diff --git a/.travis.yml b/.travis.yml index b09c348dfab..66bc3c51f8f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,43 +8,66 @@ dist: trusty language: cpp compiler: - gcc -# - clang # See commit f38808 if you want to re-enable clang builds cache: - apt: - ccache: - -# Timing on build an test needs to be < 50 minutes. The compile is ~4-5minutes -# so here we group the tests such that this happens. + - apt + - ccache +env: + matrix: + - GCC_VERSION=5 + - GCC_VERSION=6 addons: apt: + sources: + - ubuntu-toolchain-r-test +# below requires https://github.com/travis-ci/apt-source-whitelist/pull/309 +# - llvm-toolchain-trusty-3.8 +# - llvm-toolchain-trusty-3.9 +# llvm urls awaiting fix +# https://github.com/travis-ci/apt-source-whitelist/pull/288 +# https://github.com/travis-ci/apt-source-whitelist/pull/309 packages: # make sure these match debian/control contents + - gcc-5 + - g++-5 + - gcc-6 + - g++-6 - bison - chrpath - cmake - debhelper - dh-apparmor - dpatch + - gdb - libaio-dev - libboost-dev - libjudy-dev - libncurses5-dev - libpam0g-dev + - libpcre3-dev - libreadline-gplv2-dev + - libstemmer-dev - libssl-dev + - libnuma-dev + - libxml2-dev - lsb-release - perl - po-debconf - psmisc - zlib1g-dev - - libcrack2-dev # no effect as the package is disallowed on Travis-CI + - libcrack2-dev - libjemalloc-dev - devscripts # implicit for any build on Ubuntu +# libsnappy-dev # https://github.com/travis-ci/apt-package-whitelist/issues/3880 +# liblzma-dev # https://github.com/travis-ci/apt-package-whitelist/issues/3879 +# libzmq-dev # https://github.com/travis-ci/apt-package-whitelist/issues/3881 +# libsystemd-daemon-dev # https://github.com/travis-ci/apt-package-whitelist/issues/3882 + script: - - ${CC} --version ; ${CXX} --version + - export MYSQL_BUILD_CC=/usr/bin/gcc-${GCC_VERSION} MYSQL_BUILD_CXX=/usr/bin/g++-${GCC_VERSION} + - ${MYSQL_BUILD_CC} --version ; ${MYSQL_BUILD_CXX} --version - cd "${TRAVIS_BUILD_DIR}" - - env DEB_BUILD_OPTIONS="parallel=4" debian/autobake-deb.sh; + - env DEB_BUILD_OPTIONS="parallel=3" debian/autobake-deb.sh; notifications: irc: diff --git a/CMakeLists.txt b/CMakeLists.txt index e461141acc8..731afdde3d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -356,6 +356,7 @@ IF(WITH_UNIT_TESTS) ADD_SUBDIRECTORY(unittest/examples) ADD_SUBDIRECTORY(unittest/mysys) ADD_SUBDIRECTORY(unittest/my_decimal) + ADD_SUBDIRECTORY(unittest/json_lib) IF(NOT WITHOUT_SERVER) ADD_SUBDIRECTORY(unittest/sql) ENDIF() @@ -433,12 +434,6 @@ CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/cmake/info_macros.cmake.in ${CMAKE_BINARY_DIR}/info_macros.cmake @ONLY) -IF(DEB) - CONFIGURE_FILE( - ${CMAKE_SOURCE_DIR}/debian/mariadb-server-10.2.files.in - ${CMAKE_SOURCE_DIR}/debian/mariadb-server-10.2.files) -ENDIF(DEB) - # Handle the "INFO_*" files. INCLUDE(${CMAKE_BINARY_DIR}/info_macros.cmake) # Source: This can be done during the cmake phase, all information is diff --git a/CREDITS b/CREDITS index f0e6de7f08f..35ab4d48a8f 100644 --- a/CREDITS +++ b/CREDITS @@ -10,6 +10,7 @@ Visma http://visma.com (2015 - 2016) Acronis http://acronis.com (2016) Nexedi https://www.nexedi.com (2016) Automattic https://automattic.com (2014 - 2016) +Tencent Game DBA http://tencentdba.com/about (2016) Verkkokauppa.com https://www.verkkokauppa.com (2015 - 2016) Virtuozzo https://virtuozzo.com (2016) diff --git a/VERSION b/VERSION index 73750e953b1..bfea448d129 100644 --- a/VERSION +++ b/VERSION @@ -1,3 +1,3 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=2 -MYSQL_VERSION_PATCH=3 +MYSQL_VERSION_PATCH=4 diff --git a/client/mysql.cc b/client/mysql.cc index 65b7c192595..bcc86af8941 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -245,7 +245,8 @@ static void end_pager(); static void init_tee(const char *); static void end_tee(); static const char* construct_prompt(); -static char *get_arg(char *line, my_bool get_next_arg); +enum get_arg_mode { CHECK, GET, GET_NEXT}; +static char *get_arg(char *line, get_arg_mode mode); static void init_username(); static void add_int_to_prompt(int toadd); static int get_result_width(MYSQL_RES *res); @@ -2257,7 +2258,7 @@ static COMMANDS *find_command(char *name) if (!my_strnncoll(&my_charset_latin1, (uchar*) name, len, (uchar*) commands[i].name, len) && (commands[i].name[len] == '\0') && - (!end || commands[i].takes_params)) + (!end || (commands[i].takes_params && get_arg(name, CHECK)))) { index= i; break; @@ -3175,7 +3176,7 @@ com_charset(String *buffer __attribute__((unused)), char *line) char buff[256], *param; CHARSET_INFO * new_cs; strmake_buf(buff, line); - param= get_arg(buff, 0); + param= get_arg(buff, GET); if (!param || !*param) { return put_info("Usage: \\C charset_name | charset charset_name", @@ -4260,12 +4261,12 @@ com_connect(String *buffer, char *line) #ifdef EXTRA_DEBUG tmp[1]= 0; #endif - tmp= get_arg(buff, 0); + tmp= get_arg(buff, GET); if (tmp && *tmp) { my_free(current_db); current_db= my_strdup(tmp, MYF(MY_WME)); - tmp= get_arg(buff, 1); + tmp= get_arg(buff, GET_NEXT); if (tmp) { my_free(current_host); @@ -4368,7 +4369,7 @@ com_delimiter(String *buffer __attribute__((unused)), char *line) char buff[256], *tmp; strmake_buf(buff, line); - tmp= get_arg(buff, 0); + tmp= get_arg(buff, GET); if (!tmp || !*tmp) { @@ -4399,7 +4400,7 @@ com_use(String *buffer __attribute__((unused)), char *line) bzero(buff, sizeof(buff)); strmake_buf(buff, line); - tmp= get_arg(buff, 0); + tmp= get_arg(buff, GET); if (!tmp || !*tmp) { put_info("USE must be followed by a database name", INFO_ERROR); @@ -4484,23 +4485,22 @@ com_nowarnings(String *buffer __attribute__((unused)), } /* - Gets argument from a command on the command line. If get_next_arg is - not defined, skips the command and returns the first argument. The - line is modified by adding zero to the end of the argument. If - get_next_arg is defined, then the function searches for end of string - first, after found, returns the next argument and adds zero to the - end. If you ever wish to use this feature, remember to initialize all - items in the array to zero first. + Gets argument from a command on the command line. If mode is not GET_NEXT, + skips the command and returns the first argument. The line is modified by + adding zero to the end of the argument. If mode is GET_NEXT, then the + function searches for end of string first, after found, returns the next + argument and adds zero to the end. If you ever wish to use this feature, + remember to initialize all items in the array to zero first. */ -char *get_arg(char *line, my_bool get_next_arg) +static char *get_arg(char *line, get_arg_mode mode) { char *ptr, *start; - my_bool quoted= 0, valid_arg= 0; + bool short_cmd= false; char qtype= 0; ptr= line; - if (get_next_arg) + if (mode == GET_NEXT) { for (; *ptr; ptr++) ; if (*(ptr + 1)) @@ -4511,7 +4511,7 @@ char *get_arg(char *line, my_bool get_next_arg) /* skip leading white spaces */ while (my_isspace(charset_info, *ptr)) ptr++; - if (*ptr == '\\') // short command was used + if ((short_cmd= *ptr == '\\')) // short command was used ptr+= 2; else while (*ptr &&!my_isspace(charset_info, *ptr)) // skip command @@ -4524,24 +4524,28 @@ char *get_arg(char *line, my_bool get_next_arg) if (*ptr == '\'' || *ptr == '\"' || *ptr == '`') { qtype= *ptr; - quoted= 1; ptr++; } for (start=ptr ; *ptr; ptr++) { - if (*ptr == '\\' && ptr[1]) // escaped character + if ((*ptr == '\\' && ptr[1]) || // escaped character + (!short_cmd && qtype && *ptr == qtype && ptr[1] == qtype)) // quote { - // Remove the backslash - strmov_overlapp(ptr, ptr+1); + // Remove (or skip) the backslash (or a second quote) + if (mode != CHECK) + strmov_overlapp(ptr, ptr+1); + else + ptr++; } - else if ((!quoted && *ptr == ' ') || (quoted && *ptr == qtype)) + else if (*ptr == (qtype ? qtype : ' ')) { - *ptr= 0; + qtype= 0; + if (mode != CHECK) + *ptr= 0; break; } } - valid_arg= ptr != start; - return valid_arg ? start : NullS; + return ptr != start && !qtype ? start : NullS; } @@ -5129,7 +5133,7 @@ static const char *construct_prompt() { const char *prompt; prompt= connected ? mysql_get_host_info(&mysql) : "not_connected"; - if (strstr(prompt, "Localhost")) + if (strstr(prompt, "Localhost") || strstr(prompt, "localhost ")) { if (*c == 'h') processed_prompt.append("localhost"); diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 6a52c9fe29a..558dbebc89c 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -1002,6 +1002,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, switch (ev_type) { case QUERY_EVENT: + case QUERY_COMPRESSED_EVENT: { Query_log_event *qe= (Query_log_event*)ev; if (!qe->is_trans_keyword()) @@ -1243,6 +1244,12 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, case WRITE_ROWS_EVENT_V1: case UPDATE_ROWS_EVENT_V1: case DELETE_ROWS_EVENT_V1: + case WRITE_ROWS_COMPRESSED_EVENT: + case DELETE_ROWS_COMPRESSED_EVENT: + case UPDATE_ROWS_COMPRESSED_EVENT: + case WRITE_ROWS_COMPRESSED_EVENT_V1: + case UPDATE_ROWS_COMPRESSED_EVENT_V1: + case DELETE_ROWS_COMPRESSED_EVENT_V1: { Rows_log_event *e= (Rows_log_event*) ev; if (print_row_event(print_event_info, ev, e->get_table_id(), @@ -1260,6 +1267,9 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, goto err; break; } + case START_ENCRYPTION_EVENT: + glob_description_event->start_decryption((Start_encryption_log_event*)ev); + /* fall through */ default: print_skip_replication_statement(print_event_info, ev); ev->print(result_file, print_event_info); @@ -2832,9 +2842,16 @@ err: } +uint dummy1() { return 1; } struct encryption_service_st encryption_handler= { - 0, 0, 0, 0, 0, 0, 0 + (uint(*)(uint))dummy1, + (uint(*)(uint, uint, uchar*, uint*))dummy1, + (uint(*)(uint, uint))dummy1, + (int (*)(void*, const uchar*, uint, const uchar*, uint, int, uint, uint))dummy1, + (int (*)(void*, const uchar*, uint, uchar*, uint*))dummy1, + (int (*)(void*, uchar*, uint*))dummy1, + (uint (*)(uint, uint, uint))dummy1 }; /* diff --git a/client/mysqldump.c b/client/mysqldump.c index acb72a12bf3..c5c94e07e96 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -577,9 +577,7 @@ static int dump_all_tablespaces(); static int dump_tablespaces_for_tables(char *db, char **table_names, int tables); static int dump_tablespaces_for_databases(char** databases); static int dump_tablespaces(char* ts_where); -static void print_comment(FILE *sql_file, my_bool is_error, const char *format, - ...); - +static void print_comment(FILE *, my_bool, const char *, ...); /* Print the supplied message if in verbose mode @@ -657,6 +655,30 @@ static void short_usage(FILE *f) } +/** returns a string fixed to be safely printed inside a -- comment + + that is, any new line in it gets prefixed with -- +*/ +static const char *fix_for_comment(const char *ident) +{ + static char buf[1024]; + char c, *s= buf; + + while ((c= *s++= *ident++)) + { + if (s >= buf + sizeof(buf) - 10) + { + strmov(s, "..."); + break; + } + if (c == '\n') + s= strmov(s, "-- "); + } + + return buf; +} + + static void write_header(FILE *sql_file, char *db_name) { if (opt_xml) @@ -679,8 +701,8 @@ static void write_header(FILE *sql_file, char *db_name) DUMP_VERSION, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); print_comment(sql_file, 0, "-- Host: %s Database: %s\n", - current_host ? current_host : "localhost", - db_name ? db_name : ""); + fix_for_comment(current_host ? current_host : "localhost"), + fix_for_comment(db_name ? db_name : "")); print_comment(sql_file, 0, "-- ------------------------------------------------------\n" ); @@ -2252,7 +2274,8 @@ static uint dump_events_for_db(char *db) /* nice comments */ print_comment(sql_file, 0, - "\n--\n-- Dumping events for database '%s'\n--\n", db); + "\n--\n-- Dumping events for database '%s'\n--\n", + fix_for_comment(db)); /* not using "mysql_query_with_error_report" because we may have not @@ -2464,7 +2487,8 @@ static uint dump_routines_for_db(char *db) /* nice comments */ print_comment(sql_file, 0, - "\n--\n-- Dumping routines for database '%s'\n--\n", db); + "\n--\n-- Dumping routines for database '%s'\n--\n", + fix_for_comment(db)); /* not using "mysql_query_with_error_report" because we may have not @@ -2760,11 +2784,11 @@ static uint get_table_structure(char *table, char *db, char *table_type, if (strcmp (table_type, "VIEW") == 0) /* view */ print_comment(sql_file, 0, "\n--\n-- Temporary table structure for view %s\n--\n\n", - result_table); + fix_for_comment(result_table)); else print_comment(sql_file, 0, "\n--\n-- Table structure for table %s\n--\n\n", - result_table); + fix_for_comment(result_table)); if (opt_drop) { @@ -3008,7 +3032,7 @@ static uint get_table_structure(char *table, char *db, char *table_type, print_comment(sql_file, 0, "\n--\n-- Table structure for table %s\n--\n\n", - result_table); + fix_for_comment(result_table)); if (opt_drop) fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n", result_table); if (!opt_xml) @@ -3717,21 +3741,21 @@ static void dump_table(char *table, char *db) { print_comment(md_result_file, 0, "\n--\n-- Dumping data for table %s\n--\n", - result_table); + fix_for_comment(result_table)); dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ * FROM "); dynstr_append_checked(&query_string, result_table); if (where) { - print_comment(md_result_file, 0, "-- WHERE: %s\n", where); + print_comment(md_result_file, 0, "-- WHERE: %s\n", fix_for_comment(where)); dynstr_append_checked(&query_string, " WHERE "); dynstr_append_checked(&query_string, where); } if (order_by) { - print_comment(md_result_file, 0, "-- ORDER BY: %s\n", order_by); + print_comment(md_result_file, 0, "-- ORDER BY: %s\n", fix_for_comment(order_by)); dynstr_append_checked(&query_string, " ORDER BY "); dynstr_append_checked(&query_string, order_by); @@ -4241,7 +4265,7 @@ static int dump_tablespaces(char* ts_where) if (first) { print_comment(md_result_file, 0, "\n--\n-- Logfile group: %s\n--\n", - row[0]); + fix_for_comment(row[0])); fprintf(md_result_file, "\nCREATE"); } @@ -4310,7 +4334,8 @@ static int dump_tablespaces(char* ts_where) first= 1; if (first) { - print_comment(md_result_file, 0, "\n--\n-- Tablespace: %s\n--\n", row[0]); + print_comment(md_result_file, 0, "\n--\n-- Tablespace: %s\n--\n", + fix_for_comment(row[0])); fprintf(md_result_file, "\nCREATE"); } else @@ -4514,7 +4539,8 @@ static int init_dumping(char *database, int init_func(char*)) char *qdatabase= quote_name(database,quoted_database_buf,opt_quoted); print_comment(md_result_file, 0, - "\n--\n-- Current Database: %s\n--\n", qdatabase); + "\n--\n-- Current Database: %s\n--\n", + fix_for_comment(qdatabase)); /* Call the view or table specific function */ init_func(qdatabase); @@ -5774,7 +5800,7 @@ static my_bool get_view_structure(char *table, char* db) print_comment(sql_file, 0, "\n--\n-- Final view structure for view %s\n--\n\n", - result_table); + fix_for_comment(result_table)); /* Table might not exist if this view was dumped with --tab. */ fprintf(sql_file, "/*!50001 DROP TABLE IF EXISTS %s*/;\n", opt_quoted_table); diff --git a/client/mysqltest.cc b/client/mysqltest.cc index cae33fd5522..c7b049ac45d 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -1731,11 +1731,11 @@ int cat_file(DYNAMIC_STRING* ds, const char* filename) while((len= my_read(fd, (uchar*)&buff, sizeof(buff)-1, MYF(0))) > 0) { - char *p= buff, *start= buff; - while (p < buff+len) + char *p= buff, *start= buff,*end=buff+len; + while (p < end) { /* Convert cr/lf to lf */ - if (*p == '\r' && *(p+1) && *(p+1)== '\n') + if (*p == '\r' && p+1 < end && *(p+1)== '\n') { /* Add fake newline instead of cr and output the line */ *p= '\n'; @@ -3373,10 +3373,6 @@ void do_exec(struct st_command *command) #endif #endif - /* exec command is interpreted externally and will not take newlines */ - while(replace(&ds_cmd, "\n", 1, " ", 1) == 0) - ; - DBUG_PRINT("info", ("Executing '%s' as '%s'", command->first_argument, ds_cmd.str)); @@ -3395,16 +3391,32 @@ void do_exec(struct st_command *command) ds_result= &ds_sorted; } +#ifdef _WIN32 + /* Workaround for CRT bug, MDEV-9409 */ + _setmode(fileno(res_file), O_BINARY); +#endif + while (fgets(buf, sizeof(buf), res_file)) { + int len = (int)strlen(buf); +#ifdef _WIN32 + /* Strip '\r' off newlines. */ + if (len > 1 && buf[len-2] == '\r' && buf[len-1] == '\n') + { + buf[len-2] = '\n'; + buf[len-1] = 0; + len--; + } +#endif if (disable_result_log) { - buf[strlen(buf)-1]=0; + if (len) + buf[len-1] = 0; DBUG_PRINT("exec_result",("%s", buf)); } else { - replace_dynstr_append(ds_result, buf); + replace_dynstr_append_mem(ds_result, buf, len); } } error= pclose(res_file); diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index ef9713e0556..363cbac584d 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -83,7 +83,8 @@ IF(FEATURE_SET) ENDIF() OPTION(ENABLED_LOCAL_INFILE "" ON) -IF(RPM) +IF(WIN32) +ELSEIF(RPM) SET(WITH_SSL system CACHE STRING "") SET(WITH_ZLIB system CACHE STRING "") ELSEIF(DEB) diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index 88e4e06c743..dced85f3a22 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -157,7 +157,7 @@ SETA(CPACK_RPM_server_PACKAGE_REQUIRES IF(WITH_WSREP) SETA(CPACK_RPM_server_PACKAGE_REQUIRES "galera" "rsync" "lsof" "grep" "gawk" "iproute" - "coreutils" "findutils" "tar") + "coreutils" "findutils" "tar" "which") ENDIF() SET(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-prein.sh) @@ -223,6 +223,9 @@ SETA(CPACK_RPM_test_PACKAGE_PROVIDES "perl(mtr_io.pl)" "perl(mtr_match)" "perl(mtr_misc.pl)" + "perl(mtr_gcov.pl)" + "perl(mtr_gprof.pl)" + "perl(mtr_process.pl)" "perl(mtr_report)" "perl(mtr_results)" "perl(mtr_unique)") diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index 17ee3c61554..88dc2a47c6b 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -202,6 +202,7 @@ IF(WIN32) FIND_PROGRAM(SIGNTOOL_EXECUTABLE signtool PATHS "$ENV{ProgramFiles}/Microsoft SDKs/Windows/v7.0A/bin" "$ENV{ProgramFiles}/Windows Kits/8.0/bin/x86" + "$ENV{ProgramFiles}/Windows Kits/8.1/bin/x86" ) IF(NOT SIGNTOOL_EXECUTABLE) MESSAGE(FATAL_ERROR diff --git a/cmake/mysql_version.cmake b/cmake/mysql_version.cmake index 5033c8b5213..87d61fcf344 100644 --- a/cmake/mysql_version.cmake +++ b/cmake/mysql_version.cmake @@ -90,8 +90,8 @@ ENDIF() IF(NOT CPACK_SOURCE_PACKAGE_FILE_NAME) SET(CPACK_SOURCE_PACKAGE_FILE_NAME "mariadb-${VERSION}") ENDIF() -SET(CPACK_PACKAGE_CONTACT "MariaDB team ") -SET(CPACK_PACKAGE_VENDOR "Monty Program AB") +SET(CPACK_PACKAGE_CONTACT "MariaDB Developers ") +SET(CPACK_PACKAGE_VENDOR "MariaDB Foundation") SET(CPACK_SOURCE_GENERATOR "TGZ") # Defintions for windows version resources diff --git a/cmake/numa.cmake b/cmake/numa.cmake new file mode 100644 index 00000000000..4bace0ee7f4 --- /dev/null +++ b/cmake/numa.cmake @@ -0,0 +1,43 @@ +MACRO (MYSQL_CHECK_NUMA) + + IF(CMAKE_SYSTEM_NAME MATCHES "Linux") + CHECK_INCLUDE_FILES(numa.h HAVE_NUMA_H) + CHECK_INCLUDE_FILES(numaif.h HAVE_NUMAIF_H) + + IF(HAVE_NUMA_H AND HAVE_NUMAIF_H) + OPTION(WITH_NUMA "Explicitly set NUMA memory allocation policy" ON) + ELSE() + OPTION(WITH_NUMA "Explicitly set NUMA memory allocation policy" OFF) + ENDIF() + + IF(WITH_NUMA AND HAVE_NUMA_H AND HAVE_NUMAIF_H) + SET(SAVE_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} numa) + CHECK_C_SOURCE_COMPILES( + " + #include + #include + int main() + { + struct bitmask *all_nodes= numa_all_nodes_ptr; + set_mempolicy(MPOL_DEFAULT, 0, 0); + return all_nodes != NULL; + }" + HAVE_LIBNUMA) + SET(CMAKE_REQUIRED_LIBRARIES ${SAVE_CMAKE_REQUIRED_LIBRARIES}) + IF(HAVE_LIBNUMA) + ADD_DEFINITIONS(-DHAVE_LIBNUMA=1) + SET(NUMA_LIBRARY "numa") + ENDIF() + ENDIF() + + IF(WITH_NUMA AND NOT HAVE_LIBNUMA) + # Forget it in cache, abort the build. + UNSET(WITH_NUMA CACHE) + UNSET(NUMA_LIBRARY CACHE) + MESSAGE(FATAL_ERROR "Could not find numa headers/libraries") + ENDIF() + ENDIF() + +ENDMACRO() + diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index 1395c70e53c..67108132d8a 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -115,7 +115,7 @@ IF(MSVC) #TODO: update the code and remove the disabled warnings SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /wd4291 /we4099") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /wd4291 /wd4577 /we4099") IF(CMAKE_SIZEOF_VOID_P MATCHES 8) # _WIN64 is defined by the compiler itself. diff --git a/cmake/package_name.cmake b/cmake/package_name.cmake index c1c335f91f9..4930a6bf40a 100644 --- a/cmake/package_name.cmake +++ b/cmake/package_name.cmake @@ -30,6 +30,10 @@ IF(NOT VERSION) SET(64BIT 1) ENDIF() + IF(NOT 64BIT AND CMAKE_SYSTEM_PROCESSOR MATCHES "^mips64") + SET(DEFAULT_MACHINE "mips") + ENDIF() + IF(CMAKE_SYSTEM_NAME MATCHES "Windows") SET(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE 0) SET(DEFAULT_PLATFORM "win") diff --git a/cmake/readline.cmake b/cmake/readline.cmake index 1bd669fd605..12a8980b6a9 100644 --- a/cmake/readline.cmake +++ b/cmake/readline.cmake @@ -207,5 +207,6 @@ MACRO (MYSQL_CHECK_READLINE) SET(CMAKE_REQUIRED_LIBRARIES) SET(CMAKE_REQUIRED_INCLUDES) ENDIF(NOT WIN32) + CHECK_INCLUDE_FILES ("curses.h;term.h" HAVE_TERM_H) ENDMACRO() diff --git a/cmake/systemd.cmake b/cmake/systemd.cmake index 1121fd64dce..9b51fb76799 100644 --- a/cmake/systemd.cmake +++ b/cmake/systemd.cmake @@ -56,12 +56,6 @@ MACRO(CHECK_SYSTEMD) AND HAVE_SYSTEMD_SD_NOTIFY AND HAVE_SYSTEMD_SD_NOTIFYF) ADD_DEFINITIONS(-DHAVE_SYSTEMD) SET(SYSTEMD_SCRIPTS mariadb-service-convert galera_new_cluster galera_recovery) - SET(SYSTEMD_DEB_FILES "usr/bin/mariadb-service-convert - usr/bin/galera_new_cluster - usr/bin/galera_recovery - ${INSTALL_SYSTEMD_UNITDIR}/mariadb.service - ${INSTALL_SYSTEMD_UNITDIR}/mariadb@.service - ${INSTALL_SYSTEMD_UNITDIR}/mariadb@bootstrap.service.d/use_galera_new_cluster.conf") IF(DEB) SET(SYSTEMD_EXECSTARTPRE "ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld") SET(SYSTEMD_EXECSTARTPOST "ExecStartPost=/etc/mysql/debian-start") diff --git a/configure.cmake b/configure.cmake index 8dbc3aa18b5..ffcb9ba83b9 100644 --- a/configure.cmake +++ b/configure.cmake @@ -225,7 +225,6 @@ CHECK_INCLUDE_FILES (sys/socket.h HAVE_SYS_SOCKET_H) CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H) CHECK_INCLUDE_FILES (sys/stream.h HAVE_SYS_STREAM_H) CHECK_INCLUDE_FILES (sys/syscall.h HAVE_SYS_SYSCALL_H) -CHECK_INCLUDE_FILES ("curses.h;term.h" HAVE_TERM_H) CHECK_INCLUDE_FILES (asm/termbits.h HAVE_ASM_TERMBITS_H) CHECK_INCLUDE_FILES (termbits.h HAVE_TERMBITS_H) CHECK_INCLUDE_FILES (termios.h HAVE_TERMIOS_H) diff --git a/debian/additions/debian-start b/debian/additions/debian-start old mode 100644 new mode 100755 index 9fd0030d0ec..dea22c48f76 --- a/debian/additions/debian-start +++ b/debian/additions/debian-start @@ -1,27 +1,32 @@ #!/bin/bash # # This script is executed by "/etc/init.d/mysql" on every (re)start. -# +# # Changes to this file will be preserved when updating the Debian package. # source /usr/share/mysql/debian-start.inc.sh +if [ -f /etc/default/mysql ]; then + . /etc/default/mysql +fi + MYSQL="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf" MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" MYUPGRADE="/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf" MYCHECK="/usr/bin/mysqlcheck --defaults-file=/etc/mysql/debian.cnf" MYCHECK_SUBJECT="WARNING: mysqlcheck has found corrupt tables" MYCHECK_PARAMS="--all-databases --fast --silent" -MYCHECK_RCPT="root" +MYCHECK_RCPT="${MYCHECK_RCPT:-root}" + +## Checking for corrupt, not cleanly closed (only for MyISAM and Aria engines) and upgrade needing tables. # The following commands should be run when the server is up but in background # where they do not block the server start and in one shell instance so that # they run sequentially. They are supposed not to echo anything to stdout. # If you want to disable the check for crashed tables comment -# "check_for_crashed_tables" out. +# "check_for_crashed_tables" out. # (There may be no output to stdout inside the background process!) -echo "Checking for corrupt, not cleanly closed and upgrade needing tables." # Need to ignore SIGHUP, as otherwise a SIGHUP can sometimes abort the upgrade # process in the middle. diff --git a/debian/additions/debian-start.inc.sh b/debian/additions/debian-start.inc.sh old mode 100644 new mode 100755 index f50712882c1..cfe51936613 --- a/debian/additions/debian-start.inc.sh +++ b/debian/additions/debian-start.inc.sh @@ -3,7 +3,7 @@ # This file is included by /etc/mysql/debian-start # -## Check all unclosed tables. +## Check MyISAM and Aria unclosed tables. # - Requires the server to be up. # - Is supposed to run silently in background. function check_for_crashed_tables() { @@ -11,20 +11,27 @@ function check_for_crashed_tables() { set -u # But do it in the background to not stall the boot process. - logger -p daemon.info -i -t$0 "Triggering myisam-recover for all MyISAM tables" + logger -p daemon.info -i -t$0 "Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables" # Checking for $? is unreliable so the size of the output is checked. # Some table handlers like HEAP do not support CHECK TABLE. tempfile=`tempfile` - # We have to use xargs in this case, because a for loop barfs on the - # spaces in the thing to be looped over. + + # We have to use xargs in this case, because a for loop barfs on the + # spaces in the thing to be looped over. + + # If a crashed table is encountered, the "mysql" command will return with a status different from 0 + set +e + LC_ALL=C $MYSQL --skip-column-names --batch -e ' select concat('\''select count(*) into @discard from `'\'', TABLE_SCHEMA, '\''`.`'\'', TABLE_NAME, '\''`'\'') - from information_schema.TABLES where ENGINE='\''MyISAM'\' | \ + from information_schema.TABLES where TABLE_SCHEMA<>'\''INFORMATION_SCHEMA'\'' and TABLE_SCHEMA<>'\''PERFORMANCE_SCHEMA'\'' and ( ENGINE='\''MyISAM'\'' or ENGINE='\''Aria'\'' )' | \ xargs -i $MYSQL --skip-column-names --silent --batch \ - --force -e "{}" >$tempfile - if [ -s $tempfile ]; then + --force -e "{}" &>$tempfile + set -e + + if [ -s "$tempfile" ]; then ( /bin/echo -e "\n" \ "Improperly closed tables are also reported if clients are accessing\n" \ diff --git a/debian/additions/echo_stderr b/debian/additions/echo_stderr old mode 100644 new mode 100755 diff --git a/debian/additions/mariadb.cnf b/debian/additions/mariadb.cnf index 927e9d1ce88..da21212faef 100644 --- a/debian/additions/mariadb.cnf +++ b/debian/additions/mariadb.cnf @@ -15,3 +15,5 @@ #collation-server = utf8_general_ci #character_set_server = utf8 #collation_server = utf8_general_ci +# Import all .cnf files from configuration directory +!includedir /etc/mysql/mariadb.conf.d/ diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh index b597ec036b3..198cba8a467 100755 --- a/debian/autobake-deb.sh +++ b/debian/autobake-deb.sh @@ -1,15 +1,11 @@ #!/bin/bash - -# Build MariaDB .deb packages. -# Based on OurDelta .deb packaging scripts, which are in turn based on Debian -# MySQL packages. +# +# Build MariaDB .deb packages for test and release at mariadb.org +# # Exit immediately on any error set -e -# Debug script and command lines -#set -x - # On Buildbot, don't run the mysql-test-run test suite as part of build. # It takes a lot of time, and we will do a better test anyway in # Buildbot, running the test suite from installed .debs on a clean VM. @@ -21,53 +17,93 @@ then export DEB_BUILD_OPTIONS="nocheck" fi -export MARIADB_OPTIONAL_DEBS="" - -# Find major.minor version. -# -source ./VERSION -UPSTREAM="${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}.${MYSQL_VERSION_PATCH}${MYSQL_VERSION_EXTRA}" -RELEASE_EXTRA="" - -RELEASE_NAME="" -PATCHLEVEL="+maria" -LOGSTRING="MariaDB build" - -# Look up distro-version specific stuff. - -CODENAME="$(lsb_release -sc)" - -# add libcrack2 (>= 2.9.0) as a build dependency -# but only where the distribution can possibly satisfy it and if not on Travis-CI -if $TRAVIS || apt-cache madison cracklib2|grep 'cracklib2 *| *2\.[0-8]\.' >/dev/null 2>&1 +# Travis-CI optimizations +if [[ $TRAVIS ]] then - # Anything in MARIADB_OPTIONAL_DEBS is omitted from the resulting - # packages by snipped in rules file - MARIADB_OPTIONAL_DEBS="${MARIADB_OPTIONAL_DEBS} cracklib-password-check-10.2" - sed -i -e "/\\\${MAYBE_LIBCRACK}/d" debian/control - # Remove package entry from control file completely so that - # resulting Debian source package will actually be buildable - sed -i -e "/Package: mariadb-cracklib-password-check/,+6d" debian/control -else - MAYBE_LIBCRACK='libcrack2-dev (>= 2.9.0),' - sed -i -e "s/\\\${MAYBE_LIBCRACK}/${MAYBE_LIBCRACK}/g" debian/control + # On Travis-CI, the log must stay under 4MB so make the build less verbose + sed -i -e '/Add support for verbose builds/,+2d' debian/rules + + # Don't include test suite package on Travis-CI to make the build time shorter + sed '/Package: mariadb-test-data/,+26d' -i debian/control + sed '/Package: mariadb-test/,+34d' -i debian/control fi -# Adjust changelog, add new version. + +# Look up distro-version specific stuff # +# Always keep the actual packaging as up-to-date as possible following the latest +# Debian policy and targetting Debian Sid. Then case-by-case run in autobake-deb.sh +# tests for backwards compatibility and strip away parts on older builders. + +# If iproute2 is not available (before Debian Jessie and Ubuntu Trusty) +# fall back to the old iproute package. +if ! apt-cache madison iproute2 | grep 'iproute2 *|' >/dev/null 2>&1 +then + sed 's/iproute2/iproute/' -i debian/control +fi + +# If libcrack2 (>= 2.9.0) is not available (before Debian Jessie and Ubuntu Trusty) +# clean away the cracklib stanzas so the package can build without them. +if ! apt-cache madison libcrack2-dev | grep 'libcrack2-dev *| *2\.9' >/dev/null 2>&1 +then + sed '/libcrack2-dev/d' -i debian/control + sed '/Package: mariadb-plugin-cracklib/,+9d' -i debian/control +fi + +# If libpcre3-dev (>= 2:8.35-3.2~) is not available (before Debian Jessie or Ubuntu Wily) +# clean away the PCRE3 stanzas so the package can build without them. +# Update check when version 2:8.40 or newer is available. +if ! apt-cache madison libpcre3-dev | grep 'libpcre3-dev *| *2:8\.3[2-9]' >/dev/null 2>&1 +then + sed '/libpcre3-dev/d' -i debian/control +fi + +# If libsystemd-dev is not available (before Debian Jessie or Ubuntu Wily) +# clean away the systemd stanzas so the package can build without them. +if ! apt-cache madison libsystemd-dev | grep 'libsystemd-dev' >/dev/null 2>&1 +then + sed '/dh-systemd/d' -i debian/control + sed '/libsystemd-dev/d' -i debian/control + sed 's/ --with systemd//' -i debian/rules + sed '/systemd/d' -i debian/rules + sed '/\.service/d' -i debian/rules + sed '/galera_new_cluster/d' -i debian/mariadb-server-10.2.install + sed '/galera_recovery/d' -i debian/mariadb-server-10.2.install + sed '/mariadb-service-convert/d' -i debian/mariadb-server-10.2.install +fi + +# Adjust changelog, add new version echo "Incrementing changelog and starting build scripts" -dch -b -D ${CODENAME} -v "${UPSTREAM}${PATCHLEVEL}-${RELEASE_NAME}${RELEASE_EXTRA:+-${RELEASE_EXTRA}}1~${CODENAME}" "Automatic build with ${LOGSTRING}." +# Find major.minor version +source ./VERSION +UPSTREAM="${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}.${MYSQL_VERSION_PATCH}${MYSQL_VERSION_EXTRA}" +PATCHLEVEL="+maria" +LOGSTRING="MariaDB build" +CODENAME="$(lsb_release -sc)" -echo "Creating package version ${UPSTREAM}${PATCHLEVEL}-${RELEASE_NAME}${RELEASE_EXTRA:+-${RELEASE_EXTRA}}1~${CODENAME} ... " +dch -b -D ${CODENAME} -v "${UPSTREAM}${PATCHLEVEL}~${CODENAME}" "Automatic build with ${LOGSTRING}." -# Build the package. +echo "Creating package version ${UPSTREAM}${PATCHLEVEL}~${CODENAME} ... " + +# Build the package # Pass -I so that .git and other unnecessary temporary and source control files -# will be ignored by dpkg-source when createing the tar.gz source package -fakeroot dpkg-buildpackage -us -uc -I +# will be ignored by dpkg-source when creating the tar.gz source package. +# Use -b to build binary only packages as there is no need to waste time on +# generating the source package. +fakeroot dpkg-buildpackage -us -uc -I -b -[ -e debian/autorm-file ] && rm -vf `cat debian/autorm-file` +# Don't log package contents on Travis-CI to save time and log size +if [[ ! $TRAVIS ]] +then + echo "List package contents ..." + cd .. + for package in `ls *.deb` + do + echo $package | cut -d '_' -f 1 + dpkg-deb -c $package | awk '{print $1 " " $2 " " $6}' | sort -k 3 + echo "------------------------------------------------" + done +fi echo "Build complete" - -# end of autobake script diff --git a/debian/compat b/debian/compat index 7ed6ff82de6..ec635144f60 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -5 +9 diff --git a/debian/control b/debian/control index 8fa4b6e5a33..d0ecf4bddc3 100644 --- a/debian/control +++ b/debian/control @@ -2,40 +2,43 @@ Source: mariadb-10.2 Section: database Priority: optional Maintainer: MariaDB Developers -Uploaders: MariaDB Developers Build-Depends: bison, chrpath, cmake (>= 2.7), - debhelper, + debhelper (>= 9), dh-apparmor, + dh-systemd, dpatch, - libaio-dev, + gdb, + libaio-dev [linux-any], libboost-dev, + libcrack2-dev (>= 2.9.0), + libjemalloc-dev (>= 3.0.0~) [linux-any], libjudy-dev, libkrb5-dev, libncurses5-dev (>= 5.0-6~), + libnuma-dev, libpam0g-dev, + libpcre3-dev (>= 2:8.35-3.2~), libreadline-gplv2-dev, libssl-dev, + libsystemd-dev, + libxml2-dev, lsb-release, perl (>= 5.6.0), po-debconf, psmisc, - zlib1g-dev (>= 1:1.1.3-5~), - ${MAYBE_LIBCRACK} - libjemalloc-dev (>= 3.0.0~) [linux-any] + unixodbc-dev, + zlib1g-dev (>= 1:1.1.3-5~) Standards-Version: 3.8.2 Homepage: http://mariadb.org/ Vcs-Git: https://github.com/MariaDB/server.git Vcs-Browser: https://github.com/MariaDB/server/ -Package: libmariadbclient18 +Package: libmariadb3 Architecture: any Section: libs -Depends: libmysqlclient18 (= ${source:Version}), - mariadb-common, - ${misc:Depends}, - ${shlibs:Depends} +Depends: mariadb-common, ${misc:Depends}, ${shlibs:Depends} Conflicts: mariadb-galera-server-10.0 (<< 10.0.5), mariadb-galera-server-5.5 (<< 5.5.33), mariadb-server-10.0 (<< 10.0.5), @@ -43,6 +46,14 @@ Conflicts: mariadb-galera-server-10.0 (<< 10.0.5), mariadb-server-5.2, mariadb-server-5.3, mariadb-server-5.5 (<< 5.5.33) +Replaces: libmariadbclient18, + libmysqlclient18, + libmysqlclient19, + libmysqlclient20 +Provides: libmariadbclient18, + libmysqlclient18, + libmysqlclient19, + libmysqlclient20 Description: MariaDB database client library MariaDB is a fast, stable and true multi-user, multi-threaded SQL database server. SQL (Structured Query Language) is the most popular database query @@ -51,52 +62,48 @@ Description: MariaDB database client library . This package includes the client library. +Package: libmariadbclient18 +Section: libs +Architecture: any +Depends: libmariadb3 (= ${binary:Version}), ${misc:Depends} +Description: Virtual package to satisfy external depends + MariaDB is a fast, stable and true multi-user, multi-threaded SQL database + server. SQL (Structured Query Language) is the most popular database query + language in the world. The main goals of MariaDB are speed, robustness and + ease of use. + . + This is an empty package that depends on the libmariadb3 + package. + Package: libmysqlclient18 Section: libs Architecture: any -Depends: libmariadbclient18 (= ${source:Version}) -Replaces: libmysqlclient18 (<< ${source:Version}) +Depends: libmariadb3 (= ${binary:Version}), ${misc:Depends} Description: Virtual package to satisfy external depends - This is an empty package that provides an updated "best" version of - libmysqlclient18 that does not conflict with the libmariadbclient18 + MariaDB is a fast, stable and true multi-user, multi-threaded SQL database + server. SQL (Structured Query Language) is the most popular database query + language in the world. The main goals of MariaDB are speed, robustness and + ease of use. + . + This is an empty package that depends on the libmariadb3 package. - . - MariaDB is a fast, stable and true multi-user, multi-threaded SQL database - server. SQL (Structured Query Language) is the most popular database query - language in the world. The main goals of MariaDB are speed, robustness and - ease of use. -Package: libmariadbd-dev +Package: libmariadb-dev Architecture: any Section: libdevel -Depends: libmariadbclient-dev (>= ${source:Version}), ${misc:Depends} -Provides: libmysqld-dev -Conflicts: libmysqld-dev -Replaces: libmysqld-dev -Description: MariaDB embedded database, development files - MariaDB is a fast, stable and true multi-user, multi-threaded SQL database - server. SQL (Structured Query Language) is the most popular database query - language in the world. The main goals of MariaDB are speed, robustness and - ease of use. - . - This package includes the embedded server library and header files. - -Package: libmariadbclient-dev -Architecture: any -Section: libdevel -Depends: libmariadbclient18 (>= ${source:Version}), +Depends: libmariadb3 (= ${binary:Version}), zlib1g-dev, ${misc:Depends}, ${shlibs:Depends} -Replaces: libmariadbclient16-dev, libmysqlclient16-dev +Breaks: libmariadbclient-dev, libmysqlclient-dev +Replaces: libmariadbclient-dev, libmysqlclient-dev Conflicts: libmariadbclient16-dev, - libmysqlclient-dev, libmysqlclient10-dev, libmysqlclient12-dev, libmysqlclient14-dev, libmysqlclient15-dev, libmysqlclient16-dev -Provides: libmysqlclient-dev +Provides: libmariadbclient-dev, libmariadbclient-dev-compat, libmysqlclient-dev Description: MariaDB database development files MariaDB is a fast, stable and true multi-user, multi-threaded SQL database server. SQL (Structured Query Language) is the most popular database query @@ -105,6 +112,40 @@ Description: MariaDB database development files . This package includes development libraries and header files. +Package: libmariadbd19 +Architecture: any +Section: libs +Depends: ${misc:Depends}, ${shlibs:Depends} +Multi-Arch: same +Breaks: libmariadbd-dev (<< ${source:Version}) +Replaces: libmariadbd-dev (<< ${source:Version}) +Description: MariaDB embedded database, shared library + MariaDB is a fast, stable and true multi-user, multi-threaded SQL database + server. SQL (Structured Query Language) is the most popular database query + language in the world. The main goals of MariaDB are speed, robustness and + ease of use. + . + This package includes a shared library for embedded MariaDB applications + +Package: libmariadbd-dev +Architecture: any +Section: libdevel +Provides: libmysqld-dev +Pre-Depends: ${misc:Pre-Depends} +Depends: libmariadb-dev (= ${binary:Version}), + libmariadbd19 (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends} +Breaks: libmysqld-dev +Replaces: libmysqld-dev +Description: MariaDB embedded database, development files + MariaDB is a fast, stable and true multi-user, multi-threaded SQL database + server. SQL (Structured Query Language) is the most popular database query + language in the world. The main goals of MariaDB are speed, robustness and + ease of use. + . + This package includes the embedded server library development and header files. + Package: mysql-common Architecture: all Depends: ${misc:Depends}, ${shlibs:Depends} @@ -131,23 +172,18 @@ Description: MariaDB database common files (e.g. /etc/mysql/conf.d/mariadb.cnf) Package: mariadb-client-core-10.2 Architecture: any -Depends: libmariadbclient18 (>= ${source:Version}), +Depends: libmariadb3 (>= ${source:Version}), mariadb-common (>= ${source:Version}), ${misc:Depends}, ${shlibs:Depends} -Provides: mysql-client-core, - mysql-client-core-5.1, - mysql-client-core-5.5, - mysql-client-core-5.6, - virtual-mysql-client-core -Conflicts: mariadb-client-10.1, - mariadb-client-10.0, +Conflicts: mariadb-client-10.0, + mariadb-client-10.1, mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3, mariadb-client-5.5, - mariadb-client-core-10.1, mariadb-client-core-10.0, + mariadb-client-core-10.1, mariadb-client-core-5.1, mariadb-client-core-5.2, mariadb-client-core-5.3, @@ -159,15 +195,16 @@ Conflicts: mariadb-client-10.1, mysql-client-core-5.1, mysql-client-core-5.5, mysql-client-core-5.6, + mysql-client-core-5.7, virtual-mysql-client-core -Replaces: mariadb-client-10.1, - mariadb-client-10.0, +Replaces: mariadb-client-10.0, + mariadb-client-10.1, mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3, mariadb-client-5.5, - mariadb-client-core-10.1, mariadb-client-core-10.0, + mariadb-client-core-10.1, mariadb-client-core-5.1, mariadb-client-core-5.2, mariadb-client-core-5.3, @@ -179,6 +216,14 @@ Replaces: mariadb-client-10.1, mysql-client-core-5.1, mysql-client-core-5.5, mysql-client-core-5.6, + mysql-client-core-5.7, + virtual-mysql-client-core +Provides: default-mysql-client-core, + mysql-client-core, + mysql-client-core-5.1, + mysql-client-core-5.5, + mysql-client-core-5.6, + mysql-client-core-5.7, virtual-mysql-client-core Description: MariaDB database core client binaries MariaDB is a fast, stable and true multi-user, multi-threaded SQL database @@ -191,24 +236,15 @@ Description: MariaDB database core client binaries Package: mariadb-client-10.2 Architecture: any Depends: debianutils (>=1.6), - libdbd-mysql-perl (>= 1.2202), - libdbi-perl, - libmariadbclient18 (>= ${source:Version}), + libmariadb3 (>= ${source:Version}), mariadb-client-core-10.2 (>= ${source:Version}), mariadb-common, ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends} -Suggests: libterm-readkey-perl -Provides: mysql-client, - mysql-client-4.1, - mysql-client-5.1, - mysql-client-5.5, - mysql-client-5.6, - virtual-mysql-client Conflicts: mariadb-client (<< ${source:Version}), - mariadb-client-10.1, mariadb-client-10.0, + mariadb-client-10.1, mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3, @@ -218,10 +254,11 @@ Conflicts: mariadb-client (<< ${source:Version}), mysql-client-5.1, mysql-client-5.5, mysql-client-5.6, + mysql-client-5.7, virtual-mysql-client Replaces: mariadb-client (<< ${source:Version}), - mariadb-client-10.1, mariadb-client-10.0, + mariadb-client-10.1, mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3, @@ -231,7 +268,17 @@ Replaces: mariadb-client (<< ${source:Version}), mysql-client-5.1, mysql-client-5.5, mysql-client-5.6, + mysql-client-5.7, virtual-mysql-client +Provides: default-mysql-client, + mysql-client, + mysql-client-4.1, + mysql-client-5.1, + mysql-client-5.5, + mysql-client-5.6, + mysql-client-5.7, + virtual-mysql-client +Recommends: libdbd-mysql-perl (>= 1.2202), libdbi-perl, libterm-readkey-perl Description: MariaDB database client binaries MariaDB is a fast, stable and true multi-user, multi-threaded SQL database server. SQL (Structured Query Language) is the most popular database query @@ -243,17 +290,12 @@ Description: MariaDB database client binaries Package: mariadb-server-core-10.2 Architecture: any -Depends: libmariadbclient18 (>= ${binary:Version}), +Depends: libmariadb3 (>= ${binary:Version}), mariadb-common (>= ${source:Version}), ${misc:Depends}, ${shlibs:Depends} -Provides: mysql-server-core, - mysql-server-core-5.1, - mysql-server-core-5.5, - mysql-server-core-5.6, - virtual-mysql-server-core -Conflicts: mariadb-server-core-10.1, - mariadb-server-core-10.0, +Conflicts: mariadb-server-core-10.0, + mariadb-server-core-10.1, mariadb-server-core-5.1, mariadb-server-core-5.2, mariadb-server-core-5.3, @@ -263,9 +305,18 @@ Conflicts: mariadb-server-core-10.1, mysql-server-core-5.1, mysql-server-core-5.5, mysql-server-core-5.6, + mysql-server-core-5.7, virtual-mysql-server-core -Replaces: mariadb-server-core-10.1, +Breaks: mariadb-client-10.0, + mariadb-client-10.1, + mariadb-client-10.2 (<< ${source:Version}), + mariadb-server-10.2 (<< ${source:Version}) +Replaces: mariadb-client-10.0, + mariadb-client-10.1, + mariadb-client-10.2 (<< ${source:Version}), + mariadb-server-10.2 (<< ${source:Version}), mariadb-server-core-10.0, + mariadb-server-core-10.1, mariadb-server-core-5.1, mariadb-server-core-5.2, mariadb-server-core-5.3, @@ -275,6 +326,14 @@ Replaces: mariadb-server-core-10.1, mysql-server-core-5.1, mysql-server-core-5.5, mysql-server-core-5.6, + mysql-server-core-5.7, + virtual-mysql-server-core +Provides: default-mysql-server-core, + mysql-server-core, + mysql-server-core-5.1, + mysql-server-core-5.5, + mysql-server-core-5.6, + mysql-server-core-5.7, virtual-mysql-server-core Description: MariaDB database core server files MariaDB is a fast, stable and true multi-user, multi-threaded SQL database @@ -284,48 +343,17 @@ Description: MariaDB database core server files . This package includes the core server files, as used by Akonadi. -Package: mariadb-test-10.2 -Architecture: any -Depends: mariadb-client-10.2 (= ${binary:Version}), - mariadb-server-10.2 (= ${binary:Version}) -Suggests: patch -Conflicts: mariadb-galera-server-5.5 (<< 5.5.33), - mariadb-server-5.5 (<< 5.5.33), - mariadb-test (<< ${source:Version}), - mariadb-test-10.1, - mariadb-test-10.0, - mariadb-test-5.1, - mariadb-test-5.2, - mariadb-test-5.3, - virtual-mysql-testsuite -Replaces: mariadb-test (<< ${source:Version}), - mariadb-test-10.1, - mariadb-test-10.0, - mariadb-test-5.1, - mariadb-test-5.2, - mariadb-test-5.3, - virtual-mysql-testsuite -Provides: virtual-mysql-testsuite -Description: MariaDB database regression test suite - MariaDB is a fast, stable and true multi-user, multi-threaded SQL database - server. SQL (Structured Query Language) is the most popular database query - language in the world. The main goals of MariaDB are speed, robustness and - ease of use. - . - This package includes the regression test suite. - Package: mariadb-server-10.2 Architecture: any Suggests: mailx, mariadb-test, netcat-openbsd, tinyca Recommends: libhtml-template-perl -Pre-Depends: mariadb-common, adduser (>= 3.40), debconf +Pre-Depends: adduser (>= 3.40), debconf, mariadb-common (>= ${source:Version}) Depends: bsdutils, coreutils, findutils, galera-3 (>=25.3), gawk, - grep, - iproute, + iproute2, libdbi-perl, lsb-base (>= 3.0-10), lsof, @@ -336,18 +364,17 @@ Depends: bsdutils, psmisc, rsync, socat, - tar, ${misc:Depends}, ${shlibs:Depends} -Provides: mariadb-server, mysql-server, virtual-mysql-server Conflicts: mariadb-server (<< ${source:Version}), - mariadb-server-10.1, mariadb-server-10.0, + mariadb-server-10.1, mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3, mariadb-server-5.5, mariadb-tokudb-engine-10.0, + mariadb-tokudb-engine-10.1, mariadb-tokudb-engine-5.5, mysql-server (<< ${source:Version}), mysql-server-4.1, @@ -355,17 +382,19 @@ Conflicts: mariadb-server (<< ${source:Version}), mysql-server-5.1, mysql-server-5.5, mysql-server-5.6, + mysql-server-5.7, virtual-mysql-server Replaces: libmariadbclient-dev (<< 5.5.0), libmariadbclient16 (<< 5.3.4), mariadb-server (<< ${source:Version}), - mariadb-server-10.1, mariadb-server-10.0, + mariadb-server-10.1, mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3, mariadb-server-5.5, mariadb-tokudb-engine-10.0, + mariadb-tokudb-engine-10.1, mariadb-tokudb-engine-5.5, mysql-server (<< ${source:Version}), mysql-server-4.1, @@ -373,7 +402,9 @@ Replaces: libmariadbclient-dev (<< 5.5.0), mysql-server-5.1, mysql-server-5.5, mysql-server-5.6, + mysql-server-5.7, virtual-mysql-server +Provides: default-mysql-server, virtual-mysql-server Description: MariaDB database server binaries MariaDB is a fast, stable and true multi-user, multi-threaded SQL database server. SQL (Structured Query Language) is the most popular database query @@ -384,7 +415,7 @@ Description: MariaDB database server binaries Package: mariadb-server Architecture: all -Depends: mariadb-server-10.2 (= ${source:Version}), ${misc:Depends} +Depends: mariadb-server-10.2 (>= ${source:Version}), ${misc:Depends} Description: MariaDB database server (metapackage depending on the latest version) This is an empty package that depends on the current "best" version of mariadb-server (currently mariadb-server-10.2), as determined by the MariaDB @@ -399,63 +430,187 @@ Description: MariaDB database server (metapackage depending on the latest versio Package: mariadb-client Architecture: all -Depends: mariadb-client-10.2 (= ${source:Version}), ${misc:Depends} +Depends: mariadb-client-10.2 (>= ${source:Version}), ${misc:Depends} Description: MariaDB database client (metapackage depending on the latest version) This is an empty package that depends on the current "best" version of mariadb-client (currently mariadb-client-10.2), as determined by the MariaDB maintainers. Install this package if in doubt about which MariaDB version you want, as this is the one considered to be in the best shape. -Package: mariadb-test -Architecture: all -Depends: mariadb-test-10.2 (= ${source:Version}), ${misc:Depends} -Description: MariaDB database regression test suite (metapackage for the latest version) - This is an empty package that depends on the current "best" version of - mariadb-test (currently mariadb-test-10.2), as determined by the MariaDB - maintainers. - -Package: mariadb-connect-engine-10.2 +Package: mariadb-plugin-connect Architecture: any -Depends: libxml2, mariadb-server-10.2, unixodbc -Build-Depends: libxml2-dev, - mariadb-server-10.2, - unixodbc-dev, - ${misc:Depends}, - ${shlibs:Depends} +Depends: libxml2, + mariadb-server-10.2, + unixodbc, + ${misc:Depends}, + ${shlibs:Depends} +Breaks: mariadb-connect-engine-10.1, mariadb-connect-engine-10.2 +Replaces: mariadb-connect-engine-10.1, mariadb-connect-engine-10.2 Description: Connect storage engine for MariaDB Connect engine supports a number of file formats (dbf, xml, txt, bin, etc), connections to ODBC tables and remote MySQL tables, as well as a number of other interesting features. This package contains the Connect plugin for MariaDB. -Package: mariadb-oqgraph-engine-10.2 +Package: mariadb-plugin-oqgraph Architecture: any Depends: libjudydebian1, mariadb-server-10.2, ${misc:Depends}, ${shlibs:Depends} +Breaks: mariadb-oqgraph-engine-10.1, mariadb-oqgraph-engine-10.2 +Replaces: mariadb-oqgraph-engine-10.1, mariadb-oqgraph-engine-10.2 Description: OQGraph storage engine for MariaDB The OQGraph engine is a computation engine plugin for handling hierarchies (trees) and graphs (friend-of-a-friend, etc) cleanly through standard SQL. This package contains the OQGraph plugin for MariaDB. -Package: mariadb-cracklib-password-check-10.2 -Section: database +Package: mariadb-plugin-tokudb Architecture: any -Depends: libcrack2 (>= 2.9.0), mariadb-server-10.2 +Depends: mariadb-server-10.2, ${misc:Depends}, ${shlibs:Depends} +Breaks: mariadb-server-10.0, + mariadb-server-10.1, + mariadb-server-10.2 (<< ${source:Version}) +Replaces: mariadb-server-10.0, + mariadb-server-10.1, + mariadb-server-10.2 (<< ${source:Version}) +Description: TokuDB storage engine for MariaDB + The TokuDB storage engine is for use in high-performance and write-intensive + environments, offering increased compression and better performance based + on fractal indexes. + This package contains the TokuDB plugin for MariaDB. + +Package: mariadb-plugin-mroonga +Architecture: any +Depends: mariadb-server-10.2, ${misc:Depends}, ${shlibs:Depends} +Breaks: mariadb-server-10.0, + mariadb-server-10.1, + mariadb-server-10.2 (<< ${source:Version}) +Replaces: mariadb-server-10.0, + mariadb-server-10.1, + mariadb-server-10.2 (<< ${source:Version}) +Description: Mroonga storage engine for MariaDB + Mroonga (formerly named Groonga Storage Engine) is a storage engine that + provides fast CJK-ready full text searching using column store. + This package contains the Mroonga plugin for MariaDB. + +Package: mariadb-plugin-spider +Architecture: any +Depends: mariadb-server-10.2, ${misc:Depends}, ${shlibs:Depends} +Breaks: mariadb-server-10.0, + mariadb-server-10.1, + mariadb-server-10.2 (<< ${source:Version}) +Replaces: mariadb-server-10.0, + mariadb-server-10.1, + mariadb-server-10.2 (<< ${source:Version}) +Description: Spider storage engine for MariaDB + The Spider storage engine with built-in sharding features. It supports + partitioning and xa transactions, and allows tables of different MariaDB + instances to be handled as if they were on the same insctance. It refers to one + possible implementation of ISO/IEC 9075-9:2008 SQL/MED. + +Package: mariadb-plugin-cassandra +Architecture: any +Depends: mariadb-server-10.2, ${misc:Depends}, ${shlibs:Depends} +Breaks: mariadb-server-10.0, + mariadb-server-10.1, + mariadb-server-10.2 (<< ${source:Version}) +Replaces: mariadb-server-10.0, + mariadb-server-10.1, + mariadb-server-10.2 (<< ${source:Version}) +Description: Cassandra storage engine for MariaDB + The Cassandra Storage Engine allows access to data in a Cassandra cluster from + MariaDB, combining the best of SQL and no-SQL worlds. Cassandra SE (storage + engine) makes Cassandra's column family appear as a table in MariaDB that you + can insert to, update, and select from. You can write joins against this table, + it is possible to join data that's stored in MariaDB with data that's stored in + Cassandra. + +Package: mariadb-plugin-gssapi-server +Architecture: any +Depends: libgssapi-krb5-2, + mariadb-server-10.2, + ${misc:Depends}, + ${shlibs:Depends} +Breaks: mariadb-gssapi-server-10.1, mariadb-gssapi-server-10.2 +Replaces: mariadb-gssapi-server-10.1, mariadb-gssapi-server-10.2 +Description: GSSAPI authentication plugin for MariaDB server + +Package: mariadb-plugin-gssapi-client +Architecture: any +Depends: libgssapi-krb5-2, + mariadb-client-10.2, + ${misc:Depends}, + ${shlibs:Depends} +Breaks: mariadb-gssapi-client-10.1, mariadb-gssapi-client-10.2 +Replaces: mariadb-gssapi-client-10.1, mariadb-gssapi-client-10.2 +Description: GSSAPI authentication plugin for MariaDB client + +Package: mariadb-plugin-cracklib-password-check +Architecture: any +Depends: libcrack2 (>= 2.9.0), + mariadb-server-10.2, + ${misc:Depends}, + ${shlibs:Depends} Description: CrackLib Password Validation Plugin for MariaDB This password validation plugin uses cracklib to allow only sufficiently secure (as defined by cracklib) user passwords in MariaDB. -Package: mariadb-gssapi-server-10.2 -Section: database +Package: mariadb-test Architecture: any -Depends: libgssapi-krb5-2, mariadb-server-10.2 -Conflicts: mariadb-gssapi-server-10.1 -Replaces: mariadb-gssapi-server-10.1 -Description: GSSAPI authentication plugin for MariaDB server +Depends: mariadb-client-10.2 (= ${binary:Version}), + mariadb-server-10.2 (= ${binary:Version}), + mariadb-test-data (= ${source:Version}), + ${misc:Depends}, + ${shlibs:Depends} +Breaks: mariadb-server-5.5, + mariadb-test-10.0, + mariadb-test-10.1, + mariadb-test-5.5, + mysql-testsuite, + mysql-testsuite-5.5, + mysql-testsuite-5.6, + mysql-testsuite-5.7, + virtual-mysql-testsuite +Replaces: mariadb-server-5.5, + mariadb-test-10.0, + mariadb-test-10.1, + mariadb-test-5.5, + mysql-testsuite, + mysql-testsuite-5.5, + mysql-testsuite-5.6, + mysql-testsuite-5.7, + virtual-mysql-testsuite +Provides: virtual-mysql-testsuite +Suggests: patch +Description: MariaDB database regression test suite + MariaDB is a fast, stable and true multi-user, multi-threaded SQL database + server. SQL (Structured Query Language) is the most popular database query + language in the world. The main goals of MariaDB are speed, robustness and + ease of use. + . + This package includes the regression test suite. -Package: mariadb-gssapi-client-10.2 -Section: database -Architecture: any -Depends: libgssapi-krb5-2, mariadb-client-10.2 -Conflicts: mariadb-gssapi-client-10.1 -Replaces: mariadb-gssapi-client-10.1 -Description: GSSAPI authentication plugin for MariaDB client +Package: mariadb-test-data +Architecture: all +Depends: ${misc:Depends} +Breaks: mariadb-test-10.0, + mariadb-test-10.1, + mariadb-test-5.5, + mariadb-test-data-10.0, + mysql-testsuite, + mysql-testsuite-5.5, + mysql-testsuite-5.6, + mysql-testsuite-5.7 +Replaces: mariadb-test-10.0, + mariadb-test-10.1, + mariadb-test-5.5, + mariadb-test-data-10.0, + mysql-testsuite, + mysql-testsuite-5.5, + mysql-testsuite-5.6, + mysql-testsuite-5.7 +Description: MariaDB database regression test suite - data files + MariaDB is a fast, stable and true multi-user, multi-threaded SQL database + server. SQL (Structured Query Language) is the most popular database query + language in the world. The main goals of MariaDB are speed, robustness and + ease of use. + . + This package has the architecture independent data files for the test suite. diff --git a/debian/copyright b/debian/copyright index 1a31a958b99..59c84d0e4ad 100644 --- a/debian/copyright +++ b/debian/copyright @@ -9,7 +9,7 @@ The MariaDB packages were initally made by http://ourdelta.org/, and are now managed by the MariaDB development team, maria-developers@lists.launchpad.net -MariaDB can be downloaded from https://downloads.mariadb.org/ +MariaDB can be downloaded from https://downloads.mariadb.org/ Copyright: diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 00000000000..a5af3e1f7e8 --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,5 @@ +[DEFAULT] +# Ignore requirement to use branch name 'master' to make it easier +# for contributors to work with feature and bugfix branches +# to Debian packaging +ignore-branch = True diff --git a/debian/libmariadbclient-dev.README.Maintainer b/debian/libmariadb-dev.README.Maintainer similarity index 73% rename from debian/libmariadbclient-dev.README.Maintainer rename to debian/libmariadb-dev.README.Maintainer index f24cdcd519d..99e1c662c14 100644 --- a/debian/libmariadbclient-dev.README.Maintainer +++ b/debian/libmariadb-dev.README.Maintainer @@ -1,4 +1,3 @@ The examples directory includes files that might be needed by some developers: -- header files not installed by default - the example file udf_example.c diff --git a/debian/libmariadbclient-dev.examples b/debian/libmariadb-dev.examples similarity index 100% rename from debian/libmariadbclient-dev.examples rename to debian/libmariadb-dev.examples diff --git a/debian/libmariadb-dev.install b/debian/libmariadb-dev.install new file mode 100644 index 00000000000..e11eceb704e --- /dev/null +++ b/debian/libmariadb-dev.install @@ -0,0 +1,8 @@ +usr/bin/mysql_config +usr/include/mysql/*.h +usr/include/mysql/psi/*.h +usr/lib/*/libmariadb.so +usr/lib/*/libmariadbclient.a +usr/lib/*/libmysqlservices.a +usr/share/aclocal/mysql.m4 +usr/share/pkgconfig/mariadb.pc diff --git a/debian/libmariadbclient-dev.links b/debian/libmariadb-dev.links similarity index 100% rename from debian/libmariadbclient-dev.links rename to debian/libmariadb-dev.links diff --git a/debian/libmariadb-dev.manpages b/debian/libmariadb-dev.manpages new file mode 100644 index 00000000000..3aac7f4b4a9 --- /dev/null +++ b/debian/libmariadb-dev.manpages @@ -0,0 +1 @@ +debian/tmp/usr/share/man/man1/mysql_config.1 diff --git a/debian/libmariadb3.install b/debian/libmariadb3.install new file mode 100644 index 00000000000..cdb1e5918df --- /dev/null +++ b/debian/libmariadb3.install @@ -0,0 +1,5 @@ +usr/lib/*/libmariadbclient.so.* +usr/lib/*/libmysqlclient.so.* +usr/lib/*/libmariadb.so.* +usr/lib/mysql/plugin/dialog.so +usr/lib/mysql/plugin/mysql_clear_password.so diff --git a/debian/libmariadbclient18.postinst b/debian/libmariadb3.postinst similarity index 100% rename from debian/libmariadbclient18.postinst rename to debian/libmariadb3.postinst diff --git a/debian/libmariadbclient-dev.dirs b/debian/libmariadbclient-dev.dirs deleted file mode 100644 index f6ad2870431..00000000000 --- a/debian/libmariadbclient-dev.dirs +++ /dev/null @@ -1,2 +0,0 @@ -usr/include/ -usr/lib/ diff --git a/debian/libmariadbclient-dev.files b/debian/libmariadbclient-dev.files deleted file mode 100644 index 77260e88d1c..00000000000 --- a/debian/libmariadbclient-dev.files +++ /dev/null @@ -1,8 +0,0 @@ -usr/bin/mysql_config -usr/include/mysql -usr/include/mariadb -usr/lib/mariadb/libmariadbclient.a -usr/lib/libmysqlservices.a -usr/share/aclocal/mysql.m4 -usr/share/pkgconfig/mariadb.pc -usr/share/man/man1/mysql_config.1 diff --git a/debian/libmariadbclient18.dirs b/debian/libmariadbclient18.dirs deleted file mode 100644 index 2964de6141b..00000000000 --- a/debian/libmariadbclient18.dirs +++ /dev/null @@ -1 +0,0 @@ -usr/lib/ diff --git a/debian/libmariadbclient18.files b/debian/libmariadbclient18.files deleted file mode 100644 index dfef3d26d0a..00000000000 --- a/debian/libmariadbclient18.files +++ /dev/null @@ -1,3 +0,0 @@ -usr/lib/mariadb/libmariadb.so.* -usr/lib/mysql/plugin/mysql_clear_password.so -usr/lib/mysql/plugin/dialog.so diff --git a/debian/libmariadbd-dev.files b/debian/libmariadbd-dev.files deleted file mode 100644 index 26cb8d0a606..00000000000 --- a/debian/libmariadbd-dev.files +++ /dev/null @@ -1,2 +0,0 @@ -usr/lib/mysql/*.a -usr/lib/mysql/*.la diff --git a/debian/libmariadbd-dev.install b/debian/libmariadbd-dev.install new file mode 100644 index 00000000000..6fe225b15ba --- /dev/null +++ b/debian/libmariadbd-dev.install @@ -0,0 +1,3 @@ +usr/bin/mariadb_config +usr/lib/*/libmysqld.a +usr/lib/*/libmysqld.so diff --git a/debian/libmariadbd19.install b/debian/libmariadbd19.install new file mode 100644 index 00000000000..fb5f4771734 --- /dev/null +++ b/debian/libmariadbd19.install @@ -0,0 +1 @@ +usr/lib/*/libmysqld.so.* diff --git a/debian/mariadb-client-10.2.README.Debian b/debian/mariadb-client-10.2.README.Debian index 64f0f509951..b245638f9c9 100644 --- a/debian/mariadb-client-10.2.README.Debian +++ b/debian/mariadb-client-10.2.README.Debian @@ -1,4 +1,4 @@ FAQ: -Q: My completion is gone, why? +Q: My completition is gone, why? A: You have "no-auto-rehash" in the "[mysql]" section of /etc/mysql/my.cnf! diff --git a/debian/mariadb-client-10.2.dirs b/debian/mariadb-client-10.2.dirs deleted file mode 100644 index ceda5922c5d..00000000000 --- a/debian/mariadb-client-10.2.dirs +++ /dev/null @@ -1,3 +0,0 @@ -usr/bin/ -usr/share/man/man1/ -usr/share/perl5/ diff --git a/debian/mariadb-client-10.2.files b/debian/mariadb-client-10.2.files deleted file mode 100644 index 95e788dc8d8..00000000000 --- a/debian/mariadb-client-10.2.files +++ /dev/null @@ -1,25 +0,0 @@ -usr/bin/innochecksum -usr/bin/innotop -usr/bin/mysqlaccess -usr/bin/mysqladmin -usr/bin/mysqldump -usr/bin/mysqldumpslow -usr/bin/mysql_find_rows -usr/bin/mysql_fix_extensions -usr/bin/mysqlimport -usr/bin/mysqlreport -usr/bin/mysqlshow -usr/bin/mysqlslap -usr/bin/mysql_waitpid -usr/share/man/man1/innotop.1 -usr/share/man/man1/mysqlaccess.1 -usr/share/man/man1/mysqladmin.1 -usr/share/man/man1/mysqldump.1 -usr/share/man/man1/mysqldumpslow.1 -usr/share/man/man1/mysql_find_rows.1 -usr/share/man/man1/mysql_fix_extensions.1 -usr/share/man/man1/mysqlimport.1 -usr/share/man/man1/mysqlreport.1 -usr/share/man/man1/mysqlshow.1 -usr/share/man/man1/mysqlslap.1 -usr/share/man/man1/mysql_waitpid.1 diff --git a/debian/mariadb-client-10.2.install b/debian/mariadb-client-10.2.install new file mode 100644 index 00000000000..271f2a2f417 --- /dev/null +++ b/debian/mariadb-client-10.2.install @@ -0,0 +1,12 @@ +debian/additions/innotop/innotop usr/bin/ +debian/additions/mysqlreport usr/bin/ +usr/bin/mysql_find_rows +usr/bin/mysql_fix_extensions +usr/bin/mysql_waitpid +usr/bin/mysqlaccess +usr/bin/mysqladmin +usr/bin/mysqldump +usr/bin/mysqldumpslow +usr/bin/mysqlimport +usr/bin/mysqlshow +usr/bin/mysqlslap diff --git a/debian/mariadb-client-10.2.manpages b/debian/mariadb-client-10.2.manpages new file mode 100644 index 00000000000..504619785bc --- /dev/null +++ b/debian/mariadb-client-10.2.manpages @@ -0,0 +1,12 @@ +debian/additions/innotop/innotop.1 +debian/tmp/usr/share/man/man1/mysqlaccess.1 +debian/tmp/usr/share/man/man1/mysqladmin.1 +debian/tmp/usr/share/man/man1/mysqldump.1 +debian/tmp/usr/share/man/man1/mysqldumpslow.1 +debian/tmp/usr/share/man/man1/mysql_find_rows.1 +debian/tmp/usr/share/man/man1/mysql_fix_extensions.1 +debian/tmp/usr/share/man/man1/mysqlimport.1 +debian/additions/mysqlreport.1 +debian/tmp/usr/share/man/man1/mysqlshow.1 +debian/tmp/usr/share/man/man1/mysqlslap.1 +debian/tmp/usr/share/man/man1/mysql_waitpid.1 diff --git a/debian/mariadb-client-10.2.menu b/debian/mariadb-client-10.2.menu index 1378555c423..c08678536d1 100644 --- a/debian/mariadb-client-10.2.menu +++ b/debian/mariadb-client-10.2.menu @@ -1,3 +1,3 @@ # According to /usr/share/menu/ policy 1.4, not /usr/share/doc/debian-policy/ -?package(innotop):needs="text" section="Applications/Data Management"\ - title="innotop" command="/usr/bin/innotop" +?package(mariadb-client-10.2):needs="text" section="Applications/Data Management"\ + title="Innotop" command="/usr/bin/innotop" diff --git a/debian/mariadb-client-core-10.2.files b/debian/mariadb-client-core-10.2.files deleted file mode 100644 index a2781309439..00000000000 --- a/debian/mariadb-client-core-10.2.files +++ /dev/null @@ -1,4 +0,0 @@ -usr/bin/mysql -usr/bin/mysqlcheck -usr/share/man/man1/mysql.1 -usr/share/man/man1/mysqlcheck.1 diff --git a/debian/mariadb-client-core-10.2.install b/debian/mariadb-client-core-10.2.install new file mode 100644 index 00000000000..6308d769930 --- /dev/null +++ b/debian/mariadb-client-core-10.2.install @@ -0,0 +1,2 @@ +usr/bin/mysql +usr/bin/mysqlcheck diff --git a/debian/mariadb-client-core-10.2.manpages b/debian/mariadb-client-core-10.2.manpages new file mode 100644 index 00000000000..2be91d81f9a --- /dev/null +++ b/debian/mariadb-client-core-10.2.manpages @@ -0,0 +1,2 @@ +debian/tmp/usr/share/man/man1/mysql.1 +debian/tmp/usr/share/man/man1/mysqlcheck.1 diff --git a/debian/mariadb-common.dirs b/debian/mariadb-common.dirs new file mode 100644 index 00000000000..87c71c1c2f5 --- /dev/null +++ b/debian/mariadb-common.dirs @@ -0,0 +1 @@ +etc/mysql/mariadb.conf.d/ diff --git a/debian/mariadb-common.files b/debian/mariadb-common.files deleted file mode 100644 index f37e46c45fe..00000000000 --- a/debian/mariadb-common.files +++ /dev/null @@ -1 +0,0 @@ -etc/mysql/conf.d/mariadb.cnf diff --git a/debian/mariadb-common.install b/debian/mariadb-common.install new file mode 100644 index 00000000000..78dbc22b9f6 --- /dev/null +++ b/debian/mariadb-common.install @@ -0,0 +1 @@ +debian/additions/mariadb.cnf etc/mysql/conf.d diff --git a/debian/mariadb-cracklib-password-check-10.2.files b/debian/mariadb-cracklib-password-check-10.2.files deleted file mode 100644 index 3fe06639703..00000000000 --- a/debian/mariadb-cracklib-password-check-10.2.files +++ /dev/null @@ -1 +0,0 @@ -usr/lib/mysql/plugin/cracklib_password_check.so diff --git a/debian/mariadb-gssapi-server-10.2.files b/debian/mariadb-gssapi-server-10.2.files deleted file mode 100644 index d5e7b362a74..00000000000 --- a/debian/mariadb-gssapi-server-10.2.files +++ /dev/null @@ -1 +0,0 @@ -usr/lib/mysql/plugin/auth_gssapi.so diff --git a/debian/mariadb-oqgraph-engine-10.2.files b/debian/mariadb-oqgraph-engine-10.2.files deleted file mode 100644 index f67b0cd9d13..00000000000 --- a/debian/mariadb-oqgraph-engine-10.2.files +++ /dev/null @@ -1 +0,0 @@ -usr/lib/mysql/plugin/ha_oqgraph.so diff --git a/debian/mariadb-plugin-cassandra.install b/debian/mariadb-plugin-cassandra.install new file mode 100644 index 00000000000..ca195058a17 --- /dev/null +++ b/debian/mariadb-plugin-cassandra.install @@ -0,0 +1,2 @@ +etc/mysql/conf.d/cassandra.cnf etc/mysql/mariadb.conf.d +usr/lib/mysql/plugin/ha_cassandra.so diff --git a/debian/mariadb-connect-engine-10.2.files b/debian/mariadb-plugin-connect.install similarity index 100% rename from debian/mariadb-connect-engine-10.2.files rename to debian/mariadb-plugin-connect.install index 0b042607c36..8a7aee412df 100644 --- a/debian/mariadb-connect-engine-10.2.files +++ b/debian/mariadb-plugin-connect.install @@ -1,2 +1,2 @@ -usr/lib/mysql/plugin/ha_connect.so etc/mysql/conf.d/connect.cnf +usr/lib/mysql/plugin/ha_connect.so diff --git a/debian/mariadb-plugin-cracklib-password-check.install b/debian/mariadb-plugin-cracklib-password-check.install new file mode 100644 index 00000000000..7cc3fdc2b3e --- /dev/null +++ b/debian/mariadb-plugin-cracklib-password-check.install @@ -0,0 +1,2 @@ +etc/mysql/conf.d/cracklib_password_check.cnf etc/mysql/mariadb.conf.d +usr/lib/mysql/plugin/cracklib_password_check.so diff --git a/debian/mariadb-gssapi-client-10.2.files b/debian/mariadb-plugin-gssapi-client.install similarity index 100% rename from debian/mariadb-gssapi-client-10.2.files rename to debian/mariadb-plugin-gssapi-client.install diff --git a/debian/mariadb-plugin-gssapi-server.install b/debian/mariadb-plugin-gssapi-server.install new file mode 100644 index 00000000000..537f459d2d2 --- /dev/null +++ b/debian/mariadb-plugin-gssapi-server.install @@ -0,0 +1,2 @@ +etc/mysql/conf.d/auth_gssapi.cnf etc/mysql/mariadb.conf.d +usr/lib/mysql/plugin/auth_gssapi.so diff --git a/debian/mariadb-plugin-mroonga.install b/debian/mariadb-plugin-mroonga.install new file mode 100644 index 00000000000..c28fde2fd18 --- /dev/null +++ b/debian/mariadb-plugin-mroonga.install @@ -0,0 +1,3 @@ +usr/lib/mysql/plugin/ha_mroonga.so +usr/share/mysql/mroonga/install.sql +usr/share/mysql/mroonga/uninstall.sql diff --git a/debian/mariadb-plugin-mroonga.postinst b/debian/mariadb-plugin-mroonga.postinst new file mode 100644 index 00000000000..fea327c204d --- /dev/null +++ b/debian/mariadb-plugin-mroonga.postinst @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +# Install Mroonga +mysql --defaults-file=/etc/mysql/debian.cnf < /usr/share/mysql/mroonga/install.sql || true +# Always exit with success instead of leaving dpkg in a broken state + + +#DEBHELPER# diff --git a/debian/mariadb-plugin-mroonga.prerm b/debian/mariadb-plugin-mroonga.prerm new file mode 100644 index 00000000000..b64ea064142 --- /dev/null +++ b/debian/mariadb-plugin-mroonga.prerm @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +# Install Mroonga +mysql --defaults-file=/etc/mysql/debian.cnf < /usr/share/mysql/mroonga/uninstall.sql || true +# Always exit with success instead of leaving dpkg in a broken state + + +#DEBHELPER# diff --git a/debian/mariadb-plugin-oqgraph.install b/debian/mariadb-plugin-oqgraph.install new file mode 100644 index 00000000000..5e2a892d9e9 --- /dev/null +++ b/debian/mariadb-plugin-oqgraph.install @@ -0,0 +1,2 @@ +etc/mysql/conf.d/oqgraph.cnf etc/mysql/mariadb.conf.d +usr/lib/mysql/plugin/ha_oqgraph.so diff --git a/debian/mariadb-plugin-spider.install b/debian/mariadb-plugin-spider.install new file mode 100644 index 00000000000..89652fe2f3c --- /dev/null +++ b/debian/mariadb-plugin-spider.install @@ -0,0 +1,2 @@ +usr/lib/mysql/plugin/ha_spider.so +usr/share/mysql/install_spider.sql diff --git a/debian/mariadb-plugin-spider.postinst b/debian/mariadb-plugin-spider.postinst new file mode 100644 index 00000000000..d4ddaa53156 --- /dev/null +++ b/debian/mariadb-plugin-spider.postinst @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +# Install Spider +mysql --defaults-file=/etc/mysql/debian.cnf < /usr/share/mysql/install_spider.sql || true +# Always exit with success instead of leaving dpkg in a broken state + + +#DEBHELPER# diff --git a/debian/mariadb-plugin-tokudb.install b/debian/mariadb-plugin-tokudb.install new file mode 100644 index 00000000000..487c9df7120 --- /dev/null +++ b/debian/mariadb-plugin-tokudb.install @@ -0,0 +1,4 @@ +etc/mysql/conf.d/tokudb.cnf etc/mysql/mariadb.conf.d +usr/bin/tokuftdump +usr/lib/mysql/plugin/ha_tokudb.so +usr/share/doc/mariadb-server-10.2/README.md usr/share/doc/mariadb-plugin-tokudb/README.md diff --git a/debian/mariadb-server-10.2.config b/debian/mariadb-server-10.2.config index 162017caf71..44640f2a441 100644 --- a/debian/mariadb-server-10.2.config +++ b/debian/mariadb-server-10.2.config @@ -1,18 +1,17 @@ -#!/bin/bash -e +#!/bin/bash + +set -e . /usr/share/debconf/confmodule if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi ${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 } -CNF=/etc/mysql/my.cnf - # Beware that there are two ypwhich one of them needs the 2>/dev/null! if test -n "`which ypwhich 2>/dev/null`" && ypwhich >/dev/null 2>&1; then - db_input high mysql-server-5.1/nis_warning || true + db_input high mariadb-server-10.0/nis_warning || true db_go fi - # only ask this question on fresh installs, during "reconfiguration" and when # not upgrading from an existing 5.0 installation. # there is also an additional check for empty root passwords in the diff --git a/debian/mariadb-server-10.2.dirs b/debian/mariadb-server-10.2.dirs index 037d669e833..5057fe806c3 100644 --- a/debian/mariadb-server-10.2.dirs +++ b/debian/mariadb-server-10.2.dirs @@ -1,10 +1 @@ -etc/init.d -etc/logrotate.d -etc/mysql/conf.d -usr/bin -usr/sbin -usr/share/man/man8 -usr/share/mysql -usr/share/doc/mariadb-server-10.2 -var/run/mysqld var/lib/mysql-upgrade diff --git a/debian/mariadb-server-10.2.files.in b/debian/mariadb-server-10.2.install similarity index 61% rename from debian/mariadb-server-10.2.files.in rename to debian/mariadb-server-10.2.install index d4e8746f023..71aeb1f560b 100644 --- a/debian/mariadb-server-10.2.files.in +++ b/debian/mariadb-server-10.2.install @@ -1,47 +1,29 @@ -usr/lib/mysql/plugin/auth_pam.so -usr/lib/mysql/plugin/auth_socket.so -usr/lib/mysql/plugin/file_key_management.so -usr/lib/mysql/plugin/ha_archive.so -usr/lib/mysql/plugin/ha_blackhole.so -usr/lib/mysql/plugin/ha_federated.so -usr/lib/mysql/plugin/ha_federatedx.so -usr/lib/mysql/plugin/ha_mroonga.so -usr/lib/mysql/plugin/ha_sphinx.so -usr/lib/mysql/plugin/handlersocket.so -usr/lib/mysql/plugin/locales.so -usr/lib/mysql/plugin/metadata_lock_info.so -usr/lib/mysql/plugin/query_cache_info.so -usr/lib/mysql/plugin/query_response_time.so -usr/lib/mysql/plugin/semisync_master.so -usr/lib/mysql/plugin/semisync_slave.so -usr/lib/mysql/plugin/server_audit.so -usr/lib/mysql/plugin/simple_password_check.so -usr/lib/mysql/plugin/sql_errlog.so -usr/lib/mysql/plugin/wsrep_info.so -usr/lib/mysql/plugin/user_variables.so -usr/lib/libhsclient.so.* +debian/additions/debian-start etc/mysql +debian/additions/debian-start.inc.sh usr/share/mysql +debian/additions/echo_stderr usr/share/mysql +debian/additions/mysqld_safe_syslog.cnf etc/mysql/conf.d etc/apparmor.d/usr.sbin.mysqld -usr/share/apport/package-hooks/source_mariadb-10.2.py -etc/mysql/debian-start -etc/mysql/conf.d/mysqld_safe_syslog.cnf -usr/bin/msql2mysql -usr/bin/my_print_defaults -usr/bin/myisamchk -usr/bin/myisam_ftdump -usr/bin/myisamlog -usr/bin/myisampack -usr/bin/aria_pack -usr/bin/aria_read_log -usr/bin/aria_ftdump +lib/systemd/system/mariadb@bootstrap.service.d/use_galera_new_cluster.conf usr/bin/aria_chk usr/bin/aria_dump_log +usr/bin/aria_ftdump +usr/bin/aria_pack +usr/bin/aria_read_log +usr/bin/galera_new_cluster +usr/bin/galera_recovery +usr/bin/mariadb-service-convert +usr/bin/msql2mysql +usr/bin/my_print_defaults +usr/bin/myisam_ftdump +usr/bin/myisamchk +usr/bin/myisamlog +usr/bin/myisampack usr/bin/mysql_convert_table_format usr/bin/mysql_install_db usr/bin/mysql_plugin usr/bin/mysql_secure_installation usr/bin/mysql_setpermission usr/bin/mysql_tzinfo_to_sql -usr/bin/mysql_upgrade usr/bin/mysqlbinlog usr/bin/mysqld_multi usr/bin/mysqld_safe @@ -55,43 +37,33 @@ usr/bin/wsrep_sst_mysqldump usr/bin/wsrep_sst_rsync usr/bin/wsrep_sst_xtrabackup usr/bin/wsrep_sst_xtrabackup-v2 +usr/lib/mysql/plugin/auth_pam.so +usr/lib/mysql/plugin/auth_socket.so +usr/lib/mysql/plugin/file_key_management.so +usr/lib/mysql/plugin/ha_archive.so +usr/lib/mysql/plugin/ha_blackhole.so +usr/lib/mysql/plugin/ha_federated.so +usr/lib/mysql/plugin/ha_federatedx.so +usr/lib/mysql/plugin/ha_sphinx.so +usr/lib/mysql/plugin/handlersocket.so +usr/lib/mysql/plugin/locales.so +usr/lib/mysql/plugin/metadata_lock_info.so +usr/lib/mysql/plugin/query_cache_info.so +usr/lib/mysql/plugin/query_response_time.so +usr/lib/mysql/plugin/semisync_master.so +usr/lib/mysql/plugin/semisync_slave.so +usr/lib/mysql/plugin/server_audit.so +usr/lib/mysql/plugin/simple_password_check.so +usr/lib/mysql/plugin/sql_errlog.so +usr/lib/mysql/plugin/user_variables.so +usr/lib/mysql/plugin/wsrep_info.so +usr/share/apport/package-hooks/source_mariadb-10.2.py usr/share/doc/mariadb-server-10.2/mysqld.sym.gz -usr/share/doc/mariadb-server-10.2/INFO_SRC -usr/share/doc/mariadb-server-10.2/INFO_BIN -usr/share/man/man1/msql2mysql.1 -usr/share/man/man1/myisamchk.1 -usr/share/man/man1/myisam_ftdump.1 -usr/share/man/man1/myisamlog.1 -usr/share/man/man1/myisampack.1 -usr/share/man/man1/my_print_defaults.1 -usr/share/man/man1/mysqlbinlog.1 -usr/share/man/man1/mysql_convert_table_format.1 -usr/share/man/man1/mysqld_multi.1 -usr/share/man/man1/mysqld_safe.1 -usr/share/man/man1/mysqlhotcopy.1 -usr/share/man/man1/mysql_install_db.1 -usr/share/man/man1/mysql_secure_installation.1 -usr/share/man/man1/mysql_setpermission.1 -usr/share/man/man1/mysql_upgrade.1 -usr/share/man/man1/perror.1 -usr/share/man/man1/replace.1 -usr/share/man/man1/resolveip.1 -usr/share/man/man1/resolve_stack_dump.1 -usr/share/man/man1/innochecksum.1 -usr/share/man/man1/mysql_tzinfo_to_sql.1 -usr/share/mysql/debian-start.inc.sh -usr/share/mysql/echo_stderr usr/share/mysql/errmsg-utf8.txt usr/share/mysql/fill_help_tables.sql usr/share/mysql/maria_add_gis_sp_bootstrap.sql -usr/share/mysql/mroonga/install.sql -usr/share/mysql/mroonga/uninstall.sql -usr/share/mysql/mysql_system_tables_data.sql -usr/share/mysql/mysql_system_tables.sql usr/share/mysql/mysql_performance_tables.sql +usr/share/mysql/mysql_system_tables.sql +usr/share/mysql/mysql_system_tables_data.sql usr/share/mysql/mysql_test_data_timezone.sql usr/share/mysql/wsrep_notify -@CASSANDRA_DEB_FILES@ -@SPIDER_DEB_FILES@ -@TOKUDB_DEB_FILES@ -@SYSTEMD_DEB_FILES@ diff --git a/debian/mariadb-server-10.2.manpages b/debian/mariadb-server-10.2.manpages new file mode 100644 index 00000000000..1825b7655da --- /dev/null +++ b/debian/mariadb-server-10.2.manpages @@ -0,0 +1,25 @@ +debian/tmp/usr/share/man/man1/aria_chk.1 +debian/tmp/usr/share/man/man1/aria_dump_log.1 +debian/tmp/usr/share/man/man1/aria_ftdump.1 +debian/tmp/usr/share/man/man1/aria_pack.1 +debian/tmp/usr/share/man/man1/aria_read_log.1 +debian/tmp/usr/share/man/man1/msql2mysql.1 +debian/tmp/usr/share/man/man1/myisamchk.1 +debian/tmp/usr/share/man/man1/myisam_ftdump.1 +debian/tmp/usr/share/man/man1/myisamlog.1 +debian/tmp/usr/share/man/man1/myisampack.1 +debian/tmp/usr/share/man/man1/my_print_defaults.1 +debian/tmp/usr/share/man/man1/mysqlbinlog.1 +debian/tmp/usr/share/man/man1/mysql_convert_table_format.1 +debian/tmp/usr/share/man/man1/mysqld_multi.1 +debian/tmp/usr/share/man/man1/mysqld_safe.1 +debian/tmp/usr/share/man/man1/mysqlhotcopy.1 +debian/tmp/usr/share/man/man1/mysql_install_db.1 +debian/tmp/usr/share/man/man1/mysql_plugin.1 +debian/tmp/usr/share/man/man1/mysql_secure_installation.1 +debian/tmp/usr/share/man/man1/mysql_setpermission.1 +debian/tmp/usr/share/man/man1/mysql_tzinfo_to_sql.1 +debian/tmp/usr/share/man/man1/perror.1 +debian/tmp/usr/share/man/man1/replace.1 +debian/tmp/usr/share/man/man1/resolveip.1 +debian/tmp/usr/share/man/man1/resolve_stack_dump.1 diff --git a/debian/mariadb-server-10.2.mysql-server.logrotate b/debian/mariadb-server-10.2.mysql-server.logrotate index a19e9ec46a2..2a9c3cd3031 100644 --- a/debian/mariadb-server-10.2.mysql-server.logrotate +++ b/debian/mariadb-server-10.2.mysql-server.logrotate @@ -1,8 +1,8 @@ -# - I put everything in one block and added sharedscripts, so that mysql gets +# - I put everything in one block and added sharedscripts, so that mysql gets # flush-logs'd only once. # Else the binary logs would automatically increase by n times every day. # - The error log is obsolete, messages go to syslog now. -/var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mariadb-slow.log { +/var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log /var/log/mysql/mariadb-slow.log /var/log/mysql/error.log { daily rotate 7 missingok @@ -11,7 +11,6 @@ sharedscripts postrotate test -x /usr/bin/mysqladmin || exit 0 - if [ -f `my_print_defaults --mysqld | grep -oP "pid-file=\K[^$]+"` ]; then # If this fails, check debian.conf! mysqladmin --defaults-file=/etc/mysql/debian.cnf flush-logs diff --git a/debian/mariadb-server-10.2.mysql.default b/debian/mariadb-server-10.2.mysql.default new file mode 100644 index 00000000000..22f08e54427 --- /dev/null +++ b/debian/mariadb-server-10.2.mysql.default @@ -0,0 +1,8 @@ +# The delay in seconds the init script waits for the server to be up and running after having started "mysqld_safe" to run the "/etc/mysql/debian-start" script. +# If the server is still not responding after the delay, the script won't be executed and an error will be thrown on the syslog. +# Default: 30 +#MYSQLD_STARTUP_TIMEOUT=30 + +# The email recipient(s) of the output of the check for crashed and improperly closed MyISAM and Aria tables done at each server start by the "/etc/mysql/debian-start" script. +# Default: root +#MYCHECK_RCPT="root" diff --git a/debian/mariadb-server-10.2.mysql.init b/debian/mariadb-server-10.2.mysql.init index d250ebd2e9e..0d8128cb7d3 100644 --- a/debian/mariadb-server-10.2.mysql.init +++ b/debian/mariadb-server-10.2.mysql.init @@ -22,12 +22,16 @@ test -x /usr/sbin/mysqld || exit 0 . /lib/lsb/init-functions SELF=$(cd $(dirname $0); pwd -P)/$(basename $0) -CONF=/etc/mysql/my.cnf + MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" -# priority can be overridden and "-s" adds output to stderr +# priority can be overriden and "-s" adds output to stderr ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mysql -i" +if [ -f /etc/default/mysql ]; then + . /etc/default/mysql +fi + # Safeguard (relative paths, core dumps..) cd / umask 077 @@ -37,18 +41,15 @@ umask 077 # so break my scripts. export HOME=/etc/mysql/ -# Source default config file. -[ -r /etc/default/mariadb ] && . /etc/default/mariadb - ## Fetch a particular option from mysql's invocation. # # Usage: void mysqld_get_param option mysqld_get_param() { - /usr/sbin/mysqld --print-defaults \ - | tr " " "\n" \ - | grep -- "--$1" \ - | tail -n 1 \ - | cut -d= -f2 + /usr/sbin/mysqld --print-defaults \ + | tr " " "\n" \ + | grep -- "--$1" \ + | tail -n 1 \ + | cut -d= -f2 } ## Do some sanity checks before even trying to start mysqld. @@ -75,21 +76,21 @@ sanity_checks() { # # Usage: boolean mysqld_status [check_alive|check_dead] [warn|nowarn] mysqld_status () { - ping_output=`$MYADMIN ping 2>&1`; ping_alive=$(( ! $? )) + ping_output=`$MYADMIN ping 2>&1`; ping_alive=$(( ! $? )) - ps_alive=0 - pidfile=`mysqld_get_param pid-file` - if [ -f "$pidfile" ] && ps `cat $pidfile` >/dev/null 2>&1; then ps_alive=1; fi - - if [ "$1" = "check_alive" -a $ping_alive = 1 ] || - [ "$1" = "check_dead" -a $ping_alive = 0 -a $ps_alive = 0 ]; then - return 0 # EXIT_SUCCESS - else - if [ "$2" = "warn" ]; then - echo -e "$ps_alive processes alive and '$MYADMIN ping' resulted in\n$ping_output\n" | $ERR_LOGGER -p daemon.debug - fi - return 1 # EXIT_FAILURE + ps_alive=0 + pidfile=`mysqld_get_param pid-file` + if [ -f "$pidfile" ] && ps `cat $pidfile` >/dev/null 2>&1; then ps_alive=1; fi + + if [ "$1" = "check_alive" -a $ping_alive = 1 ] || + [ "$1" = "check_dead" -a $ping_alive = 0 -a $ps_alive = 0 ]; then + return 0 # EXIT_SUCCESS + else + if [ "$2" = "warn" ]; then + echo -e "$ps_alive processes alive and '$MYADMIN ping' resulted in\n$ping_output\n" | $ERR_LOGGER -p daemon.debug fi + return 1 # EXIT_FAILURE + fi } # @@ -97,101 +98,96 @@ mysqld_status () { # case "${1:-''}" in + 'start') - sanity_checks; - # Start daemon - log_daemon_msg "Starting MariaDB database server" "mysqld" - if mysqld_status check_alive nowarn; then - log_progress_msg "already running" - log_end_msg 0 - else - # Could be removed during boot - test -e /var/run/mysqld || install -m 755 -o mysql -g root -d /var/run/mysqld + sanity_checks; + # Start daemon + log_daemon_msg "Starting MariaDB database server" "mysqld" + if mysqld_status check_alive nowarn; then + log_progress_msg "already running" + log_end_msg 0 + else + # Could be removed during boot + test -e /var/run/mysqld || install -m 755 -o mysql -g root -d /var/run/mysqld - # Start MariaDB! - /usr/bin/mysqld_safe "${@:2}" > /dev/null 2>&1 & + # Start MariaDB! + /usr/bin/mysqld_safe "${@:2}" 2>&1 >/dev/null | $ERR_LOGGER & - # 6s was reported in #352070 to be too little - for i in $(seq 1 "${MYSQLD_STARTUP_TIMEOUT:-60}"); do - sleep 1 - if mysqld_status check_alive nowarn ; then break; fi - log_progress_msg "." - done - if mysqld_status check_alive warn; then - log_end_msg 0 - # Now start mysqlcheck or whatever the admin wants. - output=$(/etc/mysql/debian-start) - [ -n "$output" ] && log_action_msg "$output" - else - log_end_msg 1 - log_failure_msg "Please take a look at the syslog" - fi - fi - ;; + for i in $(seq 1 "${MYSQLD_STARTUP_TIMEOUT:-30}"); do + sleep 1 + if mysqld_status check_alive nowarn ; then break; fi + log_progress_msg "." + done + if mysqld_status check_alive warn; then + log_end_msg 0 + # Now start mysqlcheck or whatever the admin wants. + output=$(/etc/mysql/debian-start) + if [ -n "$output" ]; then + log_action_msg "$output" + fi + else + log_end_msg 1 + log_failure_msg "Please take a look at the syslog" + fi + fi + ;; 'stop') - # * As a passwordless mysqladmin (e.g. via ~/.my.cnf) must be possible - # at least for cron, we can rely on it here, too. (although we have - # to specify it explicit as e.g. sudo environments points to the normal - # users home and not /root) - log_daemon_msg "Stopping MariaDB database server" "mysqld" - if ! mysqld_status check_dead nowarn; then - set +e - shutdown_out=`$MYADMIN shutdown 2>&1`; r=$? - set -e - if [ "$r" -ne 0 ]; then - log_end_msg 1 - [ "$VERBOSE" != "no" ] && log_failure_msg "Error: $shutdown_out" - log_daemon_msg "Killing MariaDB database server by signal" "mysqld" - killall -15 mysqld - server_down= - for i in `seq 1 600`; do - sleep 1 - if mysqld_status check_dead nowarn; then server_down=1; break; fi - done - if test -z "$server_down"; then killall -9 mysqld; fi - fi - fi + # * As a passwordless mysqladmin (e.g. via ~/.my.cnf) must be possible + # at least for cron, we can rely on it here, too. (although we have + # to specify it explicit as e.g. sudo environments points to the normal + # users home and not /root) + log_daemon_msg "Stopping MariaDB database server" "mysqld" + if ! mysqld_status check_dead nowarn; then + set +e + shutdown_out=`$MYADMIN shutdown 2>&1`; r=$? + set -e + if [ "$r" -ne 0 ]; then + log_end_msg 1 + [ "$VERBOSE" != "no" ] && log_failure_msg "Error: $shutdown_out" + log_daemon_msg "Killing MariaDB database server by signal" "mysqld" + killall -15 mysqld + server_down= + for i in `seq 1 600`; do + sleep 1 + if mysqld_status check_dead nowarn; then server_down=1; break; fi + done + if test -z "$server_down"; then killall -9 mysqld; fi + fi + fi - if ! mysqld_status check_dead warn; then - log_end_msg 1 - log_failure_msg "Please stop MariaDB manually and read /usr/share/doc/mariadb-server-10.2/README.Debian.gz!" - exit -1 - else - log_end_msg 0 - fi - ;; + if ! mysqld_status check_dead warn; then + log_end_msg 1 + log_failure_msg "Please stop MariaDB manually and read /usr/share/doc/mariadb-server-10.2/README.Debian.gz!" + exit -1 + else + log_end_msg 0 + fi + ;; 'restart') - set +e; $SELF stop; set -e - $SELF start - ;; + set +e; $SELF stop; set -e + shift + $SELF start "${@}" + ;; 'reload'|'force-reload') - log_daemon_msg "Reloading MariaDB database server" "mysqld" - $MYADMIN reload - log_end_msg 0 - ;; + log_daemon_msg "Reloading MariaDB database server" "mysqld" + $MYADMIN reload + log_end_msg 0 + ;; 'status') - if mysqld_status check_alive nowarn; then - log_action_msg "$($MYADMIN version)" - else - log_action_msg "MariaDB is stopped." - exit 3 - fi - ;; - - 'bootstrap') - # Bootstrap the cluster, start the first node - # that initiates the cluster - log_daemon_msg "Bootstrapping the cluster" "mysqld" - $SELF start "${@:2}" --wsrep-new-cluster - ;; + if mysqld_status check_alive nowarn; then + log_action_msg "$($MYADMIN version)" + else + log_action_msg "MariaDB is stopped." + exit 3 + fi + ;; *) - echo "Usage: $SELF start|stop|restart|reload|force-reload|status|bootstrap" - exit 1 - ;; + echo "Usage: $SELF start|stop|restart|reload|force-reload|status" + exit 1 + ;; esac - diff --git a/debian/mariadb-server-10.2.postinst b/debian/mariadb-server-10.2.postinst index 0244046c5a3..9131ca851a7 100644 --- a/debian/mariadb-server-10.2.postinst +++ b/debian/mariadb-server-10.2.postinst @@ -4,7 +4,7 @@ if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi ${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 } - + export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin # This command can be used as pipe to syslog. With "-s" it also logs to stderr. @@ -55,84 +55,96 @@ EOF # In case the server wasn't running at all it should be ok if the stop # script fails. I can't tell at this point because of the cleaned /var/run. set +e; invoke stop; set -e - + case "$1" in configure) - mysql_datadir=/usr/share/mysql - mysql_statedir=/var/lib/mysql + mysql_statedir=/usr/share/mysql + mysql_datadir=/var/lib/mysql + mysql_logdir=/var/log/mysql mysql_rundir=/var/run/mysqld - mysql_logdir=/var/log mysql_cfgdir=/etc/mysql - mysql_newlogdir=/var/log/mysql mysql_upgradedir=/var/lib/mysql-upgrade - # first things first, if the following symlink exists, it is a preserved - # copy the old data dir from a mysql upgrade that would have otherwise - # been replaced by an empty mysql dir. this should restore it. + # If the following symlink exists, it is a preserved copy the old data dir + # created by the preinst script during a upgrade that would have otherwise + # been replaced by an empty mysql dir. This should restore it. for dir in DATADIR LOGDIR; do - if [ "$dir" = "DATADIR" ]; then targetdir=$mysql_statedir; else targetdir=$mysql_newlogdir; fi - savelink="$mysql_upgradedir/$dir.link" - if [ -L "$savelink" ]; then - # If the targetdir was a symlink before we upgraded it is supposed - # to be either still be present or not existing anymore now. - if [ -L "$targetdir" ]; then - rm "$savelink" - elif [ ! -d "$targetdir" ]; then - mv "$savelink" "$targetdir" - else - # this should never even happen, but just in case... - mysql_tmp=`mktemp -d -t mysql-symlink-restore-XXXXXX` - echo "this is very strange! see $mysql_tmp/README..." >&2 - mv "$targetdir" "$mysql_tmp" - cat << EOF > "$mysql_tmp/README" -if you're reading this, it's most likely because you had replaced /var/lib/mysql + if [ "$dir" = "DATADIR" ]; then + targetdir=$mysql_datadir + else + targetdir=$mysql_logdir + fi + + savelink="$mysql_upgradedir/$dir.link" + if [ -L "$savelink" ]; then + # If the targetdir was a symlink before we upgraded it is supposed + # to be either still be present or not existing anymore now. + if [ -L "$targetdir" ]; then + rm "$savelink" + elif [ ! -d "$targetdir" ]; then + mv "$savelink" "$targetdir" + else + # this should never even happen, but just in case... + mysql_tmp=`mktemp -d -t mysql-symlink-restore-XXXXXX` + echo "this is very strange! see $mysql_tmp/README..." >&2 + mv "$targetdir" "$mysql_tmp" + cat << EOF > "$mysql_tmp/README" + +Ff you're reading this, it's most likely because you had replaced /var/lib/mysql with a symlink, then upgraded to a new version of mysql, and then dpkg -removed your symlink (see #182747 and others). the mysql packages noticed -that this happened, and as a workaround have restored it. however, because +removed your symlink (see #182747 and others). The mysql packages noticed +that this happened, and as a workaround have restored it. However, because /var/lib/mysql seems to have been re-created in the meantime, and because -we don't want to rm -rf something we don't know as much about, we're going -to leave this unexpected directory here. if your database looks normal, +we don't want to rm -rf something we don't know as much about, we are going +to leave this unexpected directory here. If your database looks normal, and this is not a symlink to your database, you should be able to blow this all away. EOF - fi fi - rmdir $mysql_upgradedir 2>/dev/null || true + fi + rmdir $mysql_upgradedir 2>/dev/null || true + done - + # Ensure the existence and right permissions for the database and # log files. - if [ ! -d "$mysql_statedir/mysql" -a ! -L "$mysql_statedir/mysql" ]; then - # Debian: beware of the bashisms... - /bin/bash /usr/bin/mysql_install_db --rpm --user=mysql --disable-log-bin 2>&1 | $ERR_LOGGER - fi - if [ ! -d "$mysql_newlogdir" -a ! -L "$mysql_newlogdir" ]; then mkdir "$mysql_newlogdir"; fi + if [ ! -d "$mysql_statedir" -a ! -L "$mysql_statedir" ]; then mkdir "$mysql_statedir"; fi + if [ ! -d "$mysql_datadir" -a ! -L "$mysql_datadir" ]; then mkdir "$mysql_datadir" ; fi + if [ ! -d "$mysql_logdir" -a ! -L "$mysql_logdir" ]; then mkdir "$mysql_logdir" ; fi # When creating an ext3 jounal on an already mounted filesystem like e.g. # /var/lib/mysql, you get a .journal file that is not modifyable by chown. - # The mysql_datadir must not be writable by the mysql user under any + # The mysql_statedir must not be writable by the mysql user under any # circumstances as it contains scripts that are executed by root. set +e - chown -R 0:0 $mysql_datadir - chown -R mysql $mysql_statedir - chown -R mysql $mysql_rundir - chown -R mysql:adm $mysql_newlogdir; chmod 2750 $mysql_newlogdir; - for i in log err; do - touch $mysql_logdir/mysql.$i - chown mysql:adm $mysql_logdir/mysql.$i - chmod 0640 $mysql_logdir/mysql.$i - done + chown -R 0:0 $mysql_statedir + find $mysql_datadir ! -uid $(id -u mysql) -print0 | xargs -0 -r chown mysql + chown -R mysql:adm $mysql_logdir + chmod 2750 $mysql_logdir set -e # This is important to avoid dataloss when there is a removed # mysql-server version from Woody lying around which used the same # data directory and then somewhen gets purged by the admin. - db_set mysql-server/postrm_remove_database false || true + db_set mariadb-server/postrm_remove_database false || true + + # Clean up old flags before setting new one + rm -f $mysql_datadir/debian-*.flag + # Flag data dir to avoid downgrades + touch $mysql_datadir/debian-10.2.flag + + # initiate databases. Output is not allowed by debconf :-( + # This will fail if we are upgrading an existing database; in this case + # mysql_upgrade, called from the /etc/init.d/mysql start script, will + # handle things. + # Debian: beware of the bashisms... + # Debian: can safely run on upgrades with existing databases + set +e + bash /usr/bin/mysql_install_db --rpm --cross-bootstrap --user=mysql --disable-log-bin 2>&1 | $ERR_LOGGER + set -e + - # To avoid downgrades. - touch $mysql_statedir/debian-10.2.flag - ## On every reconfiguration the maintenance user is recreated. # # - It is easier to regenerate the password every time but as people @@ -151,7 +163,7 @@ EOF # the old query which always succeeds and then the new which may or may not. # recreate the credentials file if not present or without mysql_upgrade stanza - dc=$mysql_cfgdir/debian.cnf; + dc=$mysql_cfgdir/debian.cnf; if [ -e "$dc" -a -n "`fgrep mysql_upgrade $dc 2>/dev/null`" ]; then pass="`sed -n 's/^[ ]*password *= *// p' $dc | head -n 1`" else diff --git a/debian/mariadb-server-10.2.postrm b/debian/mariadb-server-10.2.postrm index 7cee5150ef9..f8a95df54ea 100644 --- a/debian/mariadb-server-10.2.postrm +++ b/debian/mariadb-server-10.2.postrm @@ -1,9 +1,6 @@ #!/bin/bash -e -# It is possible that Debconf has already been removed, too. -if [ -f /usr/share/debconf/confmodule ]; then - . /usr/share/debconf/confmodule -fi +. /usr/share/debconf/confmodule if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi ${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 } @@ -46,41 +43,36 @@ esac # # - Do NOT purge logs or data if another mysql-sever* package is installed (#307473) # - Remove the mysql user only after all his owned files are purged. -# +# if [ "$1" = "purge" -a ! \( -x /usr/sbin/mysqld -o -L /usr/sbin/mysqld \) ]; then # we remove the mysql user only after all his owned files are purged rm -f /var/log/mysql.{log,err}{,.0,.[1234567].gz} rm -rf /var/log/mysql - db_input high mysql-server-5.1/postrm_remove_databases || true + db_input high mariadb-server-10.2/postrm_remove_databases || true db_go || true - db_get mysql-server-5.1/postrm_remove_databases || true + db_get mariadb-server-10.2/postrm_remove_databases || true if [ "$RET" = "true" ]; then # never remove the debian.cnf when the databases are still existing # else we ran into big trouble on the next install! rm -f /etc/mysql/debian.cnf - rm -rf /var/lib/mysql - rm -rf /var/run/mysqld + # Remove all contents from /var/lib/mysql except if it's a + # directory with file system data. See #829491 for details and + # #608938 for potential mysql-server leftovers which erroneously + # had been renamed. + find /var/lib/mysql -mindepth 1 \ + -not -path '*/lost+found/*' -not -name 'lost+found' \ + -not -path '*/lost@002bfound/*' -not -name 'lost@002bfound' \ + -delete + # "|| true" still needed as rmdir still exits with non-zero if + # /var/lib/mysql is a mount point + rmdir --ignore-fail-on-non-empty /var/lib/mysql || true + rm -rf /var/run/mysqld # this directory is created by the init script, don't leave behind userdel mysql || true fi - # (normally) Automatically added by dh_installinit - if [ "$1" = "purge" ] ; then - update-rc.d mysql remove >/dev/null || exit 0 - fi - # (normally) End automatically added section fi -# (normally) Automatically added by dh_installdebconf -if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then - . /usr/share/debconf/confmodule - db_purge -fi -# (normally) End automatically added section - -if [ "$1" = "purge" ] ; then - rm -f /etc/apparmor.d/force-complain/usr.sbin.mysqld >/dev/null 2>&1 || true -fi -# no DEBHELPER here, "update-rc.d remove" fails if mysql-server-5.1 is installed +#DEBHELPER# exit 0 diff --git a/debian/mariadb-server-10.2.preinst b/debian/mariadb-server-10.2.preinst index ee0723ea85d..f2b8882ab8e 100644 --- a/debian/mariadb-server-10.2.preinst +++ b/debian/mariadb-server-10.2.preinst @@ -14,9 +14,8 @@ ${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 } export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" -DATADIR=/var/lib/mysql -LOGDIR=/var/log/mysql -UPGRADEDIR=/var/lib/mysql-upgrade +mysql_datadir=/var/lib/mysql +mysql_upgradedir=/var/lib/mysql-upgrade # Try to stop the server in a sane way. If it does not success let the admin # do it himself. No database directories should be removed while the server @@ -24,6 +23,10 @@ UPGRADEDIR=/var/lib/mysql-upgrade stop_server() { if [ ! -x /etc/init.d/mysql ]; then return; fi + # Return immediately if there are no mysql processes running + # as there is no point in trying to shutdown in that case. + if ! pgrep mysqld > /dev/null; then return; fi + set +e if [ -x /usr/sbin/invoke-rc.d ]; then cmd="invoke-rc.d mysql stop" @@ -33,13 +36,13 @@ stop_server() { $cmd errno=$? set -e - + # 0=ok, 100=no init script (fresh install) if [ "$errno" != 0 -a "$errno" != 100 ]; then echo "${cmd/ */} returned $errno" 1>&2 echo "There is a MySQL server running, but we failed in our attempts to stop it." 1>&2 echo "Stop it yourself and try again!" 1>&2 - db_stop + db_stop exit 1 fi } @@ -47,31 +50,80 @@ stop_server() { ################################ main() ########################## this_version=10.2 +max_upgradeable_version=5.6 -# Safe the user from stupidities. -show_downgrade_warning=0 -for i in `ls $DATADIR/debian-*.flag 2>/dev/null`; do - found_version=`echo $i | sed 's/.*debian-\([0-9\.]\+\).flag/\1/'` - if dpkg --compare-versions "$this_version" '<<' "$found_version"; then - show_downgrade_warning=1 - break; +# Check if a flag file is found that indicates a previous MariaDB or MySQL +# version was installed. If multiple flags are found, check which one was +# the biggest version number. +for flag in $mysql_datadir/debian-*.flag +do + + # The for loop leaves $flag as the query string if there are no results, + # so the check below is needed to stop further processing when there are + # no real results. + if [ $flag = "$mysql_datadir/debian-*.flag" ] + then + break fi + + flag_version=`echo $flag | sed 's/.*debian-\([0-9\.]\+\).flag/\1/'` + + # Initialize value if empty + if [ -z "$found_version" ] + then + found_version=$flag_version + fi + + # Update value if now bigger then before + if dpkg --compare-versions "$flag_version" '>>' "$found_version" + then + found_version=$flag_version + fi + done -if [ "$show_downgrade_warning" = 1 ]; then - db_fset mariadb-server-$this_version/really_downgrade seen false || true - db_input medium mariadb-server-$this_version/really_downgrade || true - db_go - db_get mariadb-server-$this_version/really_downgrade || true - if [ "$RET" = "true" ]; then - rm -f $DATADIR/debian-*.flag - touch $DATADIR/debian-$this_version.flag - else - echo "Aborting downgrade from (at least) $found_version to $this_version." 1>&2 - echo "If are sure you want to downgrade to $this_version, remove the file" 1>&2 - echo "$DATADIR/debian-*.flag and try installing again." 1>&2 - db_stop - exit 1 + + +# If an upgrade is detected, proceed with it automatically without +# requiring any user interaction. +# +# However, if the user attempts to downgrade, warn about the incompatibility. +# Downgrade is detected if the flag version is bigger than $this_version +# (e.g. 10.1 > 10.0) or the flag version is smaller than 10.0 but bigger +# than $max_upgradeable_version. +if [ ! -z "$found_version" ] +then + + echo "$mysql_datadir: found previous version $found_version" + + if dpkg --compare-versions "$found_version" '>>' "$this_version" + then + downgrade_detected=true fi + + if dpkg --compare-versions "$found_version" '>>' "$max_upgradeable_version" \ + && dpkg --compare-versions "$found_version" '<<' "10.0" + then + downgrade_detected=true + fi + +fi + + +# Don't abort dpkg if downgrade is detected (as was done previously). +# Instead simply move the old datadir and create a new for this_version. +if [ ! -z "$downgrade_detected" ] +then + db_input critical mariadb-server-10.2/old_data_directory_saved || true + db_go + echo "The file $mysql_datadir/debian-$found_version.flag indicates a" 1>&2 + echo "version that cannot automatically be upgraded. Therefore the" 1>&2 + echo "previous data directory will be renamed to $mysql_datadir-$found_version and" 1>&2 + echo "a new data directory will be initialized at $mysql_datadir." 1>&2 + echo "Please manually export/import your data (e.g. with mysqldump) if needed." 1>&2 + mv -f $mysql_datadir $mysql_datadir-$found_version + # Also move away the old debian.cnf file that included credentials that are + # no longer valid + mv -f /etc/mysql/debian.cnf /etc/mysql/debian.cnf-$found_version fi # to be sure @@ -86,9 +138,9 @@ fi # # Now we have to ensure the following state: -# /etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false +# /etc/passwd: mysql:x:100:101:MySQL Server:/nonexistent:/bin/false # /etc/group: mysql:x:101: -# +# # Sadly there could any state be present on the system so we have to # modify everything carefully i.e. not doing a chown before creating # the user etc... @@ -107,7 +159,8 @@ if ! getent passwd mysql >/dev/null; then --system \ --disabled-login \ --ingroup mysql \ - --home $DATADIR \ + --no-create-home \ + --home /nonexistent \ --gecos "MySQL Server" \ --shell /bin/false \ mysql >/dev/null @@ -121,47 +174,36 @@ set -e for dir in DATADIR LOGDIR; do checkdir=`eval echo "$"$dir` if [ -L "$checkdir" ]; then - mkdir -p "$UPGRADEDIR" - cp -d "$checkdir" "$UPGRADEDIR/$dir.link" + mkdir -p "$mysql_upgradedir" + cp -dT "$checkdir" "$mysql_upgradedir/$dir.link" fi done # creating mysql home directory -if [ ! -d $DATADIR -a ! -L $DATADIR ]; then - mkdir $DATADIR +if [ ! -d $mysql_datadir -a ! -L $mysql_datadir ]; then + mkdir $mysql_datadir fi # checking disc space -if LC_ALL=C BLOCKSIZE= df --portability $DATADIR/. | tail -n 1 | awk '{ exit ($4>1000) }'; then - echo "ERROR: There's not enough space in $DATADIR/" 1>&2 +if LC_ALL=C BLOCKSIZE= df --portability $mysql_datadir/. | tail -n 1 | awk '{ exit ($4>1000) }'; then + echo "ERROR: There's not enough space in $mysql_datadir/" 1>&2 db_stop exit 1 fi # Since the home directory was created before putting the user into -# the mysql group and moreover we cannot guarantee that the +# the mysql group and moreover we cannot guarantee that the # permissions were correctly *before* calling this script, we fix them now. # In case we use NIS and no mysql user is present then this script should # better fail now than later.. # The "set +e" is necessary as e.g. a ".journal" of a ext3 partition is # not chgrp'able (#318435). set +e -chown mysql:mysql $DATADIR -find $DATADIR -follow -not -group mysql -print0 2>/dev/null \ +find $mysql_datadir ! -uid $(id -u mysql) -print0 | xargs -0 -r chown mysql +find $mysql_datadir -follow -not -group mysql -print0 2>/dev/null \ | xargs -0 --no-run-if-empty chgrp mysql set -e -# Some files below /etc/ were possibly in the mysql-server-5.0/etch package -# before. They get overwritten by current ones to avoid unnecessary dpkg questions. -while read md5 file; do - if [ "`md5sum $file 2>/dev/null`" = "$md5 $file" ]; then - cp /usr/share/mysql-common/internal-use-only/`echo $file | sed 's°/°_°g'` $file - fi -done < -## -## All lines beginning with `## DP:' are a description of the patch. -## DP: Creates Docs/Makefile.in - -@DPATCH@ - ---- old/Docs/Images/Makefile.in 2005-03-01 02:08:01.877429040 +0100 -+++ new/Docs/Images/Makefile.in 2005-02-28 21:21:24.000000000 +0100 -@@ -0,0 +1,765 @@ -+# Makefile.in generated by automake 1.7.9 from Makefile.am. -+# @configure_input@ -+ -+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -+# Free Software Foundation, Inc. -+# This Makefile.in is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. -+ -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -+# PARTICULAR PURPOSE. -+ -+@SET_MAKE@ -+ -+# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ -+# Process this file with automake to create Makefile.in -+ -+srcdir = @srcdir@ -+top_srcdir = @top_srcdir@ -+VPATH = @srcdir@ -+pkgdatadir = $(datadir)/@PACKAGE@ -+pkglibdir = $(libdir)/@PACKAGE@ -+pkgincludedir = $(includedir)/@PACKAGE@ -+top_builddir = . -+ -+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -+INSTALL = @INSTALL@ -+install_sh_DATA = $(install_sh) -c -m 644 -+install_sh_PROGRAM = $(install_sh) -c -+install_sh_SCRIPT = $(install_sh) -c -+INSTALL_HEADER = $(INSTALL_DATA) -+transform = $(program_transform_name) -+NORMAL_INSTALL = : -+PRE_INSTALL = : -+POST_INSTALL = : -+NORMAL_UNINSTALL = : -+PRE_UNINSTALL = : -+POST_UNINSTALL = : -+build_triplet = @build@ -+host_triplet = @host@ -+target_triplet = @target@ -+ACLOCAL = @ACLOCAL@ -+ALLOCA = @ALLOCA@ -+AMDEP_FALSE = @AMDEP_FALSE@ -+AMDEP_TRUE = @AMDEP_TRUE@ -+AMTAR = @AMTAR@ -+AR = @AR@ -+AS = @AS@ -+ASSEMBLER_FALSE = @ASSEMBLER_FALSE@ -+ASSEMBLER_TRUE = @ASSEMBLER_TRUE@ -+ASSEMBLER_sparc32_FALSE = @ASSEMBLER_sparc32_FALSE@ -+ASSEMBLER_sparc32_TRUE = @ASSEMBLER_sparc32_TRUE@ -+ASSEMBLER_sparc64_FALSE = @ASSEMBLER_sparc64_FALSE@ -+ASSEMBLER_sparc64_TRUE = @ASSEMBLER_sparc64_TRUE@ -+ASSEMBLER_x86_FALSE = @ASSEMBLER_x86_FALSE@ -+ASSEMBLER_x86_TRUE = @ASSEMBLER_x86_TRUE@ -+AUTOCONF = @AUTOCONF@ -+AUTOHEADER = @AUTOHEADER@ -+AUTOMAKE = @AUTOMAKE@ -+AVAILABLE_LANGUAGES = @AVAILABLE_LANGUAGES@ -+AVAILABLE_LANGUAGES_ERRORS = @AVAILABLE_LANGUAGES_ERRORS@ -+AWK = @AWK@ -+CC = @CC@ -+CCAS = @CCAS@ -+CCASFLAGS = @CCASFLAGS@ -+CCDEPMODE = @CCDEPMODE@ -+CC_VERSION = @CC_VERSION@ -+CFLAGS = @CFLAGS@ -+CHARSETS_NEED_SOURCE = @CHARSETS_NEED_SOURCE@ -+CHARSET_OBJS = @CHARSET_OBJS@ -+CHARSET_SRCS = @CHARSET_SRCS@ -+CHECK_PID = @CHECK_PID@ -+CHMOD = @CHMOD@ -+CLIENT_EXTRA_LDFLAGS = @CLIENT_EXTRA_LDFLAGS@ -+CLIENT_LIBS = @CLIENT_LIBS@ -+CMP = @CMP@ -+COMPILATION_COMMENT = @COMPILATION_COMMENT@ -+COMPILE_PSTACK_FALSE = @COMPILE_PSTACK_FALSE@ -+COMPILE_PSTACK_TRUE = @COMPILE_PSTACK_TRUE@ -+CONF_COMMAND = @CONF_COMMAND@ -+CP = @CP@ -+CPP = @CPP@ -+CPPFLAGS = @CPPFLAGS@ -+CXX = @CXX@ -+CXXCPP = @CXXCPP@ -+CXXDEPMODE = @CXXDEPMODE@ -+CXXFLAGS = @CXXFLAGS@ -+CXXLDFLAGS = @CXXLDFLAGS@ -+CXX_VERSION = @CXX_VERSION@ -+CYGPATH_W = @CYGPATH_W@ -+DEFS = @DEFS@ -+DEPDIR = @DEPDIR@ -+DOT_FRM_VERSION = @DOT_FRM_VERSION@ -+DVIS = @DVIS@ -+ECHO = @ECHO@ -+ECHO_C = @ECHO_C@ -+ECHO_N = @ECHO_N@ -+ECHO_T = @ECHO_T@ -+EGREP = @EGREP@ -+EXEEXT = @EXEEXT@ -+F77 = @F77@ -+FFLAGS = @FFLAGS@ -+FIND_PROC = @FIND_PROC@ -+GETCONF = @GETCONF@ -+GXX = @GXX@ -+HAVE_NETWARE_FALSE = @HAVE_NETWARE_FALSE@ -+HAVE_NETWARE_TRUE = @HAVE_NETWARE_TRUE@ -+HOSTNAME = @HOSTNAME@ -+INSTALL_DATA = @INSTALL_DATA@ -+INSTALL_PROGRAM = @INSTALL_PROGRAM@ -+INSTALL_SCRIPT = @INSTALL_SCRIPT@ -+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -+IS_LINUX = @IS_LINUX@ -+KILL = @KILL@ -+LD = @LD@ -+LDFLAGS = @LDFLAGS@ -+LIBDL = @LIBDL@ -+LIBOBJS = @LIBOBJS@ -+LIBS = @LIBS@ -+LIBTOOL = @LIBTOOL@ -+LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@ -+LM_CFLAGS = @LM_CFLAGS@ -+LN = @LN@ -+LN_CP_F = @LN_CP_F@ -+LN_S = @LN_S@ -+LOCAL_FALSE = @LOCAL_FALSE@ -+LOCAL_TRUE = @LOCAL_TRUE@ -+LTLIBOBJS = @LTLIBOBJS@ -+MACHINE_TYPE = @MACHINE_TYPE@ -+MAINT = @MAINT@ -+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -+MAKEINFO = @MAKEINFO@ -+MAKE_BINARY_DISTRIBUTION_OPTIONS = @MAKE_BINARY_DISTRIBUTION_OPTIONS@ -+MAKE_SHELL = @MAKE_SHELL@ -+MT_INCLUDES = @MT_INCLUDES@ -+MT_LD_ADD = @MT_LD_ADD@ -+MV = @MV@ -+MYSQLD_DEFAULT_SWITCHES = @MYSQLD_DEFAULT_SWITCHES@ -+MYSQLD_EXTRA_LDFLAGS = @MYSQLD_EXTRA_LDFLAGS@ -+MYSQLD_USER = @MYSQLD_USER@ -+MYSQL_BASE_VERSION = @MYSQL_BASE_VERSION@ -+MYSQL_NO_DASH_VERSION = @MYSQL_NO_DASH_VERSION@ -+MYSQL_SERVER_SUFFIX = @MYSQL_SERVER_SUFFIX@ -+MYSQL_TCP_PORT = @MYSQL_TCP_PORT@ -+MYSQL_TCP_PORT_DEFAULT = @MYSQL_TCP_PORT_DEFAULT@ -+MYSQL_UNIX_ADDR = @MYSQL_UNIX_ADDR@ -+MYSQL_VERSION_ID = @MYSQL_VERSION_ID@ -+NOINST_LDFLAGS = @NOINST_LDFLAGS@ -+OBJEXT = @OBJEXT@ -+PACKAGE = @PACKAGE@ -+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -+PACKAGE_NAME = @PACKAGE_NAME@ -+PACKAGE_STRING = @PACKAGE_STRING@ -+PACKAGE_TARNAME = @PACKAGE_TARNAME@ -+PACKAGE_VERSION = @PACKAGE_VERSION@ -+PATH_SEPARATOR = @PATH_SEPARATOR@ -+PDFMANUAL = @PDFMANUAL@ -+PERL = @PERL@ -+PERL5 = @PERL5@ -+PROTOCOL_VERSION = @PROTOCOL_VERSION@ -+PS = @PS@ -+RANLIB = @RANLIB@ -+RM = @RM@ -+SAVE_ASFLAGS = @SAVE_ASFLAGS@ -+SAVE_CFLAGS = @SAVE_CFLAGS@ -+SAVE_CXXFLAGS = @SAVE_CXXFLAGS@ -+SAVE_CXXLDFLAGS = @SAVE_CXXLDFLAGS@ -+SAVE_LDFLAGS = @SAVE_LDFLAGS@ -+SED = @SED@ -+SET_MAKE = @SET_MAKE@ -+SHARED_LIB_VERSION = @SHARED_LIB_VERSION@ -+SHELL = @SHELL@ -+STRIP = @STRIP@ -+SYSTEM_TYPE = @SYSTEM_TYPE@ -+TAR = @TAR@ -+TERMCAP_LIB = @TERMCAP_LIB@ -+THREAD_LOBJECTS = @THREAD_LOBJECTS@ -+THREAD_LPROGRAMS = @THREAD_LPROGRAMS@ -+VERSION = @VERSION@ -+WRAPLIBS = @WRAPLIBS@ -+YACC = @YACC@ -+ac_ct_AR = @ac_ct_AR@ -+ac_ct_CC = @ac_ct_CC@ -+ac_ct_CXX = @ac_ct_CXX@ -+ac_ct_F77 = @ac_ct_F77@ -+ac_ct_GETCONF = @ac_ct_GETCONF@ -+ac_ct_RANLIB = @ac_ct_RANLIB@ -+ac_ct_STRIP = @ac_ct_STRIP@ -+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -+am__include = @am__include@ -+am__leading_dot = @am__leading_dot@ -+am__quote = @am__quote@ -+bdb_includes = @bdb_includes@ -+bdb_libs = @bdb_libs@ -+bdb_libs_with_path = @bdb_libs_with_path@ -+bench_dirs = @bench_dirs@ -+bindir = @bindir@ -+build = @build@ -+build_alias = @build_alias@ -+build_cpu = @build_cpu@ -+build_os = @build_os@ -+build_vendor = @build_vendor@ -+datadir = @datadir@ -+default_charset = @default_charset@ -+docs_dirs = @docs_dirs@ -+exec_prefix = @exec_prefix@ -+host = @host@ -+host_alias = @host_alias@ -+host_cpu = @host_cpu@ -+host_os = @host_os@ -+host_vendor = @host_vendor@ -+includedir = @includedir@ -+infodir = @infodir@ -+innodb_includes = @innodb_includes@ -+innodb_libs = @innodb_libs@ -+innodb_system_libs = @innodb_system_libs@ -+install_sh = @install_sh@ -+isam_libs = @isam_libs@ -+libdir = @libdir@ -+libexecdir = @libexecdir@ -+libmysqld_dirs = @libmysqld_dirs@ -+linked_client_targets = @linked_client_targets@ -+linked_netware_sources = @linked_netware_sources@ -+localstatedir = @localstatedir@ -+man_dirs = @man_dirs@ -+mandir = @mandir@ -+netware_dir = @netware_dir@ -+oldincludedir = @oldincludedir@ -+openssl_includes = @openssl_includes@ -+openssl_libs = @openssl_libs@ -+orbit_idl = @orbit_idl@ -+orbit_includes = @orbit_includes@ -+orbit_libs = @orbit_libs@ -+prefix = @prefix@ -+program_transform_name = @program_transform_name@ -+pstack_dirs = @pstack_dirs@ -+pstack_libs = @pstack_libs@ -+readline_dir = @readline_dir@ -+readline_link = @readline_link@ -+sbindir = @sbindir@ -+server_scripts = @server_scripts@ -+sharedstatedir = @sharedstatedir@ -+sql_client_dirs = @sql_client_dirs@ -+sql_server_dirs = @sql_server_dirs@ -+sysconfdir = @sysconfdir@ -+target = @target@ -+target_alias = @target_alias@ -+target_cpu = @target_cpu@ -+target_os = @target_os@ -+target_vendor = @target_vendor@ -+thread_dirs = @thread_dirs@ -+tools_dirs = @tools_dirs@ -+uname_prog = @uname_prog@ -+vio_dir = @vio_dir@ -+vio_libs = @vio_libs@ -+ -+AUTOMAKE_OPTIONS = foreign -+ -+# These are built from source in the Docs directory -+EXTRA_DIST = INSTALL-SOURCE README COPYING EXCEPTIONS-CLIENT -+SUBDIRS = . include @docs_dirs@ @readline_dir@ \ -+ @thread_dirs@ pstack @sql_client_dirs@ \ -+ @sql_server_dirs@ scripts @man_dirs@ tests \ -+ BUILD netware os2 @libmysqld_dirs@ \ -+ @bench_dirs@ support-files @tools_dirs@ -+ -+ -+# Relink after clean -+linked_sources = linked_client_sources linked_server_sources \ -+ linked_libmysql_sources linked_libmysql_r_sources \ -+ linked_libmysqld_sources linked_libmysqldex_sources \ -+ linked_include_sources @linked_netware_sources@ -+ -+ -+CLEANFILES = $(linked_sources) -+subdir = . -+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -+CONFIG_HEADER = config.h -+CONFIG_CLEAN_FILES = bdb/Makefile -+DIST_SOURCES = -+ -+RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ -+ ps-recursive install-info-recursive uninstall-info-recursive \ -+ all-recursive install-data-recursive install-exec-recursive \ -+ installdirs-recursive install-recursive uninstall-recursive \ -+ check-recursive installcheck-recursive -+DIST_COMMON = README $(srcdir)/Makefile.in $(srcdir)/configure COPYING \ -+ ChangeLog Makefile.am acconfig.h acinclude.m4 aclocal.m4 \ -+ config.guess config.h.in config.sub configure configure.in \ -+ depcomp install-sh ltconfig ltmain.sh missing mkinstalldirs -+DIST_SUBDIRS = $(SUBDIRS) -+all: config.h -+ $(MAKE) $(AM_MAKEFLAGS) all-recursive -+ -+.SUFFIXES: -+ -+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ -+ configure.lineno -+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) -+ cd $(top_srcdir) && \ -+ $(AUTOMAKE) --foreign Makefile -+Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status -+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) -+ -+$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) -+ $(SHELL) ./config.status --recheck -+$(srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) -+ cd $(srcdir) && $(AUTOCONF) -+ -+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in acinclude.m4 -+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -+ -+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status -+ @rm -f stamp-h1 -+ cd $(top_builddir) && $(SHELL) ./config.status config.h -+ -+$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/acconfig.h -+ cd $(top_srcdir) && $(AUTOHEADER) -+ touch $(srcdir)/config.h.in -+ -+distclean-hdr: -+ -rm -f config.h stamp-h1 -+bdb/Makefile: $(top_builddir)/config.status $(top_srcdir)/bdb/Makefile.in -+ cd $(top_builddir) && $(SHELL) ./config.status $@ -+ -+mostlyclean-libtool: -+ -rm -f *.lo -+ -+clean-libtool: -+ -rm -rf .libs _libs -+ -+distclean-libtool: -+ -rm -f libtool -+uninstall-info-am: -+ -+# This directory's subdirectories are mostly independent; you can cd -+# into them and run `make' without going through this Makefile. -+# To change the values of `make' variables: instead of editing Makefiles, -+# (1) if the variable is set in `config.status', edit `config.status' -+# (which will cause the Makefiles to be regenerated when you run `make'); -+# (2) otherwise, pass the desired values on the `make' command line. -+$(RECURSIVE_TARGETS): -+ @set fnord $$MAKEFLAGS; amf=$$2; \ -+ dot_seen=no; \ -+ target=`echo $@ | sed s/-recursive//`; \ -+ list='$(SUBDIRS)'; for subdir in $$list; do \ -+ echo "Making $$target in $$subdir"; \ -+ if test "$$subdir" = "."; then \ -+ dot_seen=yes; \ -+ local_target="$$target-am"; \ -+ else \ -+ local_target="$$target"; \ -+ fi; \ -+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ -+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ -+ done; \ -+ if test "$$dot_seen" = "no"; then \ -+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ -+ fi; test -z "$$fail" -+ -+mostlyclean-recursive clean-recursive distclean-recursive \ -+maintainer-clean-recursive: -+ @set fnord $$MAKEFLAGS; amf=$$2; \ -+ dot_seen=no; \ -+ case "$@" in \ -+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ -+ *) list='$(SUBDIRS)' ;; \ -+ esac; \ -+ rev=''; for subdir in $$list; do \ -+ if test "$$subdir" = "."; then :; else \ -+ rev="$$subdir $$rev"; \ -+ fi; \ -+ done; \ -+ rev="$$rev ."; \ -+ target=`echo $@ | sed s/-recursive//`; \ -+ for subdir in $$rev; do \ -+ echo "Making $$target in $$subdir"; \ -+ if test "$$subdir" = "."; then \ -+ local_target="$$target-am"; \ -+ else \ -+ local_target="$$target"; \ -+ fi; \ -+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ -+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ -+ done && test -z "$$fail" -+tags-recursive: -+ list='$(SUBDIRS)'; for subdir in $$list; do \ -+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ -+ done -+ctags-recursive: -+ list='$(SUBDIRS)'; for subdir in $$list; do \ -+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ -+ done -+ -+ETAGS = etags -+ETAGSFLAGS = -+ -+CTAGS = ctags -+CTAGSFLAGS = -+ -+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) -+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ -+ unique=`for i in $$list; do \ -+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ -+ done | \ -+ $(AWK) ' { files[$$0] = 1; } \ -+ END { for (i in files) print i; }'`; \ -+ mkid -fID $$unique -+ -+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ -+ $(TAGS_FILES) $(LISP) -+ tags=; \ -+ here=`pwd`; \ -+ if (etags --etags-include --version) >/dev/null 2>&1; then \ -+ include_option=--etags-include; \ -+ else \ -+ include_option=--include; \ -+ fi; \ -+ list='$(SUBDIRS)'; for subdir in $$list; do \ -+ if test "$$subdir" = .; then :; else \ -+ test -f $$subdir/TAGS && \ -+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ -+ fi; \ -+ done; \ -+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ -+ unique=`for i in $$list; do \ -+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ -+ done | \ -+ $(AWK) ' { files[$$0] = 1; } \ -+ END { for (i in files) print i; }'`; \ -+ test -z "$(ETAGS_ARGS)$$tags$$unique" \ -+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ -+ $$tags $$unique -+ -+ctags: CTAGS -+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ -+ $(TAGS_FILES) $(LISP) -+ tags=; \ -+ here=`pwd`; \ -+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ -+ unique=`for i in $$list; do \ -+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ -+ done | \ -+ $(AWK) ' { files[$$0] = 1; } \ -+ END { for (i in files) print i; }'`; \ -+ test -z "$(CTAGS_ARGS)$$tags$$unique" \ -+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ -+ $$tags $$unique -+ -+GTAGS: -+ here=`$(am__cd) $(top_builddir) && pwd` \ -+ && cd $(top_srcdir) \ -+ && gtags -i $(GTAGS_ARGS) $$here -+ -+distclean-tags: -+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -+ -+top_distdir = . -+distdir = $(PACKAGE)-$(VERSION) -+ -+am__remove_distdir = \ -+ { test ! -d $(distdir) \ -+ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ -+ && rm -fr $(distdir); }; } -+ -+GZIP_ENV = --best -+distuninstallcheck_listfiles = find . -type f -print -+distcleancheck_listfiles = find . -type f -print -+ -+distdir: $(DISTFILES) -+ $(am__remove_distdir) -+ mkdir $(distdir) -+ $(mkinstalldirs) $(distdir)/bdb $(distdir)/include -+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ -+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ -+ list='$(DISTFILES)'; for file in $$list; do \ -+ case $$file in \ -+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ -+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ -+ esac; \ -+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ -+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ -+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ -+ dir="/$$dir"; \ -+ $(mkinstalldirs) "$(distdir)$$dir"; \ -+ else \ -+ dir=''; \ -+ fi; \ -+ if test -d $$d/$$file; then \ -+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ -+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ -+ fi; \ -+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ -+ else \ -+ test -f $(distdir)/$$file \ -+ || cp -p $$d/$$file $(distdir)/$$file \ -+ || exit 1; \ -+ fi; \ -+ done -+ list='$(SUBDIRS)'; for subdir in $$list; do \ -+ if test "$$subdir" = .; then :; else \ -+ test -d $(distdir)/$$subdir \ -+ || mkdir $(distdir)/$$subdir \ -+ || exit 1; \ -+ (cd $$subdir && \ -+ $(MAKE) $(AM_MAKEFLAGS) \ -+ top_distdir="$(top_distdir)" \ -+ distdir=../$(distdir)/$$subdir \ -+ distdir) \ -+ || exit 1; \ -+ fi; \ -+ done -+ $(MAKE) $(AM_MAKEFLAGS) \ -+ top_distdir="$(top_distdir)" distdir="$(distdir)" \ -+ dist-hook -+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ -+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ -+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ -+ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ -+ || chmod -R a+r $(distdir) -+dist-gzip: distdir -+ $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz -+ $(am__remove_distdir) -+ -+dist dist-all: distdir -+ $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz -+ $(am__remove_distdir) -+ -+# This target untars the dist file and tries a VPATH configuration. Then -+# it guarantees that the distribution is self-contained by making another -+# tarfile. -+distcheck: dist -+ $(am__remove_distdir) -+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - -+ chmod -R a-w $(distdir); chmod a+w $(distdir) -+ mkdir $(distdir)/_build -+ mkdir $(distdir)/_inst -+ chmod a-w $(distdir) -+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ -+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ -+ && cd $(distdir)/_build \ -+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ -+ $(DISTCHECK_CONFIGURE_FLAGS) \ -+ && $(MAKE) $(AM_MAKEFLAGS) \ -+ && $(MAKE) $(AM_MAKEFLAGS) dvi \ -+ && $(MAKE) $(AM_MAKEFLAGS) check \ -+ && $(MAKE) $(AM_MAKEFLAGS) install \ -+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ -+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ -+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ -+ distuninstallcheck \ -+ && chmod -R a-w "$$dc_install_base" \ -+ && ({ \ -+ (cd ../.. && $(mkinstalldirs) "$$dc_destdir") \ -+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ -+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ -+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ -+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ -+ } || { rm -rf "$$dc_destdir"; exit 1; }) \ -+ && rm -rf "$$dc_destdir" \ -+ && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ -+ && rm -f $(distdir).tar.gz \ -+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck -+ $(am__remove_distdir) -+ @echo "$(distdir).tar.gz is ready for distribution" | \ -+ sed 'h;s/./=/g;p;x;p;x' -+distuninstallcheck: -+ @cd $(distuninstallcheck_dir) \ -+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ -+ || { echo "ERROR: files left after uninstall:" ; \ -+ if test -n "$(DESTDIR)"; then \ -+ echo " (check DESTDIR support)"; \ -+ fi ; \ -+ $(distuninstallcheck_listfiles) ; \ -+ exit 1; } >&2 -+distcleancheck: distclean -+ @if test '$(srcdir)' = . ; then \ -+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ -+ exit 1 ; \ -+ fi -+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ -+ || { echo "ERROR: files left in build directory after distclean:" ; \ -+ $(distcleancheck_listfiles) ; \ -+ exit 1; } >&2 -+check-am: all-am -+check: check-recursive -+all-am: Makefile config.h -+installdirs: installdirs-recursive -+installdirs-am: -+ -+install: install-recursive -+install-exec: install-exec-recursive -+install-data: install-data-recursive -+uninstall: uninstall-recursive -+ -+install-am: all-am -+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -+ -+installcheck: installcheck-recursive -+install-strip: -+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ -+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ -+ `test -z '$(STRIP)' || \ -+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -+mostlyclean-generic: -+ -+clean-generic: -+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) -+ -+distclean-generic: -+ -rm -f $(CONFIG_CLEAN_FILES) -+ -+maintainer-clean-generic: -+ @echo "This command is intended for maintainers to use" -+ @echo "it deletes files that may require special tools to rebuild." -+clean: clean-recursive -+ -+clean-am: clean-generic clean-libtool mostlyclean-am -+ -+distclean: distclean-recursive -+ -rm -f $(am__CONFIG_DISTCLEAN_FILES) -+ -rm -f Makefile -+distclean-am: clean-am distclean-generic distclean-hdr distclean-libtool \ -+ distclean-tags -+ -+dvi: dvi-recursive -+ -+dvi-am: -+ -+info: info-recursive -+ -+info-am: -+ -+install-data-am: -+ -+install-exec-am: -+ -+install-info: install-info-recursive -+ -+install-man: -+ -+installcheck-am: -+ -+maintainer-clean: maintainer-clean-recursive -+ -rm -f $(am__CONFIG_DISTCLEAN_FILES) -+ -rm -rf $(top_srcdir)/autom4te.cache -+ -rm -f Makefile -+maintainer-clean-am: distclean-am maintainer-clean-generic -+ -+mostlyclean: mostlyclean-recursive -+ -+mostlyclean-am: mostlyclean-generic mostlyclean-libtool -+ -+pdf: pdf-recursive -+ -+pdf-am: -+ -+ps: ps-recursive -+ -+ps-am: -+ -+uninstall-am: uninstall-info-am -+ -+uninstall-info: uninstall-info-recursive -+ -+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ -+ clean-generic clean-libtool clean-recursive ctags \ -+ ctags-recursive dist dist-all dist-gzip distcheck distclean \ -+ distclean-generic distclean-hdr distclean-libtool \ -+ distclean-recursive distclean-tags distcleancheck distdir \ -+ distuninstallcheck dvi dvi-am dvi-recursive info info-am \ -+ info-recursive install install-am install-data install-data-am \ -+ install-data-recursive install-exec install-exec-am \ -+ install-exec-recursive install-info install-info-am \ -+ install-info-recursive install-man install-recursive \ -+ install-strip installcheck installcheck-am installdirs \ -+ installdirs-am installdirs-recursive maintainer-clean \ -+ maintainer-clean-generic maintainer-clean-recursive mostlyclean \ -+ mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ -+ pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \ -+ tags-recursive uninstall uninstall-am uninstall-info-am \ -+ uninstall-info-recursive uninstall-recursive -+ -+ -+# This is just so that the linking is done early. -+config.h: $(linked_sources) -+ -+linked_include_sources: -+ cd include; $(MAKE) link_sources -+ echo timestamp > linked_include_sources -+ -+linked_client_sources: @linked_client_targets@ -+ cd client; $(MAKE) link_sources -+ echo timestamp > linked_client_sources -+ -+linked_libmysql_sources: -+ cd libmysql; $(MAKE) link_sources -+ echo timestamp > linked_libmysql_sources -+ -+linked_libmysql_r_sources: linked_libmysql_sources -+ cd libmysql_r; $(MAKE) link_sources -+ echo timestamp > linked_libmysql_r_sources -+ -+linked_libmysqld_sources: -+ cd libmysqld; $(MAKE) link_sources -+ echo timestamp > linked_libmysqld_sources -+ -+linked_libmysqldex_sources: -+ cd libmysqld/examples; $(MAKE) link_sources -+ echo timestamp > linked_libmysqldex_sources -+ -+linked_netware_sources: -+ cd @netware_dir@; $(MAKE) link_sources -+ echo timestamp > linked_netware_sources -+ -+#avoid recursive make calls in sql directory -+linked_server_sources: -+ cd sql; rm -f mini_client_errors.c;@LN_CP_F@ ../libmysql/errmsg.c mini_client_errors.c -+ echo timestamp > linked_server_sources -+ -+# Create permission databases -+init-db: all -+ $(top_builddir)/scripts/mysql_install_db -+ -+bin-dist: all -+ $(top_builddir)/scripts/make_binary_distribution @MAKE_BINARY_DISTRIBUTION_OPTIONS@ -+ -+# Remove BK's "SCCS" subdirectories from source distribution -+dist-hook: -+ rm -rf `find $(distdir) -type d -name SCCS` -+ -+tags: -+ support-files/build-tags -+.PHONY: init-db bin-dist -+ -+# Test installation -+ -+test: -+ cd mysql-test ; ./mysql-test-run -+# Tell versions [3.59,3.63) of GNU make to not export all variables. -+# Otherwise a system limit (for SysV at least) may be exceeded. -+.NOEXPORT: diff --git a/debian/patches/01_MAKEFILES__Docs_Makefile.in.dpatch b/debian/patches/01_MAKEFILES__Docs_Makefile.in.dpatch deleted file mode 100755 index 6440697bc02..00000000000 --- a/debian/patches/01_MAKEFILES__Docs_Makefile.in.dpatch +++ /dev/null @@ -1,776 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 01_MAKEFILES__Docs_Makefile.in.dpatch by -## -## All lines beginning with `## DP:' are a description of the patch. -## DP: Creates Docs/Makefile.in - -@DPATCH@ - ---- old/Docs/Makefile.in 2005-03-01 02:08:01.877429040 +0100 -+++ new/Docs/Makefile.in 2005-02-28 21:21:24.000000000 +0100 -@@ -0,0 +1,765 @@ -+# Makefile.in generated by automake 1.7.9 from Makefile.am. -+# @configure_input@ -+ -+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -+# Free Software Foundation, Inc. -+# This Makefile.in is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. -+ -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -+# PARTICULAR PURPOSE. -+ -+@SET_MAKE@ -+ -+# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ -+# Process this file with automake to create Makefile.in -+ -+srcdir = @srcdir@ -+top_srcdir = @top_srcdir@ -+VPATH = @srcdir@ -+pkgdatadir = $(datadir)/@PACKAGE@ -+pkglibdir = $(libdir)/@PACKAGE@ -+pkgincludedir = $(includedir)/@PACKAGE@ -+top_builddir = . -+ -+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -+INSTALL = @INSTALL@ -+install_sh_DATA = $(install_sh) -c -m 644 -+install_sh_PROGRAM = $(install_sh) -c -+install_sh_SCRIPT = $(install_sh) -c -+INSTALL_HEADER = $(INSTALL_DATA) -+transform = $(program_transform_name) -+NORMAL_INSTALL = : -+PRE_INSTALL = : -+POST_INSTALL = : -+NORMAL_UNINSTALL = : -+PRE_UNINSTALL = : -+POST_UNINSTALL = : -+build_triplet = @build@ -+host_triplet = @host@ -+target_triplet = @target@ -+ACLOCAL = @ACLOCAL@ -+ALLOCA = @ALLOCA@ -+AMDEP_FALSE = @AMDEP_FALSE@ -+AMDEP_TRUE = @AMDEP_TRUE@ -+AMTAR = @AMTAR@ -+AR = @AR@ -+AS = @AS@ -+ASSEMBLER_FALSE = @ASSEMBLER_FALSE@ -+ASSEMBLER_TRUE = @ASSEMBLER_TRUE@ -+ASSEMBLER_sparc32_FALSE = @ASSEMBLER_sparc32_FALSE@ -+ASSEMBLER_sparc32_TRUE = @ASSEMBLER_sparc32_TRUE@ -+ASSEMBLER_sparc64_FALSE = @ASSEMBLER_sparc64_FALSE@ -+ASSEMBLER_sparc64_TRUE = @ASSEMBLER_sparc64_TRUE@ -+ASSEMBLER_x86_FALSE = @ASSEMBLER_x86_FALSE@ -+ASSEMBLER_x86_TRUE = @ASSEMBLER_x86_TRUE@ -+AUTOCONF = @AUTOCONF@ -+AUTOHEADER = @AUTOHEADER@ -+AUTOMAKE = @AUTOMAKE@ -+AVAILABLE_LANGUAGES = @AVAILABLE_LANGUAGES@ -+AVAILABLE_LANGUAGES_ERRORS = @AVAILABLE_LANGUAGES_ERRORS@ -+AWK = @AWK@ -+CC = @CC@ -+CCAS = @CCAS@ -+CCASFLAGS = @CCASFLAGS@ -+CCDEPMODE = @CCDEPMODE@ -+CC_VERSION = @CC_VERSION@ -+CFLAGS = @CFLAGS@ -+CHARSETS_NEED_SOURCE = @CHARSETS_NEED_SOURCE@ -+CHARSET_OBJS = @CHARSET_OBJS@ -+CHARSET_SRCS = @CHARSET_SRCS@ -+CHECK_PID = @CHECK_PID@ -+CHMOD = @CHMOD@ -+CLIENT_EXTRA_LDFLAGS = @CLIENT_EXTRA_LDFLAGS@ -+CLIENT_LIBS = @CLIENT_LIBS@ -+CMP = @CMP@ -+COMPILATION_COMMENT = @COMPILATION_COMMENT@ -+COMPILE_PSTACK_FALSE = @COMPILE_PSTACK_FALSE@ -+COMPILE_PSTACK_TRUE = @COMPILE_PSTACK_TRUE@ -+CONF_COMMAND = @CONF_COMMAND@ -+CP = @CP@ -+CPP = @CPP@ -+CPPFLAGS = @CPPFLAGS@ -+CXX = @CXX@ -+CXXCPP = @CXXCPP@ -+CXXDEPMODE = @CXXDEPMODE@ -+CXXFLAGS = @CXXFLAGS@ -+CXXLDFLAGS = @CXXLDFLAGS@ -+CXX_VERSION = @CXX_VERSION@ -+CYGPATH_W = @CYGPATH_W@ -+DEFS = @DEFS@ -+DEPDIR = @DEPDIR@ -+DOT_FRM_VERSION = @DOT_FRM_VERSION@ -+DVIS = @DVIS@ -+ECHO = @ECHO@ -+ECHO_C = @ECHO_C@ -+ECHO_N = @ECHO_N@ -+ECHO_T = @ECHO_T@ -+EGREP = @EGREP@ -+EXEEXT = @EXEEXT@ -+F77 = @F77@ -+FFLAGS = @FFLAGS@ -+FIND_PROC = @FIND_PROC@ -+GETCONF = @GETCONF@ -+GXX = @GXX@ -+HAVE_NETWARE_FALSE = @HAVE_NETWARE_FALSE@ -+HAVE_NETWARE_TRUE = @HAVE_NETWARE_TRUE@ -+HOSTNAME = @HOSTNAME@ -+INSTALL_DATA = @INSTALL_DATA@ -+INSTALL_PROGRAM = @INSTALL_PROGRAM@ -+INSTALL_SCRIPT = @INSTALL_SCRIPT@ -+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -+IS_LINUX = @IS_LINUX@ -+KILL = @KILL@ -+LD = @LD@ -+LDFLAGS = @LDFLAGS@ -+LIBDL = @LIBDL@ -+LIBOBJS = @LIBOBJS@ -+LIBS = @LIBS@ -+LIBTOOL = @LIBTOOL@ -+LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@ -+LM_CFLAGS = @LM_CFLAGS@ -+LN = @LN@ -+LN_CP_F = @LN_CP_F@ -+LN_S = @LN_S@ -+LOCAL_FALSE = @LOCAL_FALSE@ -+LOCAL_TRUE = @LOCAL_TRUE@ -+LTLIBOBJS = @LTLIBOBJS@ -+MACHINE_TYPE = @MACHINE_TYPE@ -+MAINT = @MAINT@ -+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -+MAKEINFO = @MAKEINFO@ -+MAKE_BINARY_DISTRIBUTION_OPTIONS = @MAKE_BINARY_DISTRIBUTION_OPTIONS@ -+MAKE_SHELL = @MAKE_SHELL@ -+MT_INCLUDES = @MT_INCLUDES@ -+MT_LD_ADD = @MT_LD_ADD@ -+MV = @MV@ -+MYSQLD_DEFAULT_SWITCHES = @MYSQLD_DEFAULT_SWITCHES@ -+MYSQLD_EXTRA_LDFLAGS = @MYSQLD_EXTRA_LDFLAGS@ -+MYSQLD_USER = @MYSQLD_USER@ -+MYSQL_BASE_VERSION = @MYSQL_BASE_VERSION@ -+MYSQL_NO_DASH_VERSION = @MYSQL_NO_DASH_VERSION@ -+MYSQL_SERVER_SUFFIX = @MYSQL_SERVER_SUFFIX@ -+MYSQL_TCP_PORT = @MYSQL_TCP_PORT@ -+MYSQL_TCP_PORT_DEFAULT = @MYSQL_TCP_PORT_DEFAULT@ -+MYSQL_UNIX_ADDR = @MYSQL_UNIX_ADDR@ -+MYSQL_VERSION_ID = @MYSQL_VERSION_ID@ -+NOINST_LDFLAGS = @NOINST_LDFLAGS@ -+OBJEXT = @OBJEXT@ -+PACKAGE = @PACKAGE@ -+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -+PACKAGE_NAME = @PACKAGE_NAME@ -+PACKAGE_STRING = @PACKAGE_STRING@ -+PACKAGE_TARNAME = @PACKAGE_TARNAME@ -+PACKAGE_VERSION = @PACKAGE_VERSION@ -+PATH_SEPARATOR = @PATH_SEPARATOR@ -+PDFMANUAL = @PDFMANUAL@ -+PERL = @PERL@ -+PERL5 = @PERL5@ -+PROTOCOL_VERSION = @PROTOCOL_VERSION@ -+PS = @PS@ -+RANLIB = @RANLIB@ -+RM = @RM@ -+SAVE_ASFLAGS = @SAVE_ASFLAGS@ -+SAVE_CFLAGS = @SAVE_CFLAGS@ -+SAVE_CXXFLAGS = @SAVE_CXXFLAGS@ -+SAVE_CXXLDFLAGS = @SAVE_CXXLDFLAGS@ -+SAVE_LDFLAGS = @SAVE_LDFLAGS@ -+SED = @SED@ -+SET_MAKE = @SET_MAKE@ -+SHARED_LIB_VERSION = @SHARED_LIB_VERSION@ -+SHELL = @SHELL@ -+STRIP = @STRIP@ -+SYSTEM_TYPE = @SYSTEM_TYPE@ -+TAR = @TAR@ -+TERMCAP_LIB = @TERMCAP_LIB@ -+THREAD_LOBJECTS = @THREAD_LOBJECTS@ -+THREAD_LPROGRAMS = @THREAD_LPROGRAMS@ -+VERSION = @VERSION@ -+WRAPLIBS = @WRAPLIBS@ -+YACC = @YACC@ -+ac_ct_AR = @ac_ct_AR@ -+ac_ct_CC = @ac_ct_CC@ -+ac_ct_CXX = @ac_ct_CXX@ -+ac_ct_F77 = @ac_ct_F77@ -+ac_ct_GETCONF = @ac_ct_GETCONF@ -+ac_ct_RANLIB = @ac_ct_RANLIB@ -+ac_ct_STRIP = @ac_ct_STRIP@ -+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -+am__include = @am__include@ -+am__leading_dot = @am__leading_dot@ -+am__quote = @am__quote@ -+bdb_includes = @bdb_includes@ -+bdb_libs = @bdb_libs@ -+bdb_libs_with_path = @bdb_libs_with_path@ -+bench_dirs = @bench_dirs@ -+bindir = @bindir@ -+build = @build@ -+build_alias = @build_alias@ -+build_cpu = @build_cpu@ -+build_os = @build_os@ -+build_vendor = @build_vendor@ -+datadir = @datadir@ -+default_charset = @default_charset@ -+docs_dirs = @docs_dirs@ -+exec_prefix = @exec_prefix@ -+host = @host@ -+host_alias = @host_alias@ -+host_cpu = @host_cpu@ -+host_os = @host_os@ -+host_vendor = @host_vendor@ -+includedir = @includedir@ -+infodir = @infodir@ -+innodb_includes = @innodb_includes@ -+innodb_libs = @innodb_libs@ -+innodb_system_libs = @innodb_system_libs@ -+install_sh = @install_sh@ -+isam_libs = @isam_libs@ -+libdir = @libdir@ -+libexecdir = @libexecdir@ -+libmysqld_dirs = @libmysqld_dirs@ -+linked_client_targets = @linked_client_targets@ -+linked_netware_sources = @linked_netware_sources@ -+localstatedir = @localstatedir@ -+man_dirs = @man_dirs@ -+mandir = @mandir@ -+netware_dir = @netware_dir@ -+oldincludedir = @oldincludedir@ -+openssl_includes = @openssl_includes@ -+openssl_libs = @openssl_libs@ -+orbit_idl = @orbit_idl@ -+orbit_includes = @orbit_includes@ -+orbit_libs = @orbit_libs@ -+prefix = @prefix@ -+program_transform_name = @program_transform_name@ -+pstack_dirs = @pstack_dirs@ -+pstack_libs = @pstack_libs@ -+readline_dir = @readline_dir@ -+readline_link = @readline_link@ -+sbindir = @sbindir@ -+server_scripts = @server_scripts@ -+sharedstatedir = @sharedstatedir@ -+sql_client_dirs = @sql_client_dirs@ -+sql_server_dirs = @sql_server_dirs@ -+sysconfdir = @sysconfdir@ -+target = @target@ -+target_alias = @target_alias@ -+target_cpu = @target_cpu@ -+target_os = @target_os@ -+target_vendor = @target_vendor@ -+thread_dirs = @thread_dirs@ -+tools_dirs = @tools_dirs@ -+uname_prog = @uname_prog@ -+vio_dir = @vio_dir@ -+vio_libs = @vio_libs@ -+ -+AUTOMAKE_OPTIONS = foreign -+ -+# These are built from source in the Docs directory -+EXTRA_DIST = INSTALL-SOURCE README COPYING EXCEPTIONS-CLIENT -+SUBDIRS = . include @docs_dirs@ @readline_dir@ \ -+ @thread_dirs@ pstack @sql_client_dirs@ \ -+ @sql_server_dirs@ scripts @man_dirs@ tests \ -+ BUILD netware os2 @libmysqld_dirs@ \ -+ @bench_dirs@ support-files @tools_dirs@ -+ -+ -+# Relink after clean -+linked_sources = linked_client_sources linked_server_sources \ -+ linked_libmysql_sources linked_libmysql_r_sources \ -+ linked_libmysqld_sources linked_libmysqldex_sources \ -+ linked_include_sources @linked_netware_sources@ -+ -+ -+CLEANFILES = $(linked_sources) -+subdir = . -+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -+CONFIG_HEADER = config.h -+CONFIG_CLEAN_FILES = bdb/Makefile -+DIST_SOURCES = -+ -+RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ -+ ps-recursive install-info-recursive uninstall-info-recursive \ -+ all-recursive install-data-recursive install-exec-recursive \ -+ installdirs-recursive install-recursive uninstall-recursive \ -+ check-recursive installcheck-recursive -+DIST_COMMON = README $(srcdir)/Makefile.in $(srcdir)/configure COPYING \ -+ ChangeLog Makefile.am acconfig.h acinclude.m4 aclocal.m4 \ -+ config.guess config.h.in config.sub configure configure.in \ -+ depcomp install-sh ltconfig ltmain.sh missing mkinstalldirs -+DIST_SUBDIRS = $(SUBDIRS) -+all: config.h -+ $(MAKE) $(AM_MAKEFLAGS) all-recursive -+ -+.SUFFIXES: -+ -+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ -+ configure.lineno -+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) -+ cd $(top_srcdir) && \ -+ $(AUTOMAKE) --foreign Makefile -+Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status -+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) -+ -+$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) -+ $(SHELL) ./config.status --recheck -+$(srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) -+ cd $(srcdir) && $(AUTOCONF) -+ -+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in acinclude.m4 -+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -+ -+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status -+ @rm -f stamp-h1 -+ cd $(top_builddir) && $(SHELL) ./config.status config.h -+ -+$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/acconfig.h -+ cd $(top_srcdir) && $(AUTOHEADER) -+ touch $(srcdir)/config.h.in -+ -+distclean-hdr: -+ -rm -f config.h stamp-h1 -+bdb/Makefile: $(top_builddir)/config.status $(top_srcdir)/bdb/Makefile.in -+ cd $(top_builddir) && $(SHELL) ./config.status $@ -+ -+mostlyclean-libtool: -+ -rm -f *.lo -+ -+clean-libtool: -+ -rm -rf .libs _libs -+ -+distclean-libtool: -+ -rm -f libtool -+uninstall-info-am: -+ -+# This directory's subdirectories are mostly independent; you can cd -+# into them and run `make' without going through this Makefile. -+# To change the values of `make' variables: instead of editing Makefiles, -+# (1) if the variable is set in `config.status', edit `config.status' -+# (which will cause the Makefiles to be regenerated when you run `make'); -+# (2) otherwise, pass the desired values on the `make' command line. -+$(RECURSIVE_TARGETS): -+ @set fnord $$MAKEFLAGS; amf=$$2; \ -+ dot_seen=no; \ -+ target=`echo $@ | sed s/-recursive//`; \ -+ list='$(SUBDIRS)'; for subdir in $$list; do \ -+ echo "Making $$target in $$subdir"; \ -+ if test "$$subdir" = "."; then \ -+ dot_seen=yes; \ -+ local_target="$$target-am"; \ -+ else \ -+ local_target="$$target"; \ -+ fi; \ -+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ -+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ -+ done; \ -+ if test "$$dot_seen" = "no"; then \ -+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ -+ fi; test -z "$$fail" -+ -+mostlyclean-recursive clean-recursive distclean-recursive \ -+maintainer-clean-recursive: -+ @set fnord $$MAKEFLAGS; amf=$$2; \ -+ dot_seen=no; \ -+ case "$@" in \ -+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ -+ *) list='$(SUBDIRS)' ;; \ -+ esac; \ -+ rev=''; for subdir in $$list; do \ -+ if test "$$subdir" = "."; then :; else \ -+ rev="$$subdir $$rev"; \ -+ fi; \ -+ done; \ -+ rev="$$rev ."; \ -+ target=`echo $@ | sed s/-recursive//`; \ -+ for subdir in $$rev; do \ -+ echo "Making $$target in $$subdir"; \ -+ if test "$$subdir" = "."; then \ -+ local_target="$$target-am"; \ -+ else \ -+ local_target="$$target"; \ -+ fi; \ -+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ -+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ -+ done && test -z "$$fail" -+tags-recursive: -+ list='$(SUBDIRS)'; for subdir in $$list; do \ -+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ -+ done -+ctags-recursive: -+ list='$(SUBDIRS)'; for subdir in $$list; do \ -+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ -+ done -+ -+ETAGS = etags -+ETAGSFLAGS = -+ -+CTAGS = ctags -+CTAGSFLAGS = -+ -+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) -+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ -+ unique=`for i in $$list; do \ -+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ -+ done | \ -+ $(AWK) ' { files[$$0] = 1; } \ -+ END { for (i in files) print i; }'`; \ -+ mkid -fID $$unique -+ -+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ -+ $(TAGS_FILES) $(LISP) -+ tags=; \ -+ here=`pwd`; \ -+ if (etags --etags-include --version) >/dev/null 2>&1; then \ -+ include_option=--etags-include; \ -+ else \ -+ include_option=--include; \ -+ fi; \ -+ list='$(SUBDIRS)'; for subdir in $$list; do \ -+ if test "$$subdir" = .; then :; else \ -+ test -f $$subdir/TAGS && \ -+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ -+ fi; \ -+ done; \ -+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ -+ unique=`for i in $$list; do \ -+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ -+ done | \ -+ $(AWK) ' { files[$$0] = 1; } \ -+ END { for (i in files) print i; }'`; \ -+ test -z "$(ETAGS_ARGS)$$tags$$unique" \ -+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ -+ $$tags $$unique -+ -+ctags: CTAGS -+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ -+ $(TAGS_FILES) $(LISP) -+ tags=; \ -+ here=`pwd`; \ -+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ -+ unique=`for i in $$list; do \ -+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ -+ done | \ -+ $(AWK) ' { files[$$0] = 1; } \ -+ END { for (i in files) print i; }'`; \ -+ test -z "$(CTAGS_ARGS)$$tags$$unique" \ -+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ -+ $$tags $$unique -+ -+GTAGS: -+ here=`$(am__cd) $(top_builddir) && pwd` \ -+ && cd $(top_srcdir) \ -+ && gtags -i $(GTAGS_ARGS) $$here -+ -+distclean-tags: -+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -+ -+top_distdir = . -+distdir = $(PACKAGE)-$(VERSION) -+ -+am__remove_distdir = \ -+ { test ! -d $(distdir) \ -+ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ -+ && rm -fr $(distdir); }; } -+ -+GZIP_ENV = --best -+distuninstallcheck_listfiles = find . -type f -print -+distcleancheck_listfiles = find . -type f -print -+ -+distdir: $(DISTFILES) -+ $(am__remove_distdir) -+ mkdir $(distdir) -+ $(mkinstalldirs) $(distdir)/bdb $(distdir)/include -+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ -+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ -+ list='$(DISTFILES)'; for file in $$list; do \ -+ case $$file in \ -+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ -+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ -+ esac; \ -+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ -+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ -+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ -+ dir="/$$dir"; \ -+ $(mkinstalldirs) "$(distdir)$$dir"; \ -+ else \ -+ dir=''; \ -+ fi; \ -+ if test -d $$d/$$file; then \ -+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ -+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ -+ fi; \ -+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ -+ else \ -+ test -f $(distdir)/$$file \ -+ || cp -p $$d/$$file $(distdir)/$$file \ -+ || exit 1; \ -+ fi; \ -+ done -+ list='$(SUBDIRS)'; for subdir in $$list; do \ -+ if test "$$subdir" = .; then :; else \ -+ test -d $(distdir)/$$subdir \ -+ || mkdir $(distdir)/$$subdir \ -+ || exit 1; \ -+ (cd $$subdir && \ -+ $(MAKE) $(AM_MAKEFLAGS) \ -+ top_distdir="$(top_distdir)" \ -+ distdir=../$(distdir)/$$subdir \ -+ distdir) \ -+ || exit 1; \ -+ fi; \ -+ done -+ $(MAKE) $(AM_MAKEFLAGS) \ -+ top_distdir="$(top_distdir)" distdir="$(distdir)" \ -+ dist-hook -+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ -+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ -+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ -+ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ -+ || chmod -R a+r $(distdir) -+dist-gzip: distdir -+ $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz -+ $(am__remove_distdir) -+ -+dist dist-all: distdir -+ $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz -+ $(am__remove_distdir) -+ -+# This target untars the dist file and tries a VPATH configuration. Then -+# it guarantees that the distribution is self-contained by making another -+# tarfile. -+distcheck: dist -+ $(am__remove_distdir) -+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - -+ chmod -R a-w $(distdir); chmod a+w $(distdir) -+ mkdir $(distdir)/_build -+ mkdir $(distdir)/_inst -+ chmod a-w $(distdir) -+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ -+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ -+ && cd $(distdir)/_build \ -+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ -+ $(DISTCHECK_CONFIGURE_FLAGS) \ -+ && $(MAKE) $(AM_MAKEFLAGS) \ -+ && $(MAKE) $(AM_MAKEFLAGS) dvi \ -+ && $(MAKE) $(AM_MAKEFLAGS) check \ -+ && $(MAKE) $(AM_MAKEFLAGS) install \ -+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ -+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ -+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ -+ distuninstallcheck \ -+ && chmod -R a-w "$$dc_install_base" \ -+ && ({ \ -+ (cd ../.. && $(mkinstalldirs) "$$dc_destdir") \ -+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ -+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ -+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ -+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ -+ } || { rm -rf "$$dc_destdir"; exit 1; }) \ -+ && rm -rf "$$dc_destdir" \ -+ && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ -+ && rm -f $(distdir).tar.gz \ -+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck -+ $(am__remove_distdir) -+ @echo "$(distdir).tar.gz is ready for distribution" | \ -+ sed 'h;s/./=/g;p;x;p;x' -+distuninstallcheck: -+ @cd $(distuninstallcheck_dir) \ -+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ -+ || { echo "ERROR: files left after uninstall:" ; \ -+ if test -n "$(DESTDIR)"; then \ -+ echo " (check DESTDIR support)"; \ -+ fi ; \ -+ $(distuninstallcheck_listfiles) ; \ -+ exit 1; } >&2 -+distcleancheck: distclean -+ @if test '$(srcdir)' = . ; then \ -+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ -+ exit 1 ; \ -+ fi -+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ -+ || { echo "ERROR: files left in build directory after distclean:" ; \ -+ $(distcleancheck_listfiles) ; \ -+ exit 1; } >&2 -+check-am: all-am -+check: check-recursive -+all-am: Makefile config.h -+installdirs: installdirs-recursive -+installdirs-am: -+ -+install: install-recursive -+install-exec: install-exec-recursive -+install-data: install-data-recursive -+uninstall: uninstall-recursive -+ -+install-am: all-am -+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -+ -+installcheck: installcheck-recursive -+install-strip: -+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ -+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ -+ `test -z '$(STRIP)' || \ -+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -+mostlyclean-generic: -+ -+clean-generic: -+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) -+ -+distclean-generic: -+ -rm -f $(CONFIG_CLEAN_FILES) -+ -+maintainer-clean-generic: -+ @echo "This command is intended for maintainers to use" -+ @echo "it deletes files that may require special tools to rebuild." -+clean: clean-recursive -+ -+clean-am: clean-generic clean-libtool mostlyclean-am -+ -+distclean: distclean-recursive -+ -rm -f $(am__CONFIG_DISTCLEAN_FILES) -+ -rm -f Makefile -+distclean-am: clean-am distclean-generic distclean-hdr distclean-libtool \ -+ distclean-tags -+ -+dvi: dvi-recursive -+ -+dvi-am: -+ -+info: info-recursive -+ -+info-am: -+ -+install-data-am: -+ -+install-exec-am: -+ -+install-info: install-info-recursive -+ -+install-man: -+ -+installcheck-am: -+ -+maintainer-clean: maintainer-clean-recursive -+ -rm -f $(am__CONFIG_DISTCLEAN_FILES) -+ -rm -rf $(top_srcdir)/autom4te.cache -+ -rm -f Makefile -+maintainer-clean-am: distclean-am maintainer-clean-generic -+ -+mostlyclean: mostlyclean-recursive -+ -+mostlyclean-am: mostlyclean-generic mostlyclean-libtool -+ -+pdf: pdf-recursive -+ -+pdf-am: -+ -+ps: ps-recursive -+ -+ps-am: -+ -+uninstall-am: uninstall-info-am -+ -+uninstall-info: uninstall-info-recursive -+ -+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ -+ clean-generic clean-libtool clean-recursive ctags \ -+ ctags-recursive dist dist-all dist-gzip distcheck distclean \ -+ distclean-generic distclean-hdr distclean-libtool \ -+ distclean-recursive distclean-tags distcleancheck distdir \ -+ distuninstallcheck dvi dvi-am dvi-recursive info info-am \ -+ info-recursive install install-am install-data install-data-am \ -+ install-data-recursive install-exec install-exec-am \ -+ install-exec-recursive install-info install-info-am \ -+ install-info-recursive install-man install-recursive \ -+ install-strip installcheck installcheck-am installdirs \ -+ installdirs-am installdirs-recursive maintainer-clean \ -+ maintainer-clean-generic maintainer-clean-recursive mostlyclean \ -+ mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ -+ pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \ -+ tags-recursive uninstall uninstall-am uninstall-info-am \ -+ uninstall-info-recursive uninstall-recursive -+ -+ -+# This is just so that the linking is done early. -+config.h: $(linked_sources) -+ -+linked_include_sources: -+ cd include; $(MAKE) link_sources -+ echo timestamp > linked_include_sources -+ -+linked_client_sources: @linked_client_targets@ -+ cd client; $(MAKE) link_sources -+ echo timestamp > linked_client_sources -+ -+linked_libmysql_sources: -+ cd libmysql; $(MAKE) link_sources -+ echo timestamp > linked_libmysql_sources -+ -+linked_libmysql_r_sources: linked_libmysql_sources -+ cd libmysql_r; $(MAKE) link_sources -+ echo timestamp > linked_libmysql_r_sources -+ -+linked_libmysqld_sources: -+ cd libmysqld; $(MAKE) link_sources -+ echo timestamp > linked_libmysqld_sources -+ -+linked_libmysqldex_sources: -+ cd libmysqld/examples; $(MAKE) link_sources -+ echo timestamp > linked_libmysqldex_sources -+ -+linked_netware_sources: -+ cd @netware_dir@; $(MAKE) link_sources -+ echo timestamp > linked_netware_sources -+ -+#avoid recursive make calls in sql directory -+linked_server_sources: -+ cd sql; rm -f mini_client_errors.c;@LN_CP_F@ ../libmysql/errmsg.c mini_client_errors.c -+ echo timestamp > linked_server_sources -+ -+# Create permission databases -+init-db: all -+ $(top_builddir)/scripts/mysql_install_db -+ -+bin-dist: all -+ $(top_builddir)/scripts/make_binary_distribution @MAKE_BINARY_DISTRIBUTION_OPTIONS@ -+ -+# Remove BK's "SCCS" subdirectories from source distribution -+dist-hook: -+ rm -rf `find $(distdir) -type d -name SCCS` -+ -+tags: -+ support-files/build-tags -+.PHONY: init-db bin-dist -+ -+# Test installation -+ -+test: -+ cd mysql-test ; ./mysql-test-run -+# Tell versions [3.59,3.63) of GNU make to not export all variables. -+# Otherwise a system limit (for SysV at least) may be exceeded. -+.NOEXPORT: diff --git a/debian/patches/21_init__openquery_configtest.dpatch b/debian/patches/21_init__openquery_configtest.dpatch deleted file mode 100644 index c76e98d6ee6..00000000000 --- a/debian/patches/21_init__openquery_configtest.dpatch +++ /dev/null @@ -1,33 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 35_init__openquery_configtest.dpatch by -## -## All lines beginning with `## DP:' are a description of the patch. -## DP: init__openquery_configtest.dpatch - -@DPATCH@ - ---- old/debian/mysql-server-5.0.mysql.init.orig 2008-12-19 12:03:30.379898336 +1100 -+++ new/debian/mysql-server-5.0.mysql.init 2008-12-19 12:04:46.660451093 +1100 -@@ -182,8 +182,21 @@ - fi - ;; - -+ 'configtest') -+ log_daemon_msg "Testing MySQL configuration" "syntax" -+ set +e -+ help_out=`/usr/sbin/mysqld --help 2>&1`; r=$? -+ set -e -+ if [ "$r" -ne 0 ]; then -+ log_failure_msg "$help_out" -+ log_failure_msg "There are syntax errors in the server configuration. Please fix them!" -+ fi -+ log_end_msg $r -+ exit $r -+ ;; -+ - *) -- echo "Usage: $SELF start|stop|restart|reload|force-reload|status" -+ echo "Usage: $SELF start|stop|restart|reload|force-reload|status|configtest" - exit 1 - ;; - esac diff --git a/debian/patches/44_scripts__mysql_config__libs.dpatch b/debian/patches/44_scripts__mysql_config__libs.dpatch deleted file mode 100755 index c06275fdef3..00000000000 --- a/debian/patches/44_scripts__mysql_config__libs.dpatch +++ /dev/null @@ -1,24 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 99-unnamed.dpatch by -## -## All lines beginning with `## DP:' are a description of the patch. -## DP: Removes unnecessary library dependencies. See #390692 - -@DPATCH@ -diff -Nur mysql-dfsg-5.1-5.1.31.orig/scripts/mysql_config.sh mysql-dfsg-5.1-5.1.31/scripts/mysql_config.sh ---- mysql-dfsg-5.1-5.1.31.orig/scripts/mysql_config.sh 2009-01-19 17:30:55.000000000 +0100 -+++ mysql-dfsg-5.1-5.1.31/scripts/mysql_config.sh 2009-02-08 17:17:48.000000000 +0100 -@@ -106,10 +106,10 @@ - - # Create options - # We intentionally add a space to the beginning and end of lib strings, simplifies replace later --libs=" $ldflags -L$pkglibdir @RPATH_OPTION@ -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@" -+libs=" $ldflags -L$pkglibdir @RPATH_OPTION@ -lmysqlclient" - libs="$libs @openssl_libs@ @STATIC_NSS_FLAGS@ " --libs_r=" $ldflags -L$pkglibdir @RPATH_OPTION@ -lmysqlclient_r @ZLIB_DEPS@ @CLIENT_LIBS@ @openssl_libs@ " --embedded_libs=" $ldflags -L$pkglibdir @RPATH_OPTION@ -lmysqld @LIBDL@ @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @openssl_libs@ " -+libs_r=" $ldflags -L$pkglibdir @RPATH_OPTION@ -lmysqlclient_r @CLIENT_LIBS@ @openssl_libs@ " -+embedded_libs=" $ldflags -L$pkglibdir @RPATH_OPTION@ -lmysqld @LIBDL@ @WRAPLIBS@ @openssl_libs@ " - - if [ -r "$pkglibdir/libmygcc.a" ]; then - # When linking against the static library with a different version of GCC diff --git a/debian/patches/60_zlib_innodb_workaround.dpatch b/debian/patches/60_zlib_innodb_workaround.dpatch deleted file mode 100644 index e8a496a5866..00000000000 --- a/debian/patches/60_zlib_innodb_workaround.dpatch +++ /dev/null @@ -1,31 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 60_zlib_innodb_workaround.dpatch by Norbert Tretkowski -## -## All lines beginning with `## DP:' are a description of the patch. -## DP: http://bugs.mysql.com/bug.php?id=47495 - -@DPATCH@ -diff -Nur mysql-dfsg-5.1-5.1.39.orig/mysql-test/suite/innodb/r/innodb-zip.result mysql-dfsg-5.1-5.1.39/mysql-test/suite/innodb/r/innodb-zip.result ---- mysql-dfsg-5.1-5.1.39.orig/mysql-test/suite/innodb/r/innodb-zip.result 2009-09-04 19:04:38.000000000 +0200 -+++ mysql-dfsg-5.1-5.1.39/mysql-test/suite/innodb/r/innodb-zip.result 2009-09-28 16:01:33.000000000 +0200 -@@ -141,7 +141,7 @@ - CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440))) - ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; - ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs --CREATE TABLE t1(c TEXT, PRIMARY KEY (c(439))) -+CREATE TABLE t1(c TEXT, PRIMARY KEY (c(438))) - ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; - INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512)); - DROP TABLE t1; -diff -Nur mysql-dfsg-5.1-5.1.39.orig/mysql-test/suite/innodb/t/innodb-zip.test mysql-dfsg-5.1-5.1.39/mysql-test/suite/innodb/t/innodb-zip.test ---- mysql-dfsg-5.1-5.1.39.orig/mysql-test/suite/innodb/t/innodb-zip.test 2009-09-04 19:04:37.000000000 +0200 -+++ mysql-dfsg-5.1-5.1.39/mysql-test/suite/innodb/t/innodb-zip.test 2009-09-28 16:01:22.000000000 +0200 -@@ -106,7 +106,7 @@ - --error ER_TOO_BIG_ROWSIZE - CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440))) - ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; --CREATE TABLE t1(c TEXT, PRIMARY KEY (c(439))) -+CREATE TABLE t1(c TEXT, PRIMARY KEY (c(438))) - ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; - INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512)); - DROP TABLE t1; diff --git a/debian/po/ar.po b/debian/po/ar.po index 387086d51ca..3b11740a365 100644 --- a/debian/po/ar.po +++ b/debian/po/ar.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: templates\n" "Report-Msgid-Bugs-To: mariadb-10.2@packages.debian.org\n" -"POT-Creation-Date: 2012-01-12 13:08+0100\n" +"POT-Creation-Date: 2016-10-08 01:26+0300\n" "PO-Revision-Date: 2007-05-01 13:04+0300\n" "Last-Translator: Ossama M. Khayat \n" "Language-Team: Arabic \n" @@ -25,40 +25,35 @@ msgstr "" ": n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5\n" ": n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5\n" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 -msgid "Really proceed with downgrade?" -msgstr "هل ÙØ¹Ù„اً تريد التثبيط؟" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." -msgstr "هناك مل٠مسمى /var/lib/mysql/debian-*.flag موجود على هذا النظام." - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -#, fuzzy -#| msgid "" -#| "Such file is an indication that a mariadb-server package with a higher " -#| "version has been installed earlier." -msgid "" -"Such a file is an indication that a mariadb-server package with a higher " -"version has been installed previously." +msgid "The old data directory will be saved at new location" msgstr "" -"هذا المل٠دلالة على أن نسخة أحدث من حزمة mariadb-server تم تثبيتها مسبقاً." -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"There is no guarantee that the version you're currently installing will be " -"able to use the current databases." +"A file named /var/lib/mysql/debian-*.flag exists on this system. The number " +"indicates a database binary format version that cannot automatically be " +"upgraded (or downgraded)." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Therefore the previous data directory will be renamed to /var/lib/mysql-* " +"and a new data directory will be initialized at /var/lib/mysql." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Please manually export/import your data (e.g. with mysqldump) if needed." msgstr "" -"ليست هناك أية ضمانة أن النسخة التي تقوم بتثبيتها ستكون قادرة على استخدام " -"قواعد البيانات الحالية." #. Type: note #. Description @@ -111,31 +106,15 @@ msgstr "" "إن كنت تقوم بإزالة حزمة MariaDB كي تقوم لاحقاً بتثبيت نسخة أحدث أو إن كانت " "حزمة mariadb-server Ù…Ø®ØªÙ„ÙØ© تستخدمها، Ùيجب إبقاء البيانات." -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "Start the MariaDB server on boot?" -msgstr "تشغيل خادم MariaDB عند الإقلاع؟" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "" -"The MariaDB server can be launched automatically at boot time or manually " -"with the '/etc/init.d/mysql start' command." -msgstr "" -"يمكن تشغيل خادم MariaDB آلياً وقت الإقلاع أو يدوياً باستخدام الأمر '/etc/init." -"d/mysql start'." - #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "New password for the MariaDB \"root\" user:" msgstr "كلمة المرور الجديدة لمستخد \"root\" الخاص بـMariaDB:" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "" "While not mandatory, it is highly recommended that you set a password for " "the MariaDB administrative \"root\" user." @@ -145,7 +124,7 @@ msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 #, fuzzy #| msgid "If that field is left blank, the password will not be changed." msgid "If this field is left blank, the password will not be changed." @@ -153,7 +132,7 @@ msgstr "إن ترك الحقل ÙØ§Ø±ØºØ§Ù‹ØŒ Ùلن يتم تغيير كلمة #. Type: password #. Description -#: ../mariadb-server-10.2.templates:7001 +#: ../mariadb-server-10.2.templates:6001 #, fuzzy #| msgid "New password for the MariaDB \"root\" user:" msgid "Repeat password for the MariaDB \"root\" user:" @@ -161,13 +140,13 @@ msgstr "كلمة المرور الجديدة لمستخد \"root\" الخاص ب #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "Unable to set password for the MariaDB \"root\" user" msgstr "تعذر تعيين كلمة مرور للمستخدم \"root\" الخاص بـMariaDB." #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "" "An error occurred while setting the password for the MariaDB administrative " "user. This may have happened because the account already has a password, or " @@ -179,7 +158,7 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "" #| "You should check the account's password after tha package installation." @@ -188,7 +167,7 @@ msgstr "يجب عليك التحقق من كلمة مرور الحساب عقب #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "" #| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for " @@ -197,21 +176,54 @@ msgid "" "Please read the /usr/share/doc/mariadb-server-10.2/README.Debian file for " "more information." msgstr "" -"الرجاء قراءة المل٠/usr/share/doc/mariadb-server-10.2/README.Debian للمزيد من " -"المعلومات." +"الرجاء قراءة المل٠/usr/share/doc/mariadb-server-10.2/README.Debian للمزيد " +"من المعلومات." #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "Password input error" msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "The two passwords you entered were not the same. Please try again." msgstr "" +#~ msgid "Really proceed with downgrade?" +#~ msgstr "هل ÙØ¹Ù„اً تريد التثبيط؟" + +#~ msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +#~ msgstr "هناك مل٠مسمى /var/lib/mysql/debian-*.flag موجود على هذا النظام." + +#, fuzzy +#~| msgid "" +#~| "Such file is an indication that a mariadb-server package with a higher " +#~| "version has been installed earlier." +#~ msgid "" +#~ "Such a file is an indication that a mariadb-server package with a higher " +#~ "version has been installed previously." +#~ msgstr "" +#~ "هذا المل٠دلالة على أن نسخة أحدث من حزمة mariadb-server تم تثبيتها مسبقاً." + +#~ msgid "" +#~ "There is no guarantee that the version you're currently installing will " +#~ "be able to use the current databases." +#~ msgstr "" +#~ "ليست هناك أية ضمانة أن النسخة التي تقوم بتثبيتها ستكون قادرة على استخدام " +#~ "قواعد البيانات الحالية." + +#~ msgid "Start the MariaDB server on boot?" +#~ msgstr "تشغيل خادم MariaDB عند الإقلاع؟" + +#~ msgid "" +#~ "The MariaDB server can be launched automatically at boot time or manually " +#~ "with the '/etc/init.d/mysql start' command." +#~ msgstr "" +#~ "يمكن تشغيل خادم MariaDB آلياً وقت الإقلاع أو يدوياً باستخدام الأمر '/etc/" +#~ "init.d/mysql start'." + #~ msgid "" #~ "To use MariaDB, the following entries for users and groups should be " #~ "added to the system:" diff --git a/debian/po/ca.po b/debian/po/ca.po index 6f82d771279..771658d65aa 100644 --- a/debian/po/ca.po +++ b/debian/po/ca.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: mysql-dfsg-4.1\n" "Report-Msgid-Bugs-To: mariadb-10.2@packages.debian.org\n" -"POT-Creation-Date: 2012-01-12 13:08+0100\n" +"POT-Creation-Date: 2016-10-08 01:26+0300\n" "PO-Revision-Date: 2004-01-31 19:20GMT\n" "Last-Translator: Aleix Badia i Bosch \n" "Language-Team: Debian L10n Catalan \n" @@ -15,32 +15,34 @@ msgstr "" "Content-Type: text/plain; charset=ISO-8859-1\n" "Content-Transfer-Encoding: 8bit\n" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 -msgid "Really proceed with downgrade?" +msgid "The old data directory will be saved at new location" msgstr "" -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." -msgstr "" - -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"Such a file is an indication that a mariadb-server package with a higher " -"version has been installed previously." +"A file named /var/lib/mysql/debian-*.flag exists on this system. The number " +"indicates a database binary format version that cannot automatically be " +"upgraded (or downgraded)." msgstr "" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"There is no guarantee that the version you're currently installing will be " -"able to use the current databases." +"Therefore the previous data directory will be renamed to /var/lib/mysql-* " +"and a new data directory will be initialized at /var/lib/mysql." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Please manually export/import your data (e.g. with mysqldump) if needed." msgstr "" #. Type: note @@ -90,35 +92,15 @@ msgid "" "the data should be kept." msgstr "" -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -#, fuzzy -#| msgid "Should MySQL start on boot?" -msgid "Start the MariaDB server on boot?" -msgstr "Voleu que el MariaDB s'iniciï a l'arrencada ?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -#, fuzzy -msgid "" -"The MariaDB server can be launched automatically at boot time or manually " -"with the '/etc/init.d/mysql start' command." -msgstr "" -"El MariaDB es pot executar a l'arrencada o només si executeu manualment '/" -"etc/init.d/mysql start'. Seleccioneu 'sí' si voleu que s'inicialitzi " -"automàticament." - #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "New password for the MariaDB \"root\" user:" msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "" "While not mandatory, it is highly recommended that you set a password for " "the MariaDB administrative \"root\" user." @@ -126,25 +108,25 @@ msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "If this field is left blank, the password will not be changed." msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:7001 +#: ../mariadb-server-10.2.templates:6001 msgid "Repeat password for the MariaDB \"root\" user:" msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "Unable to set password for the MariaDB \"root\" user" msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "" "An error occurred while setting the password for the MariaDB administrative " "user. This may have happened because the account already has a password, or " @@ -153,13 +135,13 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "You should check the account's password after the package installation." msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "" "Please read the /usr/share/doc/mariadb-server-10.2/README.Debian file for " "more information." @@ -167,16 +149,30 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "Password input error" msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "The two passwords you entered were not the same. Please try again." msgstr "" +#, fuzzy +#~| msgid "Should MySQL start on boot?" +#~ msgid "Start the MariaDB server on boot?" +#~ msgstr "Voleu que el MariaDB s'iniciï a l'arrencada ?" + +#, fuzzy +#~ msgid "" +#~ "The MariaDB server can be launched automatically at boot time or manually " +#~ "with the '/etc/init.d/mysql start' command." +#~ msgstr "" +#~ "El MariaDB es pot executar a l'arrencada o només si executeu manualment '/" +#~ "etc/init.d/mysql start'. Seleccioneu 'sí' si voleu que s'inicialitzi " +#~ "automàticament." + #, fuzzy #~ msgid "" #~ "To use mysql you must install an equivalent user and group to the " diff --git a/debian/po/cs.po b/debian/po/cs.po index cf30159d179..526f03c99ad 100644 --- a/debian/po/cs.po +++ b/debian/po/cs.po @@ -15,7 +15,7 @@ msgid "" msgstr "" "Project-Id-Version: mysql-dfsg-5.1\n" "Report-Msgid-Bugs-To: mariadb-10.2@packages.debian.org\n" -"POT-Creation-Date: 2012-01-12 13:08+0100\n" +"POT-Creation-Date: 2016-10-08 01:26+0300\n" "PO-Revision-Date: 2007-05-01 13:01+0200\n" "Last-Translator: Miroslav Kure \n" "Language-Team: Czech \n" @@ -24,40 +24,35 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 -msgid "Really proceed with downgrade?" -msgstr "Opravdu pokraÄovat v degradaci?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." -msgstr "V systému existuje soubor /var/lib/mysql/debian-*.flag." - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -#, fuzzy -#| msgid "" -#| "Such file is an indication that a mariadb-server package with a higher " -#| "version has been installed earlier." -msgid "" -"Such a file is an indication that a mariadb-server package with a higher " -"version has been installed previously." +msgid "The old data directory will be saved at new location" msgstr "" -"To znamená, že již byl nainstalován balík mariadb-server s vyšší verzí." -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"There is no guarantee that the version you're currently installing will be " -"able to use the current databases." +"A file named /var/lib/mysql/debian-*.flag exists on this system. The number " +"indicates a database binary format version that cannot automatically be " +"upgraded (or downgraded)." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Therefore the previous data directory will be renamed to /var/lib/mysql-* " +"and a new data directory will be initialized at /var/lib/mysql." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Please manually export/import your data (e.g. with mysqldump) if needed." msgstr "" -"Neexistuje žádná záruka, že momentálnÄ› instalovaná verze bude umÄ›t pracovat " -"se stávajícími databázemi." #. Type: note #. Description @@ -114,31 +109,15 @@ msgstr "" "MariaDB, nebo pokud tato data souběžnÄ› využívá jiný balík mariadb-server, " "mÄ›li byste data ponechat." -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "Start the MariaDB server on boot?" -msgstr "Spustit MariaDB server pÅ™i startu systému?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "" -"The MariaDB server can be launched automatically at boot time or manually " -"with the '/etc/init.d/mysql start' command." -msgstr "" -"MariaDB se může spouÅ¡tÄ›t automaticky pÅ™i startu systému, nebo ruÄnÄ› příkazem " -"'/etc/init.d/mysql start'." - #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "New password for the MariaDB \"root\" user:" msgstr "Nové heslo MariaDB uživatele \"root\":" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "" "While not mandatory, it is highly recommended that you set a password for " "the MariaDB administrative \"root\" user." @@ -148,7 +127,7 @@ msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 #, fuzzy #| msgid "If that field is left blank, the password will not be changed." msgid "If this field is left blank, the password will not be changed." @@ -156,7 +135,7 @@ msgstr "Ponecháte-li pole prázdné, heslo se nezmÄ›ní." #. Type: password #. Description -#: ../mariadb-server-10.2.templates:7001 +#: ../mariadb-server-10.2.templates:6001 #, fuzzy #| msgid "New password for the MySQL \"root\" user:" msgid "Repeat password for the MariaDB \"root\" user:" @@ -164,13 +143,13 @@ msgstr "Nové heslo MariaDB uživatele \"root\":" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "Unable to set password for the MariaDB \"root\" user" msgstr "Nelze nastavit heslo MariaDB uživatele \"root\"" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "" "An error occurred while setting the password for the MariaDB administrative " "user. This may have happened because the account already has a password, or " @@ -182,7 +161,7 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "" #| "You should check the account's password after tha package installation." @@ -191,7 +170,7 @@ msgstr "Po instalaci balíku byste mÄ›li heslo ověřit." #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "" #| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for " @@ -204,16 +183,49 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "Password input error" msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "The two passwords you entered were not the same. Please try again." msgstr "" +#~ msgid "Really proceed with downgrade?" +#~ msgstr "Opravdu pokraÄovat v degradaci?" + +#~ msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +#~ msgstr "V systému existuje soubor /var/lib/mysql/debian-*.flag." + +#, fuzzy +#~| msgid "" +#~| "Such file is an indication that a mariadb-server package with a higher " +#~| "version has been installed earlier." +#~ msgid "" +#~ "Such a file is an indication that a mariadb-server package with a higher " +#~ "version has been installed previously." +#~ msgstr "" +#~ "To znamená, že již byl nainstalován balík mariadb-server s vyšší verzí." + +#~ msgid "" +#~ "There is no guarantee that the version you're currently installing will " +#~ "be able to use the current databases." +#~ msgstr "" +#~ "Neexistuje žádná záruka, že momentálnÄ› instalovaná verze bude umÄ›t " +#~ "pracovat se stávajícími databázemi." + +#~ msgid "Start the MariaDB server on boot?" +#~ msgstr "Spustit MariaDB server pÅ™i startu systému?" + +#~ msgid "" +#~ "The MariaDB server can be launched automatically at boot time or manually " +#~ "with the '/etc/init.d/mysql start' command." +#~ msgstr "" +#~ "MariaDB se může spouÅ¡tÄ›t automaticky pÅ™i startu systému, nebo ruÄnÄ› " +#~ "příkazem '/etc/init.d/mysql start'." + #~ msgid "" #~ "To use MariaDB, the following entries for users and groups should be " #~ "added to the system:" diff --git a/debian/po/da.po b/debian/po/da.po index 917465943af..74117e57dba 100644 --- a/debian/po/da.po +++ b/debian/po/da.po @@ -15,7 +15,7 @@ msgid "" msgstr "" "Project-Id-Version: mysql-dfsg-4.1\n" "Report-Msgid-Bugs-To: mariadb-10.2@packages.debian.org\n" -"POT-Creation-Date: 2012-01-12 13:08+0100\n" +"POT-Creation-Date: 2016-10-08 01:26+0300\n" "PO-Revision-Date: 2007-05-30 22:41+0200\n" "Last-Translator: Claus Hindsgaul \n" "Language-Team: Danish\n" @@ -25,42 +25,35 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KBabel 1.11.4\n" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 -msgid "Really proceed with downgrade?" -msgstr "Ønsker du virkelig at fortsætte nedgraderingen?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgid "The old data directory will be saved at new location" msgstr "" -"Der er en fil med navnet /var/lib/mysql/debian-*.flag på dette system." -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -#, fuzzy -#| msgid "" -#| "Such file is an indication that a mariadb-server package with a higher " -#| "version has been installed earlier." -msgid "" -"Such a file is an indication that a mariadb-server package with a higher " -"version has been installed previously." -msgstr "" -"Sådan en fil tyder på at der tidligere har været installeret en højere " -"version af mariadb-server-pakken." - -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"There is no guarantee that the version you're currently installing will be " -"able to use the current databases." +"A file named /var/lib/mysql/debian-*.flag exists on this system. The number " +"indicates a database binary format version that cannot automatically be " +"upgraded (or downgraded)." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Therefore the previous data directory will be renamed to /var/lib/mysql-* " +"and a new data directory will be initialized at /var/lib/mysql." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Please manually export/import your data (e.g. with mysqldump) if needed." msgstr "" -"Det kan ikke garanteres at den version, du er ved at installere, kan benytte " -"data fra de eksisterende databaser." #. Type: note #. Description @@ -117,31 +110,15 @@ msgstr "" "eller hvis en anden mariadb-server-pakke allerede benytter den, bør dataene " "bevares." -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "Start the MariaDB server on boot?" -msgstr "Start MariaDB-serveren under systemopstart?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "" -"The MariaDB server can be launched automatically at boot time or manually " -"with the '/etc/init.d/mysql start' command." -msgstr "" -"MariaDB-serveren kan enten startes op automatisk under systemopstarten, " -"eller manuelt med kommandoen '/etc/init.d/mysql start'." - #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "New password for the MariaDB \"root\" user:" msgstr "Ny adgangskode for MariaDB's \"root\"-bruger:" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "" "While not mandatory, it is highly recommended that you set a password for " "the MariaDB administrative \"root\" user." @@ -151,7 +128,7 @@ msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 #, fuzzy #| msgid "If that field is left blank, the password will not be changed." msgid "If this field is left blank, the password will not be changed." @@ -159,7 +136,7 @@ msgstr "Hvis du lader dette felt st #. Type: password #. Description -#: ../mariadb-server-10.2.templates:7001 +#: ../mariadb-server-10.2.templates:6001 #, fuzzy #| msgid "New password for the MySQL \"root\" user:" msgid "Repeat password for the MariaDB \"root\" user:" @@ -167,13 +144,13 @@ msgstr "Ny adgangskode for MariaDB's \"root\"-bruger:" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "Unable to set password for the MariaDB \"root\" user" msgstr "Kunne ikke sætte adgangskoden for MariaDB's \"root\"-bruger" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "" "An error occurred while setting the password for the MariaDB administrative " "user. This may have happened because the account already has a password, or " @@ -186,13 +163,13 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "You should check the account's password after the package installation." msgstr "Du bør tjekke kontoens adgangskode efter pakkeinstallationen." #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "" #| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for " @@ -206,16 +183,51 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "Password input error" msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "The two passwords you entered were not the same. Please try again." msgstr "" +#~ msgid "Really proceed with downgrade?" +#~ msgstr "Ønsker du virkelig at fortsætte nedgraderingen?" + +#~ msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +#~ msgstr "" +#~ "Der er en fil med navnet /var/lib/mysql/debian-*.flag på dette system." + +#, fuzzy +#~| msgid "" +#~| "Such file is an indication that a mariadb-server package with a higher " +#~| "version has been installed earlier." +#~ msgid "" +#~ "Such a file is an indication that a mariadb-server package with a higher " +#~ "version has been installed previously." +#~ msgstr "" +#~ "Sådan en fil tyder på at der tidligere har været installeret en højere " +#~ "version af mariadb-server-pakken." + +#~ msgid "" +#~ "There is no guarantee that the version you're currently installing will " +#~ "be able to use the current databases." +#~ msgstr "" +#~ "Det kan ikke garanteres at den version, du er ved at installere, kan " +#~ "benytte data fra de eksisterende databaser." + +#~ msgid "Start the MariaDB server on boot?" +#~ msgstr "Start MariaDB-serveren under systemopstart?" + +#~ msgid "" +#~ "The MariaDB server can be launched automatically at boot time or manually " +#~ "with the '/etc/init.d/mysql start' command." +#~ msgstr "" +#~ "MariaDB-serveren kan enten startes op automatisk under systemopstarten, " +#~ "eller manuelt med kommandoen '/etc/init.d/mysql start'." + #~ msgid "" #~ "To use MariaDB, the following entries for users and groups should be " #~ "added to the system:" diff --git a/debian/po/de.po b/debian/po/de.po index c39c1abeb8f..4a0ec4282d4 100644 --- a/debian/po/de.po +++ b/debian/po/de.po @@ -16,7 +16,7 @@ msgid "" msgstr "" "Project-Id-Version: mysql-dfsg-5.1_5.1.37-1_de\n" "Report-Msgid-Bugs-To: mariadb-10.2@packages.debian.org\n" -"POT-Creation-Date: 2012-01-12 13:08+0100\n" +"POT-Creation-Date: 2016-10-08 01:26+0300\n" "PO-Revision-Date: 2009-08-27 22:41+0200\n" "Last-Translator: Thomas Mueller \n" "Language-Team: german \n" @@ -27,39 +27,35 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 -msgid "Really proceed with downgrade?" -msgstr "Möchten Sie wirklich eine ältere Version einspielen?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgid "The old data directory will be saved at new location" msgstr "" -"Auf diesem System existiert eine Datei mit dem Namen /var/lib/mysql/debian-*." -"flag" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"Such a file is an indication that a mariadb-server package with a higher " -"version has been installed previously." +"A file named /var/lib/mysql/debian-*.flag exists on this system. The number " +"indicates a database binary format version that cannot automatically be " +"upgraded (or downgraded)." msgstr "" -"Diese Datei ist ein Hinweis darauf, dass früher ein MariaDB-Server-Paket mit " -"einer höheren Version installiert war." -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"There is no guarantee that the version you're currently installing will be " -"able to use the current databases." +"Therefore the previous data directory will be renamed to /var/lib/mysql-* " +"and a new data directory will be initialized at /var/lib/mysql." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Please manually export/import your data (e.g. with mysqldump) if needed." msgstr "" -"Es kann nicht garantiert werden, dass die gegenwärtig zu installierende " -"Version dessen Daten benutzen kann." #. Type: note #. Description @@ -115,31 +111,15 @@ msgstr "" "ein anderes mariadb-server-Paket dieses bereits benutzt, sollten die Daten " "behalten werden." -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "Start the MariaDB server on boot?" -msgstr "Soll der MariaDB-Server automatisch beim Booten starten?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "" -"The MariaDB server can be launched automatically at boot time or manually " -"with the '/etc/init.d/mysql start' command." -msgstr "" -"Der MariaDB-Dienst kann entweder automatisch beim Systemstart oder manuell " -"durch Eingabe des Befehls »/etc/init.d/mysql start« gestartet werden." - #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "New password for the MariaDB \"root\" user:" msgstr "Neues Passwort für den MariaDB »root«-Benutzer:" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "" "While not mandatory, it is highly recommended that you set a password for " "the MariaDB administrative \"root\" user." @@ -149,25 +129,25 @@ msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "If this field is left blank, the password will not be changed." msgstr "Wenn dieses Feld freigelassen wird, wird das Passwort nicht geändert." #. Type: password #. Description -#: ../mariadb-server-10.2.templates:7001 +#: ../mariadb-server-10.2.templates:6001 msgid "Repeat password for the MariaDB \"root\" user:" msgstr "Wiederholen Sie das Passwort für den MariaDB-»root«-Benutzer:" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "Unable to set password for the MariaDB \"root\" user" msgstr "Konnte für den MariaDB-»root«-Benutzer kein Passwort setzen" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "" "An error occurred while setting the password for the MariaDB administrative " "user. This may have happened because the account already has a password, or " @@ -180,7 +160,7 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "You should check the account's password after the package installation." msgstr "" "Sie sollten das Passwort des administrativen Benutzers nach der " @@ -188,7 +168,7 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "" #| "Please read the /usr/share/doc/mariadb-server-5.1/README.Debian file for " @@ -202,15 +182,47 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "Password input error" msgstr "Passwort-Eingabefehler" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "The two passwords you entered were not the same. Please try again." msgstr "" "Die beiden von Ihnen eingegebenen Passwörter sind nicht identisch. Bitte " "erneut versuchen." +#~ msgid "Really proceed with downgrade?" +#~ msgstr "Möchten Sie wirklich eine ältere Version einspielen?" + +#~ msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +#~ msgstr "" +#~ "Auf diesem System existiert eine Datei mit dem Namen /var/lib/mysql/" +#~ "debian-*.flag" + +#~ msgid "" +#~ "Such a file is an indication that a mariadb-server package with a higher " +#~ "version has been installed previously." +#~ msgstr "" +#~ "Diese Datei ist ein Hinweis darauf, dass früher ein MariaDB-Server-Paket " +#~ "mit einer höheren Version installiert war." + +#~ msgid "" +#~ "There is no guarantee that the version you're currently installing will " +#~ "be able to use the current databases." +#~ msgstr "" +#~ "Es kann nicht garantiert werden, dass die gegenwärtig zu installierende " +#~ "Version dessen Daten benutzen kann." + +#~ msgid "Start the MariaDB server on boot?" +#~ msgstr "Soll der MariaDB-Server automatisch beim Booten starten?" + +#~ msgid "" +#~ "The MariaDB server can be launched automatically at boot time or manually " +#~ "with the '/etc/init.d/mysql start' command." +#~ msgstr "" +#~ "Der MariaDB-Dienst kann entweder automatisch beim Systemstart oder " +#~ "manuell durch Eingabe des Befehls »/etc/init.d/mysql start« gestartet " +#~ "werden." diff --git a/debian/po/es.po b/debian/po/es.po index cb3d101460b..cbf727c1530 100644 --- a/debian/po/es.po +++ b/debian/po/es.po @@ -41,7 +41,7 @@ msgid "" msgstr "" "Project-Id-Version: mysql-dfsg-5.1_5.0.24-3\n" "Report-Msgid-Bugs-To: mariadb-10.2@packages.debian.org\n" -"POT-Creation-Date: 2012-01-12 13:08+0100\n" +"POT-Creation-Date: 2016-10-08 01:26+0300\n" "PO-Revision-Date: 2007-05-28 22:21+0200\n" "Last-Translator: Javier Fernández-Sanguino \n" "Language-Team: Debian l10 Spanish \n" @@ -50,42 +50,35 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 -msgid "Really proceed with downgrade?" -msgstr "¿Desea realmente continuar con la desactualización?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgid "The old data directory will be saved at new location" msgstr "" -"Existe un archivo con el nombre /var/lib/mysql/debian-*.flag en este sistema." -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -#, fuzzy -#| msgid "" -#| "Such file is an indication that a mariadb-server package with a higher " -#| "version has been installed earlier." -msgid "" -"Such a file is an indication that a mariadb-server package with a higher " -"version has been installed previously." -msgstr "" -"Este fichero indica que se instaló previamente una versión superior del " -"paquete mariadb-server." - -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"There is no guarantee that the version you're currently installing will be " -"able to use the current databases." +"A file named /var/lib/mysql/debian-*.flag exists on this system. The number " +"indicates a database binary format version that cannot automatically be " +"upgraded (or downgraded)." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Therefore the previous data directory will be renamed to /var/lib/mysql-* " +"and a new data directory will be initialized at /var/lib/mysql." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Please manually export/import your data (e.g. with mysqldump) if needed." msgstr "" -"No se puede garantizar que la versión que está instalando pueda usar la base " -"de datos actual." #. Type: note #. Description @@ -143,31 +136,15 @@ msgstr "" "MariaDB más reciente o si hay un paquete «mariadb-server» distinto que los " "está utilizando." -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "Start the MariaDB server on boot?" -msgstr "¿Debería ejecutarse el servidor MariaDB al iniciarse el sistema?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "" -"The MariaDB server can be launched automatically at boot time or manually " -"with the '/etc/init.d/mysql start' command." -msgstr "" -"El servidor MariaDB puede iniciarse en el momento de arranque del sistema o " -"manualmente si escribe la orden «/etc/init.d/mysql start»." - #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "New password for the MariaDB \"root\" user:" msgstr "Nueva contraseña para el usuario «root» de MariaDB:" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "" "While not mandatory, it is highly recommended that you set a password for " "the MariaDB administrative \"root\" user." @@ -177,7 +154,7 @@ msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 #, fuzzy #| msgid "If that field is left blank, the password will not be changed." msgid "If this field is left blank, the password will not be changed." @@ -185,7 +162,7 @@ msgstr "No se modificará la contraseña si deja el espacio en blanco." #. Type: password #. Description -#: ../mariadb-server-10.2.templates:7001 +#: ../mariadb-server-10.2.templates:6001 #, fuzzy #| msgid "New password for the MySQL \"root\" user:" msgid "Repeat password for the MariaDB \"root\" user:" @@ -193,13 +170,13 @@ msgstr "Nueva contraseña para el usuario «root» de MariaDB:" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "Unable to set password for the MariaDB \"root\" user" msgstr "No se pudo fijar la contraseña para el usuario «root» de MariaDB" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "" "An error occurred while setting the password for the MariaDB administrative " "user. This may have happened because the account already has a password, or " @@ -212,7 +189,7 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "You should check the account's password after the package installation." msgstr "" "Debería comprobar la contraseña de la cuenta después de la instalación del " @@ -220,7 +197,7 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "" #| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for " @@ -234,16 +211,52 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "Password input error" msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "The two passwords you entered were not the same. Please try again." msgstr "" +#~ msgid "Really proceed with downgrade?" +#~ msgstr "¿Desea realmente continuar con la desactualización?" + +#~ msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +#~ msgstr "" +#~ "Existe un archivo con el nombre /var/lib/mysql/debian-*.flag en este " +#~ "sistema." + +#, fuzzy +#~| msgid "" +#~| "Such file is an indication that a mariadb-server package with a higher " +#~| "version has been installed earlier." +#~ msgid "" +#~ "Such a file is an indication that a mariadb-server package with a higher " +#~ "version has been installed previously." +#~ msgstr "" +#~ "Este fichero indica que se instaló previamente una versión superior del " +#~ "paquete mariadb-server." + +#~ msgid "" +#~ "There is no guarantee that the version you're currently installing will " +#~ "be able to use the current databases." +#~ msgstr "" +#~ "No se puede garantizar que la versión que está instalando pueda usar la " +#~ "base de datos actual." + +#~ msgid "Start the MariaDB server on boot?" +#~ msgstr "¿Debería ejecutarse el servidor MariaDB al iniciarse el sistema?" + +#~ msgid "" +#~ "The MariaDB server can be launched automatically at boot time or manually " +#~ "with the '/etc/init.d/mysql start' command." +#~ msgstr "" +#~ "El servidor MariaDB puede iniciarse en el momento de arranque del sistema " +#~ "o manualmente si escribe la orden «/etc/init.d/mysql start»." + #~ msgid "" #~ "To use MariaDB, the following entries for users and groups should be " #~ "added to the system:" diff --git a/debian/po/eu.po b/debian/po/eu.po index 3b538bb074e..22b0f337fd1 100644 --- a/debian/po/eu.po +++ b/debian/po/eu.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: eu\n" "Report-Msgid-Bugs-To: mariadb-10.2@packages.debian.org\n" -"POT-Creation-Date: 2012-01-12 13:08+0100\n" +"POT-Creation-Date: 2016-10-08 01:26+0300\n" "PO-Revision-Date: 2009-07-29 11:59+0200\n" "Last-Translator: Piarres Beobide \n" "Language-Team: Euskara \n" @@ -18,41 +18,35 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: KBabel 1.11.4\n" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 -msgid "Really proceed with downgrade?" -msgstr "Benetan bertsio zaharragora itzuli nahi duzu?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." -msgstr "Sisteman badago /var/lib/mysql/debian-*.flag izeneko fitxategi bat." - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -#, fuzzy -#| msgid "" -#| "Such file is an indication that a mariadb-server package with a higher " -#| "version has been installed earlier." -msgid "" -"Such a file is an indication that a mariadb-server package with a higher " -"version has been installed previously." +msgid "The old data directory will be saved at new location" msgstr "" -"Fitxategi honek aurretik bertsio berriagoko mysql-zerbitzari pakete bat " -"instalatu dela adierazten du." -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"There is no guarantee that the version you're currently installing will be " -"able to use the current databases." +"A file named /var/lib/mysql/debian-*.flag exists on this system. The number " +"indicates a database binary format version that cannot automatically be " +"upgraded (or downgraded)." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Therefore the previous data directory will be renamed to /var/lib/mysql-* " +"and a new data directory will be initialized at /var/lib/mysql." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Please manually export/import your data (e.g. with mysqldump) if needed." msgstr "" -"Ezin da ziurtatu instalatzen ari zaren bertsio honek dauden datubaseak " -"erabili ahal izango dituenik." #. Type: note #. Description @@ -109,31 +103,15 @@ msgstr "" "bazara, edo beste mariadb-server pakete bat berau erabiltzen ari bada, " "datuak mantendu egin beharko lirateke." -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "Start the MariaDB server on boot?" -msgstr "Abioan MariaDB zerbitzaria abiarazi?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "" -"The MariaDB server can be launched automatically at boot time or manually " -"with the '/etc/init.d/mysql start' command." -msgstr "" -"Sistema abioan MariaDB automatikoki abiarazi daiteke edo eskuz '/etc/init.d/" -"mysql start' eginaz." - #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "New password for the MariaDB \"root\" user:" msgstr "MariaDB \"root\" erabiltzailearen pasahitz berria:" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "" "While not mandatory, it is highly recommended that you set a password for " "the MariaDB administrative \"root\" user." @@ -143,7 +121,7 @@ msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 #, fuzzy #| msgid "If that field is left blank, the password will not be changed." msgid "If this field is left blank, the password will not be changed." @@ -151,19 +129,19 @@ msgstr "Eremua hau zurian utziaz gero ez da pasahitza aldatuko." #. Type: password #. Description -#: ../mariadb-server-10.2.templates:7001 +#: ../mariadb-server-10.2.templates:6001 msgid "Repeat password for the MariaDB \"root\" user:" msgstr "Errepikatu MariaDB \"root\" erabiltzailearen pasahitza:" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "Unable to set password for the MariaDB \"root\" user" msgstr "Ezin da MariaDB \"root\" erabiltzailearen pasahitza ezarri" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "" "An error occurred while setting the password for the MariaDB administrative " "user. This may have happened because the account already has a password, or " @@ -175,14 +153,14 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "You should check the account's password after the package installation." msgstr "" "Kontuaren pasahitza egiaztatu beharko zenuke paketea instalatu aurretik." #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "" #| "Please read the /usr/share/doc/mariadb-server-10.2/README.Debian file for " @@ -196,16 +174,50 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "Password input error" msgstr "Pasahitz sarrera errorea" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "The two passwords you entered were not the same. Please try again." msgstr "Idatzi dituzun bi pasahitzak ez dira berdina. Mesedez saiatu berriz." +#~ msgid "Really proceed with downgrade?" +#~ msgstr "Benetan bertsio zaharragora itzuli nahi duzu?" + +#~ msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +#~ msgstr "Sisteman badago /var/lib/mysql/debian-*.flag izeneko fitxategi bat." + +#, fuzzy +#~| msgid "" +#~| "Such file is an indication that a mariadb-server package with a higher " +#~| "version has been installed earlier." +#~ msgid "" +#~ "Such a file is an indication that a mariadb-server package with a higher " +#~ "version has been installed previously." +#~ msgstr "" +#~ "Fitxategi honek aurretik bertsio berriagoko mysql-zerbitzari pakete bat " +#~ "instalatu dela adierazten du." + +#~ msgid "" +#~ "There is no guarantee that the version you're currently installing will " +#~ "be able to use the current databases." +#~ msgstr "" +#~ "Ezin da ziurtatu instalatzen ari zaren bertsio honek dauden datubaseak " +#~ "erabili ahal izango dituenik." + +#~ msgid "Start the MariaDB server on boot?" +#~ msgstr "Abioan MariaDB zerbitzaria abiarazi?" + +#~ msgid "" +#~ "The MariaDB server can be launched automatically at boot time or manually " +#~ "with the '/etc/init.d/mysql start' command." +#~ msgstr "" +#~ "Sistema abioan MariaDB automatikoki abiarazi daiteke edo eskuz '/etc/init." +#~ "d/mysql start' eginaz." + #~ msgid "" #~ "To use MariaDB, the following entries for users and groups should be " #~ "added to the system:" diff --git a/debian/po/fr.po b/debian/po/fr.po index 2c29513ac0a..cae8d7e903b 100644 --- a/debian/po/fr.po +++ b/debian/po/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: fr\n" "Report-Msgid-Bugs-To: mariadb-10.2@packages.debian.org\n" -"POT-Creation-Date: 2012-01-12 13:08+0100\n" +"POT-Creation-Date: 2016-10-08 01:26+0300\n" "PO-Revision-Date: 2009-08-08 14:56+0200\n" "Last-Translator: Christian Perrier \n" "Language-Team: French \n" @@ -20,35 +20,35 @@ msgstr "" "X-Generator: Lokalize 0.3\n" "Plural-Forms: Plural-Forms: nplurals=2; plural=n>1;\n" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 -msgid "Really proceed with downgrade?" -msgstr "Faut-il vraiment revenir à la version précédente ?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." -msgstr "Un fichier /var/lib/mysql/debian-*.flag est présent sur ce système." - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -msgid "" -"Such a file is an indication that a mariadb-server package with a higher " -"version has been installed previously." +msgid "The old data directory will be saved at new location" msgstr "" -"Cela indique qu'une version plus récente du paquet mariadb-server a été " -"précédemment installée." -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"There is no guarantee that the version you're currently installing will be " -"able to use the current databases." -msgstr "Il n'est pas garanti que cette version puisse en utiliser les données." +"A file named /var/lib/mysql/debian-*.flag exists on this system. The number " +"indicates a database binary format version that cannot automatically be " +"upgraded (or downgraded)." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Therefore the previous data directory will be renamed to /var/lib/mysql-* " +"and a new data directory will be initialized at /var/lib/mysql." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Please manually export/import your data (e.g. with mysqldump) if needed." +msgstr "" #. Type: note #. Description @@ -103,31 +103,15 @@ msgstr "" "Si vous prévoyez d'installer une version plus récente de MariaDB ou si un " "autre paquet mariadb-server les utilise déjà, vous devriez les conserver." -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "Start the MariaDB server on boot?" -msgstr "Faut-il lancer MariaDB au démarrage ?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "" -"The MariaDB server can be launched automatically at boot time or manually " -"with the '/etc/init.d/mysql start' command." -msgstr "" -"MariaDB peut être lancé soit au démarrage, soit en entrant la commande « /" -"etc/init.d/mysql start »." - #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "New password for the MariaDB \"root\" user:" msgstr "Nouveau mot de passe du superutilisateur de MariaDB :" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "" "While not mandatory, it is highly recommended that you set a password for " "the MariaDB administrative \"root\" user." @@ -137,26 +121,26 @@ msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "If this field is left blank, the password will not be changed." msgstr "Si ce champ est laissé vide, le mot de passe ne sera pas changé." #. Type: password #. Description -#: ../mariadb-server-10.2.templates:7001 +#: ../mariadb-server-10.2.templates:6001 msgid "Repeat password for the MariaDB \"root\" user:" msgstr "Confirmation du mot de passe du superutilisateur de MariaDB :" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "Unable to set password for the MariaDB \"root\" user" msgstr "" "Impossible de changer le mot de passe de l'utilisateur « root » de MariaDB" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "" "An error occurred while setting the password for the MariaDB administrative " "user. This may have happened because the account already has a password, or " @@ -168,7 +152,7 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "You should check the account's password after the package installation." msgstr "" "Vous devriez vérifier le mot de passe de ce compte après l'installation du " @@ -176,7 +160,7 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "" #| "Please read the /usr/share/doc/mariadb-server-10.2/README.Debian file for " @@ -190,18 +174,47 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "Password input error" msgstr "Erreur de saisie du mot de passe" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "The two passwords you entered were not the same. Please try again." msgstr "" "Le mot de passe et sa confirmation ne sont pas identiques. Veuillez " "recommencer." +#~ msgid "Really proceed with downgrade?" +#~ msgstr "Faut-il vraiment revenir à la version précédente ?" + +#~ msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +#~ msgstr "Un fichier /var/lib/mysql/debian-*.flag est présent sur ce système." + +#~ msgid "" +#~ "Such a file is an indication that a mariadb-server package with a higher " +#~ "version has been installed previously." +#~ msgstr "" +#~ "Cela indique qu'une version plus récente du paquet mariadb-server a été " +#~ "précédemment installée." + +#~ msgid "" +#~ "There is no guarantee that the version you're currently installing will " +#~ "be able to use the current databases." +#~ msgstr "" +#~ "Il n'est pas garanti que cette version puisse en utiliser les données." + +#~ msgid "Start the MariaDB server on boot?" +#~ msgstr "Faut-il lancer MariaDB au démarrage ?" + +#~ msgid "" +#~ "The MariaDB server can be launched automatically at boot time or manually " +#~ "with the '/etc/init.d/mysql start' command." +#~ msgstr "" +#~ "MariaDB peut être lancé soit au démarrage, soit en entrant la commande « /" +#~ "etc/init.d/mysql start »." + #~ msgid "" #~ "To use MySQL, the following entries for users and groups should be added " #~ "to the system:" diff --git a/debian/po/gl.po b/debian/po/gl.po index 8b0dca67223..64b5a8d7458 100644 --- a/debian/po/gl.po +++ b/debian/po/gl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: mysql-dfsg-5.1\n" "Report-Msgid-Bugs-To: mariadb-10.2@packages.debian.org\n" -"POT-Creation-Date: 2012-01-12 13:08+0100\n" +"POT-Creation-Date: 2016-10-08 01:26+0300\n" "PO-Revision-Date: 2007-04-20 09:44+0200\n" "Last-Translator: Jacobo Tarrio \n" "Language-Team: Galician \n" @@ -15,41 +15,35 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 -msgid "Really proceed with downgrade?" -msgstr "¿Quere pasar a unha versión anterior?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." -msgstr "Neste sistema hai un ficheiro chamado /var/lib/mysql/debian-*.flag." - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -#, fuzzy -#| msgid "" -#| "Such file is an indication that a mariadb-server package with a higher " -#| "version has been installed earlier." -msgid "" -"Such a file is an indication that a mariadb-server package with a higher " -"version has been installed previously." +msgid "The old data directory will be saved at new location" msgstr "" -"Este ficheiro indica que antes se instalou un paquete mariadb-server cunha " -"versión superior." -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"There is no guarantee that the version you're currently installing will be " -"able to use the current databases." +"A file named /var/lib/mysql/debian-*.flag exists on this system. The number " +"indicates a database binary format version that cannot automatically be " +"upgraded (or downgraded)." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Therefore the previous data directory will be renamed to /var/lib/mysql-* " +"and a new data directory will be initialized at /var/lib/mysql." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Please manually export/import your data (e.g. with mysqldump) if needed." msgstr "" -"Non se pode garantir que a versión que está a instalar poida empregar as " -"bases de datos actuais." #. Type: note #. Description @@ -107,31 +101,15 @@ msgstr "" "recente ou se xa hai un paquete mariadb-server diferente a empregalo, " "debería conservar os datos." -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "Start the MariaDB server on boot?" -msgstr "¿Iniciar o servidor MariaDB co ordenador?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "" -"The MariaDB server can be launched automatically at boot time or manually " -"with the '/etc/init.d/mysql start' command." -msgstr "" -"Pódese iniciar automaticamente o servidor MariaDB ao iniciar o ordenador, ou " -"manualmente coa orde \"/etc/init.d/mysql start\"." - #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "New password for the MariaDB \"root\" user:" msgstr "Novo contrasinal para o usuario \"root\" de MariaDB:" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "" "While not mandatory, it is highly recommended that you set a password for " "the MariaDB administrative \"root\" user." @@ -141,7 +119,7 @@ msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 #, fuzzy #| msgid "If that field is left blank, the password will not be changed." msgid "If this field is left blank, the password will not be changed." @@ -149,7 +127,7 @@ msgstr "Se deixa o campo en branco, non se ha cambiar o contrasinal." #. Type: password #. Description -#: ../mariadb-server-10.2.templates:7001 +#: ../mariadb-server-10.2.templates:6001 #, fuzzy #| msgid "New password for the MySQL \"root\" user:" msgid "Repeat password for the MariaDB \"root\" user:" @@ -157,13 +135,13 @@ msgstr "Novo contrasinal para o usuario \"root\" de MariaDB:" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "Unable to set password for the MariaDB \"root\" user" msgstr "Non se puido establecer o contrasinal do usuario \"root\" de MariaDB" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "" "An error occurred while setting the password for the MariaDB administrative " "user. This may have happened because the account already has a password, or " @@ -175,7 +153,7 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "" #| "You should check the account's password after tha package installation." @@ -184,7 +162,7 @@ msgstr "Debería comprobar o contrasinal da conta trala instalación do paquete. #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "" #| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for " @@ -198,16 +176,50 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "Password input error" msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "The two passwords you entered were not the same. Please try again." msgstr "" +#~ msgid "Really proceed with downgrade?" +#~ msgstr "¿Quere pasar a unha versión anterior?" + +#~ msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +#~ msgstr "Neste sistema hai un ficheiro chamado /var/lib/mysql/debian-*.flag." + +#, fuzzy +#~| msgid "" +#~| "Such file is an indication that a mariadb-server package with a higher " +#~| "version has been installed earlier." +#~ msgid "" +#~ "Such a file is an indication that a mariadb-server package with a higher " +#~ "version has been installed previously." +#~ msgstr "" +#~ "Este ficheiro indica que antes se instalou un paquete mariadb-server " +#~ "cunha versión superior." + +#~ msgid "" +#~ "There is no guarantee that the version you're currently installing will " +#~ "be able to use the current databases." +#~ msgstr "" +#~ "Non se pode garantir que a versión que está a instalar poida empregar as " +#~ "bases de datos actuais." + +#~ msgid "Start the MariaDB server on boot?" +#~ msgstr "¿Iniciar o servidor MariaDB co ordenador?" + +#~ msgid "" +#~ "The MariaDB server can be launched automatically at boot time or manually " +#~ "with the '/etc/init.d/mysql start' command." +#~ msgstr "" +#~ "Pódese iniciar automaticamente o servidor MariaDB ao iniciar o ordenador, " +#~ "ou manualmente coa orde \"/etc/init.d/mysql start\"." + #~ msgid "" #~ "To use MariaDB, the following entries for users and groups should be " #~ "added to the system:" diff --git a/debian/po/it.po b/debian/po/it.po index 076f03c9b75..7fe2c994a08 100644 --- a/debian/po/it.po +++ b/debian/po/it.po @@ -2,12 +2,12 @@ # Copyright (C) 2009 Software in the Public Interest # This file is distributed under the same license as the mysql-dfsg-5.1 package. # Luca Monducci , 2006 - 2009. -# +# msgid "" msgstr "" "Project-Id-Version: mysql-dfsg-5.1 5.1.37 italian debconf templates\n" "Report-Msgid-Bugs-To: mariadb-10.2@packages.debian.org\n" -"POT-Creation-Date: 2012-01-12 13:08+0100\n" +"POT-Creation-Date: 2016-10-08 01:26+0300\n" "PO-Revision-Date: 2009-08-08 11:03+0200\n" "Last-Translator: Luca Monducci \n" "Language-Team: Italian \n" @@ -16,38 +16,35 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 -msgid "Really proceed with downgrade?" -msgstr "Procedere realmente con l'abbassamento di versione?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgid "The old data directory will be saved at new location" msgstr "" -"Su questo sistema esiste un file con nome /var/lib/mysql/debian-*.flag." -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"Such a file is an indication that a mariadb-server package with a higher " -"version has been installed previously." +"A file named /var/lib/mysql/debian-*.flag exists on this system. The number " +"indicates a database binary format version that cannot automatically be " +"upgraded (or downgraded)." msgstr "" -"Quel file indica che in precedenza è stata installata una versione superiore " -"del pacchetto mariadb-server." -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"There is no guarantee that the version you're currently installing will be " -"able to use the current databases." +"Therefore the previous data directory will be renamed to /var/lib/mysql-* " +"and a new data directory will be initialized at /var/lib/mysql." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Please manually export/import your data (e.g. with mysqldump) if needed." msgstr "" -"Non è garantito che la versione che si sta installando sia in grado di usare " -"i database presenti." #. Type: note #. Description @@ -103,31 +100,15 @@ msgstr "" "recente oppure se sono già in uso da un altro pacchetto mariadb-server, i " "dati non devono essere eliminati." -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "Start the MariaDB server on boot?" -msgstr "Lanciare il server MariaDB all'avvio?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "" -"The MariaDB server can be launched automatically at boot time or manually " -"with the '/etc/init.d/mysql start' command." -msgstr "" -"Il server MariaDB può essere lanciato automaticamente all'avvio del sistema " -"oppure manualmente con il comando «/etc/init.d/mysql start»." - #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "New password for the MariaDB \"root\" user:" msgstr "Nuova password per l'utente «root» di MariaDB:" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "" "While not mandatory, it is highly recommended that you set a password for " "the MariaDB administrative \"root\" user." @@ -137,25 +118,25 @@ msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "If this field is left blank, the password will not be changed." msgstr "Se questo campo è lasciato vuoto, la password non viene cambiata." #. Type: password #. Description -#: ../mariadb-server-10.2.templates:7001 +#: ../mariadb-server-10.2.templates:6001 msgid "Repeat password for the MariaDB \"root\" user:" msgstr "Ripetere la password per l'utente «root» di MariaDB:" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "Unable to set password for the MariaDB \"root\" user" msgstr "Impossibile impostare la password per l'utente «root» di MariaDB" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "" "An error occurred while setting the password for the MariaDB administrative " "user. This may have happened because the account already has a password, or " @@ -168,14 +149,14 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "You should check the account's password after the package installation." msgstr "" "Al termine dell'installazione si deve verificare la password dell'account." #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "" #| "Please read the /usr/share/doc/mariadb-server-10.2/README.Debian file for " @@ -189,13 +170,43 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "Password input error" msgstr "Errore di inserimento della password" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "The two passwords you entered were not the same. Please try again." msgstr "Le due password inserite sono diverse. Riprovare." +#~ msgid "Really proceed with downgrade?" +#~ msgstr "Procedere realmente con l'abbassamento di versione?" + +#~ msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +#~ msgstr "" +#~ "Su questo sistema esiste un file con nome /var/lib/mysql/debian-*.flag." + +#~ msgid "" +#~ "Such a file is an indication that a mariadb-server package with a higher " +#~ "version has been installed previously." +#~ msgstr "" +#~ "Quel file indica che in precedenza è stata installata una versione " +#~ "superiore del pacchetto mariadb-server." + +#~ msgid "" +#~ "There is no guarantee that the version you're currently installing will " +#~ "be able to use the current databases." +#~ msgstr "" +#~ "Non è garantito che la versione che si sta installando sia in grado di " +#~ "usare i database presenti." + +#~ msgid "Start the MariaDB server on boot?" +#~ msgstr "Lanciare il server MariaDB all'avvio?" + +#~ msgid "" +#~ "The MariaDB server can be launched automatically at boot time or manually " +#~ "with the '/etc/init.d/mysql start' command." +#~ msgstr "" +#~ "Il server MariaDB può essere lanciato automaticamente all'avvio del " +#~ "sistema oppure manualmente con il comando «/etc/init.d/mysql start»." diff --git a/debian/po/ja.po b/debian/po/ja.po index 30b54ff447d..1d4d5d36896 100644 --- a/debian/po/ja.po +++ b/debian/po/ja.po @@ -16,7 +16,7 @@ msgid "" msgstr "" "Project-Id-Version: mysql-dfsg-5.1 5.1.37-1\n" "Report-Msgid-Bugs-To: mariadb-10.2@packages.debian.org\n" -"POT-Creation-Date: 2012-01-12 13:08+0100\n" +"POT-Creation-Date: 2016-10-08 01:26+0300\n" "PO-Revision-Date: 2009-09-01 08:25+0900\n" "Last-Translator: Hideki Yamane (Debian-JP) \n" "Language-Team: Japanese \n" @@ -25,39 +25,35 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 -msgid "Really proceed with downgrade?" -msgstr "本当ã«ãƒ€ã‚¦ãƒ³ã‚°ãƒ¬ãƒ¼ãƒ‰ã‚’実行ã—ã¾ã™ã‹?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgid "The old data directory will be saved at new location" msgstr "" -"ã“ã®ã‚·ã‚¹ãƒ†ãƒ ã«ã¯ /var/lib/mysql/debian-*.flag ã¨ã„ã†åå‰ã®ãƒ•ァイルãŒå­˜åœ¨ã—ã¦" -"ã„ã¾ã™ã€‚" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"Such a file is an indication that a mariadb-server package with a higher " -"version has been installed previously." +"A file named /var/lib/mysql/debian-*.flag exists on this system. The number " +"indicates a database binary format version that cannot automatically be " +"upgraded (or downgraded)." msgstr "" -"ã“ã®ãƒ•ã‚¡ã‚¤ãƒ«ãŒæ„味ã™ã‚‹ã®ã¯ã€ä»¥å‰ã«ã‚ˆã‚Šæ–°ã—ã„ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã® mariadb-server パッ" -"ケージãŒã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã•れã¦ã„ãŸã“ã¨ã‚’示ã—ã¾ã™ã€‚" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"There is no guarantee that the version you're currently installing will be " -"able to use the current databases." +"Therefore the previous data directory will be renamed to /var/lib/mysql-* " +"and a new data directory will be initialized at /var/lib/mysql." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Please manually export/import your data (e.g. with mysqldump) if needed." msgstr "" -"ã“ã®ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã‚’ç¾åœ¨ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã—よã†ã¨ã—ã¦ã„ã‚‹ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã§ä½¿ãˆã‚‹ã‹ã©ã†ã‹" -"ã¯ä¿è¨¼ã§ãã¾ã›ã‚“。" #. Type: note #. Description @@ -111,31 +107,15 @@ msgstr "" "ケージを削除ã—よã†ã¨ã—ã¦ã„ã‚‹ã€ã‚ã‚‹ã„ã¯åˆ¥ã® mariadb-server パッケージを既ã«" "使ã£ã¦ã„ã‚‹å ´åˆã€ãƒ‡ãƒ¼ã‚¿ã¯ä¿æŒã™ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚" -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "Start the MariaDB server on boot?" -msgstr "MariaDB をシステム起動時ã«é–‹å§‹ã—ã¾ã™ã‹?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "" -"The MariaDB server can be launched automatically at boot time or manually " -"with the '/etc/init.d/mysql start' command." -msgstr "" -"MariaDB ã®èµ·å‹•方法ã«ã¤ã„ã¦ã€ã‚·ã‚¹ãƒ†ãƒ èµ·å‹•時ã«è‡ªå‹•çš„ã«é–‹å§‹ã™ã‚‹ã‹ã€ã‚ã‚‹ã„㯠'/" -"etc/init.d/mysql start' ã¨æ‰‹ã§å…¥åŠ›ã—ã¦èµ·å‹•ã™ã‚‹ã‹ã‚’é¸ã¹ã¾ã™ã€‚" - #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "New password for the MariaDB \"root\" user:" msgstr "MariaDB ã® \"root\" ユーザã«å¯¾ã™ã‚‹æ–°ã—ã„パスワード:" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "" "While not mandatory, it is highly recommended that you set a password for " "the MariaDB administrative \"root\" user." @@ -145,25 +125,25 @@ msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "If this field is left blank, the password will not be changed." msgstr "ã“ã®å€¤ã‚’空ã®ã¾ã¾ã«ã—ã¦ãŠã„ãŸå ´åˆã¯ã€ãƒ‘スワードã¯å¤‰æ›´ã•れã¾ã›ã‚“。" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:7001 +#: ../mariadb-server-10.2.templates:6001 msgid "Repeat password for the MariaDB \"root\" user:" msgstr "MariaDB ã® \"root\" ユーザã«å¯¾ã™ã‚‹æ–°ã—ã„パスワード:" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "Unable to set password for the MariaDB \"root\" user" msgstr "MariaDB ã® \"root\" ユーザã®ãƒ‘スワードを設定ã§ãã¾ã›ã‚“" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "" "An error occurred while setting the password for the MariaDB administrative " "user. This may have happened because the account already has a password, or " @@ -175,14 +155,14 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "You should check the account's password after the package installation." msgstr "" "パッケージã®ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«å¾Œã€ã‚¢ã‚«ã‚¦ãƒ³ãƒˆã®ãƒ‘スワードを確èªã™ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "" #| "Please read the /usr/share/doc/mariadb-server-10.2/README.Debian file for " @@ -195,13 +175,44 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "Password input error" msgstr "パスワード入力エラー" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "The two passwords you entered were not the same. Please try again." msgstr "入力ã•れãŸäºŒã¤ã®ãƒ‘スワードãŒä¸€è‡´ã—ã¾ã›ã‚“。å†å…¥åŠ›ã—ã¦ãã ã•ã„。" +#~ msgid "Really proceed with downgrade?" +#~ msgstr "本当ã«ãƒ€ã‚¦ãƒ³ã‚°ãƒ¬ãƒ¼ãƒ‰ã‚’実行ã—ã¾ã™ã‹?" + +#~ msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +#~ msgstr "" +#~ "ã“ã®ã‚·ã‚¹ãƒ†ãƒ ã«ã¯ /var/lib/mysql/debian-*.flag ã¨ã„ã†åå‰ã®ãƒ•ァイルãŒå­˜åœ¨" +#~ "ã—ã¦ã„ã¾ã™ã€‚" + +#~ msgid "" +#~ "Such a file is an indication that a mariadb-server package with a higher " +#~ "version has been installed previously." +#~ msgstr "" +#~ "ã“ã®ãƒ•ã‚¡ã‚¤ãƒ«ãŒæ„味ã™ã‚‹ã®ã¯ã€ä»¥å‰ã«ã‚ˆã‚Šæ–°ã—ã„ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã® mariadb-server " +#~ "パッケージãŒã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã•れã¦ã„ãŸã“ã¨ã‚’示ã—ã¾ã™ã€‚" + +#~ msgid "" +#~ "There is no guarantee that the version you're currently installing will " +#~ "be able to use the current databases." +#~ msgstr "" +#~ "ã“ã®ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã‚’ç¾åœ¨ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã—よã†ã¨ã—ã¦ã„ã‚‹ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã§ä½¿ãˆã‚‹ã‹ã©ã†" +#~ "ã‹ã¯ä¿è¨¼ã§ãã¾ã›ã‚“。" + +#~ msgid "Start the MariaDB server on boot?" +#~ msgstr "MariaDB をシステム起動時ã«é–‹å§‹ã—ã¾ã™ã‹?" + +#~ msgid "" +#~ "The MariaDB server can be launched automatically at boot time or manually " +#~ "with the '/etc/init.d/mysql start' command." +#~ msgstr "" +#~ "MariaDB ã®èµ·å‹•方法ã«ã¤ã„ã¦ã€ã‚·ã‚¹ãƒ†ãƒ èµ·å‹•時ã«è‡ªå‹•çš„ã«é–‹å§‹ã™ã‚‹ã‹ã€ã‚ã‚‹ã„㯠" +#~ "'/etc/init.d/mysql start' ã¨æ‰‹ã§å…¥åŠ›ã—ã¦èµ·å‹•ã™ã‚‹ã‹ã‚’é¸ã¹ã¾ã™ã€‚" diff --git a/debian/po/nb.po b/debian/po/nb.po index c3230913e01..ca8fd6e041d 100644 --- a/debian/po/nb.po +++ b/debian/po/nb.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: mysql_nb\n" "Report-Msgid-Bugs-To: mariadb-10.2@packages.debian.org\n" -"POT-Creation-Date: 2012-01-12 13:08+0100\n" +"POT-Creation-Date: 2016-10-08 01:26+0300\n" "PO-Revision-Date: 2007-02-18 12:13+0100\n" "Last-Translator: Bjørn Steensrud \n" "Language-Team: Norwegian BokmÃ¥l \n" @@ -17,43 +17,34 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KBabel 1.11.2\n" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 -#, fuzzy -#| msgid "Do you really want to downgrade?" -msgid "Really proceed with downgrade?" -msgstr "Er du sikker pÃ¥ at du vil nedgradere?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgid "The old data directory will be saved at new location" msgstr "" -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -#, fuzzy -#| msgid "" -#| "WARNING: The file /var/lib/mysql/debian-*.flag exists. This indicates " -#| "that a mysql-server package with a higher version has been installed " -#| "before. It can not be guaranteed that this version can use its data." -msgid "" -"Such a file is an indication that a mariadb-server package with a higher " -"version has been installed previously." -msgstr "" -"ADVARSEL: Fila /var/lib/mysql/debian-*.flag finnes. Dette viser at en " -"mariadb-server-pakke med et høyere versjonsnummer har vært installert før. " -"Det kan ikke garanteres at denne versjonen kan bruke data fra den høyere " -"versjonen." - -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"There is no guarantee that the version you're currently installing will be " -"able to use the current databases." +"A file named /var/lib/mysql/debian-*.flag exists on this system. The number " +"indicates a database binary format version that cannot automatically be " +"upgraded (or downgraded)." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Therefore the previous data directory will be renamed to /var/lib/mysql-* " +"and a new data directory will be initialized at /var/lib/mysql." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Please manually export/import your data (e.g. with mysqldump) if needed." msgstr "" #. Type: note @@ -111,31 +102,9 @@ msgstr "" "beholdes hvis det bare skal installeres en høyere MariaDB-versjon, eller " "hvis en annen mariadb-server-pakke allerede bruker den." -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -#, fuzzy -#| msgid "Should MySQL start on boot?" -msgid "Start the MariaDB server on boot?" -msgstr "Skal MariaDB startes ved maskinoppstart?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -#, fuzzy -#| msgid "" -#| "The MySQL can start automatically on boot time or only if you manually " -#| "type '/etc/init.d/mysql start'." -msgid "" -"The MariaDB server can be launched automatically at boot time or manually " -"with the '/etc/init.d/mysql start' command." -msgstr "" -"MariaDB kan startes automatisk nÃ¥r maskinen starter, eller bare hvis du " -"skriver «/etc/init.d/mysql start»." - #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 #, fuzzy #| msgid "New password for MySQL \"root\" user:" msgid "New password for the MariaDB \"root\" user:" @@ -143,7 +112,7 @@ msgstr "Nytt passord for MariaDBs «root»-bruker:" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 #, fuzzy #| msgid "" #| "It is highly recommended that you set a password for the MySQL " @@ -157,13 +126,13 @@ msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "If this field is left blank, the password will not be changed." msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:7001 +#: ../mariadb-server-10.2.templates:6001 #, fuzzy #| msgid "New password for MySQL \"root\" user:" msgid "Repeat password for the MariaDB \"root\" user:" @@ -171,7 +140,7 @@ msgstr "Nytt passord for MariaDBs «root»-bruker:" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "Unable to set password for MySQL \"root\" user" msgid "Unable to set password for the MariaDB \"root\" user" @@ -179,7 +148,7 @@ msgstr "Klarer ikke angi passord for MariaDBs «root»-bruker" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "" #| "It seems an error occurred while setting the password for the MySQL " @@ -198,13 +167,13 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "You should check the account's password after the package installation." msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "" "Please read the /usr/share/doc/mariadb-server-10.2/README.Debian file for " "more information." @@ -212,16 +181,51 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "Password input error" msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "The two passwords you entered were not the same. Please try again." msgstr "" +#, fuzzy +#~| msgid "Do you really want to downgrade?" +#~ msgid "Really proceed with downgrade?" +#~ msgstr "Er du sikker pÃ¥ at du vil nedgradere?" + +#, fuzzy +#~| msgid "" +#~| "WARNING: The file /var/lib/mysql/debian-*.flag exists. This indicates " +#~| "that a mysql-server package with a higher version has been installed " +#~| "before. It can not be guaranteed that this version can use its data." +#~ msgid "" +#~ "Such a file is an indication that a mariadb-server package with a higher " +#~ "version has been installed previously." +#~ msgstr "" +#~ "ADVARSEL: Fila /var/lib/mysql/debian-*.flag finnes. Dette viser at en " +#~ "mariadb-server-pakke med et høyere versjonsnummer har vært installert " +#~ "før. Det kan ikke garanteres at denne versjonen kan bruke data fra den " +#~ "høyere versjonen." + +#, fuzzy +#~| msgid "Should MySQL start on boot?" +#~ msgid "Start the MariaDB server on boot?" +#~ msgstr "Skal MariaDB startes ved maskinoppstart?" + +#, fuzzy +#~| msgid "" +#~| "The MySQL can start automatically on boot time or only if you manually " +#~| "type '/etc/init.d/mysql start'." +#~ msgid "" +#~ "The MariaDB server can be launched automatically at boot time or manually " +#~ "with the '/etc/init.d/mysql start' command." +#~ msgstr "" +#~ "MariaDB kan startes automatisk nÃ¥r maskinen starter, eller bare hvis du " +#~ "skriver «/etc/init.d/mysql start»." + #~ msgid "" #~ "Support MySQL connections from hosts running Debian \"sarge\" or older?" #~ msgstr "" diff --git a/debian/po/nl.po b/debian/po/nl.po index 900fcaa5822..b05a30d720d 100644 --- a/debian/po/nl.po +++ b/debian/po/nl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: mysql-dfsg-5.1 5.0.30-1\n" "Report-Msgid-Bugs-To: mariadb-10.2@packages.debian.org\n" -"POT-Creation-Date: 2012-01-12 13:08+0100\n" +"POT-Creation-Date: 2016-10-08 01:26+0300\n" "PO-Revision-Date: 2006-02-19 10:20+0100\n" "Last-Translator: Thijs Kinkhorst \n" "Language-Team: Debian-Dutch \n" @@ -16,44 +16,34 @@ msgstr "" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 -#, fuzzy -#| msgid "Do you really want to downgrade?" -msgid "Really proceed with downgrade?" -msgstr "Wilt u echt een oude versie herstellen?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgid "The old data directory will be saved at new location" msgstr "" -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -#, fuzzy -#| msgid "" -#| "WARNING: The file /var/lib/mysql/debian-*.flag exists. This indicates " -#| "that a mysql-server package with a higher version has been installed " -#| "before. It can not be guaranteed that this version can use its data." -msgid "" -"Such a file is an indication that a mariadb-server package with a higher " -"version has been installed previously." -msgstr "" -"Waarschuwing: waarschijnlijk is een hogere versie van het mariadb-server " -"pakket geïnstalleerd geweest (het bestand /var/lib/mysql/debian-*.flag " -"bestaat). Er is geen garantie dat de gegevensbestanden, bewerkt met die " -"hogere versie, kunnen worden gebruikt met de versie van mysql die u nu " -"installeert." - -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"There is no guarantee that the version you're currently installing will be " -"able to use the current databases." +"A file named /var/lib/mysql/debian-*.flag exists on this system. The number " +"indicates a database binary format version that cannot automatically be " +"upgraded (or downgraded)." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Therefore the previous data directory will be renamed to /var/lib/mysql-* " +"and a new data directory will be initialized at /var/lib/mysql." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Please manually export/import your data (e.g. with mysqldump) if needed." msgstr "" #. Type: note @@ -112,31 +102,9 @@ msgstr "" "een ander mariadb-serverpakket de datamap al gebruikt, dan zou de data " "moeten worden behouden." -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -#, fuzzy -#| msgid "Should MySQL start on boot?" -msgid "Start the MariaDB server on boot?" -msgstr "Moet MariaDB starten als de computer start?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -#, fuzzy -#| msgid "" -#| "The MySQL can start automatically on boot time or only if you manually " -#| "type '/etc/init.d/mysql start'." -msgid "" -"The MariaDB server can be launched automatically at boot time or manually " -"with the '/etc/init.d/mysql start' command." -msgstr "" -"MariaDB kan automatisch starten bij het starten van de computer, of slechts " -"wanneer u '/etc/init.d/mysql start' handmatig uitvoert." - #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 #, fuzzy #| msgid "New password for MySQL \"root\" user:" msgid "New password for the MariaDB \"root\" user:" @@ -144,7 +112,7 @@ msgstr "Nieuw wachtwoord voor de MariaDB \"root\"-gebruiker:" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 #, fuzzy #| msgid "" #| "It is highly recommended that you set a password for the MySQL " @@ -158,13 +126,13 @@ msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "If this field is left blank, the password will not be changed." msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:7001 +#: ../mariadb-server-10.2.templates:6001 #, fuzzy #| msgid "New password for MySQL \"root\" user:" msgid "Repeat password for the MariaDB \"root\" user:" @@ -172,7 +140,7 @@ msgstr "Nieuw wachtwoord voor de MariaDB \"root\"-gebruiker:" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "Unable to set password for MySQL \"root\" user" msgid "Unable to set password for the MariaDB \"root\" user" @@ -180,7 +148,7 @@ msgstr "Kan het wachtwoord voor de MariaDB \"root\"-gebruiker niet instellen" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "" #| "It seems an error occurred while setting the password for the MySQL " @@ -199,13 +167,13 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "You should check the account's password after the package installation." msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "" "Please read the /usr/share/doc/mariadb-server-10.2/README.Debian file for " "more information." @@ -213,16 +181,52 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "Password input error" msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "The two passwords you entered were not the same. Please try again." msgstr "" +#, fuzzy +#~| msgid "Do you really want to downgrade?" +#~ msgid "Really proceed with downgrade?" +#~ msgstr "Wilt u echt een oude versie herstellen?" + +#, fuzzy +#~| msgid "" +#~| "WARNING: The file /var/lib/mysql/debian-*.flag exists. This indicates " +#~| "that a mysql-server package with a higher version has been installed " +#~| "before. It can not be guaranteed that this version can use its data." +#~ msgid "" +#~ "Such a file is an indication that a mariadb-server package with a higher " +#~ "version has been installed previously." +#~ msgstr "" +#~ "Waarschuwing: waarschijnlijk is een hogere versie van het mariadb-server " +#~ "pakket geïnstalleerd geweest (het bestand /var/lib/mysql/debian-*.flag " +#~ "bestaat). Er is geen garantie dat de gegevensbestanden, bewerkt met die " +#~ "hogere versie, kunnen worden gebruikt met de versie van mysql die u nu " +#~ "installeert." + +#, fuzzy +#~| msgid "Should MySQL start on boot?" +#~ msgid "Start the MariaDB server on boot?" +#~ msgstr "Moet MariaDB starten als de computer start?" + +#, fuzzy +#~| msgid "" +#~| "The MySQL can start automatically on boot time or only if you manually " +#~| "type '/etc/init.d/mysql start'." +#~ msgid "" +#~ "The MariaDB server can be launched automatically at boot time or manually " +#~ "with the '/etc/init.d/mysql start' command." +#~ msgstr "" +#~ "MariaDB kan automatisch starten bij het starten van de computer, of " +#~ "slechts wanneer u '/etc/init.d/mysql start' handmatig uitvoert." + #~ msgid "" #~ "Support MySQL connections from hosts running Debian \"sarge\" or older?" #~ msgstr "" diff --git a/debian/po/pt.po b/debian/po/pt.po index d612b83f943..069d74348ed 100644 --- a/debian/po/pt.po +++ b/debian/po/pt.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: mysql-dfsg-5.1\n" "Report-Msgid-Bugs-To: mariadb-10.2@packages.debian.org\n" -"POT-Creation-Date: 2012-01-12 13:08+0100\n" +"POT-Creation-Date: 2016-10-08 01:26+0300\n" "PO-Revision-Date: 2007-05-05 21:01+0100\n" "Last-Translator: Miguel Figueiredo \n" "Language-Team: Portuguese \n" @@ -16,41 +16,35 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 -msgid "Really proceed with downgrade?" -msgstr "Deseja mesmo fazer downgrade?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." -msgstr "Existe um ficheiro chamado /var/lib/mysql/debian-*.flag neste sistema." - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -#, fuzzy -#| msgid "" -#| "Such file is an indication that a mariadb-server package with a higher " -#| "version has been installed earlier." -msgid "" -"Such a file is an indication that a mariadb-server package with a higher " -"version has been installed previously." +msgid "The old data directory will be saved at new location" msgstr "" -"Tal ficheiro significa que anteriormente foi instalado um pacote mariadb-" -"server com um número de versão superior." -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"There is no guarantee that the version you're currently installing will be " -"able to use the current databases." +"A file named /var/lib/mysql/debian-*.flag exists on this system. The number " +"indicates a database binary format version that cannot automatically be " +"upgraded (or downgraded)." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Therefore the previous data directory will be renamed to /var/lib/mysql-* " +"and a new data directory will be initialized at /var/lib/mysql." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Please manually export/import your data (e.g. with mysqldump) if needed." msgstr "" -"Não existe nenhuma garantia que a versão que está actualmente a instalar " -"seja capaz de utilizar as bases de dados actuais." #. Type: note #. Description @@ -107,31 +101,15 @@ msgstr "" "versão mais recente ou se um pacote mariadb-server já está os está a " "utilizar, os dados devem ser mantidos." -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "Start the MariaDB server on boot?" -msgstr "Iniciar o servidor MariaDB no arranque?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "" -"The MariaDB server can be launched automatically at boot time or manually " -"with the '/etc/init.d/mysql start' command." -msgstr "" -"O MariaDB pode ser automaticamente lançado no arranque ou manualmente " -"através do comando '/etc/init.d/mysql start'." - #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "New password for the MariaDB \"root\" user:" msgstr "Nova palavra-passe para o utilizador \"root\" do MariaDB:" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "" "While not mandatory, it is highly recommended that you set a password for " "the MariaDB administrative \"root\" user." @@ -141,7 +119,7 @@ msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 #, fuzzy #| msgid "If that field is left blank, the password will not be changed." msgid "If this field is left blank, the password will not be changed." @@ -150,7 +128,7 @@ msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:7001 +#: ../mariadb-server-10.2.templates:6001 #, fuzzy #| msgid "New password for the MySQL \"root\" user:" msgid "Repeat password for the MariaDB \"root\" user:" @@ -158,7 +136,7 @@ msgstr "Nova palavra-passe para o utilizador \"root\" do MariaDB:" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "Unable to set password for the MariaDB \"root\" user" msgstr "" "Não foi possível definir a palavra-passe para o utilizador \"root\" do " @@ -166,7 +144,7 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "" "An error occurred while setting the password for the MariaDB administrative " "user. This may have happened because the account already has a password, or " @@ -179,7 +157,7 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "" #| "You should check the account's password after tha package installation." @@ -189,7 +167,7 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "" #| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for " @@ -203,16 +181,51 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "Password input error" msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "The two passwords you entered were not the same. Please try again." msgstr "" +#~ msgid "Really proceed with downgrade?" +#~ msgstr "Deseja mesmo fazer downgrade?" + +#~ msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +#~ msgstr "" +#~ "Existe um ficheiro chamado /var/lib/mysql/debian-*.flag neste sistema." + +#, fuzzy +#~| msgid "" +#~| "Such file is an indication that a mariadb-server package with a higher " +#~| "version has been installed earlier." +#~ msgid "" +#~ "Such a file is an indication that a mariadb-server package with a higher " +#~ "version has been installed previously." +#~ msgstr "" +#~ "Tal ficheiro significa que anteriormente foi instalado um pacote mariadb-" +#~ "server com um número de versão superior." + +#~ msgid "" +#~ "There is no guarantee that the version you're currently installing will " +#~ "be able to use the current databases." +#~ msgstr "" +#~ "Não existe nenhuma garantia que a versão que está actualmente a instalar " +#~ "seja capaz de utilizar as bases de dados actuais." + +#~ msgid "Start the MariaDB server on boot?" +#~ msgstr "Iniciar o servidor MariaDB no arranque?" + +#~ msgid "" +#~ "The MariaDB server can be launched automatically at boot time or manually " +#~ "with the '/etc/init.d/mysql start' command." +#~ msgstr "" +#~ "O MariaDB pode ser automaticamente lançado no arranque ou manualmente " +#~ "através do comando '/etc/init.d/mysql start'." + #~ msgid "" #~ "To use MariaDB, the following entries for users and groups should be " #~ "added to the system:" diff --git a/debian/po/pt_BR.po b/debian/po/pt_BR.po index 46ffefb8259..03d564da79b 100644 --- a/debian/po/pt_BR.po +++ b/debian/po/pt_BR.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: mysql-dfsg-5.1\n" "Report-Msgid-Bugs-To: mariadb-10.2@packages.debian.org\n" -"POT-Creation-Date: 2012-01-12 13:08+0100\n" +"POT-Creation-Date: 2016-10-08 01:26+0300\n" "PO-Revision-Date: 2007-04-21 15:59-0300\n" "Last-Translator: André Luís Lopes \n" "Language-Team: Debian-BR Project \n" @@ -19,41 +19,35 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "pt_BR utf-8\n" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 -msgid "Really proceed with downgrade?" -msgstr "Realmente proceder com o rebaixamento de versão?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." -msgstr "Um arquivo de nome /var/lib/mysql/debian-*.flag existe no sistema." - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -#, fuzzy -#| msgid "" -#| "Such file is an indication that a mariadb-server package with a higher " -#| "version has been installed earlier." -msgid "" -"Such a file is an indication that a mariadb-server package with a higher " -"version has been installed previously." +msgid "The old data directory will be saved at new location" msgstr "" -"A presença de um arquivo como este é uma indicação de que um pacote mariadb-" -"server com um número de versão mais alto já foi instalado anteriormente." -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"There is no guarantee that the version you're currently installing will be " -"able to use the current databases." +"A file named /var/lib/mysql/debian-*.flag exists on this system. The number " +"indicates a database binary format version that cannot automatically be " +"upgraded (or downgraded)." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Therefore the previous data directory will be renamed to /var/lib/mysql-* " +"and a new data directory will be initialized at /var/lib/mysql." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Please manually export/import your data (e.g. with mysqldump) if needed." msgstr "" -"Não há garantias de que a versão que você está instalando no momento " -"conseguirá utilizar as bases de dados existentes." #. Type: note #. Description @@ -110,31 +104,15 @@ msgstr "" "versão mais recente ou, caso uma versão diferente do pacote mariadb-server " "esteja sendo utilizada, os dados deverão ser mantidos." -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "Start the MariaDB server on boot?" -msgstr "Iniciar o servidor MariaDB junto a inicialização da máquina?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "" -"The MariaDB server can be launched automatically at boot time or manually " -"with the '/etc/init.d/mysql start' command." -msgstr "" -"O servidor MariaDB pode ser iniciado automaticamente junto a inicialização " -"da máquina ou manualmente com o comando '/etc/init.d/mysql start'." - #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "New password for the MariaDB \"root\" user:" msgstr "Nova senha para o usuário \"root\" do MariaDB:" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "" "While not mandatory, it is highly recommended that you set a password for " "the MariaDB administrative \"root\" user." @@ -144,7 +122,7 @@ msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 #, fuzzy #| msgid "If that field is left blank, the password will not be changed." msgid "If this field is left blank, the password will not be changed." @@ -152,7 +130,7 @@ msgstr "Caso este campo seja deixado em branco, a senha não sera mudada." #. Type: password #. Description -#: ../mariadb-server-10.2.templates:7001 +#: ../mariadb-server-10.2.templates:6001 #, fuzzy #| msgid "New password for the MySQL \"root\" user:" msgid "Repeat password for the MariaDB \"root\" user:" @@ -160,13 +138,13 @@ msgstr "Nova senha para o usuário \"root\" do MariaDB:" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "Unable to set password for the MariaDB \"root\" user" msgstr "Impossível definir senha para o usuário \"root\" do MariaDB" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "" "An error occurred while setting the password for the MariaDB administrative " "user. This may have happened because the account already has a password, or " @@ -179,7 +157,7 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "" #| "You should check the account's password after tha package installation." @@ -188,7 +166,7 @@ msgstr "Você deverá checar a senha dessa conta após a instalação deste paco #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "" #| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for " @@ -202,16 +180,52 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "Password input error" msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "The two passwords you entered were not the same. Please try again." msgstr "" +#~ msgid "Really proceed with downgrade?" +#~ msgstr "Realmente proceder com o rebaixamento de versão?" + +#~ msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +#~ msgstr "Um arquivo de nome /var/lib/mysql/debian-*.flag existe no sistema." + +#, fuzzy +#~| msgid "" +#~| "Such file is an indication that a mariadb-server package with a higher " +#~| "version has been installed earlier." +#~ msgid "" +#~ "Such a file is an indication that a mariadb-server package with a higher " +#~ "version has been installed previously." +#~ msgstr "" +#~ "A presença de um arquivo como este é uma indicação de que um pacote " +#~ "mariadb-server com um número de versão mais alto já foi instalado " +#~ "anteriormente." + +#~ msgid "" +#~ "There is no guarantee that the version you're currently installing will " +#~ "be able to use the current databases." +#~ msgstr "" +#~ "Não há garantias de que a versão que você está instalando no momento " +#~ "conseguirá utilizar as bases de dados existentes." + +#~ msgid "Start the MariaDB server on boot?" +#~ msgstr "Iniciar o servidor MariaDB junto a inicialização da máquina?" + +#~ msgid "" +#~ "The MariaDB server can be launched automatically at boot time or manually " +#~ "with the '/etc/init.d/mysql start' command." +#~ msgstr "" +#~ "O servidor MariaDB pode ser iniciado automaticamente junto a " +#~ "inicialização da máquina ou manualmente com o comando '/etc/init.d/mysql " +#~ "start'." + #~ msgid "" #~ "To use MariaDB, the following entries for users and groups should be " #~ "added to the system:" diff --git a/debian/po/ro.po b/debian/po/ro.po index c960e3d2eb4..45ed4aff10b 100644 --- a/debian/po/ro.po +++ b/debian/po/ro.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: po-debconf://mysql-dfsg\n" "Report-Msgid-Bugs-To: mariadb-10.2@packages.debian.org\n" -"POT-Creation-Date: 2012-01-12 13:08+0100\n" +"POT-Creation-Date: 2016-10-08 01:26+0300\n" "PO-Revision-Date: 2006-12-20 21:27+0200\n" "Last-Translator: stan ioan-eugen \n" "Language-Team: romanian \n" @@ -17,43 +17,34 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KBabel 1.11.4\n" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 -#, fuzzy -#| msgid "Do you really want to downgrade?" -msgid "Really proceed with downgrade?" -msgstr "SunteÅ£i sigur că doriÅ£i să instalaÅ£i o versiune mai veche?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgid "The old data directory will be saved at new location" msgstr "" -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -#, fuzzy -#| msgid "" -#| "WARNING: The file /var/lib/mysql/debian-*.flag exists. This indicates " -#| "that a mysql-server package with a higher version has been installed " -#| "before. It can not be guaranteed that this version can use its data." -msgid "" -"Such a file is an indication that a mariadb-server package with a higher " -"version has been installed previously." -msgstr "" -"AVERTISMENT: FiÅŸierul /var/lib/mysql/debian-*.flag există. Acest lucru " -"indică faptul că anterior a fost instalată o versiune nouă a pachetului " -"mariadb-server. Nu se poate garanta că versiunea instalată acum poate folosi " -"datele versiunii instalate anterior." - -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"There is no guarantee that the version you're currently installing will be " -"able to use the current databases." +"A file named /var/lib/mysql/debian-*.flag exists on this system. The number " +"indicates a database binary format version that cannot automatically be " +"upgraded (or downgraded)." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Therefore the previous data directory will be renamed to /var/lib/mysql-* " +"and a new data directory will be initialized at /var/lib/mysql." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Please manually export/import your data (e.g. with mysqldump) if needed." msgstr "" #. Type: note @@ -111,31 +102,9 @@ msgstr "" "doar să instalaÅ£i o versiune nouă MariaDB sau datele sunt folosite de către " "un alt pachet mariadb-server, atunci ar trebui păstraÅ£i datele." -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -#, fuzzy -#| msgid "Should MySQL start on boot?" -msgid "Start the MariaDB server on boot?" -msgstr "DoriÅ£i ca MariaDB să pornească la initializarea sistemului?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -#, fuzzy -#| msgid "" -#| "The MySQL can start automatically on boot time or only if you manually " -#| "type '/etc/init.d/mysql start'." -msgid "" -"The MariaDB server can be launched automatically at boot time or manually " -"with the '/etc/init.d/mysql start' command." -msgstr "" -"MariaDB poate porni automat la iniÅ£ializarea sistemului sau doar dacă rulaÅ£i " -"comanda „/etc/init.d/mysql startâ€." - #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 #, fuzzy #| msgid "New password for MySQL \"root\" user:" msgid "New password for the MariaDB \"root\" user:" @@ -143,7 +112,7 @@ msgstr "Noua parolă pentru utilizatorul „root†al MariaDB:" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 #, fuzzy #| msgid "" #| "It is highly recommended that you set a password for the MySQL " @@ -157,13 +126,13 @@ msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "If this field is left blank, the password will not be changed." msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:7001 +#: ../mariadb-server-10.2.templates:6001 #, fuzzy #| msgid "New password for MySQL \"root\" user:" msgid "Repeat password for the MariaDB \"root\" user:" @@ -171,7 +140,7 @@ msgstr "Noua parolă pentru utilizatorul „root†al MariaDB:" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "Unable to set password for MySQL \"root\" user" msgid "Unable to set password for the MariaDB \"root\" user" @@ -179,7 +148,7 @@ msgstr "Nu s-a putut stabili parola pentru utilizatorul „root†al MariaDB" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "" #| "It seems an error occurred while setting the password for the MySQL " @@ -198,13 +167,13 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "You should check the account's password after the package installation." msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "" "Please read the /usr/share/doc/mariadb-server-10.2/README.Debian file for " "more information." @@ -212,16 +181,51 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "Password input error" msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "The two passwords you entered were not the same. Please try again." msgstr "" +#, fuzzy +#~| msgid "Do you really want to downgrade?" +#~ msgid "Really proceed with downgrade?" +#~ msgstr "SunteÅ£i sigur că doriÅ£i să instalaÅ£i o versiune mai veche?" + +#, fuzzy +#~| msgid "" +#~| "WARNING: The file /var/lib/mysql/debian-*.flag exists. This indicates " +#~| "that a mysql-server package with a higher version has been installed " +#~| "before. It can not be guaranteed that this version can use its data." +#~ msgid "" +#~ "Such a file is an indication that a mariadb-server package with a higher " +#~ "version has been installed previously." +#~ msgstr "" +#~ "AVERTISMENT: FiÅŸierul /var/lib/mysql/debian-*.flag există. Acest lucru " +#~ "indică faptul că anterior a fost instalată o versiune nouă a pachetului " +#~ "mariadb-server. Nu se poate garanta că versiunea instalată acum poate " +#~ "folosi datele versiunii instalate anterior." + +#, fuzzy +#~| msgid "Should MySQL start on boot?" +#~ msgid "Start the MariaDB server on boot?" +#~ msgstr "DoriÅ£i ca MariaDB să pornească la initializarea sistemului?" + +#, fuzzy +#~| msgid "" +#~| "The MySQL can start automatically on boot time or only if you manually " +#~| "type '/etc/init.d/mysql start'." +#~ msgid "" +#~ "The MariaDB server can be launched automatically at boot time or manually " +#~ "with the '/etc/init.d/mysql start' command." +#~ msgstr "" +#~ "MariaDB poate porni automat la iniÅ£ializarea sistemului sau doar dacă " +#~ "rulaÅ£i comanda „/etc/init.d/mysql startâ€." + #~ msgid "Cannot upgrade if ISAM tables are present!" #~ msgstr "Nu se poate face actualizarea dacă sunt prezente tabele ISAM!" diff --git a/debian/po/ru.po b/debian/po/ru.po index 096e9babe09..213f64f6253 100644 --- a/debian/po/ru.po +++ b/debian/po/ru.po @@ -18,7 +18,7 @@ msgid "" msgstr "" "Project-Id-Version: mysql-dfsg-5.1 5.1.37-1\n" "Report-Msgid-Bugs-To: mariadb-10.2@packages.debian.org\n" -"POT-Creation-Date: 2012-01-12 13:08+0100\n" +"POT-Creation-Date: 2016-10-08 01:26+0300\n" "PO-Revision-Date: 2009-08-06 20:27+0400\n" "Last-Translator: Yuri Kozlov \n" "Language-Team: Russian \n" @@ -30,37 +30,35 @@ msgstr "" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 -msgid "Really proceed with downgrade?" -msgstr "ДейÑтвительно уÑтановить более Ñтарую верÑию?" +msgid "The old data directory will be saved at new location" +msgstr "" -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." -msgstr "Ð’ ÑиÑтеме найден файл /var/lib/mysql/debian-*.flag." - -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"Such a file is an indication that a mariadb-server package with a higher " -"version has been installed previously." +"A file named /var/lib/mysql/debian-*.flag exists on this system. The number " +"indicates a database binary format version that cannot automatically be " +"upgraded (or downgraded)." msgstr "" -"Это означает, что ранее уже был уÑтановлен пакет mariadb-server более новой " -"верÑии." -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"There is no guarantee that the version you're currently installing will be " -"able to use the current databases." +"Therefore the previous data directory will be renamed to /var/lib/mysql-* " +"and a new data directory will be initialized at /var/lib/mysql." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Please manually export/import your data (e.g. with mysqldump) if needed." msgstr "" -"Ðет гарантий, что верÑиÑ, ÐºÐ¾Ñ‚Ð¾Ñ€Ð°Ñ ÑƒÑтанавливаетÑÑ ÑейчаÑ, будет ÑпоÑобна " -"работать Ñ Ð¸Ð¼ÐµÑŽÑ‰Ð¸Ð¼Ð¸ÑÑ Ð±Ð°Ð·Ð°Ð¼Ð¸ данных." #. Type: note #. Description @@ -113,31 +111,15 @@ msgstr "" "еÑть другие пакеты mariadb-server, иÑпользующие Ñтот каталог, то данные " "лучше Ñохранить." -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "Start the MariaDB server on boot?" -msgstr "ЗапуÑкать MariaDB при загрузке ÑиÑтемы?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "" -"The MariaDB server can be launched automatically at boot time or manually " -"with the '/etc/init.d/mysql start' command." -msgstr "" -"Сервер MariaDB можно запуÑкать автоматичеÑки при загрузке ÑиÑтемы или " -"вручную по команде '/etc/init.d/mysql start'." - #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "New password for the MariaDB \"root\" user:" msgstr "Ðовый пароль Ð´Ð»Ñ MariaDB Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ \"root\":" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "" "While not mandatory, it is highly recommended that you set a password for " "the MariaDB administrative \"root\" user." @@ -147,25 +129,25 @@ msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "If this field is left blank, the password will not be changed." msgstr "ЕÑли оÑтавить поле пуÑтым, то пароль изменён не будет." #. Type: password #. Description -#: ../mariadb-server-10.2.templates:7001 +#: ../mariadb-server-10.2.templates:6001 msgid "Repeat password for the MariaDB \"root\" user:" msgstr "Повторите ввод Ð¿Ð°Ñ€Ð¾Ð»Ñ Ð´Ð»Ñ MariaDB Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ \"root\":" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "Unable to set password for the MariaDB \"root\" user" msgstr "Ðевозможно задать пароль MariaDB пользователю \"root\"" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "" "An error occurred while setting the password for the MariaDB administrative " "user. This may have happened because the account already has a password, or " @@ -177,13 +159,13 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "You should check the account's password after the package installation." msgstr "Проверьте пароль учётной запиÑи поÑле уÑтановки пакета." #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "" #| "Please read the /usr/share/doc/mariadb-server-10.2/README.Debian file for " @@ -196,13 +178,42 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "Password input error" msgstr "Ошибка ввода паролÑ" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "The two passwords you entered were not the same. Please try again." msgstr "Два введённых Ð¿Ð°Ñ€Ð¾Ð»Ñ Ð½Ðµ одинаковы. Повторите ввод." +#~ msgid "Really proceed with downgrade?" +#~ msgstr "ДейÑтвительно уÑтановить более Ñтарую верÑию?" + +#~ msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +#~ msgstr "Ð’ ÑиÑтеме найден файл /var/lib/mysql/debian-*.flag." + +#~ msgid "" +#~ "Such a file is an indication that a mariadb-server package with a higher " +#~ "version has been installed previously." +#~ msgstr "" +#~ "Это означает, что ранее уже был уÑтановлен пакет mariadb-server более " +#~ "новой верÑии." + +#~ msgid "" +#~ "There is no guarantee that the version you're currently installing will " +#~ "be able to use the current databases." +#~ msgstr "" +#~ "Ðет гарантий, что верÑиÑ, ÐºÐ¾Ñ‚Ð¾Ñ€Ð°Ñ ÑƒÑтанавливаетÑÑ ÑейчаÑ, будет ÑпоÑобна " +#~ "работать Ñ Ð¸Ð¼ÐµÑŽÑ‰Ð¸Ð¼Ð¸ÑÑ Ð±Ð°Ð·Ð°Ð¼Ð¸ данных." + +#~ msgid "Start the MariaDB server on boot?" +#~ msgstr "ЗапуÑкать MariaDB при загрузке ÑиÑтемы?" + +#~ msgid "" +#~ "The MariaDB server can be launched automatically at boot time or manually " +#~ "with the '/etc/init.d/mysql start' command." +#~ msgstr "" +#~ "Сервер MariaDB можно запуÑкать автоматичеÑки при загрузке ÑиÑтемы или " +#~ "вручную по команде '/etc/init.d/mysql start'." diff --git a/debian/po/sv.po b/debian/po/sv.po index 522403a049e..b7aff17f1a6 100644 --- a/debian/po/sv.po +++ b/debian/po/sv.po @@ -1,14 +1,14 @@ # Translation of mysql-dfsg-5.1 debconf template to Swedish # Copyright (C) 2009 Martin Bagge # This file is distributed under the same license as the mysql-dfsg-5.1 package. -# +# # Andreas Henriksson , 2007 # Martin Bagge , 2009 msgid "" msgstr "" "Project-Id-Version: mysql-dfsg-5.1 5.0.21-3\n" "Report-Msgid-Bugs-To: mariadb-10.2@packages.debian.org\n" -"POT-Creation-Date: 2012-01-12 13:08+0100\n" +"POT-Creation-Date: 2016-10-08 01:26+0300\n" "PO-Revision-Date: 2009-09-08 21:42+0100\n" "Last-Translator: Martin Bagge \n" "Language-Team: Swedish \n" @@ -19,37 +19,35 @@ msgstr "" "X-Poedit-Language: Swedish\n" "X-Poedit-Country: Sweden\n" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 -msgid "Really proceed with downgrade?" -msgstr "Vill du verkligen genomföra nedgraderingen?" +msgid "The old data directory will be saved at new location" +msgstr "" -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." -msgstr "En fil med namnet /var/lib/mysql/debian-*.flag hittades i systemet." - -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"Such a file is an indication that a mariadb-server package with a higher " -"version has been installed previously." +"A file named /var/lib/mysql/debian-*.flag exists on this system. The number " +"indicates a database binary format version that cannot automatically be " +"upgraded (or downgraded)." msgstr "" -"En sÃ¥dan fil är en indikation pÃ¥ att paketet mariadb-server med ett högre " -"versionsnummer har installerats tidigare." -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"There is no guarantee that the version you're currently installing will be " -"able to use the current databases." +"Therefore the previous data directory will be renamed to /var/lib/mysql-* " +"and a new data directory will be initialized at /var/lib/mysql." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Please manually export/import your data (e.g. with mysqldump) if needed." msgstr "" -"Det finns ingen garanti för att den version som du hÃ¥ller pÃ¥ att installera " -"kommer att kunna använda de aktuella databaserna." #. Type: note #. Description @@ -105,31 +103,15 @@ msgstr "" "en nyare version eller om en annan mariadb-server redan använder filerna ska " "de inte raderas." -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "Start the MariaDB server on boot?" -msgstr "Ska MariaDB startas vid systemets uppstart?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "" -"The MariaDB server can be launched automatically at boot time or manually " -"with the '/etc/init.d/mysql start' command." -msgstr "" -"MariaDB-servern kan startas vid systemets uppstart eller manuellt med " -"kommandot \"/etc/init.d/mysql start\"." - #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "New password for the MariaDB \"root\" user:" msgstr "Nytt lösenord för MariaDBs \"root\"-användare:" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "" "While not mandatory, it is highly recommended that you set a password for " "the MariaDB administrative \"root\" user." @@ -139,25 +121,25 @@ msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "If this field is left blank, the password will not be changed." msgstr "Om detta fält lämnas tom kommer lösenordet inte att ändras." #. Type: password #. Description -#: ../mariadb-server-10.2.templates:7001 +#: ../mariadb-server-10.2.templates:6001 msgid "Repeat password for the MariaDB \"root\" user:" msgstr "Repetera lösenordet för MariaDBs \"root\"-användare:" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "Unable to set password for the MariaDB \"root\" user" msgstr "Kunde inte sätta lösenord för MariaDBs \"root\"-användare" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "" "An error occurred while setting the password for the MariaDB administrative " "user. This may have happened because the account already has a password, or " @@ -170,13 +152,13 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "You should check the account's password after the package installation." msgstr "Du bör kontrollera kontots lösenord efter installationen av paketet." #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 #, fuzzy #| msgid "" #| "Please read the /usr/share/doc/mariadb-server-10.2/README.Debian file for " @@ -190,16 +172,46 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "Password input error" msgstr "Fel vid inmatning av lösenord" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "The two passwords you entered were not the same. Please try again." msgstr "De tvÃ¥ lösenorden du angav stämde inte överrens. Prova igen." +#~ msgid "Really proceed with downgrade?" +#~ msgstr "Vill du verkligen genomföra nedgraderingen?" + +#~ msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +#~ msgstr "En fil med namnet /var/lib/mysql/debian-*.flag hittades i systemet." + +#~ msgid "" +#~ "Such a file is an indication that a mariadb-server package with a higher " +#~ "version has been installed previously." +#~ msgstr "" +#~ "En sÃ¥dan fil är en indikation pÃ¥ att paketet mariadb-server med ett högre " +#~ "versionsnummer har installerats tidigare." + +#~ msgid "" +#~ "There is no guarantee that the version you're currently installing will " +#~ "be able to use the current databases." +#~ msgstr "" +#~ "Det finns ingen garanti för att den version som du hÃ¥ller pÃ¥ att " +#~ "installera kommer att kunna använda de aktuella databaserna." + +#~ msgid "Start the MariaDB server on boot?" +#~ msgstr "Ska MariaDB startas vid systemets uppstart?" + +#~ msgid "" +#~ "The MariaDB server can be launched automatically at boot time or manually " +#~ "with the '/etc/init.d/mysql start' command." +#~ msgstr "" +#~ "MariaDB-servern kan startas vid systemets uppstart eller manuellt med " +#~ "kommandot \"/etc/init.d/mysql start\"." + #~ msgid "" #~ "To use MySQL, the following entries for users and groups should be added " #~ "to the system:" diff --git a/debian/po/templates.pot b/debian/po/templates.pot index 7032c34bc20..258dcde2c81 100644 --- a/debian/po/templates.pot +++ b/debian/po/templates.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" +"Project-Id-Version: mariadb-10.2\n" "Report-Msgid-Bugs-To: mariadb-10.2@packages.debian.org\n" -"POT-Creation-Date: 2012-01-12 13:08+0100\n" +"POT-Creation-Date: 2016-10-08 01:26+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,32 +17,34 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 -msgid "Really proceed with downgrade?" +msgid "The old data directory will be saved at new location" msgstr "" -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." -msgstr "" - -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"Such a file is an indication that a mariadb-server package with a higher " -"version has been installed previously." +"A file named /var/lib/mysql/debian-*.flag exists on this system. The number " +"indicates a database binary format version that cannot automatically be " +"upgraded (or downgraded)." msgstr "" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"There is no guarantee that the version you're currently installing will be " -"able to use the current databases." +"Therefore the previous data directory will be renamed to /var/lib/mysql-* " +"and a new data directory will be initialized at /var/lib/mysql." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Please manually export/import your data (e.g. with mysqldump) if needed." msgstr "" #. Type: note @@ -90,29 +92,15 @@ msgid "" "the data should be kept." msgstr "" -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "Start the MariaDB server on boot?" -msgstr "" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -msgid "" -"The MariaDB server can be launched automatically at boot time or manually " -"with the '/etc/init.d/mysql start' command." -msgstr "" - #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "New password for the MariaDB \"root\" user:" msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "" "While not mandatory, it is highly recommended that you set a password for " "the MariaDB administrative \"root\" user." @@ -120,25 +108,25 @@ msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "If this field is left blank, the password will not be changed." msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:7001 +#: ../mariadb-server-10.2.templates:6001 msgid "Repeat password for the MariaDB \"root\" user:" msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "Unable to set password for the MariaDB \"root\" user" msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "" "An error occurred while setting the password for the MariaDB administrative " "user. This may have happened because the account already has a password, or " @@ -147,13 +135,13 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "You should check the account's password after the package installation." msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "" "Please read the /usr/share/doc/mariadb-server-10.2/README.Debian file for " "more information." @@ -161,12 +149,12 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "Password input error" msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "The two passwords you entered were not the same. Please try again." msgstr "" diff --git a/debian/po/tr.po b/debian/po/tr.po index 81c20ba3b3e..079a7198d8b 100644 --- a/debian/po/tr.po +++ b/debian/po/tr.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: mysql-dfsg-4.1\n" "Report-Msgid-Bugs-To: mariadb-10.2@packages.debian.org\n" -"POT-Creation-Date: 2012-01-12 13:08+0100\n" +"POT-Creation-Date: 2016-10-08 01:26+0300\n" "PO-Revision-Date: 2004-06-05 08:53+0300\n" "Last-Translator: Gürkan Aslan \n" "Language-Team: Turkish \n" @@ -16,32 +16,34 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 -msgid "Really proceed with downgrade?" +msgid "The old data directory will be saved at new location" msgstr "" -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:2001 -msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." -msgstr "" - -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"Such a file is an indication that a mariadb-server package with a higher " -"version has been installed previously." +"A file named /var/lib/mysql/debian-*.flag exists on this system. The number " +"indicates a database binary format version that cannot automatically be " +"upgraded (or downgraded)." msgstr "" -#. Type: boolean +#. Type: note #. Description #: ../mariadb-server-10.2.templates:2001 msgid "" -"There is no guarantee that the version you're currently installing will be " -"able to use the current databases." +"Therefore the previous data directory will be renamed to /var/lib/mysql-* " +"and a new data directory will be initialized at /var/lib/mysql." +msgstr "" + +#. Type: note +#. Description +#: ../mariadb-server-10.2.templates:2001 +msgid "" +"Please manually export/import your data (e.g. with mysqldump) if needed." msgstr "" #. Type: note @@ -91,35 +93,15 @@ msgid "" "the data should be kept." msgstr "" -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -#, fuzzy -#| msgid "Should MySQL start on boot?" -msgid "Start the MariaDB server on boot?" -msgstr "MariaDB açılış sırasında baÅŸlatılsın mı?" - -#. Type: boolean -#. Description -#: ../mariadb-server-10.2.templates:5001 -#, fuzzy -msgid "" -"The MariaDB server can be launched automatically at boot time or manually " -"with the '/etc/init.d/mysql start' command." -msgstr "" -"MariaDB açılış sırasında veya '/etc/init.d/mysql start' komutunu vermeniz " -"halinde elle baÅŸlatılabilir. EÄŸer açılışta otomatik olarak baÅŸlatılmasını " -"istiyorsanız burada 'evet'i seçin." - #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "New password for the MariaDB \"root\" user:" msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "" "While not mandatory, it is highly recommended that you set a password for " "the MariaDB administrative \"root\" user." @@ -127,25 +109,25 @@ msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:6001 +#: ../mariadb-server-10.2.templates:5001 msgid "If this field is left blank, the password will not be changed." msgstr "" #. Type: password #. Description -#: ../mariadb-server-10.2.templates:7001 +#: ../mariadb-server-10.2.templates:6001 msgid "Repeat password for the MariaDB \"root\" user:" msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "Unable to set password for the MariaDB \"root\" user" msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "" "An error occurred while setting the password for the MariaDB administrative " "user. This may have happened because the account already has a password, or " @@ -154,13 +136,13 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "You should check the account's password after the package installation." msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:8001 +#: ../mariadb-server-10.2.templates:7001 msgid "" "Please read the /usr/share/doc/mariadb-server-10.2/README.Debian file for " "more information." @@ -168,16 +150,30 @@ msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "Password input error" msgstr "" #. Type: error #. Description -#: ../mariadb-server-10.2.templates:9001 +#: ../mariadb-server-10.2.templates:8001 msgid "The two passwords you entered were not the same. Please try again." msgstr "" +#, fuzzy +#~| msgid "Should MySQL start on boot?" +#~ msgid "Start the MariaDB server on boot?" +#~ msgstr "MariaDB açılış sırasında baÅŸlatılsın mı?" + +#, fuzzy +#~ msgid "" +#~ "The MariaDB server can be launched automatically at boot time or manually " +#~ "with the '/etc/init.d/mysql start' command." +#~ msgstr "" +#~ "MariaDB açılış sırasında veya '/etc/init.d/mysql start' komutunu vermeniz " +#~ "halinde elle baÅŸlatılabilir. EÄŸer açılışta otomatik olarak baÅŸlatılmasını " +#~ "istiyorsanız burada 'evet'i seçin." + #~ msgid "" #~ "To use mysql you must install an equivalent user and group to the " #~ "following and ensure yourself that /var/lib/mysql has the right " diff --git a/debian/rules b/debian/rules index 2591e0070a4..707857a0bac 100755 --- a/debian/rules +++ b/debian/rules @@ -1,182 +1,149 @@ #!/usr/bin/make -f export DH_VERBOSE=1 -export DEB_BUILD_HARDENING=1 -PACKAGE=mariadb-10.2 +# enable Debian Hardening +# see: https://wiki.debian.org/Hardening +export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-pie +DPKG_EXPORT_BUILDFLAGS = 1 +include /usr/share/dpkg/buildflags.mk -include /usr/share/dpatch/dpatch.make - -TMP=$(CURDIR)/debian/tmp/ - -ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH) -ARCH_OS = $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS) -DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH) +ARCH_OS := $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS) +BUILDDIR := builddir DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -DEBVERSION = $(shell dpkg-parsechangelog | awk '/^Version: / { print $$2 }' | sed 's/^.*-//' ) - +DEB_BUILD_GNU_SYSTEM ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_SYSTEM) +DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH) +DEBVERSION := $(shell dpkg-parsechangelog | awk '/^Version: / { print $$2 }' | sed 's/^.*-//' ) DEB_SOURCE_PACKAGE ?= $(strip $(shell egrep '^Source: ' debian/control | cut -f 2 -d ':')) DEB_VERSION ?= $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ') DEB_NOEPOCH_VERSION ?= $(shell echo $(DEB_VERSION) | cut -d: -f2-) DEB_UPSTREAM_VERSION ?= $(shell echo $(DEB_NOEPOCH_VERSION) | sed 's/-[^-]*$$//') DEB_UPSTREAM_VERSION_MAJOR_MINOR := $(shell echo $(DEB_UPSTREAM_VERSION) | sed -r -n 's/^([0-9]+\.[0-9]+).*/\1/p') +DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) +DISTRIBUTION := $(shell lsb_release -i -s) +RELEASE := $(shell lsb_release -r -s) +TMP:=$(CURDIR)/debian/tmp -DISTRIBUTION = $(shell lsb_release -i -s) -RELEASE = $(shell lsb_release -r -s) - -MAKE_J = -j$(shell if [ -f /proc/cpuinfo ] ; then grep -c processor.* /proc/cpuinfo ; else echo 1 ; fi) -ifeq (${MAKE_J}, -j0) - MAKE_J = -j1 -endif +CC := $(DEB_HOST_GNU_TYPE)-gcc +CXX := $(DEB_HOST_GNU_TYPE)-g++ # Parallel build support as advised # at https://www.debian.org/doc/debian-policy/ch-source.html#s-debianrules-options ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) MAKEFLAGS += -j $(NUMJOBS) +else + # NUMJOBS cannot be empty as it is used as a parameter to mtr, default to 1. + NUMJOBS = 1 endif - -USE_ASSEMBLER=--enable-assembler - -BUILDDIR = builddir -builddir = $(BUILDDIR) - -# This causes seg11 crashes if LDAP is used for groups in /etc/nsswitch.conf -# so it is disabled by default although, according to MySQL, it brings >10% -# performance gain if enabled. See #299382. -ifeq ($(STATIC_MYSQLD), 1) - USE_STATIC_MYSQLD=--with-mysqld-ldflags=-all-static +# Ignore test suite exit code on unstable platforms +ifneq (,$(filter $(ARCH), mips mipsel)) + TESTSUITE_FAIL_CMD:=true +else + TESTSUITE_FAIL_CMD:=exit 1 endif -configure: patch configure-stamp -configure-stamp: +# Skip TokuDB if arch is not amd64 +ifneq ($(ARCH), amd64) + CMAKEFLAGS += -DWITHOUT_TOKUDB=true +endif + +# Add support for verbose builds +MAKEFLAGS += VERBOSE=1 + +override_dh_auto_clean: + @echo "RULES.$@" + dh_testdir + dh_testroot + [ ! -d mysql-test/var ] || rm -rf mysql-test/var + rm -rf $(BUILDDIR) + debconf-updatepo # Update po-files when clean runs before each build + +override_dh_prep: + # Don't clean /tmp/ away, it is needed by all binary packages + +override_dh_auto_configure: @echo "RULES.$@" dh_testdir -ifneq ($(ARCH_OS),hurd) - if [ ! -d /proc/self ]; then echo "/proc IS NEEDED" 1>&2; exit 1; fi + # Versioned symbols are only available on Linux. + # Remove symbols file on kFreeBSD builds so that + # dpkg-gensymbols will not fail the build. +ifneq (,$(filter $(ARCH), kfreebsd-i386 kfreebsd-amd64)) + rm debian/libmariadb3.symbols endif - ( test -d $(builddir) || mkdir $(builddir) ) && cd $(builddir) && \ - sh -c 'PATH=$${MYSQL_BUILD_PATH:-"/usr/local/bin:/usr/bin:/bin"} \ - CC=$${MYSQL_BUILD_CC:-gcc} \ - CFLAGS=$${MYSQL_BUILD_CFLAGS:-"-O2 -fno-omit-frame-pointer -g -pipe -Wall -Wno-uninitialized"} \ - CXX=$${MYSQL_BUILD_CXX:-g++} \ - CXXFLAGS=$${MYSQL_BUILD_CXXFLAGS:-"-O2 -fno-omit-frame-pointer -g -pipe -Wall -Wno-uninitialized"} \ - cmake .. \ - -DMYSQL_SERVER_SUFFIX="-$(DEBVERSION)" \ - -DBUILD_CONFIG=mysql_release \ - -DCOMPILATION_COMMENT="mariadb.org binary distribution" \ - -DSYSTEM_TYPE="debian-linux-gnu" \ - -DDEB=ubuntu' - + mkdir -p $(BUILDDIR) && cd $(BUILDDIR) && \ + sh -c 'PATH=$${MYSQL_BUILD_PATH:-"/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin"} \ + CC=${CC} \ + CXX=${CXX} \ + cmake -DCMAKE_INSTALL_PREFIX=/usr \ + $(CMAKEFLAGS) \ + -DCOMPILATION_COMMENT="mariadb.org binary distribution" \ + -DMYSQL_SERVER_SUFFIX="-$(DEBVERSION)" \ + -DSYSTEM_TYPE="debian-$(DEB_BUILD_GNU_SYSTEM)" \ + -DCMAKE_SYSTEM_PROCESSOR=$(DEB_BUILD_ARCH) \ + -DBUILD_CONFIG=mysql_release \ + -DINSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) \ + -DINSTALL_PLUGINDIR=lib/mysql/plugin \ + -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test \ + -DDEB=$(DISTRIBUTION) ..' touch $@ -build: build-stamp +# This is needed, otherwise 'make test' will run before binaries have been built +override_dh_auto_build: + @echo "RULES.$@" + # Print build env info to help debug builds on different platforms + dpkg-architecture + cd $(BUILDDIR) && $(MAKE) + touch $@ -build-stamp: configure +override_dh_auto_test: @echo "RULES.$@" dh_testdir - - cd $(builddir) && $(MAKE) $(MAKE_J) $(AM_EXTRA_MAKEFLAGS) - -ifeq ($(findstring nocheck,$(DEB_BUILD_OPTIONS)),) - if [ ! -f testsuite-stamp ] ; then \ - cd $(builddir)/mysql-test && ./mtr --force --parallel=$(NUMJOBS) --skip-rpl --suite=main; \ - fi + # Skip unstable tests if such are defined for arch + [ ! -f debian/unstable-tests.$(ARCH) ] || cat debian/unstable-tests.$(ARCH) >> mysql-test/unstable-tests + # Run testsuite +ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) + cd $(BUILDDIR)/mysql-test && ./mtr --force --mem --parallel=$(NUMJOBS) --skip-rpl --suite=main --skip-test-list=unstable-tests || $(TESTSUITE_FAIL_CMD) ; endif - touch testsuite-stamp - - touch build-stamp - -clean: clean-patched unpatch - rm -rf debian/patched -clean-patched: - @echo "RULES.clean-patched" - dh_testdir - dh_testroot - rm -f configure-stamp* - rm -f build-stamp* - rm -f testsuite-stamp - # - [ ! -f Makefile ] || $(MAKE) clean - [ ! -d mysql-test/var ] || rm -rf mysql-test/var - # - rm -rf $(BUILDDIR) - - debconf-updatepo - dh_clean -v - - -install: build +override_dh_auto_install: @echo "RULES.$@" dh_testdir dh_testroot - dh_clean -k - dh_installdirs - # some self written manpages which hopefully - # gets overwritten sooner or later with upstreams - mkdir -p $(TMP)/usr/share/man/man1/ - mkdir -p $(TMP)/usr/share/man/man8/ - cp debian/additions/*.1 $(TMP)/usr/share/man/man1/ - mkdir -p $(TMP)/etc/mysql/conf.d/ - cp debian/additions/mysqld_safe_syslog.cnf $(TMP)/etc/mysql/conf.d/ + # If TokuDB plugin was not built skip the package + [ -f $(BUILDDIR)/storage/tokudb/ha_tokudb.so ] || sed -i -e "/Package: mariadb-plugin-tokudb/,+14d" debian/control - # make install (trailing slash needed for innobase) - cd $(builddir) && $(MAKE) install DESTDIR=$(TMP)/ - # - # After installing, remove rpath to make lintian happy. - set +e; \ - find ./debian/tmp/ -type f -print0 \ - | xargs -0 --no-run-if-empty chrpath -k 2>/dev/null \ - | fgrep RPATH= \ - | cut -d: -f 1 \ - | xargs --no-run-if-empty chrpath -d; \ - set -e + # If Mroonga plugin was not built skip the package + [ -f $(BUILDDIR)/storage/mroonga/ha_mroonga.so ] || sed -i -e "/Package: mariadb-plugin-mroonga/,+13d" debian/control - # libmysqlclient-dev: forgotten header file since 3.23.25? - cp $(BUILDDIR)/include/my_config.h $(TMP)/usr/include/mysql/ - cp include/my_dir.h $(TMP)/usr/include/mysql/ + # If libthrift-dev was available (manually installed, as it is + # not in Debian) and ha_cassandra.so was thus built, create package, + # otherwise skip it. + [ -f $(BUILDDIR)/storage/cassandra/ha_cassandra.so ] || sed -i -e "/Package: mariadb-plugin-cassandra/,+16d" debian/control - # mysql-common: We provide our own version of this package for - # completeness, but we can use an existing version; mariadb-specic - # stuff is in mariadb-common - install -d $(TMP)/etc/mysql - install -m 0644 debian/additions/my.cnf $(TMP)/etc/mysql/my.cnf + # If Spider plugin was not built skip the package + [ -f $(BUILDDIR)/storage/spider/ha_spider.so ] || sed -i -e "/Package: mariadb-plugin-spider/,+14d" debian/control - # mariadb-common: MariaDB-specific config stuff. - install -d $(TMP)/etc/mysql/conf.d - install -m 0644 debian/additions/mariadb.cnf $(TMP)/etc/mysql/conf.d/mariadb.cnf + # Copy systemd files to a location available for dh_installinit + cp $(BUILDDIR)/support-files/mariadb.service debian/mariadb-server-10.2.mariadb.service + cp $(BUILDDIR)/support-files/mariadb@.service debian/mariadb-server-10.2.mariadb@.service - # mariadb-client - install -m 0755 debian/additions/mysqlreport $(TMP)/usr/bin/ - install -m 0755 debian/additions/innotop/innotop $(TMP)/usr/bin/ - install -m 0644 debian/additions/innotop/innotop.1 $(TMP)/usr/share/man/man1/ + # make install + cd $(BUILDDIR) && $(MAKE) install DESTDIR=$(TMP) - # mariadb-server - install -m 0755 $(BUILDDIR)/scripts/mysqld_safe $(TMP)/usr/bin/mysqld_safe - mkdir -p $(TMP)/usr/share/doc/mariadb-server-10.2/examples - # We have a sane my.cnf, cruft not needed (remove my-*.cnf and config-*.cnf) - # $(TMP)/usr/share/mysql/*cnf $(TMP)/usr/share/doc/mariadb-server-10.2/examples/ - rm -vf $(TMP)/usr/share/mysql/my-*.cnf \ - $(TMP)/usr/share/mysql/config-*.cnf \ - $(TMP)/usr/share/mysql/mi_test_all* \ - $(TMP)/usr/share/mysql/mysql-log-rotate \ - $(TMP)/usr/share/mysql/mysql.server \ - $(TMP)/usr/share/mysql/binary-configure - nm -n $(BUILDDIR)/sql/mysqld |gzip -9 > $(TMP)/usr/share/doc/mariadb-server-10.2/mysqld.sym.gz - install -m 0755 debian/additions/echo_stderr $(TMP)/usr/share/mysql/ - install -m 0755 debian/additions/debian-start $(TMP)/etc/mysql/ - install -m 0755 debian/additions/debian-start.inc.sh $(TMP)/usr/share/mysql/ + # Delete runnable files we don't want to have in the test data package. + # This avoids triggering multiple Lintian errors. + rm -rf $(TMP)/usr/share/mysql/mysql-test/plugin/tokudb/tokudb/*.py + rm -rf $(TMP)/usr/share/mysql/mysql-test/plugin/tokudb/tokudb/t/*.py - install -m 0644 $(builddir)/Docs/INFO_SRC $(TMP)/usr/share/doc/mariadb-server-10.2/INFO_SRC - install -m 0644 $(builddir)/Docs/INFO_BIN $(TMP)/usr/share/doc/mariadb-server-10.2/INFO_BIN - - # mariadb-test - mv $(TMP)/usr/mysql-test $(TMP)/usr/share/mysql + # nm numeric soft is not enough, therefore extra sort in command + # to satisfy Debian reproducible build requirements + nm --defined-only $(BUILDDIR)/sql/mysqld | LC_ALL=C sort | gzip -n -9 > $(TMP)/usr/share/doc/mariadb-server-10.2/mysqld.sym.gz # For 5.0 -> 10.2 transition d=$(TMP)/usr/share/mysql-common/internal-use-only/; \ @@ -185,98 +152,41 @@ install: build cp debian/mariadb-server-10.2.mysql-server.logrotate $$d/_etc_logrotate.d_mysql-server; \ cp debian/additions/debian-start $$d/_etc_mysql_debian-start; - # install AppArmor profile + # rename and install AppArmor profile install -D -m 644 debian/apparmor-profile $(TMP)/etc/apparmor.d/usr.sbin.mysqld # install Apport hook install -D -m 644 debian/mariadb-server-10.2.py $(TMP)/usr/share/apport/package-hooks/source_mariadb-10.2.py - autorm=debian/autorm-file; \ - rm -f $$autorm; \ - ignore=''; \ - for p in $$MARIADB_OPTIONAL_DEBS; do \ - p=mariadb-$$p; \ - dh_movefiles --package=$$p || echo "../$$p*.deb" >> $$autorm; \ - ignore="$$ignore --no-package=$$p"; \ - done; \ - sh -c "dh_movefiles $$ignore" + # Install libmariadbclient18 compatibility links + ln -s $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadbclient.so.18 -# Build architecture-independent files here. -binary-indep: build install - @echo "RULES.binary-indep" - dh_testdir -i - dh_testroot -i - dh_installdebconf -i - dh_installdocs -i - dh_installexamples -i - dh_installmenu -i - dh_installlogrotate -i - dh_installinit -i - dh_installcron -i - dh_installman -i - dh_installinfo -i - dh_installlogcheck -i - dh_installchangelogs -i - dh_link -i - dh_compress -i - dh_fixperms -i - dh_installdeb -i - dh_perl -i - dh_gencontrol -i - dh_md5sums -i - dh_builddeb -i + # Install libmysqlclientclientXX compatibility links + ln -s $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmysqlclient.so.18 + ln -s $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmysqlclient.so.19 + ln -s $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmysqlclient.so.20 -# Build architecture-dependent files here. -binary-arch: build install - @echo "RULES.binary-arch" - dh_testdir - dh_testroot + touch $@ - dh_installdebconf -a - dh_installdocs -a - dh_installexamples -a - dh_installmenu -a - dh_installlogrotate -a --name mysql-server - if [ -x /usr/bin/dh_systemd_enable -a -f debian/mariadb-server-10.2/lib/systemd/system/mariadb.service ]; then dh_systemd_enable -pmariadb-server-10.2 mariadb.service; fi - if [ -x /usr/bin/dh_systemd_enable -a -f debian/mariadb-server-10.2/lib/systemd/system/mariadb@.service ]; then dh_systemd_enable --no-enable -pmariadb-server-10.2 mariadb@.service; fi - # Start mysql in runlevel 19 before 20 where apache, proftpd etc gets - # started which might depend on a running database server. - dh_installinit -a --name=mysql -- defaults 19 21 - if [ -x /usr/bin/dh_systemd_start -a -f debian/mariadb-server-10.2/lib/systemd/system/mariadb.service ]; then dh_systemd_start -pmariadb-server-10.2 --restart-after-upgrade mariadb.service; fi - dh_installcron -a --name mysql-server - dh_installman -a - dh_installinfo -a - dh_installlogcheck -a - dh_installchangelogs -a - dh_strip -a - dh_link -a # .so muss nach .so.1.2.3 installier werden! - dh_compress -a --exclude=INFO_BIN - dh_fixperms -a - dh_makeshlibs -a - dh_makeshlibs -plibmariadbclient18 -V'libmariadbclient18 (>= 5.5.1-1)' - dh_installdeb -a - dh_perl -a - dh_shlibdeps -a -l debian/libmariadbclient18/usr/lib -L libmariadbclient18 - dh_gencontrol -a - dh_md5sums -a - dh_builddeb -a +override_dh_installlogrotate-arch: + dh_installlogrotate --name mysql-server -source diff: - @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false +override_dh_systemd_enable: + dh_systemd_enable --name=mariadb + dh_systemd_enable --no-enable --name=mariadb@ -binary: binary-indep binary-arch +# Start mysql at sequence number 19 before 20 where apache, proftpd etc gets +# started which might depend on a running database server. +override_dh_installinit-arch: + dh_installinit --name=mysql -- defaults 19 21 + dh_systemd_start --restart-after-upgrade + +override_dh_installcron-arch: + dh_installcron --name mysql-server get-orig-source: - @wget -nv -T10 -t3 \ - -O /tmp/mysql-$(DEB_UPSTREAM_VERSION).tar.gz \ - http://ftp.gwdg.de/pub/misc/mysql/Downloads/MySQL-$(DEB_UPSTREAM_VERSION_MAJOR_MINOR)/mysql-$(DEB_UPSTREAM_VERSION).tar.gz - @tar xfz /tmp/mysql-$(DEB_UPSTREAM_VERSION).tar.gz -C /tmp - @rm -rf /tmp/mysql-$(DEB_UPSTREAM_VERSION)/Docs - @rm -rf /tmp/mysql-$(DEB_UPSTREAM_VERSION)/debian - @mv /tmp/mysql-$(DEB_UPSTREAM_VERSION) /tmp/$(DEB_SOURCE_PACKAGE)-$(DEB_UPSTREAM_VERSION).orig - @cd /tmp ; tar czf $(DEB_SOURCE_PACKAGE)_$(DEB_UPSTREAM_VERSION).orig.tar.gz $(DEB_SOURCE_PACKAGE)-$(DEB_UPSTREAM_VERSION).orig - @rm -f /tmp/mysql-$(DEB_UPSTREAM_VERSION).tar.gz - @rm -rf /tmp/$(DEB_SOURCE_PACKAGE)-$(DEB_UPSTREAM_VERSION).orig + uscan --force-download --verbose -.PHONY: clean clean-patched configure build binary binary-indep binary-arch install patch unpatch +%: + dh $@ --parallel --with dpatch --with systemd # vim: ts=8 diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 00000000000..89ae9db8f88 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/extra/comp_err.c b/extra/comp_err.c index a5530305317..cf6262f66e2 100644 --- a/extra/comp_err.c +++ b/extra/comp_err.c @@ -172,8 +172,8 @@ int main(int argc, char *argv[]) MY_INIT(argv[0]); { uint max_error, error_count; - struct errors *error_head; - struct languages *lang_head; + struct errors *error_head= NULL; + struct languages *lang_head= NULL; DBUG_ENTER("main"); charsets_dir= DEFAULT_CHARSET_DIR; diff --git a/extra/yassl/README b/extra/yassl/README index b5eb88824fb..a3d4f60f561 100644 --- a/extra/yassl/README +++ b/extra/yassl/README @@ -12,6 +12,24 @@ before calling SSL_new(); *** end Note *** +yaSSL Release notes, version 2.4.2 (9/22/2016) + This release of yaSSL fixes a medium security vulnerability. A fix for + potential AES side channel leaks is included that a local user monitoring + the same CPU core cache could exploit. VM users, hyper-threading users, + and users where potential attackers have access to the CPU cache will need + to update if they utilize AES. + + DSA padding fixes for unusual sizes is included as well. Users with DSA + certficiates should update. + +yaSSL Release notes, version 2.4.0 (5/20/2016) + This release of yaSSL fixes the OpenSSL compatibility function + SSL_CTX_load_verify_locations() when using the path directory to allow + unlimited path sizes. Minor Windows build fixes are included. + No high level security fixes in this version but we always recommend + updating. + + yaSSL Release notes, version 2.3.9b (2/03/2016) This release of yaSSL fixes the OpenSSL compatibility function X509_NAME_get_index_by_NID() to use the actual index of the common name diff --git a/extra/yassl/certs/dsa-cert.pem b/extra/yassl/certs/dsa-cert.pem index 10d533edc88..10794cbee73 100644 --- a/extra/yassl/certs/dsa-cert.pem +++ b/extra/yassl/certs/dsa-cert.pem @@ -1,22 +1,22 @@ -----BEGIN CERTIFICATE----- -MIIDqzCCA2ugAwIBAgIJAMGqrgDU6DyhMAkGByqGSM44BAMwgY4xCzAJBgNVBAYT +MIIDrzCCA2+gAwIBAgIJAK1zRM7YFcNjMAkGByqGSM44BAMwgZAxCzAJBgNVBAYT AlVTMQ8wDQYDVQQIDAZPcmVnb24xETAPBgNVBAcMCFBvcnRsYW5kMRAwDgYDVQQK -DAd3b2xmU1NMMRAwDgYDVQQLDAd0ZXN0aW5nMRYwFAYDVQQDDA13d3cueWFzc2wu -Y29tMR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29tMB4XDTEzMDQyMjIw -MDk0NFoXDTE2MDExNzIwMDk0NFowgY4xCzAJBgNVBAYTAlVTMQ8wDQYDVQQIDAZP -cmVnb24xETAPBgNVBAcMCFBvcnRsYW5kMRAwDgYDVQQKDAd3b2xmU1NMMRAwDgYD -VQQLDAd0ZXN0aW5nMRYwFAYDVQQDDA13d3cueWFzc2wuY29tMR8wHQYJKoZIhvcN -AQkBFhBpbmZvQHdvbGZzc2wuY29tMIIBuDCCASwGByqGSM44BAEwggEfAoGBAL1R -7koy4IrH6sbh6nDEUUPPKgfhxxLCWCVexF2+qzANEr+hC9M002haJXFOfeS9DyoO -WFbL0qMZOuqv+22CaHnoUWl7q3PjJOAI3JH0P54ZyUPuU1909RzgTdIDp5+ikbr7 -KYjnltL73FQVMbjTZQKthIpPn3MjYcF+4jp2W2zFAhUAkcntYND6MGf+eYzIJDN2 -L7SonHUCgYEAklpxErfqznIZjVvqqHFaq+mgAL5J8QrKVmdhYZh/Y8z4jCjoCA8o -TDoFKxf7s2ZzgaPKvglaEKiYqLqic9qY78DYJswzQMLFvjsF4sFZ+pYCBdWPQI4N -PgxCiznK6Ce+JH9ikSBvMvG+tevjr2UpawDIHX3+AWYaZBZwKADAaboDgYUAAoGB -AJ3LY89yHyvQ/TsQ6zlYbovjbk/ogndsMqPdNUvL4RuPTgJP/caaDDa0XJ7ak6A7 -TJ+QheLNwOXoZPYJC4EGFSDAXpYniGhbWIrVTCGe6lmZDfnx40WXS0kk3m/DHaC0 -3ElLAiybxVGxyqoUfbT3Zv1JwftWMuiqHH5uADhdXuXVo1AwTjAdBgNVHQ4EFgQU -IJjk416o4v8qpH9LBtXlR9v8gccwHwYDVR0jBBgwFoAUIJjk416o4v8qpH9LBtXl -R9v8gccwDAYDVR0TBAUwAwEB/zAJBgcqhkjOOAQDAy8AMCwCFCjGKIdOSV12LcTu -k08owGM6YkO1AhQe+K173VuaO/OsDNsxZlKpyH8+1g== +DAd3b2xmU1NMMRAwDgYDVQQLDAd0ZXN0aW5nMRgwFgYDVQQDDA93d3cud29sZnNz +bC5jb20xHzAdBgkqhkiG9w0BCQEWEGluZm9Ad29sZnNzbC5jb20wHhcNMTYwOTIy +MjEyMzA0WhcNMjIwMzE1MjEyMzA0WjCBkDELMAkGA1UEBhMCVVMxDzANBgNVBAgM +Bk9yZWdvbjERMA8GA1UEBwwIUG9ydGxhbmQxEDAOBgNVBAoMB3dvbGZTU0wxEDAO +BgNVBAsMB3Rlc3RpbmcxGDAWBgNVBAMMD3d3dy53b2xmc3NsLmNvbTEfMB0GCSqG +SIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTCCAbgwggEsBgcqhkjOOAQBMIIBHwKB +gQC9Ue5KMuCKx+rG4epwxFFDzyoH4ccSwlglXsRdvqswDRK/oQvTNNNoWiVxTn3k +vQ8qDlhWy9KjGTrqr/ttgmh56FFpe6tz4yTgCNyR9D+eGclD7lNfdPUc4E3SA6ef +opG6+ymI55bS+9xUFTG402UCrYSKT59zI2HBfuI6dltsxQIVAJHJ7WDQ+jBn/nmM +yCQzdi+0qJx1AoGBAJJacRK36s5yGY1b6qhxWqvpoAC+SfEKylZnYWGYf2PM+Iwo +6AgPKEw6BSsX+7Nmc4Gjyr4JWhComKi6onPamO/A2CbMM0DCxb47BeLBWfqWAgXV +j0CODT4MQos5yugnviR/YpEgbzLxvrXr469lKWsAyB19/gFmGmQWcCgAwGm6A4GF +AAKBgQCdy2PPch8r0P07EOs5WG6L425P6IJ3bDKj3TVLy+Ebj04CT/3Gmgw2tFye +2pOgO0yfkIXizcDl6GT2CQuBBhUgwF6WJ4hoW1iK1UwhnupZmQ358eNFl0tJJN5v +wx2gtNxJSwIsm8VRscqqFH2092b9ScH7VjLoqhx+bgA4XV7l1aNQME4wHQYDVR0O +BBYEFCCY5ONeqOL/KqR/SwbV5Ufb/IHHMB8GA1UdIwQYMBaAFCCY5ONeqOL/KqR/ +SwbV5Ufb/IHHMAwGA1UdEwQFMAMBAf8wCQYHKoZIzjgEAwMvADAsAhQRYSCVN/Ge +agV3mffU3qNZ92fI0QIUPH7Jp+iASI7U1ocaYDc10qXGaGY= -----END CERTIFICATE----- diff --git a/extra/yassl/include/openssl/crypto.h b/extra/yassl/include/openssl/crypto.h index 103fcbb0e30..ac1e7ebc8eb 100644 --- a/extra/yassl/include/openssl/crypto.h +++ b/extra/yassl/include/openssl/crypto.h @@ -19,7 +19,7 @@ /* crypto.h for openSSL */ -#ifndef ysSSL_crypto_h__ +#ifndef yaSSL_crypto_h__ #define yaSSL_crypto_h__ #ifdef YASSL_PREFIX diff --git a/extra/yassl/include/openssl/ssl.h b/extra/yassl/include/openssl/ssl.h index c95eb1ed887..9ec99b46c1f 100644 --- a/extra/yassl/include/openssl/ssl.h +++ b/extra/yassl/include/openssl/ssl.h @@ -34,7 +34,7 @@ #include "rsa.h" -#define YASSL_VERSION "2.3.9b" +#define YASSL_VERSION "2.4.2" #if defined(__cplusplus) diff --git a/extra/yassl/src/ssl.cpp b/extra/yassl/src/ssl.cpp index 2a1f2fbe395..c903516eca1 100644 --- a/extra/yassl/src/ssl.cpp +++ b/extra/yassl/src/ssl.cpp @@ -162,7 +162,7 @@ int read_file(SSL_CTX* ctx, const char* file, int format, CertType type) TaoCrypt::DSA_PrivateKey dsaKey; dsaKey.Initialize(dsaSource); - if (rsaSource.GetError().What()) { + if (dsaSource.GetError().What()) { // neither worked ret = SSL_FAILURE; } @@ -785,40 +785,67 @@ int SSL_CTX_load_verify_locations(SSL_CTX* ctx, const char* file, WIN32_FIND_DATA FindFileData; HANDLE hFind; - char name[MAX_PATH + 1]; // directory specification - strncpy(name, path, MAX_PATH - 3); - strncat(name, "\\*", 3); + const int DELIMITER_SZ = 2; + const int DELIMITER_STAR_SZ = 3; + int pathSz = (int)strlen(path); + int nameSz = pathSz + DELIMITER_STAR_SZ + 1; // plus 1 for terminator + char* name = NEW_YS char[nameSz]; // directory specification + memset(name, 0, nameSz); + strncpy(name, path, nameSz - DELIMITER_STAR_SZ - 1); + strncat(name, "\\*", DELIMITER_STAR_SZ); hFind = FindFirstFile(name, &FindFileData); - if (hFind == INVALID_HANDLE_VALUE) return SSL_BAD_PATH; + if (hFind == INVALID_HANDLE_VALUE) { + ysArrayDelete(name); + return SSL_BAD_PATH; + } do { - if (FindFileData.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY) { - strncpy(name, path, MAX_PATH - 2 - HALF_PATH); - strncat(name, "\\", 2); - strncat(name, FindFileData.cFileName, HALF_PATH); + if (!(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { + int curSz = (int)strlen(FindFileData.cFileName); + if (pathSz + curSz + DELIMITER_SZ + 1 > nameSz) { + ysArrayDelete(name); + // plus 1 for terminator + nameSz = pathSz + curSz + DELIMITER_SZ + 1; + name = NEW_YS char[nameSz]; + } + memset(name, 0, nameSz); + strncpy(name, path, nameSz - curSz - DELIMITER_SZ - 1); + strncat(name, "\\", DELIMITER_SZ); + strncat(name, FindFileData.cFileName, + nameSz - pathSz - DELIMITER_SZ - 1); ret = read_file(ctx, name, SSL_FILETYPE_PEM, CA); } } while (ret == SSL_SUCCESS && FindNextFile(hFind, &FindFileData)); + ysArrayDelete(name); FindClose(hFind); #else // _WIN32 - - const int MAX_PATH = 260; - DIR* dir = opendir(path); if (!dir) return SSL_BAD_PATH; struct dirent* entry; struct stat buf; - char name[MAX_PATH + 1]; + const int DELIMITER_SZ = 1; + int pathSz = (int)strlen(path); + int nameSz = pathSz + DELIMITER_SZ + 1; //plus 1 for null terminator + char* name = NEW_YS char[nameSz]; // directory specification while (ret == SSL_SUCCESS && (entry = readdir(dir))) { - strncpy(name, path, MAX_PATH - 1 - HALF_PATH); - strncat(name, "/", 1); - strncat(name, entry->d_name, HALF_PATH); + int curSz = (int)strlen(entry->d_name); + if (pathSz + curSz + DELIMITER_SZ + 1 > nameSz) { + ysArrayDelete(name); + nameSz = pathSz + DELIMITER_SZ + curSz + 1; + name = NEW_YS char[nameSz]; + } + memset(name, 0, nameSz); + strncpy(name, path, nameSz - curSz - 1); + strncat(name, "/", DELIMITER_SZ); + strncat(name, entry->d_name, nameSz - pathSz - DELIMITER_SZ - 1); + if (stat(name, &buf) < 0) { + ysArrayDelete(name); closedir(dir); return SSL_BAD_STAT; } @@ -827,6 +854,7 @@ int SSL_CTX_load_verify_locations(SSL_CTX* ctx, const char* file, ret = read_file(ctx, name, SSL_FILETYPE_PEM, CA); } + ysArrayDelete(name); closedir(dir); #endif diff --git a/extra/yassl/taocrypt/include/aes.hpp b/extra/yassl/taocrypt/include/aes.hpp index 01763033156..bccf6e73fc7 100644 --- a/extra/yassl/taocrypt/include/aes.hpp +++ b/extra/yassl/taocrypt/include/aes.hpp @@ -60,6 +60,7 @@ private: static const word32 Te[5][256]; static const word32 Td[5][256]; + static const byte CTd4[256]; static const word32* Te0; static const word32* Te1; @@ -80,11 +81,68 @@ private: void ProcessAndXorBlock(const byte*, const byte*, byte*) const; + word32 PreFetchTe() const; + word32 PreFetchTd() const; + word32 PreFetchCTd4() const; + AES(const AES&); // hide copy AES& operator=(const AES&); // and assign }; +#if defined(__x86_64__) || defined(_M_X64) || \ + (defined(__ILP32__) && (__ILP32__ >= 1)) + #define TC_CACHE_LINE_SZ 64 +#else + /* default cache line size */ + #define TC_CACHE_LINE_SZ 32 +#endif + +inline word32 AES::PreFetchTe() const +{ + word32 x = 0; + + /* 4 tables of 256 entries */ + for (int i = 0; i < 4; i++) { + /* each entry is 4 bytes */ + for (int j = 0; j < 256; j += TC_CACHE_LINE_SZ/4) { + x &= Te[i][j]; + } + } + + return x; +} + + +inline word32 AES::PreFetchTd() const +{ + word32 x = 0; + + /* 4 tables of 256 entries */ + for (int i = 0; i < 4; i++) { + /* each entry is 4 bytes */ + for (int j = 0; j < 256; j += TC_CACHE_LINE_SZ/4) { + x &= Td[i][j]; + } + } + + return x; +} + + +inline word32 AES::PreFetchCTd4() const +{ + word32 x = 0; + int i; + + for (i = 0; i < 256; i += TC_CACHE_LINE_SZ) { + x &= CTd4[i]; + } + + return x; +} + + typedef BlockCipher AES_ECB_Encryption; typedef BlockCipher AES_ECB_Decryption; diff --git a/extra/yassl/taocrypt/include/integer.hpp b/extra/yassl/taocrypt/include/integer.hpp index 75a3ee3d3df..05fe189fd58 100644 --- a/extra/yassl/taocrypt/include/integer.hpp +++ b/extra/yassl/taocrypt/include/integer.hpp @@ -119,6 +119,9 @@ namespace TaoCrypt { +#ifdef _WIN32 + #undef max // avoid name clash +#endif // general MAX template inline const T& max(const T& a, const T& b) diff --git a/extra/yassl/taocrypt/src/aes.cpp b/extra/yassl/taocrypt/src/aes.cpp index e47765b87d0..2321c72554c 100644 --- a/extra/yassl/taocrypt/src/aes.cpp +++ b/extra/yassl/taocrypt/src/aes.cpp @@ -109,10 +109,10 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/) { temp = rk[3]; rk[4] = rk[0] ^ - (Te4[GETBYTE(temp, 2)] & 0xff000000) ^ - (Te4[GETBYTE(temp, 1)] & 0x00ff0000) ^ - (Te4[GETBYTE(temp, 0)] & 0x0000ff00) ^ - (Te4[GETBYTE(temp, 3)] & 0x000000ff) ^ + (Te2[GETBYTE(temp, 2)] & 0xff000000) ^ + (Te3[GETBYTE(temp, 1)] & 0x00ff0000) ^ + (Te0[GETBYTE(temp, 0)] & 0x0000ff00) ^ + (Te1[GETBYTE(temp, 3)] & 0x000000ff) ^ rcon_[i]; rk[5] = rk[1] ^ rk[4]; rk[6] = rk[2] ^ rk[5]; @@ -128,10 +128,10 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/) { temp = rk[ 5]; rk[ 6] = rk[ 0] ^ - (Te4[GETBYTE(temp, 2)] & 0xff000000) ^ - (Te4[GETBYTE(temp, 1)] & 0x00ff0000) ^ - (Te4[GETBYTE(temp, 0)] & 0x0000ff00) ^ - (Te4[GETBYTE(temp, 3)] & 0x000000ff) ^ + (Te2[GETBYTE(temp, 2)] & 0xff000000) ^ + (Te3[GETBYTE(temp, 1)] & 0x00ff0000) ^ + (Te0[GETBYTE(temp, 0)] & 0x0000ff00) ^ + (Te1[GETBYTE(temp, 3)] & 0x000000ff) ^ rcon_[i]; rk[ 7] = rk[ 1] ^ rk[ 6]; rk[ 8] = rk[ 2] ^ rk[ 7]; @@ -149,10 +149,10 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/) { temp = rk[ 7]; rk[ 8] = rk[ 0] ^ - (Te4[GETBYTE(temp, 2)] & 0xff000000) ^ - (Te4[GETBYTE(temp, 1)] & 0x00ff0000) ^ - (Te4[GETBYTE(temp, 0)] & 0x0000ff00) ^ - (Te4[GETBYTE(temp, 3)] & 0x000000ff) ^ + (Te2[GETBYTE(temp, 2)] & 0xff000000) ^ + (Te3[GETBYTE(temp, 1)] & 0x00ff0000) ^ + (Te0[GETBYTE(temp, 0)] & 0x0000ff00) ^ + (Te1[GETBYTE(temp, 3)] & 0x000000ff) ^ rcon_[i]; rk[ 9] = rk[ 1] ^ rk[ 8]; rk[10] = rk[ 2] ^ rk[ 9]; @@ -161,10 +161,10 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/) break; temp = rk[11]; rk[12] = rk[ 4] ^ - (Te4[GETBYTE(temp, 3)] & 0xff000000) ^ - (Te4[GETBYTE(temp, 2)] & 0x00ff0000) ^ - (Te4[GETBYTE(temp, 1)] & 0x0000ff00) ^ - (Te4[GETBYTE(temp, 0)] & 0x000000ff); + (Te2[GETBYTE(temp, 3)] & 0xff000000) ^ + (Te3[GETBYTE(temp, 2)] & 0x00ff0000) ^ + (Te0[GETBYTE(temp, 1)] & 0x0000ff00) ^ + (Te1[GETBYTE(temp, 0)] & 0x000000ff); rk[13] = rk[ 5] ^ rk[12]; rk[14] = rk[ 6] ^ rk[13]; rk[15] = rk[ 7] ^ rk[14]; @@ -191,25 +191,25 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/) for (i = 1; i < rounds_; i++) { rk += 4; rk[0] = - Td0[Te4[GETBYTE(rk[0], 3)] & 0xff] ^ - Td1[Te4[GETBYTE(rk[0], 2)] & 0xff] ^ - Td2[Te4[GETBYTE(rk[0], 1)] & 0xff] ^ - Td3[Te4[GETBYTE(rk[0], 0)] & 0xff]; + Td0[Te1[GETBYTE(rk[0], 3)] & 0xff] ^ + Td1[Te1[GETBYTE(rk[0], 2)] & 0xff] ^ + Td2[Te1[GETBYTE(rk[0], 1)] & 0xff] ^ + Td3[Te1[GETBYTE(rk[0], 0)] & 0xff]; rk[1] = - Td0[Te4[GETBYTE(rk[1], 3)] & 0xff] ^ - Td1[Te4[GETBYTE(rk[1], 2)] & 0xff] ^ - Td2[Te4[GETBYTE(rk[1], 1)] & 0xff] ^ - Td3[Te4[GETBYTE(rk[1], 0)] & 0xff]; + Td0[Te1[GETBYTE(rk[1], 3)] & 0xff] ^ + Td1[Te1[GETBYTE(rk[1], 2)] & 0xff] ^ + Td2[Te1[GETBYTE(rk[1], 1)] & 0xff] ^ + Td3[Te1[GETBYTE(rk[1], 0)] & 0xff]; rk[2] = - Td0[Te4[GETBYTE(rk[2], 3)] & 0xff] ^ - Td1[Te4[GETBYTE(rk[2], 2)] & 0xff] ^ - Td2[Te4[GETBYTE(rk[2], 1)] & 0xff] ^ - Td3[Te4[GETBYTE(rk[2], 0)] & 0xff]; + Td0[Te1[GETBYTE(rk[2], 3)] & 0xff] ^ + Td1[Te1[GETBYTE(rk[2], 2)] & 0xff] ^ + Td2[Te1[GETBYTE(rk[2], 1)] & 0xff] ^ + Td3[Te1[GETBYTE(rk[2], 0)] & 0xff]; rk[3] = - Td0[Te4[GETBYTE(rk[3], 3)] & 0xff] ^ - Td1[Te4[GETBYTE(rk[3], 2)] & 0xff] ^ - Td2[Te4[GETBYTE(rk[3], 1)] & 0xff] ^ - Td3[Te4[GETBYTE(rk[3], 0)] & 0xff]; + Td0[Te1[GETBYTE(rk[3], 3)] & 0xff] ^ + Td1[Te1[GETBYTE(rk[3], 2)] & 0xff] ^ + Td2[Te1[GETBYTE(rk[3], 1)] & 0xff] ^ + Td3[Te1[GETBYTE(rk[3], 0)] & 0xff]; } } } @@ -244,6 +244,7 @@ void AES::encrypt(const byte* inBlock, const byte* xorBlock, s2 ^= rk[2]; s3 ^= rk[3]; + s0 |= PreFetchTe(); /* * Nr - 1 full rounds: */ @@ -312,28 +313,28 @@ void AES::encrypt(const byte* inBlock, const byte* xorBlock, */ s0 = - (Te4[GETBYTE(t0, 3)] & 0xff000000) ^ - (Te4[GETBYTE(t1, 2)] & 0x00ff0000) ^ - (Te4[GETBYTE(t2, 1)] & 0x0000ff00) ^ - (Te4[GETBYTE(t3, 0)] & 0x000000ff) ^ + (Te2[GETBYTE(t0, 3)] & 0xff000000) ^ + (Te3[GETBYTE(t1, 2)] & 0x00ff0000) ^ + (Te0[GETBYTE(t2, 1)] & 0x0000ff00) ^ + (Te1[GETBYTE(t3, 0)] & 0x000000ff) ^ rk[0]; s1 = - (Te4[GETBYTE(t1, 3)] & 0xff000000) ^ - (Te4[GETBYTE(t2, 2)] & 0x00ff0000) ^ - (Te4[GETBYTE(t3, 1)] & 0x0000ff00) ^ - (Te4[GETBYTE(t0, 0)] & 0x000000ff) ^ + (Te2[GETBYTE(t1, 3)] & 0xff000000) ^ + (Te3[GETBYTE(t2, 2)] & 0x00ff0000) ^ + (Te0[GETBYTE(t3, 1)] & 0x0000ff00) ^ + (Te1[GETBYTE(t0, 0)] & 0x000000ff) ^ rk[1]; s2 = - (Te4[GETBYTE(t2, 3)] & 0xff000000) ^ - (Te4[GETBYTE(t3, 2)] & 0x00ff0000) ^ - (Te4[GETBYTE(t0, 1)] & 0x0000ff00) ^ - (Te4[GETBYTE(t1, 0)] & 0x000000ff) ^ + (Te2[GETBYTE(t2, 3)] & 0xff000000) ^ + (Te3[GETBYTE(t3, 2)] & 0x00ff0000) ^ + (Te0[GETBYTE(t0, 1)] & 0x0000ff00) ^ + (Te1[GETBYTE(t1, 0)] & 0x000000ff) ^ rk[2]; s3 = - (Te4[GETBYTE(t3, 3)] & 0xff000000) ^ - (Te4[GETBYTE(t0, 2)] & 0x00ff0000) ^ - (Te4[GETBYTE(t1, 1)] & 0x0000ff00) ^ - (Te4[GETBYTE(t2, 0)] & 0x000000ff) ^ + (Te2[GETBYTE(t3, 3)] & 0xff000000) ^ + (Te3[GETBYTE(t0, 2)] & 0x00ff0000) ^ + (Te0[GETBYTE(t1, 1)] & 0x0000ff00) ^ + (Te1[GETBYTE(t2, 0)] & 0x000000ff) ^ rk[3]; @@ -358,6 +359,8 @@ void AES::decrypt(const byte* inBlock, const byte* xorBlock, s2 ^= rk[2]; s3 ^= rk[3]; + s0 |= PreFetchTd(); + /* * Nr - 1 full rounds: */ @@ -423,29 +426,32 @@ void AES::decrypt(const byte* inBlock, const byte* xorBlock, * apply last round and * map cipher state to byte array block: */ + + t0 |= PreFetchCTd4(); + s0 = - (Td4[GETBYTE(t0, 3)] & 0xff000000) ^ - (Td4[GETBYTE(t3, 2)] & 0x00ff0000) ^ - (Td4[GETBYTE(t2, 1)] & 0x0000ff00) ^ - (Td4[GETBYTE(t1, 0)] & 0x000000ff) ^ + ((word32)CTd4[GETBYTE(t0, 3)] << 24) ^ + ((word32)CTd4[GETBYTE(t3, 2)] << 16) ^ + ((word32)CTd4[GETBYTE(t2, 1)] << 8) ^ + ((word32)CTd4[GETBYTE(t1, 0)]) ^ rk[0]; s1 = - (Td4[GETBYTE(t1, 3)] & 0xff000000) ^ - (Td4[GETBYTE(t0, 2)] & 0x00ff0000) ^ - (Td4[GETBYTE(t3, 1)] & 0x0000ff00) ^ - (Td4[GETBYTE(t2, 0)] & 0x000000ff) ^ + ((word32)CTd4[GETBYTE(t1, 3)] << 24) ^ + ((word32)CTd4[GETBYTE(t0, 2)] << 16) ^ + ((word32)CTd4[GETBYTE(t3, 1)] << 8) ^ + ((word32)CTd4[GETBYTE(t2, 0)]) ^ rk[1]; s2 = - (Td4[GETBYTE(t2, 3)] & 0xff000000) ^ - (Td4[GETBYTE(t1, 2)] & 0x00ff0000) ^ - (Td4[GETBYTE(t0, 1)] & 0x0000ff00) ^ - (Td4[GETBYTE(t3, 0)] & 0x000000ff) ^ + ((word32)CTd4[GETBYTE(t2, 3)] << 24 ) ^ + ((word32)CTd4[GETBYTE(t1, 2)] << 16 ) ^ + ((word32)CTd4[GETBYTE(t0, 1)] << 8 ) ^ + ((word32)CTd4[GETBYTE(t3, 0)]) ^ rk[2]; s3 = - (Td4[GETBYTE(t3, 3)] & 0xff000000) ^ - (Td4[GETBYTE(t2, 2)] & 0x00ff0000) ^ - (Td4[GETBYTE(t1, 1)] & 0x0000ff00) ^ - (Td4[GETBYTE(t0, 0)] & 0x000000ff) ^ + ((word32)CTd4[GETBYTE(t3, 3)] << 24) ^ + ((word32)CTd4[GETBYTE(t2, 2)] << 16) ^ + ((word32)CTd4[GETBYTE(t1, 1)] << 8) ^ + ((word32)CTd4[GETBYTE(t0, 0)]) ^ rk[3]; gpBlock::Put(xorBlock, outBlock)(s0)(s1)(s2)(s3); @@ -1826,18 +1832,52 @@ const word32 AES::Td[5][256] = { } }; +const byte AES::CTd4[256] = +{ + 0x52U, 0x09U, 0x6aU, 0xd5U, 0x30U, 0x36U, 0xa5U, 0x38U, + 0xbfU, 0x40U, 0xa3U, 0x9eU, 0x81U, 0xf3U, 0xd7U, 0xfbU, + 0x7cU, 0xe3U, 0x39U, 0x82U, 0x9bU, 0x2fU, 0xffU, 0x87U, + 0x34U, 0x8eU, 0x43U, 0x44U, 0xc4U, 0xdeU, 0xe9U, 0xcbU, + 0x54U, 0x7bU, 0x94U, 0x32U, 0xa6U, 0xc2U, 0x23U, 0x3dU, + 0xeeU, 0x4cU, 0x95U, 0x0bU, 0x42U, 0xfaU, 0xc3U, 0x4eU, + 0x08U, 0x2eU, 0xa1U, 0x66U, 0x28U, 0xd9U, 0x24U, 0xb2U, + 0x76U, 0x5bU, 0xa2U, 0x49U, 0x6dU, 0x8bU, 0xd1U, 0x25U, + 0x72U, 0xf8U, 0xf6U, 0x64U, 0x86U, 0x68U, 0x98U, 0x16U, + 0xd4U, 0xa4U, 0x5cU, 0xccU, 0x5dU, 0x65U, 0xb6U, 0x92U, + 0x6cU, 0x70U, 0x48U, 0x50U, 0xfdU, 0xedU, 0xb9U, 0xdaU, + 0x5eU, 0x15U, 0x46U, 0x57U, 0xa7U, 0x8dU, 0x9dU, 0x84U, + 0x90U, 0xd8U, 0xabU, 0x00U, 0x8cU, 0xbcU, 0xd3U, 0x0aU, + 0xf7U, 0xe4U, 0x58U, 0x05U, 0xb8U, 0xb3U, 0x45U, 0x06U, + 0xd0U, 0x2cU, 0x1eU, 0x8fU, 0xcaU, 0x3fU, 0x0fU, 0x02U, + 0xc1U, 0xafU, 0xbdU, 0x03U, 0x01U, 0x13U, 0x8aU, 0x6bU, + 0x3aU, 0x91U, 0x11U, 0x41U, 0x4fU, 0x67U, 0xdcU, 0xeaU, + 0x97U, 0xf2U, 0xcfU, 0xceU, 0xf0U, 0xb4U, 0xe6U, 0x73U, + 0x96U, 0xacU, 0x74U, 0x22U, 0xe7U, 0xadU, 0x35U, 0x85U, + 0xe2U, 0xf9U, 0x37U, 0xe8U, 0x1cU, 0x75U, 0xdfU, 0x6eU, + 0x47U, 0xf1U, 0x1aU, 0x71U, 0x1dU, 0x29U, 0xc5U, 0x89U, + 0x6fU, 0xb7U, 0x62U, 0x0eU, 0xaaU, 0x18U, 0xbeU, 0x1bU, + 0xfcU, 0x56U, 0x3eU, 0x4bU, 0xc6U, 0xd2U, 0x79U, 0x20U, + 0x9aU, 0xdbU, 0xc0U, 0xfeU, 0x78U, 0xcdU, 0x5aU, 0xf4U, + 0x1fU, 0xddU, 0xa8U, 0x33U, 0x88U, 0x07U, 0xc7U, 0x31U, + 0xb1U, 0x12U, 0x10U, 0x59U, 0x27U, 0x80U, 0xecU, 0x5fU, + 0x60U, 0x51U, 0x7fU, 0xa9U, 0x19U, 0xb5U, 0x4aU, 0x0dU, + 0x2dU, 0xe5U, 0x7aU, 0x9fU, 0x93U, 0xc9U, 0x9cU, 0xefU, + 0xa0U, 0xe0U, 0x3bU, 0x4dU, 0xaeU, 0x2aU, 0xf5U, 0xb0U, + 0xc8U, 0xebU, 0xbbU, 0x3cU, 0x83U, 0x53U, 0x99U, 0x61U, + 0x17U, 0x2bU, 0x04U, 0x7eU, 0xbaU, 0x77U, 0xd6U, 0x26U, + 0xe1U, 0x69U, 0x14U, 0x63U, 0x55U, 0x21U, 0x0cU, 0x7dU, +}; + const word32* AES::Te0 = AES::Te[0]; const word32* AES::Te1 = AES::Te[1]; const word32* AES::Te2 = AES::Te[2]; const word32* AES::Te3 = AES::Te[3]; -const word32* AES::Te4 = AES::Te[4]; const word32* AES::Td0 = AES::Td[0]; const word32* AES::Td1 = AES::Td[1]; const word32* AES::Td2 = AES::Td[2]; const word32* AES::Td3 = AES::Td[3]; -const word32* AES::Td4 = AES::Td[4]; diff --git a/extra/yassl/taocrypt/src/asn.cpp b/extra/yassl/taocrypt/src/asn.cpp index 0474e7c21d5..80bcd612d27 100644 --- a/extra/yassl/taocrypt/src/asn.cpp +++ b/extra/yassl/taocrypt/src/asn.cpp @@ -1219,17 +1219,17 @@ word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz) } word32 rLen = GetLength(source); if (rLen != 20) { - if (rLen == 21) { // zero at front, eat + while (rLen > 20 && source.remaining() > 0) { // zero's at front, eat source.next(); --rLen; } - else if (rLen == 19) { // add zero to front so 20 bytes + if (rLen < 20) { // add zero's to front so 20 bytes + word32 tmpLen = rLen; + while (tmpLen < 20) { decoded[0] = 0; decoded++; + tmpLen++; } - else { - source.SetError(DSA_SZ_E); - return 0; } } memcpy(decoded, source.get_buffer() + source.get_index(), rLen); @@ -1242,17 +1242,17 @@ word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz) } word32 sLen = GetLength(source); if (sLen != 20) { - if (sLen == 21) { - source.next(); // zero at front, eat + while (sLen > 20 && source.remaining() > 0) { + source.next(); // zero's at front, eat --sLen; } - else if (sLen == 19) { - decoded[rLen] = 0; // add zero to front so 20 bytes + if (sLen < 20) { // add zero's to front so 20 bytes + word32 tmpLen = sLen; + while (tmpLen < 20) { + decoded[rLen] = 0; decoded++; + tmpLen++; } - else { - source.SetError(DSA_SZ_E); - return 0; } } memcpy(decoded + rLen, source.get_buffer() + source.get_index(), sLen); diff --git a/extra/yassl/taocrypt/src/dsa.cpp b/extra/yassl/taocrypt/src/dsa.cpp index 72221441b2b..fda01881df5 100644 --- a/extra/yassl/taocrypt/src/dsa.cpp +++ b/extra/yassl/taocrypt/src/dsa.cpp @@ -172,6 +172,7 @@ word32 DSA_Signer::Sign(const byte* sha_digest, byte* sig, const Integer& q = key_.GetSubGroupOrder(); const Integer& g = key_.GetSubGroupGenerator(); const Integer& x = key_.GetPrivatePart(); + byte* tmpPtr = sig; // initial signature output Integer k(rng, 1, q - 1); @@ -187,22 +188,23 @@ word32 DSA_Signer::Sign(const byte* sha_digest, byte* sig, return (word32) -1; int rSz = r_.ByteCount(); + int tmpSz = rSz; - if (rSz == 19) { - sig[0] = 0; - sig++; + while (tmpSz++ < SHA::DIGEST_SIZE) { + *sig++ = 0; } r_.Encode(sig, rSz); + sig = tmpPtr + SHA::DIGEST_SIZE; // advance sig output to s int sSz = s_.ByteCount(); + tmpSz = sSz; - if (sSz == 19) { - sig[rSz] = 0; - sig++; + while (tmpSz++ < SHA::DIGEST_SIZE) { + *sig++ = 0; } - s_.Encode(sig + rSz, sSz); + s_.Encode(sig, sSz); return 40; } diff --git a/extra/yassl/taocrypt/src/integer.cpp b/extra/yassl/taocrypt/src/integer.cpp index fb8d9276bd9..dd8425396ed 100644 --- a/extra/yassl/taocrypt/src/integer.cpp +++ b/extra/yassl/taocrypt/src/integer.cpp @@ -193,8 +193,9 @@ DWord() {} "a" (a), "rm" (b) : "cc"); #elif defined(__mips64) - __asm__("dmultu %2,%3" : "=d" (r.halfs_.high), "=l" (r.halfs_.low) - : "r" (a), "r" (b)); + unsigned __int128 t = (unsigned __int128) a * b; + r.halfs_.high = t >> 64; + r.halfs_.low = (word) t; #elif defined(_M_IX86) // for testing diff --git a/extra/yassl/taocrypt/test/test.cpp b/extra/yassl/taocrypt/test/test.cpp index c23d981924d..b07a9eb9f29 100644 --- a/extra/yassl/taocrypt/test/test.cpp +++ b/extra/yassl/taocrypt/test/test.cpp @@ -1281,6 +1281,9 @@ int dsa_test() if (!verifier.Verify(digest, decoded)) return -90; + if (!verifier.Verify(digest, signature)) + return -91; + return 0; } diff --git a/extra/yassl/testsuite/test.hpp b/extra/yassl/testsuite/test.hpp index 5374edd0e2a..a65a212cf99 100644 --- a/extra/yassl/testsuite/test.hpp +++ b/extra/yassl/testsuite/test.hpp @@ -22,7 +22,6 @@ #define yaSSL_TEST_HPP #include "runtime.hpp" -#include "openssl/ssl.h" /* openssl compatibility test */ #include "error.hpp" #include #include @@ -56,6 +55,7 @@ #endif #define SOCKET_T int #endif /* _WIN32 */ +#include "openssl/ssl.h" /* openssl compatibility test */ #ifdef _MSC_VER diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 8ebd72b9c58..e6de8515fdc 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -61,6 +61,7 @@ SET(HEADERS my_compiler.h handler_state.h handler_ername.h + json_lib.h ) INSTALL(FILES ${HEADERS} DESTINATION ${INSTALL_INCLUDEDIR} COMPONENT Development) diff --git a/include/atomic/nolock.h b/include/atomic/nolock.h deleted file mode 100644 index 2137445a075..00000000000 --- a/include/atomic/nolock.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef ATOMIC_NOLOCK_INCLUDED -#define ATOMIC_NOLOCK_INCLUDED - -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#if defined(__i386__) || defined(_MSC_VER) || defined(__x86_64__) \ - || defined(HAVE_GCC_ATOMIC_BUILTINS) \ - || defined(HAVE_SOLARIS_ATOMIC) - -# ifdef MY_ATOMIC_MODE_DUMMY -# define LOCK_prefix "" -# else -# define LOCK_prefix "lock" -# endif -/* - We choose implementation as follows: - ------------------------------------ - On Windows using Visual C++ the native implementation should be - preferrable. When using gcc we prefer the Solaris implementation - before the gcc because of stability preference, we choose gcc - builtins if available, otherwise we choose the somewhat broken - native x86 implementation. If neither Visual C++ or gcc we still - choose the Solaris implementation on Solaris (mainly for SunStudio - compilers). -*/ -# if defined(_MSC_VER) -# include "generic-msvc.h" -# elif __GNUC__ -# if defined(HAVE_SOLARIS_ATOMIC) -# include "solaris.h" -# elif defined(HAVE_GCC_ATOMIC_BUILTINS) -# include "gcc_builtins.h" -# elif defined(__i386__) || defined(__x86_64__) -# include "x86-gcc.h" -# endif -# elif defined(HAVE_SOLARIS_ATOMIC) -# include "solaris.h" -# endif -#endif - -#endif /* ATOMIC_NOLOCK_INCLUDED */ diff --git a/include/atomic/x86-gcc.h b/include/atomic/x86-gcc.h index 173e32e790c..3a081d9bbc5 100644 --- a/include/atomic/x86-gcc.h +++ b/include/atomic/x86-gcc.h @@ -28,6 +28,12 @@ */ #undef MY_ATOMIC_HAS_8_AND_16 +#ifdef MY_ATOMIC_MODE_DUMMY +#define LOCK_prefix "" +#else +#define LOCK_prefix "lock" +#endif + #ifdef __x86_64__ # ifdef MY_ATOMIC_NO_XADD # define MY_ATOMIC_MODE "gcc-amd64" LOCK_prefix "-no-xadd" diff --git a/include/byte_order_generic_x86.h b/include/byte_order_generic_x86.h index 0a71a17829b..a97dd0f43a3 100644 --- a/include/byte_order_generic_x86.h +++ b/include/byte_order_generic_x86.h @@ -27,19 +27,9 @@ ((uint32) (uchar) (A)[0]))) #define sint4korr(A) (*((const long *) (A))) #define uint2korr(A) (*((const uint16 *) (A))) - -/* - Attention: Please, note, uint3korr reads 4 bytes (not 3)! - It means, that you have to provide enough allocated space. -*/ -#if defined(HAVE_valgrind) && !defined(_WIN32) #define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\ (((uint32) ((uchar) (A)[1])) << 8) +\ (((uint32) ((uchar) (A)[2])) << 16)) -#else -#define uint3korr(A) (long) (*((const unsigned int *) (A)) & 0xFFFFFF) -#endif - #define uint4korr(A) (*((const uint32 *) (A))) #define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ (((uint32) ((uchar) (A)[1])) << 8) +\ diff --git a/include/byte_order_generic_x86_64.h b/include/byte_order_generic_x86_64.h index 05c144f83cb..fbc6e1f536b 100644 --- a/include/byte_order_generic_x86_64.h +++ b/include/byte_order_generic_x86_64.h @@ -28,17 +28,9 @@ ((uint32) (uchar) (A)[0]))) #define sint4korr(A) (int32) (*((int32 *) (A))) #define uint2korr(A) (uint16) (*((uint16 *) (A))) -/* - Attention: Please, note, uint3korr reads 4 bytes (not 3)! - It means, that you have to provide enough allocated space. -*/ -#if defined(HAVE_valgrind) && !defined(_WIN32) #define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\ (((uint32) ((uchar) (A)[1])) << 8) +\ (((uint32) ((uchar) (A)[2])) << 16)) -#else -#define uint3korr(A) (uint32) (*((unsigned int *) (A)) & 0xFFFFFF) -#endif #define uint4korr(A) (uint32) (*((uint32 *) (A))) diff --git a/include/json_lib.h b/include/json_lib.h new file mode 100644 index 00000000000..ce7f27317bc --- /dev/null +++ b/include/json_lib.h @@ -0,0 +1,399 @@ +#ifndef JSON_LIB_INCLUDED +#define JSON_LIB_INCLUDED + +#ifdef __cplusplus +extern "C" { +#endif + +#define JSON_DEPTH_LIMIT 32 + +/* + When error happens, the c_next of the JSON engine contains the + character that caused the error, and the c_str is the position + in string where the error occurs. +*/ +enum json_errors { + JE_BAD_CHR= -1, /* Invalid character, charset handler cannot read it. */ + + JE_NOT_JSON_CHR= -2, /* Character met not used in JSON. */ + /* ASCII 00-08 for instance. */ + + JE_EOS= -3, /* Unexpected end of string. */ + + JE_SYN= -4, /* The next character breaks the JSON syntax. */ + + JE_STRING_CONST= -5, /* Character disallowed in string constant. */ + + JE_ESCAPING= -6, /* Error in the escaping. */ + + JE_DEPTH= -7, /* The limit on the JSON depth was overrun. */ +}; + + +typedef struct st_json_string_t +{ + const uchar *c_str; /* Current position in JSON string */ + const uchar *str_end; /* The end on the string. */ + my_wc_t c_next; /* UNICODE of the last read character */ + int error; /* error code. */ + + CHARSET_INFO *cs; /* Character set of the JSON string. */ + + my_charset_conv_mb_wc wc; /* UNICODE conversion function. */ + /* It's taken out of the cs just to speed calls. */ +} json_string_t; + + +void json_string_set_cs(json_string_t *s, CHARSET_INFO *i_cs); +void json_string_set_str(json_string_t *s, + const uchar *str, const uchar *end); +#define json_next_char(j) \ + (j)->wc((j)->cs, &(j)->c_next, (j)->c_str, (j)->str_end) +#define json_eos(j) ((j)->c_str >= (j)->str_end) +/* + read_string_const_chr() reads the next character of the string constant + and saves it to the js->c_next. + It takes into account possible escapings, so if for instance + the string is '\b', the read_string_const_chr() sets 8. +*/ +int json_read_string_const_chr(json_string_t *js); + + +/* + Various JSON-related operations expect JSON path as a parameter. + The path is a string like this "$.keyA[2].*" + The path itself is a number of steps specifying either a key or a position + in an array. Some of them can be wildcards. + So the representation of the JSON path is the json_path_t class + containing an array of json_path_step_t objects. +*/ + + +/* Path step types - actually bitmasks to let '&' or '|' operations. */ +enum json_path_step_types +{ + JSON_PATH_KEY_NULL=0, + JSON_PATH_KEY=1, /* Must be equal to JSON_VALUE_OBJECT. */ + JSON_PATH_ARRAY=2, /* Must be equal to JSON_VALUE_ARRAY. */ + JSON_PATH_KEY_OR_ARRAY=3, + JSON_PATH_WILD=4, /* Step like .* or [*] */ + JSON_PATH_DOUBLE_WILD=8, /* Step like **.k or **[1] */ + JSON_PATH_KEY_WILD= 1+4, + JSON_PATH_KEY_DOUBLEWILD= 1+8, + JSON_PATH_ARRAY_WILD= 2+4, + JSON_PATH_ARRAY_DOUBLEWILD= 2+8 +}; + + +typedef struct st_json_path_step_t +{ + enum json_path_step_types type; /* The type of the step - */ + /* see json_path_step_types */ + const uchar *key; /* Pointer to the beginning of the key. */ + const uchar *key_end; /* Pointer to the end of the key. */ + uint n_item; /* Item number in an array. No meaning for the key step. */ +} json_path_step_t; + + +typedef struct st_json_path_t +{ + json_string_t s; /* The string to be parsed. */ + json_path_step_t steps[JSON_DEPTH_LIMIT]; /* Steps of the path. */ + json_path_step_t *last_step; /* Points to the last step. */ + + int mode_strict; /* TRUE if the path specified as 'strict' */ + enum json_path_step_types types_used; /* The '|' of all step's 'type'-s */ +} json_path_t; + + +int json_path_setup(json_path_t *p, + CHARSET_INFO *i_cs, const uchar *str, const uchar *end); + + +/* + The set of functions and structures below provides interface + to the JSON text parser. + Running the parser normally goes like this: + + json_engine_t j_eng; // structure keeps parser's data + json_scan_start(j_eng) // begin the parsing + + do + { + // The parser has read next piece of JSON + // and set fields of j_eng structure accordingly. + // So let's see what we have: + switch (j_eng.state) + { + case JST_KEY: + // Handle key name. See the json_read_keyname_chr() + // Probably compare it with the keyname we're looking for + case JST_VALUE: + // Handle value. It is either value of the key or an array item. + // see the json_read_value() + case JST_OBJ_START: + // parser found an object (the '{' in JSON) + case JST_OBJ_END: + // parser found the end of the object (the '}' in JSON) + case JST_ARRAY_START: + // parser found an array (the '[' in JSON) + case JST_ARRAY_END: + // parser found the end of the array (the ']' in JSON) + + }; + } while (json_scan_next() == 0); // parse next structure + + + if (j_eng.s.error) // we need to check why the loop ended. + // Did we get to the end of JSON, or came upon error. + { + signal_error_in_JSON() + } + + + Parts of JSON can be quickly skipped. If we are not interested + in a particular key, we can just skip it with json_skip_key() call. + Similarly json_skip_level() goes right to the end of an object + or an array. +*/ + + +/* These are JSON parser states that user can expect and handle. */ +enum json_states { + JST_VALUE, /* value found */ + JST_KEY, /* key found */ + JST_OBJ_START, /* object */ + JST_OBJ_END, /* object ended */ + JST_ARRAY_START, /* array */ + JST_ARRAY_END, /* array ended */ + NR_JSON_USER_STATES +}; + + +enum json_value_types +{ + JSON_VALUE_OBJECT=1, + JSON_VALUE_ARRAY=2, + JSON_VALUE_STRING, + JSON_VALUE_NUMBER, + JSON_VALUE_TRUE, + JSON_VALUE_FALSE, + JSON_VALUE_NULL +}; + + +enum json_num_flags +{ + JSON_NUM_NEG=1, /* Number is negative. */ + JSON_NUM_FRAC_PART=2, /* The fractional part is not empty. */ + JSON_NUM_EXP=4, /* The number has the 'e' part. */ +}; + + +typedef struct st_json_engine_t +{ + json_string_t s; /* String to parse. */ + int sav_c_len; /* Length of the current character. + Can be more than 1 for multibyte charsets */ + + int state; /* The state of the parser. One of 'enum json_states'. + It tells us what construction of JSON we've just read. */ + + /* These values are only set after the json_read_value() call. */ + enum json_value_types value_type; /* type of the value.*/ + const uchar *value; /* Points to the value. */ + const uchar *value_begin;/* Points to where the value starts in the JSON. */ + uint num_flags; /* the details of the JSON_VALUE_NUMBER, is it negative, + or if it has the fractional part. + See the enum json_num_flags. */ + + /* + In most cases the 'value' and 'value_begin' are equal. + They only differ if the value is a string constants. Then 'value_begin' + points to the starting quotation mark, while the 'value' - to + the first character of the string. + */ + + const uchar *value_end; /* Points to the next character after the value. */ + int value_len; /* The length of the value. Does not count quotations for */ + /* string constants. */ + + int stack[JSON_DEPTH_LIMIT]; /* Keeps the stack of nested JSON structures. */ + int *stack_p; /* The 'stack' pointer. */ +} json_engine_t; + + +int json_scan_start(json_engine_t *je, + CHARSET_INFO *i_cs, const uchar *str, const uchar *end); +int json_scan_next(json_engine_t *j); + + +/* + json_read_keyname_chr() function assists parsing the name of an JSON key. + It only can be called when the json_engine is in JST_KEY. + The json_read_keyname_chr() reads one character of the name of the key, + and puts it in j_eng.s.next_c. + Typical usage is like this: + + if (j_eng.state == JST_KEY) + { + while (json_read_keyname_chr(&j) == 0) + { + //handle next character i.e. match it against the pattern + } + } +*/ + +int json_read_keyname_chr(json_engine_t *j); + + +/* + Check if the name of the current JSON key matches + the step of the path. +*/ +int json_key_matches(json_engine_t *je, json_string_t *k); + + +/* + json_read_value() function parses the JSON value syntax, + so that we can handle the value of a key or an array item. + It only returns meaningful result when the engine is in + the JST_VALUE state. + + Typical usage is like this: + + if (j_eng.state == JST_VALUE) + { + json_read_value(&j_eng); + switch(j_eng.value_type) + { + case JSON_VALUE_STRING: + // get the string + str= j_eng.value; + str_length= j_eng.value_len; + case JSON_VALUE_NUMBER: + // get the number + ... etc + } +*/ +int json_read_value(json_engine_t *j); + + +/* + json_skip_key() makes parser skip the content of the current + JSON key quickly. + It can be called only when the json_engine state is JST_KEY. + Typical usage is: + + if (j_eng.state == JST_KEY) + { + if (key_does_not_match(j_eng)) + json_skip_key(j_eng); + } +*/ + +int json_skip_key(json_engine_t *j); + + +typedef const int *json_level_t; + +/* + json_skip_to_level() makes parser quickly get out of nested + loops and arrays. It is used when we're not interested in what is + there in the rest of these structures. + The 'level' should be remembered in advance. + json_level_t level= json_get_level(j); + .... // getting into the nested JSON structures + json_skip_to_level(j, level); +*/ +#define json_get_level(j) (j->stack_p) + +int json_skip_to_level(json_engine_t *j, json_level_t level); + +/* + json_skip_level() works as above with just current structre. + So it gets to the end of the current JSON array or object. +*/ +#define json_skip_level(json_engine) \ + json_skip_to_level((json_engine), (json_engine)->stack_p) + + +#define json_skip_array_item json_skip_key + +/* + Checks if the current value is of scalar type - + not an OBJECT nor ARRAY. +*/ +#define json_value_scalar(je) ((je)->value_type > JSON_VALUE_ARRAY) + + +/* + Look for the JSON PATH in the json string. + Function can be called several times with same JSON/PATH to + find multiple matches. + On the first call, the json_engine_t parameter should be + initialized with the JSON string, and the json_path_t with the JSON path + appropriately. The 'p_cur_step' should point at the first + step of the path. + The 'array_counters' is the array of JSON_DEPTH_LIMIT size. + It stores the array counters of the parsed JSON. + If function returns 0, it means it found the match. The position of + the match is je->s.c_str. Then we can call the json_find_path() + with same engine/path/p_cur_step to get the next match. + Non-zero return means no matches found. + Check je->s.error to see if there was an error in JSON. +*/ +int json_find_path(json_engine_t *je, + json_path_t *p, json_path_step_t **p_cur_step, + uint *array_counters); + + +typedef struct st_json_find_paths_t +{ + uint n_paths; + json_path_t *paths; + uint cur_depth; + uint *path_depths; + uint array_counters[JSON_DEPTH_LIMIT]; +} json_find_paths_t; + + +int json_find_paths_first(json_engine_t *je, json_find_paths_t *state, + uint n_paths, json_path_t *paths, uint *path_depths); +int json_find_paths_next(json_engine_t *je, json_find_paths_t *state); + + +/* + Converst JSON string constant into ordinary string constant + which can involve unpacking json escapes and changing character set. + Returns negative integer in the case of an error, + the length of the result otherwise. +*/ +int json_unescape(CHARSET_INFO *json_cs, + const uchar *json_str, const uchar *json_end, + CHARSET_INFO *res_cs, + uchar *res, uchar *res_end); + +/* + Converst ordinary string constant into JSON string constant. + which can involve appropriate escaping and changing character set. + Returns negative integer in the case of an error, + the length of the result otherwise. +*/ +int json_escape(CHARSET_INFO *str_cs, const uchar *str, const uchar *str_end, + CHARSET_INFO *json_cs, uchar *json, uchar *json_end); + + +/* + Appends the ASCII string to the json with the charset conversion. +*/ +int json_append_ascii(CHARSET_INFO *json_cs, + uchar *json, uchar *json_end, + const uchar *ascii, const uchar *ascii_end); + +#ifdef __cplusplus +} +#endif + +#endif /* JSON_LIB_INCLUDED */ + diff --git a/include/m_ctype.h b/include/m_ctype.h index c50763ed570..04a82953f0a 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -184,7 +184,6 @@ extern MY_UNI_CTYPE my_uni_ctype[256]; #define MY_CS_MBMAXLEN 6 /* Maximum supported mbmaxlen */ #define MY_CS_IS_TOOSMALL(rc) ((rc) >= MY_CS_TOOSMALL6 && (rc) <= MY_CS_TOOSMALL) - #define MY_SEQ_INTTAIL 1 #define MY_SEQ_SPACES 2 #define MY_SEQ_NONSPACES 3 /* Skip non-space characters, including bad bytes */ @@ -397,7 +396,6 @@ typedef struct */ typedef struct { - MY_STRCOPY_STATUS m_native_copy_status; const char *m_cannot_convert_error_pos; } MY_STRCONV_STATUS; @@ -410,9 +408,6 @@ struct my_charset_handler_st size_t (*numchars)(CHARSET_INFO *, const char *b, const char *e); size_t (*charpos)(CHARSET_INFO *, const char *b, const char *e, size_t pos); - size_t (*well_formed_len)(CHARSET_INFO *, - const char *b,const char *e, - size_t nchars, int *error); size_t (*lengthsp)(CHARSET_INFO *, const char *ptr, size_t length); size_t (*numcells)(CHARSET_INFO *, const char *b, const char *e); @@ -817,8 +812,6 @@ int my_wildcmp_bin(CHARSET_INFO *, size_t my_numchars_8bit(CHARSET_INFO *, const char *b, const char *e); size_t my_numcells_8bit(CHARSET_INFO *, const char *b, const char *e); size_t my_charpos_8bit(CHARSET_INFO *, const char *b, const char *e, size_t pos); -size_t my_well_formed_len_8bit(CHARSET_INFO *, const char *b, const char *e, - size_t pos, int *error); size_t my_well_formed_char_length_8bit(CHARSET_INFO *cs, const char *b, const char *e, size_t nchars, @@ -850,8 +843,6 @@ int my_wildcmp_mb(CHARSET_INFO *, size_t my_numchars_mb(CHARSET_INFO *, const char *b, const char *e); size_t my_numcells_mb(CHARSET_INFO *, const char *b, const char *e); size_t my_charpos_mb(CHARSET_INFO *, const char *b, const char *e, size_t pos); -size_t my_well_formed_len_mb(CHARSET_INFO *, const char *b, const char *e, - size_t pos, int *error); uint my_instr_mb(CHARSET_INFO *, const char *b, size_t b_length, const char *s, size_t s_length, @@ -994,7 +985,9 @@ uint32 my_convert_using_func(char *to, uint32 to_length, CHARSET_INFO *to_cs, */ size_t my_convert_fix(CHARSET_INFO *dstcs, char *dst, size_t dst_length, CHARSET_INFO *srccs, const char *src, size_t src_length, - size_t nchars, MY_STRCONV_STATUS *status); + size_t nchars, + MY_STRCOPY_STATUS *copy_status, + MY_STRCONV_STATUS *conv_status); #define _MY_U 01 /* Upper case */ #define _MY_L 02 /* Lower case */ @@ -1089,6 +1082,22 @@ uint my_charlen_fix(CHARSET_INFO *cs, const char *str, const char *end) } +/* + A compatibility replacement pure C function for the former + cs->cset->well_formed_len(). + In C++ code please use Well_formed_prefix::length() instead. +*/ +static inline size_t +my_well_formed_length(CHARSET_INFO *cs, const char *b, const char *e, + size_t nchars, int *error) +{ + MY_STRCOPY_STATUS status; + (void) cs->cset->well_formed_char_length(cs, b, e, nchars, &status); + *error= status.m_well_formed_error_pos == NULL ? 0 : 1; + return status.m_source_end_pos - b; +} + + #define my_caseup_str(s, a) ((s)->cset->caseup_str((s), (a))) #define my_casedn_str(s, a) ((s)->cset->casedn_str((s), (a))) #define my_strntol(s, a, b, c, d, e) ((s)->cset->strntol((s),(a),(b),(c),(d),(e))) diff --git a/include/maria.h b/include/maria.h index bdd53f3d183..1305b6444c0 100644 --- a/include/maria.h +++ b/include/maria.h @@ -149,7 +149,7 @@ typedef struct st_maria_create_info uint null_bytes; uint old_options; enum data_file_type org_data_file_type; - uint8 language; + uint16 language; my_bool with_auto_increment, transactional; } MARIA_CREATE_INFO; diff --git a/include/my_atomic.h b/include/my_atomic.h index 2034bf48987..8f13a0ab89b 100644 --- a/include/my_atomic.h +++ b/include/my_atomic.h @@ -112,9 +112,26 @@ #undef MY_ATOMIC_HAS_8_16 /* - * Attempt to do atomic ops without locks - */ -#include "atomic/nolock.h" + We choose implementation as follows: + ------------------------------------ + On Windows using Visual C++ the native implementation should be + preferrable. When using gcc we prefer the Solaris implementation + before the gcc because of stability preference, we choose gcc + builtins if available, otherwise we choose the somewhat broken + native x86 implementation. If neither Visual C++ or gcc we still + choose the Solaris implementation on Solaris (mainly for SunStudio + compilers). +*/ +#if defined(_MSC_VER) +#include "atomic/generic-msvc.h" +#elif defined(HAVE_SOLARIS_ATOMIC) +#include "atomic/solaris.h" +#elif defined(HAVE_GCC_ATOMIC_BUILTINS) +#include "atomic/gcc_builtins.h" +#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) +#include "atomic/x86-gcc.h" +#endif + #ifndef make_atomic_cas_body /* nolock.h was not able to generate even a CAS function, fall back */ @@ -282,8 +299,16 @@ make_atomic_store(ptr) #if SIZEOF_LONG == 4 #define my_atomic_addlong(A,B) my_atomic_add32((int32*) (A), (B)) +#define my_atomic_loadlong(A) my_atomic_load32((int32*) (A)) +#define my_atomic_storelong(A,B) my_atomic_store32((int32*) (A), (B)) +#define my_atomic_faslong(A,B) my_atomic_fas32((int32*) (A), (B)) +#define my_atomic_caslong(A,B,C) my_atomic_cas32((int32*) (A), (int32*) (B), (C)) #else #define my_atomic_addlong(A,B) my_atomic_add64((int64*) (A), (B)) +#define my_atomic_loadlong(A) my_atomic_load64((int64*) (A)) +#define my_atomic_storelong(A,B) my_atomic_store64((int64*) (A), (B)) +#define my_atomic_faslong(A,B) my_atomic_fas64((int64*) (A), (B)) +#define my_atomic_caslong(A,B,C) my_atomic_cas64((int64*) (A), (int64*) (B), (C)) #endif #ifdef _atomic_h_cleanup_ diff --git a/include/my_base.h b/include/my_base.h index f5842685f9d..84b2e28d340 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -566,7 +566,7 @@ typedef ulong key_part_map; #define HA_STATE_KEY_CHANGED 128 #define HA_STATE_WRITE_AT_END 256 /* set in _ps_find_writepos */ #define HA_STATE_BUFF_SAVED 512 /* If current keybuff is info->buff */ -#define HA_STATE_ROW_CHANGED 1024 /* To invalide ROW cache */ +#define HA_STATE_ROW_CHANGED 1024 /* To invalidate ROW cache */ #define HA_STATE_EXTEND_BLOCK 2048 #define HA_STATE_RNEXT_SAME 4096 /* rnext_same occupied lastkey2 */ diff --git a/include/my_bitmap.h b/include/my_bitmap.h index 9c9550e3141..3e242280be4 100644 --- a/include/my_bitmap.h +++ b/include/my_bitmap.h @@ -58,6 +58,7 @@ extern my_bool bitmap_is_overlapping(const MY_BITMAP *map1, extern my_bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit); extern my_bool bitmap_test_and_clear(MY_BITMAP *map, uint bitmap_bit); extern my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit); +extern my_bool bitmap_fast_test_and_clear(MY_BITMAP *map, uint bitmap_bit); extern my_bool bitmap_union_is_set_all(const MY_BITMAP *map1, const MY_BITMAP *map2); extern my_bool bitmap_exists_intersection(const MY_BITMAP **bitmap_array, diff --git a/include/my_compare.h b/include/my_compare.h index 6b76483074b..12f9971d49b 100644 --- a/include/my_compare.h +++ b/include/my_compare.h @@ -57,7 +57,7 @@ typedef struct st_HA_KEYSEG /* Key-portion */ uint16 language; uint8 type; /* Type of key (for sort) */ uint8 null_bit; /* bitmask to test for NULL */ - uint8 bit_start,bit_end; /* if bit field */ + uint8 bit_start; uint8 bit_length; /* Length of bit part */ } HA_KEYSEG; diff --git a/include/my_global.h b/include/my_global.h index 0f24570c2f7..4f40d3e0615 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -879,8 +879,7 @@ typedef long long my_ptrdiff_t; and related routines are refactored. */ -#define my_offsetof(TYPE, MEMBER) \ - ((size_t)((char *)&(((TYPE *)0x10)->MEMBER) - (char*)0x10)) +#define my_offsetof(TYPE, MEMBER) PTR_BYTE_DIFF(&((TYPE *)0x10)->MEMBER, 0x10) #define NullS (char *) 0 diff --git a/include/my_sys.h b/include/my_sys.h index 528950f4e22..c8f3e1bf3a4 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2010, 2013, Monty Program Ab. + Copyright (c) 2010, 2016, 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 @@ -279,7 +279,7 @@ extern my_bool my_use_symdir; extern ulong my_default_record_cache_size; extern my_bool my_disable_locking, my_disable_async_io, my_disable_flush_key_blocks, my_disable_symlinks; -extern my_bool my_disable_sync; +extern my_bool my_disable_sync, my_disable_copystat_in_redel; extern char wild_many,wild_one,wild_prefix; extern const char *charsets_dir; extern my_bool timed_mutexes; @@ -698,7 +698,7 @@ extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags); extern FILE *my_freopen(const char *path, const char *mode, FILE *stream); extern int my_fclose(FILE *fd,myf MyFlags); extern int my_vfprintf(FILE *stream, const char* format, va_list args); -extern void my_strerror(char *buf, size_t len, int nr); +extern const char* my_strerror(char *buf, size_t len, int nr); extern int my_fprintf(FILE *stream, const char* format, ...); extern File my_fileno(FILE *fd); extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags); diff --git a/include/myisamchk.h b/include/myisamchk.h index 64724de1789..643241d84e5 100644 --- a/include/myisamchk.h +++ b/include/myisamchk.h @@ -16,14 +16,6 @@ /* Definitions needed for myisamchk/mariachk.c */ -/* - Entries marked as "QQ to be removed" are NOT used to - pass check/repair options to xxx_check.c. They are used - internally by xxxchk.c or/and ha_xxxx.cc and should NOT - be stored together with other flags. They should be removed - from the following list to make addition of new flags possible. -*/ - #ifndef _myisamchk_h #define _myisamchk_h @@ -66,6 +58,7 @@ typedef enum MI_STATS_METHOD_IGNORE_NULLS } enum_handler_stats_method; +struct st_myisam_info; typedef struct st_handler_check_param { @@ -122,6 +115,8 @@ typedef struct st_handler_check_param uint progress_counter; /* How often to call _report_progress() */ ulonglong progress, max_progress; + int (*fix_record)(struct st_myisam_info *info, uchar *record, int keynum); + mysql_mutex_t print_msg_mutex; my_bool need_print_msg_lock; myf malloc_flags; diff --git a/include/mysql.h b/include/mysql.h index eab859270f7..80e75c264e8 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -138,6 +138,12 @@ typedef unsigned long long my_ulonglong; #define ER_WARN_DATA_TRUNCATED WARN_DATA_TRUNCATED #define WARN_PLUGIN_DELETE_BUILTIN ER_PLUGIN_DELETE_BUILTIN #define ER_FK_DUP_NAME ER_DUP_CONSTRAINT_NAME +#define ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +#define ER_PRIMARY_KEY_BASED_ON_VIRTUAL_COLUMN ER_PRIMARY_KEY_BASED_ON_GENERATED_COLUMN +#define ER_WRONG_FK_OPTION_FOR_VIRTUAL_COLUMN ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN +#define ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN +#define ER_UNSUPPORTED_ACTION_ON_VIRTUAL_COLUMN ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN +#define ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS ER_UNSUPPORTED_ENGINE_FOR_GENERATED_COLUMNS typedef struct st_mysql_rows { struct st_mysql_rows *next; /* list of rows */ diff --git a/include/mysql.h.pp b/include/mysql.h.pp index 857f5b99a90..9d93b9ad325 100644 --- a/include/mysql.h.pp +++ b/include/mysql.h.pp @@ -11,11 +11,18 @@ enum enum_server_command COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH, COM_DAEMON, COM_MDB_GAP_BEG, COM_MDB_GAP_END=250, - COM_SLAVE_WORKER, - COM_SLAVE_IO, - COM_SLAVE_SQL, - COM_MULTI, - COM_END + COM_SLAVE_WORKER=251, + COM_SLAVE_IO=252, + COM_SLAVE_SQL=253, + COM_MULTI=254, + COM_END=255 +}; +enum enum_indicator_type +{ + STMT_INDICATOR_NONE= 0, + STMT_INDICATOR_NULL, + STMT_INDICATOR_DEFAULT, + STMT_INDICATOR_IGNORE }; struct st_vio; typedef struct st_vio Vio; @@ -109,6 +116,8 @@ my_bool net_write_command(NET *net,unsigned char command, const unsigned char *packet, size_t len); int net_real_write(NET *net,const unsigned char *packet, size_t len); unsigned long my_net_read_packet(NET *net, my_bool read_from_server); +unsigned long my_net_read_packet_reallen(NET *net, my_bool read_from_server, + unsigned long* reallen); struct sockaddr; int my_connect(my_socket s, const struct sockaddr *name, unsigned int namelen, unsigned int timeout); diff --git a/include/mysql_com.h b/include/mysql_com.h index 461800f3ce7..c399520022d 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -114,12 +114,24 @@ enum enum_server_command /* don't forget to update const char *command_name[] in sql_parse.cc */ COM_MDB_GAP_BEG, COM_MDB_GAP_END=250, - COM_SLAVE_WORKER, - COM_SLAVE_IO, - COM_SLAVE_SQL, - COM_MULTI, + COM_SLAVE_WORKER=251, + COM_SLAVE_IO=252, + COM_SLAVE_SQL=253, + COM_MULTI=254, /* Must be last */ - COM_END + COM_END=255 +}; + + +/* + Bulk PS protocol indicator value: +*/ +enum enum_indicator_type +{ + STMT_INDICATOR_NONE= 0, + STMT_INDICATOR_NULL, + STMT_INDICATOR_DEFAULT, + STMT_INDICATOR_IGNORE }; /* sql type stored in .frm files for virtual fields */ @@ -202,43 +214,43 @@ enum enum_server_command #define REFRESH_FAST (1ULL << 31) /* Intern flag */ #define CLIENT_LONG_PASSWORD 0 /* obsolete flag */ -#define CLIENT_MYSQL 1 /* mysql/old mariadb server/client */ -#define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */ -#define CLIENT_LONG_FLAG 4 /* Get all column flags */ -#define CLIENT_CONNECT_WITH_DB 8 /* One can specify db on connect */ -#define CLIENT_NO_SCHEMA 16 /* Don't allow database.table.column */ -#define CLIENT_COMPRESS 32 /* Can use compression protocol */ -#define CLIENT_ODBC 64 /* Odbc client */ -#define CLIENT_LOCAL_FILES 128 /* Can use LOAD DATA LOCAL */ -#define CLIENT_IGNORE_SPACE 256 /* Ignore spaces before '(' */ -#define CLIENT_PROTOCOL_41 512 /* New 4.1 protocol */ -#define CLIENT_INTERACTIVE 1024 /* This is an interactive client */ -#define CLIENT_SSL 2048 /* Switch to SSL after handshake */ -#define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */ -#define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */ -#define CLIENT_RESERVED 16384 /* Old flag for 4.1 protocol */ -#define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */ -#define CLIENT_MULTI_STATEMENTS (1UL << 16) /* Enable/disable multi-stmt support */ -#define CLIENT_MULTI_RESULTS (1UL << 17) /* Enable/disable multi-results */ -#define CLIENT_PS_MULTI_RESULTS (1UL << 18) /* Multi-results in PS-protocol */ +#define CLIENT_MYSQL 1ULL /* mysql/old mariadb server/client */ +#define CLIENT_FOUND_ROWS 2ULL /* Found instead of affected rows */ +#define CLIENT_LONG_FLAG 4ULL /* Get all column flags */ +#define CLIENT_CONNECT_WITH_DB 8ULL /* One can specify db on connect */ +#define CLIENT_NO_SCHEMA 16ULL /* Don't allow database.table.column */ +#define CLIENT_COMPRESS 32ULL /* Can use compression protocol */ +#define CLIENT_ODBC 64ULL /* Odbc client */ +#define CLIENT_LOCAL_FILES 128ULL /* Can use LOAD DATA LOCAL */ +#define CLIENT_IGNORE_SPACE 256ULL /* Ignore spaces before '(' */ +#define CLIENT_PROTOCOL_41 512ULL /* New 4.1 protocol */ +#define CLIENT_INTERACTIVE 1024ULL /* This is an interactive client */ +#define CLIENT_SSL 2048ULL /* Switch to SSL after handshake */ +#define CLIENT_IGNORE_SIGPIPE 4096ULL /* IGNORE sigpipes */ +#define CLIENT_TRANSACTIONS 8192ULL /* Client knows about transactions */ +#define CLIENT_RESERVED 16384ULL /* Old flag for 4.1 protocol */ +#define CLIENT_SECURE_CONNECTION 32768ULL /* New 4.1 authentication */ +#define CLIENT_MULTI_STATEMENTS (1ULL << 16) /* Enable/disable multi-stmt support */ +#define CLIENT_MULTI_RESULTS (1ULL << 17) /* Enable/disable multi-results */ +#define CLIENT_PS_MULTI_RESULTS (1ULL << 18) /* Multi-results in PS-protocol */ -#define CLIENT_PLUGIN_AUTH (1UL << 19) /* Client supports plugin authentication */ -#define CLIENT_CONNECT_ATTRS (1UL << 20) /* Client supports connection attributes */ +#define CLIENT_PLUGIN_AUTH (1ULL << 19) /* Client supports plugin authentication */ +#define CLIENT_CONNECT_ATTRS (1ULL << 20) /* Client supports connection attributes */ /* Enable authentication response packet to be larger than 255 bytes. */ -#define CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA (1UL << 21) +#define CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA (1ULL << 21) /* Don't close the connection for a connection with expired password. */ -#define CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS (1UL << 22) +#define CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS (1ULL << 22) /** Capable of handling server state change information. Its a hint to the server to include the state change information in Ok packet. */ -#define CLIENT_SESSION_TRACK (1UL << 23) +#define CLIENT_SESSION_TRACK (1ULL << 23) /* Client no longer needs EOF packet */ -#define CLIENT_DEPRECATE_EOF (1UL << 24) +#define CLIENT_DEPRECATE_EOF (1ULL << 24) -#define CLIENT_PROGRESS_OBSOLETE (1UL << 29) -#define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30) +#define CLIENT_PROGRESS_OBSOLETE (1ULL << 29) +#define CLIENT_SSL_VERIFY_SERVER_CERT (1ULL << 30) /* It used to be that if mysql_real_connect() failed, it would delete any options set by the client, unless the CLIENT_REMEMBER_OPTIONS flag was @@ -248,7 +260,7 @@ enum enum_server_command always preserve any options set in case of failed connect, and this option is effectively always set. */ -#define CLIENT_REMEMBER_OPTIONS (1UL << 31) +#define CLIENT_REMEMBER_OPTIONS (1ULL << 31) /* MariaDB extended capability flags */ #define MARIADB_CLIENT_FLAGS_MASK 0xffffffff00000000ULL @@ -256,6 +268,8 @@ enum enum_server_command #define MARIADB_CLIENT_PROGRESS (1ULL << 32) /* support COM_MULTI */ #define MARIADB_CLIENT_COM_MULTI (1ULL << 33) +/* support of array binding */ +#define MARIADB_CLIENT_STMT_BULK_OPERATIONS (1ULL << 34) #ifdef HAVE_COMPRESS #define CAN_CLIENT_COMPRESS CLIENT_COMPRESS @@ -295,7 +309,8 @@ enum enum_server_command CLIENT_SESSION_TRACK |\ CLIENT_DEPRECATE_EOF |\ CLIENT_CONNECT_ATTRS |\ - MARIADB_CLIENT_COM_MULTI) + MARIADB_CLIENT_COM_MULTI |\ + MARIADB_CLIENT_STMT_BULK_OPERATIONS) /* To be added later: @@ -585,6 +600,8 @@ my_bool net_write_command(NET *net,unsigned char command, const unsigned char *packet, size_t len); int net_real_write(NET *net,const unsigned char *packet, size_t len); unsigned long my_net_read_packet(NET *net, my_bool read_from_server); +unsigned long my_net_read_packet_reallen(NET *net, my_bool read_from_server, + unsigned long* reallen); #define my_net_read(A) my_net_read_packet((A), 0) #ifdef MY_GLOBAL_INCLUDED diff --git a/include/sql_common.h b/include/sql_common.h index 49616f6d56c..bbf459e1e55 100644 --- a/include/sql_common.h +++ b/include/sql_common.h @@ -104,6 +104,7 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command, const unsigned char *arg, ulong arg_length, my_bool skip_check, MYSQL_STMT *stmt); unsigned long cli_safe_read(MYSQL *mysql); +unsigned long cli_safe_read_reallen(MYSQL *mysql, ulong* reallen); void net_clear_error(NET *net); void set_stmt_errmsg(MYSQL_STMT *stmt, NET *net); void set_stmt_error(MYSQL_STMT *stmt, int errcode, const char *sqlstate, diff --git a/libmariadb b/libmariadb index c8dd0899d48..cae391f7bf4 160000 --- a/libmariadb +++ b/libmariadb @@ -1 +1 @@ -Subproject commit c8dd0899d484ad698ec2da5bc8e3d19ff8b623b9 +Subproject commit cae391f7bf47f17fb246cded8ddf0ef19dbfbdec diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index b64348cdd70..62aab628ed2 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -50,7 +50,8 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc ../sql/item.cc ../sql/item_create.cc ../sql/item_func.cc ../sql/item_geofunc.cc ../sql/item_row.cc ../sql/item_strfunc.cc ../sql/item_subselect.cc ../sql/item_sum.cc ../sql/item_timefunc.cc - ../sql/item_xmlfunc.cc ../sql/key.cc ../sql/lock.cc ../sql/log.cc + ../sql/item_xmlfunc.cc ../sql/item_jsonfunc.cc + ../sql/key.cc ../sql/lock.cc ../sql/log.cc ../sql/log_event.cc ../sql/mf_iocache.cc ../sql/my_decimal.cc ../sql/net_serv.cc ../sql/opt_range.cc ../sql/opt_sum.cc ../sql/parse_file.cc ../sql/procedure.cc ../sql/protocol.cc diff --git a/libmysqld/libmysql.c b/libmysqld/libmysql.c index 379a2d15fa0..7d36931dd1f 100644 --- a/libmysqld/libmysql.c +++ b/libmysqld/libmysql.c @@ -450,8 +450,9 @@ void read_user_name(char *name) void read_user_name(char *name) { - char *str=getenv("USER"); /* ODBC will send user variable */ - strmake(name,str ? str : "ODBC", USERNAME_LENGTH); + DWORD len= USERNAME_LENGTH; + if (!GetUserName(name, &len)) + strmov(name,"UNKNOWN_USER"); } #endif diff --git a/man/mysqld_multi.1 b/man/mysqld_multi.1 index fdb073a68bf..6a52116fffe 100644 --- a/man/mysqld_multi.1 +++ b/man/mysqld_multi.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLD_MULTI\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQLD_MULTI\FR" "1" "7 December 2016" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -419,6 +419,21 @@ Be more verbose\&. .sp Display version information and exit\&. .RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqld_multi: wsrep-new-cluster option +.\" wsrep-new-cluster option: mysqld_multi +\fB\-\-wsrep\-new\-cluster\fR +.sp +Bootstrap a cluster\&. +.RE .PP Some notes about \fBmysqld_multi\fR: @@ -653,7 +668,7 @@ user = jani .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2016 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mysqldump.1 b/man/mysqldump.1 index a734d5eeb70..ebd3b1fc896 100644 --- a/man/mysqldump.1 +++ b/man/mysqldump.1 @@ -753,6 +753,29 @@ suppresses date printing\& .sp -1 .IP \(bu 2.3 .\} +.\" mysqldump: dump-slave option +.\" dump-slave option: mysqldump +\fB\-\-dump\-slave[=\fR\fB\fIvalue\fR\fR\fB]\fR +.sp +Used for producing a dump file from a replication slave server that can be used to set up another slave server +with the same master\&. Causes the binary log position and filename of the master to be appended to the dumped +data output\&. Setting the value to 1 (the default) will print it as a CHANGE MASTER command in the dumped data +output; if set to 2, that command will be prefixed with a comment symbol\&. This option will turn +\-\-lock\-all\-tables on, unless \-\-single-transaction is specified too (in which case a global read lock is only +taken a short time at the beginning of the dump \- don't forget to read about \-\-single-transaction below)\&. In +all cases any action on logs will happen at the exact moment of the dump\&. Option automatically turns +\-\-lock\-tables off\&. Using this option causes mysqldump to stop the slave SQL thread before beginning the dump, +and restart it again after completion\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqldump: events option .\" events option: mysqldump \fB\-\-events\fR, diff --git a/mysql-test/suite/binlog/t/binlog_incident-master.opt b/mysql-test/extra/binlog_tests/binlog_incident-master.opt similarity index 100% rename from mysql-test/suite/binlog/t/binlog_incident-master.opt rename to mysql-test/extra/binlog_tests/binlog_incident-master.opt diff --git a/mysql-test/extra/binlog_tests/binlog_incident.inc b/mysql-test/extra/binlog_tests/binlog_incident.inc new file mode 100644 index 00000000000..8ec67746f26 --- /dev/null +++ b/mysql-test/extra/binlog_tests/binlog_incident.inc @@ -0,0 +1,68 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# +# Usage: +# +# --let $use_remote_mysqlbinlog= 1 # optional +# --let $binlog_start_pos= # optional +# --let $binlog_file= # optional +# +# --source extra/binlog_tests/binlog_incident.inc +# +# The script uses MYSQLBINLOG to verify certain results. +# By default, it uses binary logs directly. If it is undesirable, +# this behavior can be overridden by setting $use_remote_binlog +# as shown above. +# +# All values will be unset after every execution of the script, +# so if they are needed, they should be set explicitly before each call. +# + +# The purpose of this test is to provide a reference for how the +# incident log event is represented in the output from the mysqlbinlog +# program. + +source include/have_log_bin.inc; +source include/have_debug.inc; +source include/binlog_start_pos.inc; + +let $MYSQLD_DATADIR= `select @@datadir`; +RESET MASTER; + +CREATE TABLE t1 (a INT); + +INSERT INTO t1 VALUES (1),(2),(3); +SELECT * FROM t1; + +# This will generate an incident log event and store it in the binary +# log before the replace statement. +REPLACE INTO t1 VALUES (4); + +DROP TABLE t1; +FLUSH LOGS; + +if ($binlog_start_pos) +{ + --let $startpos= --start-position=$binlog_start_pos + --let $binlog_start_pos= +} +--let $filename= master-bin.000001 +if ($binlog_file) +{ + --let $filename= $binlog_file + --let $binlog_file= +} +--let $mysqlbinlog_args= $MYSQLD_DATADIR/$filename +if ($use_remote_mysqlbinlog) +{ + --let $mysqlbinlog_args= --read-from-remote-server --protocol=tcp --host=127.0.0.1 --port=$MASTER_MYPORT -uroot $filename + --let $use_remote_mysqlbinlog= 0 +} +exec $MYSQL_BINLOG $startpos $mysqlbinlog_args >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql; +--disable_query_log +eval SELECT cont LIKE '%RELOAD DATABASE; # Shall generate syntax error%' AS `Contain RELOAD DATABASE` FROM (SELECT load_file('$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql') AS cont) AS tbl; +--enable_query_log + +remove_file $MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql; diff --git a/mysql-test/extra/binlog_tests/binlog_index.inc b/mysql-test/extra/binlog_tests/binlog_index.inc new file mode 100644 index 00000000000..50215aef9a9 --- /dev/null +++ b/mysql-test/extra/binlog_tests/binlog_index.inc @@ -0,0 +1,278 @@ +# +# This include file is used by more than one test suite +# (currently binlog and binlog_encryption). +# Please check all dependent tests after modifying it +# + +# +# testing of purging of binary log files bug#18199/Bug#18453 +# +source include/have_log_bin.inc; +source include/not_embedded.inc; +# Don't test this under valgrind, memory leaks will occur +--source include/not_valgrind.inc +source include/have_debug.inc; +# Avoid CrashReporter popup on Mac +--source include/not_crashrep.inc +call mtr.add_suppression('Attempting backtrace'); +call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to process registered files that would be purged.'); +call mtr.add_suppression('MYSQL_BIN_LOG::open failed to sync the index file'); +call mtr.add_suppression('Turning logging off for the whole duration of the MySQL server process.'); +call mtr.add_suppression('Could not open .*'); +call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to clean registers before purging logs.'); +flush tables; + +let $old=`select @@debug`; + +RESET MASTER; + +let $MYSQLD_DATADIR= `select @@datadir`; +let $INDEX=$MYSQLD_DATADIR/master-bin.index; + +# +# testing purge binary logs TO +# + +flush logs; +flush logs; +flush logs; + +source include/show_binary_logs.inc; +remove_file $MYSQLD_DATADIR/master-bin.000001; +flush tables; + +# there must be a warning with file names +replace_regex /\.[\\\/]master/master/; +--source include/wait_for_binlog_checkpoint.inc +purge binary logs TO 'master-bin.000004'; + +--echo *** must show a list starting from the 'TO' argument of PURGE *** +source include/show_binary_logs.inc; + +# +# testing purge binary logs BEFORE +# + +reset master; + +flush logs; +flush logs; +flush logs; +remove_file $MYSQLD_DATADIR/master-bin.000001; + +--echo *** must be a warning master-bin.000001 was not found *** +let $date=`select NOW() + INTERVAL 1 MINUTE`; +--disable_query_log +replace_regex /\.[\\\/]master/master/; +--source include/wait_for_binlog_checkpoint.inc +eval purge binary logs BEFORE '$date'; +--enable_query_log + +--echo *** must show one record, of the active binlog, left in the index file after PURGE *** +source include/show_binary_logs.inc; + +# +# testing a fatal error +# Turning a binlog file into a directory must be a portable setup +# + +reset master; + +flush logs; +flush logs; +flush logs; + +remove_file $MYSQLD_DATADIR/master-bin.000001; +mkdir $MYSQLD_DATADIR/master-bin.000001; + +--source include/wait_for_binlog_checkpoint.inc +--error ER_BINLOG_PURGE_FATAL_ERR +purge binary logs TO 'master-bin.000002'; +replace_regex /\.[\\\/]master/master/; +show warnings; +rmdir $MYSQLD_DATADIR/master-bin.000001; +--disable_warnings +reset master; +--enable_warnings + +--echo # crash_purge_before_update_index +flush logs; + +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +SET SESSION debug_dbug="+d,crash_purge_before_update_index"; +--source include/wait_for_binlog_checkpoint.inc +--error 2013 +purge binary logs TO 'master-bin.000002'; + +--enable_reconnect +--source include/wait_until_connected_again.inc + +file_exists $MYSQLD_DATADIR/master-bin.000001; +file_exists $MYSQLD_DATADIR/master-bin.000002; +file_exists $MYSQLD_DATADIR/master-bin.000003; +--chmod 0644 $INDEX +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SET @index=LOAD_FILE('$index') +-- replace_regex /\.[\\\/]master/master/ +SELECT @index; + +--echo # crash_purge_non_critical_after_update_index +flush logs; + +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +SET SESSION debug_dbug="+d,crash_purge_non_critical_after_update_index"; +--source include/wait_for_binlog_checkpoint.inc +--error 2013 +purge binary logs TO 'master-bin.000004'; + +--enable_reconnect +--source include/wait_until_connected_again.inc + +--error 1 +file_exists $MYSQLD_DATADIR/master-bin.000001; +--error 1 +file_exists $MYSQLD_DATADIR/master-bin.000002; +--error 1 +file_exists $MYSQLD_DATADIR/master-bin.000003; +--chmod 0644 $INDEX +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SET @index=LOAD_FILE('$index') +-- replace_regex /\.[\\\/]master/master/ +SELECT @index; + +--echo # crash_purge_critical_after_update_index +flush logs; + +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +SET SESSION debug_dbug="+d,crash_purge_critical_after_update_index"; +--source include/wait_for_binlog_checkpoint.inc +--error 2013 +purge binary logs TO 'master-bin.000006'; + +--enable_reconnect +--source include/wait_until_connected_again.inc + +--error 1 +file_exists $MYSQLD_DATADIR/master-bin.000004; +--error 1 +file_exists $MYSQLD_DATADIR/master-bin.000005; +file_exists $MYSQLD_DATADIR/master-bin.000006; +file_exists $MYSQLD_DATADIR/master-bin.000007; +--error 1 +file_exists $MYSQLD_DATADIR/master-bin.000008; +--chmod 0644 $INDEX +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SET @index=LOAD_FILE('$index') +-- replace_regex /\.[\\\/]master/master/ +SELECT @index; + +--echo # crash_create_non_critical_before_update_index +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +SET SESSION debug_dbug="+d,crash_create_non_critical_before_update_index"; +--error 2013 +flush logs; + +--enable_reconnect +--source include/wait_until_connected_again.inc + +file_exists $MYSQLD_DATADIR/master-bin.000008; +--error 1 +file_exists $MYSQLD_DATADIR/master-bin.000009; +--chmod 0644 $INDEX +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SET @index=LOAD_FILE('$index') +-- replace_regex /\.[\\\/]master/master/ +SELECT @index; + +--echo # crash_create_critical_before_update_index +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +SET SESSION debug_dbug="+d,crash_create_critical_before_update_index"; +--error 2013 +flush logs; + +--enable_reconnect +--source include/wait_until_connected_again.inc + +file_exists $MYSQLD_DATADIR/master-bin.000009; +--error 1 +file_exists $MYSQLD_DATADIR/master-bin.000010; +--error 1 +file_exists $MYSQLD_DATADIR/master-bin.000011; +--chmod 0644 $INDEX +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SET @index=LOAD_FILE('$index') +-- replace_regex /\.[\\\/]master/master/ +SELECT @index; + +--echo # crash_create_after_update_index +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +SET SESSION debug_dbug="+d,crash_create_after_update_index"; +--error 2013 +flush logs; + +--enable_reconnect +--source include/wait_until_connected_again.inc + +file_exists $MYSQLD_DATADIR/master-bin.000010; +file_exists $MYSQLD_DATADIR/master-bin.000011; +--chmod 0644 $INDEX +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SET @index=LOAD_FILE('$index') +-- replace_regex /\.[\\\/]master/master/ +SELECT @index; + +--echo # +--echo # This should put the server in unsafe state and stop +--echo # accepting any command. If we inject a fault at this +--echo # point and continue the execution the server crashes. +--echo # + +--chmod 0644 $INDEX +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SET @index=LOAD_FILE('$index') +-- replace_regex /\.[\\\/]master/master/ +SELECT @index; + +--echo # fault_injection_registering_index +SET SESSION debug_dbug="+d,fault_injection_registering_index"; +-- replace_regex /\.[\\\/]master/master/ +-- error ER_CANT_OPEN_FILE +flush logs; + +--chmod 0644 $INDEX +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SET @index=LOAD_FILE('$index') +-- replace_regex /\.[\\\/]master/master/ +SELECT @index; + +--source include/restart_mysqld.inc + +--chmod 0644 $INDEX +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SET @index=LOAD_FILE('$index') +-- replace_regex /\.[\\\/]master/master/ +SELECT @index; + +--echo # fault_injection_updating_index +SET SESSION debug_dbug="+d,fault_injection_updating_index"; +-- replace_regex /\.[\\\/]master/master/ +-- error ER_CANT_OPEN_FILE +flush logs; + +--chmod 0644 $INDEX +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SET @index=LOAD_FILE('$index') +-- replace_regex /\.[\\\/]master/master/ +SELECT @index; + +--source include/restart_mysqld.inc + +--chmod 0644 $INDEX +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SET @index=LOAD_FILE('$index') +-- replace_regex /\.[\\\/]master/master/ +SELECT @index; + +eval SET SESSION debug_dbug="$old"; + +--echo End of tests diff --git a/mysql-test/extra/binlog_tests/binlog_ioerr.inc b/mysql-test/extra/binlog_tests/binlog_ioerr.inc new file mode 100644 index 00000000000..8d1069bacb0 --- /dev/null +++ b/mysql-test/extra/binlog_tests/binlog_ioerr.inc @@ -0,0 +1,36 @@ +# +# This include file is used by more than one test suite +# (currently binlog and binlog_encryption). +# Please check all dependent tests after modifying it +# + +source include/have_debug.inc; +source include/have_innodb.inc; +source include/have_log_bin.inc; +source include/have_binlog_format_mixed_or_statement.inc; + +CALL mtr.add_suppression("Error writing file 'master-bin'"); + +RESET MASTER; + +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb; +INSERT INTO t1 VALUES(0); +SET SESSION debug_dbug='+d,fail_binlog_write_1'; +--error ER_ERROR_ON_WRITE +INSERT INTO t1 VALUES(1); +--error ER_ERROR_ON_WRITE +INSERT INTO t1 VALUES(2); +SET SESSION debug_dbug=''; +INSERT INTO t1 VALUES(3); +SELECT * FROM t1; + +# Actually the output from this currently shows a bug. +# The injected IO error leaves partially written transactions in the binlog in +# the form of stray "BEGIN" events. +# These should disappear from the output if binlog error handling is improved +# (see MySQL Bug#37148 and WL#1790). +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/ +--replace_column 1 BINLOG 2 POS 5 ENDPOS +SHOW BINLOG EVENTS; + +DROP TABLE t1; diff --git a/mysql-test/extra/binlog_tests/binlog_mysqlbinlog-cp932.inc b/mysql-test/extra/binlog_tests/binlog_mysqlbinlog-cp932.inc new file mode 100644 index 00000000000..ac637b2da03 --- /dev/null +++ b/mysql-test/extra/binlog_tests/binlog_mysqlbinlog-cp932.inc @@ -0,0 +1,50 @@ +# +# This include file is used by more than one test suite +# (currently binlog and binlog_encryption). +# Please check all dependent tests after modifying it +# +# Usage: +# --let $use_remote_mysqlbinlog= 1 # optional +# --source extra/binlog_tests/binlog_mysqlbinlog-cp932.inc +# +# By default, the script calls mysqlbinlog to read binary logs directly. +# If it is undesirable, this behavior can be overridden by setting +# $use_remote_binlog as shown above. +# The value will be unset after every execution of the script, +# so if it is needed, it should be set explicitly before each call. + + +# disabled in embedded until tools running is fixed with embedded +--source include/not_embedded.inc + +-- source include/have_binlog_format_mixed_or_statement.inc +-- source include/have_cp932.inc +-- source include/have_log_bin.inc + +RESET MASTER; + +# Bug#16217 (mysql client did not know how not switch its internal charset) +create table t3 (f text character set utf8); +create table t4 (f text character set cp932); +--exec $MYSQL --default-character-set=utf8 test -e "insert into t3 values(_utf8'ソ')" +--exec $MYSQL --default-character-set=cp932 test -e "insert into t4 values(_cp932'ƒ\');" +flush logs; +rename table t3 to t03, t4 to t04; +let $MYSQLD_DATADIR= `select @@datadir`; + +--let $mysqlbinlog_args= $MYSQLD_DATADIR/master-bin.000001 +if ($use_remote_mysqlbinlog) +{ + --let $mysqlbinlog_args= --read-from-remote-server --protocol=tcp --host=127.0.0.1 --port=$MASTER_MYPORT -uroot master-bin.000001 + --let $use_remote_mysqlbinlog= 0 +} + +--exec $MYSQL_BINLOG --short-form $mysqlbinlog_args | $MYSQL --default-character-set=utf8 +# original and recovered data must be equal +select HEX(f) from t03; +select HEX(f) from t3; +select HEX(f) from t04; +select HEX(f) from t4; + +drop table t3, t4, t03, t04; +--echo End of 5.0 tests diff --git a/mysql-test/extra/binlog_tests/binlog_row_annotate.inc b/mysql-test/extra/binlog_tests/binlog_row_annotate.inc new file mode 100644 index 00000000000..e53f49149f1 --- /dev/null +++ b/mysql-test/extra/binlog_tests/binlog_row_annotate.inc @@ -0,0 +1,192 @@ +# +# This include file is used by more than one test suite +# (currently binlog and binlog_encryption). +# Please check all dependent tests after modifying it +# +# Usage: +# --let use_remote_mysqlbinlog= 1 # optional +# --source extra/binlog_tests/binlog_row_annotate.inc +# +# By default, the script uses mysqlbinlog both with direct access to files +# and via connection to the server. In some cases, direct access to files +# might be impossible (e.g. with encryption). If use_remote_mysqlbinlog +# flag is set, this part of the logic will be omitted. +# + +############################################################################### +# WL47: Store in binlog text of statements that caused RBR events +# new event: ANNOTATE_ROWS_EVENT +# new master option: --binlog-annotate-row-events +# new mysqlbinlog option: --skip-annotate-row-events +# +# Intended to test that: +# *** If the --binlog-annotate-row-events option is switched on on master +# then Annotate_rows events: +# - are generated; +# - are generated only once for "multi-table-maps" rbr queries; +# - are not generated when the corresponding queries are filtered away; +# - are generated when the corresponding queries are filtered away partialy +# (e.g. in case of multi-delete). +# *** Annotate_rows events are printed by mysqlbinlog started without +# --skip-annotate-row-events options both in remote and local cases. +# *** Annotate_rows events are not printed by mysqlbinlog started with +# --skip-annotate-row-events options both in remote and local cases. +############################################################################### + +set @old_binlog_checksum=@@binlog_checksum; +set global binlog_checksum=NONE; +--let datadir= `select @@datadir` + +--source include/have_log_bin.inc +--source include/binlog_start_pos.inc +--source include/have_binlog_format_row.inc + +set sql_mode=""; + +# Fix timestamp to avoid varying results +SET timestamp=1000000000; + +# Delete all existing binary logs +RESET MASTER; + +CREATE DATABASE test1; +CREATE TABLE test1.t1(a int); + +CREATE DATABASE test2; +CREATE TABLE test2.t2(a int); +CREATE VIEW test2.v2 AS SELECT * FROM test2.t2; + +CREATE DATABASE test3; +CREATE TABLE test3.t3(a int); + +CREATE DATABASE xtest1; +CREATE TABLE xtest1.xt1(a int); + +CREATE DATABASE xtest2; +CREATE TABLE xtest2.xt2(a int); + +# By default SESSION binlog_annotate_row_events = OFF + +INSERT INTO test1.t1 VALUES (1), (2), (3); + +SET SESSION binlog_annotate_row_events = ON; + +INSERT INTO test2.t2 VALUES (1), (2), (3); +INSERT INTO test3.t3 VALUES (1), (2), (3); + +# This query generates two Table maps but the Annotate +# event should appear only once before the first Table map +DELETE test1.t1, test2.t2 + FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3 + WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3.a; + +# This event should be filtered out together with Annotate event +INSERT INTO xtest1.xt1 VALUES (1), (2), (3); + +# This event should pass the filter +INSERT INTO test2.v2 VALUES (1), (2), (3); + +# This event should pass the filter only for test2.t2 part +DELETE xtest1.xt1, test2.t2 + FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3 + WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3.a; + +# These events should be filtered out together with Annotate events +INSERT INTO xtest1.xt1 VALUES (1), (2), (3); +INSERT INTO xtest2.xt2 VALUES (1), (2), (3); +DELETE xtest1.xt1, xtest2.xt2 + FROM xtest1.xt1 INNER JOIN xtest2.xt2 INNER JOIN test3.t3 + WHERE xtest1.xt1.a=xtest2.xt2.a AND xtest2.xt2.a=test3.t3.a; + +FLUSH LOGS; + +--echo ##################################################################################### +--echo # The following Annotate_rows events should appear below: +--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3) +--echo # - INSERT INTO test3.t3 VALUES (1), (2), (3) +--echo # - DELETE test1.t1, test2.t2 FROM <...> +--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3) +--echo # - DELETE xtest1.xt1, test2.t2 FROM <...> +--echo ##################################################################################### + +--source include/show_binlog_events.inc + +if (!$use_remote_mysqlbinlog) +{ + --echo # + --echo ##################################################################################### + --echo # mysqlbinlog + --echo # The following Annotates should appear in this output: + --echo # - INSERT INTO test2.t2 VALUES (1), (2), (3) + --echo # - INSERT INTO test3.t3 VALUES (1), (2), (3) + --echo # - DELETE test1.t1, test2.t2 FROM <...> (with two subsequent Table maps) + --echo # - INSERT INTO test2.t2 VALUES (1), (2), (3) + --echo # - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map) + --echo ##################################################################################### + + --replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ + --exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $datadir/master-bin.000001 + + --echo # + --echo ##################################################################################### + --echo # mysqlbinlog --database=test1 + --echo # The following Annotate should appear in this output: + --echo # - DELETE test1.t1, test2.t2 FROM <...> + --echo ##################################################################################### + + --replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ + --exec $MYSQL_BINLOG --base64-output=decode-rows --database=test1 -v -v $datadir/master-bin.000001 + + --echo # + --echo ##################################################################################### + --echo # mysqlbinlog --skip-annotate-row-events + --echo # No Annotates should appear in this output + --echo ##################################################################################### + + --replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ + --exec $MYSQL_BINLOG --base64-output=decode-rows --skip-annotate-row-events -v -v $datadir/master-bin.000001 + + --let use_remote_mysqlbinlog= 0 +} + +--echo # +--echo ##################################################################################### +--echo # mysqlbinlog --read-from-remote-server +--echo # The following Annotates should appear in this output: +--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3) +--echo # - INSERT INTO test3.t3 VALUES (1), (2), (3) +--echo # - DELETE test1.t1, test2.t2 FROM <...> (with two subsequent Table maps) +--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3) +--echo # - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map) +--echo ##################################################################################### + +--replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ +--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v --read-from-remote-server --user=root --host=localhost --port=$MASTER_MYPORT master-bin.000001 + +--echo # +--echo ##################################################################################### +--echo # mysqlbinlog --read-from-remote-server --database=test1 +--echo # The following Annotate should appear in this output: +--echo # - DELETE test1.t1, test2.t2 FROM <...> +--echo ##################################################################################### + +--replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ +--exec $MYSQL_BINLOG --base64-output=decode-rows --database=test1 -v -v --read-from-remote-server --user=root --host=localhost --port=$MASTER_MYPORT master-bin.000001 + +--echo # +--echo ##################################################################################### +--echo # mysqlbinlog --read-from-remote-server --skip-annotate-row-events +--echo # No Annotates should appear in this output +--echo ##################################################################################### + +--replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ +--exec $MYSQL_BINLOG --base64-output=decode-rows --skip-annotate-row-events -v -v --read-from-remote-server --user=root --host=localhost --port=$MASTER_MYPORT master-bin.000001 + +# Clean-up + +set global binlog_checksum=@old_binlog_checksum; +DROP DATABASE test1; +DROP DATABASE test2; +DROP DATABASE test3; +DROP DATABASE xtest1; +DROP DATABASE xtest2; diff --git a/mysql-test/extra/binlog_tests/binlog_write_error.inc b/mysql-test/extra/binlog_tests/binlog_write_error.inc new file mode 100644 index 00000000000..da66dbf5a95 --- /dev/null +++ b/mysql-test/extra/binlog_tests/binlog_write_error.inc @@ -0,0 +1,108 @@ +# +# This include file is used by more than one test suite +# (currently binlog and binlog_encryption). +# Please check all dependent tests after modifying it +# + +# +# === Name === +# +# binlog_write_error.test +# +# === Description === +# +# This test case check if the error of writing binlog file is properly +# reported and handled when executing statements. +# +# === Related Bugs === +# +# BUG#37148 +# + +source include/have_log_bin.inc; +source include/have_debug.inc; +source include/have_binlog_format_mixed_or_statement.inc; + +--echo # +--echo # Initialization +--echo # + +disable_warnings; +DROP TABLE IF EXISTS t1, t2; +DROP FUNCTION IF EXISTS f1; +DROP FUNCTION IF EXISTS f2; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p2; +DROP TRIGGER IF EXISTS tr1; +DROP TRIGGER IF EXISTS tr2; +DROP VIEW IF EXISTS v1, v2; +enable_warnings; + +--echo # +--echo # Test injecting binlog write error when executing queries +--echo # + +let $query= CREATE TABLE t1 (a INT); +source include/binlog_inject_error.inc; + +INSERT INTO t1 VALUES (1),(2),(3); + +let $query= INSERT INTO t1 VALUES (4),(5),(6); +source include/binlog_inject_error.inc; + +let $query= UPDATE t1 set a=a+1; +source include/binlog_inject_error.inc; + +let $query= DELETE FROM t1; +source include/binlog_inject_error.inc; + +let $query= CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t1 VALUES (new.a + 100); +source include/binlog_inject_error.inc; + +let $query= DROP TRIGGER tr1; +source include/binlog_inject_error.inc; + +let $query= ALTER TABLE t1 ADD (b INT); +source include/binlog_inject_error.inc; + +let $query= CREATE VIEW v1 AS SELECT a FROM t1; +source include/binlog_inject_error.inc; + +let $query= DROP VIEW v1; +source include/binlog_inject_error.inc; + +let $query= CREATE PROCEDURE p1(OUT rows INT) SELECT count(*) INTO rows FROM t1; +source include/binlog_inject_error.inc; + +let $query= DROP PROCEDURE p1; +source include/binlog_inject_error.inc; + +let $query= DROP TABLE t1; +source include/binlog_inject_error.inc; + +let $query= CREATE FUNCTION f1() RETURNS INT return 1; +source include/binlog_inject_error.inc; + +let $query= DROP FUNCTION f1; +source include/binlog_inject_error.inc; + +let $query= CREATE USER user1; +source include/binlog_inject_error.inc; + +let $query= REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1; +source include/binlog_inject_error.inc; + +let $query= DROP USER user1; +source include/binlog_inject_error.inc; + +--echo # +--echo # Cleanup +--echo # + +disable_warnings; +DROP TABLE IF EXISTS t1, t2; +DROP FUNCTION IF EXISTS f1; +DROP PROCEDURE IF EXISTS p1; +DROP TRIGGER IF EXISTS tr1; +DROP VIEW IF EXISTS v1, v2; +enable_warnings; diff --git a/mysql-test/extra/binlog_tests/binlog_xa_recover.inc b/mysql-test/extra/binlog_tests/binlog_xa_recover.inc new file mode 100644 index 00000000000..de2703377cc --- /dev/null +++ b/mysql-test/extra/binlog_tests/binlog_xa_recover.inc @@ -0,0 +1,281 @@ +# +# This include file is used by more than one test suite +# (currently binlog and binlog_encryption). +# Please check all dependent tests after modifying it +# + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_binlog_format_row.inc +# Valgrind does not work well with test that crashes the server +--source include/not_valgrind.inc + +# (We do not need to restore these settings, as we crash the server). +SET GLOBAL max_binlog_size= 4096; +SET GLOBAL innodb_flush_log_at_trx_commit= 1; +RESET MASTER; + +CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb; +# Insert some data to force a couple binlog rotations (3), so we get some +# normal binlog checkpoints before starting the test. +INSERT INTO t1 VALUES (100, REPEAT("x", 4100)); +# Wait for the master-bin.000002 binlog checkpoint to appear. +--let $wait_for_all= 0 +--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000002" +--let $field= Info +--let $condition= = "master-bin.000002" +--source include/wait_show_condition.inc +INSERT INTO t1 VALUES (101, REPEAT("x", 4100)); +--let $wait_for_all= 0 +--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000003" +--let $field= Info +--let $condition= = "master-bin.000003" +--source include/wait_show_condition.inc +INSERT INTO t1 VALUES (102, REPEAT("x", 4100)); +--let $wait_for_all= 0 +--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004" +--let $field= Info +--let $condition= = "master-bin.000004" +--source include/wait_show_condition.inc + +# Now start a bunch of transactions that span multiple binlog +# files. Leave then in the state prepared-but-not-committed in the engine +# and crash the server. Check that crash recovery is able to recover all +# of them. +# +# We use debug_sync to get all the transactions into the prepared state before +# we commit any of them. This is because the prepare step flushes the InnoDB +# redo log - including any commits made before, so recovery would become +# unnecessary, decreasing the value of this test. +# +# We arrange to have con1 with a prepared transaction in master-bin.000004, +# con2 and con3 with a prepared transaction in master-bin.000005, and a new +# empty master-bin.000006. So the latest binlog checkpoint should be +# master-bin.000006. + +connect(con1,localhost,root,,); +# First wait after prepare and before write to binlog. +SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con1_wait WAIT_FOR con1_cont"; +# Then complete InnoDB commit in memory (but not commit checkpoint / write to +# disk), and hang until crash, leaving a transaction to be XA recovered. +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR _ever"; +send INSERT INTO t1 VALUES (1, REPEAT("x", 4100)); + +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con1_wait"; + +connect(con2,localhost,root,,); +SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con2_wait WAIT_FOR con2_cont"; +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con2_ready WAIT_FOR _ever"; +send INSERT INTO t1 VALUES (2, NULL); + +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con2_wait"; + +connect(con3,localhost,root,,); +SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con3_wait WAIT_FOR con3_cont"; +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con3_ready WAIT_FOR _ever"; +send INSERT INTO t1 VALUES (3, REPEAT("x", 4100)); + +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con3_wait"; + +connect(con4,localhost,root,,); +SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con4_wait WAIT_FOR con4_cont"; +SET SESSION debug_dbug="+d,crash_commit_after_log"; +send INSERT INTO t1 VALUES (4, NULL); + +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con4_wait"; + +SET DEBUG_SYNC= "now SIGNAL con1_cont"; +SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; +SET DEBUG_SYNC= "now SIGNAL con2_cont"; +SET DEBUG_SYNC= "now WAIT_FOR con2_ready"; +SET DEBUG_SYNC= "now SIGNAL con3_cont"; +SET DEBUG_SYNC= "now WAIT_FOR con3_ready"; + +# Check that everything is committed in binary log. +--source include/show_binary_logs.inc +--let $binlog_file= master-bin.000003 +--let $binlog_start= 4 +--source include/show_binlog_events.inc +--let $binlog_file= master-bin.000004 +--source include/show_binlog_events.inc +--let $binlog_file= master-bin.000005 +--source include/show_binlog_events.inc +--let $binlog_file= master-bin.000006 +--source include/show_binlog_events.inc + + +# Check that server will not purge too much. +PURGE BINARY LOGS TO "master-bin.000006"; +--source include/show_binary_logs.inc + +# Now crash the server with one more transaction in prepared state. +--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +wait-binlog_xa_recover.test +EOF +--error 0,2006,2013 +SET DEBUG_SYNC= "now SIGNAL con4_cont"; +connection con4; +--error 2006,2013 +reap; + +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +restart-group_commit_binlog_pos.test +EOF + +connection default; +--enable_reconnect +--source include/wait_until_connected_again.inc + +# Check that all transactions are recovered. +SELECT a FROM t1 ORDER BY a; + +--echo Test that with multiple binlog checkpoints, recovery starts from the last one. +SET GLOBAL max_binlog_size= 4096; +SET GLOBAL innodb_flush_log_at_trx_commit= 1; +RESET MASTER; + +# Rotate to binlog master-bin.000003 while delaying binlog checkpoints. +# So we get multiple binlog checkpoints in master-bin.000003. +# Then complete the checkpoints, crash, and check that we only scan +# the necessary binlog file (ie. that we use the _last_ checkpoint). + +connect(con10,localhost,root,,); +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con10_ready WAIT_FOR con10_cont"; +send INSERT INTO t1 VALUES (10, REPEAT("x", 4100)); + +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con10_ready"; + +connect(con11,localhost,root,,); +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con11_ready WAIT_FOR con11_cont"; +send INSERT INTO t1 VALUES (11, REPEAT("x", 4100)); + +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con11_ready"; + +connect(con12,localhost,root,,); +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con12_ready WAIT_FOR con12_cont"; +send INSERT INTO t1 VALUES (12, REPEAT("x", 4100)); + +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con12_ready"; +INSERT INTO t1 VALUES (13, NULL); + +--source include/show_binary_logs.inc +--let $binlog_file= master-bin.000004 +--let $binlog_start= 4 +--source include/show_binlog_events.inc + +SET DEBUG_SYNC= "now SIGNAL con10_cont"; +connection con10; +reap; +connection default; + +# We need to sync the test case with the background processing of the +# commit checkpoint, otherwise we get nondeterministic results. +SET @old_dbug= @@global.DEBUG_DBUG; +SET GLOBAL debug_dbug="+d,binlog_background_checkpoint_processed"; + +SET DEBUG_SYNC= "now SIGNAL con12_cont"; +connection con12; +reap; +connection default; +SET DEBUG_SYNC= "now WAIT_FOR binlog_background_checkpoint_processed"; +SET GLOBAL debug_dbug= @old_dbug; + +SET DEBUG_SYNC= "now SIGNAL con11_cont"; +connection con11; +reap; + +connection default; +# Wait for the last (master-bin.000004) binlog checkpoint to appear. +--let $wait_for_all= 0 +--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004" +--let $field= Info +--let $condition= = "master-bin.000004" +--source include/wait_show_condition.inc + +--echo Checking that master-bin.000004 is the last binlog checkpoint +--source include/show_binlog_events.inc + +--echo Now crash the server +# It is not too easy to test XA recovery, as it runs early during server +# startup, before any connections can be made. +# What we do is set a DBUG error insert which will crash if XA recovery +# starts from any other binlog than master-bin.000004 (check the file +# binlog_xa_recover-master.opt). Then we will fail here if XA recovery +# would start from the wrong place. +--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +wait-binlog_xa_recover.test +EOF +SET SESSION debug_dbug="+d,crash_commit_after_log"; +--error 2006,2013 +INSERT INTO t1 VALUES (14, NULL); + +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +restart-group_commit_binlog_pos.test +EOF + +connection default; +--enable_reconnect +--source include/wait_until_connected_again.inc + +# Check that all transactions are recovered. +SELECT a FROM t1 ORDER BY a; + + +--echo *** Check that recovery works if we crashed early during rotate, before +--echo *** binlog checkpoint event could be written. + +SET GLOBAL max_binlog_size= 4096; +SET GLOBAL innodb_flush_log_at_trx_commit= 1; +RESET MASTER; + +# We need some initial data to reach binlog master-bin.000004. Otherwise +# crash recovery fails due to the error insert used for previous test. +INSERT INTO t1 VALUES (21, REPEAT("x", 4100)); +INSERT INTO t1 VALUES (22, REPEAT("x", 4100)); +# Wait for the master-bin.000003 binlog checkpoint to appear. +--let $wait_for_all= 0 +--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000003" +--let $field= Info +--let $condition= = "master-bin.000003" +--source include/wait_show_condition.inc +INSERT INTO t1 VALUES (23, REPEAT("x", 4100)); +# Wait for the last (master-bin.000004) binlog checkpoint to appear. +--let $wait_for_all= 0 +--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004" +--let $field= Info +--let $condition= = "master-bin.000004" +--source include/wait_show_condition.inc + +--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +wait-binlog_xa_recover.test +EOF +SET SESSION debug_dbug="+d,crash_before_write_checkpoint_event"; +--error 2006,2013 +INSERT INTO t1 VALUES (24, REPEAT("x", 4100)); + +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +restart-group_commit_binlog_pos.test +EOF + +--enable_reconnect +--source include/wait_until_connected_again.inc + +# Check that all transactions are recovered. +SELECT a FROM t1 ORDER BY a; + +--source include/show_binary_logs.inc +--let $binlog_file= master-bin.000004 +--let $binlog_start= 4 +--source include/show_binlog_events.inc + +# Cleanup +connection default; +DROP TABLE t1; diff --git a/mysql-test/extra/binlog_tests/ctype_ucs_binlog.result b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.result new file mode 100644 index 00000000000..c358cfcd4f2 --- /dev/null +++ b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.result @@ -0,0 +1,212 @@ +SET TIMESTAMP=10000; +create table t2 (c char(30)) charset=ucs2; +set @v=convert('abc' using ucs2); +reset master; +insert into t2 values (@v); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # User var # # @`v`=_ucs2 X'006100620063' COLLATE ucs2_general_ci +master-bin.000001 # Query # # use `test`; insert into t2 values (@v) +master-bin.000001 # Query # # COMMIT +flush logs; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +DELIMITER /*!*/; +ROLLBACK/*!*/; +BEGIN +/*!*/; +SET @`v`:=_ucs2 X'006100620063' COLLATE `ucs2_general_ci`/*!*/; +use `test`/*!*/; +SET TIMESTAMP=10000/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.sql_mode=1342177280/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; +insert into t2 values (@v) +/*!*/; +SET TIMESTAMP=10000/*!*/; +COMMIT +/*!*/; +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; +drop table t2; +# +# Start of 10.2 tests +# +# +# MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions +# +FLUSH LOGS; +SET NAMES utf8; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8); +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (''ä(i1)'')'; +EXECUTE IMMEDIATE CONVERT('INSERT INTO t1 VALUES (''ä(i2)'')' USING ucs2); +SET @stmt=CONVERT('INSERT INTO t1 VALUES (''ä(i3)'')' USING ucs2); +EXECUTE IMMEDIATE @stmt; +PREPARE stmt FROM 'INSERT INTO t1 VALUES (''ä(p1)'')'; +EXECUTE stmt; +PREPARE stmt FROM CONVERT('INSERT INTO t1 VALUES (''ä(p2)'')' USING ucs2); +EXECUTE stmt; +SET @stmt=CONVERT('INSERT INTO t1 VALUES (''ä(p3)'')' USING ucs2); +PREPARE stmt FROM @stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +SELECT * FROM t1; +a +ä(i1) +ä(i2) +ä(i3) +ä(p1) +ä(p2) +ä(p3) +DROP TABLE t1; +FLUSH LOGS; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +DELIMITER /*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Start: binlog v 4, server v #.##.## created 700101 6:46:40 +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Gtid list [#-#-#] +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Binlog checkpoint master-bin.000002 +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Binlog checkpoint master-bin.000003 +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# ddl +/*!100101 SET @@session.skip_parallel_replication=0*//*!*/; +/*!100001 SET @@session.gtid_domain_id=#*//*!*/; +/*!100001 SET @@session.server_id=#*//*!*/; +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +use `test`/*!*/; +SET TIMESTAMP=10000/*!*/; +SET @@session.pseudo_thread_id=#/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.sql_mode=1342177280/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +/*!\C utf8 *//*!*/; +SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8) +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +BEGIN +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=10000/*!*/; +INSERT INTO t1 VALUES ('ä(i1)') +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=10000/*!*/; +COMMIT +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +BEGIN +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=10000/*!*/; +INSERT INTO t1 VALUES ('ä(i2)') +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=10000/*!*/; +COMMIT +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +BEGIN +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=10000/*!*/; +INSERT INTO t1 VALUES ('ä(i3)') +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=10000/*!*/; +COMMIT +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +BEGIN +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=10000/*!*/; +INSERT INTO t1 VALUES ('ä(p1)') +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=10000/*!*/; +COMMIT +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +BEGIN +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=10000/*!*/; +INSERT INTO t1 VALUES ('ä(p2)') +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=10000/*!*/; +COMMIT +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +BEGIN +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=10000/*!*/; +INSERT INTO t1 VALUES ('ä(p3)') +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=10000/*!*/; +COMMIT +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# ddl +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=10000/*!*/; +DROP TABLE `t1` /* generated by server */ +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Rotate to master-bin.000004 pos: 4 +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; +# +# End of 10.2 tests +# diff --git a/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test index 733ad05b0be..bc94c9df5e8 100644 --- a/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test +++ b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test @@ -20,3 +20,44 @@ let $MYSQLD_DATADIR= `select @@datadir`; drop table t2; # End of 4.1 tests + + +--echo # +--echo # Start of 10.2 tests +--echo # + +--echo # +--echo # MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions +--echo # + +SET TIMESTAMP=UNIX_TIMESTAMP('1970-01-01 06:46:40'); + +FLUSH LOGS; +SET NAMES utf8; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8); +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (''ä(i1)'')'; +EXECUTE IMMEDIATE CONVERT('INSERT INTO t1 VALUES (''ä(i2)'')' USING ucs2); +SET @stmt=CONVERT('INSERT INTO t1 VALUES (''ä(i3)'')' USING ucs2); +EXECUTE IMMEDIATE @stmt; + +PREPARE stmt FROM 'INSERT INTO t1 VALUES (''ä(p1)'')'; +EXECUTE stmt; +PREPARE stmt FROM CONVERT('INSERT INTO t1 VALUES (''ä(p2)'')' USING ucs2); +EXECUTE stmt; +SET @stmt=CONVERT('INSERT INTO t1 VALUES (''ä(p3)'')' USING ucs2); +PREPARE stmt FROM @stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; + +SELECT * FROM t1; +DROP TABLE t1; +FLUSH LOGS; +let $MYSQLD_DATADIR= `select @@datadir`; +--replace_regex /TIMESTAMP=[0-9]*/TIMESTAMP=XXX/ /# at [0-9]*/# at #/ /(exec_time=|end_log_pos |Xid = |thread_id=|server id |table id |mapped to number )[0-9]+/\1#/ /server v [^ ]*/server v #.##.##/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ /Gtid list [[][0-9]+-[0-9]+-[0-9]+[\]]/Gtid list [#-#-#]/ /session[.](gtid_domain_id|server_id|gtid_seq_no)=[0-9]+/session.\1=#/ +--exec $MYSQL_BINLOG --base64-output=decode-rows -vv $MYSQLD_DATADIR/master-bin.000003 + +SET TIMESTAMP=DEFAULT; + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/extra/binlog_tests/database.test b/mysql-test/extra/binlog_tests/database.test index 6b3da087f01..097a501cc34 100644 --- a/mysql-test/extra/binlog_tests/database.test +++ b/mysql-test/extra/binlog_tests/database.test @@ -52,7 +52,7 @@ eval SELECT 'hello' INTO OUTFILE 'fake_file.$prefix'; # Use '/' instead of '\' in the error message. On windows platform, dir is # formed with '\'. ---replace_regex /\\testing_1\\*/\/testing_1\// /66/39/ /17/39/ /File exists/Directory not empty/ +--replace_regex /\\testing_1\\*/\/testing_1\// /66/39/ /93/39/ /17/39/ /247/39/ /File exists/Directory not empty/ --error 1010 DROP DATABASE testing_1; let $wait_binlog_event= DROP TABLE IF EXIST; diff --git a/mysql-test/extra/rpl_tests/delayed_slave_wait_on_query.inc b/mysql-test/extra/rpl_tests/delayed_slave_wait_on_query.inc new file mode 100644 index 00000000000..ffdcb7f60bb --- /dev/null +++ b/mysql-test/extra/rpl_tests/delayed_slave_wait_on_query.inc @@ -0,0 +1,55 @@ +# ==== Purpose ==== +# +# Auxiliary file used by rpl_delayed_slave.test. This assumes that an +# 'INSERT INTO t1...' query has been executed on the master. It does +# this: +# +# - After half the delay, check the status. It should be delaying and +# the query should not have executed. +# +# - After one and a half delay, check the status. It should not be +# delaying and the query should be executed. +# +# +# ==== Usage ==== +# +# --let $query_number= 4 +# --source extra/rpl_tests/delayed_slave_wait_on_query.inc +# +# Parameters: +# $query_number +# The value of the 'b' column in t1 for the row inserted by the query +# we are waiting for. + +connection master; + +--echo [on slave] +--let $slave_timeout= $time1 +--source include/sync_slave_io_with_master.inc +--echo # sleep 1*T +--sleep $time1 + +--let $assert_text= Query $query_number should not be executed +--let $assert_cond= MAX(b) < $query_number FROM t1 +--source include/rpl_assert.inc + +--let $assert_text= Status should be 'Waiting until MASTER_DELAY...' +--let $assert_cond= "[SHOW SLAVE STATUS, Slave_SQL_Running_State, 1]" LIKE "Waiting until MASTER_DELAY%" +--source include/rpl_assert.inc + +--echo # sleep 1*T +--sleep $time1 + +--echo # sync with master (with timeout 1*T) +--source include/sync_with_master.inc + +--let $assert_text= Query $query_number should be executed +--let $assert_cond= MAX(b) = $query_number FROM t1 +--source include/rpl_assert.inc + +--let $assert_text= Status should be 'Has read all relay log...' +--let $assert_cond= "[SHOW SLAVE STATUS, Slave_SQL_Running_State, 1]" LIKE "Slave has read all relay log%" +--source include/rpl_assert.inc + + +--source include/check_slave_is_running.inc diff --git a/mysql-test/extra/rpl_tests/multisource.inc b/mysql-test/extra/rpl_tests/multisource.inc new file mode 100644 index 00000000000..adaae775f48 --- /dev/null +++ b/mysql-test/extra/rpl_tests/multisource.inc @@ -0,0 +1,304 @@ +# +# This include file is used by more than one test suite +# (currently multisource and binlog_encryption). +# Please check all dependent tests after modifying it +# +# Usage: +# --source extra/rpl_tests/multisource.inc +# +# By default, the script expects the length of the 2nd binary log to be +# $binlog_start_pos + length(Gtid_list event) + 2 x length(Binlog_checkpoint event) +# Some tests can have specific configuration which would change it, + +# +# Test basic replication functionality +# in multi-source setup +# + +--source include/not_embedded.inc +--source include/have_innodb.inc +--source include/binlog_start_pos.inc +--let $rpl_server_count= 0 + +--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3) + +# MDEV-3984: crash/read of freed memory when changing master with named connection +# This fails after adding the new master 'abc', check we do not free twice. +--error ER_RELAY_LOG_INIT +change master 'abc' to relay_log_file=''; +# This fails before adding the new master, check that we do free it. +--error ER_WRONG_ARGUMENTS +change master 'abc2' to master_host=''; + + +# Start replication from the first master + +--replace_result $SERVER_MYPORT_1 MYPORT_1 +eval change master 'master1' to +master_port=$SERVER_MYPORT_1, +master_host='127.0.0.1', +master_user='root'; + +start slave 'master1'; +set default_master_connection = 'master1'; +--source include/wait_for_slave_to_start.inc + +--connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1) +--save_master_pos + +--connection slave +--sync_with_master 0,'master1' + +# Here and further: add an extra check on SQL thread status +# as the normal sync is not always enough +--source include/wait_for_sql_thread_read_all.inc + +# each of the 3 commands should produce +# 'master1' status + +let $wait_for_all= 1; +let $show_statement= SHOW ALL SLAVES STATUS; +let $field= Slave_IO_State; +let $condition= = 'Waiting for master to send event'; +--source include/wait_show_condition.inc + +--echo # +--echo # Checking SHOW SLAVE 'master1' STATUS +--echo # +--let $status_items= Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno +--let $slave_field_result_replace= /$SERVER_MYPORT_1/MYPORT_1/ +--let $slave_name= 'master1' +--source include/show_slave_status.inc +--let $slave_name= + +--echo # +--echo # Checking SHOW SLAVE STATUS +--echo # +--source include/show_slave_status.inc + +--echo # +--echo # Checking SHOW ALL SLAVES STATUS +--echo # +--let $all_slaves_status= 1 +--let $status_items= Connection_name, Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno, Slave_heartbeat_period +--source include/show_slave_status.inc +--let $all_slaves_status= +--echo # + + +# Check that replication actually works + +--connection master1 + +--disable_warnings +drop database if exists db1; +--enable_warnings +create database db1; +use db1; +create table t1 (i int auto_increment, f1 varchar(16), primary key pk (i,f1)) engine=MyISAM; +insert into t1 (f1) values ('one'),('two'); +--save_master_pos + +--connection slave +--sync_with_master 0,'master1' + +--sorted_result +select * from db1.t1; + +--let $datadir = `SELECT @@datadir` + +--echo # List of relay log files in the datadir +--list_files $datadir mysqld-relay-bin-master1.* + +# Check that relay logs are recognizable + +let binlog_start=4; +let binlog_file=; +source include/show_relaylog_events.inc; +let binlog_file= mysqld-relay-bin-master1.000002; +source include/show_relaylog_events.inc; + +# Try to configure connection with the same name again, +# should get an error because the slave is running + +--replace_result $SERVER_MYPORT_2 MYPORT_2 +--error ER_SLAVE_MUST_STOP +eval change master 'master1' to +master_port=$SERVER_MYPORT_2, +master_host='127.0.0.1', +master_user='root'; + +# Try to configure using the default connection name +# (which is 'master1' at the moment), +# again, should get an error + +--replace_result $SERVER_MYPORT_2 MYPORT_2 +--error ER_SLAVE_MUST_STOP +eval change master to +master_port=$SERVER_MYPORT_2, +master_host='127.0.0.1', +master_user='root'; + +# Try to configure a connection with the same master +# using a different name, should get a conflict + +--replace_result $SERVER_MYPORT_1 MYPORT_1 +--error ER_CONNECTION_ALREADY_EXISTS +eval change master 'master2' to +master_port=$SERVER_MYPORT_1, +master_host='127.0.0.1', +master_user='root'; + + +# Set up a proper 'default' connection to master2 + +set default_master_connection = ''; + +--replace_result $SERVER_MYPORT_2 MYPORT_2 +eval change master to +master_port=$SERVER_MYPORT_2, +master_host='127.0.0.1', +master_user='root'; + +start slave; +--source include/wait_for_slave_to_start.inc + +--source include/wait_for_sql_thread_read_all.inc + +# See both connections in the same status output + +let $wait_for_all= 1; +let $show_statement= SHOW ALL SLAVES STATUS; +let $field= Slave_IO_State; +let $condition= = 'Waiting for master to send event'; +--source include/wait_show_condition.inc + +--echo # +--echo # Checking SHOW ALL SLAVES STATUS +--echo # +--let $all_slaves_status= 1 +--let $status_items= Connection_name, Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno, Slave_heartbeat_period +--let $slave_field_result_replace= /$SERVER_MYPORT_1/MYPORT_1/ /$SERVER_MYPORT_2/MYPORT_2/ +--source include/show_slave_status.inc +--let $all_slaves_status= +--echo # + +# Check that replication from two servers actually works + +--connection master1 + +insert into t1 (f1) values ('three'); +--save_master_pos + +--connect (master2,127.0.0.1,root,,,$SERVER_MYPORT_2) + +--disable_warnings +drop database if exists db2; +--enable_warnings +create database db2; +use db2; +create table t1 (pk int auto_increment primary key, f1 int) engine=InnoDB; +begin; +insert into t1 (f1) values (1),(2); + +--connection slave +--sync_with_master 0,'master1' + +--connection master2 +--save_master_pos + +--connection slave +--sync_with_master 0 +--sorted_result +select * from db1.t1; +select * from db2.t1; + +--connection master2 +commit; +--save_master_pos + +--connection slave +--sync_with_master 0 +--sorted_result +select * from db2.t1; + +# Flush and purge logs on one master, +# make sure slaves don't get confused + +--connection master1 +flush logs; +--source include/wait_for_binlog_checkpoint.inc +--save_master_pos +--connection slave +--sync_with_master 0, 'master1' + +--connection master1 +purge binary logs to 'master-bin.000002'; +# Additional events: 43 (Gtid_list) + 2 x 44 (Binlog_checkpoint) = 131 +let filesize=`select $binlog_start_pos+131`; +--replace_result $filesize filesize +show binary logs; +insert into t1 (f1) values ('four'); +create table db1.t3 (f1 int) engine=InnoDB; +--save_master_pos + +--connection slave +--sync_with_master 0,'master1' + +--source include/wait_for_sql_thread_read_all.inc + +let $wait_for_all= 1; +let $show_statement= SHOW ALL SLAVES STATUS; +let $field= Slave_IO_State; +let $condition= = 'Waiting for master to send event'; +--source include/wait_show_condition.inc + +--echo # +--echo # Checking SHOW ALL SLAVES STATUS +--echo # +--let $all_slaves_status= 1 +--let $status_items= Connection_name, Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno, Slave_heartbeat_period +--let $slave_field_result_replace= /$SERVER_MYPORT_1/MYPORT_1/ /$SERVER_MYPORT_2/MYPORT_2/ +--source include/show_slave_status.inc +--let $all_slaves_status= +--echo # + +--sorted_result +select * from db1.t1; + +# This should show relay log events for the default master +# (the one with the empty name) +let binlog_file=; +source include/show_relaylog_events.inc; +let binlog_file= mysqld-relay-bin.000002; +source include/show_relaylog_events.inc; + +# Make sure we don't lose control over replication connections +# after reconnecting to the slave + +--disconnect slave +--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3) + +stop slave io_thread; +show status like 'Slave_running'; +set default_master_connection = 'master1'; +show status like 'Slave_running'; + +# Cleanup + +drop database db1; +drop database db2; + +--source include/reset_master_slave.inc +--disconnect slave + +--connection master1 +drop database db1; +--source include/reset_master_slave.inc +--disconnect master1 + +--connection master2 +drop database db2; +--source include/reset_master_slave.inc +--disconnect master2 + diff --git a/mysql-test/extra/rpl_tests/rpl_binlog_errors.inc b/mysql-test/extra/rpl_tests/rpl_binlog_errors.inc new file mode 100644 index 00000000000..c595d70daa1 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_binlog_errors.inc @@ -0,0 +1,422 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# +# Usage: +# --let $binlog_limit= X[,Y] # optional +# +# Semantics of the value is the same as in include/show_binlog_events.inc +# which the script calls as a part of the test flow. +# The goal is to print the event demonstrating the triggered error, +# so normally Y should be 1 (print the exact event only); +# however, depending on test-specific server options, the offset X +# can be different. +# + +# BUG#46166: MYSQL_BIN_LOG::new_file_impl is not propagating error +# when generating new name. +# +# WHY +# === +# +# We want to check whether error is reported or not when +# new_file_impl fails (this may happen when rotation is not +# possible because there is some problem finding an +# unique filename). +# +# HOW +# === +# +# Test cases are documented inline. + +-- source include/have_innodb.inc +-- source include/have_debug.inc +-- source include/master-slave.inc + +-- echo ####################################################################### +-- echo ####################### PART 1: MASTER TESTS ########################## +-- echo ####################################################################### + + +### ACTION: stopping slave as it is not needed for the first part of +### the test + +-- connection slave +-- source include/stop_slave.inc +-- connection master + +call mtr.add_suppression("Can't generate a unique log-filename"); +call mtr.add_suppression("Writing one row to the row-based binary log failed.*"); +call mtr.add_suppression("Error writing file .*"); + +SET @old_debug= @@global.debug; + +### ACTION: create a large file (> 4096 bytes) that will be later used +### in LOAD DATA INFILE to check binlog errors in its vacinity +-- let $load_file= $MYSQLTEST_VARDIR/tmp/bug_46166.data +-- let $MYSQLD_DATADIR= `select @@datadir` +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SELECT repeat('x',8192) INTO OUTFILE '$load_file' + +### ACTION: create a small file (< 4096 bytes) that will be later used +### in LOAD DATA INFILE to check for absence of binlog errors +### when file loading this file does not force flushing and +### rotating the binary log +-- let $load_file2= $MYSQLTEST_VARDIR/tmp/bug_46166-2.data +-- let $MYSQLD_DATADIR= `select @@datadir` +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SELECT repeat('x',10) INTO OUTFILE '$load_file2' + +RESET MASTER; + +-- echo ###################### TEST #1 + +### ASSERTION: no problem flushing logs (should show two binlogs) +FLUSH LOGS; +-- echo # assert: must show two binlogs +-- source include/show_binary_logs.inc + +-- echo ###################### TEST #2 + +### ASSERTION: check that FLUSH LOGS actually fails and reports +### failure back to the user if find_uniq_filename fails +### (should show just one binlog) + +RESET MASTER; +SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +-- error ER_NO_UNIQUE_LOGFILE +FLUSH LOGS; +-- echo # assert: must show one binlog +-- source include/show_binary_logs.inc + +### ACTION: clean up and move to next test +SET GLOBAL debug_dbug=@old_debug; +RESET MASTER; + +-- echo ###################### TEST #3 + +### ACTION: create some tables (t1, t2, t4) and insert some values in +### table t1 +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a VARCHAR(16384)) Engine=InnoDB; +CREATE TABLE t4 (a VARCHAR(16384)); +INSERT INTO t1 VALUES (1); +RESET MASTER; + +### ASSERTION: we force rotation of the binary log because it exceeds +### the max_binlog_size option (should show two binary +### logs) + +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 + +# shows two binary logs +-- echo # assert: must show two binlog +-- source include/show_binary_logs.inc + +# clean up the table and the binlog to be used in next part of test +SET GLOBAL debug_dbug=@old_debug; +DELETE FROM t2; +RESET MASTER; + +-- echo ###################### TEST #4 + +### ASSERTION: load the big file into a transactional table and check +### that it reports error. The table will contain the +### changes performed despite the fact that it reported an +### error. + +SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- error ER_NO_UNIQUE_LOGFILE +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 + +# show table +-- echo # assert: must show one entry +SELECT count(*) FROM t2; + +# clean up the table and the binlog to be used in next part of test +SET GLOBAL debug_dbug=@old_debug; +DELETE FROM t2; +RESET MASTER; + +-- echo ###################### TEST #5 + +### ASSERTION: load the small file into a transactional table and +### check that it succeeds + +SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval LOAD DATA INFILE '$load_file2' INTO TABLE t2 + +# show table +-- echo # assert: must show one entry +SELECT count(*) FROM t2; + +# clean up the table and the binlog to be used in next part of test +SET GLOBAL debug_dbug=@old_debug; +DELETE FROM t2; +RESET MASTER; + +-- echo ###################### TEST #6 + +### ASSERTION: check that even if one is using a transactional table +### and explicit transactions (no autocommit) if rotation +### fails we get the error. Transaction is not rolledback +### because rotation happens after the commit. + +SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET AUTOCOMMIT=0; +INSERT INTO t2 VALUES ('muse'); +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 +INSERT INTO t2 VALUES ('muse'); +-- error ER_NO_UNIQUE_LOGFILE +COMMIT; + +### ACTION: Show the contents of the table after the test +-- echo # assert: must show three entries +SELECT count(*) FROM t2; + +### ACTION: clean up and move to the next test +SET AUTOCOMMIT= 1; +SET GLOBAL debug_dbug=@old_debug; +DELETE FROM t2; +RESET MASTER; + +-- echo ###################### TEST #7 + +### ASSERTION: check that on a non-transactional table, if rotation +### fails then an error is reported and an incident event +### is written to the current binary log. + +SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SELECT count(*) FROM t4; +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- error ER_NO_UNIQUE_LOGFILE +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t4 + +-- echo # assert: must show 1 entry +SELECT count(*) FROM t4; + +-- echo ### check that the incident event is written to the current log +SET GLOBAL debug_dbug=@old_debug; +if (!$binlog_limit) +{ + -- let $binlog_limit= 4,1 +} +-- source include/show_binlog_events.inc + +# clean up and move to next test +DELETE FROM t4; +RESET MASTER; + +-- echo ###################### TEST #8 + +### ASSERTION: check that statements end up in error but they succeed +### on changing the data. + +SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +-- echo # must show 0 entries +SELECT count(*) FROM t4; +SELECT count(*) FROM t2; + +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- error ER_NO_UNIQUE_LOGFILE +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t4 +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- error ER_NO_UNIQUE_LOGFILE +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 +-- error ER_NO_UNIQUE_LOGFILE +INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'); + +-- echo # INFO: Count(*) Before Offending DELETEs +-- echo # assert: must show 1 entry +SELECT count(*) FROM t4; +-- echo # assert: must show 4 entries +SELECT count(*) FROM t2; + +-- error ER_NO_UNIQUE_LOGFILE +DELETE FROM t4; +-- error ER_NO_UNIQUE_LOGFILE +DELETE FROM t2; + +-- echo # INFO: Count(*) After Offending DELETEs +-- echo # assert: must show zero entries +SELECT count(*) FROM t4; +SELECT count(*) FROM t2; + +# remove fault injection +SET GLOBAL debug_dbug=@old_debug; + +-- echo ###################### TEST #9 + +### ASSERTION: check that if we disable binlogging, then statements +### succeed. +SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET SQL_LOG_BIN=0; +INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd'); +INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh'); +-- echo # assert: must show four entries +SELECT count(*) FROM t2; +SELECT count(*) FROM t4; +DELETE FROM t2; +DELETE FROM t4; +-- echo # assert: must show zero entries +SELECT count(*) FROM t2; +SELECT count(*) FROM t4; +SET SQL_LOG_BIN=1; +SET GLOBAL debug_dbug=@old_debug; + +-- echo ###################### TEST #10 + +### ASSERTION: check that error is reported if there is a failure +### while registering the index file and the binary log +### file or failure to write the rotate event. + +call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file."); +call mtr.add_suppression("Could not open .*"); + +RESET MASTER; +SHOW WARNINGS; + +# +d,fault_injection_registering_index => injects fault on MYSQL_BIN_LOG::open +SET GLOBAL debug_dbug="+d,fault_injection_registering_index"; +-- replace_regex /\.[\\\/]master/master/ +-- error ER_CANT_OPEN_FILE +FLUSH LOGS; +SET GLOBAL debug_dbug="-d,fault_injection_registering_index"; + +-- error ER_NO_BINARY_LOGGING +SHOW BINARY LOGS; + +# issue some statements and check that they don't fail +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; + +-- echo ###################### TEST #11 + +### ASSERTION: check that error is reported if there is a failure +### while opening the index file and the binary log file or +### failure to write the rotate event. + +# restart the server so that we have binlog again +--let $rpl_server_number= 1 +--source include/rpl_restart_server.inc + +# +d,fault_injection_openning_index => injects fault on MYSQL_BIN_LOG::open_index_file +SET GLOBAL debug_dbug="+d,fault_injection_openning_index"; +-- replace_regex /\.[\\\/]master/master/ +-- error ER_CANT_OPEN_FILE +FLUSH LOGS; +SET GLOBAL debug_dbug="-d,fault_injection_openning_index"; + +-- error ER_FLUSH_MASTER_BINLOG_CLOSED +RESET MASTER; + +# issue some statements and check that they don't fail +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; + +# restart the server so that we have binlog again +--let $rpl_server_number= 1 +--source include/rpl_restart_server.inc + +-- echo ###################### TEST #12 + +### ASSERTION: check that error is reported if there is a failure +### while writing the rotate event when creating a new log +### file. + +# +d,fault_injection_new_file_rotate_event => injects fault on MYSQL_BIN_LOG::MYSQL_BIN_LOG::new_file_impl +SET GLOBAL debug_dbug="+d,fault_injection_new_file_rotate_event"; +-- error ER_ERROR_ON_WRITE +FLUSH LOGS; +SET GLOBAL debug_dbug="-d,fault_injection_new_file_rotate_event"; + +-- error ER_FLUSH_MASTER_BINLOG_CLOSED +RESET MASTER; + +# issue some statements and check that they don't fail +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; + +# restart the server so that we have binlog again +--let $rpl_server_number= 1 +--source include/rpl_restart_server.inc + +## clean up +DROP TABLE t1, t2, t4; +RESET MASTER; + +# restart slave again +-- connection slave +-- source include/start_slave.inc +-- connection master + +-- echo ####################################################################### +-- echo ####################### PART 2: SLAVE TESTS ########################### +-- echo ####################################################################### + +### setup +--source include/rpl_reset.inc +-- connection slave + +# slave suppressions + +call mtr.add_suppression("Slave I/O: Relay log write failure: could not queue event from master.*"); +call mtr.add_suppression("Error writing file .*"); +call mtr.add_suppression("Could not open .*"); +call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file."); +call mtr.add_suppression("Can't generate a unique log-filename .*"); +-- echo ###################### TEST #13 + +#### ASSERTION: check against unique log filename error +-- let $io_thd_injection_fault_flag= error_unique_log_filename +-- let $slave_io_errno= 1595 +-- let $show_slave_io_error= 1 +-- source include/io_thd_fault_injection.inc + +-- echo ###################### TEST #14 + +#### ASSERTION: check against rotate failing +-- let $io_thd_injection_fault_flag= fault_injection_new_file_rotate_event +-- let $slave_io_errno= 1595 +-- let $show_slave_io_error= 1 +-- source include/io_thd_fault_injection.inc + +-- echo ###################### TEST #15 + +#### ASSERTION: check against relay log open failure +-- let $io_thd_injection_fault_flag= fault_injection_registering_index +-- let $slave_io_errno= 1595 +-- let $show_slave_io_error= 1 +-- source include/io_thd_fault_injection.inc + +-- echo ###################### TEST #16 + +#### ASSERTION: check against relay log index open failure +-- let $io_thd_injection_fault_flag= fault_injection_openning_index +-- let $slave_io_errno= 1595 +-- let $show_slave_io_error= 1 +-- source include/io_thd_fault_injection.inc + +### clean up +-- source include/stop_slave_sql.inc +RESET SLAVE; +RESET MASTER; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_cant_read_event_incident.inc b/mysql-test/extra/rpl_tests/rpl_cant_read_event_incident.inc new file mode 100644 index 00000000000..a9534a999e2 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_cant_read_event_incident.inc @@ -0,0 +1,83 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +# +# Bug#11747416 : 32228 A disk full makes binary log corrupt. +# +# +# The test demonstrates reading from binlog error propagation to slave +# and reporting there. +# Conditions for the bug include a crash at time of the last event to +# the binlog was written partly. With the fixes the event is not sent out +# any longer, but rather the dump thread sends out a sound error message. +# +# Crash is not simulated. A binlog with partly written event in its end is installed +# and replication is started from it. +# + +--source include/master-slave.inc +--source include/have_binlog_format_mixed.inc + +--connection slave +# Make sure the slave is stopped while we are messing with master. +# Otherwise we get occasional failures as the slave manages to re-connect +# to the newly started master and we get extra events applied, causing +# conflicts. +--source include/stop_slave.inc + +--connection master +call mtr.add_suppression("Error in Log_event::read_log_event()"); +--let $datadir= `SELECT @@datadir` + +--let $rpl_server_number= 1 +--source include/rpl_stop_server.inc + +--remove_file $datadir/master-bin.000001 +--copy_file $MYSQL_TEST_DIR/std_data/bug11747416_32228_binlog.000001 $datadir/master-bin.000001 + +--let $rpl_server_number= 1 +--source include/rpl_start_server.inc + +--source include/wait_until_connected_again.inc + +# evidence of the partial binlog +--error ER_ERROR_WHEN_EXECUTING_COMMAND +show binlog events; + +--connection slave +call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log"); +reset slave; +start slave; + +# ER_MASTER_FATAL_ERROR_READING_BINLOG 1236 +--let $slave_param=Last_IO_Errno +--let $slave_param_value=1236 +--source include/wait_for_slave_param.inc + +--let $slave_field_result_replace= / at [0-9]*/ at XXX/ +--let $status_items= Last_IO_Errno, Last_IO_Error +--source include/show_slave_status.inc + +# +# Cleanup +# + +--connection master +reset master; + +--connection slave +stop slave; +reset slave; +# Table was created from binlog, it may not be created if SQL thread is running +# slowly and IO thread reaches incident before SQL thread applies it. +--disable_warnings +drop table if exists t; +--enable_warnings +reset master; + +--echo End of the tests +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_checksum.inc b/mysql-test/extra/rpl_tests/rpl_checksum.inc new file mode 100644 index 00000000000..8423d2fc1cb --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_checksum.inc @@ -0,0 +1,334 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +# WL2540 replication events checksum +# Testing configuration parameters + +--source include/master-slave.inc +--source include/have_debug.inc +--source include/have_binlog_format_mixed.inc + +call mtr.add_suppression('Slave can not handle replication events with the checksum that master is configured to log'); +call mtr.add_suppression('Replication event checksum verification failed'); +# due to C failure simulation +call mtr.add_suppression('Relay log write failure: could not queue event from master'); +call mtr.add_suppression('Master is configured to log replication events with checksum, but will not send such events to slaves that cannot process them'); + +# A. read/write access to the global vars: +# binlog_checksum master_verify_checksum slave_sql_verify_checksum + +connection master; + +set @master_save_binlog_checksum= @@global.binlog_checksum; +set @save_master_verify_checksum = @@global.master_verify_checksum; + +select @@global.binlog_checksum as 'must be CRC32 because of the command line option'; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.binlog_checksum as 'no session var'; + +select @@global.master_verify_checksum as 'must be zero because of default'; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.master_verify_checksum as 'no session var'; + +connection slave; + +set @slave_save_binlog_checksum= @@global.binlog_checksum; +set @save_slave_sql_verify_checksum = @@global.slave_sql_verify_checksum; + +select @@global.slave_sql_verify_checksum as 'must be one because of default'; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.slave_sql_verify_checksum as 'no session var'; + +connection master; + +source include/show_binary_logs.inc; +set @@global.binlog_checksum = NONE; +select @@global.binlog_checksum; +--echo *** must be rotations seen *** +source include/show_binary_logs.inc; + +set @@global.binlog_checksum = default; +select @@global.binlog_checksum; + +# testing lack of side-effects in non-effective update of binlog_checksum: +set @@global.binlog_checksum = CRC32; +select @@global.binlog_checksum; +set @@global.binlog_checksum = CRC32; + +set @@global.master_verify_checksum = 0; +set @@global.master_verify_checksum = default; + +--error ER_WRONG_VALUE_FOR_VAR +set @@global.binlog_checksum = ADLER32; +--error ER_WRONG_VALUE_FOR_VAR +set @@global.master_verify_checksum = 2; # the var is of bool type + +connection slave; + +set @@global.slave_sql_verify_checksum = 0; +set @@global.slave_sql_verify_checksum = default; +--error ER_WRONG_VALUE_FOR_VAR +set @@global.slave_sql_verify_checksum = 2; # the var is of bool type + +# +# B. Old Slave to New master conditions +# +# while master does not send a checksum-ed binlog the Old Slave can +# work with the New Master + +connection master; + +set @@global.binlog_checksum = NONE; +create table t1 (a int); + +# testing that binlog rotation preserves opt_binlog_checksum value +flush logs; +flush logs; +-- source include/wait_for_binlog_checkpoint.inc +flush logs; + +sync_slave_with_master; +#connection slave; +# checking that rotation on the slave side leaves slave stable +flush logs; +flush logs; +flush logs; +select count(*) as zero from t1; + +source include/stop_slave.inc; + +connection master; +set @@global.binlog_checksum = CRC32; +-- source include/wait_for_binlog_checkpoint.inc +insert into t1 values (1) /* will not be applied on slave due to simulation */; + +# instruction to the dump thread + +connection slave; +set @@global.debug_dbug='d,simulate_slave_unaware_checksum'; +start slave; +--let $slave_io_errno= 1236 +--let $show_slave_io_error= 1 +source include/wait_for_slave_io_error.inc; + +select count(*) as zero from t1; + +###connection master; +set @@global.debug_dbug=''; + +connection slave; +source include/start_slave.inc; + +# +# C. checksum failure simulations +# + +# C1. Failure by a client thread +connection master; +set @@global.master_verify_checksum = 1; +set @@session.debug_dbug='d,simulate_checksum_test_failure'; +--error ER_ERROR_WHEN_EXECUTING_COMMAND +show binlog events; +set @@session.debug_dbug=''; +set @@global.master_verify_checksum = default; + +#connection master; +sync_slave_with_master; + +connection slave; +source include/stop_slave.inc; + +connection master; +create table t2 (a int); +let $pos_master= query_get_value(SHOW MASTER STATUS, Position, 1); + +connection slave; + +# C2. Failure by IO thread +# instruction to io thread +set @@global.debug_dbug='d,simulate_checksum_test_failure'; +start slave io_thread; +# When the checksum error is detected, the slave sets error code 1913 +# (ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE) in queue_event(), then immediately +# sets error 1595 (ER_SLAVE_RELAY_LOG_WRITE_FAILURE) in handle_slave_io(). +# So we usually get 1595, but it is occasionally possible to get 1913. +--let $slave_io_errno= 1595,1913 +--let $show_slave_io_error= 0 +source include/wait_for_slave_io_error.inc; +set @@global.debug_dbug=''; + +# to make IO thread re-read it again w/o the failure +start slave io_thread; +let $slave_param= Read_Master_Log_Pos; +let $slave_param_value= $pos_master; +source include/wait_for_slave_param.inc; + +# C3. Failure by SQL thread +# instruction to sql thread; +set @@global.slave_sql_verify_checksum = 1; + +set @@global.debug_dbug='d,simulate_checksum_test_failure'; + +start slave sql_thread; +--let $slave_sql_errno= 1593 +--let $show_slave_sql_error= 1 +source include/wait_for_slave_sql_error.inc; + +# resuming SQL thread to parse out the event w/o the failure + +set @@global.debug_dbug=''; +source include/start_slave.inc; + +connection master; +sync_slave_with_master; + +#connection slave; +select count(*) as 'must be zero' from t2; + +# +# D. Reset slave, Change-Master, Binlog & Relay-log rotations with +# random value on binlog_checksum on both master and slave +# +connection slave; +stop slave; +reset slave; + +# randomize slave server's own checksum policy +set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE"); +flush logs; + +connection master; +set @@global.binlog_checksum= CRC32; +reset master; +flush logs; +create table t3 (a int, b char(5)); + +connection slave; +source include/start_slave.inc; + +connection master; +sync_slave_with_master; + +#connection slave; +select count(*) as 'must be zero' from t3; +source include/stop_slave.inc; +--replace_result $MASTER_MYPORT MASTER_PORT +eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root'; + +connection master; +flush logs; +reset master; +insert into t3 value (1, @@global.binlog_checksum); + +connection slave; +source include/start_slave.inc; +flush logs; + +connection master; +sync_slave_with_master; + +#connection slave; +select count(*) as 'must be one' from t3; + +connection master; +set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE"); +insert into t3 value (1, @@global.binlog_checksum); +sync_slave_with_master; + +#connection slave; + +#clean-up + +connection master; +drop table t1, t2, t3; +set @@global.binlog_checksum = @master_save_binlog_checksum; +set @@global.master_verify_checksum = @save_master_verify_checksum; + +# +# BUG#58564: flush_read_lock fails in mysql-trunk-bugfixing after merging with WL#2540 +# +# Sanity check that verifies that no assertions are triggered because +# of old FD events (generated by versions prior to server released with +# checksums feature) +# +# There is no need for query log, if something wrong this should trigger +# an assertion + +--disable_query_log + +BINLOG ' +MfmqTA8BAAAAZwAAAGsAAAABAAQANS41LjctbTMtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAx+apMEzgNAAgAEgAEBAQEEgAAVAAEGggAAAAICAgCAA== +'; + +--enable_query_log + +#connection slave; +sync_slave_with_master; + + +--echo *** Bug#59123 / MDEV-5799: INCIDENT_EVENT checksum written to error log as garbage characters *** + +--connection master + +--source include/wait_for_binlog_checkpoint.inc +CREATE TABLE t4 (a INT PRIMARY KEY); +INSERT INTO t4 VALUES (1); + +SET sql_log_bin=0; +CALL mtr.add_suppression("\\[ERROR\\] Can't generate a unique log-filename"); +SET sql_log_bin=1; +SET @old_dbug= @@GLOBAL.debug_dbug; +SET debug_dbug= '+d,binlog_inject_new_name_error'; +--error ER_NO_UNIQUE_LOGFILE +FLUSH LOGS; +SET debug_dbug= @old_dbug; + +INSERT INTO t4 VALUES (2); + +--connection slave +--let $slave_sql_errno= 1590 +--source include/wait_for_slave_sql_error.inc + +# Search the error log for the error message. +# The bug was that 4 garbage bytes were output in the middle of the error +# message; by searching for a pattern that spans that location, we can +# catch the error. +let $log_error_= `SELECT @@GLOBAL.log_error`; +if(!$log_error_) +{ + # MySQL Server on windows is started with --console and thus + # does not know the location of its .err log, use default location + let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.2.err; +} +--let SEARCH_FILE= $log_error_ +--let SEARCH_RANGE=-50000 +--let SEARCH_PATTERN= Slave SQL: The incident LOST_EVENTS occurred on the master\. Message: error writing to the binary log, Internal MariaDB error code: 1590 +--source include/search_pattern_in_file.inc + +SELECT * FROM t4 ORDER BY a; +STOP SLAVE IO_THREAD; +SET sql_slave_skip_counter= 1; +--source include/start_slave.inc + +--connection master +--save_master_pos + +--connection slave +--sync_with_master +SELECT * FROM t4 ORDER BY a; + + +--connection slave +set @@global.binlog_checksum = @slave_save_binlog_checksum; +set @@global.slave_sql_verify_checksum = @save_slave_sql_verify_checksum; + +--echo End of tests + +--connection master +DROP TABLE t4; + +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_checksum_cache.inc b/mysql-test/extra/rpl_tests/rpl_checksum_cache.inc new file mode 100644 index 00000000000..a10c9721f70 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_checksum_cache.inc @@ -0,0 +1,261 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +-- source include/have_innodb.inc +-- source include/master-slave.inc + +--disable_warnings +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. Statement: insert into t2 set data=repeat.*'a', @act_size.*"); +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. Statement: insert into t1 values.* NAME_CONST.*'n',.*, @data .*"); +--enable_warnings + +connection master; +set @save_binlog_cache_size = @@global.binlog_cache_size; +set @save_binlog_checksum = @@global.binlog_checksum; +set @save_master_verify_checksum = @@global.master_verify_checksum; +set @@global.binlog_cache_size = 4096; +set @@global.binlog_checksum = CRC32; +set @@global.master_verify_checksum = 1; + +# restart slave to force the dump thread to verify events (on master side) +connection slave; +source include/stop_slave.inc; +source include/start_slave.inc; + +connection master; + +# +# Testing a critical part of checksum handling dealing with transaction cache. +# The cache's buffer size is set to be less than the transaction's footprint +# in binlog. +# +# To verify combined buffer-by-buffer read out of the file and fixing crc per event +# there are the following parts: +# +# 1. the event size is much less than the cache's buffer +# 2. the event size is bigger than the cache's buffer +# 3. the event size if approximately the same as the cache's buffer +# 4. all in above + +# +# 1. the event size is much less than the cache's buffer +# + +flush status; +show status like "binlog_cache_use"; +show status like "binlog_cache_disk_use"; +--disable_warnings +drop table if exists t1; +--enable_warnings + +# +# parameter to ensure the test slightly varies binlog content +# between different invocations +# +let $deviation_size=32; +eval create table t1 (a int PRIMARY KEY, b CHAR($deviation_size)) engine=innodb; + +# Now we are going to create transaction which is long enough so its +# transaction binlog will be flushed to disk... + +delimiter |; +create procedure test.p_init (n int, size int) +begin + while n > 0 do + select round(RAND() * size) into @act_size; + set @data = repeat('a', @act_size); + insert into t1 values(n, @data ); + set n= n-1; + end while; +end| + +delimiter ;| + +let $1 = 4000; # PB2 can run it slow to time out on following sync_slave_with_master:s + +begin; +--disable_warnings +# todo: check if it is really so. +#+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. +eval call test.p_init($1, $deviation_size); +--enable_warnings +commit; + +show status like "binlog_cache_use"; +--echo *** binlog_cache_disk_use must be non-zero *** +show status like "binlog_cache_disk_use"; + +sync_slave_with_master; + +let $diff_tables=master:test.t1, slave:test.t1; +source include/diff_tables.inc; + +# undoing changes with verifying the above once again +connection master; + +begin; +delete from t1; +commit; + +sync_slave_with_master; + + +# +# 2. the event size is bigger than the cache's buffer +# +connection master; + +flush status; +let $t2_data_size= `select 3 * @@global.binlog_cache_size`; +let $t2_aver_size= `select 2 * @@global.binlog_cache_size`; +let $t2_max_rand= `select 1 * @@global.binlog_cache_size`; + +eval create table t2(a int auto_increment primary key, data VARCHAR($t2_data_size)) ENGINE=Innodb; +let $1=100; +--disable_query_log +begin; +while ($1) +{ + eval select round($t2_aver_size + RAND() * $t2_max_rand) into @act_size; + set @data = repeat('a', @act_size); + insert into t2 set data = @data; + dec $1; +} +commit; +--enable_query_log +show status like "binlog_cache_use"; +--echo *** binlog_cache_disk_use must be non-zero *** +show status like "binlog_cache_disk_use"; + +sync_slave_with_master; + +let $diff_tables=master:test.t2, slave:test.t2; +source include/diff_tables.inc; + +# undoing changes with verifying the above once again +connection master; + +begin; +delete from t2; +commit; + +sync_slave_with_master; + +# +# 3. the event size if approximately the same as the cache's buffer +# + +connection master; + +flush status; +let $t3_data_size= `select 2 * @@global.binlog_cache_size`; +let $t3_aver_size= `select (9 * @@global.binlog_cache_size) / 10`; +let $t3_max_rand= `select (2 * @@global.binlog_cache_size) / 10`; + +eval create table t3(a int auto_increment primary key, data VARCHAR($t3_data_size)) engine=innodb; + +let $1= 300; +--disable_query_log +begin; +while ($1) +{ + eval select round($t3_aver_size + RAND() * $t3_max_rand) into @act_size; + insert into t3 set data= repeat('a', @act_size); + dec $1; +} +commit; +--enable_query_log +show status like "binlog_cache_use"; +--echo *** binlog_cache_disk_use must be non-zero *** +show status like "binlog_cache_disk_use"; + +sync_slave_with_master; + +let $diff_tables=master:test.t3, slave:test.t3; +source include/diff_tables.inc; + +# undoing changes with verifying the above once again +connection master; + +begin; +delete from t3; +commit; + +sync_slave_with_master; + + +# +# 4. all in above +# + +connection master; +flush status; + +delimiter |; +eval create procedure test.p1 (n int) +begin + while n > 0 do + case (select (round(rand()*100) % 3) + 1) + when 1 then + select round(RAND() * $deviation_size) into @act_size; + set @data = repeat('a', @act_size); + insert into t1 values(n, @data); + when 2 then + begin + select round($t2_aver_size + RAND() * $t2_max_rand) into @act_size; + insert into t2 set data=repeat('a', @act_size); + end; + when 3 then + begin + select round($t3_aver_size + RAND() * $t3_max_rand) into @act_size; + insert into t3 set data= repeat('a', @act_size); + end; + end case; + set n= n-1; + end while; +end| +delimiter ;| + +let $1= 1000; +set autocommit= 0; +begin; +--disable_warnings +eval call test.p1($1); +--enable_warnings +commit; + +show status like "binlog_cache_use"; +--echo *** binlog_cache_disk_use must be non-zero *** +show status like "binlog_cache_disk_use"; + +sync_slave_with_master; + +let $diff_tables=master:test.t1, slave:test.t1; +source include/diff_tables.inc; + +let $diff_tables=master:test.t2, slave:test.t2; +source include/diff_tables.inc; + +let $diff_tables=master:test.t3, slave:test.t3; +source include/diff_tables.inc; + + +connection master; + +begin; +delete from t1; +delete from t2; +delete from t3; +commit; + +drop table t1, t2, t3; +set @@global.binlog_cache_size = @save_binlog_cache_size; +set @@global.binlog_checksum = @save_binlog_checksum; +set @@global.master_verify_checksum = @save_master_verify_checksum; +drop procedure test.p_init; +drop procedure test.p1; + +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_corruption.inc b/mysql-test/extra/rpl_tests/rpl_corruption.inc new file mode 100644 index 00000000000..048a9d74249 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_corruption.inc @@ -0,0 +1,176 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +############################################################ +# Purpose: WL#5064 Testing with corrupted events. +# The test emulates the corruption at the vary stages +# of replication: +# - in binlog file +# - in network +# - in relay log +############################################################ + +# +# The tests intensively utilize @@global.debug. Note, +# Bug#11765758 - 58754, +# @@global.debug is read by the slave threads through dbug-interface. +# Hence, before a client thread set @@global.debug we have to ensure that: +# (a) the slave threads are stopped, or (b) the slave threads are in +# sync and waiting. + +--source include/have_debug.inc +--source include/master-slave.inc + +# Block legal errors for MTR +call mtr.add_suppression('Found invalid event in binary log'); +call mtr.add_suppression('Slave I/O: Relay log write failure: could not queue event from master'); +call mtr.add_suppression('event read from binlog did not pass crc check'); +call mtr.add_suppression('Replication event checksum verification failed'); +call mtr.add_suppression('Event crc check failed! Most likely there is event corruption'); +call mtr.add_suppression('Slave SQL: Error initializing relay log position: I/O error reading event at position .*, error.* 1593'); + +SET @old_master_verify_checksum = @@master_verify_checksum; + +# Creating test table/data and set corruption position for testing +--echo # 1. Creating test table/data and set corruption position for testing +--connection master +--echo * insert/update/delete rows in table t1 * +# Corruption algorithm modifies only the first event and +# then will be reset. To avoid checking always the first event +# from binlog (usually it is FD) we randomly execute different +# statements and set position for corruption inside events. + +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c VARCHAR(100)); +--disable_query_log +let $i=`SELECT 3+CEILING(10*RAND())`; +let $j=1; +let $pos=0; +while ($i) { + eval INSERT INTO t1 VALUES ($j, 'a', NULL); + if (`SELECT RAND() > 0.7`) + { + eval UPDATE t1 SET c = REPEAT('a', 20) WHERE a = $j; + } + if (`SELECT RAND() > 0.8`) + { + eval DELETE FROM t1 WHERE a = $j; + } + if (!$pos) { + let $pos= query_get_value(SHOW MASTER STATUS, Position, 1); + --sync_slave_with_master + --source include/stop_slave.inc + --disable_query_log + --connection master + } + dec $i; + inc $j; +} +--enable_query_log + + +# Emulate corruption in binlog file when SHOW BINLOG EVENTS is executing +--echo # 2. Corruption in master binlog and SHOW BINLOG EVENTS +SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char"; +--echo SHOW BINLOG EVENTS; +--disable_query_log +send_eval SHOW BINLOG EVENTS FROM $pos; +--enable_query_log +--error ER_ERROR_WHEN_EXECUTING_COMMAND +reap; + +SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char"; + +# Emulate corruption on master with crc checking on master +--echo # 3. Master read a corrupted event from binlog and send the error to slave + +# We have a rare but nasty potential race here: if the dump thread on +# the master for the _old_ slave connection has not yet discovered +# that the slave has disconnected, we will inject the corrupt event on +# the wrong connection, and the test will fail +# (+d,corrupt_read_log_event2 corrupts only one event). +# So kill any lingering dump thread (we need to kill; otherwise dump thread +# could manage to send all events down the socket before seeing it close, and +# hang forever waiting for new binlog events to be created). +let $id= `select id from information_schema.processlist where command = "Binlog Dump"`; +if ($id) +{ + --disable_query_log + --error 0,1094 + eval kill $id; + --enable_query_log +} +let $wait_condition= + SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE command = 'Binlog Dump'; +--source include/wait_condition.inc + +SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set"; +--connection slave +START SLAVE IO_THREAD; +let $slave_io_errno= 1236; +--let $slave_timeout= 10 +--source include/wait_for_slave_io_error.inc +--connection master +SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; + +# Emulate corruption on master without crc checking on master +--echo # 4. Master read a corrupted event from binlog and send it to slave +--connection master +SET GLOBAL master_verify_checksum=0; +SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set"; +--connection slave +START SLAVE IO_THREAD; +# When the checksum error is detected, the slave sets error code 1913 +# (ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE) in queue_event(), then immediately +# sets error 1595 (ER_SLAVE_RELAY_LOG_WRITE_FAILURE) in handle_slave_io(). +# So we usually get 1595, but it is occasionally possible to get 1913. +let $slave_io_errno= 1595,1913; +--source include/wait_for_slave_io_error.inc +--connection master +SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; +SET GLOBAL debug_dbug= ""; +SET GLOBAL master_verify_checksum=1; + +# Emulate corruption in network +--echo # 5. Slave. Corruption in network +--connection slave +SET GLOBAL debug_dbug="+d,corrupt_queue_event"; +START SLAVE IO_THREAD; +let $slave_io_errno= 1595,1913; +--source include/wait_for_slave_io_error.inc +SET GLOBAL debug_dbug="-d,corrupt_queue_event"; + +# Emulate corruption in relay log +--echo # 6. Slave. Corruption in relay log + +SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char"; + +START SLAVE SQL_THREAD; +let $slave_sql_errno= 1593; +--source include/wait_for_slave_sql_error.inc + +SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char"; +SET GLOBAL debug_dbug= ""; + +# Start normal replication and compare same table on master +# and slave +--echo # 7. Seek diff for tables on master and slave +--connection slave +--source include/start_slave.inc +--connection master +--sync_slave_with_master +let $diff_tables= master:test.t1, slave:test.t1; +--source include/diff_tables.inc + +# Clean up +--echo # 8. Clean up +--connection master +SET GLOBAL debug_dbug= ""; +SET GLOBAL master_verify_checksum = @old_master_verify_checksum; +DROP TABLE t1; +--sync_slave_with_master +SET GLOBAL debug_dbug= ""; + +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_gtid_basic.inc b/mysql-test/extra/rpl_tests/rpl_gtid_basic.inc new file mode 100644 index 00000000000..ab7d23f70ac --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_gtid_basic.inc @@ -0,0 +1,568 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +--source include/have_innodb.inc +--let $rpl_topology=1->2->3->4 +--source include/rpl_init.inc + +# Set up a 4-deep replication topology, then test various fail-overs +# using GTID. +# +# A -> B -> C -> D + +connection server_1; +--source include/wait_for_binlog_checkpoint.inc +--let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1) +--let $binlog_pos = query_get_value(SHOW MASTER STATUS,Position,1) +--echo *** GTID position should be empty here *** +--replace_result $binlog_file $binlog_pos +eval SELECT BINLOG_GTID_POS('$binlog_file',$binlog_pos); + +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM; +CREATE TABLE t2 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, "m1"); +INSERT INTO t1 VALUES (2, "m2"), (3, "m3"), (4, "m4"); +INSERT INTO t2 VALUES (1, "i1"); +BEGIN; +INSERT INTO t2 VALUES (2, "i2"), (3, "i3"); +INSERT INTO t2 VALUES (4, "i4"); +COMMIT; +save_master_pos; +source include/wait_for_binlog_checkpoint.inc; +--let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1) +--let $binlog_pos = query_get_value(SHOW MASTER STATUS,Position,1) +--let $gtid_pos_server_1 = `SELECT @@gtid_binlog_pos` +--echo *** GTID position should be non-empty here *** +--replace_result $binlog_file $binlog_pos $gtid_pos_server_1 +eval SELECT BINLOG_GTID_POS('$binlog_file',$binlog_pos); + +connection server_2; +sync_with_master; +source include/wait_for_binlog_checkpoint.inc; +--let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1) +--let $binlog_pos = query_get_value(SHOW MASTER STATUS,Position,1) +--echo *** GTID position should be the same as on server_1 *** +--replace_result $binlog_file $binlog_pos $gtid_pos_server_1 +eval SELECT BINLOG_GTID_POS('$binlog_file',$binlog_pos); +SELECT * FROM t1 ORDER BY a; +SELECT * FROM t2 ORDER BY a; +save_master_pos; + +connection server_3; +sync_with_master; +SELECT * FROM t1 ORDER BY a; +SELECT * FROM t2 ORDER BY a; +save_master_pos; + +connection server_4; +sync_with_master; +SELECT * FROM t1 ORDER BY a; +SELECT * FROM t2 ORDER BY a; + + +--echo *** Now take out D, let it fall behind a bit, and then test re-attaching it to A *** +connection server_4; +--source include/stop_slave.inc + +connection server_1; +INSERT INTO t1 VALUES (5, "m1a"); +INSERT INTO t2 VALUES (5, "i1a"); +save_master_pos; + +connection server_4; +--replace_result $MASTER_MYPORT MASTER_PORT +eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT, + MASTER_USE_GTID=CURRENT_POS; +--source include/start_slave.inc +sync_with_master; +SELECT * FROM t1 ORDER BY a; +SELECT * FROM t2 ORDER BY a; + +--echo *** Now move B to D (C is still replicating from B) *** +connection server_2; +--source include/stop_slave.inc +--replace_result $SERVER_MYPORT_4 SERVER_MYPORT_4 +eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_4, + MASTER_USE_GTID=CURRENT_POS; +--source include/start_slave.inc + +connection server_4; +UPDATE t2 SET b="j1a" WHERE a=5; +save_master_pos; + +connection server_2; +sync_with_master; +SELECT * FROM t1 ORDER BY a; +SELECT * FROM t2 ORDER BY a; + +--echo *** Now move C to D, after letting it fall a little behind *** +connection server_3; +--source include/stop_slave.inc + +connection server_1; +INSERT INTO t2 VALUES (6, "i6b"); +INSERT INTO t2 VALUES (7, "i7b"); +--source include/save_master_gtid.inc + +connection server_3; +--replace_result $SERVER_MYPORT_4 SERVER_MYPORT_4 +eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_4, + MASTER_USE_GTID=CURRENT_POS; +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc +SELECT * FROM t2 ORDER BY a; + +--echo *** Now change everything back to what it was, to make rpl_end.inc happy +# Also check that MASTER_USE_GTID=CURRENT_POS is still enabled. +connection server_2; +# We need to sync up server_2 before switching. If it happened to have reached +# the point 'UPDATE t2 SET b="j1a" WHERE a=5' it will fail to connect to +# server_1, which is (deliberately) missing that transaction. +--source include/sync_with_master_gtid.inc +--source include/stop_slave.inc +--replace_result $MASTER_MYPORT MASTER_MYPORT +eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT; +--source include/start_slave.inc +--source include/wait_for_slave_to_start.inc + +connection server_3; +--source include/stop_slave.inc +--replace_result $SLAVE_MYPORT SLAVE_MYPORT +eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SLAVE_MYPORT; +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +connection server_4; +--source include/stop_slave.inc +--replace_result $SERVER_MYPORT_3 SERVER_MYPORT_3 +eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_3; +--source include/start_slave.inc + +connection server_1; +DROP TABLE t1,t2; +--source include/save_master_gtid.inc + +--echo *** A few more checks for BINLOG_GTID_POS function *** +--let $valid_binlog_name = query_get_value(SHOW BINARY LOGS,Log_name,1) +--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT +SELECT BINLOG_GTID_POS(); +--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT +SELECT BINLOG_GTID_POS('a'); +--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT +SELECT BINLOG_GTID_POS('a',1,NULL); +SELECT BINLOG_GTID_POS(1,'a'); +SELECT BINLOG_GTID_POS(NULL,NULL); +SELECT BINLOG_GTID_POS('',1); +SELECT BINLOG_GTID_POS('a',1); +eval SELECT BINLOG_GTID_POS('$valid_binlog_name',-1); +eval SELECT BINLOG_GTID_POS('$valid_binlog_name',0); +eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551615); +eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551616); + + +--echo *** Some tests of @@GLOBAL.gtid_binlog_state *** +--connection server_2 +--source include/sync_with_master_gtid.inc +--source include/stop_slave.inc + +--connection server_1 +SET @old_state= @@GLOBAL.gtid_binlog_state; + +--error ER_BINLOG_MUST_BE_EMPTY +SET GLOBAL gtid_binlog_state = ''; +RESET MASTER; +SET GLOBAL gtid_binlog_state = ''; +FLUSH LOGS; +--source include/show_binary_logs.inc +SET GLOBAL gtid_binlog_state = '0-1-10,1-2-20,0-3-30'; +--source include/show_binary_logs.inc +--let $binlog_file= master-bin.000001 +--let $binlog_start= 4 +--source include/show_binlog_events.inc +#SELECT @@GLOBAL.gtid_binlog_pos; +#SELECT @@GLOBAL.gtid_binlog_state; +--error ER_BINLOG_MUST_BE_EMPTY +SET GLOBAL gtid_binlog_state = @old_state; +RESET MASTER; +SET GLOBAL gtid_binlog_state = @old_state; + +# Check that slave can reconnect again, despite the RESET MASTER, as we +# restored the state. + +CREATE TABLE t1 (a INT PRIMARY KEY); +SET gtid_seq_no=100; +INSERT INTO t1 VALUES (1); +--source include/save_master_gtid.inc + +--connection server_2 +--source include/start_slave.inc +# We cannot just use sync_with_master as we've done RESET MASTER, so +# slave old-style position is wrong. +# So sync on gtid position instead. +--source include/sync_with_master_gtid.inc + +SELECT * FROM t1; +# Check that the IO gtid position in SHOW SLAVE STATUS is also correct. +--let $status_items= Gtid_IO_Pos +--source include/show_slave_status.inc + +--echo *** Test @@LAST_GTID and MASTER_GTID_WAIT() *** + +--connection server_1 +DROP TABLE t1; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +--save_master_pos + +--connection server_2 +--sync_with_master +--source include/stop_slave.inc + +--connect (m1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +SELECT @@last_gtid; +SET gtid_seq_no=110; +SELECT @@last_gtid; +BEGIN; +SELECT @@last_gtid; +INSERT INTO t1 VALUES (2); +SELECT @@last_gtid; +COMMIT; +SELECT @@last_gtid; +--let $pos= `SELECT @@gtid_binlog_pos` + +--connect (s1,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +eval SET @pos= '$pos'; +# Check NULL argument. +SELECT master_gtid_wait(NULL); +# Check empty argument returns immediately. +SELECT master_gtid_wait('', NULL); +# Check this gets counted +SHOW STATUS LIKE 'Master_gtid_wait_count'; +SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; +SHOW STATUS LIKE 'Master_gtid_wait_time'; +# Let's check that we get a timeout +SELECT master_gtid_wait(@pos, 0.5); +SELECT * FROM t1 ORDER BY a; +# Now actually wait until the slave reaches the position +send SELECT master_gtid_wait(@pos); + +--connection server_2 +--source include/start_slave.inc + +--connection s1 +reap; +SELECT * FROM t1 ORDER BY a; + +# Test waiting on a domain that does not exist yet. +--source include/stop_slave.inc + +--connection server_1 +SET gtid_domain_id= 1; +INSERT INTO t1 VALUES (3); +--let $pos= `SELECT @@gtid_binlog_pos` + +--connection s1 +--replace_result $pos POS +eval SET @pos= '$pos'; +SELECT master_gtid_wait(@pos, 0); +SELECT * FROM t1 WHERE a >= 3; +send SELECT master_gtid_wait(@pos, -1); + +--connection server_2 +--source include/start_slave.inc + +--connection s1 +reap; +SELECT * FROM t1 WHERE a >= 3; +# Waiting for only part of the position. +SELECT master_gtid_wait('1-1-1', 0); + +# Now test a lot of parallel master_gtid_wait() calls, completing in different +# order, and some of which time out or get killed on the way. + +--connection s1 +send SELECT master_gtid_wait('2-1-1,1-1-4,0-1-110'); + +--connect (s2,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +# This will time out. No event 0-1-1000 exists +send SELECT master_gtid_wait('0-1-1000', 0.5); + +--connect (s3,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +# This one we will kill +--let $kill1_id= `SELECT connection_id()` +send SELECT master_gtid_wait('0-1-2000'); + +--connect (s4,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +send SELECT master_gtid_wait('2-1-10'); + +--connect (s5,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +send SELECT master_gtid_wait('2-1-6', 1); + +# This one we will kill also. +--connect (s6,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +--let $kill2_id= `SELECT connection_id()` +send SELECT master_gtid_wait('2-1-5'); + +--connect (s7,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +send SELECT master_gtid_wait('2-1-10'); + +--connect (s8,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +send SELECT master_gtid_wait('2-1-5,1-1-4,0-1-110'); + +--connect (s9,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +send SELECT master_gtid_wait('2-1-2'); + +--connection server_2 +# This one completes immediately. +SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; +SHOW STATUS LIKE 'Master_gtid_wait_count'; +SELECT master_gtid_wait('1-1-1'); +SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; +SHOW STATUS LIKE 'Master_gtid_wait_count'; +let $wait_time = query_get_value(SHOW STATUS LIKE 'Master_gtid_wait_time', Value, 1); +--replace_result $wait_time MASTER_GTID_WAIT_TIME +eval SET @a= $wait_time; +SELECT IF(@a <= 100*1000*1000, "OK", CONCAT("Error: wait time ", @a, " is larger than expected")) + AS Master_gtid_wait_time_as_expected; + + +--connect (s10,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +send SELECT master_gtid_wait('0-1-109'); + +--connection server_2 +# This one should time out. +SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; +SHOW STATUS LIKE 'Master_gtid_wait_count'; +SELECT master_gtid_wait('2-1-2', 0.5); +SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; +SHOW STATUS LIKE 'Master_gtid_wait_count'; +let $wait_time = query_get_value(SHOW STATUS LIKE 'Master_gtid_wait_time', Value, 1); +--replace_result $wait_time MASTER_GTID_WAIT_TIME +eval SET @a= $wait_time; +# We expect a wait time of just a bit over 0.5 seconds. But thread scheduling +# and timer inaccuracies could introduce significant jitter. So allow a +# generous interval. +SELECT IF(@a BETWEEN 0.4*1000*1000 AND 100*1000*1000, "OK", CONCAT("Error: wait time ", @a, " not as expected")) AS Master_gtid_wait_time_as_expected; + +--replace_result $kill1_id KILL_ID +eval KILL QUERY $kill1_id; +--connection s3 +--error ER_QUERY_INTERRUPTED +reap; + +--connection server_1 +SET gtid_domain_id=2; +SET gtid_seq_no=2; +INSERT INTO t1 VALUES (4); + +--connection s9 +reap; + +--connection server_2 +--replace_result $kill2_id KILL_ID +eval KILL CONNECTION $kill2_id; + +--connection s6 +--error 2013,ER_CONNECTION_KILLED +reap; + +--connection server_1 +SET gtid_domain_id=1; +SET gtid_seq_no=4; +INSERT INTO t1 VALUES (5); +SET gtid_domain_id=2; +SET gtid_seq_no=5; +INSERT INTO t1 VALUES (6); + +--connection s8 +reap; +--connection s1 +reap; +--connection s2 +reap; +--connection s5 +reap; +--connection s10 +reap; + +--connection server_1 +SET gtid_domain_id=2; +SET gtid_seq_no=10; +INSERT INTO t1 VALUES (7); + +--connection s4 +reap; +--connection s7 +reap; + + +--echo *** Test gtid_slave_pos when used with GTID *** + +--connection server_2 +--source include/stop_slave.inc + +--connection server_1 +SET gtid_domain_id=2; +SET gtid_seq_no=1000; +INSERT INTO t1 VALUES (10); +INSERT INTO t1 VALUES (11); +--save_master_pos + +--connection server_2 +SET sql_slave_skip_counter= 1; +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t1 WHERE a >= 10 ORDER BY a; +SELECT IF(LOCATE("2-1-1001", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1001 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; + +--source include/stop_slave.inc + +--connection server_1 +SET gtid_domain_id=2; +SET gtid_seq_no=1010; +INSERT INTO t1 VALUES (12); +INSERT INTO t1 VALUES (13); +--save_master_pos + +--connection server_2 +SET sql_slave_skip_counter= 2; +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t1 WHERE a >= 10 ORDER BY a; +SELECT IF(LOCATE("2-1-1011", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1011 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; + +--source include/stop_slave.inc + +--connection server_1 +SET gtid_domain_id=2; +SET gtid_seq_no=1020; +INSERT INTO t1 VALUES (14); +INSERT INTO t1 VALUES (15); +INSERT INTO t1 VALUES (16); +--save_master_pos + +--connection server_2 +SET sql_slave_skip_counter= 3; +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t1 WHERE a >= 10 ORDER BY a; +SELECT IF(LOCATE("2-1-1022", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1022 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; + +--source include/stop_slave.inc + +--connection server_1 +SET gtid_domain_id=2; +SET gtid_seq_no=1030; +INSERT INTO t1 VALUES (17); +INSERT INTO t1 VALUES (18); +INSERT INTO t1 VALUES (19); +--save_master_pos + +--connection server_2 +SET sql_slave_skip_counter= 5; +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t1 WHERE a >= 10 ORDER BY a; +SELECT IF(LOCATE("2-1-1032", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1032 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; + + +--source include/stop_slave.inc + +--connection server_1 +SET gtid_domain_id=3; +SET gtid_seq_no=100; +CREATE TABLE t2 (a INT PRIMARY KEY); +DROP TABLE t2; +SET gtid_domain_id=2; +SET gtid_seq_no=1040; +INSERT INTO t1 VALUES (20); +--save_master_pos + +--connection server_2 +SET @saved_mode= @@GLOBAL.slave_ddl_exec_mode; +SET GLOBAL slave_ddl_exec_mode=STRICT; +SET sql_slave_skip_counter=1; +START SLAVE UNTIL master_gtid_pos="3-1-100"; +--let $master_pos=3-1-100 +--source include/sync_with_master_gtid.inc +--source include/wait_for_slave_to_stop.inc +--error ER_NO_SUCH_TABLE +SELECT * FROM t2; +SELECT IF(LOCATE("3-1-100", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-100 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; + +# Start the slave again, it should fail on the DROP TABLE as the table is not there. +SET sql_log_bin=0; +CALL mtr.add_suppression("Slave: Unknown table 'test\\.t2' Error_code: 1051"); +SET sql_log_bin=1; +START SLAVE; +--let $slave_sql_errno=1051 +--source include/wait_for_slave_sql_error.inc +SELECT IF(LOCATE("3-1-100", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-100 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; + +STOP SLAVE IO_THREAD; +SET sql_slave_skip_counter=2; +--source include/start_slave.inc +--sync_with_master + +SELECT * FROM t1 WHERE a >= 20 ORDER BY a; +SELECT IF(LOCATE("3-1-101", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-101 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; +SELECT IF(LOCATE("2-1-1040", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1040 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; + +SET GLOBAL slave_ddl_exec_mode= @saved_mode; + + +--echo *** Test GTID-connecting to a master with out-of-order sequence numbers in the binlog. *** + +# Create an out-of-order binlog on server 2. +# Let server 3 replicate to an out-of-order point, stop it, restart it, +# and check that it replicates correctly despite the out-of-order. + +--connection server_1 +SET gtid_domain_id= @@GLOBAL.gtid_domain_id; +INSERT INTO t1 VALUES (31); +--save_master_pos + +--connection server_2 +--sync_with_master +SET gtid_domain_id= @@GLOBAL.gtid_domain_id; +INSERT INTO t1 VALUES (32); + +--connection server_1 +INSERT INTO t1 VALUES (33); +--save_master_pos + +--connection server_2 +--sync_with_master +--save_master_pos + +--connection server_3 +--sync_with_master +--source include/stop_slave.inc + +--connection server_1 +INSERT INTO t1 VALUES (34); +--save_master_pos + +--connection server_2 +--sync_with_master +--save_master_pos + +--connection server_3 +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t1 WHERE a >= 30 ORDER BY a; +--save_master_pos + +--connection server_4 +--sync_with_master +SELECT * FROM t1 WHERE a >= 30 ORDER BY a; + + +# Clean up. +--connection server_1 +DROP TABLE t1; + + +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_incident.inc b/mysql-test/extra/rpl_tests/rpl_incident.inc new file mode 100644 index 00000000000..350a2086681 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_incident.inc @@ -0,0 +1,63 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +--source include/have_debug.inc +--source include/master-slave.inc + +SET @old_binlog_checksum=@@binlog_checksum; +SET GLOBAL BINLOG_CHECKSUM=none; +connection slave; +SET @old_binlog_checksum=@@binlog_checksum; +SET GLOBAL BINLOG_CHECKSUM=none; +connection master; + +--echo **** On Master **** +CREATE TABLE t1 (a INT); + +INSERT INTO t1 VALUES (1),(2),(3); +SELECT * FROM t1; + +let $debug_save= `SELECT @@GLOBAL.debug`; +SET GLOBAL debug_dbug= '+d,incident_database_resync_on_replace,*'; + +# This will generate an incident log event and store it in the binary +# log before the replace statement. +REPLACE INTO t1 VALUES (4); +--save_master_pos +SELECT * FROM t1; + +--disable_query_log +eval SET GLOBAL debug_dbug= '$debug_save'; +--enable_query_log + +connection slave; +# Wait until SQL thread stops with error LOST_EVENT on master +call mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occurred on the master.* 1590"); +let $slave_sql_errno= 1590; +let $show_slave_sql_error= 1; +source include/wait_for_slave_sql_error.inc; + +# The 4 should not be inserted into the table, since the incident log +# event should have stop the slave. +--echo **** On Slave **** +SELECT * FROM t1; + +SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; +START SLAVE; +--sync_with_master + +# Now, we should have inserted the row into the table and the slave +# should be running. We should also have rotated to a new binary log. + +SELECT * FROM t1; +source include/check_slave_is_running.inc; + +connection master; +SET GLOBAL BINLOG_CHECKSUM=@old_binlog_checksum; +DROP TABLE t1; +--sync_slave_with_master +SET GLOBAL BINLOG_CHECKSUM=@old_binlog_checksum; +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_init_slave_errors.inc b/mysql-test/extra/rpl_tests/rpl_init_slave_errors.inc new file mode 100644 index 00000000000..a8ac4e3cd6e --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_init_slave_errors.inc @@ -0,0 +1,95 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +###################################################################### +# Some errors that cause the slave SQL thread to stop are not shown in +# the Slave_SQL_Error column of "SHOW SLAVE STATUS". Instead, the error +# is only in the server's error log. +# +# Two failures and their respective reporting are verified: +# +# 1 - Failures during slave thread initialization +# 2 - Failures while processing queries passed through the init_slave +# option. +# +# In order to check the first type of failure, we inject a fault in the +# SQL/IO Threads through SET GLOBAL debug. +# +# To check the second type, we set @@global.init_slave to an invalid +# command thus preventing the initialization of the SQL Thread. +# +# Obs: +# 1 - Note that testing failures while initializing the relay log position +# is hard as the same function is called before the code reaches the point +# that we want to test. +# +# 2 - This test does not target failures that are reported while applying +# events such as duplicate keys, errors while reading the relay-log.bin*, +# etc. Such errors are already checked on other tests. +###################################################################### + +###################################################################### +# Configuring the Environment +###################################################################### +source include/have_debug.inc; +source include/master-slave.inc; +source include/have_log_bin.inc; + +connection slave; + +--disable_warnings +stop slave; +--enable_warnings +reset slave; + +###################################################################### +# Injecting faults in the threads' initialization +###################################################################### +connection slave; + +# Set debug flags on slave to force errors to occur +SET GLOBAL debug_dbug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; + +start slave; + +# +# slave is going to stop because of emulated failures +# but there won't be any crashes nor asserts hit. +# +# 1593 = ER_SLAVE_FATAL_ERROR +--let $slave_sql_errno= 1593 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error.inc + +call mtr.add_suppression("Failed during slave.* thread initialization"); + +SET GLOBAL debug_dbug= ""; + +###################################################################### +# Injecting faults in the init_slave option +###################################################################### +connection slave; + +reset slave; + +SET GLOBAL init_slave= "garbage"; + +start slave; +# 1064 = ER_PARSE_ERROR +--let $slave_sql_errno= 1064 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error.inc + +###################################################################### +# Clean up +###################################################################### +SET GLOBAL init_slave= ""; + +# Clean up Last_SQL_Error +--source include/stop_slave_io.inc +RESET SLAVE; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_loaddata_local.inc b/mysql-test/extra/rpl_tests/rpl_loaddata_local.inc new file mode 100644 index 00000000000..20962d74e98 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_loaddata_local.inc @@ -0,0 +1,232 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +# See if "LOAD DATA LOCAL INFILE" is well replicated +# (LOAD DATA LOCAL INFILE is not written to the binlog +# the same way as LOAD DATA INFILE : Append_blocks are smaller). +# In MySQL 4.0 <4.0.12 there were 2 bugs with LOAD DATA LOCAL INFILE : +# - the loaded file was not written entirely to the master's binlog, +# only the first 4KB, 8KB or 16KB usually. +# - the loaded file's first line was not written entirely to the +# master's binlog (1st char was absent) +source include/master-slave.inc; + +create table t1(a int); +let $1=10000; +disable_query_log; +set SQL_LOG_BIN=0; +while ($1) +{ + insert into t1 values(1); + dec $1; +} +set SQL_LOG_BIN=1; +enable_query_log; +let $MYSQLD_DATADIR= `select @@datadir`; +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; +#This will generate a 20KB file, now test LOAD DATA LOCAL +truncate table t1; +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1; +--remove_file $MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile +sync_slave_with_master; +select a,count(*) from t1 group by a; +connection master; +drop table t1; +sync_slave_with_master; + +# End of 4.1 tests + +# +# Now let us test how well we replicate LOAD DATA LOCAL in situation when +# we met duplicates in tables to which we are adding rows. +# (It supposed that LOAD DATA LOCAL ignores such errors) +# +connection master; +create table t1(a int); +insert into t1 values (1), (2), (2), (3); +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; +drop table t1; +create table t1(a int primary key); +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1; +--remove_file $MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile +SELECT * FROM t1 ORDER BY a; +save_master_pos; +connection slave; +sync_with_master; +SELECT * FROM t1 ORDER BY a; +connection master; +drop table t1; +save_master_pos; +connection slave; +sync_with_master; + + +# +# Bug22504 load data infile sql statement in replication architecture get error +# +--echo ==== Bug22504 Initialize ==== + +--connection master + +SET sql_mode='ignore_space'; +CREATE TABLE t1(a int); +insert into t1 values (1), (2), (3), (4); +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; +truncate table t1; +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1; +--remove_file $MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile +SELECT * FROM t1 ORDER BY a; + +sync_slave_with_master; +SELECT * FROM t1 ORDER BY a; + +--echo ==== Clean up ==== + +connection master; +DROP TABLE t1; + +sync_slave_with_master; + +--echo +--echo Bug #43746: +--echo "return wrong query string when parse 'load data infile' sql statement" +--echo + +connection master; +let $MYSQLD_DATADIR= `select @@datadir`; +SELECT @@SESSION.sql_mode INTO @old_mode; + +SET sql_mode='ignore_space'; + +CREATE TABLE t1(a int); +INSERT INTO t1 VALUES (1), (2), (3), (4); + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval SELECT * INTO OUTFILE '$MYSQLD_DATADIR/bug43746.sql' FROM t1; +TRUNCATE TABLE t1; + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1; + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval LOAD/* look mum, with comments in weird places! */DATA/* oh hai */LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql'/* we are */INTO/* from the internets */TABLE t1; + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval LOAD DATA/*!10000 LOCAL */INFILE '$MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1; + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql' /*!10000 INTO */ TABLE t1; + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql' /*!10000 INTO TABLE */ t1; + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval LOAD DATA /*!10000 LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql' INTO TABLE */ t1; + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval LOAD DATA/*!10000 LOCAL */INFILE '$MYSQLD_DATADIR/bug43746.sql'/*!10000 INTO*/TABLE t1; + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval LOAD DATA/*!10000 LOCAL */INFILE '$MYSQLD_DATADIR/bug43746.sql'/* empty */INTO TABLE t1; + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval LOAD DATA/*!10000 LOCAL */INFILE '$MYSQLD_DATADIR/bug43746.sql' INTO/* empty */TABLE t1; + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval LOAD/*!999999 special comments that do not expand */DATA/*!999999 code from the future */LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql'/*!999999 have flux capacitor */INTO/*!999999 will travel */TABLE t1; + +SET sql_mode='PIPES_AS_CONCAT,ANSI_QUOTES,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER'; + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1; + +sync_slave_with_master; + +--echo +--echo Bug #59267: +--echo "LOAD DATA LOCAL INFILE not executed on slave with SBR" +--echo + +connection master; + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval SELECT * INTO OUTFILE '$MYSQLD_DATADIR/bug59267.sql' FROM t1; +TRUNCATE TABLE t1; + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug59267.sql' INTO TABLE t1; + +SELECT 'Master', COUNT(*) FROM t1; + +--sync_slave_with_master +SELECT 'Slave', COUNT(*) FROM t1; + +# cleanup +connection master; + +--remove_file $MYSQLD_DATADIR/bug43746.sql +--remove_file $MYSQLD_DATADIR/bug59267.sql + +DROP TABLE t1; +SET SESSION sql_mode=@old_mode; + +sync_slave_with_master; + +connection master; + +--echo +--echo Bug #60580/#11902767: +--echo "statement improperly replicated crashes slave sql thread" +--echo + +connection master; +let $MYSQLD_DATADIR= `select @@datadir`; + +CREATE TABLE t1(f1 INT, f2 INT); +CREATE TABLE t2(f1 INT, f2 TIMESTAMP); + +INSERT INTO t2 VALUES(1, '2011-03-22 21:01:28'); +INSERT INTO t2 VALUES(2, '2011-03-21 21:01:28'); +INSERT INTO t2 VALUES(3, '2011-03-20 21:01:28'); + +CREATE TABLE t3 AS SELECT * FROM t2; + +CREATE VIEW v1 AS SELECT * FROM t2 + WHERE f1 IN (SELECT f1 FROM t3 WHERE (t3.f2 IS NULL)); + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval SELECT 1 INTO OUTFILE '$MYSQLD_DATADIR/bug60580.csv' FROM DUAL; + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug60580.csv' INTO TABLE t1 (@f1) SET f2 = (SELECT f1 FROM v1 WHERE f1=@f1); + +SELECT * FROM t1; + +sleep 1; + +sync_slave_with_master; + +SELECT * FROM t1; + +--remove_file $MYSQLD_DATADIR/bug60580.csv + +connection master; + +DROP VIEW v1; +DROP TABLE t1, t2, t3; + +sync_slave_with_master; + +connection master; +--source include/rpl_end.inc + +--echo # End of 5.1 tests diff --git a/mysql-test/extra/rpl_tests/rpl_loadfile.inc b/mysql-test/extra/rpl_tests/rpl_loadfile.inc new file mode 100644 index 00000000000..e43c003b29c --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_loadfile.inc @@ -0,0 +1,120 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +############################################################################# +# Original Author: JBM # +# Original Date: Aug/18/2005 # +############################################################################# +# TEST: To test the LOAD_FILE() in rbr # +############################################################################# +# Change Author: JBM +# Change Date: 2006-01-16 +########## + +# Includes +-- source include/have_binlog_format_mixed_or_row.inc +-- source include/master-slave.inc + +-- source extra/rpl_tests/rpl_loadfile.test + +# BUG#39701: Mixed binlog format does not switch to row mode on LOAD_FILE +# +# DESCRIPTION +# +# Problem: when using load_file string function and mixed binlogging format +# there was no switch to row based binlogging format. This leads +# to scenarios on which the slave replicates the statement and it +# will try to load the file from local file system, which in most +# likely it will not exist. +# +# Solution: +# Marking this function as unsafe for statement format, makes the +# statement using it to be logged in row based format. As such, data +# replicated from the master, becomes the content of the loaded file. +# Consequently, the slave receives the necessary data to complete +# the load_file instruction correctly. +# +# IMPLEMENTATION +# +# The test is implemented as follows: +# +# On Master, +# i) write to file the desired content. +# ii) create table and stored procedure with load_file +# iii) stop slave +# iii) execute load_file +# iv) remove file +# +# On Slave, +# v) start slave +# vi) sync it with master so that it gets the updates from binlog (which +# should have bin logged in row format). +# +# If the the binlog format does not change to row, then the assertion +# done in the following step fails. This happens because tables differ +# since the file does not exist anymore, meaning that when slave +# attempts to execute LOAD_FILE statement it inserts NULL on table +# instead of the same contents that the master loaded when it executed +# the procedure (which was executed when file existed). +# +# vii) assert that the contents of master and slave +# table are the same + +--source include/rpl_reset.inc + +connection master; +let $file= $MYSQLTEST_VARDIR/tmp/bug_39701.data; + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval SELECT repeat('x',20) INTO OUTFILE '$file' + +disable_warnings; +DROP TABLE IF EXISTS t1; +enable_warnings; + +CREATE TABLE t1 (t text); +DELIMITER |; +CREATE PROCEDURE p(file varchar(4096)) + BEGIN + INSERT INTO t1 VALUES (LOAD_FILE(file)); + END| +DELIMITER ;| + +# stop slave before issuing the load_file on master +connection slave; +source include/stop_slave.inc; + +connection master; + +# test: check that logging falls back to rbr. +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval CALL p('$file') + +# test: remove the file from the filesystem and assert that slave still +# gets the loaded file +remove_file $file; + +# now that the file is removed it is safe (regarding what we want to test) +# to start slave +connection slave; +source include/start_slave.inc; + +connection master; +sync_slave_with_master; + +# assertion: assert that the slave got the updates even +# if the file was removed before the slave started, +# meaning that contents were indeed transfered +# through binlog (in row format) +let $diff_tables= master:t1, slave:t1; +source include/diff_tables.inc; + +# CLEAN UP +--connection master +DROP TABLE t1; +DROP PROCEDURE p; + +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_packet.inc b/mysql-test/extra/rpl_tests/rpl_packet.inc new file mode 100644 index 00000000000..41bb374b802 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_packet.inc @@ -0,0 +1,183 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +# ==== Purpose ==== +# +# Check replication protocol packet size handling +# +# ==== Related bugs ==== +# Bug#19402 SQL close to the size of the max_allowed_packet fails on slave +# BUG#23755: Replicated event larger that max_allowed_packet infinitely re-transmits +# BUG#42914: No LAST_IO_ERROR for max_allowed_packet errors +# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET + +# max-out size db name +source include/master-slave.inc; +source include/have_binlog_format_row.inc; +call mtr.add_suppression("Slave I/O: Got a packet bigger than 'slave_max_allowed_packet' bytes, .*error.* 1153"); +call mtr.add_suppression("Log entry on master is longer than slave_max_allowed_packet"); +let $db= DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________; +disable_warnings; +eval drop database if exists $db; +enable_warnings; +eval create database $db; + +connection master; +let $old_max_allowed_packet= `SELECT @@global.max_allowed_packet`; +let $old_net_buffer_length= `SELECT @@global.net_buffer_length`; +let $old_slave_max_allowed_packet= `SELECT @@global.slave_max_allowed_packet`; +SET @@global.max_allowed_packet=1024; +SET @@global.net_buffer_length=1024; + +sync_slave_with_master; +# Restart slave for setting to take effect +source include/stop_slave.inc; +source include/start_slave.inc; + +# Reconnect to master for new setting to take effect +disconnect master; + +# alas, can't use eval here; if db name changed apply the change here +connect (master,localhost,root,,DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________); + +connection master; +select @@net_buffer_length, @@max_allowed_packet; + +create table `t1` (`f1` LONGTEXT) ENGINE=MyISAM; + +INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1023'); +sync_slave_with_master; + +eval select count(*) from `$db`.`t1` /* must be 1 */; + +SHOW STATUS LIKE 'Slave_running'; +select * from information_schema.session_status where variable_name= 'SLAVE_RUNNING'; +connection master; +eval drop database $db; +sync_slave_with_master; + +# +# Bug #23755: Replicated event larger that max_allowed_packet infinitely re-transmits +# +# Check that a situation when the size of event on the master is greater than +# max_allowed_packet on the slave does not lead to infinite re-transmits. + +connection master; + +# Change the max packet size on master + +SET @@global.max_allowed_packet=4096; +SET @@global.net_buffer_length=4096; + +# Restart slave for new setting to take effect +connection slave; +source include/stop_slave.inc; +source include/start_slave.inc; + +# Reconnect to master for new setting to take effect +disconnect master; +connect (master, localhost, root); +connection master; + +CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM; + +sync_slave_with_master; + +connection master; + +INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048'); + + +# +# Bug#42914: The slave I/O thread must stop after trying to read the above +# event, However there is no Last_IO_Error report. +# + +# The slave I/O thread must stop after trying to read the above event +connection slave; +# 1153 = ER_NET_PACKET_TOO_LARGE +--let $slave_io_errno= 1153 +--let $show_slave_io_error= 1 +--source include/wait_for_slave_io_error.inc + +# TODO: this is needed because of BUG#55790. Remove once that is fixed. +--source include/stop_slave_sql.inc + +# +# Bug#42914: On the master, if a binary log event is larger than +# max_allowed_packet, the error message ER_MASTER_FATAL_ERROR_READING_BINLOG +# is sent to a slave when it requests a dump from the master, thus leading the +# I/O thread to stop. However, there is no Last_IO_Error reported. +# + +--let $rpl_only_running_threads= 1 +--source include/rpl_reset.inc +--connection master +DROP TABLE t1; +--sync_slave_with_master + + +connection master; +CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM; +sync_slave_with_master; + +connection master; +INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), REPEAT('b', @@global.max_allowed_packet)); + +connection slave; +# The slave I/O thread must stop after receiving +# 1153 = ER_NET_PACKET_TOO_LARGE +--let $slave_io_errno= 1153 +--let $show_slave_io_error= 1 +--source include/wait_for_slave_io_error.inc + +# Remove the bad binlog and clear error status on slave. +STOP SLAVE; +RESET SLAVE; +--connection master +RESET MASTER; + + +# +# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET +# +# In BUG#55322, @@session.max_allowed_packet increased each time SHOW +# BINLOG EVENTS was issued. To verify that this bug is fixed, we +# execute SHOW BINLOG EVENTS twice and check that max_allowed_packet +# never changes. We turn off the result log because we don't care +# about the contents of the binlog. + +--disable_result_log +SET @max_allowed_packet_0= @@session.max_allowed_packet; +SHOW BINLOG EVENTS; +SET @max_allowed_packet_1= @@session.max_allowed_packet; +SHOW BINLOG EVENTS; +SET @max_allowed_packet_2= @@session.max_allowed_packet; +--enable_result_log +if (`SELECT NOT(@max_allowed_packet_0 = @max_allowed_packet_1 AND @max_allowed_packet_1 = @max_allowed_packet_2)`) +{ + --echo ERROR: max_allowed_packet changed after executing SHOW BINLOG EVENTS + --source include/show_rpl_debug_info.inc + SELECT @max_allowed_packet_0, @max_allowed_packet_1, @max_allowed_packet_2; + --die @max_allowed_packet changed after executing SHOW BINLOG EVENTS +} + + +--echo ==== clean up ==== +connection master; +DROP TABLE t1; +eval SET @@global.max_allowed_packet= $old_max_allowed_packet; +eval SET @@global.net_buffer_length= $old_net_buffer_length; +eval SET @@global.slave_max_allowed_packet= $old_slave_max_allowed_packet; +# slave is stopped +connection slave; +DROP TABLE t1; + +# Clear Last_IO_Error +RESET SLAVE; + +--source include/rpl_end.inc +# End of tests diff --git a/mysql-test/extra/rpl_tests/rpl_parallel.inc b/mysql-test/extra/rpl_tests/rpl_parallel.inc new file mode 100644 index 00000000000..42354343084 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_parallel.inc @@ -0,0 +1,2219 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +# Test various aspects of parallel replication. + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +--error ER_SLAVE_MUST_STOP +SET GLOBAL slave_parallel_threads=10; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; + +# Check that we do not spawn any worker threads when no slave is running. +SELECT IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; + +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +# Check that worker threads get spawned when slave starts. +SELECT IF(COUNT(*) >= 10, "OK", CONCAT("Found too few system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; +# ... and that worker threads get removed when slave stops. +--source include/stop_slave.inc +SELECT IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; +--source include/start_slave.inc +SELECT IF(COUNT(*) >= 10, "OK", CONCAT("Found too few system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; + +--echo *** Test long-running query in domain 1 can run in parallel with short queries in domain 0 *** + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (1); +--save_master_pos + +--connection server_2 +--sync_with_master + +# Block the table t1 to simulate a replicated query taking a long time. +--connect (con_temp1,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +LOCK TABLE t1 WRITE; + +--connection server_1 +SET gtid_domain_id=1; +# This query will be blocked on the slave until UNLOCK TABLES. +INSERT INTO t1 VALUES (2); +SET gtid_domain_id=0; +# These t2 queries can be replicated in parallel with the prior t1 query, as +# they are in a separate replication domain. +INSERT INTO t2 VALUES (2); +INSERT INTO t2 VALUES (3); +BEGIN; +INSERT INTO t2 VALUES (4); +INSERT INTO t2 VALUES (5); +COMMIT; +INSERT INTO t2 VALUES (6); + +--connection server_2 +--let $wait_condition= SELECT COUNT(*) = 6 FROM t2 +--source include/wait_condition.inc + +SELECT * FROM t2 ORDER by a; + +--connection con_temp1 +SELECT * FROM t1; +UNLOCK TABLES; + +--connection server_2 +--let $wait_condition= SELECT COUNT(*) = 2 FROM t1 +--source include/wait_condition.inc + +SELECT * FROM t1 ORDER BY a; + + +--echo *** Test two transactions in different domains committed in opposite order on slave but in a single group commit. *** +--connection server_2 +--source include/stop_slave.inc + +--connection server_1 +# Use a stored function to inject a debug_sync into the appropriate THD. +# The function does nothing on the master, and on the slave it injects the +# desired debug_sync action(s). +SET sql_log_bin=0; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +SET @old_format= @@SESSION.binlog_format; +SET binlog_format='statement'; +SET gtid_domain_id=1; +INSERT INTO t2 VALUES (foo(10, + 'commit_before_enqueue SIGNAL ready1 WAIT_FOR cont1', + 'commit_after_release_LOCK_prepare_ordered SIGNAL ready2')); + +--connection server_2 +FLUSH LOGS; +--source include/wait_for_binlog_checkpoint.inc +SET sql_log_bin=0; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + IF d1 != '' THEN + SET debug_sync = d1; + END IF; + IF d2 != '' THEN + SET debug_sync = d2; + END IF; + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; +SET @old_format=@@GLOBAL.binlog_format; +SET GLOBAL binlog_format=statement; +# We need to restart all parallel threads for the new global setting to +# be copied to the session-level values. +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +--source include/start_slave.inc + +# First make sure the first insert is ready to commit, but not queued yet. +SET debug_sync='now WAIT_FOR ready1'; + +--connection server_1 +SET gtid_domain_id=2; +INSERT INTO t2 VALUES (foo(11, + 'commit_before_enqueue SIGNAL ready3 WAIT_FOR cont3', + 'commit_after_release_LOCK_prepare_ordered SIGNAL ready4 WAIT_FOR cont4')); +SET gtid_domain_id=0; +SELECT * FROM t2 WHERE a >= 10 ORDER BY a; + +--connection server_2 +# Now wait for the second insert to queue itself as the leader, and then +# wait for more commits to queue up. +SET debug_sync='now WAIT_FOR ready3'; +SET debug_sync='now SIGNAL cont3'; +SET debug_sync='now WAIT_FOR ready4'; +# Now allow the first insert to queue up to participate in group commit. +SET debug_sync='now SIGNAL cont1'; +SET debug_sync='now WAIT_FOR ready2'; +# Finally allow the second insert to proceed and do the group commit. +SET debug_sync='now SIGNAL cont4'; + +--let $wait_condition= SELECT COUNT(*) = 2 FROM t2 WHERE a >= 10 +--source include/wait_condition.inc +SELECT * FROM t2 WHERE a >= 10 ORDER BY a; +# The two INSERT transactions should have been committed in opposite order, +# but in the same group commit (seen by precense of cid=# in the SHOW +# BINLOG output). +--let $binlog_file= slave-bin.000002 +--source include/show_binlog_events.inc +FLUSH LOGS; +--source include/wait_for_binlog_checkpoint.inc + +# Restart all the slave parallel worker threads, to clear all debug_sync actions. +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +SET debug_sync='RESET'; +--source include/start_slave.inc + + +--echo *** Test that group-committed transactions on the master can replicate in parallel on the slave. *** +--connection server_1 +SET debug_sync='RESET'; +FLUSH LOGS; +--source include/wait_for_binlog_checkpoint.inc +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +# Create some sentinel rows so that the rows inserted in parallel fall into +# separate gaps and do not cause gap lock conflicts. +INSERT INTO t3 VALUES (1,1), (3,3), (5,5), (7,7); +--save_master_pos +--connection server_2 +--sync_with_master + +# We want to test that the transactions can execute out-of-order on +# the slave, but still end up committing in-order, and in a single +# group commit. +# +# The idea is to group-commit three transactions together on the master: +# A, B, and C. On the slave, C will execute the insert first, then A, +# and then B. But B manages to complete before A has time to commit, so +# all three end up committing together. +# +# So we start by setting up some row locks that will block transactions +# A and B from executing, allowing C to run first. + +--connection con_temp1 +BEGIN; +INSERT INTO t3 VALUES (2,102); +--connect (con_temp2,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +BEGIN; +INSERT INTO t3 VALUES (4,104); + +# On the master, queue three INSERT transactions as a single group commit. +--connect (con_temp3,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +SET binlog_format=statement; +send INSERT INTO t3 VALUES (2, foo(12, + 'commit_after_release_LOCK_prepare_ordered SIGNAL slave_queued1 WAIT_FOR slave_cont1', + '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connect (con_temp4,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +SET binlog_format=statement; +send INSERT INTO t3 VALUES (4, foo(14, + 'commit_after_release_LOCK_prepare_ordered SIGNAL slave_queued2', + '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; + +--connect (con_temp5,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +SET binlog_format=statement; +send INSERT INTO t3 VALUES (6, foo(16, + 'group_commit_waiting_for_prior SIGNAL slave_queued3', + '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued3'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con_temp3 +REAP; +--connection con_temp4 +REAP; +--connection con_temp5 +REAP; +SET debug_sync='RESET'; + +--connection server_1 +SELECT * FROM t3 ORDER BY a; +--let $binlog_file= master-bin.000002 +--source include/show_binlog_events.inc + +# First, wait until insert 3 is ready to queue up for group commit, but is +# waiting for insert 2 to commit before it can do so itself. +--connection server_2 +SET debug_sync='now WAIT_FOR slave_queued3'; + +# Next, let insert 1 proceed, and allow it to queue up as the group commit +# leader, but let it wait for insert 2 to also queue up before proceeding. +--connection con_temp1 +ROLLBACK; +--connection server_2 +SET debug_sync='now WAIT_FOR slave_queued1'; + +# Now let insert 2 proceed and queue up. +--connection con_temp2 +ROLLBACK; +--connection server_2 +SET debug_sync='now WAIT_FOR slave_queued2'; +# And finally, we can let insert 1 proceed and do the group commit with all +# three insert transactions together. +SET debug_sync='now SIGNAL slave_cont1'; + +# Wait for the commit to complete and check that all three transactions +# group-committed together (will be seen in the binlog as all three having +# cid=# on their GTID event). +--let $wait_condition= SELECT COUNT(*) = 3 FROM t3 WHERE a IN (2,4,6) +--source include/wait_condition.inc +SELECT * FROM t3 ORDER BY a; +--let $binlog_file= slave-bin.000003 +--source include/show_binlog_events.inc + + +--echo *** Test STOP SLAVE in parallel mode *** +--connection server_2 +--source include/stop_slave.inc +# Respawn all worker threads to clear any left-over debug_sync or other stuff. +SET debug_sync='RESET'; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; + +--connection server_1 +# Set up a couple of transactions. The first will be blocked halfway +# through on a lock, and while it is blocked we initiate STOP SLAVE. +# We then test that the halfway-initiated transaction is allowed to +# complete, but no subsequent ones. +# We have to use statement-based mode and set +# binlog_direct_non_transactional_updates=0; otherwise the binlog will +# be split into two event groups, one for the MyISAM part and one for the +# InnoDB part. +SET binlog_direct_non_transactional_updates=0; +SET sql_log_bin=0; +CALL mtr.add_suppression("Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction"); +SET sql_log_bin=1; +BEGIN; +INSERT INTO t2 VALUES (20); +--disable_warnings +INSERT INTO t1 VALUES (20); +--enable_warnings +INSERT INTO t2 VALUES (21); +INSERT INTO t3 VALUES (20, 20); +COMMIT; +INSERT INTO t3 VALUES(21, 21); +INSERT INTO t3 VALUES(22, 22); +SET binlog_format=@old_format; +--save_master_pos + +# Start a connection that will block the replicated transaction halfway. +--connection con_temp1 +BEGIN; +INSERT INTO t2 VALUES (21); + +--connection server_2 +START SLAVE; +# Wait for the MyISAM change to be visible, after which replication will wait +# for con_temp1 to roll back. +--let $wait_condition= SELECT COUNT(*) = 1 FROM t1 WHERE a=20 +--source include/wait_condition.inc + +--connection con_temp2 +# Initiate slave stop. It will have to wait for the current event group +# to complete. +# The dbug injection causes debug_sync to signal 'wait_for_done_waiting' +# when the SQL driver thread is ready. +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,rpl_parallel_wait_for_done_trigger"; +send STOP SLAVE; + +--connection con_temp1 +SET debug_sync='now WAIT_FOR wait_for_done_waiting'; +ROLLBACK; + +--connection con_temp2 +reap; +SET GLOBAL debug_dbug=@old_dbug; +SET debug_sync='RESET'; + +--connection server_2 +--source include/wait_for_slave_to_stop.inc +# We should see the first transaction applied, but not the two others. +SELECT * FROM t1 WHERE a >= 20 ORDER BY a; +SELECT * FROM t2 WHERE a >= 20 ORDER BY a; +SELECT * FROM t3 WHERE a >= 20 ORDER BY a; + +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t1 WHERE a >= 20 ORDER BY a; +SELECT * FROM t2 WHERE a >= 20 ORDER BY a; +SELECT * FROM t3 WHERE a >= 20 ORDER BY a; + + +--connection server_2 +# Respawn all worker threads to clear any left-over debug_sync or other stuff. +--source include/stop_slave.inc +SET GLOBAL binlog_format=@old_format; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +--source include/start_slave.inc + + +--echo *** Test killing slave threads at various wait points *** +--echo *** 1. Test killing transaction waiting in commit for previous transaction to commit *** + +# Set up three transactions on the master that will be group-committed +# together so they can be replicated in parallel on the slave. +--connection con_temp3 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +SET binlog_format=statement; +send INSERT INTO t3 VALUES (31, foo(31, + 'commit_before_prepare_ordered WAIT_FOR t2_waiting', + 'commit_after_prepare_ordered SIGNAL t1_ready WAIT_FOR t1_cont')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con_temp4 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +SET binlog_format=statement; +BEGIN; +# This insert is just so we can get T2 to wait while a query is running that we +# can see in SHOW PROCESSLIST so we can get its thread_id to kill later. +INSERT INTO t3 VALUES (32, foo(32, + 'ha_write_row_end SIGNAL t2_query WAIT_FOR t2_cont', + '')); +# This insert sets up debug_sync points so that T2 will tell when it is at its +# wait point where we want to kill it - and when it has been killed. +INSERT INTO t3 VALUES (33, foo(33, + 'group_commit_waiting_for_prior SIGNAL t2_waiting', + 'group_commit_waiting_for_prior_killed SIGNAL t2_killed')); +send COMMIT; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; + +--connection con_temp5 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +SET binlog_format=statement; +send INSERT INTO t3 VALUES (34, foo(34, + '', + '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued3'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con_temp3 +REAP; +--connection con_temp4 +REAP; +--connection con_temp5 +REAP; + +--connection server_1 +SELECT * FROM t3 WHERE a >= 30 ORDER BY a; +SET debug_sync='RESET'; + +--connection server_2 +SET sql_log_bin=0; +CALL mtr.add_suppression("Query execution was interrupted"); +CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); +CALL mtr.add_suppression("Slave: Connection was killed"); +SET sql_log_bin=1; +# Wait until T2 is inside executing its insert of 32, then find it in SHOW +# PROCESSLIST to know its thread id for KILL later. +SET debug_sync='now WAIT_FOR t2_query'; +--let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(32%' AND INFO NOT LIKE '%LIKE%'` +SET debug_sync='now SIGNAL t2_cont'; + +# Wait until T2 has entered its wait for T1 to commit, and T1 has +# progressed into its commit phase. +SET debug_sync='now WAIT_FOR t1_ready'; + +# Now kill the transaction T2. +--replace_result $thd_id THD_ID +eval KILL $thd_id; + +# Wait until T2 has reacted on the kill. +SET debug_sync='now WAIT_FOR t2_killed'; + +# Now we can allow T1 to proceed. +SET debug_sync='now SIGNAL t1_cont'; + +--let $slave_sql_errno= 1317,1927,1964 +--source include/wait_for_slave_sql_error.inc +STOP SLAVE IO_THREAD; +SELECT * FROM t3 WHERE a >= 30 ORDER BY a; + +# Now we have to disable the debug_sync statements, so they do not trigger +# when the events are retried. +SET debug_sync='RESET'; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +SET sql_log_bin=0; +DROP FUNCTION foo; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--connection server_1 +INSERT INTO t3 VALUES (39,0); +--save_master_pos + +--connection server_2 +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t3 WHERE a >= 30 ORDER BY a; +# Restore the foo() function. +SET sql_log_bin=0; +DROP FUNCTION foo; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + IF d1 != '' THEN + SET debug_sync = d1; + END IF; + IF d2 != '' THEN + SET debug_sync = d2; + END IF; + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + + +--connection server_2 +# Respawn all worker threads to clear any left-over debug_sync or other stuff. +--source include/stop_slave.inc +SET GLOBAL binlog_format=@old_format; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +--source include/start_slave.inc + + +--echo *** 2. Same as (1), but without restarting IO thread after kill of SQL threads *** + +# Set up three transactions on the master that will be group-committed +# together so they can be replicated in parallel on the slave. +--connection con_temp3 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +SET binlog_format=statement; +send INSERT INTO t3 VALUES (41, foo(41, + 'commit_before_prepare_ordered WAIT_FOR t2_waiting', + 'commit_after_prepare_ordered SIGNAL t1_ready WAIT_FOR t1_cont')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con_temp4 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +SET binlog_format=statement; +BEGIN; +# This insert is just so we can get T2 to wait while a query is running that we +# can see in SHOW PROCESSLIST so we can get its thread_id to kill later. +INSERT INTO t3 VALUES (42, foo(42, + 'ha_write_row_end SIGNAL t2_query WAIT_FOR t2_cont', + '')); +# This insert sets up debug_sync points so that T2 will tell when it is at its +# wait point where we want to kill it - and when it has been killed. +INSERT INTO t3 VALUES (43, foo(43, + 'group_commit_waiting_for_prior SIGNAL t2_waiting', + 'group_commit_waiting_for_prior_killed SIGNAL t2_killed')); +send COMMIT; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; + +--connection con_temp5 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +SET binlog_format=statement; +send INSERT INTO t3 VALUES (44, foo(44, + '', + '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued3'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con_temp3 +REAP; +--connection con_temp4 +REAP; +--connection con_temp5 +REAP; + +--connection server_1 +SELECT * FROM t3 WHERE a >= 40 ORDER BY a; +SET debug_sync='RESET'; + +--connection server_2 +# Wait until T2 is inside executing its insert of 42, then find it in SHOW +# PROCESSLIST to know its thread id for KILL later. +SET debug_sync='now WAIT_FOR t2_query'; +--let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(42%' AND INFO NOT LIKE '%LIKE%'` +SET debug_sync='now SIGNAL t2_cont'; + +# Wait until T2 has entered its wait for T1 to commit, and T1 has +# progressed into its commit phase. +SET debug_sync='now WAIT_FOR t1_ready'; + +# Now kill the transaction T2. +--replace_result $thd_id THD_ID +eval KILL $thd_id; + +# Wait until T2 has reacted on the kill. +SET debug_sync='now WAIT_FOR t2_killed'; + +# Now we can allow T1 to proceed. +SET debug_sync='now SIGNAL t1_cont'; + +--let $slave_sql_errno= 1317,1927,1964 +--source include/wait_for_slave_sql_error.inc + +# Now we have to disable the debug_sync statements, so they do not trigger +# when the events are retried. +SET debug_sync='RESET'; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +SET sql_log_bin=0; +DROP FUNCTION foo; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--connection server_1 +INSERT INTO t3 VALUES (49,0); +--save_master_pos + +--connection server_2 +START SLAVE SQL_THREAD; +--sync_with_master +SELECT * FROM t3 WHERE a >= 40 ORDER BY a; +# Restore the foo() function. +SET sql_log_bin=0; +DROP FUNCTION foo; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + IF d1 != '' THEN + SET debug_sync = d1; + END IF; + IF d2 != '' THEN + SET debug_sync = d2; + END IF; + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + + +--connection server_2 +# Respawn all worker threads to clear any left-over debug_sync or other stuff. +--source include/stop_slave.inc +SET GLOBAL binlog_format=@old_format; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +--source include/start_slave.inc + + +--echo *** 3. Same as (2), but not using gtid mode *** + +--connection server_2 +--source include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=no; +--source include/start_slave.inc + +--connection server_1 +# Set up three transactions on the master that will be group-committed +# together so they can be replicated in parallel on the slave. +--connection con_temp3 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +SET binlog_format=statement; +send INSERT INTO t3 VALUES (51, foo(51, + 'commit_before_prepare_ordered WAIT_FOR t2_waiting', + 'commit_after_prepare_ordered SIGNAL t1_ready WAIT_FOR t1_cont')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con_temp4 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +SET binlog_format=statement; +BEGIN; +# This insert is just so we can get T2 to wait while a query is running that we +# can see in SHOW PROCESSLIST so we can get its thread_id to kill later. +INSERT INTO t3 VALUES (52, foo(52, + 'ha_write_row_end SIGNAL t2_query WAIT_FOR t2_cont', + '')); +# This insert sets up debug_sync points so that T2 will tell when it is at its +# wait point where we want to kill it - and when it has been killed. +INSERT INTO t3 VALUES (53, foo(53, + 'group_commit_waiting_for_prior SIGNAL t2_waiting', + 'group_commit_waiting_for_prior_killed SIGNAL t2_killed')); +send COMMIT; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; + +--connection con_temp5 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +SET binlog_format=statement; +send INSERT INTO t3 VALUES (54, foo(54, + '', + '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued3'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con_temp3 +REAP; +--connection con_temp4 +REAP; +--connection con_temp5 +REAP; + +--connection server_1 +SELECT * FROM t3 WHERE a >= 50 ORDER BY a; +SET debug_sync='RESET'; + +--connection server_2 +# Wait until T2 is inside executing its insert of 52, then find it in SHOW +# PROCESSLIST to know its thread id for KILL later. +SET debug_sync='now WAIT_FOR t2_query'; +--let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(52%' AND INFO NOT LIKE '%LIKE%'` +SET debug_sync='now SIGNAL t2_cont'; + +# Wait until T2 has entered its wait for T1 to commit, and T1 has +# progressed into its commit phase. +SET debug_sync='now WAIT_FOR t1_ready'; + +# Now kill the transaction T2. +--replace_result $thd_id THD_ID +eval KILL $thd_id; + +# Wait until T2 has reacted on the kill. +SET debug_sync='now WAIT_FOR t2_killed'; + +# Now we can allow T1 to proceed. +SET debug_sync='now SIGNAL t1_cont'; + +--let $slave_sql_errno= 1317,1927,1964 +--source include/wait_for_slave_sql_error.inc +SELECT * FROM t3 WHERE a >= 50 ORDER BY a; + +# Now we have to disable the debug_sync statements, so they do not trigger +# when the events are retried. +SET debug_sync='RESET'; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +SET sql_log_bin=0; +DROP FUNCTION foo; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--connection server_1 +INSERT INTO t3 VALUES (59,0); +--save_master_pos + +--connection server_2 +START SLAVE SQL_THREAD; +--sync_with_master +SELECT * FROM t3 WHERE a >= 50 ORDER BY a; +# Restore the foo() function. +SET sql_log_bin=0; +DROP FUNCTION foo; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + IF d1 != '' THEN + SET debug_sync = d1; + END IF; + IF d2 != '' THEN + SET debug_sync = d2; + END IF; + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + + +--source include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_2 +# Respawn all worker threads to clear any left-over debug_sync or other stuff. +--source include/stop_slave.inc +SET GLOBAL binlog_format=@old_format; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=4; +--source include/start_slave.inc + + +--echo *** 4. Test killing thread that is waiting to start transaction until previous transaction commits *** + +# We set up four transactions T1, T2, T3, and T4 on the master. T2, T3, and T4 +# can run in parallel with each other (same group commit and commit id), +# but not in parallel with T1. +# +# We use four worker threads, each Ti will be queued on each their own +# worker thread. We will delay T1 commit, T3 will wait for T1 to begin +# commit before it can start. We will kill T3 during this wait, and +# check that everything works correctly. +# +# It is rather tricky to get the correct thread id of the worker to kill. +# We start by injecting four dummy transactions in a debug_sync-controlled +# manner to be able to get known thread ids for the workers in a pool with +# just 4 worker threads. Then we let in each of the real test transactions +# T1-T4 one at a time in a way which allows us to know which transaction +# ends up with which thread id. + +--connection server_1 +SET binlog_format=statement; +SET gtid_domain_id=2; +BEGIN; +# This debug_sync will linger on and be used to control T4 later. +INSERT INTO t3 VALUES (70, foo(70, + 'rpl_parallel_start_waiting_for_prior SIGNAL t4_waiting', '')); +INSERT INTO t3 VALUES (60, foo(60, + 'ha_write_row_end SIGNAL d2_query WAIT_FOR d2_cont2', + 'rpl_parallel_end_of_group SIGNAL d2_done WAIT_FOR d2_cont')); +COMMIT; +SET gtid_domain_id=0; + +--connection server_2 +SET debug_sync='now WAIT_FOR d2_query'; +--let $d2_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(60%' AND INFO NOT LIKE '%LIKE%'` + +--connection server_1 +SET gtid_domain_id=1; +BEGIN; +# These debug_sync's will linger on and be used to control T3 later. +INSERT INTO t3 VALUES (61, foo(61, + 'rpl_parallel_start_waiting_for_prior SIGNAL t3_waiting', + 'rpl_parallel_start_waiting_for_prior_killed SIGNAL t3_killed')); +INSERT INTO t3 VALUES (62, foo(62, + 'ha_write_row_end SIGNAL d1_query WAIT_FOR d1_cont2', + 'rpl_parallel_end_of_group SIGNAL d1_done WAIT_FOR d1_cont')); +COMMIT; +SET gtid_domain_id=0; + +--connection server_2 +SET debug_sync='now WAIT_FOR d1_query'; +--let $d1_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(62%' AND INFO NOT LIKE '%LIKE%'` + +--connection server_1 +SET gtid_domain_id=0; +INSERT INTO t3 VALUES (63, foo(63, + 'ha_write_row_end SIGNAL d0_query WAIT_FOR d0_cont2', + 'rpl_parallel_end_of_group SIGNAL d0_done WAIT_FOR d0_cont')); + +--connection server_2 +SET debug_sync='now WAIT_FOR d0_query'; +--let $d0_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(63%' AND INFO NOT LIKE '%LIKE%'` + +--connection server_1 +SET gtid_domain_id=3; +BEGIN; +# These debug_sync's will linger on and be used to control T2 later. +INSERT INTO t3 VALUES (68, foo(68, + 'rpl_parallel_start_waiting_for_prior SIGNAL t2_waiting', '')); +INSERT INTO t3 VALUES (69, foo(69, + 'ha_write_row_end SIGNAL d3_query WAIT_FOR d3_cont2', + 'rpl_parallel_end_of_group SIGNAL d3_done WAIT_FOR d3_cont')); +COMMIT; +SET gtid_domain_id=0; + +--connection server_2 +SET debug_sync='now WAIT_FOR d3_query'; +--let $d3_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(69%' AND INFO NOT LIKE '%LIKE%'` + +SET debug_sync='now SIGNAL d2_cont2'; +SET debug_sync='now WAIT_FOR d2_done'; +SET debug_sync='now SIGNAL d1_cont2'; +SET debug_sync='now WAIT_FOR d1_done'; +SET debug_sync='now SIGNAL d0_cont2'; +SET debug_sync='now WAIT_FOR d0_done'; +SET debug_sync='now SIGNAL d3_cont2'; +SET debug_sync='now WAIT_FOR d3_done'; + +# Now prepare the real transactions T1, T2, T3, T4 on the master. + +--connection con_temp3 +# Create transaction T1. +SET binlog_format=statement; +INSERT INTO t3 VALUES (64, foo(64, + 'rpl_parallel_before_mark_start_commit SIGNAL t1_waiting WAIT_FOR t1_cont', '')); + +# Create transaction T2, as a group commit leader on the master. +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2 WAIT_FOR master_cont2'; +send INSERT INTO t3 VALUES (65, foo(65, '', '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; + +--connection con_temp4 +# Create transaction T3, participating in T2's group commit. +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +send INSERT INTO t3 VALUES (66, foo(66, '', '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued3'; + +--connection con_temp5 +# Create transaction T4, participating in group commit with T2 and T3. +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued4'; +send INSERT INTO t3 VALUES (67, foo(67, '', '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued4'; +SET debug_sync='now SIGNAL master_cont2'; + +--connection con_temp3 +REAP; +--connection con_temp4 +REAP; +--connection con_temp5 +REAP; + +--connection server_1 +SELECT * FROM t3 WHERE a >= 60 ORDER BY a; +SET debug_sync='RESET'; + +--connection server_2 +# Now we have the four transactions pending for replication on the slave. +# Let them be queued for our three worker threads in a controlled fashion. +# We put them at a stage where T1 is delayed and T3 is waiting for T1 to +# commit before T3 can start. Then we kill T3. + +# Make the worker D0 free, and wait for T1 to be queued in it. +SET debug_sync='now SIGNAL d0_cont'; +SET debug_sync='now WAIT_FOR t1_waiting'; + +# Make the worker D3 free, and wait for T2 to be queued in it. +SET debug_sync='now SIGNAL d3_cont'; +SET debug_sync='now WAIT_FOR t2_waiting'; + +# Now release worker D1, and wait for T3 to be queued in it. +# T3 will wait for T1 to commit before it can start. +SET debug_sync='now SIGNAL d1_cont'; +SET debug_sync='now WAIT_FOR t3_waiting'; + +# Release worker D2. Wait for T4 to be queued, so we are sure it has +# received the debug_sync signal (else we might overwrite it with the +# next debug_sync). +SET debug_sync='now SIGNAL d2_cont'; +SET debug_sync='now WAIT_FOR t4_waiting'; + +# Now we kill the waiting transaction T3 in worker D1. +--replace_result $d1_thd_id THD_ID +eval KILL $d1_thd_id; + +# Wait until T3 has reacted on the kill. +SET debug_sync='now WAIT_FOR t3_killed'; + +# Now we can allow T1 to proceed. +SET debug_sync='now SIGNAL t1_cont'; + +--let $slave_sql_errno= 1317,1927,1964 +--source include/wait_for_slave_sql_error.inc +STOP SLAVE IO_THREAD; +# Since T2, T3, and T4 run in parallel, we can not be sure if T2 will have time +# to commit or not before the stop. However, T1 should commit, and T3/T4 may +# not have committed. (After slave restart we check that all become committed +# eventually). +SELECT * FROM t3 WHERE a >= 60 AND a != 65 ORDER BY a; + +# Now we have to disable the debug_sync statements, so they do not trigger +# when the events are retried. +SET debug_sync='RESET'; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +SET sql_log_bin=0; +DROP FUNCTION foo; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--connection server_1 +UPDATE t3 SET b=b+1 WHERE a=60; +--save_master_pos + +--connection server_2 +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t3 WHERE a >= 60 ORDER BY a; +# Restore the foo() function. +SET sql_log_bin=0; +DROP FUNCTION foo; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + IF d1 != '' THEN + SET debug_sync = d1; + END IF; + IF d2 != '' THEN + SET debug_sync = d2; + END IF; + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--connection server_2 +# Respawn all worker threads to clear any left-over debug_sync or other stuff. +--source include/stop_slave.inc +SET GLOBAL binlog_format=@old_format; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +--source include/start_slave.inc + + +--echo *** 5. Test killing thread that is waiting for queue of max length to shorten *** + +# Find the thread id of the driver SQL thread that we want to kill. +--let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Slave has read all relay log%' +--source include/wait_condition.inc +--let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Slave has read all relay log%'` +SET @old_max_queued= @@GLOBAL.slave_parallel_max_queued; +SET GLOBAL slave_parallel_max_queued=9000; + +--connection server_1 +--let bigstring= `SELECT REPEAT('x', 10000)` +SET binlog_format=statement; +# Create an event that will wait to be signalled. +INSERT INTO t3 VALUES (80, foo(0, + 'ha_write_row_end SIGNAL query_waiting WAIT_FOR query_cont', '')); + +--connection server_2 +SET debug_sync='now WAIT_FOR query_waiting'; +# Inject that the SQL driver thread will signal `wait_queue_ready' to debug_sync +# as it goes to wait for the event queue to become smaller than the value of +# @@slave_parallel_max_queued. +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,rpl_parallel_wait_queue_max"; + +--connection server_1 +--disable_query_log +# Create an event that will fill up the queue. +# The Xid event at the end of the event group will have to wait for the Query +# event with the INSERT to drain so the queue becomes shorter. However that in +# turn waits for the prior event group to continue. +eval INSERT INTO t3 VALUES (81, LENGTH('$bigstring')); +--enable_query_log +SELECT * FROM t3 WHERE a >= 80 ORDER BY a; + +--connection server_2 +SET debug_sync='now WAIT_FOR wait_queue_ready'; + +--replace_result $thd_id THD_ID +eval KILL $thd_id; + +SET debug_sync='now WAIT_FOR wait_queue_killed'; +SET debug_sync='now SIGNAL query_cont'; + +--let $slave_sql_errno= 1317,1927,1964 +--source include/wait_for_slave_sql_error.inc +STOP SLAVE IO_THREAD; + +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL slave_parallel_max_queued= @old_max_queued; + +--connection server_1 +INSERT INTO t3 VALUES (82,0); +SET binlog_format=@old_format; +--save_master_pos + +--connection server_2 +SET debug_sync='RESET'; +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t3 WHERE a >= 80 ORDER BY a; + + +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL binlog_format=@old_format; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +--source include/start_slave.inc + +--echo *** MDEV-5788 Incorrect free of rgi->deferred_events in parallel replication *** + +--connection server_2 +# Use just two worker threads, so we are sure to get the rpl_group_info added +# to the free list, which is what triggered the bug. +--source include/stop_slave.inc +SET GLOBAL replicate_ignore_table="test.t3"; +SET GLOBAL slave_parallel_threads=2; +--source include/start_slave.inc + +--connection server_1 +INSERT INTO t3 VALUES (100, rand()); +INSERT INTO t3 VALUES (101, rand()); + +--save_master_pos + +--connection server_2 +--sync_with_master + +--connection server_1 +INSERT INTO t3 VALUES (102, rand()); +INSERT INTO t3 VALUES (103, rand()); +INSERT INTO t3 VALUES (104, rand()); +INSERT INTO t3 VALUES (105, rand()); + +--save_master_pos + +--connection server_2 +--sync_with_master +--source include/stop_slave.inc +SET GLOBAL replicate_ignore_table=""; +--source include/start_slave.inc + +--connection server_1 +INSERT INTO t3 VALUES (106, rand()); +INSERT INTO t3 VALUES (107, rand()); +--save_master_pos + +--connection server_2 +--sync_with_master +--replace_column 2 # +SELECT * FROM t3 WHERE a >= 100 ORDER BY a; + + +--echo *** MDEV-5921: In parallel replication, an error is not correctly signalled to the next transaction *** + +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +--source include/start_slave.inc + +--connection server_1 +INSERT INTO t3 VALUES (110, 1); +--save_master_pos + +--connection server_2 +--sync_with_master +SELECT * FROM t3 WHERE a >= 110 ORDER BY a; +# Inject a duplicate key error. +SET sql_log_bin=0; +INSERT INTO t3 VALUES (111, 666); +SET sql_log_bin=1; + +--connection server_1 + +# Create a group commit with two inserts, the first one conflicts with a row on the slave +--connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send INSERT INTO t3 VALUES (111, 2); +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connect (con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +send INSERT INTO t3 VALUES (112, 3); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con1 +REAP; +--connection con2 +REAP; +SET debug_sync='RESET'; +--save_master_pos + +--connection server_2 +--let $slave_sql_errno= 1062 +--source include/wait_for_slave_sql_error.inc +--source include/wait_for_slave_sql_to_stop.inc +# We should not see the row (112,3) here, it should be rolled back due to +# error signal from the prior transaction. +SELECT * FROM t3 WHERE a >= 110 ORDER BY a; +SET sql_log_bin=0; +DELETE FROM t3 WHERE a=111 AND b=666; +SET sql_log_bin=1; +START SLAVE SQL_THREAD; +--sync_with_master +SELECT * FROM t3 WHERE a >= 110 ORDER BY a; + + +--echo ***MDEV-5914: Parallel replication deadlock due to InnoDB lock conflicts *** +--connection server_2 +--source include/stop_slave.inc + +--connection server_1 +CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; +INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); + +# Create a group commit with UPDATE and DELETE, in that order. +# The bug was that while the UPDATE's row lock does not block the DELETE, the +# DELETE's gap lock _does_ block the UPDATE. This could cause a deadlock +# on the slave. +--connection con1 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send UPDATE t4 SET b=NULL WHERE a=6; +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con2 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +send DELETE FROM t4 WHERE b <= 3; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con1 +REAP; +--connection con2 +REAP; +SET debug_sync='RESET'; +--save_master_pos + +--connection server_2 +--source include/start_slave.inc +--sync_with_master +--source include/stop_slave.inc + +SELECT * FROM t4 ORDER BY a; + + +# Another example, this one with INSERT vs. DELETE +--connection server_1 +DELETE FROM t4; +INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); + +# Create a group commit with INSERT and DELETE, in that order. +# The bug was that while the INSERT's insert intention lock does not block +# the DELETE, the DELETE's gap lock _does_ block the INSERT. This could cause +# a deadlock on the slave. +--connection con1 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send INSERT INTO t4 VALUES (7, NULL); +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con2 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +send DELETE FROM t4 WHERE b <= 3; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con1 +REAP; +--connection con2 +REAP; +SET debug_sync='RESET'; +--save_master_pos + +--connection server_2 +--source include/start_slave.inc +--sync_with_master +--source include/stop_slave.inc + +SELECT * FROM t4 ORDER BY a; + + +# MDEV-6549, failing to update gtid_slave_pos for a transaction that was retried. +# The problem was that when a transaction updates the mysql.gtid_slave_pos +# table, it clears the flag that marks that there is a GTID position that +# needs to be updated. Then, if the transaction got killed after that due +# to a deadlock, the subsequent retry would fail to notice that the GTID needs +# to be recorded in gtid_slave_pos. +# +# (In the original bug report, the symptom was an assertion; this was however +# just a side effect of the missing update of gtid_slave_pos, which also +# happened to cause a missing clear of OPTION_GTID_BEGIN). +--connection server_1 +DELETE FROM t4; +INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); + +# Create two transactions that can run in parallel on the slave but cause +# a deadlock if the second runs before the first. +--connection con1 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send UPDATE t4 SET b=NULL WHERE a=6; +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con2 +# Must use statement-based binlogging. Otherwise the transaction will not be +# binlogged at all, as it modifies no rows. +SET @old_format= @@SESSION.binlog_format; +SET binlog_format='statement'; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +send DELETE FROM t4 WHERE b <= 1; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con1 +REAP; +--connection con2 +REAP; +SET @old_format=@@GLOBAL.binlog_format; +SET debug_sync='RESET'; +--save_master_pos +--let $last_gtid= `SELECT @@last_gtid` + +--connection server_2 +# Disable the usual skip of gap locks for transactions that are run in +# parallel, using DBUG. This allows the deadlock to occur, and this in turn +# triggers a retry of the second transaction, and the code that was buggy and +# caused the gtid_slave_pos update to be skipped in the retry. +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,disable_thd_need_ordering_with"; +--source include/start_slave.inc +--sync_with_master +SET GLOBAL debug_dbug=@old_dbug; + +SELECT * FROM t4 ORDER BY a; +# Check that the GTID of the second transaction was correctly recorded in +# gtid_slave_pos, in the variable as well as in the table. +--replace_result $last_gtid GTID +eval SET @last_gtid= '$last_gtid'; +SELECT IF(@@gtid_slave_pos LIKE CONCAT('%',@last_gtid,'%'), "GTID found ok", + CONCAT("GTID ", @last_gtid, " not found in gtid_slave_pos=", @@gtid_slave_pos)) + AS result; +SELECT "ROW FOUND" AS `Is the row found?` + FROM mysql.gtid_slave_pos + WHERE CONCAT(domain_id, "-", server_id, "-", seq_no) = @last_gtid; + + +--echo *** MDEV-5938: Exec_master_log_pos not updated at log rotate in parallel replication *** +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=1; +SET DEBUG_SYNC= 'RESET'; +--source include/start_slave.inc + +--connection server_1 +CREATE TABLE t5 (a INT PRIMARY KEY, b INT); +INSERT INTO t5 VALUES (1,1); +INSERT INTO t5 VALUES (2,2), (3,8); +INSERT INTO t5 VALUES (4,16); +--save_master_pos + +--connection server_2 +--sync_with_master +let $io_file= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1); +let $io_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); +let $sql_file= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1); +let $sql_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1); +--disable_query_log +eval SELECT IF('$io_file' = '$sql_file', "OK", "Not ok, $io_file <> $sql_file") AS test_check; +eval SELECT IF('$io_pos' = '$sql_pos', "OK", "Not ok, $io_pos <> $sql_pos") AS test_check; +--enable_query_log + +--connection server_1 +FLUSH LOGS; +--source include/wait_for_binlog_checkpoint.inc +--save_master_pos + +--connection server_2 +--sync_with_master +let $io_file= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1); +let $io_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); +let $sql_file= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1); +let $sql_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1); +--disable_query_log +eval SELECT IF('$io_file' = '$sql_file', "OK", "Not ok, $io_file <> $sql_file") AS test_check; +eval SELECT IF('$io_pos' = '$sql_pos', "OK", "Not ok, $io_pos <> $sql_pos") AS test_check; +--enable_query_log + + +--echo *** MDEV_6435: Incorrect error handling when query binlogged partially on master with "killed" error *** + +--connection server_1 +CREATE TABLE t6 (a INT) ENGINE=MyISAM; +CREATE TRIGGER tr AFTER INSERT ON t6 FOR EACH ROW SET @a = 1; + +--connection con1 +SET @old_format= @@binlog_format; +SET binlog_format= statement; +--let $conid = `SELECT CONNECTION_ID()` +SET debug_sync='sp_head_execute_before_loop SIGNAL ready WAIT_FOR cont'; +send INSERT INTO t6 VALUES (1), (2), (3); + +--connection server_1 +SET debug_sync='now WAIT_FOR ready'; +--replace_result $conid CONID +eval KILL QUERY $conid; +SET debug_sync='now SIGNAL cont'; + +--connection con1 +--error ER_QUERY_INTERRUPTED +--reap +SET binlog_format= @old_format; +SET debug_sync='RESET'; +--let $after_error_gtid_pos= `SELECT @@gtid_binlog_pos` + +--connection server_1 +SET debug_sync='RESET'; + + +--connection server_2 +--let $slave_sql_errno= 1317 +--source include/wait_for_slave_sql_error.inc +STOP SLAVE IO_THREAD; +--replace_result $after_error_gtid_pos AFTER_ERROR_GTID_POS +eval SET GLOBAL gtid_slave_pos= '$after_error_gtid_pos'; +--source include/start_slave.inc + +--connection server_1 +INSERT INTO t6 VALUES (4); +SELECT * FROM t6 ORDER BY a; +--save_master_pos + +--connection server_2 +--sync_with_master +SELECT * FROM t6 ORDER BY a; + + +--echo *** MDEV-6551: Some replication errors are ignored if slave_parallel_threads > 0 *** + +--connection server_1 +INSERT INTO t2 VALUES (31); +--let $gtid1= `SELECT @@LAST_GTID` +--source include/save_master_gtid.inc + +--connection server_2 +--source include/sync_with_master_gtid.inc +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads= 0; +--source include/start_slave.inc + +# Force a duplicate key error on the slave. +SET sql_log_bin= 0; +INSERT INTO t2 VALUES (32); +SET sql_log_bin= 1; + +--connection server_1 +INSERT INTO t2 VALUES (32); +--let $gtid2= `SELECT @@LAST_GTID` +# Rotate the binlog; the bug is triggered when the master binlog file changes +# after the event group that causes the duplicate key error. +FLUSH LOGS; +INSERT INTO t2 VALUES (33); +INSERT INTO t2 VALUES (34); +SELECT * FROM t2 WHERE a >= 30 ORDER BY a; +--source include/save_master_gtid.inc + +--connection server_2 +--let $slave_sql_errno= 1062 +--source include/wait_for_slave_sql_error.inc + +--connection server_2 +--source include/stop_slave_io.inc +SET GLOBAL slave_parallel_threads=10; +START SLAVE; + +--let $slave_sql_errno= 1062 +--source include/wait_for_slave_sql_error.inc + +# Note: IO thread is still running at this point. +# The bug seems to have been that restarting the SQL thread after an error with +# the IO thread still running, somehow picks up a later relay log position and +# thus ends up skipping the failing event, rather than re-executing. + +START SLAVE SQL_THREAD; +--let $slave_sql_errno= 1062 +--source include/wait_for_slave_sql_error.inc + +SELECT * FROM t2 WHERE a >= 30 ORDER BY a; + +# Skip the duplicate error, so we can proceed. +--error ER_SLAVE_SKIP_NOT_IN_GTID +SET sql_slave_skip_counter= 1; +--source include/stop_slave_io.inc +--disable_query_log +eval SET GLOBAL gtid_slave_pos = REPLACE(@@gtid_slave_pos, "$gtid1", "$gtid2"); +--enable_query_log +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +SELECT * FROM t2 WHERE a >= 30 ORDER BY a; + + +--echo *** MDEV-6775: Wrong binlog order in parallel replication *** +--connection server_1 +# A bit tricky bug to reproduce. On the master, we binlog in statement-mode +# two transactions, an UPDATE followed by a DELETE. On the slave, we replicate +# with binlog-mode set to ROW, which means the DELETE, which modifies no rows, +# is not binlogged. Then we inject a wait in the group commit code on the +# slave, shortly before the actual commit of the UPDATE. The bug was that the +# DELETE could wake up from wait_for_prior_commit() before the commit of the +# UPDATE. So the test could see the slave position updated to after DELETE, +# while the UPDATE was still not visible. +DELETE FROM t4; +INSERT INTO t4 VALUES (1,NULL), (3,NULL), (4,4), (5, NULL), (6, 6); +--source include/save_master_gtid.inc + +--connection server_2 +--source include/sync_with_master_gtid.inc +--source include/stop_slave.inc +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,inject_binlog_commit_before_get_LOCK_log"; +SET @old_format=@@GLOBAL.binlog_format; +SET GLOBAL binlog_format=ROW; +# Re-spawn the worker threads to be sure they pick up the new binlog format +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; + +--connection con1 +SET @old_format= @@binlog_format; +SET binlog_format= statement; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send UPDATE t4 SET b=NULL WHERE a=6; +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con2 +SET @old_format= @@binlog_format; +SET binlog_format= statement; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +send DELETE FROM t4 WHERE b <= 3; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con1 +REAP; +SET binlog_format= @old_format; +--connection con2 +REAP; +SET binlog_format= @old_format; +SET debug_sync='RESET'; +--save_master_pos +SELECT * FROM t4 ORDER BY a; + +--connection server_2 +--source include/start_slave.inc +SET debug_sync= 'now WAIT_FOR waiting'; +--sync_with_master +SELECT * FROM t4 ORDER BY a; +SET debug_sync= 'now SIGNAL cont'; + +# Re-spawn the worker threads to remove any DBUG injections or DEBUG_SYNC. +--source include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL binlog_format= @old_format; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +--source include/start_slave.inc + + +--echo *** MDEV-7237: Parallel replication: incorrect relaylog position after stop/start the slave *** +--connection server_1 +INSERT INTO t2 VALUES (40); +--save_master_pos + +--connection server_2 +--sync_with_master +--source include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=no; +SET @old_dbug= @@GLOBAL.debug_dbug; +# This DBUG injection causes a DEBUG_SYNC signal "scheduled_gtid_0_x_100" when +# GTID 0-1-100 has been scheduled for and fetched by a worker thread. +SET GLOBAL debug_dbug="+d,rpl_parallel_scheduled_gtid_0_x_100"; +# This DBUG injection causes a DEBUG_SYNC signal "wait_for_done_waiting" when +# STOP SLAVE has signalled all worker threads to stop. +SET GLOBAL debug_dbug="+d,rpl_parallel_wait_for_done_trigger"; +# Reset worker threads to make DBUG setting catch on. +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; + + +--connection server_1 +# Setup some transaction for the slave to replicate. +INSERT INTO t2 VALUES (41); +INSERT INTO t2 VALUES (42); +# Need to log the DELETE in statement format, so we can see it in processlist. +SET @old_format= @@binlog_format; +SET binlog_format= statement; +DELETE FROM t2 WHERE a=40; +SET binlog_format= @old_format; +INSERT INTO t2 VALUES (43); +INSERT INTO t2 VALUES (44); +# Force the slave to switch to a new relay log file. +FLUSH LOGS; +INSERT INTO t2 VALUES (45); +# Inject a GTID 0-1-100, which will trigger a DEBUG_SYNC signal when this +# transaction has been fetched by a worker thread. +SET gtid_seq_no=100; +INSERT INTO t2 VALUES (46); +--save_master_pos + +--connection con_temp2 +# Temporarily block the DELETE on a=40 from completing. +BEGIN; +SELECT * FROM t2 WHERE a=40 FOR UPDATE; + + +--connection server_2 +--source include/start_slave.inc + +# Wait for a worker thread to start on the DELETE that will be blocked +# temporarily by the SELECT FOR UPDATE. +--let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE state='updating' and info LIKE '%DELETE FROM t2 WHERE a=40%' +--source include/wait_condition.inc + +# The DBUG injection set above will make the worker thread signal the following +# debug_sync when the GTID 0-1-100 has been reached by a worker thread. +# Thus, at this point, the SQL driver thread has reached the next +# relay log file name, while a worker thread is still processing a +# transaction in the previous relay log file, blocked on the SELECT FOR +# UPDATE. +SET debug_sync= 'now WAIT_FOR scheduled_gtid_0_x_100'; +# At this point, the SQL driver thread is in the new relay log file, while +# the DELETE from the old relay log file is not yet complete. We will stop +# the slave at this point. The bug was that the DELETE statement would +# update the slave position to the _new_ relay log file name instead of +# its own old file name. Thus, by stoping and restarting the slave at this +# point, we would get an error at restart due to incorrect position. (If +# we would let the slave catch up before stopping, the incorrect position +# would be corrected by a later transaction). + +send STOP SLAVE; + +--connection con_temp2 +# Wait for STOP SLAVE to have proceeded sufficiently that it has signalled +# all worker threads to stop; this ensures that we will stop after the DELETE +# transaction (and not after a later transaction that might have been able +# to set a fixed position). +SET debug_sync= 'now WAIT_FOR wait_for_done_waiting'; +# Now release the row lock that was blocking the replication of DELETE. +ROLLBACK; + +--connection server_2 +reap; +--source include/wait_for_slave_sql_to_stop.inc +SELECT * FROM t2 WHERE a >= 40 ORDER BY a; +# Now restart the slave. With the bug present, this would start at an +# incorrect relay log position, causing relay log read error (or if unlucky, +# silently skip a number of events). +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t2 WHERE a >= 40 ORDER BY a; +--source include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET DEBUG_SYNC= 'RESET'; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + + +--echo *** MDEV-7326 Server deadlock in connection with parallel replication *** +# We use three transactions, each in a separate group commit. +# T1 does mark_start_commit(), then gets a deadlock error. +# T2 wakes up and starts running +# T1 does unmark_start_commit() +# T3 goes to wait for T2 to start its commit +# T2 does mark_start_commit() +# The bug was that at this point, T3 got deadlocked. Because T1 has unmarked(), +# T3 did not yet see the count_committing_event_groups reach its target value +# yet. But when T1 later re-did mark_start_commit(), it failed to send a wakeup +# to T3. + +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=3; +SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_xid"; +--source include/start_slave.inc + +--connection server_1 +SET @old_format= @@SESSION.binlog_format; +SET binlog_format= STATEMENT; +# This debug_sync will linger on and be used to control T3 later. +INSERT INTO t1 VALUES (foo(50, + "rpl_parallel_start_waiting_for_prior SIGNAL t3_ready", + "rpl_parallel_end_of_group SIGNAL prep_ready WAIT_FOR prep_cont")); +--save_master_pos +--connection server_2 +# Wait for the debug_sync point for T3 to be set. But let the preparation +# transaction remain hanging, so that T1 and T2 will be scheduled for the +# remaining two worker threads. +SET DEBUG_SYNC= "now WAIT_FOR prep_ready"; + +--connection server_1 +INSERT INTO t2 VALUES (foo(50, + "rpl_parallel_simulate_temp_err_xid SIGNAL t1_ready1 WAIT_FOR t1_cont1", + "rpl_parallel_retry_after_unmark SIGNAL t1_ready2 WAIT_FOR t1_cont2")); +--save_master_pos + +--connection server_2 +SET DEBUG_SYNC= "now WAIT_FOR t1_ready1"; +# T1 has now done mark_start_commit(). It will later do a rollback and retry. + +--connection server_1 +# Use a MyISAM table for T2 and T3, so they do not trigger the +# rpl_parallel_simulate_temp_err_xid DBUG insertion on XID event. +INSERT INTO t1 VALUES (foo(51, + "rpl_parallel_before_mark_start_commit SIGNAL t2_ready1 WAIT_FOR t2_cont1", + "rpl_parallel_after_mark_start_commit SIGNAL t2_ready2")); + +--connection server_2 +SET DEBUG_SYNC= "now WAIT_FOR t2_ready1"; +# T2 has now started running, but has not yet done mark_start_commit() +SET DEBUG_SYNC= "now SIGNAL t1_cont1"; +SET DEBUG_SYNC= "now WAIT_FOR t1_ready2"; +# T1 has now done unmark_start_commit() in preparation for its retry. + +--connection server_1 +INSERT INTO t1 VALUES (52); +SET BINLOG_FORMAT= @old_format; +SELECT * FROM t2 WHERE a>=50 ORDER BY a; +SELECT * FROM t1 WHERE a>=50 ORDER BY a; + +--connection server_2 +# Let the preparation transaction complete, so that the same worker thread +# can continue with the transaction T3. +SET DEBUG_SYNC= "now SIGNAL prep_cont"; +SET DEBUG_SYNC= "now WAIT_FOR t3_ready"; +# T3 has now gone to wait for T2 to start committing +SET DEBUG_SYNC= "now SIGNAL t2_cont1"; +SET DEBUG_SYNC= "now WAIT_FOR t2_ready2"; +# T2 has now done mark_start_commit(). +# Let things run, and check that T3 does not get deadlocked. +SET DEBUG_SYNC= "now SIGNAL t1_cont2"; +--sync_with_master + +--connection server_1 +--save_master_pos +--connection server_2 +--sync_with_master +SELECT * FROM t2 WHERE a>=50 ORDER BY a; +SELECT * FROM t1 WHERE a>=50 ORDER BY a; +SET DEBUG_SYNC="reset"; + +# Re-spawn the worker threads to remove any DBUG injections or DEBUG_SYNC. +--source include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +--source include/start_slave.inc + + +--echo *** MDEV-7326 Server deadlock in connection with parallel replication *** +# Similar to the previous test, but with T2 and T3 in the same GCO. +# We use three transactions, T1 in one group commit and T2/T3 in another. +# T1 does mark_start_commit(), then gets a deadlock error. +# T2 wakes up and starts running +# T1 does unmark_start_commit() +# T3 goes to wait for T1 to start its commit +# T2 does mark_start_commit() +# The bug was that at this point, T3 got deadlocked. T2 increments the +# count_committing_event_groups but does not signal T3, as they are in +# the same GCO. Then later when T1 increments, it would also not signal +# T3, because now the count_committing_event_groups is not equal to the +# wait_count of T3 (it is one larger). + +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=3; +SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_xid"; +--source include/start_slave.inc + +--connection server_1 +SET @old_format= @@SESSION.binlog_format; +SET binlog_format= STATEMENT; +# This debug_sync will linger on and be used to control T3 later. +INSERT INTO t1 VALUES (foo(60, + "rpl_parallel_start_waiting_for_prior SIGNAL t3_ready", + "rpl_parallel_end_of_group SIGNAL prep_ready WAIT_FOR prep_cont")); +--save_master_pos +--connection server_2 +# Wait for the debug_sync point for T3 to be set. But let the preparation +# transaction remain hanging, so that T1 and T2 will be scheduled for the +# remaining two worker threads. +SET DEBUG_SYNC= "now WAIT_FOR prep_ready"; + +--connection server_1 +INSERT INTO t2 VALUES (foo(60, + "rpl_parallel_simulate_temp_err_xid SIGNAL t1_ready1 WAIT_FOR t1_cont1", + "rpl_parallel_retry_after_unmark SIGNAL t1_ready2 WAIT_FOR t1_cont2")); +--save_master_pos + +--connection server_2 +SET DEBUG_SYNC= "now WAIT_FOR t1_ready1"; +# T1 has now done mark_start_commit(). It will later do a rollback and retry. + +# Do T2 and T3 in a single group commit. +# Use a MyISAM table for T2 and T3, so they do not trigger the +# rpl_parallel_simulate_temp_err_xid DBUG insertion on XID event. +--connection con_temp3 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +SET binlog_format=statement; +send INSERT INTO t1 VALUES (foo(61, + "rpl_parallel_before_mark_start_commit SIGNAL t2_ready1 WAIT_FOR t2_cont1", + "rpl_parallel_after_mark_start_commit SIGNAL t2_ready2")); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con_temp4 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +send INSERT INTO t6 VALUES (62); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con_temp3 +REAP; +--connection con_temp4 +REAP; + +--connection server_1 +SET debug_sync='RESET'; +SET BINLOG_FORMAT= @old_format; +SELECT * FROM t2 WHERE a>=60 ORDER BY a; +SELECT * FROM t1 WHERE a>=60 ORDER BY a; +SELECT * FROM t6 WHERE a>=60 ORDER BY a; + +--connection server_2 +SET DEBUG_SYNC= "now WAIT_FOR t2_ready1"; +# T2 has now started running, but has not yet done mark_start_commit() +SET DEBUG_SYNC= "now SIGNAL t1_cont1"; +SET DEBUG_SYNC= "now WAIT_FOR t1_ready2"; +# T1 has now done unmark_start_commit() in preparation for its retry. + +--connection server_2 +# Let the preparation transaction complete, so that the same worker thread +# can continue with the transaction T3. +SET DEBUG_SYNC= "now SIGNAL prep_cont"; +SET DEBUG_SYNC= "now WAIT_FOR t3_ready"; +# T3 has now gone to wait for T2 to start committing +SET DEBUG_SYNC= "now SIGNAL t2_cont1"; +SET DEBUG_SYNC= "now WAIT_FOR t2_ready2"; +# T2 has now done mark_start_commit(). +# Let things run, and check that T3 does not get deadlocked. +SET DEBUG_SYNC= "now SIGNAL t1_cont2"; +--sync_with_master + +--connection server_1 +--save_master_pos +--connection server_2 +--sync_with_master +SELECT * FROM t2 WHERE a>=60 ORDER BY a; +SELECT * FROM t1 WHERE a>=60 ORDER BY a; +SELECT * FROM t6 WHERE a>=60 ORDER BY a; +SET DEBUG_SYNC="reset"; + +# Re-spawn the worker threads to remove any DBUG injections or DEBUG_SYNC. +--source include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +--source include/start_slave.inc + +--echo *** MDEV-7335: Potential parallel slave deadlock with specific binlog corruption *** + +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=1; +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000"; + +--connection server_1 +INSERT INTO t2 VALUES (101); +INSERT INTO t2 VALUES (102); +INSERT INTO t2 VALUES (103); +INSERT INTO t2 VALUES (104); +INSERT INTO t2 VALUES (105); +# Inject a partial event group (missing XID at the end). The bug was that such +# partial group was not handled appropriately, leading to server deadlock. +SET gtid_seq_no=1000; +INSERT INTO t2 VALUES (106); +INSERT INTO t2 VALUES (107); +INSERT INTO t2 VALUES (108); +INSERT INTO t2 VALUES (109); +INSERT INTO t2 VALUES (110); +INSERT INTO t2 VALUES (111); +INSERT INTO t2 VALUES (112); +INSERT INTO t2 VALUES (113); +INSERT INTO t2 VALUES (114); +INSERT INTO t2 VALUES (115); +INSERT INTO t2 VALUES (116); +INSERT INTO t2 VALUES (117); +INSERT INTO t2 VALUES (118); +INSERT INTO t2 VALUES (119); +INSERT INTO t2 VALUES (120); +INSERT INTO t2 VALUES (121); +INSERT INTO t2 VALUES (122); +INSERT INTO t2 VALUES (123); +INSERT INTO t2 VALUES (124); +INSERT INTO t2 VALUES (125); +INSERT INTO t2 VALUES (126); +INSERT INTO t2 VALUES (127); +INSERT INTO t2 VALUES (128); +INSERT INTO t2 VALUES (129); +INSERT INTO t2 VALUES (130); +--source include/save_master_gtid.inc + +--connection server_2 +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc +# The partial event group (a=106) should be rolled back and thus missing. +SELECT * FROM t2 WHERE a >= 100 ORDER BY a; + +--source include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL slave_parallel_threads=10; +--source include/start_slave.inc + +--echo *** MDEV-6676 - test syntax of @@slave_parallel_mode *** +--connection server_2 + +--let $status_items= Parallel_Mode +--source include/show_slave_status.inc +--source include/stop_slave.inc +SET GLOBAL slave_parallel_mode='aggressive'; +--let $status_items= Parallel_Mode +--source include/show_slave_status.inc +SET GLOBAL slave_parallel_mode='conservative'; +--let $status_items= Parallel_Mode +--source include/show_slave_status.inc + + +--echo *** MDEV-6676 - test that empty parallel_mode does not replicate in parallel *** +--connection server_1 +INSERT INTO t2 VALUES (1040); +--source include/save_master_gtid.inc + +--connection server_2 +SET GLOBAL slave_parallel_mode='none'; +# Test that we do not use parallel apply, by injecting an unconditional +# crash in the parallel apply code. +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,slave_crash_if_parallel_apply"; +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc +SELECT * FROM t2 WHERE a >= 1040 ORDER BY a; +--source include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; + + +--echo *** MDEV-6676 - test disabling domain-based parallel replication *** +--connection server_1 +# Let's do a bunch of transactions that will conflict if run out-of-order in +# domain-based parallel replication mode. +SET gtid_domain_id = 1; +INSERT INTO t2 VALUES (1041); +INSERT INTO t2 VALUES (1042); +INSERT INTO t2 VALUES (1043); +INSERT INTO t2 VALUES (1044); +INSERT INTO t2 VALUES (1045); +INSERT INTO t2 VALUES (1046); +DELETE FROM t2 WHERE a >= 1041; +SET gtid_domain_id = 2; +INSERT INTO t2 VALUES (1041); +INSERT INTO t2 VALUES (1042); +INSERT INTO t2 VALUES (1043); +INSERT INTO t2 VALUES (1044); +INSERT INTO t2 VALUES (1045); +INSERT INTO t2 VALUES (1046); +SET gtid_domain_id = 0; +--source include/save_master_gtid.inc +--connection server_2 +SET GLOBAL slave_parallel_mode=minimal; +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc +SELECT * FROM t2 WHERE a >= 1040 ORDER BY a; + +--echo *** MDEV-7888: ANALYZE TABLE does wakeup_subsequent_commits(), causing wrong binlog order and parallel replication hang *** + +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_mode='conservative'; +SET GLOBAL slave_parallel_threads=10; + +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug= '+d,inject_analyze_table_sleep'; + +--connection server_1 +# Inject two group commits. The bug was that ANALYZE TABLE would call +# wakeup_subsequent_commits() too early, allowing the following transaction +# in the same group to run ahead and binlog and free the GCO. Then we get +# wrong binlog order and later access freed GCO, which causes lost wakeup +# of following GCO and thus replication hang. +# We injected a small sleep in ANALYZE to make the race easier to hit (this +# can only cause false negatives in versions with the bug, not false positives, +# so sleep is ok here. And it's in general not possible to trigger reliably +# the race with debug_sync, since the bugfix makes the race impossible). + +SET @old_dbug= @@SESSION.debug_dbug; +SET SESSION debug_dbug="+d,binlog_force_commit_id"; + +# Group commit with cid=10000, two event groups. +SET @commit_id= 10000; +ANALYZE TABLE t2; +INSERT INTO t3 VALUES (120, 0); + +# Group commit with cid=10001, one event group. +SET @commit_id= 10001; +INSERT INTO t3 VALUES (121, 0); + +SET SESSION debug_dbug=@old_dbug; + +SELECT * FROM t3 WHERE a >= 120 ORDER BY a; +--source include/save_master_gtid.inc + +--connection server_2 +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +SELECT * FROM t3 WHERE a >= 120 ORDER BY a; + +--source include/stop_slave.inc +SET GLOBAL debug_dbug= @old_dbug; +--source include/start_slave.inc + + +--echo *** MDEV-7929: record_gtid() for non-transactional event group calls wakeup_subsequent_commits() too early, causing slave hang. *** + +--connection server_2 +--source include/stop_slave.inc +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug= '+d,inject_record_gtid_serverid_100_sleep'; + +--connection server_1 +# Inject two group commits. The bug was that record_gtid for a +# non-transactional event group would commit its own transaction, which would +# cause ha_commit_trans() to call wakeup_subsequent_commits() too early. This +# in turn lead to access to freed group_commit_orderer object, losing a wakeup +# and causing slave threads to hang. +# We inject a small sleep in the corresponding record_gtid() to make the race +# easier to hit. + +SET @old_dbug= @@SESSION.debug_dbug; +SET SESSION debug_dbug="+d,binlog_force_commit_id"; + +# Group commit with cid=10010, two event groups. +SET @old_server_id= @@SESSION.server_id; +SET SESSION server_id= 100; +SET @commit_id= 10010; +ALTER TABLE t1 COMMENT "Hulubulu!"; +SET SESSION server_id= @old_server_id; +INSERT INTO t3 VALUES (130, 0); + +# Group commit with cid=10011, one event group. +SET @commit_id= 10011; +INSERT INTO t3 VALUES (131, 0); + +SET SESSION debug_dbug=@old_dbug; + +SELECT * FROM t3 WHERE a >= 130 ORDER BY a; +--source include/save_master_gtid.inc + +--connection server_2 +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +SELECT * FROM t3 WHERE a >= 130 ORDER BY a; + +--source include/stop_slave.inc +SET GLOBAL debug_dbug= @old_dbug; +--source include/start_slave.inc + + +--echo *** MDEV-8031: Parallel replication stops on "connection killed" error (probably incorrectly handled deadlock kill) *** + +--connection server_1 +INSERT INTO t3 VALUES (201,0), (202,0); +--source include/save_master_gtid.inc + +--connection server_2 +--source include/sync_with_master_gtid.inc +--source include/stop_slave.inc +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug= '+d,inject_mdev8031'; + +--connection server_1 +# We artificially create a situation that hopefully resembles the original +# bug which was only seen "in the wild", and only once. +# Setup a fake group commit with lots of conflicts that will lead to deadloc +# kill. The slave DBUG injection causes the slave to be deadlock killed at +# a particular point during the retry, and then later do a small sleep at +# another critical point where the prior transaction then has a chance to +# complete. Finally an extra KILL check catches an unhandled, lingering +# deadlock kill. So rather artificial, but at least it exercises the +# relevant code paths. +SET @old_dbug= @@SESSION.debug_dbug; +SET SESSION debug_dbug="+d,binlog_force_commit_id"; + +SET @commit_id= 10200; +INSERT INTO t3 VALUES (203, 1); +INSERT INTO t3 VALUES (204, 1); +INSERT INTO t3 VALUES (205, 1); +UPDATE t3 SET b=b+1 WHERE a=201; +UPDATE t3 SET b=b+1 WHERE a=201; +UPDATE t3 SET b=b+1 WHERE a=201; +UPDATE t3 SET b=b+1 WHERE a=202; +UPDATE t3 SET b=b+1 WHERE a=202; +UPDATE t3 SET b=b+1 WHERE a=202; +UPDATE t3 SET b=b+1 WHERE a=202; +UPDATE t3 SET b=b+1 WHERE a=203; +UPDATE t3 SET b=b+1 WHERE a=203; +UPDATE t3 SET b=b+1 WHERE a=204; +UPDATE t3 SET b=b+1 WHERE a=204; +UPDATE t3 SET b=b+1 WHERE a=204; +UPDATE t3 SET b=b+1 WHERE a=203; +UPDATE t3 SET b=b+1 WHERE a=205; +UPDATE t3 SET b=b+1 WHERE a=205; +SET SESSION debug_dbug=@old_dbug; + +SELECT * FROM t3 WHERE a>=200 ORDER BY a; +--source include/save_master_gtid.inc + +--connection server_2 +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +SELECT * FROM t3 WHERE a>=200 ORDER BY a; +--source include/stop_slave.inc +SET GLOBAL debug_dbug= @old_dbug; +--source include/start_slave.inc + + +--echo *** Check getting deadlock killed inside open_binlog() during retry. *** + +--connection server_2 +--source include/stop_slave.inc +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug= '+d,inject_retry_event_group_open_binlog_kill'; +SET @old_max= @@GLOBAL.max_relay_log_size; +SET GLOBAL max_relay_log_size= 4096; + +--connection server_1 +SET @old_dbug= @@SESSION.debug_dbug; +SET SESSION debug_dbug="+d,binlog_force_commit_id"; + +--let $large= `SELECT REPEAT("*", 8192)` +SET @commit_id= 10210; +--echo Omit long queries that cause relaylog rotations and transaction retries... +--disable_query_log +eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=205 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=205 /* $large */; +--enable_query_log +SET SESSION debug_dbug=@old_dbug; + +SELECT * FROM t3 WHERE a>=200 ORDER BY a; +--source include/save_master_gtid.inc + +--connection server_2 +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +SELECT * FROM t3 WHERE a>=200 ORDER BY a; +--source include/stop_slave.inc +SET GLOBAL debug_dbug= @old_debg; +SET GLOBAL max_relay_log_size= @old_max; +--source include/start_slave.inc + +--echo *** MDEV-8725: Assertion on ROLLBACK statement in the binary log *** +--connection server_1 +# Inject an event group terminated by ROLLBACK, by mixing MyISAM and InnoDB +# in a transaction. The bug was an assertion on the ROLLBACK due to +# mark_start_commit() being already called. +--disable_warnings +BEGIN; +INSERT INTO t2 VALUES (2000); +INSERT INTO t1 VALUES (2000); +INSERT INTO t2 VALUES (2001); +ROLLBACK; +--enable_warnings +SELECT * FROM t1 WHERE a>=2000 ORDER BY a; +SELECT * FROM t2 WHERE a>=2000 ORDER BY a; +--source include/save_master_gtid.inc + +--connection server_2 +--source include/sync_with_master_gtid.inc +SELECT * FROM t1 WHERE a>=2000 ORDER BY a; +SELECT * FROM t2 WHERE a>=2000 ORDER BY a; + + +# Clean up. +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; + +--connection server_1 +DROP function foo; +DROP TABLE t1,t2,t3,t4,t5,t6; +SET DEBUG_SYNC= 'RESET'; + +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_parallel_show_binlog_events_purge_logs.inc b/mysql-test/extra/rpl_tests/rpl_parallel_show_binlog_events_purge_logs.inc new file mode 100644 index 00000000000..7801498adb4 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_parallel_show_binlog_events_purge_logs.inc @@ -0,0 +1,37 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +# BUG#13979418: SHOW BINLOG EVENTS MAY CRASH THE SERVER +# +# The function mysql_show_binlog_events has a local stack variable +# 'LOG_INFO linfo;', which is assigned to thd->current_linfo, however +# this variable goes out of scope and is destroyed before clean +# thd->current_linfo. +# +# This test case runs SHOW BINLOG EVENTS and FLUSH LOGS to make sure +# that with the fix local variable linfo is valid along all +# mysql_show_binlog_events function scope. +# +--source include/have_debug_sync.inc +--source include/master-slave.inc + +--connection slave +SET DEBUG_SYNC= 'after_show_binlog_events SIGNAL on_show_binlog_events WAIT_FOR end'; +--send SHOW BINLOG EVENTS + +--connection slave1 +SET DEBUG_SYNC= 'now WAIT_FOR on_show_binlog_events'; +FLUSH LOGS; +SET DEBUG_SYNC= 'now SIGNAL end'; + +--connection slave +--disable_result_log +--reap +--enable_result_log +SET DEBUG_SYNC= 'RESET'; + +--connection master +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_relayrotate.inc b/mysql-test/extra/rpl_tests/rpl_relayrotate.inc new file mode 100644 index 00000000000..ce638e419ff --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_relayrotate.inc @@ -0,0 +1,18 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +####################################################### +# Wrapper for rpl_relayrotate.test to allow multi # +# Engines to reuse test code. By JBM 2006-02-15 # +####################################################### +-- source include/have_innodb.inc +# Slow test, don't run during staging part +-- source include/not_staging.inc +-- source include/master-slave.inc + +let $engine_type=innodb; +-- source extra/rpl_tests/rpl_relayrotate.test +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_semi_sync.inc b/mysql-test/extra/rpl_tests/rpl_semi_sync.inc new file mode 100644 index 00000000000..12053c54f4e --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_semi_sync.inc @@ -0,0 +1,551 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +source include/have_semisync.inc; +source include/not_embedded.inc; +source include/have_innodb.inc; +source include/master-slave.inc; + +let $engine_type= InnoDB; +#let $engine_type= MyISAM; + +# Suppress warnings that might be generated during the test +connection master; +call mtr.add_suppression("Timeout waiting for reply of binlog"); +call mtr.add_suppression("Read semi-sync reply"); +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT."); +connection slave; +call mtr.add_suppression("Master server does not support semi-sync"); +call mtr.add_suppression("Semi-sync slave .* reply"); +call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); +connection master; + +# wait for dying connections (if any) to disappear +let $wait_condition= select count(*) = 0 from information_schema.processlist where command='killed'; +--source include/wait_condition.inc + +# After fix of BUG#45848, semi-sync slave should not create any extra +# connections on master, save the count of connections before start +# semi-sync slave for comparison below. +let $_connections_normal_slave= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1); + +--echo # +--echo # Uninstall semi-sync plugins on master and slave +--echo # +connection slave; +source include/stop_slave.inc; +reset slave; +set global rpl_semi_sync_master_enabled= 0; +set global rpl_semi_sync_slave_enabled= 0; + +connection master; +reset master; +set global rpl_semi_sync_master_enabled= 0; +set global rpl_semi_sync_slave_enabled= 0; + +--echo # +--echo # Main test of semi-sync replication start here +--echo # + +connection master; + +set global rpl_semi_sync_master_timeout= 60000; # 60s + +echo [ default state of semi-sync on master should be OFF ]; +show variables like 'rpl_semi_sync_master_enabled'; + +echo [ enable semi-sync on master ]; +set global rpl_semi_sync_master_enabled = 1; +show variables like 'rpl_semi_sync_master_enabled'; + +echo [ status of semi-sync on master should be ON even without any semi-sync slaves ]; +show status like 'Rpl_semi_sync_master_clients'; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +--echo # +--echo # BUG#45672 Semisync repl: ActiveTranx:insert_tranx_node: transaction node allocation failed +--echo # BUG#45673 Semisynch reports correct operation even if no slave is connected +--echo # + +# BUG#45672 When semi-sync is enabled on master, it would allocate +# transaction node even without semi-sync slave connected, and would +# finally result in transaction node allocation error. +# +# Semi-sync master will pre-allocate 'max_connections' transaction +# nodes, so here we do more than that much transactions to check if it +# will fail or not. +# select @@global.max_connections + 1; +let $i= `select @@global.max_connections + 1`; +disable_query_log; +eval create table t1 (a int) engine=$engine_type; +while ($i) +{ + eval insert into t1 values ($i); + dec $i; +} +drop table t1; +enable_query_log; + +# BUG#45673 +echo [ status of semi-sync on master should be OFF ]; +show status like 'Rpl_semi_sync_master_clients'; +show status like 'Rpl_semi_sync_master_status'; +--replace_result 305 304 +show status like 'Rpl_semi_sync_master_yes_tx'; + +# reset master to make sure the following test will start with a clean environment +reset master; + +connection slave; + +echo [ default state of semi-sync on slave should be OFF ]; +show variables like 'rpl_semi_sync_slave_enabled'; + +echo [ enable semi-sync on slave ]; +set global rpl_semi_sync_slave_enabled = 1; +show variables like 'rpl_semi_sync_slave_enabled'; +source include/start_slave.inc; + +connection master; + +# NOTE: Rpl_semi_sync_master_client will only be updated when +# semi-sync slave has started binlog dump request +let $status_var= Rpl_semi_sync_master_clients; +let $status_var_value= 1; +source include/wait_for_status_var.inc; + +echo [ initial master state after the semi-sync slave connected ]; +show status like 'Rpl_semi_sync_master_clients'; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +replace_result $engine_type ENGINE_TYPE; +eval create table t1(a int) engine = $engine_type; + +echo [ master state after CREATE TABLE statement ]; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +# After fix of BUG#45848, semi-sync slave should not create any extra +# connections on master. +let $_connections_semisync_slave= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1); +replace_result $_connections_normal_slave CONNECTIONS_NORMAL_SLAVE $_connections_semisync_slave CONNECTIONS_SEMISYNC_SLAVE; +eval select $_connections_semisync_slave - $_connections_normal_slave as 'Should be 0'; + +echo [ insert records to table ]; +insert t1 values (10); +insert t1 values (9); +insert t1 values (8); +insert t1 values (7); +insert t1 values (6); +insert t1 values (5); +insert t1 values (4); +insert t1 values (3); +insert t1 values (2); +insert t1 values (1); + +echo [ master status after inserts ]; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +sync_slave_with_master; + +echo [ slave status after replicated inserts ]; +show status like 'Rpl_semi_sync_slave_status'; + +select count(distinct a) from t1; +select min(a) from t1; +select max(a) from t1; + +--echo +--echo # BUG#50157 +--echo # semi-sync replication crashes when replicating a transaction which +--echo # include 'CREATE TEMPORARY TABLE `MyISAM_t` SELECT * FROM `Innodb_t` ; + +connection master; +SET SESSION AUTOCOMMIT= 0; +CREATE TABLE t2(c1 INT) ENGINE=innodb; +sync_slave_with_master; + +connection master; +BEGIN; +--echo +--echo # Even though it is in a transaction, this statement is binlogged into binlog +--echo # file immediately. +--disable_warnings +CREATE TEMPORARY TABLE t3 SELECT c1 FROM t2 where 1=1; +--enable_warnings +--echo +--echo # These statements will not be binlogged until the transaction is committed +INSERT INTO t2 VALUES(11); +INSERT INTO t2 VALUES(22); +COMMIT; + +DROP TABLE t2, t3; +SET SESSION AUTOCOMMIT= 1; +sync_slave_with_master; + + +--echo # +--echo # Test semi-sync master will switch OFF after one transaction +--echo # timeout waiting for slave reply. +--echo # +connection slave; +source include/stop_slave.inc; + +connection master; +set global rpl_semi_sync_master_timeout= 5000; + +# The first semi-sync check should be on because after slave stop, +# there are no transactions on the master. +echo [ master status should be ON ]; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +--replace_result 305 304 +show status like 'Rpl_semi_sync_master_yes_tx'; +show status like 'Rpl_semi_sync_master_clients'; + +echo [ semi-sync replication of these transactions will fail ]; +insert into t1 values (500); + +# Wait for the semi-sync replication of this transaction to timeout +let $status_var= Rpl_semi_sync_master_status; +let $status_var_value= OFF; +source include/wait_for_status_var.inc; + +# The second semi-sync check should be off because one transaction +# times out during waiting. +echo [ master status should be OFF ]; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +--replace_result 305 304 +show status like 'Rpl_semi_sync_master_yes_tx'; + +# Semi-sync status on master is now OFF, so all these transactions +# will be replicated asynchronously. +delete from t1 where a=10; +delete from t1 where a=9; +delete from t1 where a=8; +delete from t1 where a=7; +delete from t1 where a=6; +delete from t1 where a=5; +delete from t1 where a=4; +delete from t1 where a=3; +delete from t1 where a=2; +delete from t1 where a=1; + +insert into t1 values (100); + +echo [ master status should be OFF ]; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +--replace_result 305 304 +show status like 'Rpl_semi_sync_master_yes_tx'; + +--echo # +--echo # Test semi-sync status on master will be ON again when slave catches up +--echo # + +# Save the master position for later use. +save_master_pos; + +connection slave; + +echo [ slave status should be OFF ]; +show status like 'Rpl_semi_sync_slave_status'; +source include/start_slave.inc; +sync_with_master; + +echo [ slave status should be ON ]; +show status like 'Rpl_semi_sync_slave_status'; + +select count(distinct a) from t1; +select min(a) from t1; +select max(a) from t1; + +connection master; + +# The master semi-sync status should be on again after slave catches up. +echo [ master status should be ON again after slave catches up ]; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +--replace_result 305 304 +show status like 'Rpl_semi_sync_master_yes_tx'; +show status like 'Rpl_semi_sync_master_clients'; + +--echo # +--echo # Test disable/enable master semi-sync on the fly. +--echo # + +drop table t1; +sync_slave_with_master; + +source include/stop_slave.inc; + +--echo # +--echo # Flush status +--echo # +connection master; +echo [ Semi-sync master status variables before FLUSH STATUS ]; +SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx'; +SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx'; +# Do not write the FLUSH STATUS to binlog, to make sure we'll get a +# clean status after this. +FLUSH NO_WRITE_TO_BINLOG STATUS; +echo [ Semi-sync master status variables after FLUSH STATUS ]; +SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx'; +SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx'; + +connection master; + +source include/show_master_logs.inc; +show variables like 'rpl_semi_sync_master_enabled'; + +echo [ disable semi-sync on the fly ]; +set global rpl_semi_sync_master_enabled=0; +show variables like 'rpl_semi_sync_master_enabled'; +show status like 'Rpl_semi_sync_master_status'; + +echo [ enable semi-sync on the fly ]; +set global rpl_semi_sync_master_enabled=1; +show variables like 'rpl_semi_sync_master_enabled'; +show status like 'Rpl_semi_sync_master_status'; + +--echo # +--echo # Test RESET MASTER/SLAVE +--echo # + +connection slave; + +source include/start_slave.inc; + +connection master; + +replace_result $engine_type ENGINE_TYPE; +eval create table t1 (a int) engine = $engine_type; +drop table t1; + +##show status like 'Rpl_semi_sync_master_status'; + +sync_slave_with_master; +--replace_column 2 # +show status like 'Rpl_relay%'; + +echo [ test reset master ]; +connection master; + +reset master; + +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +connection slave; + +source include/stop_slave.inc; +reset slave; + +# Kill the dump thread on master for previous slave connection and +# wait for it to exit +connection master; +let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`; +if ($_tid) +{ + --replace_result $_tid _tid + eval kill query $_tid; + + # After dump thread exit, Rpl_semi_sync_master_clients will be 0 + let $status_var= Rpl_semi_sync_master_clients; + let $status_var_value= 0; + source include/wait_for_status_var.inc; +} + +connection slave; +source include/start_slave.inc; + +connection master; + +# Wait for dump thread to start, Rpl_semi_sync_master_clients will be +# 1 after dump thread started. +let $status_var= Rpl_semi_sync_master_clients; +let $status_var_value= 1; +source include/wait_for_status_var.inc; + +replace_result $engine_type ENGINE_TYPE; +eval create table t1 (a int) engine = $engine_type; +insert into t1 values (1); +insert into t1 values (2), (3); + +sync_slave_with_master; + +select * from t1; + +connection master; + +echo [ master semi-sync status should be ON ]; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +--echo # +--echo # Start semi-sync replication without SUPER privilege +--echo # +connection slave; +source include/stop_slave.inc; +reset slave; +connection master; +reset master; + +# Kill the dump thread on master for previous slave connection and wait for it to exit +let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`; +if ($_tid) +{ + --replace_result $_tid _tid + eval kill query $_tid; + + # After dump thread exit, Rpl_semi_sync_master_clients will be 0 + let $status_var= Rpl_semi_sync_master_clients; + let $status_var_value= 0; + source include/wait_for_status_var.inc; +} + +# Do not binlog the following statement because it will generate +# different events for ROW and STATEMENT format +set sql_log_bin=0; +grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password'; +flush privileges; +set sql_log_bin=1; +connection slave; +grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password'; +flush privileges; +change master to master_user='rpl',master_password='rpl_password'; +source include/start_slave.inc; +show status like 'Rpl_semi_sync_slave_status'; +connection master; + +# Wait for the semi-sync binlog dump thread to start +let $status_var= Rpl_semi_sync_master_clients; +let $status_var_value= 1; +source include/wait_for_status_var.inc; +echo [ master semi-sync should be ON ]; +show status like 'Rpl_semi_sync_master_clients'; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; +insert into t1 values (4); +insert into t1 values (5); +echo [ master semi-sync should be ON ]; +show status like 'Rpl_semi_sync_master_clients'; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +--echo # +--echo # Test semi-sync slave connect to non-semi-sync master +--echo # + +# Disable semi-sync on master +connection slave; +source include/stop_slave.inc; +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; + +connection master; + +# Kill the dump thread on master for previous slave connection and wait for it to exit +let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`; +if ($_tid) +{ + --replace_result $_tid _tid + eval kill query $_tid; + + # After dump thread exit, Rpl_semi_sync_master_clients will be 0 + let $status_var= Rpl_semi_sync_master_clients; + let $status_var_value= 0; + source include/wait_for_status_var.inc; +} + +echo [ Semi-sync status on master should be ON ]; +show status like 'Rpl_semi_sync_master_clients'; +show status like 'Rpl_semi_sync_master_status'; +set global rpl_semi_sync_master_enabled= 0; + +connection slave; +SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; +source include/start_slave.inc; +connection master; +insert into t1 values (8); +let $status_var= Rpl_semi_sync_master_clients; +let $status_var_value= 1; +source include/wait_for_status_var.inc; +echo [ master semi-sync clients should be 1, status should be OFF ]; +show status like 'Rpl_semi_sync_master_clients'; +show status like 'Rpl_semi_sync_master_status'; +sync_slave_with_master; +show status like 'Rpl_semi_sync_slave_status'; + +# Uninstall semi-sync plugin on master +connection slave; +source include/stop_slave.inc; +connection master; +set global rpl_semi_sync_master_enabled= 0; + +connection slave; +SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; +source include/start_slave.inc; + +connection master; +insert into t1 values (10); +sync_slave_with_master; + +--echo # +--echo # Test non-semi-sync slave connect to semi-sync master +--echo # + +connection master; +set global rpl_semi_sync_master_timeout= 5000; # 5s +set global rpl_semi_sync_master_enabled= 1; + +connection slave; +source include/stop_slave.inc; +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; + +echo [ uninstall semi-sync slave plugin ]; +set global rpl_semi_sync_slave_enabled= 0; + +echo [ reinstall semi-sync slave plugin and disable semi-sync ]; +SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; +source include/start_slave.inc; +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; + +--echo # +--echo # Clean up +--echo # + +connection slave; +source include/stop_slave.inc; +set global rpl_semi_sync_slave_enabled= 0; + +connection master; +set global rpl_semi_sync_master_enabled= 0; + +connection slave; +change master to master_user='root',master_password=''; +source include/start_slave.inc; + +connection master; +drop table t1; +sync_slave_with_master; + +connection master; +drop user rpl@127.0.0.1; +flush privileges; +set global rpl_semi_sync_master_timeout= default; +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_skip_replication.inc b/mysql-test/extra/rpl_tests/rpl_skip_replication.inc new file mode 100644 index 00000000000..14e3339ff5e --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_skip_replication.inc @@ -0,0 +1,402 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it. +# +# Usage: +# +# --let $use_remote_mysqlbinlog= 1 # optional +# --source extra/rpl_tests/rpl_skip_replication.inc +# +# The script uses MYSQLBINLOG to verify certain results. +# By default, it uses binary logs directly. If it is undesirable, +# this behavior can be overridden by setting $use_remote_binlog +# as shown above. +# The value will be unset after every execution of the script, +# so if it is needed, it should be set explicitly before each call. +# + +--source include/master-slave.inc +--source include/have_innodb.inc + +connection slave; +# Test that SUPER is required to change @@replicate_events_marked_for_skip. +CREATE USER 'nonsuperuser'@'127.0.0.1'; +GRANT ALTER,CREATE,DELETE,DROP,EVENT,INSERT,PROCESS,REPLICATION SLAVE, + SELECT,UPDATE ON *.* TO 'nonsuperuser'@'127.0.0.1'; +connect(nonpriv, 127.0.0.1, nonsuperuser,, test, $SLAVE_MYPORT,); +connection nonpriv; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; +disconnect nonpriv; +connection slave; +DROP USER'nonsuperuser'@'127.0.0.1'; + +SELECT @@global.replicate_events_marked_for_skip; +--error ER_SLAVE_MUST_STOP +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; +SELECT @@global.replicate_events_marked_for_skip; +STOP SLAVE; +--error ER_GLOBAL_VARIABLE +SET SESSION replicate_events_marked_for_skip=FILTER_ON_MASTER; +SELECT @@global.replicate_events_marked_for_skip; +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; +SELECT @@global.replicate_events_marked_for_skip; +START SLAVE; + +connection master; +SELECT @@skip_replication; +--error ER_LOCAL_VARIABLE +SET GLOBAL skip_replication=1; +SELECT @@skip_replication; + +CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=myisam; +CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=innodb; +INSERT INTO t1(a) VALUES (1); +INSERT INTO t2(a) VALUES (1); + + +# Test that master-side filtering works. +SET skip_replication=1; + +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam; +INSERT INTO t1(a) VALUES (2); +INSERT INTO t2(a) VALUES (2); + +# Inject a rotate event in the binlog stream sent to slave (otherwise we will +# fail sync_slave_with_master as the last event on the master is not present +# on the slave). +FLUSH NO_WRITE_TO_BINLOG LOGS; + +sync_slave_with_master; +connection slave; +SHOW TABLES; +SELECT * FROM t1; +SELECT * FROM t2; + +connection master; +DROP TABLE t3; + +FLUSH NO_WRITE_TO_BINLOG LOGS; +sync_slave_with_master; + + +# Test that slave-side filtering works. +connection slave; +STOP SLAVE; +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; +START SLAVE; + +connection master; +SET skip_replication=1; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam; +INSERT INTO t1(a) VALUES (3); +INSERT INTO t2(a) VALUES (3); + +# Inject a rotate event in the binlog stream sent to slave (otherwise we will +# fail sync_slave_with_master as the last event on the master is not present +# on the slave). +FLUSH NO_WRITE_TO_BINLOG LOGS; + +sync_slave_with_master; +connection slave; +SHOW TABLES; +SELECT * FROM t1; +SELECT * FROM t2; + +connection master; +DROP TABLE t3; + +FLUSH NO_WRITE_TO_BINLOG LOGS; +sync_slave_with_master; +connection slave; +STOP SLAVE; +SET GLOBAL replicate_events_marked_for_skip=REPLICATE; +START SLAVE; + + +# Test that events with @@skip_replication=1 are not filtered when filtering is +# not set on slave. +connection master; +SET skip_replication=1; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam; +INSERT INTO t3(a) VALUES(2); +sync_slave_with_master; +connection slave; +SELECT * FROM t3; +connection master; +DROP TABLE t3; + +# +# Test that the slave will preserve the @@skip_replication flag in its +# own binlog. +# + +TRUNCATE t1; +sync_slave_with_master; +connection slave; +RESET MASTER; + +connection master; +SET skip_replication=0; +INSERT INTO t1 VALUES (1,0); +SET skip_replication=1; +INSERT INTO t1 VALUES (2,0); +SET skip_replication=0; +INSERT INTO t1 VALUES (3,0); + +sync_slave_with_master; +connection slave; +# Since slave has @@replicate_events_marked_for_skip=REPLICATE, it should have +# applied all events. +SELECT * FROM t1 ORDER by a; + +STOP SLAVE; +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; +let $SLAVE_DATADIR= `select @@datadir`; + +connection master; +TRUNCATE t1; + +# Now apply the slave binlog to the master, to check that both the slave +# and mysqlbinlog will preserve the @@skip_replication flag. + +--let $mysqlbinlog_args= $SLAVE_DATADIR/slave-bin.000001 +if ($use_remote_mysqlbinlog) +{ + --let $mysqlbinlog_args= --read-from-remote-server --protocol=tcp --host=127.0.0.1 --port=$SLAVE_MYPORT -uroot slave-bin.000001 + --let $use_remote_mysqlbinlog= 0 +} +--exec $MYSQL_BINLOG $mysqlbinlog_args > $MYSQLTEST_VARDIR/tmp/rpl_skip_replication.binlog +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/rpl_skip_replication.binlog + +# The master should have all three events. +SELECT * FROM t1 ORDER by a; + +# The slave should be missing event 2, which is marked with the +# @@skip_replication flag. + +connection slave; +START SLAVE; + +connection master; +sync_slave_with_master; + +connection slave; +SELECT * FROM t1 ORDER by a; + +# +# Test that @@sql_slave_skip_counter does not count skipped @@skip_replication +# events. +# + +connection master; +TRUNCATE t1; + +sync_slave_with_master; +connection slave; +STOP SLAVE; +# We will skip two INSERTs (in addition to any skipped due to +# @@skip_replication). Since from 5.5 every statement is wrapped in +# BEGIN ... END, we need to skip 6 events for this. +SET GLOBAL sql_slave_skip_counter=6; +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; +START SLAVE; + +connection master; +# Need to fix @@binlog_format to get consistent event count. +SET @old_binlog_format= @@binlog_format; +SET binlog_format= statement; +SET skip_replication=0; +INSERT INTO t1 VALUES (1,5); +SET skip_replication=1; +INSERT INTO t1 VALUES (2,5); +SET skip_replication=0; +INSERT INTO t1 VALUES (3,5); +INSERT INTO t1 VALUES (4,5); +SET binlog_format= @old_binlog_format; + +sync_slave_with_master; +connection slave; + +# The slave should have skipped the first three inserts (number 1 and 3 due +# to @@sql_slave_skip_counter=2, number 2 due to +# @@replicate_events_marked_for_skip=FILTER_ON_SLAVE). So only number 4 +# should be left. +SELECT * FROM t1; + + +# +# Check that BINLOG statement preserves the @@skip_replication flag. +# +connection slave; +# Need row @@binlog_format for BINLOG statements containing row events. +--source include/stop_slave.inc +SET @old_slave_binlog_format= @@global.binlog_format; +SET GLOBAL binlog_format= row; +--source include/start_slave.inc + +connection master; +TRUNCATE t1; + +SET @old_binlog_format= @@binlog_format; +SET binlog_format= row; +# Format description log event. +BINLOG 'wlZOTw8BAAAA8QAAAPUAAAAAAAQANS41LjIxLU1hcmlhREItZGVidWctbG9nAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAA2QAEGggAAAAICAgCAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAA371saA=='; +# INSERT INTO t1 VALUES (1,8) # with @@skip_replication=1 +BINLOG 'wlZOTxMBAAAAKgAAAGMBAAAAgCkAAAAAAAEABHRlc3QAAnQxAAIDAwAC +wlZOTxcBAAAAJgAAAIkBAAAAgCkAAAAAAAEAAv/8AQAAAAgAAAA='; +# INSERT INTO t1 VALUES (2,8) # with @@skip_replication=0 +BINLOG 'wlZOTxMBAAAAKgAAADwCAAAAACkAAAAAAAEABHRlc3QAAnQxAAIDAwAC +wlZOTxcBAAAAJgAAAGICAAAAACkAAAAAAAEAAv/8AgAAAAgAAAA='; +SET binlog_format= @old_binlog_format; + +SELECT * FROM t1 ORDER BY a; +sync_slave_with_master; +connection slave; +# Slave should have only the second insert, the first should be ignored due to +# the @@skip_replication flag. +SELECT * FROM t1 ORDER by a; + +--source include/stop_slave.inc +SET GLOBAL binlog_format= @old_slave_binlog_format; +--source include/start_slave.inc + + +# Test that it is not possible to change @@skip_replication inside a +# transaction or statement, thereby replicating only parts of statements +# or transactions. +connection master; +SET skip_replication=0; + +BEGIN; +--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION +SET skip_replication=0; +--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION +SET skip_replication=1; +ROLLBACK; +SET skip_replication=1; +BEGIN; +--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION +SET skip_replication=0; +--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION +SET skip_replication=1; +COMMIT; +SET autocommit=0; +INSERT INTO t2(a) VALUES(100); +--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION +SET skip_replication=1; +ROLLBACK; +SET autocommit=1; + +SET skip_replication=1; +--delimiter | +CREATE FUNCTION foo (x INT) RETURNS INT BEGIN SET SESSION skip_replication=x; RETURN x; END| +CREATE PROCEDURE bar(x INT) BEGIN SET SESSION skip_replication=x; END| +CREATE FUNCTION baz (x INT) RETURNS INT BEGIN CALL bar(x); RETURN x; END| +--delimiter ; +--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION +SELECT foo(0); +--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION +SELECT baz(0); +--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION +SET @a= foo(1); +--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION +SET @a= baz(1); +--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION +UPDATE t2 SET b=foo(0); +--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION +UPDATE t2 SET b=baz(0); +--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION +INSERT INTO t1 VALUES (101, foo(1)); +--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION +INSERT INTO t1 VALUES (101, baz(0)); +SELECT @@skip_replication; +CALL bar(0); +SELECT @@skip_replication; +CALL bar(1); +SELECT @@skip_replication; +DROP FUNCTION foo; +DROP PROCEDURE bar; +DROP FUNCTION baz; + + +# Test that master-side filtering happens on the master side, and that +# slave-side filtering happens on the slave. + +# First test that events do not reach the slave when master-side filtering +# is configured. Do this by replicating first with only the IO thread running +# and master-side filtering; then change to no filtering and start the SQL +# thread. This should still skip the events, as master-side filtering +# means the events never reached the slave. +connection master; +SET skip_replication= 0; +TRUNCATE t1; +sync_slave_with_master; +connection slave; +STOP SLAVE; +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; +START SLAVE IO_THREAD; +connection master; +SET skip_replication= 1; +INSERT INTO t1(a) VALUES (1); +SET skip_replication= 0; +INSERT INTO t1(a) VALUES (2); +--source include/save_master_pos.inc +connection slave; +--source include/sync_io_with_master.inc +STOP SLAVE IO_THREAD; +SET GLOBAL replicate_events_marked_for_skip=REPLICATE; +START SLAVE; +connection master; +sync_slave_with_master; +connection slave; +# Now only the second insert of (2) should be visible, as the first was +# filtered on the master, so even though the SQL thread ran without skipping +# events, it will never see the event in the first place. +SELECT * FROM t1; + +# Now tests that when slave-side filtering is configured, events _do_ reach +# the slave. +connection master; +SET skip_replication= 0; +TRUNCATE t1; +sync_slave_with_master; +connection slave; +STOP SLAVE; +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; +START SLAVE IO_THREAD; +connection master; +SET skip_replication= 1; +INSERT INTO t1(a) VALUES (1); +SET skip_replication= 0; +INSERT INTO t1(a) VALUES (2); +--source include/save_master_pos.inc +connection slave; +--source include/sync_io_with_master.inc +STOP SLAVE IO_THREAD; +SET GLOBAL replicate_events_marked_for_skip=REPLICATE; +START SLAVE; +connection master; +sync_slave_with_master; +connection slave; +# Now both inserts should be visible. Since filtering was configured to be +# slave-side, the event is in the relay log, and when the SQL thread ran we +# had disabled filtering again. +SELECT * FROM t1 ORDER BY a; + + +# Clean up. +connection master; +SET skip_replication=0; +DROP TABLE t1,t2; +connection slave; +STOP SLAVE; +SET GLOBAL replicate_events_marked_for_skip=REPLICATE; +START SLAVE; + +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_special_charset.inc b/mysql-test/extra/rpl_tests/rpl_special_charset.inc new file mode 100644 index 00000000000..51119b319d7 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_special_charset.inc @@ -0,0 +1,32 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +################################################################################ +# Bug#19855907 IO THREAD AUTHENTICATION ISSUE WITH SOME CHARACTER SETS +# Problem: IO thread fails to connect to master if servers are configured with +# special character sets like utf16, utf32, ucs2. +# +# Analysis: MySQL server does not support few special character sets like +# utf16,utf32 and ucs2 as "client's character set"(eg: utf16,utf32, ucs2). +# When IO thread is trying to connect to Master, it sets server's character +# set as client's character set. When Slave server is started with these +# special character sets, IO thread (a connection to Master) fails because +# of the above said reason. +# +# Fix: If server's character set is not supported as client's character set, +# then set default's client character set(latin1) as client's character set. +############################################################################### +--source include/master-slave.inc +call mtr.add_suppression("Cannot use utf16 as character_set_client"); +CREATE TABLE t1(i VARCHAR(20)); +INSERT INTO t1 VALUES (0xFFFF); +--sync_slave_with_master +--let diff_tables=master:t1, slave:t1 +--source include/diff_tables.inc +# Cleanup +--connection master +DROP TABLE t1; +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_sporadic_master.inc b/mysql-test/extra/rpl_tests/rpl_sporadic_master.inc new file mode 100644 index 00000000000..ad4c44cbf74 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_sporadic_master.inc @@ -0,0 +1,32 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +# test to see if replication can continue when master sporadically fails on +# COM_BINLOG_DUMP and additionally limits the number of events per dump + +source include/master-slave.inc; + +create table t2(n int); +create table t1(n int not null auto_increment primary key); +insert into t1 values (NULL),(NULL); +truncate table t1; +# We have to use 4 in the following to make this test work with all table types +insert into t1 values (4),(NULL); +sync_slave_with_master; +--source include/stop_slave.inc +--source include/start_slave.inc +connection master; +insert into t1 values (NULL),(NULL); +flush logs; +truncate table t1; +insert into t1 values (10),(NULL),(NULL),(NULL),(NULL),(NULL); +sync_slave_with_master; +select * from t1 ORDER BY n; +connection master; +drop table t1,t2; +sync_slave_with_master; + +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_ssl.inc b/mysql-test/extra/rpl_tests/rpl_ssl.inc new file mode 100644 index 00000000000..aff5499c8e5 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_ssl.inc @@ -0,0 +1,115 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +source include/have_ssl_communication.inc; +source include/master-slave.inc; + +# create a user for replication that requires ssl encryption +connection master; +create user replssl@localhost; +grant replication slave on *.* to replssl@localhost require ssl; +create table t1 (t int auto_increment, KEY(t)); + +sync_slave_with_master; + +# Set slave to use SSL for connection to master +stop slave; +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +eval change master to + master_user='replssl', + master_password='', + master_ssl=1, + master_ssl_ca ='$MYSQL_TEST_DIR/std_data/cacert.pem', + master_ssl_cert='$MYSQL_TEST_DIR/std_data/client-cert.pem', + master_ssl_key='$MYSQL_TEST_DIR/std_data/client-key.pem'; +start slave; + +# Switch to master and insert one record, then sync it to slave +connection master; +insert into t1 values(1); +sync_slave_with_master; + +# The record should now be on slave +select * from t1; + +# The slave is synced and waiting/reading from master +# SHOW SLAVE STATUS will show "Waiting for master to send event" +let $status_items= Master_SSL_Allowed, Master_SSL_CA_Path, Master_SSL_CA_File, Master_SSL_Cert, Master_SSL_Key; +source include/show_slave_status.inc; +source include/check_slave_is_running.inc; + +# Stop the slave, as reported in bug#21871 it would hang +STOP SLAVE; + +select * from t1; + +# Do the same thing a number of times +disable_query_log; +disable_result_log; +# 2007-11-27 mats Bug #32756 Starting and stopping the slave in a loop can lose rows +# After discussions with Engineering, I'm disabling this part of the test to avoid it causing +# red trees. +disable_parsing; +let $i= 100; +while ($i) +{ + start slave; + connection master; + insert into t1 values (NULL); + select * from t1; # Some variance + connection slave; + select * from t1; # Some variance + stop slave; + dec $i; +} +enable_parsing; +START SLAVE; +enable_query_log; +enable_result_log; +connection master; +# INSERT one more record to make sure +# the sync has something to do +insert into t1 values (NULL); +let $master_count= `select count(*) from t1`; + +sync_slave_with_master; +--source include/wait_for_slave_to_start.inc +source include/show_slave_status.inc; +source include/check_slave_is_running.inc; + +let $slave_count= `select count(*) from t1`; + +if ($slave_count != $master_count) +{ + echo master and slave differed in number of rows; + echo master: $master_count; + echo slave: $slave_count; + + connection master; + select count(*) t1; + select * from t1; + connection slave; + select count(*) t1; + select * from t1; + query_vertical show slave status; +} + +connection master; +drop user replssl@localhost; +drop table t1; +sync_slave_with_master; + +--source include/stop_slave.inc +CHANGE MASTER TO + master_user = 'root', + master_ssl = 0, + master_ssl_ca = '', + master_ssl_cert = '', + master_ssl_key = ''; + +--echo End of 5.0 tests +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_stm_relay_ign_space.inc b/mysql-test/extra/rpl_tests/rpl_stm_relay_ign_space.inc new file mode 100644 index 00000000000..82c4b1881bf --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_stm_relay_ign_space.inc @@ -0,0 +1,107 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +# +# BUG#12400313 / BUG#64503 test case +# +# +# Description +# ----------- +# +# This test case starts the slave server with: +# --relay-log-space-limit=8192 --relay-log-purge --max-relay-log-size=4096 +# +# Then it issues some queries that will cause the slave to reach +# relay-log-space-limit. We lock the table so that the SQL thread is +# not able to purge the log and then we issue some more statements. +# +# The purpose is to show that the IO thread will honor the limits +# while the SQL thread is not able to purge the relay logs, which did +# not happen before this patch. In addition we assert that while +# ignoring the limit (SQL thread needs to rotate before purging), the +# IO thread does not do it in an uncontrolled manner. + +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc +--source include/have_innodb.inc + +--disable_query_log +CREATE TABLE t1 (c1 TEXT) engine=InnoDB; + +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); + +--sync_slave_with_master + +# wait for the SQL thread to sleep +--let $show_statement= SHOW PROCESSLIST +--let $field= State +--let $condition= = 'Slave has read all relay log; waiting for the slave I/O thread to update it' +--source include/wait_show_condition.inc + +# now the io thread has set rli->ignore_space_limit +# lets lock the table so that once the SQL thread awakes +# it blocks there and does not set rli->ignore_space_limit +# back to zero +LOCK TABLE t1 WRITE; + +# now issue more statements that will overflow the +# rli->log_space_limit (in this case ~10K) +--connection master + +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); + +--connection slave + +# ASSERT that the IO thread waits for the SQL thread to release some +# space before continuing +--let $show_statement= SHOW PROCESSLIST +--let $field= State +--let $condition= LIKE 'Waiting for %' +# before the patch (IO would have transfered everything) +#--let $condition= = 'Waiting for master to send event' +# after the patch (now it waits for space to be freed) +#--let $condition= = 'Waiting for the slave SQL thread to free enough relay log space' +--source include/wait_show_condition.inc + +# without the patch we can uncomment the following two lines and +# watch the IO thread synchronize with the master, thus writing +# relay logs way over the space limit +#--connection master +#--source include/sync_slave_io_with_master.inc + +## ASSERT that the IO thread has honored the limit+few bytes required to be able to purge +--let $relay_log_space_while_sql_is_executing = query_get_value(SHOW SLAVE STATUS, Relay_Log_Space, 1) +--let $relay_log_space_limit = query_get_value(SHOW VARIABLES LIKE "relay_log_space_limit", Value, 1) +--let $assert_text= Assert that relay log space is close to the limit +--let $assert_cond= $relay_log_space_while_sql_is_executing <= $relay_log_space_limit * 1.15 +--source include/assert.inc + +# unlock the table and let SQL thread continue applying events +UNLOCK TABLES; + +--connection master +--sync_slave_with_master +--let $diff_tables=master:test.t1,slave:test.t1 +--source include/diff_tables.inc + +--connection master +DROP TABLE t1; +--enable_query_log +--sync_slave_with_master + +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_switch_stm_row_mixed.inc b/mysql-test/extra/rpl_tests/rpl_switch_stm_row_mixed.inc new file mode 100644 index 00000000000..e74fd6828c6 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_switch_stm_row_mixed.inc @@ -0,0 +1,631 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +# +# rpl_switch_stm_row_mixed tests covers +# +# - Master is switching explicitly between STATEMENT, ROW, and MIXED +# binlog format showing when it is possible and when not. +# - Master switching from MIXED to RBR implicitly listing all use +# cases, e.g a query invokes UUID(), thereafter to serve as the +# definition of MIXED binlog format +# - correctness of execution + + +-- source include/have_binlog_format_mixed_or_row.inc +-- source include/master-slave.inc + +# Since this test generates row-based events in the binary log, the +# slave SQL thread cannot be in STATEMENT mode to execute this test, +# so we only execute it for MIXED and ROW as default value of +# BINLOG_FORMAT. + +connection slave; + +connection master; +--disable_warnings +drop database if exists mysqltest1; +create database mysqltest1; +--enable_warnings +use mysqltest1; + +# Save binlog format +set @my_binlog_format= @@global.binlog_format; + +# play with switching +set session binlog_format=mixed; +show session variables like "binlog_format%"; +set session binlog_format=statement; +show session variables like "binlog_format%"; +set session binlog_format=row; +show session variables like "binlog_format%"; + +set global binlog_format=DEFAULT; +show global variables like "binlog_format%"; +set global binlog_format=MIXED; +show global variables like "binlog_format%"; +set global binlog_format=STATEMENT; +show global variables like "binlog_format%"; +set global binlog_format=ROW; +show global variables like "binlog_format%"; +show session variables like "binlog_format%"; +select @@global.binlog_format, @@session.binlog_format; + +CREATE TABLE t1 (a varchar(100)); + +prepare stmt1 from 'insert into t1 select concat(UUID(),?)'; +set @string="emergency_1_"; +insert into t1 values("work_2_"); +execute stmt1 using @string; +deallocate prepare stmt1; + +prepare stmt1 from 'insert into t1 select ?'; +insert into t1 values(concat(UUID(),"work_3_")); +execute stmt1 using @string; +deallocate prepare stmt1; + +insert into t1 values(concat("for_4_",UUID())); +insert into t1 select "yesterday_5_"; + +# verify that temp tables prevent a switch to SBR +create temporary table tmp(a char(100)); +insert into tmp values("see_6_"); +--error ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR +set binlog_format=statement; +insert into t1 select * from tmp; +drop temporary table tmp; + +# Now we go to SBR +set binlog_format=statement; +show global variables like "binlog_format%"; +show session variables like "binlog_format%"; +select @@global.binlog_format, @@session.binlog_format; +set global binlog_format=statement; +show global variables like "binlog_format%"; +show session variables like "binlog_format%"; +select @@global.binlog_format, @@session.binlog_format; + +prepare stmt1 from 'insert into t1 select ?'; +set @string="emergency_7_"; +insert into t1 values("work_8_"); +execute stmt1 using @string; +deallocate prepare stmt1; + +prepare stmt1 from 'insert into t1 select ?'; +insert into t1 values("work_9_"); +execute stmt1 using @string; +deallocate prepare stmt1; + +insert into t1 values("for_10_"); +insert into t1 select "yesterday_11_"; + +# test statement (is not default after wl#3368) +set binlog_format=statement; +select @@global.binlog_format, @@session.binlog_format; +set global binlog_format=statement; +select @@global.binlog_format, @@session.binlog_format; + +prepare stmt1 from 'insert into t1 select ?'; +set @string="emergency_12_"; +insert into t1 values("work_13_"); +execute stmt1 using @string; +deallocate prepare stmt1; + +prepare stmt1 from 'insert into t1 select ?'; +insert into t1 values("work_14_"); +execute stmt1 using @string; +deallocate prepare stmt1; + +insert into t1 values("for_15_"); +insert into t1 select "yesterday_16_"; + +# and now the mixed mode + +set global binlog_format=mixed; +select @@global.binlog_format, @@session.binlog_format; +set binlog_format=default; +select @@global.binlog_format, @@session.binlog_format; + +prepare stmt1 from 'insert into t1 select concat(UUID(),?)'; +set @string="emergency_17_"; +insert into t1 values("work_18_"); +execute stmt1 using @string; +deallocate prepare stmt1; + +prepare stmt1 from 'insert into t1 select ?'; +insert into t1 values(concat(UUID(),"work_19_")); +execute stmt1 using @string; +deallocate prepare stmt1; + +insert into t1 values(concat("for_20_",UUID())); +insert into t1 select "yesterday_21_"; + +prepare stmt1 from 'insert into t1 select ?'; +insert into t1 values(concat(UUID(),"work_22_")); +execute stmt1 using @string; +deallocate prepare stmt1; + +insert into t1 values(concat("for_23_",UUID())); +insert into t1 select "yesterday_24_"; + +# Test of CREATE TABLE SELECT + +create table t2 ENGINE=MyISAM select rpad(UUID(),100,' '); +create table t3 select 1 union select UUID(); +--disable_warnings +create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3); +--enable_warnings +create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3); +# what if UUID() is first: +--disable_warnings +insert into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4); +--enable_warnings + +# inside a stored procedure + +delimiter |; +create procedure foo() +begin +insert into t1 values("work_25_"); +insert into t1 values(concat("for_26_",UUID())); +insert into t1 select "yesterday_27_"; +end| +create procedure foo2() +begin +insert into t1 values(concat("emergency_28_",UUID())); +insert into t1 values("work_29_"); +insert into t1 values(concat("for_30_",UUID())); +set session binlog_format=row; # accepted for stored procs +insert into t1 values("more work_31_"); +set session binlog_format=mixed; +end| +create function foo3() returns bigint unsigned +begin + set session binlog_format=row; # rejected for stored funcs + insert into t1 values("alarm"); + return 100; +end| +create procedure foo4(x varchar(100)) +begin +insert into t1 values(concat("work_250_",x)); +insert into t1 select "yesterday_270_"; +end| +delimiter ;| +call foo(); +call foo2(); +call foo4("hello"); +call foo4(UUID()); +call foo4("world"); + +# test that can't SET in a stored function +--error ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT +select foo3(); +select * from t1 where a="alarm"; + +# Tests of stored functions/triggers/views for BUG#20930 "Mixed +# binlogging mode does not work with stored functions, triggers, +# views" + +# Function which calls procedure +drop function foo3; +delimiter |; +create function foo3() returns bigint unsigned +begin + insert into t1 values("foo3_32_"); + call foo(); + return 100; +end| +delimiter ;| +insert into t2 select foo3(); + +prepare stmt1 from 'insert into t2 select foo3()'; +execute stmt1; +execute stmt1; +deallocate prepare stmt1; + +# Test if stored function calls stored function which calls procedure +# which requires row-based. + +delimiter |; +create function foo4() returns bigint unsigned +begin + insert into t2 select foo3(); + return 100; +end| +delimiter ;| +select foo4(); + +prepare stmt1 from 'select foo4()'; +execute stmt1; +execute stmt1; +deallocate prepare stmt1; + +# A simple stored function +delimiter |; +create function foo5() returns bigint unsigned +begin + insert into t2 select UUID(); + return 100; +end| +delimiter ;| +select foo5(); + +prepare stmt1 from 'select foo5()'; +execute stmt1; +execute stmt1; +deallocate prepare stmt1; + +# A simple stored function where UUID() is in the argument +delimiter |; +create function foo6(x varchar(100)) returns bigint unsigned +begin + insert into t2 select x; + return 100; +end| +delimiter ;| +select foo6("foo6_1_"); +select foo6(concat("foo6_2_",UUID())); + +prepare stmt1 from 'select foo6(concat("foo6_3_",UUID()))'; +execute stmt1; +execute stmt1; +deallocate prepare stmt1; + + +# Test of views using UUID() + +create view v1 as select uuid(); +create table t11 (data varchar(255)); +insert into t11 select * from v1; +# Test of querying INFORMATION_SCHEMA which parses the view's body, +# to verify that it binlogs statement-based (is not polluted by +# the parsing of the view's body). +insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11'); +prepare stmt1 from "insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')"; +execute stmt1; +execute stmt1; +deallocate prepare stmt1; + +# Test of triggers with UUID() +delimiter |; +create trigger t11_bi before insert on t11 for each row +begin + set NEW.data = concat(NEW.data,UUID()); +end| +delimiter ;| +insert into t11 values("try_560_"); + +# Test that INSERT DELAYED works in mixed mode (BUG#20649) +insert delayed into t2 values("delay_1_"); +insert delayed into t2 values(concat("delay_2_",UUID())); +insert delayed into t2 values("delay_6_"); + +# Test for BUG#20633 (INSERT DELAYED RAND()/user_variable does not +# replicate fine in statement-based ; we test that in mixed mode it +# works). +insert delayed into t2 values(rand()); +set @a=2.345; +insert delayed into t2 values(@a); + +# With INSERT DELAYED, rows are written to the binlog after they are +# written to the table. Therefore, it is not enough to wait until the +# rows make it to t2 on the master (the rows may not be in the binlog +# at that time, and may still not be in the binlog when +# sync_slave_with_master is later called). Instead, we wait until the +# rows make it to t2 on the slave. We first call +# sync_slave_with_master, so that we are sure that t2 has been created +# on the slave. +sync_slave_with_master; +let $wait_condition= SELECT COUNT(*) = 19 FROM mysqltest1.t2; +--source include/wait_condition.inc +connection master; + +# If you want to do manual testing of the mixed mode regarding UDFs (not +# testable automatically as quite platform- and compiler-dependent), +# you just need to set the variable below to 1, and to +# "make udf_example.so" in sql/, and to copy sql/udf_example.so to +# MYSQL_TEST_DIR/lib/mysql. +let $you_want_to_test_UDF=0; +if ($you_want_to_test_UDF) +{ + CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so'; + prepare stmt1 from 'insert into t1 select metaphon(?)'; + set @string="emergency_133_"; + insert into t1 values("work_134_"); + execute stmt1 using @string; + deallocate prepare stmt1; + prepare stmt1 from 'insert into t1 select ?'; + insert into t1 values(metaphon("work_135_")); + execute stmt1 using @string; + deallocate prepare stmt1; + insert into t1 values(metaphon("for_136_")); + insert into t1 select "yesterday_137_"; + create table t6 select metaphon("for_138_"); + create table t7 select 1 union select metaphon("for_139_"); + create table t8 select * from t1 where 3 in (select 1 union select 2 union select metaphon("for_140_") union select 3); + create table t9 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3); +} + +create table t20 select * from t1; # save for comparing later +create table t21 select * from t2; +create table t22 select * from t3; +drop table t1,t2,t3; + +# This tests the fix to +# BUG#19630 stored function inserting into two auto_increment breaks statement-based binlog +# We verify that under the mixed binlog mode, a stored function +# modifying at least two tables having an auto_increment column, +# is binlogged row-based. Indeed in statement-based binlogging, +# only the auto_increment value generated for the first table +# is recorded in the binlog, the value generated for the 2nd table +# lacking. + +create table t1 (a int primary key auto_increment, b varchar(100)); +create table t2 (a int primary key auto_increment, b varchar(100)); +create table t3 (b varchar(100)); +delimiter |; +create function f (x varchar(100)) returns int deterministic +begin + insert into t1 values(null,x); + insert into t2 values(null,x); + return 1; +end| +delimiter ;| +select f("try_41_"); +# Two operations which compensate each other except that their net +# effect is that they advance the auto_increment counter of t2 on slave: +sync_slave_with_master; +use mysqltest1; +insert into t2 values(2,null),(3,null),(4,null); +delete from t2 where a>=2; + +connection master; +# this is the call which didn't replicate well +select f("try_42_"); +sync_slave_with_master; + +# now use prepared statement and test again, just to see that the RBB +# mode isn't set at PREPARE but at EXECUTE. + +insert into t2 values(3,null),(4,null); +delete from t2 where a>=3; + +connection master; +prepare stmt1 from 'select f(?)'; +set @string="try_43_"; +insert into t1 values(null,"try_44_"); # should be SBB +execute stmt1 using @string; # should be RBB +deallocate prepare stmt1; +sync_slave_with_master; + +# verify that if only one table has auto_inc, it does not trigger RBB +# (we'll check in binlog further below) + +connection master; +create table t12 select * from t1; # save for comparing later +drop table t1; +create table t1 (a int, b varchar(100), key(a)); +select f("try_45_"); + +# restore table's key +create table t13 select * from t1; +drop table t1; +create table t1 (a int primary key auto_increment, b varchar(100)); + +# now test if it's two functions, each of them inserts in one table + +drop function f; +# we need a unique key to have sorting of rows by mysqldump +create table t14 (unique (a)) select * from t2; +truncate table t2; +delimiter |; +create function f1 (x varchar(100)) returns int deterministic +begin + insert into t1 values(null,x); + return 1; +end| +create function f2 (x varchar(100)) returns int deterministic +begin + insert into t2 values(null,x); + return 1; +end| +delimiter ;| +select f1("try_46_"),f2("try_47_"); + +sync_slave_with_master; +insert into t2 values(2,null),(3,null),(4,null); +delete from t2 where a>=2; + +connection master; +# Test with SELECT and INSERT +select f1("try_48_"),f2("try_49_"); +insert into t3 values(concat("try_50_",f1("try_51_"),f2("try_52_"))); +sync_slave_with_master; + +# verify that if f2 does only read on an auto_inc table, this does not +# switch to RBB +connection master; +drop function f2; +delimiter |; +create function f2 (x varchar(100)) returns int deterministic +begin + declare y int; + insert into t1 values(null,x); + set y = (select count(*) from t2); + return y; +end| +delimiter ;| +select f1("try_53_"),f2("try_54_"); +sync_slave_with_master; + +# And now, a normal statement with a trigger (no stored functions) + +connection master; +drop function f2; +delimiter |; +create trigger t1_bi before insert on t1 for each row +begin + insert into t2 values(null,"try_55_"); +end| +delimiter ;| +insert into t1 values(null,"try_56_"); +# and now remove one auto_increment and verify SBB +alter table t1 modify a int, drop primary key; +insert into t1 values(null,"try_57_"); +sync_slave_with_master; + +# Test for BUG#20499 "mixed mode with temporary table breaks binlog" +# Slave used to have only 2 rows instead of 3. +connection master; +CREATE TEMPORARY TABLE t15 SELECT UUID(); +create table t16 like t15; +INSERT INTO t16 SELECT * FROM t15; +# we'll verify that this one is done RBB +insert into t16 values("try_65_"); +drop table t15; +# we'll verify that this one is done SBB +insert into t16 values("try_66_"); +sync_slave_with_master; + +# and now compare: + +connection master; + +# first check that data on master is sensible +select count(*) from t1; +select count(*) from t2; +select count(*) from t3; +select count(*) from t4; +select count(*) from t5; +select count(*) from t11; +select count(*) from t20; +select count(*) from t21; +select count(*) from t22; +select count(*) from t12; +select count(*) from t13; +select count(*) from t14; +select count(*) from t16; +if ($you_want_to_test_UDF) +{ + select count(*) from t6; + select count(*) from t7; + select count(*) from t8; + select count(*) from t9; +} + +sync_slave_with_master; + +# +# Bug#20863 If binlog format is changed between update and unlock of +# tables, wrong binlog +# + +connection master; +DROP TABLE IF EXISTS t11; +SET SESSION BINLOG_FORMAT=STATEMENT; +CREATE TABLE t11 (song VARCHAR(255)); +LOCK TABLES t11 WRITE; +SET SESSION BINLOG_FORMAT=ROW; +INSERT INTO t11 VALUES('Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict'); +SET SESSION BINLOG_FORMAT=STATEMENT; +INSERT INTO t11 VALUES('Careful With That Axe, Eugene'); +UNLOCK TABLES; + +--query_vertical SELECT * FROM t11 +sync_slave_with_master; +USE mysqltest1; +--query_vertical SELECT * FROM t11 + +connection master; +DROP TABLE IF EXISTS t12; +SET SESSION BINLOG_FORMAT=MIXED; +CREATE TABLE t12 (data LONG); +LOCK TABLES t12 WRITE; +INSERT INTO t12 VALUES(UUID()); +UNLOCK TABLES; +sync_slave_with_master; + +# +# BUG#28086: SBR of USER() becomes corrupted on slave +# + +connection master; + +# Just to get something that is non-trivial, albeit still simple, we +# stuff the result of USER() and CURRENT_USER() into a variable. +--delimiter $$ +CREATE FUNCTION my_user() + RETURNS CHAR(64) +BEGIN + DECLARE user CHAR(64); + SELECT USER() INTO user; + RETURN user; +END $$ +--delimiter ; + +--delimiter $$ +CREATE FUNCTION my_current_user() + RETURNS CHAR(64) +BEGIN + DECLARE user CHAR(64); + SELECT CURRENT_USER() INTO user; + RETURN user; +END $$ +--delimiter ; + +DROP TABLE IF EXISTS t13; +CREATE TABLE t13 (data CHAR(64)); +INSERT INTO t13 VALUES (USER()); +INSERT INTO t13 VALUES (my_user()); +INSERT INTO t13 VALUES (CURRENT_USER()); +INSERT INTO t13 VALUES (my_current_user()); + +sync_slave_with_master; + +# as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID +--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql +--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql + +# Let's compare. Note: If they match test will pass, if they do not match +# the test will show that the diff statement failed and not reject file +# will be created. You will need to go to the mysql-test dir and diff +# the files your self to see what is not matching + +diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql; + +connection master; + +# Now test that mysqlbinlog works fine on a binlog generated by the +# mixed mode + +# BUG#11312 "DELIMITER is not written to the binary log that causes +# syntax error" makes that mysqlbinlog will fail if we pass it the +# text of queries; this forces us to use --base64-output here. + +# BUG#20929 "BINLOG command causes invalid free plus assertion +# failure" makes mysqld segfault when receiving --base64-output + +# So I can't enable this piece of test +# SIGH + +if ($enable_when_11312_or_20929_fixed) +{ +--exec $MYSQL_BINLOG --base64-output $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql +drop database mysqltest1; +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql +--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql +# the old mysqldump output on slave is the same as what it was on +# master before restoring on master. +diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql; +} + +drop database mysqltest1; +sync_slave_with_master; + +connection master; +# Restore binlog format setting +set global binlog_format =@my_binlog_format; +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_sync.inc b/mysql-test/extra/rpl_tests/rpl_sync.inc new file mode 100644 index 00000000000..ede3c3c515f --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_sync.inc @@ -0,0 +1,159 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +######################################################################################## +# This test verifies the options --sync-relay-log-info and --relay-log-recovery by +# crashing the slave in two different situations: +# (case-1) - Corrupt the relay log with changes which were not processed by +# the SQL Thread and crashes it. +# (case-2) - Corrupt the master.info with wrong coordinates and crashes it. +# +# Case 1: +# 1 - Stops the SQL Thread +# 2 - Inserts new records into the master. +# 3 - Corrupts the relay-log.bin* which most likely has such changes. +# 4 - Crashes the slave +# 5 - Verifies if the slave is sync with the master which means that the information +# loss was circumvented by the recovery process. +# +# Case 2: +# 1 - Stops the SQL/IO Threads +# 2 - Inserts new records into the master. +# 3 - Corrupts the master.info with wrong coordinates. +# 4 - Crashes the slave +# 5 - Verifies if the slave is sync with the master which means that the information +# loss was circumvented by the recovery process. +######################################################################################## + +######################################################################################## +# Configuring the environment +######################################################################################## +--echo =====Configuring the enviroment=======; +--source include/master-slave.inc +--source include/not_embedded.inc +--source include/not_valgrind.inc +--source include/have_debug.inc +--source include/have_innodb.inc +--source include/not_crashrep.inc + +call mtr.add_suppression('Attempting backtrace'); +call mtr.add_suppression("Recovery from master pos .* and file master-bin.000001"); +# Use innodb so we do not get "table should be repaired" issues. +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +flush tables; +CREATE TABLE t1(a INT, PRIMARY KEY(a)) engine=innodb; + +insert into t1(a) values(1); +insert into t1(a) values(2); +insert into t1(a) values(3); + +######################################################################################## +# Case 1: Corrupt a relay-log.bin* +######################################################################################## +--echo =====Inserting data on the master but without the SQL Thread being running=======; +sync_slave_with_master; + +connection slave; +let $MYSQLD_SLAVE_DATADIR= `select @@datadir`; +--replace_result $MYSQLD_SLAVE_DATADIR MYSQLD_SLAVE_DATADIR +--copy_file $MYSQLD_SLAVE_DATADIR/master.info $MYSQLD_SLAVE_DATADIR/master.backup +--source include/stop_slave_sql.inc + +connection master; +insert into t1(a) values(4); +insert into t1(a) values(5); +insert into t1(a) values(6); + +--echo =====Removing relay log files and crashing/recoverying the slave=======; +connection slave; +--source include/stop_slave_io.inc + +let $file= query_get_value("SHOW SLAVE STATUS", Relay_Log_File, 1); + +--let FILE_TO_CORRUPT= $MYSQLD_SLAVE_DATADIR/$file +perl; +$file= $ENV{'FILE_TO_CORRUPT'}; +open(FILE, ">$file") || die "Unable to open $file."; +truncate(FILE,0); +print FILE "failure"; +close ($file); +EOF + +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +SET SESSION debug_dbug="d,crash_before_rotate_relaylog"; +--error 2013 +FLUSH LOGS; + +--let $rpl_server_number= 2 +--source include/rpl_reconnect.inc + +--echo =====Dumping and comparing tables=======; +--source include/start_slave.inc + +connection master; +sync_slave_with_master; + +let $diff_tables=master:t1,slave:t1; +source include/diff_tables.inc; + +######################################################################################## +# Case 2: Corrupt a master.info +######################################################################################## +--echo =====Corrupting the master.info=======; +connection slave; +--source include/stop_slave.inc + +connection master; +FLUSH LOGS; + +insert into t1(a) values(7); +insert into t1(a) values(8); +insert into t1(a) values(9); + +connection slave; +let MYSQLD_SLAVE_DATADIR=`select @@datadir`; + +--perl +use strict; +use warnings; +my $src= "$ENV{'MYSQLD_SLAVE_DATADIR'}/master.backup"; +my $dst= "$ENV{'MYSQLD_SLAVE_DATADIR'}/master.info"; +open(FILE, "<", $src) or die; +my @content= ; +close FILE; +open(FILE, ">", $dst) or die; +binmode FILE; +print FILE @content; +close FILE; +EOF + +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +SET SESSION debug_dbug="d,crash_before_rotate_relaylog"; +--error 2013 +FLUSH LOGS; + +--let $rpl_server_number= 2 +--source include/rpl_reconnect.inc + +--echo =====Dumping and comparing tables=======; +--source include/start_slave.inc + +connection master; +sync_slave_with_master; + +let $diff_tables=master:t1,slave:t1; +source include/diff_tables.inc; + +######################################################################################## +# Clean up +######################################################################################## +--echo =====Clean up=======; +connection master; +drop table t1; + +--remove_file $MYSQLD_SLAVE_DATADIR/master.backup +--source include/rpl_end.inc + diff --git a/mysql-test/extra/rpl_tests/rpl_temporal_format_default_to_default.inc b/mysql-test/extra/rpl_tests/rpl_temporal_format_default_to_default.inc new file mode 100644 index 00000000000..6728ff55d6f --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_temporal_format_default_to_default.inc @@ -0,0 +1,82 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +--source include/master-slave.inc + +if ($force_master_mysql56_temporal_format) +{ + connection master; + eval SET @@global.mysql56_temporal_format=$force_master_mysql56_temporal_format; +} + +if ($force_slave_mysql56_temporal_format) +{ + connection slave; + eval SET @@global.mysql56_temporal_format=$force_slave_mysql56_temporal_format; +} + +connection master; +SELECT @@global.mysql56_temporal_format AS on_master; +connection slave; +SELECT @@global.mysql56_temporal_format AS on_slave; +connection master; + +CREATE TABLE t1 +( + c0 TIME(0), + c1 TIME(1), + c2 TIME(2), + c3 TIME(3), + c4 TIME(4), + c5 TIME(5), + c6 TIME(6) +); +CREATE TABLE t2 +( + c0 TIMESTAMP(0), + c1 TIMESTAMP(1), + c2 TIMESTAMP(2), + c3 TIMESTAMP(3), + c4 TIMESTAMP(4), + c5 TIMESTAMP(5), + c6 TIMESTAMP(6) +); + +CREATE TABLE t3 +( + c0 DATETIME(0), + c1 DATETIME(1), + c2 DATETIME(2), + c3 DATETIME(3), + c4 DATETIME(4), + c5 DATETIME(5), + c6 DATETIME(6) +); +INSERT INTO t1 VALUES ('01:01:01','01:01:01.1','01:01:01.11','01:01:01.111','01:01:01.1111','01:01:01.11111','01:01:01.111111'); +INSERT INTO t2 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111'); +INSERT INTO t3 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111'); +SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME; +sync_slave_with_master; + +connection slave; +--query_vertical SELECT * FROM t1; +--query_vertical SELECT * FROM t2; +--query_vertical SELECT * FROM t3; +SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME; + +connection master; +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; + +connection slave; +SET @@global.mysql56_temporal_format=DEFAULT; +connection master; +SET @@global.mysql56_temporal_format=DEFAULT; + +--source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_typeconv.inc b/mysql-test/extra/rpl_tests/rpl_typeconv.inc new file mode 100644 index 00000000000..0f078854ec2 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_typeconv.inc @@ -0,0 +1,78 @@ +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption suite). +# Please check all dependent tests after modifying it +# + +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +connection slave; +set @saved_slave_type_conversions = @@global.slave_type_conversions; +CREATE TABLE type_conversions ( + TestNo INT AUTO_INCREMENT PRIMARY KEY, + Source TEXT, + Target TEXT, + Flags TEXT, + On_Master TEXT, + On_Slave TEXT, + Expected TEXT, + Compare INT, + Error TEXT); + +SELECT @@global.slave_type_conversions; +SET GLOBAL SLAVE_TYPE_CONVERSIONS=''; +SELECT @@global.slave_type_conversions; +SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY'; +SELECT @@global.slave_type_conversions; +SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY'; +SELECT @@global.slave_type_conversions; +SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY'; +SELECT @@global.slave_type_conversions; +--error ER_WRONG_VALUE_FOR_VAR +SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY,NONEXISTING_BIT'; +SELECT @@global.slave_type_conversions; + +# Checking strict interpretation of type conversions +connection slave; +SET GLOBAL SLAVE_TYPE_CONVERSIONS=''; +source extra/rpl_tests/type_conversions.test; + +# Checking lossy integer type conversions +connection slave; +SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY'; +source extra/rpl_tests/type_conversions.test; + +# Checking non-lossy integer type conversions +connection slave; +SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY'; +source extra/rpl_tests/type_conversions.test; + +# Checking all type conversions +connection slave; +SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY'; +source extra/rpl_tests/type_conversions.test; + +connection slave; +--echo **** Result of conversions **** +disable_query_log; +SELECT RPAD(Source, 15, ' ') AS Source_Type, + RPAD(Target, 15, ' ') AS Target_Type, + RPAD(Flags, 25, ' ') AS All_Type_Conversion_Flags, + IF(Compare IS NULL AND Error IS NOT NULL, '', + IF(Compare, '', + CONCAT("'", On_Slave, "' != '", Expected, "'"))) + AS Value_On_Slave + FROM type_conversions; +enable_query_log; +DROP TABLE type_conversions; + +call mtr.add_suppression("Slave SQL.*Column 1 of table .test.t1. cannot be converted from type.* error.* 1677"); + +connection master; +DROP TABLE t1; +sync_slave_with_master; + +set global slave_type_conversions = @saved_slave_type_conversions; + +--source include/rpl_end.inc diff --git a/mysql-test/extra/table_index_statistics.inc b/mysql-test/extra/table_index_statistics.inc new file mode 100644 index 00000000000..ba585320fc9 --- /dev/null +++ b/mysql-test/extra/table_index_statistics.inc @@ -0,0 +1,59 @@ +# include file to test index and table statstics for specific storage engine +# requires includer set the default strorage engine for the session + +# Bug 602047 (wrong rows_read value) + +FLUSH INDEX_STATISTICS; +FLUSH TABLE_STATISTICS; + +SET @userstat_old= @@userstat; +SET GLOBAL userstat=ON; + +CREATE TABLE t1 (id int(10), PRIMARY KEY (id)); +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +SELECT COUNT(*) FROM t1; +SELECT ROWS_READ FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t1'; +SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1'; + +# Test that FLUSH clears one table but not another + +FLUSH TABLE_STATISTICS; + +SELECT ROWS_READ FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t1'; +SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1'; + +# Test that FLUSH clears both tables now + +FLUSH INDEX_STATISTICS; + +SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1'; + +# Test that stats are collected after the FLUSH again + +SELECT COUNT(*) FROM t1; +SELECT ROWS_READ FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t1'; +SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1'; + +DROP TABLE t1; + +# Bug 1183625 (handler::update_global_table_stats crash). + +CREATE TABLE t2 (c1 INT UNSIGNED); + +ALTER TABLE t2 MODIFY c1 FLOAT; + +SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t2'; + +DROP TABLE t2; + +# Bug 1183625 (handler::update_global_table_stats crash). + +CREATE TABLE t2 (c1 INT UNSIGNED); + +ALTER TABLE t2 MODIFY c1 FLOAT; + +SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t2'; + +DROP TABLE t2; + +SET GLOBAL userstat= @userstat_old; diff --git a/mysql-test/include/binlog_start_pos.inc b/mysql-test/include/binlog_start_pos.inc index a187e18b3a4..5412a7ea75f 100644 --- a/mysql-test/include/binlog_start_pos.inc +++ b/mysql-test/include/binlog_start_pos.inc @@ -10,19 +10,19 @@ # # Format_description_log_event length = # 19 /* event common header */ + -# 58 /* misc stuff in the Format description header */ + +# 57 /* misc stuff in the Format description header */ + # number of events + # 1 /* Checksum algorithm */ + # 4 /* CRC32 length */ # -# With current number of events = 164, +# With current number of events = 171, # -# binlog_start_pos = 4 + 19 + 57 + 163 + 1 + 4 = 249. +# binlog_start_pos = 4 + 19 + 57 + 171 + 1 + 4 = 256. # ############################################################################## -let $binlog_start_pos=249; --disable_query_log -SET @binlog_start_pos=249; +set @binlog_start_pos=256 + @@encrypt_binlog * (36 + (@@binlog_checksum != 'NONE') * 4); --enable_query_log +let $binlog_start_pos=`select @binlog_start_pos`; diff --git a/mysql-test/include/check-testcase.test b/mysql-test/include/check-testcase.test index 083f44ce966..abac3861c66 100644 --- a/mysql-test/include/check-testcase.test +++ b/mysql-test/include/check-testcase.test @@ -67,6 +67,9 @@ if ($tmp) --echo Replicate_Do_Domain_Ids --echo Replicate_Ignore_Domain_Ids --echo Parallel_Mode conservative + --echo SQL_Delay 0 + --echo SQL_Remaining_Delay NULL + --echo Slave_SQL_Running_State } if (!$tmp) { # Note: after WL#5177, fields 13-18 shall not be filtered-out. diff --git a/mysql-test/include/commit.inc b/mysql-test/include/commit.inc index e72ebba8527..830ffb52c02 100644 --- a/mysql-test/include/commit.inc +++ b/mysql-test/include/commit.inc @@ -430,9 +430,9 @@ call p_verify_status_increment(2, 2, 2, 2); --echo # 4. Read-write statement: UPDATE, update 0 rows, 1 row matches WHERE --echo # update t1 set a=2; -call p_verify_status_increment(2, 2, 1, 0); +call p_verify_status_increment(2, 0, 1, 0); commit; -call p_verify_status_increment(2, 2, 1, 0); +call p_verify_status_increment(2, 0, 1, 0); --echo # 5. Read-write statement: UPDATE, update 0 rows, 0 rows match WHERE --echo # diff --git a/mysql-test/include/func_str_ascii_checksum.inc b/mysql-test/include/func_str_ascii_checksum.inc new file mode 100644 index 00000000000..8e51c92c1ac --- /dev/null +++ b/mysql-test/include/func_str_ascii_checksum.inc @@ -0,0 +1,24 @@ +--echo # Start of func_str_ascii_checksum.inc + +--echo # +--echo # MDEV-10850 Wrong result for WHERE .. (f2=TO_BASE64('test') OR f2=TO_BASE64('TEST')) +--echo # + +--eval CREATE TABLE t1 (f1 VARCHAR(4), f2 VARCHAR(255), UNIQUE KEY k1 (f1,f2)) +--eval INSERT INTO t1 VALUES ('test',$func('test')), ('TEST', $func('TEST')) +--eval SELECT * FROM t1 IGNORE INDEX(k1) WHERE f1='test' AND (f2= $func("test") OR f2= $func("TEST")) +--eval SELECT * FROM t1 WHERE f1='test' AND (f2= $func("test") OR f2= $func("TEST")) +--eval SELECT * FROM t1 WHERE f1='test' AND (f2= $func("TEST") OR f2= $func("test")) +DROP TABLE t1; + + +--echo # +--echo # MDEV-10425 Assertion `collation.derivation == DERIVATION_IMPLICIT' failed in Item_func_conv_charset::fix_length_and_dec() +--echo # + +--eval PREPARE stmt FROM "SELECT $func(CONVERT('foo' USING latin1))" +EXECUTE stmt; +DEALLOCATE PREPARE stmt; + + +--echo # End of func_str_ascii_checksum.inc diff --git a/mysql-test/include/have_innodb.combinations b/mysql-test/include/have_innodb.combinations index 49ae741b269..7e9e6b9e3b0 100644 --- a/mysql-test/include/have_innodb.combinations +++ b/mysql-test/include/have_innodb.combinations @@ -9,9 +9,13 @@ innodb-locks innodb-buffer-pool-stats innodb-buffer-page innodb-buffer-page-lru +innodb-sys-columns +innodb-sys-fields innodb-sys-foreign innodb-sys-foreign-cols +innodb-sys-indexes innodb-sys-tables +innodb-sys-virtual innodb-metrics [xtradb_plugin] @@ -43,3 +47,21 @@ innodb-buffer-page-lru innodb-sys-foreign innodb-sys-foreign-cols innodb-sys-tables + +[innodb] +innodb +innodb-cmpmem +innodb-cmp-per-index +innodb-trx +innodb-locks +innodb-metrics +innodb-buffer-pool-stats +innodb-buffer-page +innodb-buffer-page-lru +innodb-sys-columns +innodb-sys-fields +innodb-sys-foreign +innodb-sys-foreign-cols +innodb-sys-indexes +innodb-sys-tables +innodb-sys-virtual diff --git a/mysql-test/include/have_numa.inc b/mysql-test/include/have_numa.inc new file mode 100644 index 00000000000..18bca99e04d --- /dev/null +++ b/mysql-test/include/have_numa.inc @@ -0,0 +1,9 @@ +let $numa_support = `SELECT COUNT(VARIABLE_VALUE) = 1 FROM + INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='innodb_numa_interleave'`; + +if ( $numa_support == 0 ) +{ + --skip Test requires: Binary must be built with NUMA support. +} + diff --git a/mysql-test/include/have_xtradb.combinations b/mysql-test/include/have_xtradb.combinations index 3454f83cb4d..0419dc91171 100644 --- a/mysql-test/include/have_xtradb.combinations +++ b/mysql-test/include/have_xtradb.combinations @@ -6,8 +6,8 @@ innodb-cmpmem innodb-trx innodb-sys-indexes -#[xtradb] -#innodb -#innodb-cmpmem -#innodb-trx -#innodb-sys-indexes +[xtradb] +innodb +innodb-cmpmem +innodb-trx +innodb-sys-indexes diff --git a/mysql-test/include/index_merge2.inc b/mysql-test/include/index_merge2.inc index c50a45a9923..03afa49d323 100644 --- a/mysql-test/include/index_merge2.inc +++ b/mysql-test/include/index_merge2.inc @@ -341,6 +341,7 @@ while ($1) alter table t1 add index i2(key2); alter table t1 add index i3(key3); update t1 set key2=key1,key3=key1; +analyze table t1; # to test the bug, the following must use "sort_union": --replace_column 9 REF diff --git a/mysql-test/include/kill_and_restart_mysqld.inc b/mysql-test/include/kill_and_restart_mysqld.inc new file mode 100644 index 00000000000..f2ac9b504d2 --- /dev/null +++ b/mysql-test/include/kill_and_restart_mysqld.inc @@ -0,0 +1,19 @@ +--let $_server_id= `SELECT @@server_id` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect + +if ($restart_parameters) +{ + --echo # Kill and restart: $restart_parameters + --exec echo "restart: $restart_parameters" > $_expect_file_name +} +if (!$restart_parameters) +{ + --echo # Kill and restart + --exec echo "restart" > $_expect_file_name +} + +--shutdown_server 0 +--source include/wait_until_disconnected.inc +--enable_reconnect +--source include/wait_until_connected_again.inc +--disable_reconnect diff --git a/mysql-test/include/kill_mysqld.inc b/mysql-test/include/kill_mysqld.inc new file mode 100644 index 00000000000..86ee048a0f1 --- /dev/null +++ b/mysql-test/include/kill_mysqld.inc @@ -0,0 +1,7 @@ +--let $_server_id= `SELECT @@server_id` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect + +--echo # Kill the server +--exec echo "wait" > $_expect_file_name +--shutdown_server 0 +--source include/wait_until_disconnected.inc diff --git a/mysql-test/include/mix1.inc b/mysql-test/include/mix1.inc index 7eae4235baa..ea7bc3f5327 100644 --- a/mysql-test/include/mix1.inc +++ b/mysql-test/include/mix1.inc @@ -236,6 +236,15 @@ create table t2i (a int); insert into t2m values (5); insert into t2i values (5); +-- disable_query_log +-- disable_result_log +analyze table t1i; +analyze table t1m; +analyze table t2i; +analyze table t2m; +-- enable_result_log +-- enable_query_log + # test with $engine_type select min(a) from t1i; select min(7) from t1i; @@ -411,6 +420,13 @@ if ($test_foreign_keys) INSERT INTO t1 VALUES (1,'A1'),(2,'A2'),(3,'B'); INSERT INTO t2 VALUES (1,1),(2,2),(3,2),(4,3),(5,3); +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +ANALYZE TABLE t2; +-- enable_result_log +-- enable_query_log + EXPLAIN SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id WHERE t1.name LIKE 'A%'; @@ -572,12 +588,22 @@ OPTIMIZE TABLE t1; SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1 WHERE acct_id=785; +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +-- enable_result_log +-- enable_query_log + EXPLAIN SELECT COUNT(*) FROM t1 WHERE stat_id IN (1,3) AND acct_id=785; INSERT INTO t2 SELECT * FROM t1; OPTIMIZE TABLE t2; -EXPLAIN SELECT COUNT(*) FROM t2 WHERE stat_id IN (1,3) AND acct_id=785; +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t2; +-- enable_result_log +-- enable_query_log DROP TABLE t1,t2; @@ -654,9 +680,11 @@ INSERT INTO t2 VALUES (1); CONNECTION c2; SET AUTOCOMMIT=0; +SET @old_lock_wait_timeout= @@lock_wait_timeout; +SET lock_wait_timeout= 1; --error ER_LOCK_WAIT_TIMEOUT LOCK TABLES t1 READ, t2 READ; - +SET @@lock_wait_timeout= @old_lock_wait_timeout; CONNECTION c1; COMMIT; INSERT INTO t1 VALUES (1); @@ -702,6 +730,13 @@ INSERT INTO t1(b,c) SELECT b,c FROM t2; UPDATE t2 SET c='2007-01-03'; INSERT INTO t1(b,c) SELECT b,c FROM t2; +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +ANALYZE TABLE t2; +-- enable_result_log +-- enable_query_log + set @@sort_buffer_size=8192; SELECT COUNT(*) FROM t1; @@ -791,6 +826,12 @@ INSERT INTO t1 SELECT a + 16, MOD(a + 16, 20), 1 FROM t1; INSERT INTO t1 SELECT a + 32, MOD(a + 32, 20), 1 FROM t1; INSERT INTO t1 SELECT a + 64, MOD(a + 64, 20), 1 FROM t1; +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +-- enable_result_log +-- enable_query_log + EXPLAIN SELECT b, SUM(c) FROM t1 GROUP BY b; EXPLAIN SELECT SQL_BIG_RESULT b, SUM(c) FROM t1 GROUP BY b; DROP TABLE t1; @@ -853,6 +894,11 @@ CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY bkey (b)) ENGINE=InnoDB; INSERT INTO t1 VALUES (1,2),(3,2),(2,2),(4,2),(5,2),(6,2),(7,2),(8,2); INSERT INTO t1 SELECT a + 8, 2 FROM t1; INSERT INTO t1 SELECT a + 16, 1 FROM t1; +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +-- enable_result_log +-- enable_query_log query_vertical EXPLAIN SELECT * FROM t1 WHERE b=2 ORDER BY a; SELECT * FROM t1 WHERE b=2 ORDER BY a; query_vertical EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a; @@ -866,6 +912,12 @@ INSERT INTO t2 VALUES (1,1,1),(3,1,1),(2,1,1),(4,1,1); INSERT INTO t2 SELECT a + 4, 1, 1 FROM t2; INSERT INTO t2 SELECT a + 8, 1, 1 FROM t2; +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t2; +-- enable_result_log +-- enable_query_log + query_vertical EXPLAIN SELECT * FROM t2 WHERE b=1 ORDER BY a; SELECT * FROM t2 WHERE b=1 ORDER BY a; query_vertical EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a; @@ -957,7 +1009,7 @@ SELECT * FROM t1 WHERE b=20 FOR UPDATE; --connect (conn2, localhost, root,,test) -# This statement gives a "failed: 1205: Lock wait timeout exceeded; try +# This statement gives a "failed: 1205: Lock wait timeout exceeded; try # restarting transaction" message when the bug is present. START TRANSACTION; SELECT * FROM t1 WHERE b=10 ORDER BY A FOR UPDATE; @@ -982,6 +1034,12 @@ CREATE TABLE t1( INSERT INTO t1 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4); +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +-- enable_result_log +-- enable_query_log + EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d; SELECT c,b,d FROM t1 GROUP BY c,b,d; EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL; @@ -1002,6 +1060,12 @@ DROP TABLE t1; CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a), INDEX b (b)) ENGINE=InnoDB; INSERT INTO t1(a,b) VALUES (1,1), (2,2), (3,2); +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +-- enable_result_log +-- enable_query_log + #The two queries below should produce different results, but they don't. query_vertical EXPLAIN SELECT * FROM t1 WHERE b=2 ORDER BY a ASC; SELECT * FROM t1 WHERE b=2 ORDER BY a ASC; @@ -1085,6 +1149,12 @@ CREATE TABLE t1 (id int, type char(6), d int, INDEX idx(id,d)) ENGINE=InnoDB; INSERT INTO t1 VALUES (191, 'member', 1), (NULL, 'member', 3), (NULL, 'member', 4), (201, 'member', 2); +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +-- enable_result_log +-- enable_query_log + EXPLAIN SELECT * FROM t1 WHERE id=191 OR id IS NULL ORDER BY d; SELECT * FROM t1 WHERE id=191 OR id IS NULL ORDER BY d; @@ -1113,12 +1183,13 @@ CREATE TABLE t1 (a int, b int, c int, PRIMARY KEY (a), KEY t1_b (b)) INSERT INTO t1 (a,b,c) VALUES (1,1,1), (2,1,1), (3,1,1), (4,1,1); INSERT INTO t1 (a,b,c) SELECT a+4,b,c FROM t1; -# should be range access +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +-- enable_result_log +-- enable_query_log -# -# InnoDB uses "where", while xtradb "index condition" -# ---replace_regex /where/index condition/ +# should be range access EXPLAIN SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5; # should produce '8 7 6 5 4' for a @@ -1512,6 +1583,12 @@ INSERT INTO t1 VALUES (4,1,3,'pk',NULL),(5,1,3,'c2',NULL), (2,1,4,'c_extra',NULL),(3,1,4,'c_extra',NULL); +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +-- enable_result_log +-- enable_query_log + EXPLAIN SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE tid = 1 AND vid = 3 ORDER BY idx DESC; SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE tid = 1 AND vid = 3 ORDER BY idx DESC; @@ -1529,6 +1606,12 @@ CREATE TABLE t1 (c1 INT, c2 INT, c3 INT, KEY (c3), KEY (c2, c3)) ENGINE=$engine_type; INSERT INTO t1 VALUES (1,1,1), (1,1,1), (1,1,2), (1,1,1), (1,1,2); +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +-- enable_result_log +-- enable_query_log + SELECT 1 FROM (SELECT COUNT(DISTINCT c1) FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x; EXPLAIN @@ -1542,6 +1625,12 @@ CREATE TABLE t1 (c1 REAL, c2 REAL, c3 REAL, KEY (c3), KEY (c2, c3)) ENGINE=$engine_type; INSERT INTO t1 VALUES (1,1,1), (1,1,1), (1,1,2), (1,1,1), (1,1,2); +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +-- enable_result_log +-- enable_query_log + SELECT 1 FROM (SELECT COUNT(DISTINCT c1) FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x; EXPLAIN @@ -1556,6 +1645,12 @@ CREATE TABLE t1 (c1 DECIMAL(12,2), c2 DECIMAL(12,2), c3 DECIMAL(12,2), ENGINE=$engine_type; INSERT INTO t1 VALUES (1,1,1), (1,1,1), (1,1,2), (1,1,1), (1,1,2); +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +-- enable_result_log +-- enable_query_log + SELECT 1 FROM (SELECT COUNT(DISTINCT c1) FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x; EXPLAIN @@ -1583,6 +1678,13 @@ CREATE TABLE t2 ( insert into t1 values (0),(1),(2),(3),(4); insert into t2 select A.a + 10 *B.a, 1, 'filler' from t1 A, t1 B; +-- disable_query_log +-- disable_result_log +analyze table t1; +analyze table t2; +-- enable_result_log +-- enable_query_log + explain select * from t1, t2 where t2.a=t1.a and t2.b + 1; select * from t1, t2 where t2.a=t1.a and t2.b + 1; diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index 278add92ba5..635dfd9b8c3 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -205,14 +205,6 @@ INSERT INTO global_suppressions VALUES ("==[0-9]*== Warning: invalid file descriptor -1 in syscall write()"), ("==[0-9]*== Warning: invalid file descriptor -1 in syscall read()"), - /* - BUG#42147 - Concurrent DML and LOCK TABLE ... READ for InnoDB - table cause warnings in errlog - Note: This is a temporary suppression until Bug#42147 can be - fixed properly. See bug page for more information. - */ - ("Found lock of type 6 that is write and read locked"), - /* Transient network failures that cause warnings on reconnect. BUG#47743 and BUG#47983. diff --git a/mysql-test/include/relocate_binlogs.inc b/mysql-test/include/relocate_binlogs.inc index d5d1135dda3..593ea0e9fbf 100644 --- a/mysql-test/include/relocate_binlogs.inc +++ b/mysql-test/include/relocate_binlogs.inc @@ -101,16 +101,16 @@ if ($relocate_index_file) --eval LOAD DATA INFILE '$relocate_fix_relay_log_info' INTO TABLE tmp (entry) --let $count= `SELECT count(*) FROM tmp` - --let $_curr_entry= `SELECT entry FROM tmp WHERE id=1` + --let $_curr_entry= `SELECT entry FROM tmp WHERE id=2` --let $_curr_entry_basename= `SELECT RIGHT(RTRIM("$_curr_entry"), LOCATE("$_path_separator",REVERSE(RTRIM("$_curr_entry"))) -1)` if ($relocate_is_windows) { - --eval UPDATE tmp SET entry='$_to\$_curr_entry_basename' WHERE id=1 + --eval UPDATE tmp SET entry='$_to\$_curr_entry_basename' WHERE id=2 } if (!$relocate_is_windows) { - --eval UPDATE tmp SET entry='$_to/$_curr_entry_basename' WHERE id=1 + --eval UPDATE tmp SET entry='$_to/$_curr_entry_basename' WHERE id=2 } --remove_file $relocate_fix_relay_log_info diff --git a/mysql-test/suite/multi_source/reset_master_slave.inc b/mysql-test/include/reset_master_slave.inc similarity index 100% rename from mysql-test/suite/multi_source/reset_master_slave.inc rename to mysql-test/include/reset_master_slave.inc diff --git a/mysql-test/include/rpl_assert.inc b/mysql-test/include/rpl_assert.inc new file mode 100644 index 00000000000..d9963e8e782 --- /dev/null +++ b/mysql-test/include/rpl_assert.inc @@ -0,0 +1,118 @@ +# ==== Purpose ==== +# +# Check if a condition holds, fail with debug info if not. +# +# The condition is parsed before executed. The following constructs +# are supported: +# +# [SQL STATEMENT, COLUMN, ROW] +# The square bracket is replaced by the result from SQL STATEMENT, +# in the given COLUMN and ROW. +# +# <1> +# This is a shorthand for the result of the first executed square +# bracket. <2> is a shorthand for the second executed square +# bracket, and so on. +# +# ==== Usage ==== +# +# --let $assert_text= Relay_Log_Pos must be smaller than pos. +# --let $assert_cond= [SHOW SLAVE STATUS, Relay_Log_Pos, 1] >= $min_pos AND <1> <= $max_pos +# [--let $assert_quiet= 1] +# [--let $rpl_debug= 1] +# --source include/rpl_assert.inc +# +# Parameters: +# +# $assert_text +# Text that describes what is being checked. By default, this text +# is written to the query log. +# +# $assert_cond +# Condition to check. See above for details about the format. The +# condition will be executed as `SELECT $assert_cond`. Note: this +# condition is parsed using SQL statements, quoted inside single +# quotes, so it must not contain single quotes itself (use double +# quotes for strings). +# +# $assert_quiet +# Do not print $assert_text to the query log. +# +# $rpl_debug +# Print extra debug info. + + +if ($rpl_debug) +{ + --echo # debug: assert_text='$assert_text' assert_cond='$assert_cond' +} + +# Sanity-check input +if (`SELECT "$assert_text" = ""`) +{ + --die ERROR IN TEST: the mysqltest variable rpl_test must be set +} + +# Evaluate square brackets in cond. +--let $_rpl_assert_substmt_number= 1 +--let $_rpl_interpolated_cond= $assert_cond +--let $_rpl_assert_lbracket= `SELECT LOCATE('[', '$_rpl_interpolated_cond')` +while ($_rpl_assert_lbracket) +{ + # Get position of right bracket + --let $_rpl_assert_rbracket= `SELECT LOCATE(']', '$_rpl_interpolated_cond')` + if (!$_rpl_assert_rbracket) + { + --echo BUG IN TEST: Mismatching square brackets in assert_cond: '$assert_cond' + --die BUG IN TEST: Mismatching square brackets in $assert_cond + } + # Get sub-statement and result of it + --let $_rpl_assert_substmt= `SELECT SUBSTRING('$_rpl_interpolated_cond', $_rpl_assert_lbracket + 1, $_rpl_assert_rbracket - $_rpl_assert_lbracket - 1)` + --let $_rpl_assert_substmt_result= query_get_value($_rpl_assert_substmt) + if ($rpl_debug) + { + --echo # debug: sub-statement='$_rpl_assert_substmt' result='$rpl_assert_result' + } + # Replace sub-statement by its result + --let $_rpl_interpolated_cond= `SELECT REPLACE('$_rpl_interpolated_cond', '[$_rpl_assert_substmt]', '$_rpl_assert_substmt_result')` + # Replace result references by result + --let $_rpl_interpolated_cond= `SELECT REPLACE('$_rpl_interpolated_cond', '<$_rpl_assert_substmt_number>', '$_rpl_assert_substmt_result')` + + --let $_rpl_assert_lbracket= `SELECT LOCATE('[', '$_rpl_interpolated_cond')` + + --inc $_rpl_assert_substmt_number +} + +if ($rpl_debug) +{ + --echo # debug: interpolated_cond='$_rpl_interpolated_cond' +} + +# Execute. +--let $_rpl_assert_result= `SELECT $_rpl_interpolated_cond` + +if ($rpl_debug) +{ + --echo # debug: result='$_rpl_assert_result' +} + +# Check. +if (!$_rpl_assert_result) +{ + --echo ######## Test assertion failed: $assert_text ######## + --echo Dumping debug info: + --source include/show_rpl_debug_info.inc + --echo Assertion text: '$assert_text' + --echo Assertion condition: '$assert_cond' + --echo Assertion condition, interpolated: '$_rpl_interpolated_cond' + --echo Assertion result: '$_rpl_assert_result' + --die Test assertion failed in rpl_assertion.inc +} + +if (!$assert_quiet) +{ + --echo # Asserted this: $assert_text +} + +--let $assert_text= +--let $assert_cond= diff --git a/mysql-test/include/search_pattern_in_file.inc b/mysql-test/include/search_pattern_in_file.inc index 84237026ed0..3280dbfd574 100644 --- a/mysql-test/include/search_pattern_in_file.inc +++ b/mysql-test/include/search_pattern_in_file.inc @@ -60,25 +60,30 @@ perl; use strict; - my $search_file= $ENV{'SEARCH_FILE'} or die "SEARCH_FILE not set"; + die "SEARCH_FILE not set" unless $ENV{'SEARCH_FILE'}; + my @search_files= glob($ENV{'SEARCH_FILE'}); my $search_pattern= $ENV{'SEARCH_PATTERN'} or die "SEARCH_PATTERN not set"; my $search_range= $ENV{'SEARCH_RANGE'}; - my $file_content; + my $content; $search_range= 50000 unless $search_range =~ /-?[0-9]+/; - open(FILE, '<', $search_file) or die("Unable to open '$search_file': $!\n"); - if ($search_range >= 0) { - read(FILE, $file_content, $search_range, 0); - } else { - my $size= -s $search_file; - $search_range = -$size if $size > -$search_range; - seek(FILE, $search_range, 2); - read(FILE, $file_content, -$search_range, 0); + foreach my $search_file (@search_files) { + open(FILE, '<', $search_file) or die("Unable to open '$search_file': $!\n"); + my $file_content; + if ($search_range >= 0) { + read(FILE, $file_content, $search_range, 0); + } else { + my $size= -s $search_file; + $search_range = -$size if $size > -$search_range; + seek(FILE, $search_range, 2); + read(FILE, $file_content, -$search_range, 0); + } + close(FILE); + $content.= $file_content; } - close(FILE); - $search_file =~ s{^.*?([^/\\]+)$}{$1}; - if ($file_content =~ m{$search_pattern}) { - print "FOUND /$search_pattern/ in $search_file\n" + $ENV{'SEARCH_FILE'} =~ s{^.*?([^/\\]+)$}{$1}; + if ($content =~ m{$search_pattern}) { + print "FOUND /$search_pattern/ in $ENV{'SEARCH_FILE'}\n" } else { - print "NOT FOUND /$search_pattern/ in $search_file\n" + print "NOT FOUND /$search_pattern/ in $ENV{'SEARCH_FILE'}\n" } EOF diff --git a/mysql-test/include/show_binlog_events2.inc b/mysql-test/include/show_binlog_events2.inc index eefefe4bfbe..84c62cced66 100644 --- a/mysql-test/include/show_binlog_events2.inc +++ b/mysql-test/include/show_binlog_events2.inc @@ -4,7 +4,7 @@ if ($binlog_start) } if (!$binlog_start) { - --let $_binlog_start=249 + --let $_binlog_start=256 } if ($binlog_file) { diff --git a/mysql-test/include/show_delayed_slave_state.inc b/mysql-test/include/show_delayed_slave_state.inc new file mode 100644 index 00000000000..8eb7232a206 --- /dev/null +++ b/mysql-test/include/show_delayed_slave_state.inc @@ -0,0 +1,28 @@ +# ==== Purpose ==== +# +# Display the delay state of the SQL thread. +# +# ==== Usage ==== +# +# --let $verbose_delayed_slave_state= [0|1] +# --source extra/rpl_tests/show_delayed_slave_state.inc +# +# By default, the output is normalized so that it does not depend on +# exact timing or exact binlog positions. If +# $verbose_delayed_slave_state is set, then it outputs exact times and +# binlog positions. This can be useful for debugging. + +--let $_delayed_slave_status= query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running_State, 1) + +--let $_delayed_slave_remaining_delay= query_get_value(SHOW SLAVE STATUS, SQL_Remaining_Delay, 1) +--let $_delayed_slave_qualitative_delay= `SELECT CASE WHEN "$_delayed_slave_remaining_delay" = "NULL" THEN "NULL" WHEN "$_delayed_slave_remaining_delay" = "0" THEN "0" ELSE "greater than zero" END` + +--let $_delayed_slave_io_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1) +--let $_delayed_slave_sql_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1) +--let $_delayed_slave_qualitative_log_pos= `SELECT IF($_delayed_slave_io_pos > $_delayed_slave_sql_pos, "behind", "in sync with")` + +--echo Slave_SQL_Running_State='$_delayed_slave_status'; SQL_Remaining_Delay is $_delayed_slave_qualitative_delay; SQL thread is $_delayed_slave_qualitative_log_pos IO thread + +if ($verbose_delayed_slave_state) { + --echo SQL_Remaining_Delay='$_delayed_slave_remaining_delay'; Read_master_log_pos='$_delayed_slave_io_pos'; Exec_Master_Log_Pos='$_delayed_slave_sql_pos' +} diff --git a/mysql-test/include/sync_slave_sql_with_io.inc b/mysql-test/include/sync_slave_sql_with_io.inc index 8048f7a177c..9efede9a61f 100644 --- a/mysql-test/include/sync_slave_sql_with_io.inc +++ b/mysql-test/include/sync_slave_sql_with_io.inc @@ -26,6 +26,10 @@ let $_slave_timeout= $slave_timeout; if (!$_slave_timeout) { let $_slave_timeout= 300; + if ($VALGRIND_TEST) + { + let $_slave_timeout= 1500; + } } --let $_master_log_file= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1) diff --git a/mysql-test/include/sync_with_master.inc b/mysql-test/include/sync_with_master.inc new file mode 100644 index 00000000000..dcb995a3ca9 --- /dev/null +++ b/mysql-test/include/sync_with_master.inc @@ -0,0 +1,26 @@ +# ==== Purpose ==== +# +# This file does the same as the built-in command sync_with_master, +# but can be configured to use a custom timeout. This has the benefit +# that it accepts the same $slave_timeout and $master_connection +# parameters as wait_for_slave_param.inc +# +# +# ==== Usage ==== +# +# --connection master +# --source include/save_master_pos.inc +# --connection slave +# --source include/sync_with_master.inc +# +# Parameters to this macro are $slave_timeout and +# $master_connection. See wait_for_slave_param.inc for +# descriptions. + +--let $slave_param= Relay_Master_Log_File +--let $slave_param_value= $_master_file +--source include/wait_for_slave_param.inc + +--let $slave_param= Exec_Master_Log_Pos +--let $slave_param_value= $_master_pos +--source include/wait_for_slave_param.inc diff --git a/mysql-test/include/wait_for_slave_param.inc b/mysql-test/include/wait_for_slave_param.inc index d3f7ec56614..25020d46ed9 100644 --- a/mysql-test/include/wait_for_slave_param.inc +++ b/mysql-test/include/wait_for_slave_param.inc @@ -50,6 +50,10 @@ let $_slave_timeout= $slave_timeout; if (!$_slave_timeout) { let $_slave_timeout= 300; + if ($VALGRIND_TEST) + { + let $_slave_timeout= 1500; + } } if ($slave_error_param == '') diff --git a/mysql-test/suite/multi_source/wait_for_sql_thread_read_all.inc b/mysql-test/include/wait_for_sql_thread_read_all.inc similarity index 100% rename from mysql-test/suite/multi_source/wait_for_sql_thread_read_all.inc rename to mysql-test/include/wait_for_sql_thread_read_all.inc diff --git a/mysql-test/lib/My/CoreDump.pm b/mysql-test/lib/My/CoreDump.pm index 0e90967ef95..f9f7b3d8d4b 100644 --- a/mysql-test/lib/My/CoreDump.pm +++ b/mysql-test/lib/My/CoreDump.pm @@ -261,11 +261,7 @@ sub show { # On Windows, rely on cdb to be there... if (IS_WINDOWS) { - # Starting cdb is unsafe when used with --parallel > 1 option - if ( $parallel < 2 ) - { - _cdb($core_name); - } + _cdb($core_name); return; } diff --git a/mysql-test/lib/My/Platform.pm b/mysql-test/lib/My/Platform.pm index 1776f1008da..110cf8a20e0 100644 --- a/mysql-test/lib/My/Platform.pm +++ b/mysql-test/lib/My/Platform.pm @@ -24,7 +24,7 @@ use File::Path; use base qw(Exporter); our @EXPORT= qw(IS_CYGWIN IS_WINDOWS IS_WIN32PERL native_path posix_path mixed_path - check_socket_path_length process_alive); + check_socket_path_length process_alive open_for_append); BEGIN { if ($^O eq "cygwin") { @@ -161,4 +161,51 @@ sub process_alive { } + +use Symbol qw( gensym ); + +use if $^O eq 'MSWin32', 'Win32API::File', qw( CloseHandle CreateFile GetOsFHandle OsFHandleOpen OPEN_ALWAYS FILE_APPEND_DATA + FILE_SHARE_READ FILE_SHARE_WRITE FILE_SHARE_DELETE ); +use if $^O eq 'MSWin32', 'Win32::API'; + +use constant WIN32API_FILE_NULL => []; + +# Open a file for append +# On Windows we use CreateFile with FILE_APPEND_DATA +# to insure that writes are atomic, not interleaved +# with writes by another processes. +sub open_for_append +{ + my ($file) = @_; + my $fh = gensym(); + + if (IS_WIN32PERL) + { + my $handle; + if (!($handle = CreateFile( + $file, + FILE_APPEND_DATA(), + FILE_SHARE_READ()|FILE_SHARE_WRITE()|FILE_SHARE_DELETE(), + WIN32API_FILE_NULL, + OPEN_ALWAYS(),# Create if doesn't exist. + 0, + WIN32API_FILE_NULL, + ))) + { + return undef; + } + + if (!OsFHandleOpen($fh, $handle, 'wat')) + { + CloseHandle($handle); + return undef; + } + return $fh; + } + + open($fh,">>",$file) or return undef; + return $fh; +} + + 1; diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index 2be903abf42..d758b81c1c7 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -58,8 +58,6 @@ use My::Test; use My::Find; use My::Suite; -require "mtr_misc.pl"; - # locate plugin suites, depending on whether it's a build tree or installed my @plugin_suitedirs; my $plugin_suitedir_regex; @@ -1096,7 +1094,7 @@ sub get_tags_from_file($$) { $file_to_tags{$file}= $tags; $file_to_master_opts{$file}= $master_opts; $file_to_slave_opts{$file}= $slave_opts; - $file_combinations{$file}= [ uniq(@combinations) ]; + $file_combinations{$file}= [ ::uniq(@combinations) ]; $file_in_overlay{$file} = 1 if $in_overlay; return @{$tags}; } diff --git a/mysql-test/lib/mtr_io.pl b/mysql-test/lib/mtr_io.pl index 8c2803f0427..0de4d9612ac 100644 --- a/mysql-test/lib/mtr_io.pl +++ b/mysql-test/lib/mtr_io.pl @@ -21,6 +21,7 @@ use strict; use Carp; +use My::Platform; sub mtr_fromfile ($); sub mtr_tofile ($@); @@ -45,10 +46,10 @@ sub mtr_fromfile ($) { sub mtr_tofile ($@) { my $file= shift; - - open(FILE,">>",$file) or mtr_error("can't open file \"$file\": $!"); - print FILE join("", @_); - close FILE; + my $fh= open_for_append $file; + mtr_error("can't open file \"$file\": $!") unless defined($fh); + print $fh join("", @_); + close $fh; } diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm index 9ab82c454ed..97ace54f0fb 100644 --- a/mysql-test/lib/mtr_report.pm +++ b/mysql-test/lib/mtr_report.pm @@ -34,7 +34,6 @@ use mtr_match; use My::Platform; use POSIX qw[ _exit ]; use IO::Handle qw[ flush ]; -require "mtr_io.pl"; use mtr_results; my $tot_real_time= 0; @@ -92,7 +91,7 @@ sub mtr_report_test_passed ($) { my $timer_str= ""; if ( $timer and -f "$::opt_vardir/log/timer" ) { - $timer_str= mtr_fromfile("$::opt_vardir/log/timer"); + $timer_str= ::mtr_fromfile("$::opt_vardir/log/timer"); $tinfo->{timer}= $timer_str; resfile_test_info('duration', $timer_str) if $::opt_resfile; } diff --git a/mysql-test/lib/v1/mtr_report.pl b/mysql-test/lib/v1/mtr_report.pl index 738236a731e..0af70d96647 100644 --- a/mysql-test/lib/v1/mtr_report.pl +++ b/mysql-test/lib/v1/mtr_report.pl @@ -361,9 +361,6 @@ sub mtr_report_stats ($) { /Slave: Can't DROP 'c7'.* 1091/ or /Slave: Key column 'c6'.* 1072/ or - # Warnings generated until bug#42147 is properly resolved - /Found lock of type 6 that is write and read locked/ or - # rpl_idempotency.test produces warnings for the slave. ($testname eq 'rpl.rpl_idempotency' and (/Slave: Can\'t find record in \'t1\' error.* 1032/ or diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 81291789a20..58aedf169d8 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -102,11 +102,11 @@ use mtr_results; use IO::Socket::INET; use IO::Select; -require "lib/mtr_process.pl"; -require "lib/mtr_io.pl"; -require "lib/mtr_gcov.pl"; -require "lib/mtr_gprof.pl"; -require "lib/mtr_misc.pl"; +require "mtr_process.pl"; +require "mtr_io.pl"; +require "mtr_gcov.pl"; +require "mtr_gprof.pl"; +require "mtr_misc.pl"; $SIG{INT}= sub { mtr_error("Got ^C signal"); }; $SIG{HUP}= sub { mtr_error("Hangup detected on controlling terminal"); }; @@ -170,15 +170,18 @@ my @DEFAULT_SUITES= qw( main- archive- binlog- + binlog_encryption- csv- encryption- federated- funcs_1- funcs_2- + gcol- handler- heap- innodb- innodb_fts- + innodb_gis- innodb_zip- maria- multi_source- diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index f3e41e1b246..4cccf861807 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -1544,17 +1544,17 @@ ALTER TABLE t1 ADD INDEX i2(b), ALGORITHM= DEFAULT; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 1 Warnings: -Note 1831 Duplicate index 'i2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `i2`. This is deprecated and will be disallowed in a future release ALTER TABLE t1 ADD INDEX i3(b), ALGORITHM= COPY; affected rows: 2 info: Records: 2 Duplicates: 0 Warnings: 1 Warnings: -Note 1831 Duplicate index 'i3' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `i3`. This is deprecated and will be disallowed in a future release ALTER TABLE t1 ADD INDEX i4(b), ALGORITHM= INPLACE; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 1 Warnings: -Note 1831 Duplicate index 'i4' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `i4`. This is deprecated and will be disallowed in a future release ALTER TABLE t1 ADD INDEX i5(b), ALGORITHM= INVALID; ERROR HY000: Unknown ALGORITHM 'INVALID' ALTER TABLE m1 ENABLE KEYS; @@ -1579,17 +1579,17 @@ ALTER TABLE t1 ADD INDEX i2(b), ALGORITHM= DEFAULT; affected rows: 2 info: Records: 2 Duplicates: 0 Warnings: 1 Warnings: -Note 1831 Duplicate index 'i2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `i2`. This is deprecated and will be disallowed in a future release ALTER TABLE t1 ADD INDEX i3(b), ALGORITHM= COPY; affected rows: 2 info: Records: 2 Duplicates: 0 Warnings: 1 Warnings: -Note 1831 Duplicate index 'i3' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `i3`. This is deprecated and will be disallowed in a future release ALTER TABLE t1 ADD INDEX i4(b), ALGORITHM= INPLACE; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 1 Warnings: -Note 1831 Duplicate index 'i4' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `i4`. This is deprecated and will be disallowed in a future release SET SESSION old_alter_table= 0; affected rows: 0 ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4; @@ -1611,17 +1611,17 @@ ALTER TABLE t1 ADD INDEX i2(b), LOCK= NONE; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 1 Warnings: -Note 1831 Duplicate index 'i2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `i2`. This is deprecated and will be disallowed in a future release ALTER TABLE t1 ADD INDEX i3(b), LOCK= SHARED; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 1 Warnings: -Note 1831 Duplicate index 'i3' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `i3`. This is deprecated and will be disallowed in a future release ALTER TABLE t1 ADD INDEX i4(b), LOCK= EXCLUSIVE; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 1 Warnings: -Note 1831 Duplicate index 'i4' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `i4`. This is deprecated and will be disallowed in a future release ALTER TABLE t1 ADD INDEX i5(b), LOCK= INVALID; ERROR HY000: Unknown LOCK type 'INVALID' ALTER TABLE m1 ENABLE KEYS, LOCK= DEFAULT; @@ -1641,24 +1641,24 @@ ALTER TABLE t1 ADD INDEX i2(b), ALGORITHM= INPLACE, LOCK= SHARED; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 1 Warnings: -Note 1831 Duplicate index 'i2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `i2`. This is deprecated and will be disallowed in a future release ALTER TABLE t1 ADD INDEX i3(b), ALGORITHM= INPLACE, LOCK= EXCLUSIVE; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 1 Warnings: -Note 1831 Duplicate index 'i3' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `i3`. This is deprecated and will be disallowed in a future release ALTER TABLE t1 ADD INDEX i4(b), ALGORITHM= COPY, LOCK= NONE; ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED ALTER TABLE t1 ADD INDEX i5(b), ALGORITHM= COPY, LOCK= SHARED; affected rows: 2 info: Records: 2 Duplicates: 0 Warnings: 1 Warnings: -Note 1831 Duplicate index 'i5' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `i5`. This is deprecated and will be disallowed in a future release ALTER TABLE t1 ADD INDEX i6(b), ALGORITHM= COPY, LOCK= EXCLUSIVE; affected rows: 2 info: Records: 2 Duplicates: 0 Warnings: 1 Warnings: -Note 1831 Duplicate index 'i6' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `i6`. This is deprecated and will be disallowed in a future release ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE, LOCK= NONE; ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE, LOCK= SHARED; @@ -2034,6 +2034,64 @@ Warnings: Note 1061 Multiple primary key defined DROP TABLE t1; # +# MDEV-11126 Crash while altering persistent virtual column +# +CREATE TABLE `tab1` ( +`id` bigint(20) NOT NULL AUTO_INCREMENT, +`field2` set('option1','option2','option3','option4') NOT NULL, +`field3` set('option1','option2','option3','option4','option5') NOT NULL, +`field4` set('option1','option2','option3','option4') NOT NULL, +`field5` varchar(32) NOT NULL, +`field6` varchar(32) NOT NULL, +`field7` varchar(32) NOT NULL, +`field8` varchar(32) NOT NULL, +`field9` int(11) NOT NULL DEFAULT '1', +`field10` varchar(16) NOT NULL, +`field11` enum('option1','option2','option3') NOT NULL DEFAULT 'option1', +`v_col` varchar(128) AS (IF(field11='option1',CONCAT_WS(":","field1",field2,field3,field4,field5,field6,field7,field8,field9,field10), CONCAT_WS(":","field1",field11,field2,field3,field4,field5,field6,field7,field8,field9,field10))) PERSISTENT, +PRIMARY KEY (`id`) +) DEFAULT CHARSET=latin1; +ALTER TABLE `tab1` CHANGE COLUMN v_col `v_col` varchar(128); +SHOW CREATE TABLE `tab1`; +Table Create Table +tab1 CREATE TABLE `tab1` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `field2` set('option1','option2','option3','option4') NOT NULL, + `field3` set('option1','option2','option3','option4','option5') NOT NULL, + `field4` set('option1','option2','option3','option4') NOT NULL, + `field5` varchar(32) NOT NULL, + `field6` varchar(32) NOT NULL, + `field7` varchar(32) NOT NULL, + `field8` varchar(32) NOT NULL, + `field9` int(11) NOT NULL DEFAULT 1, + `field10` varchar(16) NOT NULL, + `field11` enum('option1','option2','option3') NOT NULL DEFAULT 'option1', + `v_col` varchar(128) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +ALTER TABLE `tab1` CHANGE COLUMN v_col `v_col` varchar(128) AS (IF(field11='option1',CONCAT_WS(":","field1",field2,field3,field4,field5,field6,field7,field8,field9,field10), CONCAT_WS(":","field1",field11,field2,field3,field4,field5,field6,field7,field8,field9,field10))) PERSISTENT; +SHOW CREATE TABLE `tab1`; +Table Create Table +tab1 CREATE TABLE `tab1` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `field2` set('option1','option2','option3','option4') NOT NULL, + `field3` set('option1','option2','option3','option4','option5') NOT NULL, + `field4` set('option1','option2','option3','option4') NOT NULL, + `field5` varchar(32) NOT NULL, + `field6` varchar(32) NOT NULL, + `field7` varchar(32) NOT NULL, + `field8` varchar(32) NOT NULL, + `field9` int(11) NOT NULL DEFAULT 1, + `field10` varchar(16) NOT NULL, + `field11` enum('option1','option2','option3') NOT NULL DEFAULT 'option1', + `v_col` varchar(128) GENERATED ALWAYS AS (if(`field11` = 'option1',concat_ws(':','field1',`field2`,`field3`,`field4`,`field5`,`field6`,`field7`,`field8`,`field9`,`field10`),concat_ws(':','field1',`field11`,`field2`,`field3`,`field4`,`field5`,`field6`,`field7`,`field8`,`field9`,`field10`))) STORED, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE `tab1`; +# +# Start of 10.1 tests +# +# # MDEV-7374 : Losing connection to MySQL while running ALTER TABLE # CREATE TABLE t1(i INT) ENGINE=INNODB; @@ -2042,9 +2100,6 @@ INSERT INTO t1 SELECT a.* FROM t1 a, t1 b, t1 c, t1 d, t1 e; ALTER TABLE t1 MODIFY i FLOAT; DROP TABLE t1; # -# Start of 10.1 tests -# -# # MDEV-7816 ALTER with DROP INDEX and ADD INDEX .. COMMENT='comment2' ignores the new comment # CREATE TABLE t1(a INT); @@ -2073,8 +2128,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - CONSTRAINT `min` CHECK (a+b > 100), - CONSTRAINT `mini` CHECK (a+b > 100) + CONSTRAINT `min` CHECK (`a` + `b` > 100), + CONSTRAINT `mini` CHECK (`a` + `b` > 100) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1(a INT, b INT, CONSTRAINT min check (a>5), diff --git a/mysql-test/r/analyze_format_json.result b/mysql-test/r/analyze_format_json.result index fadbe705f99..db28a2748aa 100644 --- a/mysql-test/r/analyze_format_json.result +++ b/mysql-test/r/analyze_format_json.result @@ -18,7 +18,7 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 30, - "attached_condition": "(t0.a < 3)" + "attached_condition": "t0.a < 3" } } } @@ -46,7 +46,7 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 0, - "attached_condition": "((t0.a > 9) and (t0.a is not null))" + "attached_condition": "t0.a > 9 and t0.a is not null" }, "table": { "table_name": "t1", @@ -86,7 +86,7 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, - "attached_condition": "(t0.a is not null)" + "attached_condition": "t0.a is not null" }, "table": { "table_name": "t1", @@ -102,7 +102,7 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 40, - "attached_condition": "(t1.b < 4)" + "attached_condition": "t1.b < 4" } } } @@ -128,7 +128,7 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 20, - "attached_condition": "(tbl1.b < 20)" + "attached_condition": "tbl1.b < 20" }, "block-nl-join": { "table": { @@ -140,7 +140,7 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 60, - "attached_condition": "(tbl2.b < 60)" + "attached_condition": "tbl2.b < 60" }, "buffer_type": "flat", "buffer_size": "256Kb", @@ -166,7 +166,7 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 20, - "attached_condition": "(tbl1.b < 20)" + "attached_condition": "tbl1.b < 20" }, "block-nl-join": { "table": { @@ -178,12 +178,12 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 60, - "attached_condition": "(tbl2.b < 60)" + "attached_condition": "tbl2.b < 60" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(tbl1.c > tbl2.c)", + "attached_condition": "tbl1.c > tbl2.c", "r_filtered": 15.833 } } @@ -213,7 +213,7 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, - "attached_condition": "(t1.a is not null)" + "attached_condition": "t1.a is not null" }, "table": { "table_name": "t2", @@ -263,7 +263,7 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 50, - "attached_condition": "(test.t1.a < 5)" + "attached_condition": "test.t1.a < 5" } } } @@ -320,8 +320,8 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 50, - "index_condition": "(t1.pk < 10)", - "attached_condition": "(t1.b > 4)" + "index_condition": "t1.pk < 10", + "attached_condition": "t1.b > 4" } } } @@ -344,7 +344,7 @@ ANALYZE "r_rows": 10, "r_filtered": 50, "r_total_time_ms": "REPLACED", - "attached_condition": "((t1.pk < 10) and (t1.b > 4))" + "attached_condition": "t1.pk < 10 and t1.b > 4" } } } @@ -444,7 +444,7 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 50, - "attached_condition": "(tbl1.a < 5)" + "attached_condition": "tbl1.a < 5" } } }, @@ -462,7 +462,7 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 20, - "attached_condition": "(tbl2.a in (2,3))" + "attached_condition": "tbl2.a in (2,3)" } } } @@ -492,7 +492,7 @@ ANALYZE "select_id": 1, "r_loops": 1, "volatile parameter": "REPLACED", - "having_condition": "(TOP > t2.a)", + "having_condition": "TOP > t2.a", "filesort": { "sort_key": "t2.a", "r_loops": 1, @@ -660,7 +660,7 @@ ANALYZE "buffer_type": "incremental", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(t2.b = ``.a)", + "attached_condition": "t2.b = ``.a", "r_filtered": 0 } } @@ -722,7 +722,7 @@ ANALYZE "volatile parameter": "REPLACED", "filtered": 100, "r_filtered": 0, - "attached_condition": "(t3.f3 in (1,2))" + "attached_condition": "t3.f3 in (1,2)" }, "buffer_type": "flat", "buffer_size": "256Kb", @@ -758,7 +758,7 @@ ANALYZE "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(t2.f2 = t3.f3)", + "attached_condition": "t2.f2 = t3.f3", "r_filtered": null } } diff --git a/mysql-test/r/analyze_stmt_orderby.result b/mysql-test/r/analyze_stmt_orderby.result index 37f0005148e..8d904a4419b 100644 --- a/mysql-test/r/analyze_stmt_orderby.result +++ b/mysql-test/r/analyze_stmt_orderby.result @@ -79,7 +79,7 @@ EXPLAIN "key_length": "5", "used_key_parts": ["a"], "rows": 8, - "attached_condition": "(t2.a < 10)" + "attached_condition": "t2.a < 10" } } } @@ -104,7 +104,7 @@ ANALYZE "r_rows": 10, "r_filtered": 100, "r_total_time_ms": "REPLACED", - "attached_condition": "(t2.a < 10)" + "attached_condition": "t2.a < 10" } } } @@ -179,7 +179,7 @@ EXPLAIN "access_type": "ALL", "rows": 10, "filtered": 100, - "attached_condition": "(t0.a is not null)" + "attached_condition": "t0.a is not null" }, "table": { "table_name": "t2", @@ -221,7 +221,7 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, - "attached_condition": "(t0.a is not null)" + "attached_condition": "t0.a is not null" }, "table": { "table_name": "t2", @@ -264,7 +264,7 @@ EXPLAIN "access_type": "ALL", "rows": 10, "filtered": 100, - "attached_condition": "(t0.a is not null)" + "attached_condition": "t0.a is not null" } } }, @@ -307,7 +307,7 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 1, - "attached_condition": "(t0.a is not null)" + "attached_condition": "t0.a is not null" } } }, @@ -365,7 +365,7 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 50, - "attached_condition": "((t2.a % 2) = 0)" + "attached_condition": "t2.a % 2 = 0" } } } @@ -428,7 +428,7 @@ ANALYZE "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(t3.a = t0.a)", + "attached_condition": "t3.a = t0.a", "r_filtered": 10 } } @@ -483,7 +483,7 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 80, - "attached_condition": "((t6.b > 0) and (t6.a <= 5))" + "attached_condition": "t6.b > 0 and t6.a <= 5" }, "block-nl-join": { "table": { @@ -499,7 +499,7 @@ ANALYZE "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(t5.a = t6.a)", + "attached_condition": "t5.a = t6.a", "r_filtered": 21.429 } } @@ -527,7 +527,7 @@ EXPLAIN "access_type": "ALL", "rows": 5, "filtered": 100, - "attached_condition": "((t6.b > 0) and (t6.a <= 5))" + "attached_condition": "t6.b > 0 and t6.a <= 5" }, "block-nl-join": { "table": { @@ -539,7 +539,7 @@ EXPLAIN "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(t5.a = t6.a)" + "attached_condition": "t5.a = t6.a" } } } diff --git a/mysql-test/r/analyze_stmt_slow_query_log.result b/mysql-test/r/analyze_stmt_slow_query_log.result index 7d280e66b6c..a0c4b45dee0 100644 --- a/mysql-test/r/analyze_stmt_slow_query_log.result +++ b/mysql-test/r/analyze_stmt_slow_query_log.result @@ -1,4 +1,7 @@ drop table if exists t1; +SET @@global.slow_query_log = OFF; +FLUSH SLOW LOGS; +SET @@global.slow_query_log = ON; create table t1 (a int); INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); select * from t1 where a<3; diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result index 5fca4c82883..e58cce67d6a 100644 --- a/mysql-test/r/bigint.result +++ b/mysql-test/r/bigint.result @@ -420,22 +420,22 @@ UPDATE t1 SET b = a; EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a = 18446744073709551615 AND TRIM(a) = b; SHOW WARNINGS; Level Code Message -Note 1003 select 1 AS `1` from `test`.`t1` where ((`test`.`t1`.`a` = 18446744073709551615) and ('18446744073709551615' = `test`.`t1`.`b`)) +Note 1003 select 1 AS `1` from `test`.`t1` where `test`.`t1`.`a` = 18446744073709551615 and '18446744073709551615' = `test`.`t1`.`b` # 8000000000000000 EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a = 9223372036854775808 AND TRIM(a) = b; SHOW WARNINGS; Level Code Message -Note 1003 select 1 AS `1` from `test`.`t1` where ((`test`.`t1`.`a` = 9223372036854775808) and ('9223372036854775808' = `test`.`t1`.`b`)) +Note 1003 select 1 AS `1` from `test`.`t1` where `test`.`t1`.`a` = 9223372036854775808 and '9223372036854775808' = `test`.`t1`.`b` # 7FFFFFFFFFFFFFFF EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a = 9223372036854775807 AND TRIM(a) = b; SHOW WARNINGS; Level Code Message -Note 1003 select 1 AS `1` from `test`.`t1` where ((`test`.`t1`.`a` = 9223372036854775807) and ('9223372036854775807' = `test`.`t1`.`b`)) +Note 1003 select 1 AS `1` from `test`.`t1` where `test`.`t1`.`a` = 9223372036854775807 and '9223372036854775807' = `test`.`t1`.`b` # 0 EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a = 0 AND TRIM(a) = b; SHOW WARNINGS; Level Code Message -Note 1003 select 1 AS `1` from `test`.`t1` where ((`test`.`t1`.`a` = 0) and ('0' = `test`.`t1`.`b`)) +Note 1003 select 1 AS `1` from `test`.`t1` where `test`.`t1`.`a` = 0 and '0' = `test`.`t1`.`b` DROP TABLE t1; # End of 5.1 tests # diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result index 9ceb7efde64..5a02ca22392 100644 --- a/mysql-test/r/case.result +++ b/mysql-test/r/case.result @@ -27,7 +27,7 @@ explain extended select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" E id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select (case 1 when 1 then 'one' when 2 then 'two' else 'more' end) AS `CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END` +Note 1003 select case 1 when 1 then 'one' when 2 then 'two' else 'more' end AS `CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END` select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END; CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END two @@ -66,7 +66,7 @@ explain extended select case a when 1 then 2 when 2 then 3 else 0 end as fcase, id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort Warnings: -Note 1003 select (case `test`.`t1`.`a` when 1 then 2 when 2 then 3 else 0 end) AS `fcase`,count(0) AS `count(*)` from `test`.`t1` group by (case `test`.`t1`.`a` when 1 then 2 when 2 then 3 else 0 end) +Note 1003 select case `test`.`t1`.`a` when 1 then 2 when 2 then 3 else 0 end AS `fcase`,count(0) AS `count(*)` from `test`.`t1` group by case `test`.`t1`.`a` when 1 then 2 when 2 then 3 else 0 end select case a when 1 then "one" when 2 then "two" else "nothing" end as fcase, count(*) from t1 group by fcase; fcase count(*) nothing 2 @@ -147,7 +147,7 @@ COALESCE('a' COLLATE latin1_bin,'b'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select coalesce(1) AS `COALESCE(1)`,coalesce(1.0) AS `COALESCE(1.0)`,coalesce('a') AS `COALESCE('a')`,coalesce(1,1.0) AS `COALESCE(1,1.0)`,coalesce(1,'1') AS `COALESCE(1,'1')`,coalesce(1.1,'1') AS `COALESCE(1.1,'1')`,coalesce(('a' collate latin1_bin),'b') AS `COALESCE('a' COLLATE latin1_bin,'b')` +Note 1003 select coalesce(1) AS `COALESCE(1)`,coalesce(1.0) AS `COALESCE(1.0)`,coalesce('a') AS `COALESCE('a')`,coalesce(1,1.0) AS `COALESCE(1,1.0)`,coalesce(1,'1') AS `COALESCE(1,'1')`,coalesce(1.1,'1') AS `COALESCE(1.1,'1')`,coalesce('a' collate latin1_bin,'b') AS `COALESCE('a' COLLATE latin1_bin,'b')` SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -270,7 +270,7 @@ SELECT * FROM t1 WHERE CASE a WHEN 1 THEN 1 ELSE 0 END AND a='5'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '5') and (case `test`.`t1`.`a` when 1 then 1 else 0 end)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '5' and case `test`.`t1`.`a` when 1 then 1 else 0 end DROP TABLE t1; CREATE TABLE t1 (a ENUM('a','b','100')); INSERT INTO t1 VALUES ('a'),('b'),('100'); @@ -289,7 +289,7 @@ SELECT * FROM t1 WHERE CASE a WHEN 'a' THEN 1 ELSE 0 END AND a='a'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' SELECT * FROM t1 WHERE a=3; a 100 @@ -307,7 +307,7 @@ SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END AND a=3; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((case `test`.`t1`.`a` when 3 then 1 else 0 end) and (`test`.`t1`.`a` = 3)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where case `test`.`t1`.`a` when 3 then 1 else 0 end and `test`.`t1`.`a` = 3 SELECT * FROM t1 WHERE a=3; a 100 @@ -323,7 +323,7 @@ SELECT * FROM t1 WHERE CASE a WHEN '100' THEN 1 ELSE 0 END AND a=3; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((case `test`.`t1`.`a` when '100' then 1 else 0 end) and (`test`.`t1`.`a` = 3)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where case `test`.`t1`.`a` when '100' then 1 else 0 end and `test`.`t1`.`a` = 3 SELECT * FROM t1 WHERE a='100'; a 100 @@ -339,7 +339,7 @@ SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END AND a='100'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '100') and (case `test`.`t1`.`a` when 3 then 1 else 0 end)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '100' and case `test`.`t1`.`a` when 3 then 1 else 0 end SELECT * FROM t1 WHERE a='100'; a 100 @@ -355,7 +355,7 @@ SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END AND a=' id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '100') and (case `test`.`t1`.`a` when 3 then 1 when '100' then 1 else 0 end)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '100' and case `test`.`t1`.`a` when 3 then 1 when '100' then 1 else 0 end SELECT * FROM t1 WHERE a=3; a 100 @@ -371,7 +371,7 @@ SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END AND a=3 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((case `test`.`t1`.`a` when 3 then 1 when '100' then 1 else 0 end) and (`test`.`t1`.`a` = 3)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where case `test`.`t1`.`a` when 3 then 1 when '100' then 1 else 0 end and `test`.`t1`.`a` = 3 DROP TABLE t1; # # End of MDEV-8752 diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result index 9f653a17ce8..2edacb6c7e9 100644 --- a/mysql-test/r/cast.result +++ b/mysql-test/r/cast.result @@ -33,7 +33,7 @@ explain extended select ~5, cast(~5 as signed); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select ~(5) AS `~5`,cast(~(5) as signed) AS `cast(~5 as signed)` +Note 1003 select ~5 AS `~5`,cast(~5 as signed) AS `cast(~5 as signed)` select cast(18446744073709551615 as signed); cast(18446744073709551615 as signed) -1 @@ -804,7 +804,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` char(5) AS (cast("a" as char(10) binary) + a) VIRTUAL + `b` char(5) GENERATED ALWAYS AS (cast('a' as char(10) charset latin1) + `a`) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select collation(cast("a" as char(10) binary)); diff --git a/mysql-test/r/check.result b/mysql-test/r/check.result index d59146cff5d..341c4411298 100644 --- a/mysql-test/r/check.result +++ b/mysql-test/r/check.result @@ -5,9 +5,9 @@ drop table if exists t1,t2; drop view if exists v1; create table t1(n int not null, key(n), key(n), key(n), key(n)); Warnings: -Note 1831 Duplicate index 'n_2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'n_3' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'n_4' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `n_2`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `n_3`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `n_4`. This is deprecated and will be disallowed in a future release check table t1 extended; connection con2; insert into t1 values (200000); diff --git a/mysql-test/r/check_constraint.result b/mysql-test/r/check_constraint.result index f3c1fda1eee..db64eb7f89f 100644 --- a/mysql-test/r/check_constraint.result +++ b/mysql-test/r/check_constraint.result @@ -3,10 +3,10 @@ create table t1 (a int check(a>10), b int check (b > 20), constraint `min` check show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL CHECK (a>10), - `b` int(11) DEFAULT NULL CHECK (b > 20), - CONSTRAINT `min` CHECK (a+b > 100), - CONSTRAINT `max` CHECK (a+b <500) + `a` int(11) DEFAULT NULL CHECK (`a` > 10), + `b` int(11) DEFAULT NULL CHECK (`b` > 20), + CONSTRAINT `min` CHECK (`a` + `b` > 100), + CONSTRAINT `max` CHECK (`a` + `b` < 500) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (100,100); insert into t1 values (1,1); @@ -52,12 +52,12 @@ set check_constraint_checks=@save_check_constraint; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL CHECK (a>10), - `b` int(11) DEFAULT NULL CHECK (b > 20), - `c` int(11) DEFAULT 0 CHECK (c < 10), - CONSTRAINT `min` CHECK (a+b > 100), - CONSTRAINT `max` CHECK (a+b <500), - CONSTRAINT `CONSTRAINT_1` CHECK (a+b+c < 500) + `a` int(11) DEFAULT NULL CHECK (`a` > 10), + `b` int(11) DEFAULT NULL CHECK (`b` > 20), + `c` int(11) DEFAULT 0 CHECK (`c` < 10), + CONSTRAINT `min` CHECK (`a` + `b` > 100), + CONSTRAINT `max` CHECK (`a` + `b` < 500), + CONSTRAINT `CONSTRAINT_1` CHECK (`a` + `b` + `c` < 500) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values(105,105,105); ERROR 23000: CONSTRAINT `c` failed for `test`.`t1` @@ -75,12 +75,12 @@ create table t2 like t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` int(11) DEFAULT NULL CHECK (a>10), - `b` int(11) DEFAULT NULL CHECK (b > 20), - `c` int(11) DEFAULT 0 CHECK (c < 10), - CONSTRAINT `min` CHECK (a+b > 100), - CONSTRAINT `max` CHECK (a+b <500), - CONSTRAINT `CONSTRAINT_1` CHECK (a+b+c < 500) + `a` int(11) DEFAULT NULL CHECK (`a` > 10), + `b` int(11) DEFAULT NULL CHECK (`b` > 20), + `c` int(11) DEFAULT 0 CHECK (`c` < 10), + CONSTRAINT `min` CHECK (`a` + `b` > 100), + CONSTRAINT `max` CHECK (`a` + `b` < 500), + CONSTRAINT `CONSTRAINT_1` CHECK (`a` + `b` + `c` < 500) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 alter table t2 drop constraint c; ERROR 42000: Can't DROP CONSTRAINT `c`; check that it exists @@ -91,11 +91,11 @@ alter table t2 drop constraint min; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` int(11) DEFAULT NULL CHECK (a>10), - `b` int(11) DEFAULT NULL CHECK (b > 20), - `c` int(11) DEFAULT 0 CHECK (c < 10), - CONSTRAINT `max` CHECK (a+b <500), - CONSTRAINT `CONSTRAINT_1` CHECK (a+b+c < 500) + `a` int(11) DEFAULT NULL CHECK (`a` > 10), + `b` int(11) DEFAULT NULL CHECK (`b` > 20), + `c` int(11) DEFAULT 0 CHECK (`c` < 10), + CONSTRAINT `max` CHECK (`a` + `b` < 500), + CONSTRAINT `CONSTRAINT_1` CHECK (`a` + `b` + `c` < 500) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1,t2; create or replace table t1 (a int, b int, constraint check (a>b)); @@ -104,7 +104,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - CONSTRAINT `CONSTRAINT_1` CHECK (a>b) + CONSTRAINT `CONSTRAINT_1` CHECK (`a` > `b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 create or replace table t1 (a int, b int, constraint CONSTRAINT_1 check (a>1), @@ -114,8 +114,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - CONSTRAINT `CONSTRAINT_1` CHECK (a>1), - CONSTRAINT `CONSTRAINT_2` CHECK (b>1) + CONSTRAINT `CONSTRAINT_1` CHECK (`a` > 1), + CONSTRAINT `CONSTRAINT_2` CHECK (`b` > 1) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 create or replace table t1 (a int, b int, constraint CONSTRAINT_1 check (a>1), @@ -126,8 +126,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - CONSTRAINT `CONSTRAINT_1` CHECK (a>1), - CONSTRAINT `CONSTRAINT_3` CHECK (b>1), - CONSTRAINT `CONSTRAINT_2` CHECK (a>b) + CONSTRAINT `CONSTRAINT_1` CHECK (`a` > 1), + CONSTRAINT `CONSTRAINT_3` CHECK (`b` > 1), + CONSTRAINT `CONSTRAINT_2` CHECK (`a` > `b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; diff --git a/mysql-test/r/commit_1innodb.result b/mysql-test/r/commit_1innodb.result index 1e173221b15..514f0a67c7f 100644 --- a/mysql-test/r/commit_1innodb.result +++ b/mysql-test/r/commit_1innodb.result @@ -419,11 +419,11 @@ SUCCESS # 4. Read-write statement: UPDATE, update 0 rows, 1 row matches WHERE # update t1 set a=2; -call p_verify_status_increment(2, 2, 1, 0); +call p_verify_status_increment(2, 0, 1, 0); SUCCESS commit; -call p_verify_status_increment(2, 2, 1, 0); +call p_verify_status_increment(2, 0, 1, 0); SUCCESS # 5. Read-write statement: UPDATE, update 0 rows, 0 rows match WHERE diff --git a/mysql-test/r/compare.result b/mysql-test/r/compare.result index a5654fb3160..ea8111cc3ce 100644 --- a/mysql-test/r/compare.result +++ b/mysql-test/r/compare.result @@ -64,7 +64,7 @@ EXPLAIN EXTENDED SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`b` = 1) and (concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = '0101')) +Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where `test`.`t1`.`b` = 1 and concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = '0101' SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101'; b c 01 01 @@ -88,7 +88,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`a` AS `a`,<`test`.`t2`.`a`>((select count(0) from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t2`.`a`) and (concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = concat('0',`test`.`t2`.`a`,'01'))))) AS `x` from `test`.`t2` order by `test`.`t2`.`a` +Note 1003 select `test`.`t2`.`a` AS `a`,<`test`.`t2`.`a`>((select count(0) from `test`.`t1` where `test`.`t1`.`b` = `test`.`t2`.`a` and concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = concat('0',`test`.`t2`.`a`,'01'))) AS `x` from `test`.`t2` order by `test`.`t2`.`a` DROP TABLE t1,t2; CREATE TABLE t1 (a TIMESTAMP); INSERT INTO t1 VALUES (NOW()),(NOW()),(NOW()); diff --git a/mysql-test/r/compress.result b/mysql-test/r/compress.result index 13e97ebaafb..762ab6630d8 100644 --- a/mysql-test/r/compress.result +++ b/mysql-test/r/compress.result @@ -1515,7 +1515,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where Warnings: -Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> '')) +Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> '' select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3; companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1) 00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087 diff --git a/mysql-test/r/constraints.result b/mysql-test/r/constraints.result index 8ab38bf1f35..fe9398ea8ce 100644 --- a/mysql-test/r/constraints.result +++ b/mysql-test/r/constraints.result @@ -3,7 +3,7 @@ create table t1 (a int check (a>0)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL CHECK (a>0) + `a` int(11) DEFAULT NULL CHECK (`a` > 0) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1); insert into t1 values (0); @@ -15,7 +15,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - CONSTRAINT `CONSTRAINT_1` CHECK (a>b) + CONSTRAINT `CONSTRAINT_1` CHECK (`a` > `b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,0); insert into t1 values (0,1); @@ -27,7 +27,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - CONSTRAINT `abc` CHECK (a>b) + CONSTRAINT `abc` CHECK (`a` > `b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,0); insert into t1 values (0,1); @@ -45,10 +45,10 @@ create table t1 (a int null); alter table t1 add constraint constraint_1 unique (a); alter table t1 add constraint unique key_1(a); Warnings: -Note 1831 Duplicate index 'key_1' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `key_1`. This is deprecated and will be disallowed in a future release alter table t1 add constraint constraint_2 unique key_2(a); Warnings: -Note 1831 Duplicate index 'key_2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `key_2`. This is deprecated and will be disallowed in a future release show create table t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/r/contributors.result b/mysql-test/r/contributors.result index 918ceaa496f..f3f5e227d3a 100644 --- a/mysql-test/r/contributors.result +++ b/mysql-test/r/contributors.result @@ -9,6 +9,7 @@ Acronis http://www.acronis.com Silver Sponsor of the MariaDB Foundation Auttomattic https://automattic.com Bronze Sponsor of the MariaDB Foundation Verkkokauppa.com https://virtuozzo.com Bronze Sponsor of the MariaDB Foundation Virtuozzo https://virtuozzo.com/ Bronze Sponsor of the MariaDB Foundation +Tencent Game DBA http://tencentdba.com/about/ Bronze Sponsor of the MariaDB Foundation Google USA Sponsoring encryption, parallel replication and GTID Facebook USA Sponsoring non-blocking API, LIMIT ROWS EXAMINED etc Ronald Bradford Brisbane, Australia EFF contribution for UC2006 Auction diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 801a500345e..f9ac0dd4c7f 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -181,36 +181,36 @@ Warnings: Note 1051 Unknown table 'test.t2' create table t1 (a int not null, b int, primary key(a), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b)); Warnings: -Note 1831 Duplicate index 'b_2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_3' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_4' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_5' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_6' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_7' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_8' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_9' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_10' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_11' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_12' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_13' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_14' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_15' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_16' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_17' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_18' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_19' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_20' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_21' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_22' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_23' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_24' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_25' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_26' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_27' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_28' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_29' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_30' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_31' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_2`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_3`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_4`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_5`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_6`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_7`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_8`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_9`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_10`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_11`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_12`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_13`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_14`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_15`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_16`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_17`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_18`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_19`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_20`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_21`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_22`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_23`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_24`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_25`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_26`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_27`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_28`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_29`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_30`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_31`. This is deprecated and will be disallowed in a future release show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -1866,8 +1866,8 @@ Thinkpad Laptop black ttt show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `color` char(32) AS (COLUMN_GET(dynamic_cols, 1 as char)) PERSISTENT, - `cl` char(32) AS (COLUMN_GET(COLUMN_ADD(COLUMN_CREATE(1 , 'blue' as char), 2, 'ttt'), i as char)) PERSISTENT, + `color` char(32) GENERATED ALWAYS AS (column_get(`dynamic_cols`,1 as char charset latin1)) STORED, + `cl` char(32) GENERATED ALWAYS AS (column_get(column_add(column_create(1,'blue' AS char charset latin1 ),2,'ttt'),`i` as char charset latin1)) STORED, `item_name` varchar(32) NOT NULL, `i` int(11) DEFAULT NULL, `dynamic_cols` blob DEFAULT NULL, @@ -1888,7 +1888,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `n` int(11) DEFAULT NULL, - `c` char(32) AS (convert(cast(n as char), char)) PERSISTENT + `c` char(32) GENERATED ALWAYS AS (cast(cast(`n` as char charset latin1) as char charset latin1)) STORED ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; set @@session.collation_server=filename; @@ -1915,3 +1915,7 @@ drop function f1; End of 5.5 tests create table t1; ERROR 42000: A table must have at least 1 column +create table t1 (i int, j int, key(i), key(i)) as select 1 as i, 2 as j; +Warnings: +Note 1831 Duplicate index `i_2`. This is deprecated and will be disallowed in a future release +drop table t1; diff --git a/mysql-test/r/create_drop_server.result b/mysql-test/r/create_drop_server.result index 561f67dba2d..29c4fe7e123 100644 --- a/mysql-test/r/create_drop_server.result +++ b/mysql-test/r/create_drop_server.result @@ -35,3 +35,12 @@ SELECT server_name, username, db FROM mysql.servers; server_name username db server_1 mysqltest_1 test4 DROP SERVER server_1; +CREATE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'Remote', HOST 'Server.Example.Com', DATABASE 'test'); +SELECT Host FROM mysql.servers WHERE Server_Name = 'server_1'; +Host +server.example.com +ALTER SERVER server_1 OPTIONS(HOST 'Server.Example.Org'); +SELECT Host FROM mysql.servers WHERE Server_Name = 'server_1'; +Host +server.example.org +DROP SERVER server_1; diff --git a/mysql-test/r/create_drop_view.result b/mysql-test/r/create_drop_view.result index a822c16ae3c..0ec337b9b25 100644 --- a/mysql-test/r/create_drop_view.result +++ b/mysql-test/r/create_drop_view.result @@ -16,22 +16,22 @@ CREATE VIEW v1 AS SELECT * FROM t1 WHERE id>11; ERROR 42S01: Table 'v1' already exists SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1'; VIEW_DEFINITION -select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`id` > 10) +select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`id` > 10 CREATE VIEW IF NOT EXISTS v1 AS SELECT * FROM t1 WHERE id>12; Warnings: Note 1050 Table 'v1' already exists SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1'; VIEW_DEFINITION -select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`id` > 10) +select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`id` > 10 CREATE OR REPLACE VIEW IF NOT EXISTS v1 AS SELECT * FROM t1 WHERE id>13; ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1'; VIEW_DEFINITION -select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`id` > 10) +select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`id` > 10 CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1 WHERE id>14; SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1'; VIEW_DEFINITION -select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`id` > 14) +select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`id` > 14 INSERT INTO t1 VALUES (50), (80), (3), (2), (40); SELECT * FROM t1; id diff --git a/mysql-test/r/create_or_replace.result b/mysql-test/r/create_or_replace.result index 3f768535bdf..3d9b29ffe27 100644 --- a/mysql-test/r/create_or_replace.result +++ b/mysql-test/r/create_or_replace.result @@ -447,3 +447,14 @@ disconnect con1; connection default; drop table t1; DROP TABLE t2; +# +# MDEV-10824 - Crash in CREATE OR REPLACE TABLE t1 AS SELECT spfunc() +# +CREATE TABLE t1(a INT); +CREATE FUNCTION f1() RETURNS VARCHAR(16383) RETURN 'test'; +CREATE OR REPLACE TABLE t1 AS SELECT f1(); +LOCK TABLE t1 WRITE; +CREATE OR REPLACE TABLE t1 AS SELECT f1(); +UNLOCK TABLES; +DROP FUNCTION f1; +DROP TABLE t1; diff --git a/mysql-test/r/create_w_max_indexes_64.result b/mysql-test/r/create_w_max_indexes_64.result index 050af6a37ad..c937f3af312 100644 --- a/mysql-test/r/create_w_max_indexes_64.result +++ b/mysql-test/r/create_w_max_indexes_64.result @@ -131,69 +131,69 @@ key a064_long_123456789_123456789_123456789_123456789_123456789_1234 ( c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16) ); Warnings: -Note 1831 Duplicate index 'a002_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a003_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a004_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a005_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a006_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a007_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a008_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a009_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a010_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a011_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a012_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a013_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a014_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a015_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a016_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a017_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a018_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a019_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a020_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a021_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a022_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a023_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a024_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a025_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a026_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a027_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a028_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a029_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a030_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a031_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a032_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a033_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a034_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a035_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a036_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a037_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a038_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a039_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a040_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a041_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a042_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a043_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a044_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a045_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a046_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a047_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a048_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a049_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a050_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a051_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a052_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a053_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a054_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a055_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a056_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a057_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a058_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a059_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a060_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a061_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a062_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a063_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a064_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a002_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a003_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a004_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a005_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a006_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a007_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a008_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a009_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a010_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a011_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a012_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a013_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a014_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a015_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a016_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a017_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a018_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a019_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a020_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a021_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a022_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a023_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a024_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a025_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a026_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a027_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a028_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a029_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a030_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a031_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a032_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a033_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a034_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a035_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a036_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a037_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a038_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a039_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a040_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a041_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a042_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a043_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a044_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a045_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a046_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a047_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a048_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a049_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a050_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a051_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a052_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a053_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a054_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a055_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a056_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a057_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a058_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a059_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a060_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a061_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a062_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a063_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a064_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -496,69 +496,69 @@ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), add key a064_long_123456789_123456789_123456789_123456789_123456789_1234 ( c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16); Warnings: -Note 1831 Duplicate index 'a002_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a003_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a004_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a005_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a006_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a007_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a008_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a009_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a010_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a011_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a012_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a013_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a014_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a015_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a016_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a017_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a018_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a019_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a020_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a021_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a022_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a023_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a024_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a025_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a026_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a027_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a028_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a029_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a030_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a031_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a032_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a033_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a034_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a035_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a036_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a037_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a038_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a039_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a040_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a041_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a042_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a043_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a044_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a045_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a046_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a047_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a048_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a049_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a050_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a051_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a052_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a053_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a054_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a055_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a056_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a057_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a058_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a059_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a060_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a061_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a062_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a063_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a064_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a002_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a003_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a004_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a005_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a006_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a007_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a008_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a009_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a010_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a011_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a012_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a013_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a014_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a015_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a016_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a017_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a018_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a019_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a020_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a021_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a022_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a023_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a024_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a025_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a026_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a027_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a028_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a029_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a030_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a031_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a032_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a033_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a034_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a035_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a036_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a037_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a038_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a039_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a040_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a041_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a042_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a043_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a044_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a045_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a046_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a047_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a048_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a049_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a050_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a051_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a052_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a053_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a054_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a055_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a056_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a057_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a058_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a059_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a060_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a061_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a062_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a063_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a064_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release show create table t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/r/cte_nonrecursive.result b/mysql-test/r/cte_nonrecursive.result index 616b2151bb7..71bf617df0a 100644 --- a/mysql-test/r/cte_nonrecursive.result +++ b/mysql-test/r/cte_nonrecursive.result @@ -569,7 +569,7 @@ with t as (select a from t1 where b >= 'c') select * from t2,t where t2.c=t.a; show create view v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `t1`.`a` AS `a` from `t1` where (`t1`.`b` >= 'c'))select `t2`.`c` AS `c`,`t`.`a` AS `a` from (`t2` join `t`) where (`t2`.`c` = `t`.`a`) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `t1`.`a` AS `a` from `t1` where `t1`.`b` >= 'c')select `t2`.`c` AS `c`,`t`.`a` AS `a` from (`t2` join `t`) where `t2`.`c` = `t`.`a` latin1 latin1_swedish_ci select * from v1; c a 4 4 @@ -586,7 +586,7 @@ with t as (select a, count(*) from t1 where b >= 'c' group by a) select * from t2,t where t2.c=t.a; show create view v2; View Create View character_set_client collation_connection -v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS with t as (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` where (`t1`.`b` >= 'c') group by `t1`.`a`)select `t2`.`c` AS `c`,`t`.`a` AS `a`,`t`.`count(*)` AS `count(*)` from (`t2` join `t`) where (`t2`.`c` = `t`.`a`) latin1 latin1_swedish_ci +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS with t as (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` where `t1`.`b` >= 'c' group by `t1`.`a`)select `t2`.`c` AS `c`,`t`.`a` AS `a`,`t`.`count(*)` AS `count(*)` from (`t2` join `t`) where `t2`.`c` = `t`.`a` latin1 latin1_swedish_ci select * from v2; c a count(*) 4 4 2 @@ -604,7 +604,7 @@ with t(c) as (select a from t1 where b >= 'c') select * from t r1 where r1.c=4; show create view v3; View Create View character_set_client collation_connection -v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS with t as (select `t1`.`a` AS `c` from `t1` where (`t1`.`b` >= 'c'))select `r1`.`c` AS `c` from `t` `r1` where (`r1`.`c` = 4) latin1 latin1_swedish_ci +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS with t as (select `t1`.`a` AS `c` from `t1` where `t1`.`b` >= 'c')select `r1`.`c` AS `c` from `t` `r1` where `r1`.`c` = 4 latin1 latin1_swedish_ci select * from v3; c 4 @@ -616,7 +616,7 @@ with t(c) as (select a from t1 where b >= 'c') select * from t r1, t r2 where r1.c=r2.c and r2.c=4; show create view v4; View Create View character_set_client collation_connection -v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS with t as (select `t1`.`a` AS `c` from `t1` where (`t1`.`b` >= 'c'))select `r1`.`c` AS `c`,`r2`.`c` AS `d` from (`t` `r1` join `t` `r2`) where ((`r1`.`c` = `r2`.`c`) and (`r2`.`c` = 4)) latin1 latin1_swedish_ci +v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS with t as (select `t1`.`a` AS `c` from `t1` where `t1`.`b` >= 'c')select `r1`.`c` AS `c`,`r2`.`c` AS `d` from (`t` `r1` join `t` `r2`) where `r1`.`c` = `r2`.`c` and `r2`.`c` = 4 latin1 latin1_swedish_ci select * from v4; c d 4 4 diff --git a/mysql-test/r/cte_recursive.result b/mysql-test/r/cte_recursive.result index f22370870c2..0cc88d27e23 100644 --- a/mysql-test/r/cte_recursive.result +++ b/mysql-test/r/cte_recursive.result @@ -699,7 +699,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL 2 UNCACHEABLE SUBQUERY ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 with recursive ancestor_couple_ids as (select `a`.`father` AS `h_id`,`a`.`mother` AS `w_id` from `coupled_ancestors` `a` where ((`a`.`father` is not null) and (`a`.`mother` is not null)))coupled_ancestors as (select `test`.`folks`.`id` AS `id`,`test`.`folks`.`name` AS `name`,`test`.`folks`.`dob` AS `dob`,`test`.`folks`.`father` AS `father`,`test`.`folks`.`mother` AS `mother` from `test`.`folks` where (`test`.`folks`.`name` = 'Me') union all select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `fa` where (`test`.`p`.`id` = `fa`.`h_id`) union all select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `ma` where (`test`.`p`.`id` = `ma`.`w_id`)), select `h`.`name` AS `name`,`h`.`dob` AS `dob`,`w`.`name` AS `name`,`w`.`dob` AS `dob` from `ancestor_couple_ids` `c` join `coupled_ancestors` `h` join `coupled_ancestors` `w` where ((`h`.`id` = `c`.`h_id`) and (`w`.`id` = `c`.`w_id`)) +Note 1003 with recursive ancestor_couple_ids as (select `a`.`father` AS `h_id`,`a`.`mother` AS `w_id` from `coupled_ancestors` `a` where `a`.`father` is not null and `a`.`mother` is not null)coupled_ancestors as (select `test`.`folks`.`id` AS `id`,`test`.`folks`.`name` AS `name`,`test`.`folks`.`dob` AS `dob`,`test`.`folks`.`father` AS `father`,`test`.`folks`.`mother` AS `mother` from `test`.`folks` where `test`.`folks`.`name` = 'Me' union all select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `fa` where `test`.`p`.`id` = `fa`.`h_id` union all select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `ma` where `test`.`p`.`id` = `ma`.`w_id`), select `h`.`name` AS `name`,`h`.`dob` AS `dob`,`w`.`name` AS `name`,`w`.`dob` AS `dob` from `ancestor_couple_ids` `c` join `coupled_ancestors` `h` join `coupled_ancestors` `w` where `h`.`id` = `c`.`h_id` and `w`.`id` = `c`.`w_id` # simple mutual recursion with recursive ancestor_couple_ids(h_id, w_id) @@ -818,7 +818,7 @@ where p.id = a.father or p.id = a.mother select * from ancestors; show create view v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with recursive ancestors as (select `folks`.`id` AS `id`,`folks`.`name` AS `name`,`folks`.`dob` AS `dob`,`folks`.`father` AS `father`,`folks`.`mother` AS `mother` from `folks` where ((`folks`.`name` = 'Me') and (`folks`.`dob` = '2000-01-01')) union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`folks` `p` join `ancestors` `a`) where ((`p`.`id` = `a`.`father`) or (`p`.`id` = `a`.`mother`)))select `ancestors`.`id` AS `id`,`ancestors`.`name` AS `name`,`ancestors`.`dob` AS `dob`,`ancestors`.`father` AS `father`,`ancestors`.`mother` AS `mother` from `ancestors` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with recursive ancestors as (select `folks`.`id` AS `id`,`folks`.`name` AS `name`,`folks`.`dob` AS `dob`,`folks`.`father` AS `father`,`folks`.`mother` AS `mother` from `folks` where `folks`.`name` = 'Me' and `folks`.`dob` = '2000-01-01' union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`folks` `p` join `ancestors` `a`) where `p`.`id` = `a`.`father` or `p`.`id` = `a`.`mother`)select `ancestors`.`id` AS `id`,`ancestors`.`name` AS `name`,`ancestors`.`dob` AS `dob`,`ancestors`.`father` AS `father`,`ancestors`.`mother` AS `mother` from `ancestors` latin1 latin1_swedish_ci select * from v1; id name dob father mother 100 Me 2000-01-01 20 30 @@ -849,7 +849,7 @@ where p.id = ma.mother select * from ancestors; show create view v2; View Create View character_set_client collation_connection -v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS with recursive ancestors as (select `folks`.`id` AS `id`,`folks`.`name` AS `name`,`folks`.`dob` AS `dob`,`folks`.`father` AS `father`,`folks`.`mother` AS `mother` from `folks` where (`folks`.`name` = 'Me') union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`folks` `p` join `ancestors` `fa`) where (`p`.`id` = `fa`.`father`) union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`folks` `p` join `ancestors` `ma`) where (`p`.`id` = `ma`.`mother`))select `ancestors`.`id` AS `id`,`ancestors`.`name` AS `name`,`ancestors`.`dob` AS `dob`,`ancestors`.`father` AS `father`,`ancestors`.`mother` AS `mother` from `ancestors` latin1 latin1_swedish_ci +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS with recursive ancestors as (select `folks`.`id` AS `id`,`folks`.`name` AS `name`,`folks`.`dob` AS `dob`,`folks`.`father` AS `father`,`folks`.`mother` AS `mother` from `folks` where `folks`.`name` = 'Me' union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`folks` `p` join `ancestors` `fa`) where `p`.`id` = `fa`.`father` union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`folks` `p` join `ancestors` `ma`) where `p`.`id` = `ma`.`mother`)select `ancestors`.`id` AS `id`,`ancestors`.`name` AS `name`,`ancestors`.`dob` AS `dob`,`ancestors`.`father` AS `father`,`ancestors`.`mother` AS `mother` from `ancestors` latin1 latin1_swedish_ci select * from v2; id name dob father mother 100 Me 2000-01-01 20 30 @@ -882,7 +882,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 RECURSIVE UNION ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 with recursive ancestors as (select `test`.`folks`.`id` AS `id`,`test`.`folks`.`name` AS `name`,`test`.`folks`.`dob` AS `dob`,`test`.`folks`.`father` AS `father`,`test`.`folks`.`mother` AS `mother` from `test`.`folks` where ((`test`.`folks`.`name` = 'Me') and (`test`.`folks`.`dob` = DATE'2000-01-01')) union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestors` `a` where ((`a`.`father` = `p`.`id`) or (`a`.`mother` = `p`.`id`)))select `ancestors`.`id` AS `id`,`ancestors`.`name` AS `name`,`ancestors`.`dob` AS `dob`,`ancestors`.`father` AS `father`,`ancestors`.`mother` AS `mother` from `ancestors` +Note 1003 with recursive ancestors as (select `test`.`folks`.`id` AS `id`,`test`.`folks`.`name` AS `name`,`test`.`folks`.`dob` AS `dob`,`test`.`folks`.`father` AS `father`,`test`.`folks`.`mother` AS `mother` from `test`.`folks` where `test`.`folks`.`name` = 'Me' and `test`.`folks`.`dob` = DATE'2000-01-01' union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestors` `a` where `a`.`father` = `p`.`id` or `a`.`mother` = `p`.`id`)select `ancestors`.`id` AS `id`,`ancestors`.`name` AS `name`,`ancestors`.`dob` AS `dob`,`ancestors`.`father` AS `father`,`ancestors`.`mother` AS `mother` from `ancestors` # recursive spec with two anchor selects and two recursive ones with recursive ancestor_ids (id) @@ -1358,7 +1358,7 @@ EXPLAIN "access_type": "ALL", "rows": 12, "filtered": 100, - "attached_condition": "(folks.`name` = 'Me2')" + "attached_condition": "folks.`name` = 'Me2'" } } }, @@ -1370,7 +1370,7 @@ EXPLAIN "access_type": "ALL", "rows": 12, "filtered": 100, - "attached_condition": "(prev_gen.`id` < 345)", + "attached_condition": "prev_gen.`id` < 345", "materialized": { "query_block": { "recursive_union": { @@ -1385,7 +1385,7 @@ EXPLAIN "access_type": "ALL", "rows": 12, "filtered": 100, - "attached_condition": "(folks.`name` = 'Me')" + "attached_condition": "folks.`name` = 'Me'" } } }, @@ -1409,7 +1409,7 @@ EXPLAIN "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "((prev_gen.father = folks.`id`) or (prev_gen.mother = folks.`id`))" + "attached_condition": "prev_gen.father = folks.`id` or prev_gen.mother = folks.`id`" } } } @@ -1428,7 +1428,7 @@ EXPLAIN "access_type": "ALL", "rows": 24, "filtered": 100, - "attached_condition": "(ancestors.`id` < 234)" + "attached_condition": "ancestors.`id` < 234" } } } @@ -1489,7 +1489,7 @@ EXPLAIN "access_type": "ALL", "rows": 12, "filtered": 100, - "attached_condition": "((v.`name` = 'Me') and (v.father is not null) and (v.mother is not null))" + "attached_condition": "v.`name` = 'Me' and v.father is not null and v.mother is not null" }, "table": { "table_name": "h", @@ -1523,7 +1523,7 @@ EXPLAIN "access_type": "ALL", "rows": 2, "filtered": 100, - "attached_condition": "((a.father is not null) and (a.mother is not null))" + "attached_condition": "a.father is not null and a.mother is not null" }, "table": { "table_name": "h", @@ -1766,7 +1766,7 @@ EXPLAIN "access_type": "ALL", "rows": 10, "filtered": 100, - "attached_condition": "(t.a < 1000)" + "attached_condition": "t.a < 1000" } } } @@ -1836,3 +1836,494 @@ id select_type table type possible_keys key key_len ref rows Extra 4 RECURSIVE UNION t2 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) NULL UNION RESULT ALL NULL NULL NULL NULL NULL drop table t1,t2; +# +# MDEV-11278: non-mergeable view in the spec of recursive CTE +# +create table t1 (a int); +insert into t1 values +(0), (1), (2), (3), (4); +create table t2 (a int); +insert into t2 values +(1), (2), (3), (4), (5); +create view v1 as +select a from t2 where a < 3 +union +select a from t2 where a > 4; +with recursive +t1 as +( +select a from v1 where a=1 +union +select v1.a from t1,v1 where t1.a+1=v1.a +) +select * from t1; +a +1 +2 +drop view v1; +drop table t1,t2; +# +# MDEV-11259: recursive CTE with concatenation operation +# +DROP TABLE IF EXISTS edges; +Warnings: +Note 1051 Unknown table 'test.edges' +CREATE TABLE edges( +a int(10) unsigned NOT NULL, +b int(10) unsigned NOT NULL, +PRIMARY KEY (a,b), +KEY b(b) +); +INSERT INTO edges +VALUES (1,3),(2,1),(2,4),(3,4),(3,5),(3,6),(4,7),(5,1),(5,6),(6,1); +DROP TABLE IF EXISTS edges2; +Warnings: +Note 1051 Unknown table 'test.edges2' +CREATE VIEW edges2 (a, b) AS +SELECT a, b FROM edges UNION ALL SELECT b, a FROM edges; +WITH RECURSIVE transitive_closure(a, b, distance, path_string) AS +( SELECT a, b, 1 AS distance, +concat(a, '.', b, '.') AS path_string +FROM edges +UNION ALL +SELECT tc.a, e.b, tc.distance + 1, +concat(tc.path_string, e.b, '.') AS path_string +FROM edges AS e +JOIN transitive_closure AS tc +ON e.a = tc.b +WHERE tc.path_string NOT LIKE concat('%', e.b, '.%') +) +SELECT * FROM transitive_closure +ORDER BY a, b, distance; +a b distance path_string +1 3 1 1.3. +1 4 2 1.3.4. +1 5 2 1.3.5. +1 6 2 1.3.6. +1 6 3 1.3.5.6. +1 7 3 1.3.4.7. +2 1 1 2.1. +2 3 2 2.1.3. +2 4 1 2.4. +2 4 3 2.1.3.4. +2 5 3 2.1.3.5. +2 6 3 2.1.3.6. +2 6 4 2.1.3.5.6. +2 7 2 2.4.7. +2 7 4 2.1.3.4.7. +3 1 2 3.5.1. +3 1 2 3.6.1. +3 1 3 3.5.6.1. +3 4 1 3.4. +3 5 1 3.5. +3 6 1 3.6. +3 6 2 3.5.6. +3 7 2 3.4.7. +4 7 1 4.7. +5 1 1 5.1. +5 1 2 5.6.1. +5 3 2 5.1.3. +5 3 3 5.6.1.3. +5 4 3 5.1.3.4. +5 4 4 5.6.1.3.4. +5 6 1 5.6. +5 6 3 5.1.3.6. +5 7 4 5.1.3.4.7. +5 7 5 5.6.1.3.4.7. +6 1 1 6.1. +6 3 2 6.1.3. +6 4 3 6.1.3.4. +6 5 3 6.1.3.5. +6 7 4 6.1.3.4.7. +WITH RECURSIVE transitive_closure(a, b, distance, path_string) AS +( SELECT a, b, 1 AS distance, +concat(a, '.', b, '.') AS path_string +FROM edges +WHERE a = 1 -- source +UNION ALL +SELECT tc.a, e.b, tc.distance + 1, +concat(tc.path_string, e.b, '.') AS path_string +FROM edges AS e +JOIN transitive_closure AS tc ON e.a = tc.b +WHERE tc.path_string NOT LIKE concat('%', e.b, '.%') +) +SELECT * FROM transitive_closure +WHERE b = 6 -- destination +ORDER BY a, b, distance; +a b distance path_string +1 6 2 1.3.6. +1 6 3 1.3.5.6. +WITH RECURSIVE transitive_closure(a, b, distance, path_string) AS +( SELECT a, b, 1 AS distance, +concat(a, '.', b, '.') AS path_string +FROM edges2 +UNION ALL +SELECT tc.a, e.b, tc.distance + 1, +concat(tc.path_string, e.b, '.') AS path_string +FROM edges2 AS e +JOIN transitive_closure AS tc ON e.a = tc.b +WHERE tc.path_string NOT LIKE concat('%', e.b, '.%') +) +SELECT * FROM transitive_closure +ORDER BY a, b, distance; +a b distance path_string +1 2 1 1.2. +1 2 3 1.3.4.2. +1 2 4 1.5.3.4.2. +1 2 4 1.6.3.4.2. +1 2 5 1.5.6.3.4.2. +1 2 5 1.6.5.3.4.2. +1 3 1 1.3. +1 3 2 1.5.3. +1 3 2 1.6.3. +1 3 3 1.2.4.3. +1 3 3 1.5.6.3. +1 3 3 1.6.5.3. +1 4 2 1.2.4. +1 4 2 1.3.4. +1 4 3 1.5.3.4. +1 4 3 1.6.3.4. +1 4 4 1.5.6.3.4. +1 4 4 1.6.5.3.4. +1 5 1 1.5. +1 5 2 1.3.5. +1 5 2 1.6.5. +1 5 3 1.3.6.5. +1 5 3 1.6.3.5. +1 5 4 1.2.4.3.5. +1 5 5 1.2.4.3.6.5. +1 6 1 1.6. +1 6 2 1.3.6. +1 6 2 1.5.6. +1 6 3 1.3.5.6. +1 6 3 1.5.3.6. +1 6 4 1.2.4.3.6. +1 6 5 1.2.4.3.5.6. +1 7 3 1.2.4.7. +1 7 3 1.3.4.7. +1 7 4 1.5.3.4.7. +1 7 4 1.6.3.4.7. +1 7 5 1.5.6.3.4.7. +1 7 5 1.6.5.3.4.7. +2 1 1 2.1. +2 1 3 2.4.3.1. +2 1 4 2.4.3.5.1. +2 1 4 2.4.3.6.1. +2 1 5 2.4.3.5.6.1. +2 1 5 2.4.3.6.5.1. +2 3 2 2.1.3. +2 3 2 2.4.3. +2 3 3 2.1.5.3. +2 3 3 2.1.6.3. +2 3 4 2.1.5.6.3. +2 3 4 2.1.6.5.3. +2 4 1 2.4. +2 4 3 2.1.3.4. +2 4 4 2.1.5.3.4. +2 4 4 2.1.6.3.4. +2 4 5 2.1.5.6.3.4. +2 4 5 2.1.6.5.3.4. +2 5 2 2.1.5. +2 5 3 2.1.3.5. +2 5 3 2.1.6.5. +2 5 3 2.4.3.5. +2 5 4 2.1.3.6.5. +2 5 4 2.1.6.3.5. +2 5 4 2.4.3.1.5. +2 5 4 2.4.3.6.5. +2 5 5 2.4.3.1.6.5. +2 5 5 2.4.3.6.1.5. +2 6 2 2.1.6. +2 6 3 2.1.3.6. +2 6 3 2.1.5.6. +2 6 3 2.4.3.6. +2 6 4 2.1.3.5.6. +2 6 4 2.1.5.3.6. +2 6 4 2.4.3.1.6. +2 6 4 2.4.3.5.6. +2 6 5 2.4.3.1.5.6. +2 6 5 2.4.3.5.1.6. +2 7 2 2.4.7. +2 7 4 2.1.3.4.7. +2 7 5 2.1.5.3.4.7. +2 7 5 2.1.6.3.4.7. +2 7 6 2.1.5.6.3.4.7. +2 7 6 2.1.6.5.3.4.7. +3 1 1 3.1. +3 1 2 3.5.1. +3 1 2 3.6.1. +3 1 3 3.4.2.1. +3 1 3 3.5.6.1. +3 1 3 3.6.5.1. +3 2 2 3.1.2. +3 2 2 3.4.2. +3 2 3 3.5.1.2. +3 2 3 3.6.1.2. +3 2 4 3.5.6.1.2. +3 2 4 3.6.5.1.2. +3 4 1 3.4. +3 4 3 3.1.2.4. +3 4 4 3.5.1.2.4. +3 4 4 3.6.1.2.4. +3 4 5 3.5.6.1.2.4. +3 4 5 3.6.5.1.2.4. +3 5 1 3.5. +3 5 2 3.1.5. +3 5 2 3.6.5. +3 5 3 3.1.6.5. +3 5 3 3.6.1.5. +3 5 4 3.4.2.1.5. +3 5 5 3.4.2.1.6.5. +3 6 1 3.6. +3 6 2 3.1.6. +3 6 2 3.5.6. +3 6 3 3.1.5.6. +3 6 3 3.5.1.6. +3 6 4 3.4.2.1.6. +3 6 5 3.4.2.1.5.6. +3 7 2 3.4.7. +3 7 4 3.1.2.4.7. +3 7 5 3.5.1.2.4.7. +3 7 5 3.6.1.2.4.7. +3 7 6 3.5.6.1.2.4.7. +3 7 6 3.6.5.1.2.4.7. +4 1 2 4.2.1. +4 1 2 4.3.1. +4 1 3 4.3.5.1. +4 1 3 4.3.6.1. +4 1 4 4.3.5.6.1. +4 1 4 4.3.6.5.1. +4 2 1 4.2. +4 2 3 4.3.1.2. +4 2 4 4.3.5.1.2. +4 2 4 4.3.6.1.2. +4 2 5 4.3.5.6.1.2. +4 2 5 4.3.6.5.1.2. +4 3 1 4.3. +4 3 3 4.2.1.3. +4 3 4 4.2.1.5.3. +4 3 4 4.2.1.6.3. +4 3 5 4.2.1.5.6.3. +4 3 5 4.2.1.6.5.3. +4 5 2 4.3.5. +4 5 3 4.2.1.5. +4 5 3 4.3.1.5. +4 5 3 4.3.6.5. +4 5 4 4.2.1.3.5. +4 5 4 4.2.1.6.5. +4 5 4 4.3.1.6.5. +4 5 4 4.3.6.1.5. +4 5 5 4.2.1.3.6.5. +4 5 5 4.2.1.6.3.5. +4 6 2 4.3.6. +4 6 3 4.2.1.6. +4 6 3 4.3.1.6. +4 6 3 4.3.5.6. +4 6 4 4.2.1.3.6. +4 6 4 4.2.1.5.6. +4 6 4 4.3.1.5.6. +4 6 4 4.3.5.1.6. +4 6 5 4.2.1.3.5.6. +4 6 5 4.2.1.5.3.6. +4 7 1 4.7. +5 1 1 5.1. +5 1 2 5.3.1. +5 1 2 5.6.1. +5 1 3 5.3.6.1. +5 1 3 5.6.3.1. +5 1 4 5.3.4.2.1. +5 1 5 5.6.3.4.2.1. +5 2 2 5.1.2. +5 2 3 5.3.1.2. +5 2 3 5.3.4.2. +5 2 3 5.6.1.2. +5 2 4 5.1.3.4.2. +5 2 4 5.3.6.1.2. +5 2 4 5.6.3.1.2. +5 2 4 5.6.3.4.2. +5 2 5 5.1.6.3.4.2. +5 2 5 5.6.1.3.4.2. +5 3 1 5.3. +5 3 2 5.1.3. +5 3 2 5.6.3. +5 3 3 5.1.6.3. +5 3 3 5.6.1.3. +5 3 4 5.1.2.4.3. +5 3 5 5.6.1.2.4.3. +5 4 2 5.3.4. +5 4 3 5.1.2.4. +5 4 3 5.1.3.4. +5 4 3 5.6.3.4. +5 4 4 5.1.6.3.4. +5 4 4 5.3.1.2.4. +5 4 4 5.6.1.2.4. +5 4 4 5.6.1.3.4. +5 4 5 5.3.6.1.2.4. +5 4 5 5.6.3.1.2.4. +5 6 1 5.6. +5 6 2 5.1.6. +5 6 2 5.3.6. +5 6 3 5.1.3.6. +5 6 3 5.3.1.6. +5 6 5 5.1.2.4.3.6. +5 6 5 5.3.4.2.1.6. +5 7 3 5.3.4.7. +5 7 4 5.1.2.4.7. +5 7 4 5.1.3.4.7. +5 7 4 5.6.3.4.7. +5 7 5 5.1.6.3.4.7. +5 7 5 5.3.1.2.4.7. +5 7 5 5.6.1.2.4.7. +5 7 5 5.6.1.3.4.7. +5 7 6 5.3.6.1.2.4.7. +5 7 6 5.6.3.1.2.4.7. +6 1 1 6.1. +6 1 2 6.3.1. +6 1 2 6.5.1. +6 1 3 6.3.5.1. +6 1 3 6.5.3.1. +6 1 4 6.3.4.2.1. +6 1 5 6.5.3.4.2.1. +6 2 2 6.1.2. +6 2 3 6.3.1.2. +6 2 3 6.3.4.2. +6 2 3 6.5.1.2. +6 2 4 6.1.3.4.2. +6 2 4 6.3.5.1.2. +6 2 4 6.5.3.1.2. +6 2 4 6.5.3.4.2. +6 2 5 6.1.5.3.4.2. +6 2 5 6.5.1.3.4.2. +6 3 1 6.3. +6 3 2 6.1.3. +6 3 2 6.5.3. +6 3 3 6.1.5.3. +6 3 3 6.5.1.3. +6 3 4 6.1.2.4.3. +6 3 5 6.5.1.2.4.3. +6 4 2 6.3.4. +6 4 3 6.1.2.4. +6 4 3 6.1.3.4. +6 4 3 6.5.3.4. +6 4 4 6.1.5.3.4. +6 4 4 6.3.1.2.4. +6 4 4 6.5.1.2.4. +6 4 4 6.5.1.3.4. +6 4 5 6.3.5.1.2.4. +6 4 5 6.5.3.1.2.4. +6 5 1 6.5. +6 5 2 6.1.5. +6 5 2 6.3.5. +6 5 3 6.1.3.5. +6 5 3 6.3.1.5. +6 5 5 6.1.2.4.3.5. +6 5 5 6.3.4.2.1.5. +6 7 3 6.3.4.7. +6 7 4 6.1.2.4.7. +6 7 4 6.1.3.4.7. +6 7 4 6.5.3.4.7. +6 7 5 6.1.5.3.4.7. +6 7 5 6.3.1.2.4.7. +6 7 5 6.5.1.2.4.7. +6 7 5 6.5.1.3.4.7. +6 7 6 6.3.5.1.2.4.7. +6 7 6 6.5.3.1.2.4.7. +7 1 3 7.4.2.1. +7 1 3 7.4.3.1. +7 1 4 7.4.3.5.1. +7 1 4 7.4.3.6.1. +7 1 5 7.4.3.5.6.1. +7 1 5 7.4.3.6.5.1. +7 2 2 7.4.2. +7 2 4 7.4.3.1.2. +7 2 5 7.4.3.5.1.2. +7 2 5 7.4.3.6.1.2. +7 2 6 7.4.3.5.6.1.2. +7 2 6 7.4.3.6.5.1.2. +7 3 2 7.4.3. +7 3 4 7.4.2.1.3. +7 3 5 7.4.2.1.5.3. +7 3 5 7.4.2.1.6.3. +7 3 6 7.4.2.1.5.6.3. +7 3 6 7.4.2.1.6.5.3. +7 4 1 7.4. +7 5 3 7.4.3.5. +7 5 4 7.4.2.1.5. +7 5 4 7.4.3.1.5. +7 5 4 7.4.3.6.5. +7 5 5 7.4.2.1.3.5. +7 5 5 7.4.2.1.6.5. +7 5 5 7.4.3.1.6.5. +7 5 5 7.4.3.6.1.5. +7 5 6 7.4.2.1.3.6.5. +7 5 6 7.4.2.1.6.3.5. +7 6 3 7.4.3.6. +7 6 4 7.4.2.1.6. +7 6 4 7.4.3.1.6. +7 6 4 7.4.3.5.6. +7 6 5 7.4.2.1.3.6. +7 6 5 7.4.2.1.5.6. +7 6 5 7.4.3.1.5.6. +7 6 5 7.4.3.5.1.6. +7 6 6 7.4.2.1.3.5.6. +7 6 6 7.4.2.1.5.3.6. +WITH RECURSIVE transitive_closure(a, b, distance, path_string) +AS +( SELECT a, b, 1 AS distance, +concat(a, '.', b, '.') AS path_string +FROM edges2 +UNION ALL +SELECT tc.a, e.b, tc.distance + 1, +concat(tc.path_string, e.b, '.') AS path_string +FROM edges2 AS e +JOIN transitive_closure AS tc ON e.a = tc.b +WHERE tc.path_string NOT LIKE concat('%', e.b, '.%') +) +SELECT a, b, min(distance) AS dist FROM transitive_closure +GROUP BY a, b +ORDER BY a, dist, b; +a b dist +1 2 1 +1 3 1 +1 4 2 +1 5 1 +1 6 1 +1 7 3 +2 1 1 +2 3 2 +2 4 1 +2 5 2 +2 6 2 +2 7 2 +3 1 1 +3 2 2 +3 4 1 +3 5 1 +3 6 1 +3 7 2 +4 1 2 +4 2 1 +4 3 1 +4 5 2 +4 6 2 +4 7 1 +5 1 1 +5 2 2 +5 3 1 +5 4 2 +5 6 1 +5 7 3 +6 1 1 +6 2 2 +6 3 1 +6 4 2 +6 5 1 +6 7 3 +7 1 3 +7 2 2 +7 3 2 +7 4 1 +7 5 3 +7 6 3 +DROP VIEW edges2; +DROP TABLE edges; diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result index e7c40b5ed91..7fefa5754c3 100644 --- a/mysql-test/r/ctype_binary.result +++ b/mysql-test/r/ctype_binary.result @@ -2869,11 +2869,11 @@ NULL id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Level Code Message -Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()` +Note 1003 select v_LastPaymentDate@0 < current_timestamp() AS `v_LastPaymentDate < NOW()` id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select concat(v_LastPaymentDate@0,now()) AS `CONCAT(v_LastPaymentDate, NOW())` +Note 1003 select concat(v_LastPaymentDate@0,current_timestamp()) AS `CONCAT(v_LastPaymentDate, NOW())` DROP PROCEDURE p1; # # Bug#52159 returning time type from function and empty left join causes debug assertion @@ -3014,7 +3014,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ('%' = concat(`test`.`t1`.`c1`)) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) DROP TABLE t1; # # MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' @@ -3036,7 +3036,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where (`test`.`t1`.`a` = 'a') +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' DROP TABLE t1; # # End of MDEV-8694 @@ -3069,7 +3069,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)= id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)`,crc32(`test`.`t1`.`a`) AS `CRC32(a)` from `test`.`t1` where (`test`.`t1`.`a` = 'a') +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)`,crc32(`test`.`t1`.`a`) AS `CRC32(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' SELECT a, HEX(a) FROM t1 WHERE HEX(a)='61'; a HEX(a) a 61 @@ -3081,7 +3081,7 @@ EXPLAIN EXTENDED SELECT *,HEX(a) FROM t1 WHERE a='a' AND HEX(a)='61'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,hex(`test`.`t1`.`a`) AS `HEX(a)` from `test`.`t1` where (`test`.`t1`.`a` = 'a') +Note 1003 select `test`.`t1`.`a` AS `a`,hex(`test`.`t1`.`a`) AS `HEX(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' SELECT * FROM t1 WHERE a='a'; a a @@ -3107,7 +3107,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a ' AND LENGTH(a)=2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a ') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a ' DROP TABLE t1; # # MDEV-8723 Wrong result for SELECT..WHERE COLLATION(a)='binary' AND a='a' @@ -3130,22 +3130,22 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE COLLATION(a)='binary' AND a='a'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' EXPLAIN EXTENDED SELECT * FROM t1 WHERE CHARSET(a)='binary' AND a='a'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' EXPLAIN EXTENDED SELECT * FROM t1 WHERE COERCIBILITY(a)=2 AND a='a'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' EXPLAIN EXTENDED SELECT * FROM t1 WHERE WEIGHT_STRING(a)='a' AND a='a'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (weight_string(`test`.`t1`.`a`) = 'a')) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and weight_string(`test`.`t1`.`a`,0,0,1) = 'a' DROP TABLE t1; # # End of 10.1 tests diff --git a/mysql-test/r/ctype_collate.result b/mysql-test/r/ctype_collate.result index 8ddc4e9a80a..3cc405937ae 100644 --- a/mysql-test/r/ctype_collate.result +++ b/mysql-test/r/ctype_collate.result @@ -519,7 +519,7 @@ explain extended SELECT charset('a'),collation('a'),coercibility('a'),'a'='A'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select charset('a') AS `charset('a')`,collation('a') AS `collation('a')`,coercibility('a') AS `coercibility('a')`,('a' = 'A') AS `'a'='A'` +Note 1003 select charset('a') AS `charset('a')`,collation('a') AS `collation('a')`,coercibility('a') AS `coercibility('a')`,'a' = 'A' AS `'a'='A'` SET CHARACTER SET koi8r; SHOW VARIABLES LIKE 'collation_client'; Variable_name Value diff --git a/mysql-test/r/ctype_cp1250_ch.result b/mysql-test/r/ctype_cp1250_ch.result index 69253250a53..173fcccb873 100644 --- a/mysql-test/r/ctype_cp1250_ch.result +++ b/mysql-test/r/ctype_cp1250_ch.result @@ -129,7 +129,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a ')) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -152,7 +152,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -175,7 +175,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -198,7 +198,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; # # MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' @@ -220,7 +220,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((not((`test`.`t1`.`a` like 'a '))) and (`test`.`t1`.`a` = 'a')) +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` not like 'a ' and `test`.`t1`.`a` = 'a' DROP TABLE t1; # # End of MDEV-8694 diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result index 36dc23f33be..8902a30934f 100644 --- a/mysql-test/r/ctype_cp1251.result +++ b/mysql-test/r/ctype_cp1251.result @@ -3278,11 +3278,11 @@ NULL id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Level Code Message -Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()` +Note 1003 select v_LastPaymentDate@0 < current_timestamp() AS `v_LastPaymentDate < NOW()` id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select concat(convert(v_LastPaymentDate@0 using cp1251),now()) AS `CONCAT(v_LastPaymentDate, NOW())` +Note 1003 select concat(convert(v_LastPaymentDate@0 using cp1251),current_timestamp()) AS `CONCAT(v_LastPaymentDate, NOW())` DROP PROCEDURE p1; # # Bug#52159 returning time type from function and empty left join causes debug assertion @@ -3385,12 +3385,12 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,3) AND a=' 1'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = ' 1') and (`test`.`t1`.`a` in (1,2,3))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = ' 1' and `test`.`t1`.`a` in (1,2,3) EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,3,'x') AND a=' 1'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = ' 1') and (`test`.`t1`.`a` in (1,2,3,'x'))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = ' 1' and `test`.`t1`.`a` in (1,2,3,'x') DROP TABLE t1; # # MDEV-8671 Wrong result for SELECT..WHERE varchar_column=' 1' AND (varchar_column XOR '1') @@ -3416,7 +3416,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=' 1' AND (a XOR '0'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = ' 1') and (`test`.`t1`.`a` xor '0')) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = ' 1' and (`test`.`t1`.`a` xor '0') DROP TABLE t1; # # End of 10.1 tests diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result index 5ed8e9e8868..ddd2ecdbd95 100644 --- a/mysql-test/r/ctype_latin1.result +++ b/mysql-test/r/ctype_latin1.result @@ -3575,11 +3575,11 @@ NULL id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Level Code Message -Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()` +Note 1003 select v_LastPaymentDate@0 < current_timestamp() AS `v_LastPaymentDate < NOW()` id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select concat(v_LastPaymentDate@0,now()) AS `CONCAT(v_LastPaymentDate, NOW())` +Note 1003 select concat(v_LastPaymentDate@0,current_timestamp()) AS `CONCAT(v_LastPaymentDate, NOW())` DROP PROCEDURE p1; # # Bug#52159 returning time type from function and empty left join causes debug assertion @@ -7723,7 +7723,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a ')) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -7746,7 +7746,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -7769,7 +7769,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -7792,7 +7792,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; # # MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' @@ -7814,7 +7814,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a ')))) +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a ' DROP TABLE t1; # # End of MDEV-8694 @@ -7844,7 +7844,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a ')) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -7867,7 +7867,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -7890,7 +7890,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -7913,7 +7913,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; # # MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' @@ -7935,7 +7935,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a ')))) +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a ' DROP TABLE t1; # # End of MDEV-8694 @@ -8032,12 +8032,12 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='10' AND IF(a='10',1,0)=1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = '10') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '10' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='10' AND CASE WHEN a='10' THEN 1 ELSE 0 END; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = '10') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '10' DROP TABLE t1; # # MDEV-8680 Wrong result for SELECT..WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a' @@ -8055,7 +8055,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b') AND a= id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (`test`.`t1`.`a` in ((('a' collate latin1_bin)),'b'))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` in (('a' collate latin1_bin),'b') DROP TABLE t1; # # MDEV-8698 Wrong result for SELECT..WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin; @@ -8075,7 +8075,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 6 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (`test`.`t1`.`a` between 'a' and (('c' collate latin1_bin)))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` between 'a' and ('c' collate latin1_bin) DROP TABLE t1; # # MDEV-8707 Wrong result for SELECT..WHERE varchar_column=DATE'2001-01-01' AND varchar_column='2001-01-01' @@ -8157,7 +8157,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)= id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)`,crc32(`test`.`t1`.`a`) AS `CRC32(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (crc32(`test`.`t1`.`a`) = 3904355907)) +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)`,crc32(`test`.`t1`.`a`) AS `CRC32(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and crc32(`test`.`t1`.`a`) = 3904355907 SELECT a, HEX(a) FROM t1 WHERE HEX(a)='61'; a HEX(a) a 61 @@ -8169,7 +8169,7 @@ EXPLAIN EXTENDED SELECT *,HEX(a) FROM t1 WHERE a='a' AND HEX(a)='61'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,hex(`test`.`t1`.`a`) AS `HEX(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (hex(`test`.`t1`.`a`) = '61')) +Note 1003 select `test`.`t1`.`a` AS `a`,hex(`test`.`t1`.`a`) AS `HEX(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and hex(`test`.`t1`.`a`) = '61' SELECT * FROM t1 WHERE a='a'; a a @@ -8185,7 +8185,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND LENGTH(a)=2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (length(`test`.`t1`.`a`) = 2)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and length(`test`.`t1`.`a`) = 2 DROP TABLE t1; # # MDEV-8712 Wrong result for SELECT..WHERE latin1_bin_column=_latin1'a' AND latin1_bin_column='A' @@ -8217,7 +8217,7 @@ SELECT * FROM t1 WHERE COALESCE(c,0)='3 ' AND COALESCE(d,0)=COALESCE(c,0); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` where ((coalesce(`test`.`t1`.`c`,0) = '3 ') and (coalesce(`test`.`t1`.`d`,0) = '3 ')) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` where coalesce(`test`.`t1`.`c`,0) = '3 ' and coalesce(`test`.`t1`.`d`,0) = '3 ' DROP TABLE t1; # # End of 10.1 tests diff --git a/mysql-test/r/ctype_latin2_ch.result b/mysql-test/r/ctype_latin2_ch.result index 2ec8351cd69..e559689fdd0 100644 --- a/mysql-test/r/ctype_latin2_ch.result +++ b/mysql-test/r/ctype_latin2_ch.result @@ -69,7 +69,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a ')) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -92,7 +92,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -115,7 +115,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -138,7 +138,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; # # MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' @@ -160,7 +160,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a ')))) +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a ' DROP TABLE t1; # # End of MDEV-8694 diff --git a/mysql-test/r/ctype_ldml.result b/mysql-test/r/ctype_ldml.result index 34e862d0222..237646ade77 100644 --- a/mysql-test/r/ctype_ldml.result +++ b/mysql-test/r/ctype_ldml.result @@ -483,6 +483,9 @@ ucs2_vn_ci ucs2 359 8 ucs2_5624_1 ucs2 360 8 utf8_5624_5 utf8 368 8 utf8_5624_5_bad utf8 369 8 +utf8_czech_test_w2 utf8 370 4 +utf8_czech_test_nopad_w2 utf8 371 4 +utf8_czech_test_bad_w2 utf8 372 4 utf32_test_ci utf32 391 8 utf8_maxuserid_ci utf8 2047 8 show collation like '%test%'; @@ -491,6 +494,9 @@ latin1_test latin1 99 Yes 1 latin1_test2 latin1 332 1 latin1_test2_cs latin1 333 1 utf8_test_ci utf8 353 8 +utf8_czech_test_w2 utf8 370 4 +utf8_czech_test_nopad_w2 utf8 371 4 +utf8_czech_test_bad_w2 utf8 372 4 ucs2_test_ci ucs2 358 8 utf8mb4_test_ci utf8mb4 326 8 utf8mb4_test_400_ci utf8mb4 328 8 @@ -1326,3 +1332,1705 @@ HEX(a) REPLACE(a,' ','') 6120 a 61 a DROP TABLE t1; +SET NAMES utf8 COLLATE utf8_czech_test_w2; +CREATE TABLE t1 AS SELECT SPACE(10) AS c1 LIMIT 0; +insert into t1 values ('A'),('a'); +insert into t1 values ('B'),('b'); +insert into t1 values ('C'),('c'); +insert into t1 values ('D'),('d'); +insert into t1 values ('E'),('e'); +insert into t1 values ('F'),('f'); +insert into t1 values ('G'),('g'); +insert into t1 values ('H'),('h'); +insert into t1 values ('I'),('i'); +insert into t1 values ('J'),('j'); +insert into t1 values ('K'),('k'); +insert into t1 values ('L'),('l'); +insert into t1 values ('M'),('m'); +insert into t1 values ('N'),('n'); +insert into t1 values ('O'),('o'); +insert into t1 values ('P'),('p'); +insert into t1 values ('Q'),('q'); +insert into t1 values ('R'),('r'); +insert into t1 values ('S'),('s'); +insert into t1 values ('T'),('t'); +insert into t1 values ('U'),('u'); +insert into t1 values ('V'),('v'); +insert into t1 values ('W'),('w'); +insert into t1 values ('X'),('x'); +insert into t1 values ('Y'),('y'); +insert into t1 values ('Z'),('z'); +insert into t1 values (_ucs2 0x00e0),(_ucs2 0x00c0); +insert into t1 values (_ucs2 0x00e1),(_ucs2 0x00c1); +insert into t1 values (_ucs2 0x00e2),(_ucs2 0x00c2); +insert into t1 values (_ucs2 0x00e3),(_ucs2 0x00c3); +insert into t1 values (_ucs2 0x00e4),(_ucs2 0x00c4); +insert into t1 values (_ucs2 0x00e5),(_ucs2 0x00c5); +insert into t1 values (_ucs2 0x00e6),(_ucs2 0x00c6); +insert into t1 values (_ucs2 0x00e7),(_ucs2 0x00c7); +insert into t1 values (_ucs2 0x00e8),(_ucs2 0x00c8); +insert into t1 values (_ucs2 0x00e9),(_ucs2 0x00c9); +insert into t1 values (_ucs2 0x00ea),(_ucs2 0x00ca); +insert into t1 values (_ucs2 0x00eb),(_ucs2 0x00cb); +insert into t1 values (_ucs2 0x00ec),(_ucs2 0x00cc); +insert into t1 values (_ucs2 0x00ed),(_ucs2 0x00cd); +insert into t1 values (_ucs2 0x00ee),(_ucs2 0x00ce); +insert into t1 values (_ucs2 0x00ef),(_ucs2 0x00cf); +insert into t1 values (_ucs2 0x00f0),(_ucs2 0x00d0); +insert into t1 values (_ucs2 0x00f1),(_ucs2 0x00d1); +insert into t1 values (_ucs2 0x00f2),(_ucs2 0x00d2); +insert into t1 values (_ucs2 0x00f3),(_ucs2 0x00d3); +insert into t1 values (_ucs2 0x00f4),(_ucs2 0x00d4); +insert into t1 values (_ucs2 0x00f5),(_ucs2 0x00d5); +insert into t1 values (_ucs2 0x00f6),(_ucs2 0x00d6); +insert into t1 values (_ucs2 0x00f7),(_ucs2 0x00d7); +insert into t1 values (_ucs2 0x00f8),(_ucs2 0x00d8); +insert into t1 values (_ucs2 0x00f9),(_ucs2 0x00d9); +insert into t1 values (_ucs2 0x00fa),(_ucs2 0x00da); +insert into t1 values (_ucs2 0x00fb),(_ucs2 0x00db); +insert into t1 values (_ucs2 0x00fc),(_ucs2 0x00dc); +insert into t1 values (_ucs2 0x00fd),(_ucs2 0x00dd); +insert into t1 values (_ucs2 0x00fe),(_ucs2 0x00de); +insert into t1 values (_ucs2 0x00ff),(_ucs2 0x00df); +insert into t1 values (_ucs2 0x0100),(_ucs2 0x0101),(_ucs2 0x0102),(_ucs2 0x0103); +insert into t1 values (_ucs2 0x0104),(_ucs2 0x0105),(_ucs2 0x0106),(_ucs2 0x0107); +insert into t1 values (_ucs2 0x0108),(_ucs2 0x0109),(_ucs2 0x010a),(_ucs2 0x010b); +insert into t1 values (_ucs2 0x010c),(_ucs2 0x010d),(_ucs2 0x010e),(_ucs2 0x010f); +insert into t1 values (_ucs2 0x0110),(_ucs2 0x0111),(_ucs2 0x0112),(_ucs2 0x0113); +insert into t1 values (_ucs2 0x0114),(_ucs2 0x0115),(_ucs2 0x0116),(_ucs2 0x0117); +insert into t1 values (_ucs2 0x0118),(_ucs2 0x0119),(_ucs2 0x011a),(_ucs2 0x011b); +insert into t1 values (_ucs2 0x011c),(_ucs2 0x011d),(_ucs2 0x011e),(_ucs2 0x011f); +insert into t1 values (_ucs2 0x0120),(_ucs2 0x0121),(_ucs2 0x0122),(_ucs2 0x0123); +insert into t1 values (_ucs2 0x0124),(_ucs2 0x0125),(_ucs2 0x0126),(_ucs2 0x0127); +insert into t1 values (_ucs2 0x0128),(_ucs2 0x0129),(_ucs2 0x012a),(_ucs2 0x012b); +insert into t1 values (_ucs2 0x012c),(_ucs2 0x012d),(_ucs2 0x012e),(_ucs2 0x012f); +insert into t1 values (_ucs2 0x0130),(_ucs2 0x0131),(_ucs2 0x0132),(_ucs2 0x0133); +insert into t1 values (_ucs2 0x0134),(_ucs2 0x0135),(_ucs2 0x0136),(_ucs2 0x0137); +insert into t1 values (_ucs2 0x0138),(_ucs2 0x0139),(_ucs2 0x013a),(_ucs2 0x013b); +insert into t1 values (_ucs2 0x013c),(_ucs2 0x013d),(_ucs2 0x013e),(_ucs2 0x013f); +insert into t1 values (_ucs2 0x0140),(_ucs2 0x0141),(_ucs2 0x0142),(_ucs2 0x0143); +insert into t1 values (_ucs2 0x0144),(_ucs2 0x0145),(_ucs2 0x0146),(_ucs2 0x0147); +insert into t1 values (_ucs2 0x0148),(_ucs2 0x0149),(_ucs2 0x014a),(_ucs2 0x014b); +insert into t1 values (_ucs2 0x014c),(_ucs2 0x014d),(_ucs2 0x014e),(_ucs2 0x014f); +insert into t1 values (_ucs2 0x0150),(_ucs2 0x0151),(_ucs2 0x0152),(_ucs2 0x0153); +insert into t1 values (_ucs2 0x0154),(_ucs2 0x0155),(_ucs2 0x0156),(_ucs2 0x0157); +insert into t1 values (_ucs2 0x0158),(_ucs2 0x0159),(_ucs2 0x015a),(_ucs2 0x015b); +insert into t1 values (_ucs2 0x015c),(_ucs2 0x015d),(_ucs2 0x015e),(_ucs2 0x015f); +insert into t1 values (_ucs2 0x0160),(_ucs2 0x0161),(_ucs2 0x0162),(_ucs2 0x0163); +insert into t1 values (_ucs2 0x0164),(_ucs2 0x0165),(_ucs2 0x0166),(_ucs2 0x0167); +insert into t1 values (_ucs2 0x0168),(_ucs2 0x0169),(_ucs2 0x016a),(_ucs2 0x016b); +insert into t1 values (_ucs2 0x016c),(_ucs2 0x016d),(_ucs2 0x016e),(_ucs2 0x016f); +insert into t1 values (_ucs2 0x0170),(_ucs2 0x0171),(_ucs2 0x0172),(_ucs2 0x0173); +insert into t1 values (_ucs2 0x0174),(_ucs2 0x0175),(_ucs2 0x0176),(_ucs2 0x0177); +insert into t1 values (_ucs2 0x0178),(_ucs2 0x0179),(_ucs2 0x017a),(_ucs2 0x017b); +insert into t1 values (_ucs2 0x017c),(_ucs2 0x017d),(_ucs2 0x017e),(_ucs2 0x017f); +insert into t1 values (_ucs2 0x0180),(_ucs2 0x0181),(_ucs2 0x0182),(_ucs2 0x0183); +insert into t1 values (_ucs2 0x0184),(_ucs2 0x0185),(_ucs2 0x0186),(_ucs2 0x0187); +insert into t1 values (_ucs2 0x0188),(_ucs2 0x0189),(_ucs2 0x018a),(_ucs2 0x018b); +insert into t1 values (_ucs2 0x018c),(_ucs2 0x018d),(_ucs2 0x018e),(_ucs2 0x018f); +insert into t1 values (_ucs2 0x0190),(_ucs2 0x0191),(_ucs2 0x0192),(_ucs2 0x0193); +insert into t1 values (_ucs2 0x0194),(_ucs2 0x0195),(_ucs2 0x0196),(_ucs2 0x0197); +insert into t1 values (_ucs2 0x0198),(_ucs2 0x0199),(_ucs2 0x019a),(_ucs2 0x019b); +insert into t1 values (_ucs2 0x019c),(_ucs2 0x019d),(_ucs2 0x019e),(_ucs2 0x019f); +insert into t1 values (_ucs2 0x01a0),(_ucs2 0x01a1),(_ucs2 0x01a2),(_ucs2 0x01a3); +insert into t1 values (_ucs2 0x01a4),(_ucs2 0x01a5),(_ucs2 0x01a6),(_ucs2 0x01a7); +insert into t1 values (_ucs2 0x01a8),(_ucs2 0x01a9),(_ucs2 0x01aa),(_ucs2 0x01ab); +insert into t1 values (_ucs2 0x01ac),(_ucs2 0x01ad),(_ucs2 0x01ae),(_ucs2 0x01af); +insert into t1 values (_ucs2 0x01b0),(_ucs2 0x01b1),(_ucs2 0x01b2),(_ucs2 0x01b3); +insert into t1 values (_ucs2 0x01b4),(_ucs2 0x01b5),(_ucs2 0x01b6),(_ucs2 0x01b7); +insert into t1 values (_ucs2 0x01b8),(_ucs2 0x01b9),(_ucs2 0x01ba),(_ucs2 0x01bb); +insert into t1 values (_ucs2 0x01bc),(_ucs2 0x01bd),(_ucs2 0x01be),(_ucs2 0x01bf); +insert into t1 values (_ucs2 0x01c0),(_ucs2 0x01c1),(_ucs2 0x01c2),(_ucs2 0x01c3); +insert into t1 values (_ucs2 0x01c4),(_ucs2 0x01c5),(_ucs2 0x01c6),(_ucs2 0x01c7); +insert into t1 values (_ucs2 0x01c8),(_ucs2 0x01c9),(_ucs2 0x01ca),(_ucs2 0x01cb); +insert into t1 values (_ucs2 0x01cc),(_ucs2 0x01cd),(_ucs2 0x01ce),(_ucs2 0x01cf); +insert into t1 values (_ucs2 0x01d0),(_ucs2 0x01d1),(_ucs2 0x01d2),(_ucs2 0x01d3); +insert into t1 values (_ucs2 0x01d4),(_ucs2 0x01d5),(_ucs2 0x01d6),(_ucs2 0x01d7); +insert into t1 values (_ucs2 0x01d8),(_ucs2 0x01d9),(_ucs2 0x01da),(_ucs2 0x01db); +insert into t1 values (_ucs2 0x01dc),(_ucs2 0x01dd),(_ucs2 0x01de),(_ucs2 0x01df); +insert into t1 values (_ucs2 0x01e0),(_ucs2 0x01e1),(_ucs2 0x01e2),(_ucs2 0x01e3); +insert into t1 values (_ucs2 0x01e4),(_ucs2 0x01e5),(_ucs2 0x01e6),(_ucs2 0x01e7); +insert into t1 values (_ucs2 0x01e8),(_ucs2 0x01e9),(_ucs2 0x01ea),(_ucs2 0x01eb); +insert into t1 values (_ucs2 0x01ec),(_ucs2 0x01ed),(_ucs2 0x01ee),(_ucs2 0x01ef); +insert into t1 values (_ucs2 0x01f0),(_ucs2 0x01f1),(_ucs2 0x01f2),(_ucs2 0x01f3); +insert into t1 values (_ucs2 0x01f4),(_ucs2 0x01f5),(_ucs2 0x01f6),(_ucs2 0x01f7); +insert into t1 values (_ucs2 0x01f8),(_ucs2 0x01f9),(_ucs2 0x01fa),(_ucs2 0x01fb); +insert into t1 values (_ucs2 0x01fc),(_ucs2 0x01fd),(_ucs2 0x01fe),(_ucs2 0x01ff); +INSERT INTO t1 VALUES (_ucs2 0x1EA0),(_ucs2 0x1EA1),(_ucs2 0x1EA2),(_ucs2 0x1EA3); +INSERT INTO t1 VALUES (_ucs2 0x1EA4),(_ucs2 0x1EA5),(_ucs2 0x1EA6),(_ucs2 0x1EA7); +INSERT INTO t1 VALUES (_ucs2 0x1EA8),(_ucs2 0x1EA9),(_ucs2 0x1EAA),(_ucs2 0x1EAB); +INSERT INTO t1 VALUES (_ucs2 0x1EAC),(_ucs2 0x1EAD),(_ucs2 0x1EAE),(_ucs2 0x1EAF); +INSERT INTO t1 VALUES (_ucs2 0x1EB0),(_ucs2 0x1EB1),(_ucs2 0x1EB2),(_ucs2 0x1EB3); +INSERT INTO t1 VALUES (_ucs2 0x1EB4),(_ucs2 0x1EB5),(_ucs2 0x1EB6),(_ucs2 0x1EB7); +INSERT INTO t1 VALUES (_ucs2 0x1EB8),(_ucs2 0x1EB9),(_ucs2 0x1EBA),(_ucs2 0x1EBB); +INSERT INTO t1 VALUES (_ucs2 0x1EBC),(_ucs2 0x1EBD),(_ucs2 0x1EBE),(_ucs2 0x1EBF); +INSERT INTO t1 VALUES (_ucs2 0x1EC0),(_ucs2 0x1EC1),(_ucs2 0x1EC2),(_ucs2 0x1EC3); +INSERT INTO t1 VALUES (_ucs2 0x1EC4),(_ucs2 0x1EC5),(_ucs2 0x1EC6),(_ucs2 0x1EC7); +INSERT INTO t1 VALUES (_ucs2 0x1EC8),(_ucs2 0x1EC9),(_ucs2 0x1ECA),(_ucs2 0x1ECB); +INSERT INTO t1 VALUES (_ucs2 0x1ECC),(_ucs2 0x1ECD),(_ucs2 0x1ECE),(_ucs2 0x1ECF); +INSERT INTO t1 VALUES (_ucs2 0x1ED0),(_ucs2 0x1ED1),(_ucs2 0x1ED2),(_ucs2 0x1ED3); +INSERT INTO t1 VALUES (_ucs2 0x1ED4),(_ucs2 0x1ED5),(_ucs2 0x1ED6),(_ucs2 0x1ED7); +INSERT INTO t1 VALUES (_ucs2 0x1ED8),(_ucs2 0x1ED9),(_ucs2 0x1EDA),(_ucs2 0x1EDB); +INSERT INTO t1 VALUES (_ucs2 0x1EDC),(_ucs2 0x1EDD),(_ucs2 0x1EDE),(_ucs2 0x1EDF); +INSERT INTO t1 VALUES (_ucs2 0x1EE0),(_ucs2 0x1EE1),(_ucs2 0x1EE2),(_ucs2 0x1EE3); +INSERT INTO t1 VALUES (_ucs2 0x1EE4),(_ucs2 0x1EE5),(_ucs2 0x1EE6),(_ucs2 0x1EE7); +INSERT INTO t1 VALUES (_ucs2 0x1EE8),(_ucs2 0x1EE9),(_ucs2 0x1EEA),(_ucs2 0x1EEB); +INSERT INTO t1 VALUES (_ucs2 0x1EEC),(_ucs2 0x1EED),(_ucs2 0x1EEE),(_ucs2 0x1EEF); +INSERT INTO t1 VALUES (_ucs2 0x1EF0),(_ucs2 0x1EF1); +insert into t1 values ('AA'),('Aa'),('aa'),('aA'); +insert into t1 values ('AE'),('Ae'),('ae'),('aE'); +insert into t1 values ('CH'),('Ch'),('ch'),('cH'); +insert into t1 values ('DZ'),('Dz'),('dz'),('dZ'); +insert into t1 values ('DŽ'),('Dž'),('dž'),('dŽ'); +insert into t1 values ('IJ'),('Ij'),('ij'),('iJ'); +insert into t1 values ('LJ'),('Lj'),('lj'),('lJ'); +insert into t1 values ('LL'),('Ll'),('ll'),('lL'); +insert into t1 values ('NJ'),('Nj'),('nj'),('nJ'); +insert into t1 values ('OE'),('Oe'),('oe'),('oE'); +insert into t1 values ('SS'),('Ss'),('ss'),('sS'); +insert into t1 values ('RR'),('Rr'),('rr'),('rR'); +INSERT INTO t1 VALUES ('a '); +SELECT c1, HEX(WEIGHT_STRING(c1 LEVEL 1)), HEX(WEIGHT_STRING(c1 LEVEL 2)) FROM t1 ORDER BY c1, BINARY c1; +c1 HEX(WEIGHT_STRING(c1 LEVEL 1)) HEX(WEIGHT_STRING(c1 LEVEL 2)) +÷ 0552 0020 +× 0553 0020 +A 120F 0020 +a 120F 0020 +a 120F020A 00200020 +à 120F 00200032 +á 120F 00200032 +À 120F 00200035 +à 120F 00200035 +Ä‚ 120F 00200037 +ă 120F 00200037 +Ắ 120F 002000370032 +ắ 120F 002000370032 +Ằ 120F 002000370035 +ằ 120F 002000370035 +Ẵ 120F 00200037004E +ẵ 120F 00200037004E +Ẳ 120F 002000370064 +ẳ 120F 002000370064 + 120F 0020003C +â 120F 0020003C +Ấ 120F 0020003C0032 +ấ 120F 0020003C0032 +Ầ 120F 0020003C0035 +ầ 120F 0020003C0035 +Ẫ 120F 0020003C004E +ẫ 120F 0020003C004E +Ẩ 120F 0020003C0064 +ẩ 120F 0020003C0064 +Ç 120F 00200041 +ÇŽ 120F 00200041 +Ã… 120F 00200043 +Ã¥ 120F 00200043 +Ǻ 120F 002000430032 +Ç» 120F 002000430032 +Ä 120F 00200047 +ä 120F 00200047 +Çž 120F 00200047005B +ÇŸ 120F 00200047005B +à 120F 0020004E +ã 120F 0020004E +Ç  120F 00200052005B +Ç¡ 120F 00200052005B +Ä„ 120F 00200059 +Ä… 120F 00200059 +Ä€ 120F 0020005B +Ä 120F 0020005B +Ả 120F 00200064 +ả 120F 00200064 +Ạ 120F 00200070 +ạ 120F 00200070 +Ặ 120F 002000700037 +ặ 120F 002000700037 +Ậ 120F 00200070003C +ậ 120F 00200070003C +AA 120F120F 00200020 +Aa 120F120F 00200020 +aA 120F120F 00200020 +aa 120F120F 00200020 +AE 120F126B 00200020 +Ae 120F126B 00200020 +aE 120F126B 00200020 +ae 120F126B 00200020 +Æ 120F126B 002001590020 +æ 120F126B 002001590020 +Ǽ 120F126B 0020015900200032 +ǽ 120F126B 0020015900200032 +Ç¢ 120F126B 002001590020005B +Ç£ 120F126B 002001590020005B +B 1225 0020 +b 1225 0020 +Æ€ 122D 0020 +Æ 1235 0020 +Æ‚ 1239 0020 +ƃ 1239 0020 +C 123D 0020 +c 123D 0020 +Ć 123D 00200032 +ć 123D 00200032 +Ĉ 123D 0020003C +ĉ 123D 0020003C +ÄŠ 123D 00200052 +Ä‹ 123D 00200052 +Ç 123D 00200056 +ç 123D 00200056 +cH 123D12D3 00200020 +ÄŒ 123E 0020 +Ä 123E 0020 +Ƈ 1246 0020 +ƈ 1246 0020 +D 1250 0020 +d 1250 0020 +ÄŽ 1250 00200041 +Ä 1250 00200041 +Ä 1250 0020007D +Ä‘ 1250 0020007D +à 1250 00200159 +ð 1250 00200159 +DZ 125014AD 00200020 +Dz 125014AD 00200020 +dZ 125014AD 00200020 +dz 125014AD 00200020 +DZ 125014AD 00200020 +Dz 125014AD 00200020 +dz 125014AD 00200020 +Ç„ 125014AD 002000200041 +Ç… 125014AD 002000200041 +dž 125014AD 002000200041 +DŽ 125014AE 00200020 +Dž 125014AE 00200020 +dŽ 125014AE 00200020 +dž 125014AE 00200020 +Ɖ 1258 0020 +ÆŠ 125C 0020 +Æ‹ 1261 0020 +ÆŒ 1261 0020 +E 126B 0020 +e 126B 0020 +É 126B 00200032 +é 126B 00200032 +È 126B 00200035 +è 126B 00200035 +Ä” 126B 00200037 +Ä• 126B 00200037 +Ê 126B 0020003C +ê 126B 0020003C +Ế 126B 0020003C0032 +ế 126B 0020003C0032 +Ề 126B 0020003C0035 +á» 126B 0020003C0035 +Ễ 126B 0020003C004E +á»… 126B 0020003C004E +Ể 126B 0020003C0064 +ể 126B 0020003C0064 +Äš 126B 00200041 +Ä› 126B 00200041 +Ë 126B 00200047 +ë 126B 00200047 +Ẽ 126B 0020004E +ẽ 126B 0020004E +Ä– 126B 00200052 +Ä— 126B 00200052 +Ę 126B 00200059 +Ä™ 126B 00200059 +Ä’ 126B 0020005B +Ä“ 126B 0020005B +Ẻ 126B 00200064 +ẻ 126B 00200064 +Ẹ 126B 00200070 +ẹ 126B 00200070 +Ệ 126B 00200070003C +ệ 126B 00200070003C +ÆŽ 1276 0020 +Ç 1276 0020 +Æ 127B 0020 +Æ 1280 0020 +F 12A3 0020 +f 12A3 0020 +Æ‘ 12AA 0020 +Æ’ 12AA 0020 +G 12B0 0020 +g 12B0 0020 +Ç´ 12B0 00200032 +ǵ 12B0 00200032 +Äž 12B0 00200037 +ÄŸ 12B0 00200037 +Äœ 12B0 0020003C +Ä 12B0 0020003C +Ǧ 12B0 00200041 +ǧ 12B0 00200041 +Ä  12B0 00200052 +Ä¡ 12B0 00200052 +Ä¢ 12B0 00200056 +Ä£ 12B0 00200056 +Ǥ 12BC 0020 +Ç¥ 12BC 0020 +Æ“ 12C1 0020 +Æ” 12CB 0020 +Æ¢ 12CF 0020 +Æ£ 12CF 0020 +H 12D3 0020 +h 12D3 0020 +Ĥ 12D3 0020003C +Ä¥ 12D3 0020003C +Ħ 12D3 0020007D +ħ 12D3 0020007D +CH 12D4 0020 +Ch 12D4 0020 +ch 12D4 0020 +Æ• 12DB 0020 +Ƕ 12DB 0020 +I 12EC 0020 +i 12EC 0020 +à 12EC 00200032 +í 12EC 00200032 +ÃŒ 12EC 00200035 +ì 12EC 00200035 +Ĭ 12EC 00200037 +Ä­ 12EC 00200037 +ÃŽ 12EC 0020003C +î 12EC 0020003C +Ç 12EC 00200041 +Ç 12EC 00200041 +à 12EC 00200047 +ï 12EC 00200047 +Ĩ 12EC 0020004E +Ä© 12EC 0020004E +İ 12EC 00200052 +Ä® 12EC 00200059 +į 12EC 00200059 +Ī 12EC 0020005B +Ä« 12EC 0020005B +Ỉ 12EC 00200064 +ỉ 12EC 00200064 +Ị 12EC 00200070 +ị 12EC 00200070 +IJ 12EC1305 00200020 +Ij 12EC1305 00200020 +iJ 12EC1305 00200020 +ij 12EC1305 00200020 +IJ 12EC1305 00200020 +ij 12EC1305 00200020 +ı 12F0 0020 +Æ— 12FA 0020 +Æ– 1300 0020 +J 1305 0020 +j 1305 0020 +Ä´ 1305 0020003C +ĵ 1305 0020003C +ǰ 1305 00200041 +K 131E 0020 +k 131E 0020 +Ǩ 131E 00200041 +Ç© 131E 00200041 +Ķ 131E 00200056 +Ä· 131E 00200056 +Ƙ 1324 0020 +Æ™ 1324 0020 +L 1330 0020 +l 1330 0020 +Ĺ 1330 00200032 +ĺ 1330 00200032 +Ľ 1330 00200041 +ľ 1330 00200041 +Ä» 1330 00200056 +ļ 1330 00200056 +Å 1330 0020007D +Å‚ 1330 0020007D +Ä¿ 1330 00200159 +Å€ 1330 00200159 +LJ 13301305 00200020 +Lj 13301305 00200020 +lJ 13301305 00200020 +lj 13301305 00200020 +LJ 13301305 00200020 +Lj 13301305 00200020 +lj 13301305 00200020 +LL 13301330 00200020 +Ll 13301330 00200020 +lL 13301330 00200020 +ll 13301330 00200020 +Æš 133B 0020 +Æ› 1357 0020 +M 135F 0020 +m 135F 0020 +N 136D 0020 +n 136D 0020 +Ń 136D 00200032 +Å„ 136D 00200032 +Ǹ 136D 00200035 +ǹ 136D 00200035 +Ň 136D 00200041 +ň 136D 00200041 +Ñ 136D 0020004E +ñ 136D 0020004E +Å… 136D 00200056 +ņ 136D 00200056 +NJ 136D1305 00200020 +Nj 136D1305 00200020 +nJ 136D1305 00200020 +nj 136D1305 00200020 +ÇŠ 136D1305 00200020 +Ç‹ 136D1305 00200020 +ÇŒ 136D1305 00200020 +Æ 1378 0020 +Æž 137C 0020 +ÅŠ 138A 0020 +Å‹ 138A 0020 +O 138E 0020 +o 138E 0020 +Ó 138E 00200032 +ó 138E 00200032 +Ã’ 138E 00200035 +ò 138E 00200035 +ÅŽ 138E 00200037 +Å 138E 00200037 +Ô 138E 0020003C +ô 138E 0020003C +á» 138E 0020003C0032 +ố 138E 0020003C0032 +á»’ 138E 0020003C0035 +ồ 138E 0020003C0035 +á»– 138E 0020003C004E +á»— 138E 0020003C004E +á»” 138E 0020003C0064 +ổ 138E 0020003C0064 +Ç‘ 138E 00200041 +Ç’ 138E 00200041 +Ö 138E 00200047 +ö 138E 00200047 +Å 138E 0020004D +Å‘ 138E 0020004D +Õ 138E 0020004E +õ 138E 0020004E +Ø 138E 00200054 +ø 138E 00200054 +Ǿ 138E 002000540032 +Ç¿ 138E 002000540032 +Ǫ 138E 00200059 +Ç« 138E 00200059 +Ǭ 138E 00200059005B +Ç­ 138E 00200059005B +ÅŒ 138E 0020005B +Å 138E 0020005B +Ỏ 138E 00200064 +á» 138E 00200064 +Æ  138E 00200068 +Æ¡ 138E 00200068 +Ớ 138E 002000680032 +á»› 138E 002000680032 +Ờ 138E 002000680035 +á» 138E 002000680035 +á»  138E 00200068004E +ỡ 138E 00200068004E +Ở 138E 002000680064 +ở 138E 002000680064 +Ợ 138E 002000680070 +ợ 138E 002000680070 +Ọ 138E 00200070 +á» 138E 00200070 +Ộ 138E 00200070003C +á»™ 138E 00200070003C +OE 138E126B 00200020 +Oe 138E126B 00200020 +oE 138E126B 00200020 +oe 138E126B 00200020 +Å’ 138E126B 002001590020 +Å“ 138E126B 002001590020 +Ɔ 139A 0020 +ÆŸ 13A5 0020 +P 13B3 0020 +p 13B3 0020 +Ƥ 13BC 0020 +Æ¥ 13BC 0020 +Q 13C8 0020 +q 13C8 0020 +ĸ 13D6 0020 +R 13DA 0020 +r 13DA 0020 +Å” 13DA 00200032 +Å• 13DA 00200032 +Å– 13DA 00200056 +Å— 13DA 00200056 +RR 13DA13DA 00200020 +Rr 13DA13DA 00200020 +rR 13DA13DA 00200020 +rr 13DA13DA 00200020 +Ř 13DB 0020 +Å™ 13DB 0020 +Ʀ 13DE 0020 +S 1410 0020 +s 1410 0020 +Åš 1410 00200032 +Å› 1410 00200032 +Åœ 1410 0020003C +Å 1410 0020003C +Åž 1410 00200056 +ÅŸ 1410 00200056 +Å¿ 1410 0020015A +SS 14101410 00200020 +Ss 14101410 00200020 +sS 14101410 00200020 +ss 14101410 00200020 +ß 14101410 002001590020 +Å  1411 0020 +Å¡ 1411 0020 +Æ© 1421 0020 +ƪ 1426 0020 +T 1433 0020 +t 1433 0020 +Ť 1433 00200041 +Å¥ 1433 00200041 +Å¢ 1433 00200056 +Å£ 1433 00200056 +ƾ 14331410 00200020 +Ŧ 1438 0020 +ŧ 1438 0020 +Æ« 143E 0020 +Ƭ 1442 0020 +Æ­ 1442 0020 +Æ® 1446 0020 +U 1453 0020 +u 1453 0020 +Ú 1453 00200032 +ú 1453 00200032 +Ù 1453 00200035 +ù 1453 00200035 +Ŭ 1453 00200037 +Å­ 1453 00200037 +Û 1453 0020003C +û 1453 0020003C +Ç“ 1453 00200041 +Ç” 1453 00200041 +Å® 1453 00200043 +ů 1453 00200043 +Ü 1453 00200047 +ü 1453 00200047 +Ç— 1453 002000470032 +ǘ 1453 002000470032 +Ç› 1453 002000470035 +Çœ 1453 002000470035 +Ç™ 1453 002000470041 +Çš 1453 002000470041 +Ç• 1453 00200047005B +Ç– 1453 00200047005B +Ű 1453 0020004D +ű 1453 0020004D +Ũ 1453 0020004E +Å© 1453 0020004E +Ų 1453 00200059 +ų 1453 00200059 +Ū 1453 0020005B +Å« 1453 0020005B +Ủ 1453 00200064 +á»§ 1453 00200064 +Ư 1453 00200068 +ư 1453 00200068 +Ứ 1453 002000680032 +ứ 1453 002000680032 +Ừ 1453 002000680035 +ừ 1453 002000680035 +á»® 1453 00200068004E +ữ 1453 00200068004E +Ử 1453 002000680064 +á»­ 1453 002000680064 +á»° 1453 002000680070 +á»± 1453 002000680070 +Ụ 1453 00200070 +ụ 1453 00200070 +Æœ 146D 0020 +Ʊ 1476 0020 +V 147B 0020 +v 147B 0020 +Ʋ 1482 0020 +W 148D 0020 +w 148D 0020 +Å´ 148D 0020003C +ŵ 148D 0020003C +X 1497 0020 +x 1497 0020 +Y 149C 0020 +y 149C 0020 +à 149C 00200032 +ý 149C 00200032 +Ŷ 149C 0020003C +Å· 149C 0020003C +ÿ 149C 00200047 +Ÿ 149C 00200047 +Ƴ 14A8 0020 +Æ´ 14A8 0020 +Z 14AD 0020 +z 14AD 0020 +Ź 14AD 00200032 +ź 14AD 00200032 +Å» 14AD 00200052 +ż 14AD 00200052 +Æ 14AD148D 00200020 +Ž 14AE 0020 +ž 14AE 0020 +Ƶ 14B2 0020 +ƶ 14B2 0020 +Æ· 14CA 0020 +Ç® 14CA 00200041 +ǯ 14CA 00200041 +Ƹ 14CF 0020 +ƹ 14CF 0020 +ƺ 14D4 0020 +Þ 14E0 0020 +þ 14E0 0020 +Æ¿ 14E6 0020 +Ç· 14E6 0020 +Æ» 14EF 0020 +Ƨ 14F6 0020 +ƨ 14F6 0020 +Ƽ 14FA 0020 +ƽ 14FA 0020 +Æ„ 14FE 0020 +Æ… 14FE 0020 +ʼn 150B136D 00200020 +Ç€ 1525 0020 +Ç 1529 0020 +Ç‚ 152D 0020 +ǃ 1531 0020 +SELECT c1, HEX(WEIGHT_STRING(c1 AS CHAR(3) LEVEL 1)), HEX(WEIGHT_STRING(c1 AS CHAR(3) LEVEL 2)) FROM t1 WHERE c1 BETWEEN 'a' AND 'aZ' ORDER BY c1, BINARY c1; +c1 HEX(WEIGHT_STRING(c1 AS CHAR(3) LEVEL 1)) HEX(WEIGHT_STRING(c1 AS CHAR(3) LEVEL 2)) +A 120F020A020A 002000200020 +a 120F020A020A 002000200020 +a 120F020A020A 002000200020 +à 120F020A020A 002000320020 +á 120F020A020A 002000320020 +À 120F020A020A 002000350020 +à 120F020A020A 002000350020 +Ä‚ 120F020A020A 002000370020 +ă 120F020A020A 002000370020 +Ắ 120F020A020A 002000370032 +ắ 120F020A020A 002000370032 +Ằ 120F020A020A 002000370035 +ằ 120F020A020A 002000370035 +Ẵ 120F020A020A 00200037004E +ẵ 120F020A020A 00200037004E +Ẳ 120F020A020A 002000370064 +ẳ 120F020A020A 002000370064 + 120F020A020A 0020003C0020 +â 120F020A020A 0020003C0020 +Ấ 120F020A020A 0020003C0032 +ấ 120F020A020A 0020003C0032 +Ầ 120F020A020A 0020003C0035 +ầ 120F020A020A 0020003C0035 +Ẫ 120F020A020A 0020003C004E +ẫ 120F020A020A 0020003C004E +Ẩ 120F020A020A 0020003C0064 +ẩ 120F020A020A 0020003C0064 +Ç 120F020A020A 002000410020 +ÇŽ 120F020A020A 002000410020 +Ã… 120F020A020A 002000430020 +Ã¥ 120F020A020A 002000430020 +Ǻ 120F020A020A 002000430032 +Ç» 120F020A020A 002000430032 +Ä 120F020A020A 002000470020 +ä 120F020A020A 002000470020 +Çž 120F020A020A 00200047005B +ÇŸ 120F020A020A 00200047005B +à 120F020A020A 0020004E0020 +ã 120F020A020A 0020004E0020 +Ç  120F020A020A 00200052005B +Ç¡ 120F020A020A 00200052005B +Ä„ 120F020A020A 002000590020 +Ä… 120F020A020A 002000590020 +Ä€ 120F020A020A 0020005B0020 +Ä 120F020A020A 0020005B0020 +Ả 120F020A020A 002000640020 +ả 120F020A020A 002000640020 +Ạ 120F020A020A 002000700020 +ạ 120F020A020A 002000700020 +Ặ 120F020A020A 002000700037 +ặ 120F020A020A 002000700037 +Ậ 120F020A020A 00200070003C +ậ 120F020A020A 00200070003C +AA 120F120F020A 002000200020 +Aa 120F120F020A 002000200020 +aA 120F120F020A 002000200020 +aa 120F120F020A 002000200020 +AE 120F126B020A 002000200020 +Ae 120F126B020A 002000200020 +aE 120F126B020A 002000200020 +ae 120F126B020A 002000200020 +Æ 120F126B020A 002001590020 +æ 120F126B020A 002001590020 +Ǽ 120F126B020A 002001590020 +ǽ 120F126B020A 002001590020 +Ç¢ 120F126B020A 002001590020 +Ç£ 120F126B020A 002001590020 +DROP TABLE t1; +SELECT 'a' = 'a '; +'a' = 'a ' +1 +SELECT 'a' < 'á'; +'a' < 'á' +1 +SELECT 'áa' < 'ab'; +'áa' < 'ab' +1 +SELECT 'á' < 'ä'; +'á' < 'ä' +1 +SELECT 'äa' < 'áb'; +'äa' < 'áb' +1 +SELECT 'c' < 'Ä'; +'c' < 'Ä' +1 +SELECT 'cb' < 'Äa'; +'cb' < 'Äa' +1 +SELECT 'd' < 'Ä'; +'d' < 'Ä' +1 +SELECT 'Äa' < 'db'; +'Äa' < 'db' +1 +SELECT 'e' < 'é'; +'e' < 'é' +1 +SELECT 'éa' < 'eb'; +'éa' < 'eb' +1 +SELECT 'é' < 'Ä›'; +'é' < 'Ä›' +1 +SELECT 'Ä›a' < 'éb'; +'Ä›a' < 'éb' +1 +SELECT 'i' < 'í'; +'i' < 'í' +1 +SELECT 'ía' < 'ib'; +'ía' < 'ib' +1 +SELECT 'n' < 'ň'; +'n' < 'ň' +1 +SELECT 'ňa' < 'nb'; +'ňa' < 'nb' +1 +SELECT 'o' < 'ó'; +'o' < 'ó' +1 +SELECT 'óa' < 'ob'; +'óa' < 'ob' +1 +SELECT 'ó' < 'ö'; +'ó' < 'ö' +1 +SELECT 'öa' < 'ób'; +'öa' < 'ób' +1 +SELECT 'r' < 'Å™'; +'r' < 'Å™' +1 +SELECT 'rb' < 'Å™a'; +'rb' < 'Å™a' +1 +SELECT 's' < 'Å¡'; +'s' < 'Å¡' +1 +SELECT 'sb' < 'Å¡a'; +'sb' < 'Å¡a' +1 +SELECT 't' < 'Å¥'; +'t' < 'Å¥' +1 +SELECT 'Å¥a' < 'tb'; +'Å¥a' < 'tb' +1 +SELECT 'u' < 'ú'; +'u' < 'ú' +1 +SELECT 'úa' < 'ub'; +'úa' < 'ub' +1 +SELECT 'ú' < 'ů'; +'ú' < 'ů' +1 +SELECT 'ůa' < 'úb'; +'ůa' < 'úb' +1 +SELECT 'ů' < 'ü'; +'ů' < 'ü' +1 +SELECT 'üa' < 'ůb'; +'üa' < 'ůb' +1 +SELECT 'y' < 'ý'; +'y' < 'ý' +1 +SELECT 'ýa' < 'yb'; +'ýa' < 'yb' +1 +SELECT 'z' < 'ž'; +'z' < 'ž' +1 +SELECT 'zb' < 'ža'; +'zb' < 'ža' +1 +SELECT 'hž' < 'ch'; +'hž' < 'ch' +1 +SELECT 'chž'< 'i'; +'chž'< 'i' +1 +SET NAMES utf8 COLLATE utf8_czech_test_nopad_w2; +CREATE TABLE t1 AS SELECT SPACE(10) AS c1 LIMIT 0; +insert into t1 values ('A'),('a'); +insert into t1 values ('B'),('b'); +insert into t1 values ('C'),('c'); +insert into t1 values ('D'),('d'); +insert into t1 values ('E'),('e'); +insert into t1 values ('F'),('f'); +insert into t1 values ('G'),('g'); +insert into t1 values ('H'),('h'); +insert into t1 values ('I'),('i'); +insert into t1 values ('J'),('j'); +insert into t1 values ('K'),('k'); +insert into t1 values ('L'),('l'); +insert into t1 values ('M'),('m'); +insert into t1 values ('N'),('n'); +insert into t1 values ('O'),('o'); +insert into t1 values ('P'),('p'); +insert into t1 values ('Q'),('q'); +insert into t1 values ('R'),('r'); +insert into t1 values ('S'),('s'); +insert into t1 values ('T'),('t'); +insert into t1 values ('U'),('u'); +insert into t1 values ('V'),('v'); +insert into t1 values ('W'),('w'); +insert into t1 values ('X'),('x'); +insert into t1 values ('Y'),('y'); +insert into t1 values ('Z'),('z'); +insert into t1 values (_ucs2 0x00e0),(_ucs2 0x00c0); +insert into t1 values (_ucs2 0x00e1),(_ucs2 0x00c1); +insert into t1 values (_ucs2 0x00e2),(_ucs2 0x00c2); +insert into t1 values (_ucs2 0x00e3),(_ucs2 0x00c3); +insert into t1 values (_ucs2 0x00e4),(_ucs2 0x00c4); +insert into t1 values (_ucs2 0x00e5),(_ucs2 0x00c5); +insert into t1 values (_ucs2 0x00e6),(_ucs2 0x00c6); +insert into t1 values (_ucs2 0x00e7),(_ucs2 0x00c7); +insert into t1 values (_ucs2 0x00e8),(_ucs2 0x00c8); +insert into t1 values (_ucs2 0x00e9),(_ucs2 0x00c9); +insert into t1 values (_ucs2 0x00ea),(_ucs2 0x00ca); +insert into t1 values (_ucs2 0x00eb),(_ucs2 0x00cb); +insert into t1 values (_ucs2 0x00ec),(_ucs2 0x00cc); +insert into t1 values (_ucs2 0x00ed),(_ucs2 0x00cd); +insert into t1 values (_ucs2 0x00ee),(_ucs2 0x00ce); +insert into t1 values (_ucs2 0x00ef),(_ucs2 0x00cf); +insert into t1 values (_ucs2 0x00f0),(_ucs2 0x00d0); +insert into t1 values (_ucs2 0x00f1),(_ucs2 0x00d1); +insert into t1 values (_ucs2 0x00f2),(_ucs2 0x00d2); +insert into t1 values (_ucs2 0x00f3),(_ucs2 0x00d3); +insert into t1 values (_ucs2 0x00f4),(_ucs2 0x00d4); +insert into t1 values (_ucs2 0x00f5),(_ucs2 0x00d5); +insert into t1 values (_ucs2 0x00f6),(_ucs2 0x00d6); +insert into t1 values (_ucs2 0x00f7),(_ucs2 0x00d7); +insert into t1 values (_ucs2 0x00f8),(_ucs2 0x00d8); +insert into t1 values (_ucs2 0x00f9),(_ucs2 0x00d9); +insert into t1 values (_ucs2 0x00fa),(_ucs2 0x00da); +insert into t1 values (_ucs2 0x00fb),(_ucs2 0x00db); +insert into t1 values (_ucs2 0x00fc),(_ucs2 0x00dc); +insert into t1 values (_ucs2 0x00fd),(_ucs2 0x00dd); +insert into t1 values (_ucs2 0x00fe),(_ucs2 0x00de); +insert into t1 values (_ucs2 0x00ff),(_ucs2 0x00df); +insert into t1 values (_ucs2 0x0100),(_ucs2 0x0101),(_ucs2 0x0102),(_ucs2 0x0103); +insert into t1 values (_ucs2 0x0104),(_ucs2 0x0105),(_ucs2 0x0106),(_ucs2 0x0107); +insert into t1 values (_ucs2 0x0108),(_ucs2 0x0109),(_ucs2 0x010a),(_ucs2 0x010b); +insert into t1 values (_ucs2 0x010c),(_ucs2 0x010d),(_ucs2 0x010e),(_ucs2 0x010f); +insert into t1 values (_ucs2 0x0110),(_ucs2 0x0111),(_ucs2 0x0112),(_ucs2 0x0113); +insert into t1 values (_ucs2 0x0114),(_ucs2 0x0115),(_ucs2 0x0116),(_ucs2 0x0117); +insert into t1 values (_ucs2 0x0118),(_ucs2 0x0119),(_ucs2 0x011a),(_ucs2 0x011b); +insert into t1 values (_ucs2 0x011c),(_ucs2 0x011d),(_ucs2 0x011e),(_ucs2 0x011f); +insert into t1 values (_ucs2 0x0120),(_ucs2 0x0121),(_ucs2 0x0122),(_ucs2 0x0123); +insert into t1 values (_ucs2 0x0124),(_ucs2 0x0125),(_ucs2 0x0126),(_ucs2 0x0127); +insert into t1 values (_ucs2 0x0128),(_ucs2 0x0129),(_ucs2 0x012a),(_ucs2 0x012b); +insert into t1 values (_ucs2 0x012c),(_ucs2 0x012d),(_ucs2 0x012e),(_ucs2 0x012f); +insert into t1 values (_ucs2 0x0130),(_ucs2 0x0131),(_ucs2 0x0132),(_ucs2 0x0133); +insert into t1 values (_ucs2 0x0134),(_ucs2 0x0135),(_ucs2 0x0136),(_ucs2 0x0137); +insert into t1 values (_ucs2 0x0138),(_ucs2 0x0139),(_ucs2 0x013a),(_ucs2 0x013b); +insert into t1 values (_ucs2 0x013c),(_ucs2 0x013d),(_ucs2 0x013e),(_ucs2 0x013f); +insert into t1 values (_ucs2 0x0140),(_ucs2 0x0141),(_ucs2 0x0142),(_ucs2 0x0143); +insert into t1 values (_ucs2 0x0144),(_ucs2 0x0145),(_ucs2 0x0146),(_ucs2 0x0147); +insert into t1 values (_ucs2 0x0148),(_ucs2 0x0149),(_ucs2 0x014a),(_ucs2 0x014b); +insert into t1 values (_ucs2 0x014c),(_ucs2 0x014d),(_ucs2 0x014e),(_ucs2 0x014f); +insert into t1 values (_ucs2 0x0150),(_ucs2 0x0151),(_ucs2 0x0152),(_ucs2 0x0153); +insert into t1 values (_ucs2 0x0154),(_ucs2 0x0155),(_ucs2 0x0156),(_ucs2 0x0157); +insert into t1 values (_ucs2 0x0158),(_ucs2 0x0159),(_ucs2 0x015a),(_ucs2 0x015b); +insert into t1 values (_ucs2 0x015c),(_ucs2 0x015d),(_ucs2 0x015e),(_ucs2 0x015f); +insert into t1 values (_ucs2 0x0160),(_ucs2 0x0161),(_ucs2 0x0162),(_ucs2 0x0163); +insert into t1 values (_ucs2 0x0164),(_ucs2 0x0165),(_ucs2 0x0166),(_ucs2 0x0167); +insert into t1 values (_ucs2 0x0168),(_ucs2 0x0169),(_ucs2 0x016a),(_ucs2 0x016b); +insert into t1 values (_ucs2 0x016c),(_ucs2 0x016d),(_ucs2 0x016e),(_ucs2 0x016f); +insert into t1 values (_ucs2 0x0170),(_ucs2 0x0171),(_ucs2 0x0172),(_ucs2 0x0173); +insert into t1 values (_ucs2 0x0174),(_ucs2 0x0175),(_ucs2 0x0176),(_ucs2 0x0177); +insert into t1 values (_ucs2 0x0178),(_ucs2 0x0179),(_ucs2 0x017a),(_ucs2 0x017b); +insert into t1 values (_ucs2 0x017c),(_ucs2 0x017d),(_ucs2 0x017e),(_ucs2 0x017f); +insert into t1 values (_ucs2 0x0180),(_ucs2 0x0181),(_ucs2 0x0182),(_ucs2 0x0183); +insert into t1 values (_ucs2 0x0184),(_ucs2 0x0185),(_ucs2 0x0186),(_ucs2 0x0187); +insert into t1 values (_ucs2 0x0188),(_ucs2 0x0189),(_ucs2 0x018a),(_ucs2 0x018b); +insert into t1 values (_ucs2 0x018c),(_ucs2 0x018d),(_ucs2 0x018e),(_ucs2 0x018f); +insert into t1 values (_ucs2 0x0190),(_ucs2 0x0191),(_ucs2 0x0192),(_ucs2 0x0193); +insert into t1 values (_ucs2 0x0194),(_ucs2 0x0195),(_ucs2 0x0196),(_ucs2 0x0197); +insert into t1 values (_ucs2 0x0198),(_ucs2 0x0199),(_ucs2 0x019a),(_ucs2 0x019b); +insert into t1 values (_ucs2 0x019c),(_ucs2 0x019d),(_ucs2 0x019e),(_ucs2 0x019f); +insert into t1 values (_ucs2 0x01a0),(_ucs2 0x01a1),(_ucs2 0x01a2),(_ucs2 0x01a3); +insert into t1 values (_ucs2 0x01a4),(_ucs2 0x01a5),(_ucs2 0x01a6),(_ucs2 0x01a7); +insert into t1 values (_ucs2 0x01a8),(_ucs2 0x01a9),(_ucs2 0x01aa),(_ucs2 0x01ab); +insert into t1 values (_ucs2 0x01ac),(_ucs2 0x01ad),(_ucs2 0x01ae),(_ucs2 0x01af); +insert into t1 values (_ucs2 0x01b0),(_ucs2 0x01b1),(_ucs2 0x01b2),(_ucs2 0x01b3); +insert into t1 values (_ucs2 0x01b4),(_ucs2 0x01b5),(_ucs2 0x01b6),(_ucs2 0x01b7); +insert into t1 values (_ucs2 0x01b8),(_ucs2 0x01b9),(_ucs2 0x01ba),(_ucs2 0x01bb); +insert into t1 values (_ucs2 0x01bc),(_ucs2 0x01bd),(_ucs2 0x01be),(_ucs2 0x01bf); +insert into t1 values (_ucs2 0x01c0),(_ucs2 0x01c1),(_ucs2 0x01c2),(_ucs2 0x01c3); +insert into t1 values (_ucs2 0x01c4),(_ucs2 0x01c5),(_ucs2 0x01c6),(_ucs2 0x01c7); +insert into t1 values (_ucs2 0x01c8),(_ucs2 0x01c9),(_ucs2 0x01ca),(_ucs2 0x01cb); +insert into t1 values (_ucs2 0x01cc),(_ucs2 0x01cd),(_ucs2 0x01ce),(_ucs2 0x01cf); +insert into t1 values (_ucs2 0x01d0),(_ucs2 0x01d1),(_ucs2 0x01d2),(_ucs2 0x01d3); +insert into t1 values (_ucs2 0x01d4),(_ucs2 0x01d5),(_ucs2 0x01d6),(_ucs2 0x01d7); +insert into t1 values (_ucs2 0x01d8),(_ucs2 0x01d9),(_ucs2 0x01da),(_ucs2 0x01db); +insert into t1 values (_ucs2 0x01dc),(_ucs2 0x01dd),(_ucs2 0x01de),(_ucs2 0x01df); +insert into t1 values (_ucs2 0x01e0),(_ucs2 0x01e1),(_ucs2 0x01e2),(_ucs2 0x01e3); +insert into t1 values (_ucs2 0x01e4),(_ucs2 0x01e5),(_ucs2 0x01e6),(_ucs2 0x01e7); +insert into t1 values (_ucs2 0x01e8),(_ucs2 0x01e9),(_ucs2 0x01ea),(_ucs2 0x01eb); +insert into t1 values (_ucs2 0x01ec),(_ucs2 0x01ed),(_ucs2 0x01ee),(_ucs2 0x01ef); +insert into t1 values (_ucs2 0x01f0),(_ucs2 0x01f1),(_ucs2 0x01f2),(_ucs2 0x01f3); +insert into t1 values (_ucs2 0x01f4),(_ucs2 0x01f5),(_ucs2 0x01f6),(_ucs2 0x01f7); +insert into t1 values (_ucs2 0x01f8),(_ucs2 0x01f9),(_ucs2 0x01fa),(_ucs2 0x01fb); +insert into t1 values (_ucs2 0x01fc),(_ucs2 0x01fd),(_ucs2 0x01fe),(_ucs2 0x01ff); +INSERT INTO t1 VALUES (_ucs2 0x1EA0),(_ucs2 0x1EA1),(_ucs2 0x1EA2),(_ucs2 0x1EA3); +INSERT INTO t1 VALUES (_ucs2 0x1EA4),(_ucs2 0x1EA5),(_ucs2 0x1EA6),(_ucs2 0x1EA7); +INSERT INTO t1 VALUES (_ucs2 0x1EA8),(_ucs2 0x1EA9),(_ucs2 0x1EAA),(_ucs2 0x1EAB); +INSERT INTO t1 VALUES (_ucs2 0x1EAC),(_ucs2 0x1EAD),(_ucs2 0x1EAE),(_ucs2 0x1EAF); +INSERT INTO t1 VALUES (_ucs2 0x1EB0),(_ucs2 0x1EB1),(_ucs2 0x1EB2),(_ucs2 0x1EB3); +INSERT INTO t1 VALUES (_ucs2 0x1EB4),(_ucs2 0x1EB5),(_ucs2 0x1EB6),(_ucs2 0x1EB7); +INSERT INTO t1 VALUES (_ucs2 0x1EB8),(_ucs2 0x1EB9),(_ucs2 0x1EBA),(_ucs2 0x1EBB); +INSERT INTO t1 VALUES (_ucs2 0x1EBC),(_ucs2 0x1EBD),(_ucs2 0x1EBE),(_ucs2 0x1EBF); +INSERT INTO t1 VALUES (_ucs2 0x1EC0),(_ucs2 0x1EC1),(_ucs2 0x1EC2),(_ucs2 0x1EC3); +INSERT INTO t1 VALUES (_ucs2 0x1EC4),(_ucs2 0x1EC5),(_ucs2 0x1EC6),(_ucs2 0x1EC7); +INSERT INTO t1 VALUES (_ucs2 0x1EC8),(_ucs2 0x1EC9),(_ucs2 0x1ECA),(_ucs2 0x1ECB); +INSERT INTO t1 VALUES (_ucs2 0x1ECC),(_ucs2 0x1ECD),(_ucs2 0x1ECE),(_ucs2 0x1ECF); +INSERT INTO t1 VALUES (_ucs2 0x1ED0),(_ucs2 0x1ED1),(_ucs2 0x1ED2),(_ucs2 0x1ED3); +INSERT INTO t1 VALUES (_ucs2 0x1ED4),(_ucs2 0x1ED5),(_ucs2 0x1ED6),(_ucs2 0x1ED7); +INSERT INTO t1 VALUES (_ucs2 0x1ED8),(_ucs2 0x1ED9),(_ucs2 0x1EDA),(_ucs2 0x1EDB); +INSERT INTO t1 VALUES (_ucs2 0x1EDC),(_ucs2 0x1EDD),(_ucs2 0x1EDE),(_ucs2 0x1EDF); +INSERT INTO t1 VALUES (_ucs2 0x1EE0),(_ucs2 0x1EE1),(_ucs2 0x1EE2),(_ucs2 0x1EE3); +INSERT INTO t1 VALUES (_ucs2 0x1EE4),(_ucs2 0x1EE5),(_ucs2 0x1EE6),(_ucs2 0x1EE7); +INSERT INTO t1 VALUES (_ucs2 0x1EE8),(_ucs2 0x1EE9),(_ucs2 0x1EEA),(_ucs2 0x1EEB); +INSERT INTO t1 VALUES (_ucs2 0x1EEC),(_ucs2 0x1EED),(_ucs2 0x1EEE),(_ucs2 0x1EEF); +INSERT INTO t1 VALUES (_ucs2 0x1EF0),(_ucs2 0x1EF1); +insert into t1 values ('AA'),('Aa'),('aa'),('aA'); +insert into t1 values ('AE'),('Ae'),('ae'),('aE'); +insert into t1 values ('CH'),('Ch'),('ch'),('cH'); +insert into t1 values ('DZ'),('Dz'),('dz'),('dZ'); +insert into t1 values ('DŽ'),('Dž'),('dž'),('dŽ'); +insert into t1 values ('IJ'),('Ij'),('ij'),('iJ'); +insert into t1 values ('LJ'),('Lj'),('lj'),('lJ'); +insert into t1 values ('LL'),('Ll'),('ll'),('lL'); +insert into t1 values ('NJ'),('Nj'),('nj'),('nJ'); +insert into t1 values ('OE'),('Oe'),('oe'),('oE'); +insert into t1 values ('SS'),('Ss'),('ss'),('sS'); +insert into t1 values ('RR'),('Rr'),('rr'),('rR'); +INSERT INTO t1 VALUES ('a '); +SELECT c1, HEX(WEIGHT_STRING(c1 LEVEL 1)), HEX(WEIGHT_STRING(c1 LEVEL 2)) FROM t1 ORDER BY c1, BINARY c1; +c1 HEX(WEIGHT_STRING(c1 LEVEL 1)) HEX(WEIGHT_STRING(c1 LEVEL 2)) +÷ 0552 0020 +× 0553 0020 +A 120F 0020 +a 120F 0020 +à 120F 00200032 +á 120F 00200032 +À 120F 00200035 +à 120F 00200035 +Ä‚ 120F 00200037 +ă 120F 00200037 +Ắ 120F 002000370032 +ắ 120F 002000370032 +Ằ 120F 002000370035 +ằ 120F 002000370035 +Ẵ 120F 00200037004E +ẵ 120F 00200037004E +Ẳ 120F 002000370064 +ẳ 120F 002000370064 + 120F 0020003C +â 120F 0020003C +Ấ 120F 0020003C0032 +ấ 120F 0020003C0032 +Ầ 120F 0020003C0035 +ầ 120F 0020003C0035 +Ẫ 120F 0020003C004E +ẫ 120F 0020003C004E +Ẩ 120F 0020003C0064 +ẩ 120F 0020003C0064 +Ç 120F 00200041 +ÇŽ 120F 00200041 +Ã… 120F 00200043 +Ã¥ 120F 00200043 +Ǻ 120F 002000430032 +Ç» 120F 002000430032 +Ä 120F 00200047 +ä 120F 00200047 +Çž 120F 00200047005B +ÇŸ 120F 00200047005B +à 120F 0020004E +ã 120F 0020004E +Ç  120F 00200052005B +Ç¡ 120F 00200052005B +Ä„ 120F 00200059 +Ä… 120F 00200059 +Ä€ 120F 0020005B +Ä 120F 0020005B +Ả 120F 00200064 +ả 120F 00200064 +Ạ 120F 00200070 +ạ 120F 00200070 +Ặ 120F 002000700037 +ặ 120F 002000700037 +Ậ 120F 00200070003C +ậ 120F 00200070003C +a 120F020A 00200020 +AA 120F120F 00200020 +Aa 120F120F 00200020 +aA 120F120F 00200020 +aa 120F120F 00200020 +AE 120F126B 00200020 +Ae 120F126B 00200020 +aE 120F126B 00200020 +ae 120F126B 00200020 +Æ 120F126B 002001590020 +æ 120F126B 002001590020 +Ǽ 120F126B 0020015900200032 +ǽ 120F126B 0020015900200032 +Ç¢ 120F126B 002001590020005B +Ç£ 120F126B 002001590020005B +B 1225 0020 +b 1225 0020 +Æ€ 122D 0020 +Æ 1235 0020 +Æ‚ 1239 0020 +ƃ 1239 0020 +C 123D 0020 +c 123D 0020 +Ć 123D 00200032 +ć 123D 00200032 +Ĉ 123D 0020003C +ĉ 123D 0020003C +ÄŠ 123D 00200052 +Ä‹ 123D 00200052 +Ç 123D 00200056 +ç 123D 00200056 +cH 123D12D3 00200020 +ÄŒ 123E 0020 +Ä 123E 0020 +Ƈ 1246 0020 +ƈ 1246 0020 +D 1250 0020 +d 1250 0020 +ÄŽ 1250 00200041 +Ä 1250 00200041 +Ä 1250 0020007D +Ä‘ 1250 0020007D +à 1250 00200159 +ð 1250 00200159 +DZ 125014AD 00200020 +Dz 125014AD 00200020 +dZ 125014AD 00200020 +dz 125014AD 00200020 +DZ 125014AD 00200020 +Dz 125014AD 00200020 +dz 125014AD 00200020 +Ç„ 125014AD 002000200041 +Ç… 125014AD 002000200041 +dž 125014AD 002000200041 +DŽ 125014AE 00200020 +Dž 125014AE 00200020 +dŽ 125014AE 00200020 +dž 125014AE 00200020 +Ɖ 1258 0020 +ÆŠ 125C 0020 +Æ‹ 1261 0020 +ÆŒ 1261 0020 +E 126B 0020 +e 126B 0020 +É 126B 00200032 +é 126B 00200032 +È 126B 00200035 +è 126B 00200035 +Ä” 126B 00200037 +Ä• 126B 00200037 +Ê 126B 0020003C +ê 126B 0020003C +Ế 126B 0020003C0032 +ế 126B 0020003C0032 +Ề 126B 0020003C0035 +á» 126B 0020003C0035 +Ễ 126B 0020003C004E +á»… 126B 0020003C004E +Ể 126B 0020003C0064 +ể 126B 0020003C0064 +Äš 126B 00200041 +Ä› 126B 00200041 +Ë 126B 00200047 +ë 126B 00200047 +Ẽ 126B 0020004E +ẽ 126B 0020004E +Ä– 126B 00200052 +Ä— 126B 00200052 +Ę 126B 00200059 +Ä™ 126B 00200059 +Ä’ 126B 0020005B +Ä“ 126B 0020005B +Ẻ 126B 00200064 +ẻ 126B 00200064 +Ẹ 126B 00200070 +ẹ 126B 00200070 +Ệ 126B 00200070003C +ệ 126B 00200070003C +ÆŽ 1276 0020 +Ç 1276 0020 +Æ 127B 0020 +Æ 1280 0020 +F 12A3 0020 +f 12A3 0020 +Æ‘ 12AA 0020 +Æ’ 12AA 0020 +G 12B0 0020 +g 12B0 0020 +Ç´ 12B0 00200032 +ǵ 12B0 00200032 +Äž 12B0 00200037 +ÄŸ 12B0 00200037 +Äœ 12B0 0020003C +Ä 12B0 0020003C +Ǧ 12B0 00200041 +ǧ 12B0 00200041 +Ä  12B0 00200052 +Ä¡ 12B0 00200052 +Ä¢ 12B0 00200056 +Ä£ 12B0 00200056 +Ǥ 12BC 0020 +Ç¥ 12BC 0020 +Æ“ 12C1 0020 +Æ” 12CB 0020 +Æ¢ 12CF 0020 +Æ£ 12CF 0020 +H 12D3 0020 +h 12D3 0020 +Ĥ 12D3 0020003C +Ä¥ 12D3 0020003C +Ħ 12D3 0020007D +ħ 12D3 0020007D +CH 12D4 0020 +Ch 12D4 0020 +ch 12D4 0020 +Æ• 12DB 0020 +Ƕ 12DB 0020 +I 12EC 0020 +i 12EC 0020 +à 12EC 00200032 +í 12EC 00200032 +ÃŒ 12EC 00200035 +ì 12EC 00200035 +Ĭ 12EC 00200037 +Ä­ 12EC 00200037 +ÃŽ 12EC 0020003C +î 12EC 0020003C +Ç 12EC 00200041 +Ç 12EC 00200041 +à 12EC 00200047 +ï 12EC 00200047 +Ĩ 12EC 0020004E +Ä© 12EC 0020004E +İ 12EC 00200052 +Ä® 12EC 00200059 +į 12EC 00200059 +Ī 12EC 0020005B +Ä« 12EC 0020005B +Ỉ 12EC 00200064 +ỉ 12EC 00200064 +Ị 12EC 00200070 +ị 12EC 00200070 +IJ 12EC1305 00200020 +Ij 12EC1305 00200020 +iJ 12EC1305 00200020 +ij 12EC1305 00200020 +IJ 12EC1305 00200020 +ij 12EC1305 00200020 +ı 12F0 0020 +Æ— 12FA 0020 +Æ– 1300 0020 +J 1305 0020 +j 1305 0020 +Ä´ 1305 0020003C +ĵ 1305 0020003C +ǰ 1305 00200041 +K 131E 0020 +k 131E 0020 +Ǩ 131E 00200041 +Ç© 131E 00200041 +Ķ 131E 00200056 +Ä· 131E 00200056 +Ƙ 1324 0020 +Æ™ 1324 0020 +L 1330 0020 +l 1330 0020 +Ĺ 1330 00200032 +ĺ 1330 00200032 +Ľ 1330 00200041 +ľ 1330 00200041 +Ä» 1330 00200056 +ļ 1330 00200056 +Å 1330 0020007D +Å‚ 1330 0020007D +Ä¿ 1330 00200159 +Å€ 1330 00200159 +LJ 13301305 00200020 +Lj 13301305 00200020 +lJ 13301305 00200020 +lj 13301305 00200020 +LJ 13301305 00200020 +Lj 13301305 00200020 +lj 13301305 00200020 +LL 13301330 00200020 +Ll 13301330 00200020 +lL 13301330 00200020 +ll 13301330 00200020 +Æš 133B 0020 +Æ› 1357 0020 +M 135F 0020 +m 135F 0020 +N 136D 0020 +n 136D 0020 +Ń 136D 00200032 +Å„ 136D 00200032 +Ǹ 136D 00200035 +ǹ 136D 00200035 +Ň 136D 00200041 +ň 136D 00200041 +Ñ 136D 0020004E +ñ 136D 0020004E +Å… 136D 00200056 +ņ 136D 00200056 +NJ 136D1305 00200020 +Nj 136D1305 00200020 +nJ 136D1305 00200020 +nj 136D1305 00200020 +ÇŠ 136D1305 00200020 +Ç‹ 136D1305 00200020 +ÇŒ 136D1305 00200020 +Æ 1378 0020 +Æž 137C 0020 +ÅŠ 138A 0020 +Å‹ 138A 0020 +O 138E 0020 +o 138E 0020 +Ó 138E 00200032 +ó 138E 00200032 +Ã’ 138E 00200035 +ò 138E 00200035 +ÅŽ 138E 00200037 +Å 138E 00200037 +Ô 138E 0020003C +ô 138E 0020003C +á» 138E 0020003C0032 +ố 138E 0020003C0032 +á»’ 138E 0020003C0035 +ồ 138E 0020003C0035 +á»– 138E 0020003C004E +á»— 138E 0020003C004E +á»” 138E 0020003C0064 +ổ 138E 0020003C0064 +Ç‘ 138E 00200041 +Ç’ 138E 00200041 +Ö 138E 00200047 +ö 138E 00200047 +Å 138E 0020004D +Å‘ 138E 0020004D +Õ 138E 0020004E +õ 138E 0020004E +Ø 138E 00200054 +ø 138E 00200054 +Ǿ 138E 002000540032 +Ç¿ 138E 002000540032 +Ǫ 138E 00200059 +Ç« 138E 00200059 +Ǭ 138E 00200059005B +Ç­ 138E 00200059005B +ÅŒ 138E 0020005B +Å 138E 0020005B +Ỏ 138E 00200064 +á» 138E 00200064 +Æ  138E 00200068 +Æ¡ 138E 00200068 +Ớ 138E 002000680032 +á»› 138E 002000680032 +Ờ 138E 002000680035 +á» 138E 002000680035 +á»  138E 00200068004E +ỡ 138E 00200068004E +Ở 138E 002000680064 +ở 138E 002000680064 +Ợ 138E 002000680070 +ợ 138E 002000680070 +Ọ 138E 00200070 +á» 138E 00200070 +Ộ 138E 00200070003C +á»™ 138E 00200070003C +OE 138E126B 00200020 +Oe 138E126B 00200020 +oE 138E126B 00200020 +oe 138E126B 00200020 +Å’ 138E126B 002001590020 +Å“ 138E126B 002001590020 +Ɔ 139A 0020 +ÆŸ 13A5 0020 +P 13B3 0020 +p 13B3 0020 +Ƥ 13BC 0020 +Æ¥ 13BC 0020 +Q 13C8 0020 +q 13C8 0020 +ĸ 13D6 0020 +R 13DA 0020 +r 13DA 0020 +Å” 13DA 00200032 +Å• 13DA 00200032 +Å– 13DA 00200056 +Å— 13DA 00200056 +RR 13DA13DA 00200020 +Rr 13DA13DA 00200020 +rR 13DA13DA 00200020 +rr 13DA13DA 00200020 +Ř 13DB 0020 +Å™ 13DB 0020 +Ʀ 13DE 0020 +S 1410 0020 +s 1410 0020 +Åš 1410 00200032 +Å› 1410 00200032 +Åœ 1410 0020003C +Å 1410 0020003C +Åž 1410 00200056 +ÅŸ 1410 00200056 +Å¿ 1410 0020015A +SS 14101410 00200020 +Ss 14101410 00200020 +sS 14101410 00200020 +ss 14101410 00200020 +ß 14101410 002001590020 +Å  1411 0020 +Å¡ 1411 0020 +Æ© 1421 0020 +ƪ 1426 0020 +T 1433 0020 +t 1433 0020 +Ť 1433 00200041 +Å¥ 1433 00200041 +Å¢ 1433 00200056 +Å£ 1433 00200056 +ƾ 14331410 00200020 +Ŧ 1438 0020 +ŧ 1438 0020 +Æ« 143E 0020 +Ƭ 1442 0020 +Æ­ 1442 0020 +Æ® 1446 0020 +U 1453 0020 +u 1453 0020 +Ú 1453 00200032 +ú 1453 00200032 +Ù 1453 00200035 +ù 1453 00200035 +Ŭ 1453 00200037 +Å­ 1453 00200037 +Û 1453 0020003C +û 1453 0020003C +Ç“ 1453 00200041 +Ç” 1453 00200041 +Å® 1453 00200043 +ů 1453 00200043 +Ü 1453 00200047 +ü 1453 00200047 +Ç— 1453 002000470032 +ǘ 1453 002000470032 +Ç› 1453 002000470035 +Çœ 1453 002000470035 +Ç™ 1453 002000470041 +Çš 1453 002000470041 +Ç• 1453 00200047005B +Ç– 1453 00200047005B +Ű 1453 0020004D +ű 1453 0020004D +Ũ 1453 0020004E +Å© 1453 0020004E +Ų 1453 00200059 +ų 1453 00200059 +Ū 1453 0020005B +Å« 1453 0020005B +Ủ 1453 00200064 +á»§ 1453 00200064 +Ư 1453 00200068 +ư 1453 00200068 +Ứ 1453 002000680032 +ứ 1453 002000680032 +Ừ 1453 002000680035 +ừ 1453 002000680035 +á»® 1453 00200068004E +ữ 1453 00200068004E +Ử 1453 002000680064 +á»­ 1453 002000680064 +á»° 1453 002000680070 +á»± 1453 002000680070 +Ụ 1453 00200070 +ụ 1453 00200070 +Æœ 146D 0020 +Ʊ 1476 0020 +V 147B 0020 +v 147B 0020 +Ʋ 1482 0020 +W 148D 0020 +w 148D 0020 +Å´ 148D 0020003C +ŵ 148D 0020003C +X 1497 0020 +x 1497 0020 +Y 149C 0020 +y 149C 0020 +à 149C 00200032 +ý 149C 00200032 +Ŷ 149C 0020003C +Å· 149C 0020003C +ÿ 149C 00200047 +Ÿ 149C 00200047 +Ƴ 14A8 0020 +Æ´ 14A8 0020 +Z 14AD 0020 +z 14AD 0020 +Ź 14AD 00200032 +ź 14AD 00200032 +Å» 14AD 00200052 +ż 14AD 00200052 +Æ 14AD148D 00200020 +Ž 14AE 0020 +ž 14AE 0020 +Ƶ 14B2 0020 +ƶ 14B2 0020 +Æ· 14CA 0020 +Ç® 14CA 00200041 +ǯ 14CA 00200041 +Ƹ 14CF 0020 +ƹ 14CF 0020 +ƺ 14D4 0020 +Þ 14E0 0020 +þ 14E0 0020 +Æ¿ 14E6 0020 +Ç· 14E6 0020 +Æ» 14EF 0020 +Ƨ 14F6 0020 +ƨ 14F6 0020 +Ƽ 14FA 0020 +ƽ 14FA 0020 +Æ„ 14FE 0020 +Æ… 14FE 0020 +ʼn 150B136D 00200020 +Ç€ 1525 0020 +Ç 1529 0020 +Ç‚ 152D 0020 +ǃ 1531 0020 +SELECT c1, HEX(WEIGHT_STRING(c1 AS CHAR(3) LEVEL 1)), HEX(WEIGHT_STRING(c1 AS CHAR(3) LEVEL 2)) FROM t1 WHERE c1 BETWEEN 'a' AND 'aZ' ORDER BY c1, BINARY c1; +c1 HEX(WEIGHT_STRING(c1 AS CHAR(3) LEVEL 1)) HEX(WEIGHT_STRING(c1 AS CHAR(3) LEVEL 2)) +A 120F02000200 002000200020 +a 120F02000200 002000200020 +à 120F02000200 002000320020 +á 120F02000200 002000320020 +À 120F02000200 002000350020 +à 120F02000200 002000350020 +Ä‚ 120F02000200 002000370020 +ă 120F02000200 002000370020 +Ắ 120F02000200 002000370032 +ắ 120F02000200 002000370032 +Ằ 120F02000200 002000370035 +ằ 120F02000200 002000370035 +Ẵ 120F02000200 00200037004E +ẵ 120F02000200 00200037004E +Ẳ 120F02000200 002000370064 +ẳ 120F02000200 002000370064 + 120F02000200 0020003C0020 +â 120F02000200 0020003C0020 +Ấ 120F02000200 0020003C0032 +ấ 120F02000200 0020003C0032 +Ầ 120F02000200 0020003C0035 +ầ 120F02000200 0020003C0035 +Ẫ 120F02000200 0020003C004E +ẫ 120F02000200 0020003C004E +Ẩ 120F02000200 0020003C0064 +ẩ 120F02000200 0020003C0064 +Ç 120F02000200 002000410020 +ÇŽ 120F02000200 002000410020 +Ã… 120F02000200 002000430020 +Ã¥ 120F02000200 002000430020 +Ǻ 120F02000200 002000430032 +Ç» 120F02000200 002000430032 +Ä 120F02000200 002000470020 +ä 120F02000200 002000470020 +Çž 120F02000200 00200047005B +ÇŸ 120F02000200 00200047005B +à 120F02000200 0020004E0020 +ã 120F02000200 0020004E0020 +Ç  120F02000200 00200052005B +Ç¡ 120F02000200 00200052005B +Ä„ 120F02000200 002000590020 +Ä… 120F02000200 002000590020 +Ä€ 120F02000200 0020005B0020 +Ä 120F02000200 0020005B0020 +Ả 120F02000200 002000640020 +ả 120F02000200 002000640020 +Ạ 120F02000200 002000700020 +ạ 120F02000200 002000700020 +Ặ 120F02000200 002000700037 +ặ 120F02000200 002000700037 +Ậ 120F02000200 00200070003C +ậ 120F02000200 00200070003C +a 120F020A0200 002000200020 +AA 120F120F0200 002000200020 +Aa 120F120F0200 002000200020 +aA 120F120F0200 002000200020 +aa 120F120F0200 002000200020 +AE 120F126B0200 002000200020 +Ae 120F126B0200 002000200020 +aE 120F126B0200 002000200020 +ae 120F126B0200 002000200020 +Æ 120F126B0200 002001590020 +æ 120F126B0200 002001590020 +Ǽ 120F126B0200 002001590020 +ǽ 120F126B0200 002001590020 +Ç¢ 120F126B0200 002001590020 +Ç£ 120F126B0200 002001590020 +DROP TABLE t1; +SELECT 'a' = 'a '; +'a' = 'a ' +0 +SELECT 'a' < 'á'; +'a' < 'á' +1 +SELECT 'áa' < 'ab'; +'áa' < 'ab' +1 +SELECT 'á' < 'ä'; +'á' < 'ä' +1 +SELECT 'äa' < 'áb'; +'äa' < 'áb' +1 +SELECT 'c' < 'Ä'; +'c' < 'Ä' +1 +SELECT 'cb' < 'Äa'; +'cb' < 'Äa' +1 +SELECT 'd' < 'Ä'; +'d' < 'Ä' +1 +SELECT 'Äa' < 'db'; +'Äa' < 'db' +1 +SELECT 'e' < 'é'; +'e' < 'é' +1 +SELECT 'éa' < 'eb'; +'éa' < 'eb' +1 +SELECT 'é' < 'Ä›'; +'é' < 'Ä›' +1 +SELECT 'Ä›a' < 'éb'; +'Ä›a' < 'éb' +1 +SELECT 'i' < 'í'; +'i' < 'í' +1 +SELECT 'ía' < 'ib'; +'ía' < 'ib' +1 +SELECT 'n' < 'ň'; +'n' < 'ň' +1 +SELECT 'ňa' < 'nb'; +'ňa' < 'nb' +1 +SELECT 'o' < 'ó'; +'o' < 'ó' +1 +SELECT 'óa' < 'ob'; +'óa' < 'ob' +1 +SELECT 'ó' < 'ö'; +'ó' < 'ö' +1 +SELECT 'öa' < 'ób'; +'öa' < 'ób' +1 +SELECT 'r' < 'Å™'; +'r' < 'Å™' +1 +SELECT 'rb' < 'Å™a'; +'rb' < 'Å™a' +1 +SELECT 's' < 'Å¡'; +'s' < 'Å¡' +1 +SELECT 'sb' < 'Å¡a'; +'sb' < 'Å¡a' +1 +SELECT 't' < 'Å¥'; +'t' < 'Å¥' +1 +SELECT 'Å¥a' < 'tb'; +'Å¥a' < 'tb' +1 +SELECT 'u' < 'ú'; +'u' < 'ú' +1 +SELECT 'úa' < 'ub'; +'úa' < 'ub' +1 +SELECT 'ú' < 'ů'; +'ú' < 'ů' +1 +SELECT 'ůa' < 'úb'; +'ůa' < 'úb' +1 +SELECT 'ů' < 'ü'; +'ů' < 'ü' +1 +SELECT 'üa' < 'ůb'; +'üa' < 'ůb' +1 +SELECT 'y' < 'ý'; +'y' < 'ý' +1 +SELECT 'ýa' < 'yb'; +'ýa' < 'yb' +1 +SELECT 'z' < 'ž'; +'z' < 'ž' +1 +SELECT 'zb' < 'ža'; +'zb' < 'ža' +1 +SELECT 'hž' < 'ch'; +'hž' < 'ch' +1 +SELECT 'chž'< 'i'; +'chž'< 'i' +1 +SELECT 'a' COLLATE utf8_czech_test_bad_w2; +ERROR HY000: Unknown collation: 'utf8_czech_test_bad_w2' diff --git a/mysql-test/r/ctype_like_range.result b/mysql-test/r/ctype_like_range.result index 176cfe3acf0..f8032d0ae86 100644 --- a/mysql-test/r/ctype_like_range.result +++ b/mysql-test/r/ctype_like_range.result @@ -4419,8 +4419,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `mn` varchar(10) DEFAULT LIKE_RANGE_MIN(a,10), - `mx` varchar(10) DEFAULT LIKE_RANGE_MAX(a,10) + `mn` varchar(10) DEFAULT like_range_min(`a`,10), + `mx` varchar(10) DEFAULT like_range_max(`a`,10) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('a'),('a_'),('a%'); SELECT a, HEX(mn), HEX(mx) FROM t1; diff --git a/mysql-test/r/ctype_tis620.result b/mysql-test/r/ctype_tis620.result index fd934600689..3dbccf9ccb0 100644 --- a/mysql-test/r/ctype_tis620.result +++ b/mysql-test/r/ctype_tis620.result @@ -3139,7 +3139,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a ')) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -3162,7 +3162,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -3185,7 +3185,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -3208,7 +3208,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; # # MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' @@ -3230,7 +3230,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a ')))) +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a ' DROP TABLE t1; # # End of MDEV-8694 @@ -3355,7 +3355,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a ')) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -3378,7 +3378,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -3401,7 +3401,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -3424,7 +3424,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; # # MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' @@ -3446,7 +3446,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a ')))) +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a ' DROP TABLE t1; # # End of MDEV-8694 diff --git a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result index cade3e4cd75..3d93d7f201e 100644 --- a/mysql-test/r/ctype_uca.result +++ b/mysql-test/r/ctype_uca.result @@ -8468,7 +8468,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a ')) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -8491,7 +8491,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -8514,7 +8514,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -8537,7 +8537,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; # # MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' @@ -8559,7 +8559,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((not((`test`.`t1`.`a` like 'a '))) and (`test`.`t1`.`a` = 'a')) +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` not like 'a ' and `test`.`t1`.`a` = 'a' DROP TABLE t1; # # End of MDEV-8694 @@ -8586,7 +8586,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE c1='ä' AND c1 LIKE 'ae'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((`test`.`t1`.`c1` = 'ä') and (`test`.`t1`.`c1` like 'ae')) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where `test`.`t1`.`c1` = 'ä' and `test`.`t1`.`c1` like 'ae' SELECT * FROM t1 WHERE CONCAT(c1)='ä'; c1 ä @@ -8599,7 +8599,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='ä' AND CONCAT(c1) LIKE 'ae' id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'ä') and (concat(`test`.`t1`.`c1`) like 'ae')) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'ä' and concat(`test`.`t1`.`c1`) like 'ae' DROP TABLE IF EXISTS t1; SET NAMES utf8 COLLATE utf8_german2_ci; # @@ -8626,7 +8626,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a ')) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -8649,7 +8649,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -8672,7 +8672,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -8695,7 +8695,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; # # MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' @@ -8717,7 +8717,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((not((`test`.`t1`.`a` like 'a '))) and (`test`.`t1`.`a` = 'a')) +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` not like 'a ' and `test`.`t1`.`a` = 'a' DROP TABLE t1; # # End of MDEV-8694 @@ -8746,7 +8746,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE c1='ä' AND c1 LIKE 'ae'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((`test`.`t1`.`c1` = 'ä') and (`test`.`t1`.`c1` like 'ae')) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where `test`.`t1`.`c1` = 'ä' and `test`.`t1`.`c1` like 'ae' SELECT * FROM t1 WHERE CONCAT(c1)='ä'; c1 ae @@ -8761,7 +8761,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='ä' AND CONCAT(c1) LIKE 'ae' id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'ä') and (concat(`test`.`t1`.`c1`) like 'ae')) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'ä' and concat(`test`.`t1`.`c1`) like 'ae' DROP TABLE IF EXISTS t1; # # MDEV-4929 Myanmar collation @@ -13944,12 +13944,12 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='oe' AND a='oe' COLLATE utf8_german2_c id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'oe') and (`test`.`t1`.`a` = 'oe')) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'oe' and `test`.`t1`.`a` = 'oe' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='oe' COLLATE utf8_german2_ci AND a='oe'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'oe') and (`test`.`t1`.`a` = 'oe')) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'oe' and `test`.`t1`.`a` = 'oe' DROP TABLE t1; # # End of MariaDB-10.0 tests diff --git a/mysql-test/r/ctype_uca_partitions.result b/mysql-test/r/ctype_uca_partitions.result index 11d4e82e27b..508893522e4 100644 --- a/mysql-test/r/ctype_uca_partitions.result +++ b/mysql-test/r/ctype_uca_partitions.result @@ -6,8 +6,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 3 */ + PARTITION BY KEY (c1) +PARTITIONS 3 INSERT INTO t1 VALUES ('A'),('À'),('Ã'),('Â'),('Ã'),('Ä'),('Ã…'); INSERT INTO t1 VALUES ('B'); INSERT INTO t1 VALUES ('C'); diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 0a75b11e064..0ac76e91c21 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -4478,11 +4478,11 @@ NULL id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Level Code Message -Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()` +Note 1003 select v_LastPaymentDate@0 < current_timestamp() AS `v_LastPaymentDate < NOW()` id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select concat(convert(v_LastPaymentDate@0 using ucs2),convert(now() using ucs2)) AS `CONCAT(v_LastPaymentDate, NOW())` +Note 1003 select concat(convert(v_LastPaymentDate@0 using ucs2),convert(current_timestamp() using ucs2)) AS `CONCAT(v_LastPaymentDate, NOW())` DROP PROCEDURE p1; # # Bug#52159 returning time type from function and empty left join causes debug assertion @@ -5386,7 +5386,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a ')) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -5409,7 +5409,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -5432,7 +5432,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -5455,7 +5455,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; # # MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' @@ -5477,7 +5477,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a ')))) +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a ' DROP TABLE t1; # # End of MDEV-8694 @@ -5507,7 +5507,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a ')) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -5530,7 +5530,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -5553,7 +5553,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -5576,7 +5576,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; # # MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' @@ -5598,7 +5598,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a ')))) +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a ' DROP TABLE t1; # # End of MDEV-8694 @@ -5646,7 +5646,7 @@ SELECT * FROM t1 WHERE COALESCE(c,0)='3 ' AND COALESCE(d,0)=COALESCE(c,0); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` where ((coalesce(`test`.`t1`.`c`,0) = '3 ') and (coalesce(`test`.`t1`.`d`,0) = '3 ')) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` where coalesce(`test`.`t1`.`c`,0) = '3 ' and coalesce(`test`.`t1`.`d`,0) = '3 ' DROP TABLE t1; # # MDEV-9178 Wrong result for CAST(CONVERT('1IJ3' USING ucs2) AS SIGNED) @@ -6222,5 +6222,68 @@ DROP TABLE t1; # SET STORAGE_ENGINE=Default; # +# MDEV-10585 EXECUTE IMMEDIATE statement +# +SET character_set_connection=ucs2; +EXECUTE IMMEDIATE 'SELECT COLLATION("a")'; +COLLATION("a") +ucs2_general_ci +SET @stmt='SELECT COLLATION("a")'; +EXECUTE IMMEDIATE @stmt; +COLLATION("a") +ucs2_general_ci +# +# MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions +# +SET NAMES utf8, collation_connection=ucs2_bin; +SET @stmt='SELECT COLLATION(''a'')'; +EXECUTE IMMEDIATE @stmt; +COLLATION('a') +ucs2_bin +SET NAMES utf8, character_set_connection=ucs2; +SET @stmt='SELECT COLLATION(''a'')'; +EXECUTE IMMEDIATE @stmt; +COLLATION('a') +ucs2_general_ci +EXECUTE IMMEDIATE CONCAT('SELECT ''a'' FROM DUAL'); +a +a +SELECT HEX('aä') FROM DUAL; +HEX('aä') +006100E4 +EXECUTE IMMEDIATE 'SELECT HEX(''aä'') FROM DUAL'; +HEX('aä') +006100E4 +EXECUTE IMMEDIATE CONCAT('SELECT HEX(''aä'') FROM DUAL'); +HEX('aä') +006100E4 +EXECUTE IMMEDIATE CONCAT('SELECT HEX(''aä'') FROM ', 'DUAL'); +HEX('aä') +006100E4 +PREPARE stmt FROM 'SELECT HEX(''aä'') FROM DUAL'; +EXECUTE stmt; +HEX('aä') +006100E4 +DEALLOCATE PREPARE stmt; +SET @table='DUAL'; +SELECT HEX(@table); +HEX(@table) +004400550041004C +EXECUTE IMMEDIATE CONCAT('SELECT HEX(''aä'') FROM ', @table); +HEX('aä') +006100E4 +EXECUTE IMMEDIATE CONCAT('SELECT HEX(''aä'') FROM ', CONVERT(@table USING utf8)); +HEX('aä') +006100E4 +SET @stmt='SELECT HEX(''aä'') FROM DUAL'; +EXECUTE IMMEDIATE @stmt; +HEX('aä') +006100E4 +PREPARE stmt FROM @stmt; +EXECUTE stmt; +HEX('aä') +006100E4 +DEALLOCATE PREPARE stmt; +# # End of 10.2 tests # diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result index 9d96fa026e6..f5365dd0c31 100644 --- a/mysql-test/r/ctype_utf32.result +++ b/mysql-test/r/ctype_utf32.result @@ -1662,6 +1662,11 @@ CHAR_LENGTH(TRIM(BOTH 0x61 FROM _utf32 0x00000061)) SELECT CHAR_LENGTH(TRIM(BOTH 0x00 FROM _utf32 0x00000061)); CHAR_LENGTH(TRIM(BOTH 0x00 FROM _utf32 0x00000061)) 1 +select hex(lower(cast(0xffff0000 as char character set utf32))) as c; +c +0000003F0000003F0000003F0000003F +Warnings: +Warning 1300 Invalid utf32 character string: '\xFF\xFF\x00\x00' # # End of 5.5 tests # diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 5e76aa2c203..5410d803a3c 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -5320,11 +5320,11 @@ NULL id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Level Code Message -Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()` +Note 1003 select v_LastPaymentDate@0 < current_timestamp() AS `v_LastPaymentDate < NOW()` id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select concat(convert(v_LastPaymentDate@0 using utf8),now()) AS `CONCAT(v_LastPaymentDate, NOW())` +Note 1003 select concat(convert(v_LastPaymentDate@0 using utf8),current_timestamp()) AS `CONCAT(v_LastPaymentDate, NOW())` DROP PROCEDURE p1; # # Bug#52159 returning time type from function and empty left join causes debug assertion @@ -6248,6 +6248,32 @@ SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65537) AS data) AS sub; len 131074 # +# MDEV-10717 Assertion `!null_value' failed in virtual bool Item::send(Protocol*, String*) +# +CREATE TABLE t1 (i INT, KEY(i)); +INSERT INTO t1 VALUES (20081205),(20050327); +SELECT HEX(i), HEX(CHAR(i USING utf8)) FROM t1; +HEX(i) HEX(CHAR(i USING utf8)) +131F197 0131 +1326A35 01326A35 +Warnings: +Warning 1300 Invalid utf8 character string: 'F197' +SET sql_mode='STRICT_ALL_TABLES'; +SELECT HEX(i), HEX(CHAR(i USING utf8)) FROM t1; +HEX(i) HEX(CHAR(i USING utf8)) +131F197 NULL +1326A35 01326A35 +Warnings: +Warning 1300 Invalid utf8 character string: 'F197' +SELECT CHAR(i USING utf8) FROM t1; +CHAR(i USING utf8) +### +### +Warnings: +### 1300 Invalid utf8 character string: 'F197' +SET sql_mode=DEFAULT; +DROP TABLE t1; +# # End of 5.5 tests # # @@ -6797,7 +6823,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a ')) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -6820,7 +6846,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -6843,7 +6869,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -6866,7 +6892,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; # # MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' @@ -6888,7 +6914,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a ')))) +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a ' DROP TABLE t1; # # End of MDEV-8694 @@ -6918,7 +6944,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a ')) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -6941,7 +6967,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -6964,7 +6990,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; @@ -6987,7 +7013,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; # # MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' @@ -7009,7 +7035,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((not((`test`.`t1`.`a` like 'a '))) and (`test`.`t1`.`a` = 'a')) +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` not like 'a ' and `test`.`t1`.`a` = 'a' DROP TABLE t1; # # End of MDEV-8694 @@ -7036,7 +7062,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE c1='ä' AND c1 LIKE 'ae'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((`test`.`t1`.`c1` = 'ä') and (`test`.`t1`.`c1` like 'ae')) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where `test`.`t1`.`c1` = 'ä' and `test`.`t1`.`c1` like 'ae' SELECT * FROM t1 WHERE CONCAT(c1)='ä'; c1 ä @@ -7049,7 +7075,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='ä' AND CONCAT(c1) LIKE 'ae' id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'ä') and (concat(`test`.`t1`.`c1`) like 'ae')) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'ä' and concat(`test`.`t1`.`c1`) like 'ae' DROP TABLE IF EXISTS t1; # # MDEV-6666 Malformed result for CONCAT(utf8_column, binary_string) @@ -10256,7 +10282,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a,a)=(10,'1e1'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 10) and (`test`.`t1`.`a` = '1e1')) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 10 and `test`.`t1`.`a` = '1e1' DROP TABLE t1; # # MDEV-8688 Wrong result for SELECT..WHERE varchar_column IN (1,2,3) AND varchar_column=' 1'; @@ -10283,12 +10309,12 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2) AND a='1ë1'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '1ë1') and (`test`.`t1`.`a` in (1,2))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '1ë1' and `test`.`t1`.`a` in (1,2) EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,'x') AND a='1ë1'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '1ë1') and (`test`.`t1`.`a` in (1,2,'x'))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '1ë1' and `test`.`t1`.`a` in (1,2,'x') DROP TABLE IF EXISTS t1; # # MDEV-8816 Equal field propagation is not applied for WHERE varbinary_column>=_utf8'a' COLLATE utf8_swedish_ci AND varbinary_column='A'; @@ -10303,7 +10329,7 @@ SELECT * FROM t1 WHERE c>=_utf8'a' COLLATE utf8_general_ci AND c='A'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c` AS `c` from `test`.`t1` where (`test`.`t1`.`c` = 'A') +Note 1003 select `test`.`t1`.`c` AS `c` from `test`.`t1` where `test`.`t1`.`c` = 'A' DROP TABLE t1; # # MDEV-7231 Field ROUTINE_DEFINITION in INFORMATION_SCHEMA.`ROUTINES` contains broken procedure body when used shielding quotes inside. @@ -10515,7 +10541,7 @@ SET NAMES utf8; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(30) DEFAULT CONCAT('ß') + `a` varchar(30) DEFAULT concat('ß') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); SELECT HEX(a),a FROM t1; @@ -10528,9 +10554,9 @@ ALTER TABLE t1 ADD c VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(30) DEFAULT CONCAT('ß'), - `b` varchar(30) DEFAULT CONCAT('ß'), - `c` varchar(30) DEFAULT CONCAT('ß') + `a` varchar(30) DEFAULT concat('ß'), + `b` varchar(30) DEFAULT concat('ß'), + `c` varchar(30) DEFAULT concat('ß') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DELETE FROM t1; INSERT INTO t1 VALUES(); @@ -10551,7 +10577,7 @@ SET NAMES utf8; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(30) CHARACTER SET utf8 DEFAULT CONCAT('ß') + `a` varchar(30) CHARACTER SET utf8 DEFAULT concat('ß') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); SELECT HEX(a), a FROM t1; @@ -10563,7 +10589,7 @@ CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß')); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(30) DEFAULT CONCAT('ß') + `a` varchar(30) DEFAULT concat('ß') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); SELECT HEX(a) FROM t1; @@ -10575,7 +10601,7 @@ CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET utf8 DEFAULT CONCAT('ß')); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(30) CHARACTER SET utf8 DEFAULT CONCAT('ß') + `a` varchar(30) CHARACTER SET utf8 DEFAULT concat('ß') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); SELECT HEX(a) FROM t1; diff --git a/mysql-test/r/ctype_utf8mb4.result b/mysql-test/r/ctype_utf8mb4.result index c75b76964a2..23e6f0aec26 100644 --- a/mysql-test/r/ctype_utf8mb4.result +++ b/mysql-test/r/ctype_utf8mb4.result @@ -3359,6 +3359,26 @@ DFFFFFDFFFFF9CFFFF9DFFFF9EFFFF # Start of 10.0 tests # # +# MDEV-11343 LOAD DATA INFILE fails to load data with an escape character followed by a multi-byte character +# +CREATE TABLE t1 (a TEXT CHARACTER SET utf8mb4); +LOAD DATA INFILE '../../std_data/loaddata/mdev-11343.txt' INTO TABLE t1 CHARACTER SET utf8mb4; +SELECT HEX(a) FROM t1; +HEX(a) +C3A4 +C3A478 +78C3A4 +78C3A478 +EA99A0 +EA99A078 +78EA99A0 +78EA99A078 +F09F988E +F09F988E78 +78F09F988E +78F09F988E78 +DROP TABLE t1; +# # MDEV-6566 Different INSERT behaviour on bad bytes with and without character set conversion # # @@ -3404,9 +3424,6 @@ DROP TABLE t1; # End of 10.0 tests # # -# End of tests -# -# # Start of 10.1 tests # # @@ -4014,5 +4031,27 @@ DROP TABLE t1; # SET STORAGE_ENGINE=Default; # +# MDEV-10867 PREPARE..EXECUTE is not consistent about non-ASCII characters +# +SET NAMES utf8mb4; +SELECT '😎' AS c; +c +😎 +SET @src='SELECT ''😎'' AS c'; +PREPARE stmt FROM @src; +EXECUTE stmt; +c +😎 +EXECUTE IMMEDIATE @src; +c +😎 +PREPARE stmt FROM 'SELECT ''😎'' AS c'; +EXECUTE stmt; +c +😎 +EXECUTE IMMEDIATE 'SELECT ''😎'' AS c'; +c +😎 +# # End of 10.2 tests # diff --git a/mysql-test/r/debug_sync.result b/mysql-test/r/debug_sync.result index 8498a908000..bb9ae1a417d 100644 --- a/mysql-test/r/debug_sync.result +++ b/mysql-test/r/debug_sync.result @@ -265,17 +265,31 @@ connection default; DROP TABLE t1; SET DEBUG_SYNC= 'RESET'; DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INT); -LOCK TABLE t1 READ; +CREATE TABLE t1 (c1 INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1); +SELECT GET_LOCK('mysqltest_lock', 100); +GET_LOCK('mysqltest_lock', 100) +1 connect con1,localhost,root,,; +# Sending: +UPDATE t1 SET c1=GET_LOCK('mysqltest_lock', 100);; +connect con2,localhost,root,,; SET DEBUG_SYNC= 'wait_for_lock SIGNAL locked EXECUTE 2'; INSERT INTO t1 VALUES (1); connection default; SET DEBUG_SYNC= 'now WAIT_FOR locked'; -UNLOCK TABLES; +SELECT RELEASE_LOCK('mysqltest_lock'); +RELEASE_LOCK('mysqltest_lock') +1 connection con1; +# Reaping UPDATE +SELECT RELEASE_LOCK('mysqltest_lock'); +RELEASE_LOCK('mysqltest_lock') +1 +connection con2; retrieve INSERT result. disconnect con1; +disconnect con2; connection default; DROP TABLE t1; SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/r/default.result b/mysql-test/r/default.result index 386837a84bb..dc7a33d6b9c 100644 --- a/mysql-test/r/default.result +++ b/mysql-test/r/default.result @@ -223,6 +223,50 @@ NULL drop table t1, t2; # End of 5.0 tests # +# Start of 10.0 tests +# +# +# MDEV-11265 Access defied when CREATE VIIEW v1 AS SELECT DEFAULT(column) FROM t1 +# +CREATE TABLE t1 (a INT DEFAULT 10); +INSERT INTO t1 VALUES (11); +CREATE VIEW v1 AS SELECT a AS a FROM t1; +CREATE VIEW v2 AS SELECT DEFAULT(a) AS a FROM t1; +CREATE VIEW v3 AS SELECT VALUES(a) AS a FROM t1; +SELECT * FROM v1; +a +11 +SELECT * FROM v2; +a +10 +SELECT * FROM v3; +a +NULL +UPDATE v2 SET a=123; +ERROR HY000: Column 'a' is not updatable +UPDATE v3 SET a=123; +ERROR HY000: Column 'a' is not updatable +DROP VIEW v3; +DROP VIEW v2; +DROP VIEW v1; +DROP TABLE t1; +# +# MDEV-10780 Server crashes in in create_tmp_table +# +connect con1,localhost,root,,test; +CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=MyISAM; +INSERT INTO t1 VALUES (); +INSERT INTO t1 VALUES (); +SELECT DISTINCT DEFAULT (pk) FROM t1 GROUP BY RAND() WITH ROLLUP; +DEFAULT (pk) +0 +disconnect con1; +connection default; +DROP TABLE t1; +# +# End of 10.0 tests +# +# # Start of 10.1 tests # CREATE TABLE t1 (a INT DEFAULT 100, b INT DEFAULT NULL); @@ -247,19 +291,19 @@ CREATE or replace TABLE t1 (event_time TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIM SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE or replace TABLE t1 (event_time TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(2) ON UPDATE CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(2) ON UPDATE CURRENT_TIMESTAMP(6) + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(2) ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE or replace TABLE t1 (event_time TIMESTAMP(6) NOT NULL DEFAULT SYSDATE(2) ON UPDATE CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `event_time` timestamp(6) NOT NULL DEFAULT SYSDATE(2) ON UPDATE CURRENT_TIMESTAMP(6) + `event_time` timestamp(6) NOT NULL DEFAULT sysdate(2) ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; # @@ -270,8 +314,8 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT 1, - `b` int(11) DEFAULT (a+1), - `c` int(11) DEFAULT (a+b) + `b` int(11) DEFAULT (`a` + 1), + `c` int(11) DEFAULT (`a` + `b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (); insert into t1 (a) values (2); @@ -301,8 +345,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` blob DEFAULT 1, - `c` blob DEFAULT "hello", - `t` text DEFAULT concat(a,b,c) + `c` blob DEFAULT 'hello', + `t` text DEFAULT concat(`a`,`b`,`c`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 (a) values (2); insert into t1 (a,b) values (10,"test1"); @@ -345,11 +389,11 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT 1, `c` int(11) DEFAULT -1, - `d` int(11) DEFAULT (1+1), - `e` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `f` int(11) DEFAULT (1+1+1), - `g` int(11) NOT NULL DEFAULT (1+1+1+1), - `h` int(11) DEFAULT (2+2+2+2) + `d` int(11) DEFAULT (1 + 1), + `e` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `f` int(11) DEFAULT (1 + 1 + 1), + `g` int(11) NOT NULL DEFAULT (1 + 1 + 1 + 1), + `h` int(11) DEFAULT (2 + 2 + 2 + 2) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 create table t2 like t1; show create table t2; @@ -358,11 +402,11 @@ t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT 1, `c` int(11) DEFAULT -1, - `d` int(11) DEFAULT (1+1), - `e` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `f` int(11) DEFAULT (1+1+1), - `g` int(11) NOT NULL DEFAULT (1+1+1+1), - `h` int(11) DEFAULT (2+2+2+2) + `d` int(11) DEFAULT (1 + 1), + `e` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `f` int(11) DEFAULT (1 + 1 + 1), + `g` int(11) NOT NULL DEFAULT (1 + 1 + 1 + 1), + `h` int(11) DEFAULT (2 + 2 + 2 + 2) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t2 (a) values (100); select a,b,c,d,e,f,g,h from t2; @@ -373,7 +417,7 @@ create table t1 (a int default (1----1), b int default - 1, c int default +1, e show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT (1----1), + `a` int(11) DEFAULT (1 - -1), `b` int(11) DEFAULT -1, `c` int(11) DEFAULT 1, `e` int(11) DEFAULT 1 @@ -542,11 +586,16 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; DEALLOCATE PREPARE stmt; -PREPARE stmt FROM 'CREATE TABLE t1 (a INT DEFAULT(?+?))'; +prepare stmt from 'create table t1 (a int default(?+?))'; set @a=1; execute stmt using @a,@a; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?+?)' at line 1 -DEALLOCATE PREPARE stmt; +deallocate prepare stmt; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT (1 + 1) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; # # Parenthesized Item_basic_constant # @@ -623,20 +672,20 @@ d03 DATETIME DEFAULT COALESCE(TIMESTAMP'2001-01-01 10:20:30') SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `i01` int(11) DEFAULT COALESCE(1), - `i02` int(11) DEFAULT COALESCE(0x3939), - `i03` int(11) DEFAULT COALESCE(1.0), - `i04` int(11) DEFAULT COALESCE(1e0), - `i05` int(11) DEFAULT COALESCE(NULL), - `f01` double DEFAULT COALESCE(PI()), - `s01` varchar(10) DEFAULT COALESCE(_latin1'test'), - `s02` varchar(10) DEFAULT COALESCE('test'), - `s03` varchar(10) DEFAULT COALESCE(0x40), - `s04` varchar(10) DEFAULT COALESCE(X'40'), - `s05` varchar(10) DEFAULT COALESCE(B'1000000'), - `d01` time DEFAULT COALESCE(TIME'10:20:30'), - `d02` date DEFAULT COALESCE(DATE'2001-01-01'), - `d03` datetime DEFAULT COALESCE(TIMESTAMP'2001-01-01 10:20:30') + `i01` int(11) DEFAULT coalesce(1), + `i02` int(11) DEFAULT coalesce(0x3939), + `i03` int(11) DEFAULT coalesce(1.0), + `i04` int(11) DEFAULT coalesce(1e0), + `i05` int(11) DEFAULT coalesce(NULL), + `f01` double DEFAULT coalesce(pi()), + `s01` varchar(10) DEFAULT coalesce(_latin1'test'), + `s02` varchar(10) DEFAULT coalesce('test'), + `s03` varchar(10) DEFAULT coalesce(0x40), + `s04` varchar(10) DEFAULT coalesce(X'40'), + `s05` varchar(10) DEFAULT coalesce(0x40), + `d01` time DEFAULT coalesce(TIME'10:20:30'), + `d02` date DEFAULT coalesce(DATE'2001-01-01'), + `d03` datetime DEFAULT coalesce(TIMESTAMP'2001-01-01 10:20:30') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (); SELECT * FROM t1; @@ -682,7 +731,7 @@ CREATE TABLE t1 (a INT DEFAULT COALESCE(1) NOT NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL DEFAULT COALESCE(1) + `a` int(11) NOT NULL DEFAULT coalesce(1) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; @@ -707,7 +756,7 @@ CREATE TABLE t1 (a INT DEFAULT CONCAT('1') NOT NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL DEFAULT CONCAT('1') + `a` int(11) NOT NULL DEFAULT concat('1') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; @@ -718,7 +767,7 @@ CREATE TABLE t1 (a INT DEFAULT COALESCE('1') NOT NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL DEFAULT COALESCE('1') + `a` int(11) NOT NULL DEFAULT coalesce('1') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; @@ -767,7 +816,7 @@ Note 1265 Data truncated for column 'a' at row 1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT CONCAT('1 ') + `a` int(11) DEFAULT concat('1 ') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); Warnings: @@ -782,7 +831,7 @@ Note 1265 Data truncated for column 'a' at row 1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT COALESCE('1 ') + `a` int(11) DEFAULT coalesce('1 ') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); Warnings: @@ -830,7 +879,7 @@ CREATE TABLE t1 (a VARCHAR(2) DEFAULT CONCAT(0x41) NOT NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(2) NOT NULL DEFAULT CONCAT(0x41) + `a` varchar(2) NOT NULL DEFAULT concat(0x41) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; @@ -841,7 +890,7 @@ CREATE TABLE t1 (a VARCHAR(2) DEFAULT COALESCE(0x41) NOT NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(2) NOT NULL DEFAULT COALESCE(0x41) + `a` varchar(2) NOT NULL DEFAULT coalesce(0x41) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; @@ -852,7 +901,7 @@ CREATE TABLE t1 (a VARCHAR(2) DEFAULT CONCAT(_utf8 0x41) NOT NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(2) NOT NULL DEFAULT CONCAT(_utf8 0x41) + `a` varchar(2) NOT NULL DEFAULT concat(_utf8'A') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; @@ -863,7 +912,7 @@ CREATE TABLE t1 (a VARCHAR(2) DEFAULT CONCAT(_utf8 X'41') NOT NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(2) NOT NULL DEFAULT CONCAT(_utf8 X'41') + `a` varchar(2) NOT NULL DEFAULT concat(_utf8'A') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; @@ -901,7 +950,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT a + `b` int(11) DEFAULT `a` ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (1, 1); INSERT INTO t1 VALUES (DEFAULT, DEFAULT); @@ -921,7 +970,7 @@ CREATE TABLE t1 (a INT DEFAULT(DEFAULT(b)), b INT DEFAULT 1); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT DEFAULT(b), + `a` int(11) DEFAULT default(`b`), `b` int(11) DEFAULT 1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT, DEFAULT); @@ -934,7 +983,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT 1, - `b` int(11) DEFAULT DEFAULT(a) + `b` int(11) DEFAULT default(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT, DEFAULT); SELECT * FROM t1; @@ -948,21 +997,21 @@ CREATE TABLE t1 (a DATETIME DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` datetime DEFAULT CURRENT_TIMESTAMP + `a` datetime DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIME DEFAULT CURRENT_TIME); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` time DEFAULT CURRENT_TIME + `a` time DEFAULT curtime() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a DATE DEFAULT CURRENT_DATE); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` date DEFAULT CURRENT_DATE + `a` date DEFAULT curdate() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; # @@ -972,7 +1021,7 @@ CREATE TABLE t1 (a DECIMAL(30,6) DEFAULT CURRENT_TIMESTAMP(6)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` decimal(30,6) DEFAULT CURRENT_TIMESTAMP(6) + `a` decimal(30,6) DEFAULT current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (); SELECT * FROM t1; @@ -983,7 +1032,7 @@ CREATE TABLE t1 (a DECIMAL(30,6) DEFAULT COALESCE(CURRENT_TIMESTAMP(6))); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` decimal(30,6) DEFAULT COALESCE(CURRENT_TIMESTAMP(6)) + `a` decimal(30,6) DEFAULT coalesce(current_timestamp(6)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES(); Warnings: @@ -1003,7 +1052,7 @@ CREATE TABLE t1 (a DECIMAL(30,6) DEFAULT COALESCE(CURRENT_TIME(6))); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` decimal(30,6) DEFAULT COALESCE(CURRENT_TIME(6)) + `a` decimal(30,6) DEFAULT coalesce(curtime(6)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES(); Warnings: @@ -1016,7 +1065,7 @@ CREATE TABLE t1 (a DECIMAL(30,6) DEFAULT COALESCE(CURRENT_DATE)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` decimal(30,6) DEFAULT COALESCE(CURRENT_DATE) + `a` decimal(30,6) DEFAULT coalesce(curdate()) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES(); Warnings: @@ -1029,21 +1078,21 @@ CREATE TABLE t1 (a TIMESTAMP DEFAULT COALESCE(CURRENT_TIMESTAMP)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT COALESCE(CURRENT_TIMESTAMP) + `a` timestamp NOT NULL DEFAULT coalesce(current_timestamp()) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a DATE DEFAULT COALESCE(CURRENT_DATE)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` date DEFAULT COALESCE(CURRENT_DATE) + `a` date DEFAULT coalesce(curdate()) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIME DEFAULT COALESCE(CURRENT_TIME)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` time DEFAULT COALESCE(CURRENT_TIME) + `a` time DEFAULT coalesce(curtime()) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 ( @@ -1053,8 +1102,8 @@ b TIMESTAMP DEFAULT COALESCE(CURRENT_TIMESTAMP(6)) SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `b` timestamp NOT NULL DEFAULT COALESCE(CURRENT_TIMESTAMP(6)) + `a` timestamp NOT NULL DEFAULT current_timestamp(), + `b` timestamp NOT NULL DEFAULT coalesce(current_timestamp(6)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (); SELECT CURRENT_TIMESTAMP(6); @@ -1071,8 +1120,8 @@ b DECIMAL(30,0) DEFAULT COALESCE(CURRENT_TIMESTAMP(6)) SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` decimal(30,0) DEFAULT CURRENT_TIMESTAMP(6), - `b` decimal(30,0) DEFAULT COALESCE(CURRENT_TIMESTAMP(6)) + `a` decimal(30,0) DEFAULT current_timestamp(6), + `b` decimal(30,0) DEFAULT coalesce(current_timestamp(6)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (); Warnings: @@ -1089,7 +1138,7 @@ CREATE TABLE `t1` (`a` int(11) DEFAULT (3+3),`b` int(11) DEFAULT '1000'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT (3+3), + `a` int(11) DEFAULT (3 + 3), `b` int(11) DEFAULT 1000 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,1),(2,2); @@ -1118,7 +1167,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(10,1) DEFAULT NULL, - `b` double DEFAULT (CAST(a AS DOUBLE)) + `b` double DEFAULT (cast(`a` as double)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (10.1, DEFAULT); SELECT * FROM t1; @@ -1130,9 +1179,9 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double DEFAULT EXP(a), - `c` double DEFAULT LOG(b), - `d` double DEFAULT LOG(4, b) + `b` double DEFAULT exp(`a`), + `c` double DEFAULT log(`b`), + `d` double DEFAULT log(4,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (2, DEFAULT, DEFAULT, DEFAULT); SELECT * FROM t1; @@ -1144,8 +1193,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` double DEFAULT LOG2(a), - `c` double DEFAULT LOG10(a) + `b` double DEFAULT log2(`a`), + `c` double DEFAULT log10(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (4, DEFAULT, DEFAULT); INSERT INTO t1 VALUES (100, DEFAULT, DEFAULT); @@ -1159,8 +1208,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double DEFAULT SQRT(a), - `c` double DEFAULT POW(a,3) + `b` double DEFAULT sqrt(`a`), + `c` double DEFAULT pow(`a`,3) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (4, DEFAULT, DEFAULT); SELECT * FROM t1; @@ -1172,9 +1221,9 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double DEFAULT ACOS(a), - `c` double DEFAULT ASIN(a), - `d` double DEFAULT ATAN(a) + `b` double DEFAULT acos(`a`), + `c` double DEFAULT asin(`a`), + `d` double DEFAULT atan(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (1, DEFAULT, DEFAULT, DEFAULT); SELECT a, b/PI(), c/PI(), d/PI() FROM t1; @@ -1186,10 +1235,10 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double DEFAULT COS(a), - `c` double DEFAULT SIN(a), - `d` double DEFAULT TAN(a), - `e` double DEFAULT COT(a) + `b` double DEFAULT cos(`a`), + `c` double DEFAULT sin(`a`), + `d` double DEFAULT tan(`a`), + `e` double DEFAULT cot(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (PI()/3); SELECT ROUND(a,3), ROUND(b,3), ROUND(c,3), ROUND(d,3), ROUND(e,3) FROM t1; @@ -1200,7 +1249,7 @@ CREATE TABLE t1 (a DOUBLE DEFAULT RAND()); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` double DEFAULT RAND() + `a` double DEFAULT rand() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); DROP TABLE t1; @@ -1209,8 +1258,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double DEFAULT DEGREES(a), - `c` double DEFAULT RADIANS(b) + `b` double DEFAULT degrees(`a`), + `c` double DEFAULT radians(`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (PI(), DEFAULT, DEFAULT); SELECT * FROM t1; @@ -1225,7 +1274,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT INTERVAL(a, 10, 20, 30, 40) + `b` int(11) DEFAULT interval(`a`,10,20,30,40) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (34); SELECT * FROM t1; @@ -1238,7 +1287,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT (a DIV b) + `c` int(11) DEFAULT (`a` DIV `b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a, b) VALUES (13, 3); SELECT * FROM t1; @@ -1250,7 +1299,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT SIGN(a) + `b` int(11) DEFAULT sign(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (-10),(0), (10); SELECT * FROM t1; @@ -1264,7 +1313,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, - `b` int(11) DEFAULT FIELD(a, 'Hej', 'ej', 'Heja', 'hej', 'foo') + `b` int(11) DEFAULT field(`a`,'Hej','ej','Heja','hej','foo') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('ej'); SELECT * FROM t1; @@ -1276,7 +1325,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, - `b` int(11) DEFAULT FIND_IN_SET(a, 'Hej,ej,Heja,hej,foo') + `b` int(11) DEFAULT find_in_set(`a`,'Hej,ej,Heja,hej,foo') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('ej'); SELECT * FROM t1; @@ -1288,8 +1337,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, - `b` int(11) DEFAULT ASCII(a), - `c` int(11) DEFAULT ORD(a) + `b` int(11) DEFAULT ascii(`a`), + `c` int(11) DEFAULT ord(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('a'); SELECT * FROM t1; @@ -1300,7 +1349,7 @@ CREATE TABLE t1 (a TEXT DEFAULT UUID_SHORT()); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` text DEFAULT UUID_SHORT() + `a` text DEFAULT uuid_short() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (); SELECT a>0 FROM t1; @@ -1339,7 +1388,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` date DEFAULT (DATE_ADD(a, INTERVAL b DAY)) + `c` date DEFAULT (`a` + interval `b` day) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('2001-01-01', 30, DEFAULT); SELECT * FROM t1; @@ -1352,7 +1401,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` time DEFAULT NULL, - `c` datetime DEFAULT ADDTIME(a, b) + `c` datetime DEFAULT addtime(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('2001-01-01', '10:20:30', DEFAULT); SELECT * FROM t1; @@ -1365,7 +1414,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(32) DEFAULT NULL, `b` varchar(32) DEFAULT NULL, - `c` date DEFAULT STR_TO_DATE(a,b) + `c` date DEFAULT str_to_date(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('01,5,2013','%d,%m,%Y', DEFAULT); SELECT * FROM t1; @@ -1379,8 +1428,8 @@ CREATE TABLE t1 (a DATE DEFAULT CURDATE(), b DATE DEFAULT UTC_DATE()); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` date DEFAULT CURDATE(), - `b` date DEFAULT UTC_DATE() + `a` date DEFAULT curdate(), + `b` date DEFAULT utc_date() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (); SELECT * FROM t1; @@ -1393,7 +1442,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` date DEFAULT FROM_DAYS(a) + `b` date DEFAULT from_days(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (730669, DEFAULT); SELECT * FROM t1; @@ -1405,7 +1454,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` date DEFAULT LAST_DAY(a) + `b` date DEFAULT last_day(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('2003-02-05', DEFAULT); SELECT * FROM t1; @@ -1418,7 +1467,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `yy` int(11) DEFAULT NULL, `yd` int(11) DEFAULT NULL, - `d` date DEFAULT MAKEDATE(yy, yd) + `d` date DEFAULT makedate(`yy`,`yd`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (2011,32,DEFAULT); SELECT * FROM t1; @@ -1432,8 +1481,8 @@ CREATE TABLE t1 (a TIME DEFAULT CURTIME(), b TIME DEFAULT UTC_TIME()); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` time DEFAULT CURTIME(), - `b` time DEFAULT UTC_TIME() + `a` time DEFAULT curtime(), + `b` time DEFAULT utc_time() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (); SELECT * FROM t1; @@ -1446,7 +1495,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` time DEFAULT SEC_TO_TIME(a) + `b` time DEFAULT sec_to_time(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (2378, DEFAULT); SELECT * FROM t1; @@ -1459,7 +1508,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime DEFAULT NULL, - `c` time DEFAULT TIMEDIFF(a,b) + `c` time DEFAULT timediff(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('2000:01:01 00:00:00', '2000:01:02 10:20:30', DEFAULT); SELECT * FROM t1; @@ -1473,7 +1522,7 @@ t1 CREATE TABLE `t1` ( `hh` int(11) DEFAULT NULL, `mm` int(11) DEFAULT NULL, `ss` int(11) DEFAULT NULL, - `t` time DEFAULT MAKETIME(hh,mm,ss) + `t` time DEFAULT maketime(`hh`,`mm`,`ss`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (10,20,30,DEFAULT); SELECT * FROM t1; @@ -1487,8 +1536,8 @@ CREATE TABLE t1 (a TIMESTAMP DEFAULT NOW(), b TIMESTAMP DEFAULT UTC_TIMESTAMP()) SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `b` timestamp NOT NULL DEFAULT UTC_TIMESTAMP() + `a` timestamp NOT NULL DEFAULT current_timestamp(), + `b` timestamp NOT NULL DEFAULT utc_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (); SELECT * FROM t1; @@ -1500,9 +1549,9 @@ CREATE TABLE t1 (a TIMESTAMP(6) DEFAULT SYSDATE(6), s INT, b TIMESTAMP(6) DEFAUL SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(6) NOT NULL DEFAULT SYSDATE(6), + `a` timestamp(6) NOT NULL DEFAULT sysdate(6), `s` int(11) DEFAULT NULL, - `b` timestamp(6) NOT NULL DEFAULT SYSDATE(6) + `b` timestamp(6) NOT NULL DEFAULT sysdate(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT, SLEEP(0.1), DEFAULT); SELECT b>a FROM t1; @@ -1515,7 +1564,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` timestamp NOT NULL DEFAULT FROM_UNIXTIME(a) + `b` timestamp NOT NULL DEFAULT from_unixtime(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (1447430881, DEFAULT); SELECT * FROM t1; @@ -1527,8 +1576,8 @@ CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP DEFAULT CONVERT_TZ(a, '-10:00', '+10:0 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `b` timestamp NOT NULL DEFAULT CONVERT_TZ(a, '-10:00', '+10:00') + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `b` timestamp NOT NULL DEFAULT convert_tz(`a`,'-10:00','+10:00') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('2001-01-01 10:20:30', DEFAULT); SELECT * FROM t1; @@ -1541,7 +1590,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` date DEFAULT CAST(a AS DATE) + `b` date DEFAULT cast(`a` as date) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (20010203, DEFAULT); SELECT * FROM t1; @@ -1553,7 +1602,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` time DEFAULT CAST(a AS TIME) + `b` time DEFAULT cast(`a` as time) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (102030, DEFAULT); SELECT * FROM t1; @@ -1565,7 +1614,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL, - `b` datetime DEFAULT CAST(a AS DATETIME) + `b` datetime DEFAULT cast(`a` as datetime) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (20010203102030, DEFAULT); SELECT * FROM t1; @@ -1581,7 +1630,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT PERIOD_ADD(a,b) + `c` int(11) DEFAULT period_add(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (200801, 2); SELECT * FROM t1; @@ -1594,7 +1643,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT PERIOD_DIFF(a,b) + `c` int(11) DEFAULT period_diff(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (200802, 200703); SELECT * FROM t1; @@ -1606,7 +1655,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT TO_DAYS(a) + `b` int(11) DEFAULT to_days(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (950501); SELECT * FROM t1; @@ -1618,7 +1667,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` int(11) DEFAULT TO_DAYS(a) + `b` int(11) DEFAULT to_days(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2007-10-07'); SELECT * FROM t1; @@ -1630,7 +1679,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` bigint(20) DEFAULT TO_SECONDS(a) + `b` bigint(20) DEFAULT to_seconds(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (950501); SELECT * FROM t1; @@ -1642,7 +1691,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` bigint(20) DEFAULT TO_SECONDS(a) + `b` bigint(20) DEFAULT to_seconds(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2009-11-29'); SELECT * FROM t1; @@ -1654,7 +1703,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` bigint(20) DEFAULT TO_SECONDS(a) + `b` bigint(20) DEFAULT to_seconds(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2009-11-29 13:43:32'); SELECT * FROM t1; @@ -1666,7 +1715,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` bigint(20) DEFAULT DAYOFMONTH(a) + `b` bigint(20) DEFAULT dayofmonth(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2007-02-03'); SELECT * FROM t1; @@ -1678,7 +1727,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` bigint(20) DEFAULT DAYOFWEEK(a) + `b` bigint(20) DEFAULT dayofweek(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2007-02-03'); SELECT * FROM t1; @@ -1690,7 +1739,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` bigint(20) DEFAULT DAYOFYEAR(a) + `b` bigint(20) DEFAULT dayofyear(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2007-02-03'); SELECT * FROM t1; @@ -1702,7 +1751,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, - `b` int(11) DEFAULT HOUR(a) + `b` int(11) DEFAULT hour(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('10:05:03'); SELECT * FROM t1; @@ -1714,7 +1763,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, - `b` int(11) DEFAULT MINUTE(a) + `b` int(11) DEFAULT minute(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('10:05:03'); SELECT * FROM t1; @@ -1726,7 +1775,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, - `b` int(11) DEFAULT SECOND(a) + `b` int(11) DEFAULT second(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('10:05:03'); SELECT * FROM t1; @@ -1738,7 +1787,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime(6) DEFAULT NULL, - `b` int(11) DEFAULT MICROSECOND(a) + `b` int(11) DEFAULT microsecond(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2009-12-31 23:59:59.000010'); SELECT * FROM t1; @@ -1750,7 +1799,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` int(11) DEFAULT YEAR(a) + `b` int(11) DEFAULT year(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('1987-01-01'); SELECT * FROM t1; @@ -1762,7 +1811,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` int(11) DEFAULT MONTH(a) + `b` int(11) DEFAULT month(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('1987-01-01'); SELECT * FROM t1; @@ -1774,7 +1823,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` int(11) DEFAULT WEEK(a) + `b` int(11) DEFAULT week(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('1987-02-01'); SELECT * FROM t1; @@ -1786,7 +1835,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` int(11) DEFAULT YEARWEEK(a) + `b` int(11) DEFAULT yearweek(`a`,0) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2000-01-01'); SELECT * FROM t1; @@ -1798,7 +1847,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` int(11) DEFAULT QUARTER(a) + `b` int(11) DEFAULT quarter(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2008-04-01'); SELECT * FROM t1; @@ -1810,7 +1859,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` int(11) DEFAULT EXTRACT(YEAR FROM a) + `b` int(11) DEFAULT extract(year from `a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2009-07-02'); SELECT * FROM t1; @@ -1822,7 +1871,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) DEFAULT EXTRACT(YEAR_MONTH FROM a) + `b` int(11) DEFAULT extract(year_month from `a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2009-07-02 01:02:03'); SELECT * FROM t1; @@ -1834,7 +1883,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) DEFAULT EXTRACT(DAY_MINUTE FROM a) + `b` int(11) DEFAULT extract(day_minute from `a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2009-07-02 01:02:03'); SELECT * FROM t1; @@ -1846,7 +1895,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime(6) DEFAULT NULL, - `b` int(11) DEFAULT EXTRACT(MICROSECOND FROM a) + `b` int(11) DEFAULT extract(microsecond from `a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2009-07-02 01:02:03.000123'); SELECT * FROM t1; @@ -1859,7 +1908,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` date DEFAULT NULL, - `c` int(11) DEFAULT TIMESTAMPDIFF(MONTH,a,b) + `c` int(11) DEFAULT timestampdiff(MONTH,`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES ('2003-02-01','2003-05-01'); SELECT * FROM t1; @@ -1872,7 +1921,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` date DEFAULT NULL, - `c` int(11) DEFAULT TIMESTAMPDIFF(YEAR,a,b) + `c` int(11) DEFAULT timestampdiff(YEAR,`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES ('2002-05-01','2001-01-01'); SELECT * FROM t1; @@ -1885,7 +1934,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` datetime DEFAULT NULL, - `c` int(11) DEFAULT TIMESTAMPDIFF(MINUTE,a,b) + `c` int(11) DEFAULT timestampdiff(MINUTE,`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES ('2003-02-01','2003-05-01 12:05:55'); SELECT * FROM t1; @@ -1901,7 +1950,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT COALESCE(a,b) + `c` int(11) DEFAULT coalesce(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (NULL, 1, DEFAULT); SELECT * FROM t1; @@ -1914,7 +1963,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT IFNULL(a,b) + `c` int(11) DEFAULT ifnull(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (NULL, 2, DEFAULT); INSERT INTO t1 VALUES (1, 2, DEFAULT); @@ -1929,7 +1978,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT NULLIF(a,b) + `c` int(11) DEFAULT nullif(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (1, 1, DEFAULT); INSERT INTO t1 VALUES (1, 2, DEFAULT); @@ -1944,7 +1993,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT IF(a,b,2) + `c` int(11) DEFAULT if(`a`,`b`,2) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (0, 1, DEFAULT); INSERT INTO t1 VALUES (1, 1, DEFAULT); @@ -1959,7 +2008,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT (CASE WHEN a THEN b ELSE 2 END) + `c` int(11) DEFAULT (case when `a` then `b` else 2 end) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (0, 1, DEFAULT); INSERT INTO t1 VALUES (1, 1, DEFAULT); @@ -1973,13 +2022,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT (-a) + `b` int(11) DEFAULT (-`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT (-a) + `b` int(11) DEFAULT (-`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (10, DEFAULT); SELECT * FROM t1; @@ -1991,7 +2040,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT ABS(a) + `b` int(11) DEFAULT abs(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (-10, DEFAULT); SELECT * FROM t1; @@ -2003,9 +2052,9 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` int(11) DEFAULT CEILING(a), - `c` int(11) DEFAULT FLOOR(a), - `d` int(11) DEFAULT ROUND(a) + `b` int(11) DEFAULT ceiling(`a`), + `c` int(11) DEFAULT floor(`a`), + `d` int(11) DEFAULT round(`a`,0) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (1.5, DEFAULT, DEFAULT, DEFAULT); INSERT INTO t1 VALUES (-1.5, DEFAULT, DEFAULT, DEFAULT); @@ -2020,8 +2069,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT (a+b), - `d` int(11) DEFAULT (a-b) + `c` int(11) DEFAULT (`a` + `b`), + `d` int(11) DEFAULT (`a` - `b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (2, 1, DEFAULT, DEFAULT); SELECT * FROM t1; @@ -2034,18 +2083,18 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT (a*b), - `d` int(11) DEFAULT (a/b), - `e` int(11) DEFAULT (a MOD b) + `c` int(11) DEFAULT (`a` * `b`), + `d` int(11) DEFAULT (`a` / `b`), + `e` int(11) DEFAULT (`a` % `b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT (a*b), - `d` int(11) DEFAULT (a/b), - `e` int(11) DEFAULT (a MOD b) + `c` int(11) DEFAULT (`a` * `b`), + `d` int(11) DEFAULT (`a` / `b`), + `e` int(11) DEFAULT (`a` % `b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (7, 3, DEFAULT, DEFAULT, DEFAULT); SELECT * FROM t1; @@ -2058,7 +2107,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) DEFAULT UNIX_TIMESTAMP(a) + `b` int(11) DEFAULT unix_timestamp(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('2001-01-01 10:20:30', DEFAULT); SELECT * FROM t1; @@ -2071,7 +2120,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, - `b` int(11) DEFAULT TIME_TO_SEC(a) + `b` int(11) DEFAULT time_to_sec(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('22:23:00', DEFAULT); SELECT * FROM t1; @@ -2084,8 +2133,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT LEAST(a,b), - `d` int(11) DEFAULT GREATEST(a,b) + `c` int(11) DEFAULT least(`a`,`b`), + `d` int(11) DEFAULT greatest(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (0, 1, DEFAULT, DEFAULT); INSERT INTO t1 VALUES (1, 1, DEFAULT, DEFAULT); @@ -2100,7 +2149,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT LAST_VALUE(a,b) + `c` int(11) DEFAULT last_value(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (1, 2, DEFAULT); SELECT * FROM t1; @@ -2115,7 +2164,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, - `b` decimal(10,6) DEFAULT (CAST(a AS DECIMAL(10,1))) + `b` decimal(10,6) DEFAULT (cast(`a` as decimal(10,1))) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('123.456'); SELECT * FROM t1; @@ -2129,8 +2178,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(10,3) DEFAULT NULL, - `b` varchar(10) DEFAULT (CAST(a AS CHAR(10))), - `c` varchar(10) DEFAULT (CAST(a AS CHAR(4))) + `b` varchar(10) DEFAULT (cast(`a` as char(10) charset latin1)), + `c` varchar(10) DEFAULT (cast(`a` as char(4) charset latin1)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (123.456); Warnings: @@ -2144,7 +2193,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(10) unsigned DEFAULT (CAST(a AS UNSIGNED)) + `b` int(10) unsigned DEFAULT (cast(`a` as unsigned)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (-1); Warnings: @@ -2159,7 +2208,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) unsigned DEFAULT NULL, - `b` bigint(20) DEFAULT (CAST(a AS SIGNED)) + `b` bigint(20) DEFAULT (cast(`a` as signed)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (0xFFFFFFFFFFFFFFFF); SELECT * FROM t1; @@ -2176,9 +2225,9 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT a, - `c` varchar(10) CHARACTER SET utf8 DEFAULT CONVERT(a USING utf8), - `d` varbinary(10) DEFAULT (BINARY(a)) + `b` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT `a`, + `c` varchar(10) CHARACTER SET utf8 DEFAULT convert(`a` using utf8), + `d` varbinary(10) DEFAULT (cast(`a` as char charset binary)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('a'); SELECT * FROM t1; @@ -2193,7 +2242,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT BIT_COUNT(a) + `b` int(11) DEFAULT bit_count(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (7); SELECT * FROM t1; @@ -2206,7 +2255,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT (a|b) + `c` int(11) DEFAULT (`a` | `b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (1,2); SELECT * FROM t1; @@ -2219,7 +2268,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT (a&b) + `c` int(11) DEFAULT (`a` & `b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (5,4); SELECT * FROM t1; @@ -2232,7 +2281,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT (a^b) + `c` int(11) DEFAULT (`a` ^ `b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (11,3); SELECT * FROM t1; @@ -2245,7 +2294,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT (a&~b) + `c` int(11) DEFAULT (`a` & ~`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (5,1); SELECT * FROM t1; @@ -2258,8 +2307,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT (a<>b) + `c` int(11) DEFAULT (`a` << `b`), + `d` int(11) DEFAULT (`a` >> `b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (5,1); SELECT * FROM t1; @@ -2274,7 +2323,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(20) DEFAULT REVERSE(a) + `b` varchar(20) DEFAULT reverse(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('abcd'); SELECT * FROM t1; @@ -2286,8 +2335,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) DEFAULT UPPER(a), - `c` varchar(10) DEFAULT LOWER(a) + `b` varchar(10) DEFAULT ucase(`a`), + `c` varchar(10) DEFAULT lcase(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('ABcd'); SELECT * FROM t1; @@ -2299,9 +2348,9 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) DEFAULT LEFT(a,1), - `c` varchar(10) DEFAULT RIGHT(a,1), - `d` varchar(10) DEFAULT SUBSTR(a,2,2) + `b` varchar(10) DEFAULT left(`a`,1), + `c` varchar(10) DEFAULT right(`a`,1), + `d` varchar(10) DEFAULT substr(`a`,2,2) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('abcd'); SELECT * FROM t1; @@ -2313,7 +2362,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(20) DEFAULT NULL, - `b` varchar(20) DEFAULT SUBSTRING_INDEX(a,'.',2) + `b` varchar(20) DEFAULT substring_index(`a`,'.',2) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('www.mariadb.org'); SELECT * FROM t1; @@ -2326,7 +2375,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` varchar(20) DEFAULT CONCAT(a,b) + `c` varchar(20) DEFAULT concat(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES ('a','b'); SELECT * FROM t1; @@ -2339,7 +2388,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` varchar(20) DEFAULT CONCAT_WS(',',a,b) + `c` varchar(20) DEFAULT concat_ws(',',`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES ('a','b'); SELECT * FROM t1; @@ -2351,7 +2400,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) DEFAULT REPLACE(a,'a','A') + `b` varchar(10) DEFAULT replace(`a`,'a','A') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('abc'); SELECT * FROM t1; @@ -2363,7 +2412,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) DEFAULT REGEXP_REPLACE(a,'[0-9]','.') + `b` varchar(10) DEFAULT regexp_replace(`a`,'[0-9]','.') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('a1b2c'); SELECT * FROM t1; @@ -2375,7 +2424,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) DEFAULT REGEXP_SUBSTR(a,'[0-9]+') + `b` varchar(10) DEFAULT regexp_substr(`a`,'[0-9]+') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('ab12cd'); SELECT * FROM t1; @@ -2387,7 +2436,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(20) DEFAULT NULL, - `b` varchar(20) DEFAULT SOUNDEX(a) + `b` varchar(20) DEFAULT soundex(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('tester'); SELECT * FROM t1; @@ -2399,7 +2448,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(20) DEFAULT NULL, - `b` varchar(20) DEFAULT QUOTE(a) + `b` varchar(20) DEFAULT quote(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('a\'b'); SELECT * FROM t1; @@ -2411,8 +2460,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) DEFAULT LPAD(a,10,'.'), - `c` varchar(10) DEFAULT RPAD(a,10,'.') + `b` varchar(10) DEFAULT lpad(`a`,10,'.'), + `c` varchar(10) DEFAULT rpad(`a`,10,'.') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('ab'); SELECT * FROM t1; @@ -2424,8 +2473,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) DEFAULT LTRIM(a), - `c` varchar(10) DEFAULT RTRIM(a) + `b` varchar(10) DEFAULT ltrim(`a`), + `c` varchar(10) DEFAULT rtrim(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (' ab '); SELECT a, HEX(b), HEX(c) FROM t1; @@ -2437,7 +2486,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) DEFAULT TRIM(BOTH 'a' FROM a) + `b` varchar(10) DEFAULT trim(both 'a' from `a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('abba'); SELECT a, b FROM t1; @@ -2449,7 +2498,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` varchar(10) DEFAULT SPACE(a) + `b` varchar(10) DEFAULT space(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (3); SELECT a, HEX(b) FROM t1; @@ -2462,7 +2511,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` varchar(10) DEFAULT REPEAT(b,a) + `c` varchar(10) DEFAULT repeat(`b`,`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (3,'x'); SELECT a, b, c FROM t1; @@ -2477,7 +2526,7 @@ t1 CREATE TABLE `t1` ( `pos` int(11) DEFAULT NULL, `len` int(11) DEFAULT NULL, `newstr` varchar(10) DEFAULT NULL, - `result` varchar(10) DEFAULT INSERT(str,pos,len,newstr) + `result` varchar(10) DEFAULT insert(`str`,`pos`,`len`,`newstr`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (str,pos,len,newstr) VALUES ('Quadratic', 3, 4, 'What'); SELECT * FROM t1; @@ -2489,7 +2538,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `n` int(11) DEFAULT NULL, - `res` varchar(10) DEFAULT ELT(n,'ej', 'Heja', 'hej', 'foo') + `res` varchar(10) DEFAULT elt(`n`,'ej','Heja','hej','foo') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (n) VALUES (1); SELECT * FROM t1; @@ -2501,7 +2550,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `bits` int(11) DEFAULT NULL, - `res` varchar(10) DEFAULT MAKE_SET(bits,'a','b','c','d') + `res` varchar(10) DEFAULT make_set(`bits`,'a','b','c','d') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (bits) VALUES (1|4); SELECT * FROM t1; @@ -2513,7 +2562,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` varchar(10) DEFAULT CHAR(a) + `b` varchar(10) DEFAULT char(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (77); SELECT * FROM t1; @@ -2525,7 +2574,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` varchar(10) DEFAULT CONV(a,10,16) + `b` varchar(10) DEFAULT conv(`a`,10,16) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (64); SELECT * FROM t1; @@ -2538,7 +2587,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` varchar(30) DEFAULT FORMAT(a,b) + `c` varchar(30) DEFAULT format(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (10000,3); SELECT * FROM t1; @@ -2552,7 +2601,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `l` varchar(10) DEFAULT NULL, - `c` varchar(30) DEFAULT FORMAT(a,b,l) + `c` varchar(30) DEFAULT format(`a`,`b`,`l`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b,l) VALUES (10000,2,'no_NO'),(10000,2,'ru_RU'),(10000,2,'ar_BH'); SELECT * FROM t1; @@ -2566,7 +2615,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(20) DEFAULT GET_FORMAT(DATE,a) + `b` varchar(20) DEFAULT get_format(DATE, `a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('EUR'),('USA'),('JIS'),('ISO'),('INTERNAL'); SELECT * FROM t1; @@ -2593,7 +2642,7 @@ t1 CREATE TABLE `t1` ( `v_off` varchar(10) DEFAULT NULL, `v_separator` varchar(10) DEFAULT NULL, `number_of_bits` int(11) DEFAULT NULL, - `x` varchar(30) DEFAULT EXPORT_SET(bits, v_on, v_off, v_separator, number_of_bits) + `x` varchar(30) DEFAULT export_set(`bits`,`v_on`,`v_off`,`v_separator`,`number_of_bits`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (0x50006,'Y','N','',64,DEFAULT); Warnings: @@ -2612,7 +2661,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT (NOT a) + `b` int(11) DEFAULT (`a` = 0) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (NULL),(0),(1); SELECT * FROM t1; @@ -2627,7 +2676,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `x` int(11) DEFAULT (a XOR b) + `x` int(11) DEFAULT (`a` xor `b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (0,0),(0,1),(1,0),(1,1); SELECT * FROM t1; @@ -2642,8 +2691,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT (a IS TRUE), - `c` int(11) DEFAULT (a IS NOT TRUE) + `b` int(11) DEFAULT (`a` is true), + `c` int(11) DEFAULT (`a` is not true) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (NULL),(0),(1); SELECT * FROM t1; @@ -2657,8 +2706,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT (a IS FALSE), - `c` int(11) DEFAULT (a IS NOT FALSE) + `b` int(11) DEFAULT (`a` is false), + `c` int(11) DEFAULT (`a` is not false) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (NULL),(0),(1); SELECT * FROM t1; @@ -2672,8 +2721,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT (a IS NULL), - `c` int(11) DEFAULT (a IS NOT NULL) + `b` int(11) DEFAULT (`a` is null), + `c` int(11) DEFAULT (`a` is not null) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (NULL),(0),(1); SELECT * FROM t1; @@ -2687,8 +2736,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT (a IS UNKNOWN), - `c` int(11) DEFAULT (a IS NOT UNKNOWN) + `b` int(11) DEFAULT (`a` is null), + `c` int(11) DEFAULT (`a` is not null) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (NULL),(0),(1); SELECT * FROM t1; @@ -2706,13 +2755,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `eq` int(11) DEFAULT (a=0), - `equal` int(11) DEFAULT (a<=>0), - `ne` int(11) DEFAULT (a<>0), - `lt` int(11) DEFAULT (a<0), - `le` int(11) DEFAULT (a<=0), - `gt` int(11) DEFAULT (a>0), - `ge` int(11) DEFAULT (a>=0) + `eq` int(11) DEFAULT (`a` = 0), + `equal` int(11) DEFAULT (`a` <=> 0), + `ne` int(11) DEFAULT (`a` <> 0), + `lt` int(11) DEFAULT (`a` < 0), + `le` int(11) DEFAULT (`a` <= 0), + `gt` int(11) DEFAULT (`a` > 0), + `ge` int(11) DEFAULT (`a` >= 0) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (NULL),(-1),(0),(1); SELECT * FROM t1; @@ -2727,7 +2776,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) DEFAULT (a LIKE 'a%') + `b` int(11) DEFAULT (`a` like 'a%') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'); SELECT * FROM t1; @@ -2741,7 +2790,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) DEFAULT (a RLIKE 'a$') + `b` int(11) DEFAULT (`a` regexp 'a$') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'); SELECT * FROM t1; @@ -2755,7 +2804,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) DEFAULT (a IN ('aaa','bbb')) + `b` int(11) DEFAULT (`a` in ('aaa','bbb')) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'),('ccc'); SELECT * FROM t1; @@ -2770,7 +2819,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) DEFAULT (a NOT IN ('aaa','bbb')) + `b` int(11) DEFAULT (`a` not in ('aaa','bbb')) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'),('ccc'); SELECT * FROM t1; @@ -2785,7 +2834,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) DEFAULT (a BETWEEN 'aaa' AND 'bbb') + `b` int(11) DEFAULT (`a` between 'aaa' and 'bbb') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'),('ccc'); SELECT * FROM t1; @@ -2800,7 +2849,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) DEFAULT (a NOT BETWEEN 'aaa' AND 'bbb') + `b` int(11) DEFAULT (`a` not between 'aaa' and 'bbb') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'),('ccc'); SELECT * FROM t1; @@ -2814,7 +2863,7 @@ CREATE TABLE t1 (a TEXT DEFAULT UUID()); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` text DEFAULT UUID() + `a` text DEFAULT uuid() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (); SELECT LENGTH(a)>0 FROM t1; @@ -2829,7 +2878,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) DEFAULT STRCMP(a,'b') + `b` int(11) DEFAULT strcmp(`a`,'b') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('A'),('a'),('B'),('b'),('C'),('c'); SELECT * FROM t1; @@ -2846,9 +2895,9 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) DEFAULT LENGTH(a), - `c` int(11) DEFAULT CHAR_LENGTH(a), - `d` int(11) DEFAULT BIT_LENGTH(a) + `b` int(11) DEFAULT length(`a`), + `c` int(11) DEFAULT char_length(`a`), + `d` int(11) DEFAULT bit_length(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('a'),('aa'),('aaa'); SELECT * FROM t1; @@ -2862,7 +2911,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) DEFAULT LOCATE('a',a) + `b` int(11) DEFAULT locate('a',`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('xa'),('xxa'),('xxxa'); SELECT * FROM t1; @@ -2876,7 +2925,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) DEFAULT REGEXP_INSTR(a, 'a') + `b` int(11) DEFAULT regexp_instr(`a`,'a') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('xa'),('xxa'),('xxxa'); SELECT * FROM t1; @@ -2898,7 +2947,7 @@ CREATE TABLE t1 (a INT DEFAULT CONNECTION_ID()); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT CONNECTION_ID() + `a` int(11) DEFAULT connection_id() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES(); SELECT a>0 FROM t1; @@ -2910,8 +2959,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) DEFAULT COERCIBILITY(a), - `c` int(11) DEFAULT COERCIBILITY(b) + `b` int(11) DEFAULT coercibility(`a`), + `c` int(11) DEFAULT coercibility(`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('test'); SELECT * FROM t1; @@ -2930,8 +2979,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(20) DEFAULT CHARSET(a), - `c` varchar(20) DEFAULT COLLATION(a) + `b` varchar(20) DEFAULT charset(`a`), + `c` varchar(20) DEFAULT collation(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('test'); SELECT * FROM t1; @@ -2946,8 +2995,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` bigint(20) DEFAULT CRC32(a), - `c` text DEFAULT MD5(a) + `b` bigint(20) DEFAULT crc32(`a`), + `c` text DEFAULT md5(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('a'); SELECT * FROM t1; @@ -2959,8 +3008,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` text DEFAULT TO_BASE64(a), - `c` text DEFAULT FROM_BASE64(b) + `b` text DEFAULT to_base64(`a`), + `c` text DEFAULT from_base64(`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('aaaabbbb'); SELECT * FROM t1; @@ -2972,8 +3021,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` text DEFAULT HEX(a), - `c` text DEFAULT UNHEX(b) + `b` text DEFAULT hex(`a`), + `c` text DEFAULT unhex(`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('aaaabbbb'); SELECT * FROM t1; @@ -2985,8 +3034,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` text DEFAULT ENCODE(a,'test'), - `c` text DEFAULT DECODE(b,'test') + `b` text DEFAULT encode(`a`,'test'), + `c` text DEFAULT decode(`b`,'test') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('aaaabbbb'); SELECT a, HEX(b), c FROM t1; @@ -2998,7 +3047,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, - `b` text DEFAULT PASSWORD(a) + `b` text DEFAULT password(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('notagoodpwd'); SELECT * FROM t1; @@ -3014,8 +3063,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, - `b` blob DEFAULT AES_ENCRYPT(a, 'passwd'), - `c` text DEFAULT AES_DECRYPT(b, 'passwd') + `b` blob DEFAULT aes_encrypt(`a`,'passwd'), + `c` text DEFAULT aes_decrypt(`b`,'passwd') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('test'); SELECT c FROM t1; @@ -3047,7 +3096,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT 1, - `b` int(11) DEFAULT (1+1), + `b` int(11) DEFAULT (1 + 1), `c` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 alter table t1 alter a set default (2+3), alter b set default 4, @@ -3057,9 +3106,9 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT (2+3), + `a` int(11) DEFAULT (2 + 3), `b` int(11) DEFAULT 4, - `c` int(11) DEFAULT (-a) + `c` int(11) DEFAULT (-`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a int default 5 check (a>10), b int default (5+5), c int as (a+b)); @@ -3068,8 +3117,8 @@ create table t3 as select max(a), max(b), max(c) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` int(11) DEFAULT 5 CHECK (a>10), - `b` int(11) DEFAULT (5+5), + `a` int(11) DEFAULT 5 CHECK (`a` > 10), + `b` int(11) DEFAULT (5 + 5), `c` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show create table t3; @@ -3080,3 +3129,185 @@ t3 CREATE TABLE `t3` ( `max(c)` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1, t2, t3; +# MDEV-11359: Implement IGNORE for bulk operation +create table t1 (a int primary key default 0, b int default 3); +insert into t1 values (1, ignore); +insert into t1 values (2, ignore); +replace into t1 values (2, ignore); +replace into t1 values (3, ignore); +replace into t1 values (4, 6); +replace into t1 values (5, 7); +update t1 set a=6,b=ignore where a=5; +insert into t1 values (ignore, ignore); +insert into t1 values (ignore, ignore); +ERROR 23000: Duplicate entry '0' for key 'PRIMARY' +select * from t1 order by a; +a b +0 3 +1 3 +2 3 +3 3 +4 6 +6 7 +delete from t1 where a < 4; +# actually insert default instead of ignoring +# (but REPLACE is non standard operator) +replace into t1 values (4, ignore); +select * from t1 order by a; +a b +4 3 +6 7 +drop table t1; +create table t1 (a int default 100, b int, c varchar(60) default 'x'); +load data infile '../../std_data/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10, c=ignore; +select * from t1; +a b c +NULL 20 x +NULL 25 x +drop table t1; +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT); +CREATE TABLE t2 (a INT); +INSERT INTO t2 VALUES (1),(2),(3),(2); +INSERT INTO t1 SELECT a FROM t2 ON DUPLICATE KEY UPDATE a=DEFAULT; +SELECT * FROM t1 order by a; +a +0 +1 +3 +truncate table t1; +INSERT INTO t1 SELECT a FROM t2 ON DUPLICATE KEY UPDATE a=IGNORE; +SELECT * FROM t1 order by a; +a +0 +1 +3 +DROP TABLE t1,t2; +create table t1 (a int primary key default 0, b int default 3); +prepare insstmt from "insert into t1 values (?, ?)"; +prepare repstmt from "replace into t1 values (?, ?)"; +prepare updstmt from "update t1 set a=6,b=? where a=5"; +execute insstmt using 1, ignore; +execute insstmt using 2, ignore; +execute repstmt using 2, ignore; +execute repstmt using 3, ignore; +execute repstmt using 4, 6; +execute repstmt using 5, 7; +execute updstmt using ignore; +execute insstmt using ignore, ignore; +execute insstmt using ignore, ignore; +ERROR 23000: Duplicate entry '0' for key 'PRIMARY' +select * from t1 order by a; +a b +0 3 +1 3 +2 3 +3 3 +4 6 +6 7 +delete from t1 where a < 4; +execute repstmt using 4, ignore; +select * from t1 order by a; +a b +4 3 +6 7 +drop table t1; +# +# DEVAULT & PS adoption +# +CREATE TABLE t1 (a INT DEFAULT 10, b INT DEFAULT NULL); +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?,?)' USING IGNORE, IGNORE; +SELECT * FROM t1; +a b +10 NULL +UPDATE t1 SET a=20, b=30; +SELECT * FROM t1; +a b +20 30 +EXECUTE IMMEDIATE 'UPDATE t1 SET a=?,b=?' USING IGNORE, IGNORE; +SELECT * FROM t1; +a b +20 30 +DROP TABLE t1; +CREATE TABLE t1 (a INT DEFAULT 10); +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?+1)' USING IGNORE; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (CONCAT(?,?))' USING IGNORE, 'test'; +ERROR HY000: Default/ignore value is not supported for such parameter usage +DROP TABLE t1; +CREATE TABLE t1 (a INT DEFAULT 10); +INSERT INTO t1 VALUES (20); +EXECUTE IMMEDIATE 'UPDATE t1 SET a=?+1' USING IGNORE; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'UPDATE t1 SET a=CONCAT(?,?)' USING IGNORE, 'test'; +ERROR HY000: Default/ignore value is not supported for such parameter usage +DROP TABLE t1; +EXECUTE IMMEDIATE 'SELECT CAST(? AS SIGNED)' USING IGNORE; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT CAST(? AS DOUBLE)' USING IGNORE; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT CAST(? AS CHAR)' USING IGNORE; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT CAST(? AS DECIMAL(10,1))' USING IGNORE; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT CAST(? AS TIME)' USING IGNORE; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT CAST(? AS DATE)' USING IGNORE; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT CAST(? AS DATETIME)' USING IGNORE; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT ?+1' USING IGNORE; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT CONCAT(?,?)' USING IGNORE,'test'; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT 1 LIMIT ?' USING IGNORE; +ERROR HY000: Default/ignore value is not supported for such parameter usage +CREATE TABLE t1 (a INT DEFAULT 10); +INSERT INTO t1 VALUES (1),(2),(3); +EXECUTE IMMEDIATE 'SELECT * FROM t1 LIMIT ?' USING IGNORE; +ERROR HY000: Default/ignore value is not supported for such parameter usage +DROP TABLE t1; +# The output of this query in 'Note' is a syntactically incorrect query. +# But as it's never logged, it's ok. It should be human readable only. +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT ?' USING IGNORE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select ignore AS `?` +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>?+a' USING DEFAULT,DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +DROP TABLE t1; +# end of 10.2 test +set sql_mode=ansi_quotes; +create table t1 (a int, b int default (a+1)); +show create table t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" int(11) DEFAULT NULL, + "b" int(11) DEFAULT ("a" + 1) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert t1 (a) values (10); +set sql_mode=''; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT (`a` + 1) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert t1 (a) values (20); +flush tables; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT (`a` + 1) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert t1 (a) values (30); +select * from t1; +a b +10 11 +20 21 +30 31 +drop table t1; +set sql_mode=default; diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index 04cb8c4c3ad..9e550284163 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -632,7 +632,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DERIVED t1 system NULL NULL NULL NULL 1 100.00 Warnings: Note 1276 Field or reference 'sq.f2' of SELECT #3 was resolved in SELECT #1 -Note 1003 select 6 AS `f1` from (select `test`.`t2`.`f3` from `test`.`t2` having (`test`.`t2`.`f3` >= 8)) semi join (`test`.`t2`) where ((`test`.`t2`.`f3` = 6) and (``.`f3` = 9)) +Note 1003 select 6 AS `f1` from (select `test`.`t2`.`f3` from `test`.`t2` having `test`.`t2`.`f3` >= 8) semi join (`test`.`t2`) where `test`.`t2`.`f3` = 6 and ``.`f3` = 9 DROP TABLE t2,t1; # # MDEV-9462: Out of memory using explain on 2 empty tables @@ -955,6 +955,71 @@ id select_type table type possible_keys key key_len ref rows Extra DROP TABLES t1,t2; set optimizer_switch=@save_derived_optimizer_switch; # +# MDEV-10663: Use of Inline table columns in HAVING clause +# throws 1463 Error +# +set @save_sql_mode = @@sql_mode; +set sql_mode='ONLY_FULL_GROUP_BY,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; +CREATE TABLE `example1463` ( +`Customer` varchar(255) NOT NULL, +`DeliveryStatus` varchar(255) NOT NULL, +`OrderSize` int(11) NOT NULL +); +INSERT INTO example1463 VALUES ('Charlie', 'Success', 100); +INSERT INTO example1463 VALUES ('David', 'Success', 110); +INSERT INTO example1463 VALUES ('Charlie', 'Failed', 200); +INSERT INTO example1463 VALUES ('David', 'Success', 100); +INSERT INTO example1463 VALUES ('David', 'Unknown', 100); +INSERT INTO example1463 VALUES ('Edward', 'Success', 150); +INSERT INTO example1463 VALUES ('Edward', 'Pending', 150); +SELECT Customer, Success, SUM(OrderSize) +FROM (SELECT Customer, +CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success, +OrderSize +FROM example1463) as subQ +GROUP BY Success, Customer +WITH ROLLUP; +Customer Success SUM(OrderSize) +Charlie No 200 +David No 100 +Edward No 150 +NULL No 450 +Charlie Yes 100 +David Yes 210 +Edward Yes 150 +NULL Yes 460 +NULL NULL 910 +SELECT Customer, Success, SUM(OrderSize) +FROM (SELECT Customer, +CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success, +OrderSize +FROM example1463) as subQ +GROUP BY Success, Customer; +Customer Success SUM(OrderSize) +Charlie No 200 +David No 100 +Edward No 150 +Charlie Yes 100 +David Yes 210 +Edward Yes 150 +SELECT Customer, Success, SUM(OrderSize) +FROM (SELECT Customer, +CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success, +OrderSize +FROM example1463) as subQ +GROUP BY Success, Customer +HAVING Success IS NOT NULL; +Customer Success SUM(OrderSize) +Charlie No 200 +David No 100 +Edward No 150 +Charlie Yes 100 +David Yes 210 +Edward Yes 150 +DROP TABLE example1463; +set sql_mode= @save_sql_mode; +# end of 5.5 +# # Start of 10.1 tests # # diff --git a/mysql-test/r/derived_cond_pushdown.result b/mysql-test/r/derived_cond_pushdown.result index 3922a7d0360..0be577a9f64 100644 --- a/mysql-test/r/derived_cond_pushdown.result +++ b/mysql-test/r/derived_cond_pushdown.result @@ -133,16 +133,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(v1.max_c > 214)" + "attached_condition": "v1.max_c > 214" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(t2.a > v1.a)", + "attached_condition": "t2.a > v1.a", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((max_c < 707) and (max_c > 214))", + "having_condition": "max_c < 707 and max_c > 214", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -202,7 +202,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t2.a is not null)" + "attached_condition": "t2.a is not null" }, "table": { "table_name": "", @@ -214,11 +214,11 @@ EXPLAIN "ref": ["test.t2.a"], "rows": 2, "filtered": 100, - "attached_condition": "(v1.max_c > 300)", + "attached_condition": "v1.max_c > 300", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((max_c < 707) and (max_c > 300))", + "having_condition": "max_c < 707 and max_c > 300", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -288,16 +288,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.max_c > 400) or (v1.max_c < 135))" + "attached_condition": "v1.max_c > 400 or v1.max_c < 135" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(((v1.max_c > 400) and (t2.a > v1.a)) or ((v1.max_c < 135) and (t2.a < v1.a)))", + "attached_condition": "v1.max_c > 400 and t2.a > v1.a or v1.max_c < 135 and t2.a < v1.a", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((max_c < 707) and ((max_c > 400) or (max_c < 135)))", + "having_condition": "max_c < 707 and (max_c > 400 or max_c < 135)", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -356,16 +356,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.max_c > 300) or (v1.max_c < 135))" + "attached_condition": "v1.max_c > 300 or v1.max_c < 135" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(((v1.b = t2.b) and (v1.max_c > 300) and (v1.avg_c > t2.d)) or ((v1.a = t2.a) and (v1.max_c < 135) and (v1.max_c < t2.c)))", + "attached_condition": "v1.b = t2.b and v1.max_c > 300 and v1.avg_c > t2.d or v1.a = t2.a and v1.max_c < 135 and v1.max_c < t2.c", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((max_c < 707) and ((max_c > 300) or (max_c < 135)))", + "having_condition": "max_c < 707 and (max_c > 300 or max_c < 135)", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -413,16 +413,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(v1.a > 6)" + "attached_condition": "v1.a > 6" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(t2.b > v1.b)", + "attached_condition": "t2.b > v1.b", "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -431,7 +431,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a > 6)" + "attached_condition": "t1.a > 6" } } } @@ -480,16 +480,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(v2.b > 25)" + "attached_condition": "v2.b > 25" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(t2.a < v2.a)", + "attached_condition": "t2.a < v2.a", "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -498,7 +498,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a > 5) and (t1.b > 25))" + "attached_condition": "t1.a > 5 and t1.b > 25" } } } @@ -568,16 +568,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.a > 7) or (v1.a < 2))" + "attached_condition": "v1.a > 7 or v1.a < 2" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(((v1.a > 7) and (t2.c < v1.max_c)) or ((v1.a < 2) and (t2.b < v1.b)))", + "attached_condition": "v1.a > 7 and t2.c < v1.max_c or v1.a < 2 and t2.b < v1.b", "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -586,7 +586,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a > 7) or (t1.a < 2))" + "attached_condition": "t1.a > 7 or t1.a < 2" } } } @@ -649,16 +649,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v2.a > 7) or (v2.a > 5))" + "attached_condition": "v2.a > 7 or v2.a > 5" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(((v2.a > 7) and (t2.c < v2.max_c)) or ((v2.a > 5) and (t2.b < v2.b)))", + "attached_condition": "v2.a > 7 and t2.c < v2.max_c or v2.a > 5 and t2.b < v2.b", "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -667,7 +667,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a > 5) and ((t1.a > 7) or (t1.a > 5)))" + "attached_condition": "t1.a > 5 and (t1.a > 7 or t1.a > 5)" } } } @@ -716,16 +716,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.a > 4) or (v1.a < 2))" + "attached_condition": "v1.a > 4 or v1.a < 2" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(((v1.a > 4) and (v1.b > t2.b) and (v1.max_c = t2.d)) or ((v1.a < 2) and (v1.max_c < t2.c) and (v1.max_c = t2.d)))", + "attached_condition": "v1.a > 4 and v1.b > t2.b and v1.max_c = t2.d or v1.a < 2 and v1.max_c < t2.c and v1.max_c = t2.d", "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -734,7 +734,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a > 4) or (t1.a < 2))" + "attached_condition": "t1.a > 4 or t1.a < 2" } } } @@ -776,16 +776,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.a < 2) and (v1.max_c > 400))" + "attached_condition": "v1.a < 2 and v1.max_c > 400" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(t2.b > v1.b)", + "attached_condition": "t2.b > v1.b", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((max_c < 707) and (max_c > 400))", + "having_condition": "max_c < 707 and max_c > 400", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -794,7 +794,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a < 2)" + "attached_condition": "t1.a < 2" } } } @@ -840,7 +840,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t.a is not null)" + "attached_condition": "t.a is not null" }, "table": { "table_name": "", @@ -852,11 +852,11 @@ EXPLAIN "ref": ["test.t.a"], "rows": 2, "filtered": 100, - "attached_condition": "((v.avg_a > 0.45) and (v.b > 10))", + "attached_condition": "v.avg_a > 0.45 and v.b > 10", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((avg_a < 22.333) and (avg_a > 0.45))", + "having_condition": "avg_a < 22.333 and avg_a > 0.45", "filesort": { "sort_key": "t1_double.b, t1_double.c", "temporary_table": { @@ -865,7 +865,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "((t1_double.b > 12.2) and (t1_double.b > 10))" + "attached_condition": "t1_double.b > 12.2 and t1_double.b > 10" } } } @@ -899,7 +899,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t.a is not null)" + "attached_condition": "t.a is not null" }, "table": { "table_name": "", @@ -911,11 +911,11 @@ EXPLAIN "ref": ["test.t.a"], "rows": 2, "filtered": 100, - "attached_condition": "((v.avg_c > 15) and (v.b > 1))", + "attached_condition": "v.avg_c > 15 and v.b > 1", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((avg_c > 12) and (avg_c > 15))", + "having_condition": "avg_c > 12 and avg_c > 15", "filesort": { "sort_key": "t1_decimal.a, t1_decimal.b", "temporary_table": { @@ -924,7 +924,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t1_decimal.b > 1)" + "attached_condition": "t1_decimal.b > 1" } } } @@ -988,16 +988,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(((v1.a > 7) and (v1.max_c > 300)) or ((v1.a < 4) and (v1.max_c < 500)))" + "attached_condition": "v1.a > 7 and v1.max_c > 300 or v1.a < 4 and v1.max_c < 500" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(((v1.a > 7) and (v1.max_c > 300) and (t2.c < v1.max_c)) or ((v1.a < 4) and (v1.max_c < 500) and (t2.b < v1.b)))", + "attached_condition": "v1.a > 7 and v1.max_c > 300 and t2.c < v1.max_c or v1.a < 4 and v1.max_c < 500 and t2.b < v1.b", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((max_c < 707) and (((t1.a > 7) and (max_c > 300)) or ((t1.a < 4) and (max_c < 500))))", + "having_condition": "max_c < 707 and (t1.a > 7 and max_c > 300 or t1.a < 4 and max_c < 500)", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -1006,7 +1006,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a > 7) or (t1.a < 4))" + "attached_condition": "t1.a > 7 or t1.a < 4" } } } @@ -1077,16 +1077,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(((v1.a < 2) and (v1.max_c > 120)) or (v1.a > 7))" + "attached_condition": "v1.a < 2 and v1.max_c > 120 or v1.a > 7" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(((v1.a < 2) and (v1.max_c > 120)) or (v1.a > 7))", + "attached_condition": "v1.a < 2 and v1.max_c > 120 or v1.a > 7", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((max_c < 707) and (((t1.a < 2) and (max_c > 120)) or (t1.a > 7)))", + "having_condition": "max_c < 707 and (t1.a < 2 and max_c > 120 or t1.a > 7)", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -1095,7 +1095,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a < 2) or (t1.a > 7))" + "attached_condition": "t1.a < 2 or t1.a > 7" } } } @@ -1155,16 +1155,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(((v1.a < 2) and (v1.max_c > 120)) or (v1.a > 7))" + "attached_condition": "v1.a < 2 and v1.max_c > 120 or v1.a > 7" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(((v1.b = t2.b) and (v1.a < 2) and (v1.max_c > 120)) or (v1.a > 7))", + "attached_condition": "v1.b = t2.b and v1.a < 2 and v1.max_c > 120 or v1.a > 7", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((max_c < 707) and (((t1.a < 2) and (max_c > 120)) or (t1.a > 7)))", + "having_condition": "max_c < 707 and (t1.a < 2 and max_c > 120 or t1.a > 7)", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -1173,7 +1173,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a < 2) or (t1.a > 7))" + "attached_condition": "t1.a < 2 or t1.a > 7" } } } @@ -1222,16 +1222,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(((v1.a < 2) and (v1.max_c < 200)) or (v1.a > 4))" + "attached_condition": "v1.a < 2 and v1.max_c < 200 or v1.a > 4" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(((v1.a < 2) and (v1.max_c < 200) and (t2.c > v1.max_c) and (v1.max_c = t2.d)) or ((v1.max_c = t2.c) and (v1.a > 4) and (t2.c < 500) and (t2.b < v1.b)))", + "attached_condition": "v1.a < 2 and v1.max_c < 200 and t2.c > v1.max_c and v1.max_c = t2.d or v1.max_c = t2.c and v1.a > 4 and t2.c < 500 and t2.b < v1.b", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((max_c < 707) and (((t1.a < 2) and (max_c < 200)) or ((t1.a > 4) and (max_c < 500))))", + "having_condition": "max_c < 707 and (t1.a < 2 and max_c < 200 or t1.a > 4 and max_c < 500)", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -1240,7 +1240,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a < 2) or (t1.a > 4))" + "attached_condition": "t1.a < 2 or t1.a > 4" } } } @@ -1268,16 +1268,16 @@ a b max_c avg_c a b c d execute stmt; a b max_c avg_c a b c d 1 21 500 234.6000 2 3 207 207 -5 27 132 132.0000 2 3 207 207 -5 27 132 132.0000 1 21 909 12 1 21 500 234.6000 7 13 312 406 1 21 500 234.6000 8 64 248 107 1 21 500 234.6000 6 20 315 279 -5 27 132 132.0000 1 19 203 107 1 21 500 234.6000 8 80 800 314 1 21 500 234.6000 3 12 231 190 -5 27 132 132.0000 3 12 231 190 1 21 500 234.6000 6 23 303 909 +5 27 132 132.0000 2 3 207 207 +5 27 132 132.0000 1 21 909 12 +5 27 132 132.0000 1 19 203 107 +5 27 132 132.0000 3 12 231 190 deallocate prepare stmt; prepare stmt from "explain format=json select * from v1,t2 where @@ -1299,16 +1299,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.max_c > 400) or (v1.max_c < 135))" + "attached_condition": "v1.max_c > 400 or v1.max_c < 135" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(((v1.max_c > 400) and (t2.a > v1.a)) or ((v1.max_c < 135) and (t2.a < v1.a)))", + "attached_condition": "v1.max_c > 400 and t2.a > v1.a or v1.max_c < 135 and t2.a < v1.a", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((max_c < 707) and ((max_c > 400) or (max_c < 135)))", + "having_condition": "max_c < 707 and (max_c > 400 or max_c < 135)", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -1342,16 +1342,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.max_c > 400) or (v1.max_c < 135))" + "attached_condition": "v1.max_c > 400 or v1.max_c < 135" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(((v1.max_c > 400) and (t2.a > v1.a)) or ((v1.max_c < 135) and (t2.a < v1.a)))", + "attached_condition": "v1.max_c > 400 and t2.a > v1.a or v1.max_c < 135 and t2.a < v1.a", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((max_c < 707) and ((max_c > 400) or (max_c < 135)))", + "having_condition": "max_c < 707 and (max_c > 400 or max_c < 135)", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -1394,7 +1394,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "((t2.a = 1) and (t2.b is not null))" + "attached_condition": "t2.a = 1 and t2.b is not null" }, "table": { "table_name": "", @@ -1406,11 +1406,11 @@ EXPLAIN "ref": ["test.t2.b"], "rows": 2, "filtered": 100, - "attached_condition": "(v1.a = 1)", + "attached_condition": "v1.a = 1", "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.b", "temporary_table": { @@ -1419,7 +1419,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a = 1)" + "attached_condition": "t1.a = 1" } } } @@ -1449,7 +1449,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t2.d is not null)" + "attached_condition": "t2.d is not null" }, "table": { "table_name": "", @@ -1461,11 +1461,11 @@ EXPLAIN "ref": ["test.t2.d"], "rows": 2, "filtered": 100, - "attached_condition": "((v1.a = 5) and (v1.max_c = t2.d))", + "attached_condition": "v1.a = 5 and v1.max_c = t2.d", "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.b", "temporary_table": { @@ -1474,7 +1474,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a = 5)" + "attached_condition": "t1.a = 5" } } } @@ -1511,7 +1511,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "((t2.a < 5) and (t2.a is not null))" + "attached_condition": "t2.a < 5 and t2.a is not null" }, "table": { "table_name": "", @@ -1526,7 +1526,7 @@ EXPLAIN "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -1535,7 +1535,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a < 5)" + "attached_condition": "t1.a < 5" } } } @@ -1563,7 +1563,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "((t2.a is not null) and (t2.a is not null))" + "attached_condition": "t2.a is not null and t2.a is not null" }, "table": { "table_name": "", @@ -1578,7 +1578,7 @@ EXPLAIN "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -1587,7 +1587,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.b = t1.a)" + "attached_condition": "t1.b = t1.a" } } } @@ -1620,7 +1620,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "((t2.c > 150) and (t2.c is not null))" + "attached_condition": "t2.c > 150 and t2.c is not null" }, "table": { "table_name": "", @@ -1635,7 +1635,7 @@ EXPLAIN "materialized": { "query_block": { "select_id": 2, - "having_condition": "((max_c < 707) and (max_c > 150))", + "having_condition": "max_c < 707 and max_c > 150", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -1673,7 +1673,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t2.a = 3)" + "attached_condition": "t2.a = 3" }, "block-nl-join": { "table": { @@ -1681,7 +1681,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.a = 3) and (v1.b = 3))" + "attached_condition": "v1.a = 3 and v1.b = 3" }, "buffer_type": "flat", "buffer_size": "256Kb", @@ -1689,13 +1689,13 @@ EXPLAIN "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "table": { "table_name": "t1", "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a = 3) and (t1.b = 3))" + "attached_condition": "t1.a = 3 and t1.b = 3" } } } @@ -1723,7 +1723,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t2.a = 2)" + "attached_condition": "t2.a = 2" }, "block-nl-join": { "table": { @@ -1731,7 +1731,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.a = 1) and (v1.b = 21))" + "attached_condition": "v1.a = 1 and v1.b = 21" }, "buffer_type": "flat", "buffer_size": "256Kb", @@ -1739,13 +1739,13 @@ EXPLAIN "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "table": { "table_name": "t1", "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a = 1) and (t1.b = 21))" + "attached_condition": "t1.a = 1 and t1.b = 21" } } } @@ -1779,11 +1779,11 @@ EXPLAIN "access_type": "ALL", "rows": 12, "filtered": 100, - "attached_condition": "((v.a = 'c') and (v.b < 'Hermes'))", + "attached_condition": "v.a = 'c' and v.b < 'Hermes'", "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c < 9)", + "having_condition": "max_c < 9", "filesort": { "sort_key": "t1_char.b", "temporary_table": { @@ -1792,7 +1792,7 @@ EXPLAIN "access_type": "ALL", "rows": 12, "filtered": 100, - "attached_condition": "((t1_char.a = 'c') and (t1_char.b < 'Hermes'))" + "attached_condition": "t1_char.a = 'c' and t1_char.b < 'Hermes'" } } } @@ -1809,7 +1809,7 @@ EXPLAIN "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "((t.b = v.b) or (v.max_c > 20))" + "attached_condition": "t.b = v.b or v.max_c > 20" } } } @@ -1852,7 +1852,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(((t.b > 1) or (t.b = 1)) and (t.b is not null) and (t.b is not null))" + "attached_condition": "(t.b > 1 or t.b = 1) and t.b is not null and t.b is not null" }, "table": { "table_name": "", @@ -1867,7 +1867,7 @@ EXPLAIN "materialized": { "query_block": { "select_id": 2, - "having_condition": "(avg_c > 12)", + "having_condition": "avg_c > 12", "filesort": { "sort_key": "t1_decimal.a, t1_decimal.b", "temporary_table": { @@ -1876,7 +1876,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "((t1_decimal.b = t1_decimal.a) and ((t1_decimal.a > 1) or (t1_decimal.a = 1)))" + "attached_condition": "t1_decimal.b = t1_decimal.a and (t1_decimal.a > 1 or t1_decimal.a = 1)" } } } @@ -1921,7 +1921,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "((t2.a < 4) or (t2.c > 150))" + "attached_condition": "t2.a < 4 or t2.c > 150" }, "block-nl-join": { "table": { @@ -1933,11 +1933,11 @@ EXPLAIN "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(((v1.a = t2.a) and (t2.a < 4)) or ((v1.max_c = t2.c) and (t2.c > 150)))", + "attached_condition": "v1.a = t2.a and t2.a < 4 or v1.max_c = t2.c and t2.c > 150", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((max_c < 707) and ((t1.a < 4) or (max_c > 150)))", + "having_condition": "max_c < 707 and (t1.a < 4 or max_c > 150)", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -1980,7 +1980,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "((t2.a > 5) and (t2.c > 250) and (t2.a is not null) and (t2.c is not null))" + "attached_condition": "t2.a > 5 and t2.c > 250 and t2.a is not null and t2.c is not null" }, "table": { "table_name": "", @@ -1995,7 +1995,7 @@ EXPLAIN "materialized": { "query_block": { "select_id": 2, - "having_condition": "((max_c < 707) and (max_c > 250))", + "having_condition": "max_c < 707 and max_c > 250", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -2004,7 +2004,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a > 5)" + "attached_condition": "t1.a > 5" } } } @@ -2050,7 +2050,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t2.a = 8)" + "attached_condition": "t2.a = 8" }, "block-nl-join": { "table": { @@ -2058,7 +2058,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.a = 8) and (v1.max_c = 404))" + "attached_condition": "v1.a = 8 and v1.max_c = 404" }, "buffer_type": "flat", "buffer_size": "256Kb", @@ -2066,7 +2066,7 @@ EXPLAIN "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c = 404)", + "having_condition": "max_c = 404", "filesort": { "sort_key": "t1.b", "temporary_table": { @@ -2075,7 +2075,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a = 8)" + "attached_condition": "t1.a = 8" } } } @@ -2110,7 +2110,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t2.d is not null)" + "attached_condition": "t2.d is not null" }, "table": { "table_name": "", @@ -2122,11 +2122,11 @@ EXPLAIN "ref": ["test.t2.d"], "rows": 2, "filtered": 100, - "attached_condition": "((v1.a > 3) and (v1.max_c > 200) and (t2.b < v1.b) and (t2.d = v1.max_c))", + "attached_condition": "v1.a > 3 and v1.max_c > 200 and t2.b < v1.b and t2.d = v1.max_c", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((max_c < 707) and (max_c > 200))", + "having_condition": "max_c < 707 and max_c > 200", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -2135,7 +2135,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a > 3)" + "attached_condition": "t1.a > 3" } } } @@ -2170,7 +2170,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "((t.c is not null) and (t.c is not null))" + "attached_condition": "t.c is not null and t.c is not null" }, "table": { "table_name": "", @@ -2182,11 +2182,11 @@ EXPLAIN "ref": ["test.t.c", "test.t.c"], "rows": 2, "filtered": 100, - "attached_condition": "((t.c > 10) or (v.a = 1))", + "attached_condition": "t.c > 10 or v.a = 1", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((avg_a < 22.333) and ((t1_double.b > 10) or (t1_double.a = 1)))", + "having_condition": "avg_a < 22.333 and (t1_double.b > 10 or t1_double.a = 1)", "filesort": { "sort_key": "t1_double.b, t1_double.c", "temporary_table": { @@ -2195,7 +2195,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "((t1_double.c = t1_double.b) and (t1_double.b > 12.2))" + "attached_condition": "t1_double.c = t1_double.b and t1_double.b > 12.2" } } } @@ -2235,7 +2235,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "((t.c > 18) and (t.c is not null))" + "attached_condition": "t.c > 18 and t.c is not null" }, "table": { "table_name": "", @@ -2247,11 +2247,11 @@ EXPLAIN "ref": ["test.t.c"], "rows": 2, "filtered": 100, - "attached_condition": "((v.a > 0.2) or (v.b < 17) or (t.c > 17))", + "attached_condition": "v.a > 0.2 or v.b < 17 or t.c > 17", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((avg_a < 22.333) and ((t1_double.a > 0.2) or (t1_double.b < 17) or (t1_double.c > 17)))", + "having_condition": "avg_a < 22.333 and (t1_double.a > 0.2 or t1_double.b < 17 or t1_double.c > 17)", "filesort": { "sort_key": "t1_double.b, t1_double.c", "temporary_table": { @@ -2260,7 +2260,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "((t1_double.b > 12.2) and (t1_double.c > 18))" + "attached_condition": "t1_double.b > 12.2 and t1_double.c > 18" } } } @@ -2331,11 +2331,11 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(((v.a > 4) or (v.a = 2) or (v.b > 3)) and (v.avg_c = 13))", + "attached_condition": "(v.a > 4 or v.a = 2 or v.b > 3) and v.avg_c = 13", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((avg_c > 12) and (avg_c = 13))", + "having_condition": "avg_c > 12 and avg_c = 13", "filesort": { "sort_key": "t1_decimal.a, t1_decimal.b", "temporary_table": { @@ -2344,7 +2344,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "((t1_decimal.a > 4) or (t1_decimal.a = 2) or (t1_decimal.b > 3))" + "attached_condition": "t1_decimal.a > 4 or t1_decimal.a = 2 or t1_decimal.b > 3" } } } @@ -2395,7 +2395,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "((t2.a is not null) and (t2.a is not null))" + "attached_condition": "t2.a is not null and t2.a is not null" }, "table": { "table_name": "", @@ -2407,11 +2407,11 @@ EXPLAIN "ref": ["test.t2.a", "test.t2.a"], "rows": 2, "filtered": 100, - "attached_condition": "(v1.max_c > 300)", + "attached_condition": "v1.max_c > 300", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((max_c < 707) and (max_c > 300))", + "having_condition": "max_c < 707 and max_c > 300", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -2420,7 +2420,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.b = t1.a) and (t1.a > 5))" + "attached_condition": "t1.b = t1.a and t1.a > 5" } } } @@ -2461,7 +2461,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "((t2.a < 2) and (t2.c > 900))" + "attached_condition": "t2.a < 2 and t2.c > 900" }, "block-nl-join": { "table": { @@ -2476,7 +2476,7 @@ EXPLAIN "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -2518,7 +2518,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "((t2.a is not null) and (t2.b is not null))" + "attached_condition": "t2.a is not null and t2.b is not null" }, "table": { "table_name": "", @@ -2533,7 +2533,7 @@ EXPLAIN "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -2600,11 +2600,11 @@ EXPLAIN "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "((v1.a = t2.a) or ((v1.b = t2.b) and ((v1.a = 1) or (v1.a = 6))))", + "attached_condition": "v1.a = t2.a or v1.b = t2.b and (v1.a = 1 or v1.a = 6)", "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -2695,11 +2695,11 @@ EXPLAIN "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "((v1.a = 1) or (v1.b = 21) or (t2.a = 2))", + "attached_condition": "v1.a = 1 or v1.b = 21 or t2.a = 2", "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -2751,7 +2751,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "((t2.a < 2) and (t2.c > 900))" + "attached_condition": "t2.a < 2 and t2.c > 900" }, "block-nl-join": { "table": { @@ -2763,11 +2763,11 @@ EXPLAIN "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "((v1.a < t2.a) or (t2.a < 11))", + "attached_condition": "v1.a < t2.a or t2.a < 11", "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -2818,7 +2818,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "((t2.a is not null) and (t2.a is not null))" + "attached_condition": "t2.a is not null and t2.a is not null" }, "table": { "table_name": "", @@ -2833,7 +2833,7 @@ EXPLAIN "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -2858,11 +2858,11 @@ EXPLAIN "ref": ["test.t2.a"], "rows": 2, "filtered": 100, - "attached_condition": "(v2.b < 50)", + "attached_condition": "v2.b < 50", "materialized": { "query_block": { "select_id": 3, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -2871,7 +2871,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a > 5) and (t1.b < 50))" + "attached_condition": "t1.a > 5 and t1.b < 50" } } } @@ -2933,7 +2933,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t2.b < 50)" + "attached_condition": "t2.b < 50" }, "block-nl-join": { "table": { @@ -2945,11 +2945,11 @@ EXPLAIN "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(v1.b is not null)", + "attached_condition": "v1.b is not null", "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -2974,11 +2974,11 @@ EXPLAIN "ref": ["v1.b"], "rows": 2, "filtered": 100, - "attached_condition": "((v2.a = v1.a) or (v1.a = t2.a))", + "attached_condition": "v2.a = v1.a or v1.a = t2.a", "materialized": { "query_block": { "select_id": 3, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -2987,7 +2987,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a > 5)" + "attached_condition": "t1.a > 5" } } } @@ -3040,11 +3040,11 @@ EXPLAIN "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "((v1.a = t2.a) or (t2.c < 115))", + "attached_condition": "v1.a = t2.a or t2.c < 115", "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -3069,11 +3069,11 @@ EXPLAIN "buffer_type": "incremental", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(((v1.a = t2.a) and (v2.a = t2.a)) or ((v2.b > 13) and (t2.c < 115)))", + "attached_condition": "v1.a = t2.a and v2.a = t2.a or v2.b > 13 and t2.c < 115", "materialized": { "query_block": { "select_id": 3, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -3082,7 +3082,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a > 5)" + "attached_condition": "t1.a > 5" } } } @@ -3135,7 +3135,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(v1.max_c < 300)" + "attached_condition": "v1.max_c < 300" }, "buffer_type": "flat", "buffer_size": "256Kb", @@ -3143,7 +3143,7 @@ EXPLAIN "materialized": { "query_block": { "select_id": 2, - "having_condition": "((max_c < 707) and (max_c < 300))", + "having_condition": "max_c < 707 and max_c < 300", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -3164,16 +3164,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v2.b < 50) or (v2.b = 19))" + "attached_condition": "v2.b < 50 or v2.b = 19" }, "buffer_type": "incremental", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(((v2.a = v1.a) or (v1.a = t2.a)) and ((v2.b < 50) or (v2.b = 19)))", + "attached_condition": "(v2.a = v1.a or v1.a = t2.a) and (v2.b < 50 or v2.b = 19)", "materialized": { "query_block": { "select_id": 3, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -3182,7 +3182,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a > 5) and ((t1.b < 50) or (t1.b = 19)))" + "attached_condition": "t1.a > 5 and (t1.b < 50 or t1.b = 19)" } } } @@ -3219,7 +3219,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "((t2.a is not null) and (t2.a is not null) and (t2.a is not null))" + "attached_condition": "t2.a is not null and t2.a is not null and t2.a is not null" }, "table": { "table_name": "", @@ -3234,7 +3234,7 @@ EXPLAIN "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -3243,7 +3243,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.b = t1.a)" + "attached_condition": "t1.b = t1.a" } } } @@ -3260,11 +3260,11 @@ EXPLAIN "ref": ["test.t2.a"], "rows": 2, "filtered": 100, - "attached_condition": "(v2.max_c < 300)", + "attached_condition": "v2.max_c < 300", "materialized": { "query_block": { "select_id": 3, - "having_condition": "((max_c < 707) and (max_c < 300))", + "having_condition": "max_c < 707 and max_c < 300", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -3273,7 +3273,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a > 5)" + "attached_condition": "t1.a > 5" } } } @@ -3314,16 +3314,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.a = 1) and (v1.b > 10))" + "attached_condition": "v1.a = 1 and v1.b > 10" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(v1.b is not null)", + "attached_condition": "v1.b is not null", "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.b", "temporary_table": { @@ -3332,7 +3332,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a = 1) and (t1.b > 10))" + "attached_condition": "t1.a = 1 and t1.b > 10" } } } @@ -3352,7 +3352,7 @@ EXPLAIN "materialized": { "query_block": { "select_id": 3, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -3361,7 +3361,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a > 5) and (t1.b > 10))" + "attached_condition": "t1.a > 5 and t1.b > 10" } } } @@ -3406,11 +3406,11 @@ EXPLAIN "access_type": "ALL", "rows": 12, "filtered": 100, - "attached_condition": "((v.a = 'b') and ((v.b = 'Vika') or (v.b = 'Ali')))", + "attached_condition": "v.a = 'b' and (v.b = 'Vika' or v.b = 'Ali')", "materialized": { "query_block": { "select_id": 2, - "having_condition": "(max_c < 9)", + "having_condition": "max_c < 9", "filesort": { "sort_key": "t1_char.b", "temporary_table": { @@ -3419,7 +3419,7 @@ EXPLAIN "access_type": "ALL", "rows": 12, "filtered": 100, - "attached_condition": "((t1_char.a = 'b') and ((t1_char.b = 'Vika') or (t1_char.b = 'Ali')))" + "attached_condition": "t1_char.a = 'b' and (t1_char.b = 'Vika' or t1_char.b = 'Ali')" } } } @@ -3432,7 +3432,7 @@ EXPLAIN "access_type": "ALL", "rows": 12, "filtered": 100, - "attached_condition": "(t.a = 'b')" + "attached_condition": "t.a = 'b'" }, "buffer_type": "flat", "buffer_size": "256Kb", @@ -3503,7 +3503,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t2.a is not null)" + "attached_condition": "t2.a is not null" }, "table": { "table_name": "", @@ -3515,11 +3515,11 @@ EXPLAIN "ref": ["test.t2.a"], "rows": 2, "filtered": 100, - "attached_condition": "((v3.b < 50) or (v3.b = 33))", + "attached_condition": "v3.b < 50 or v3.b = 33", "materialized": { "query_block": { "select_id": 4, - "having_condition": "(min_c > 109)", + "having_condition": "min_c > 109", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -3528,7 +3528,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a < 10) and ((t1.b < 50) or (t1.b = 33)))" + "attached_condition": "t1.a < 10 and (t1.b < 50 or t1.b = 33)" } } } @@ -3541,7 +3541,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(v2.max_c > 300)" + "attached_condition": "v2.max_c > 300" }, "buffer_type": "flat", "buffer_size": "256Kb", @@ -3549,7 +3549,7 @@ EXPLAIN "materialized": { "query_block": { "select_id": 3, - "having_condition": "((max_c < 707) and (max_c > 300))", + "having_condition": "max_c < 707 and max_c > 300", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -3558,7 +3558,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a > 5)" + "attached_condition": "t1.a > 5" } } } @@ -3571,16 +3571,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(v1.max_c < 500)" + "attached_condition": "v1.max_c < 500" }, "buffer_type": "incremental", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "((v1.a = v2.a) or (v1.a = t2.a))", + "attached_condition": "v1.a = v2.a or v1.a = t2.a", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((max_c < 707) and (max_c < 500))", + "having_condition": "max_c < 707 and max_c < 500", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -3640,7 +3640,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t2.b is not null)" + "attached_condition": "t2.b is not null" }, "table": { "table_name": "", @@ -3652,11 +3652,11 @@ EXPLAIN "ref": ["test.t2.b"], "rows": 2, "filtered": 100, - "attached_condition": "((v1.max_c > 130) and (v1.a is not null))", + "attached_condition": "v1.max_c > 130 and v1.a is not null", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((max_c < 707) and (max_c > 130))", + "having_condition": "max_c < 707 and max_c > 130", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -3665,7 +3665,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a > 5)" + "attached_condition": "t1.a > 5" } } } @@ -3682,11 +3682,11 @@ EXPLAIN "ref": ["v1.a"], "rows": 2, "filtered": 100, - "attached_condition": "(v2.min_c < 130)", + "attached_condition": "v2.min_c < 130", "materialized": { "query_block": { "select_id": 3, - "having_condition": "((min_c < 707) and (min_c < 130))", + "having_condition": "min_c < 707 and min_c < 130", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -3695,7 +3695,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a > 5)" + "attached_condition": "t1.a > 5" } } } @@ -3787,16 +3787,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.avg_c < 400) or (v1.a > 1))" + "attached_condition": "v1.avg_c < 400 or v1.a > 1" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(((v1.avg_c < 400) or (v1.a > 1)) and (v1.a is not null) and (v1.b is not null))", + "attached_condition": "(v1.avg_c < 400 or v1.a > 1) and v1.a is not null and v1.b is not null", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((max_c < 707) and ((avg_c < 400) or (t1.a > 1)))", + "having_condition": "max_c < 707 and (avg_c < 400 or t1.a > 1)", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -3805,7 +3805,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a > 5)" + "attached_condition": "t1.a > 5" } } } @@ -3822,11 +3822,11 @@ EXPLAIN "ref": ["v1.a"], "rows": 2, "filtered": 100, - "attached_condition": "(v2.min_c < 200)", + "attached_condition": "v2.min_c < 200", "materialized": { "query_block": { "select_id": 3, - "having_condition": "((min_c < 707) and (min_c < 200))", + "having_condition": "min_c < 707 and min_c < 200", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -3835,7 +3835,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a > 5)" + "attached_condition": "t1.a > 5" } } } @@ -3852,11 +3852,11 @@ EXPLAIN "ref": ["v1.b"], "rows": 2, "filtered": 100, - "attached_condition": "((v3.avg_c > 170) or (v3.a < 5))", + "attached_condition": "v3.avg_c > 170 or v3.a < 5", "materialized": { "query_block": { "select_id": 4, - "having_condition": "((avg_c > 170) or (t1.a < 5))", + "having_condition": "avg_c > 170 or t1.a < 5", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -3865,7 +3865,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a < 8)" + "attached_condition": "t1.a < 8" } } } @@ -3932,16 +3932,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(((v1.a = 1) or (v1.max_c < 300)) and (v1.b > 25))" + "attached_condition": "(v1.a = 1 or v1.max_c < 300) and v1.b > 25" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "((v1.a = 1) or (v1.max_c < 300))", + "attached_condition": "v1.a = 1 or v1.max_c < 300", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((max_c < 707) and ((t1.a = 1) or (max_c < 300)))", + "having_condition": "max_c < 707 and (t1.a = 1 or max_c < 300)", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -3950,7 +3950,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.b > 25)" + "attached_condition": "t1.b > 25" } } } @@ -3996,7 +3996,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t2.a is not null)" + "attached_condition": "t2.a is not null" }, "table": { "table_name": "", @@ -4008,11 +4008,11 @@ EXPLAIN "ref": ["test.t2.a"], "rows": 2, "filtered": 100, - "attached_condition": "((v1.max_c > 300) and (v1.b < 30))", + "attached_condition": "v1.max_c > 300 and v1.b < 30", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((max_c < 707) and (max_c > 300))", + "having_condition": "max_c < 707 and max_c > 300", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -4021,7 +4021,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a > 5) and (t1.b < 30))" + "attached_condition": "t1.a > 5 and t1.b < 30" } } } @@ -4074,7 +4074,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "((t2.c > 800) and (t2.b is not null))" + "attached_condition": "t2.c > 800 and t2.b is not null" }, "table": { "table_name": "", @@ -4086,11 +4086,11 @@ EXPLAIN "ref": ["test.t2.b"], "rows": 2, "filtered": 100, - "attached_condition": "(v1.a < 5)", + "attached_condition": "v1.a < 5", "materialized": { "query_block": { "select_id": 3, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -4099,7 +4099,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a < 5)" + "attached_condition": "t1.a < 5" } } } @@ -4116,7 +4116,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t2.d > 800)" + "attached_condition": "t2.d > 800" }, "block-nl-join": { "table": { @@ -4124,7 +4124,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.max_c > 100) and (v1.a > 7))" + "attached_condition": "v1.max_c > 100 and v1.a > 7" }, "buffer_type": "flat", "buffer_size": "256Kb", @@ -4132,7 +4132,7 @@ EXPLAIN "materialized": { "query_block": { "select_id": 4, - "having_condition": "((max_c < 707) and (max_c > 100))", + "having_condition": "max_c < 707 and max_c > 100", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -4141,7 +4141,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a > 7)" + "attached_condition": "t1.a > 7" } } } @@ -4217,7 +4217,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t2.b = 19)" + "attached_condition": "t2.b = 19" }, "block-nl-join": { "table": { @@ -4225,7 +4225,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.b = 19) and (v1.a < 5))" + "attached_condition": "v1.b = 19 and v1.a < 5" }, "buffer_type": "flat", "buffer_size": "256Kb", @@ -4233,7 +4233,7 @@ EXPLAIN "materialized": { "query_block": { "select_id": 3, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a", "temporary_table": { @@ -4242,7 +4242,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.b = 19) and (t1.a < 5))" + "attached_condition": "t1.b = 19 and t1.a < 5" } } } @@ -4266,16 +4266,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.max_c > 400) or (v1.avg_c > 270))" + "attached_condition": "v1.max_c > 400 or v1.avg_c > 270" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(((v1.max_c > 400) or (v1.avg_c > 270)) and (v1.a < t2.a))", + "attached_condition": "(v1.max_c > 400 or v1.avg_c > 270) and v1.a < t2.a", "materialized": { "query_block": { "select_id": 4, - "having_condition": "((max_c < 707) and ((max_c > 400) or (avg_c > 270)))", + "having_condition": "max_c < 707 and (max_c > 400 or avg_c > 270)", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -4378,16 +4378,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.a = 1) or (v1.a = 6))" + "attached_condition": "v1.a = 1 or v1.a = 6" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(((v1.a = t2.a) or (v1.b = t2.b)) and ((v1.a = 1) or (v1.a = 6)))", + "attached_condition": "(v1.a = t2.a or v1.b = t2.b) and (v1.a = 1 or v1.a = 6)", "materialized": { "query_block": { "select_id": 3, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -4396,7 +4396,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a = 1) or (t1.a = 6))" + "attached_condition": "t1.a = 1 or t1.a = 6" } } } @@ -4420,16 +4420,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(((v1.a > 3) and (v1.b > 27)) or (v1.max_c > 550))" + "attached_condition": "v1.a > 3 and v1.b > 27 or v1.max_c > 550" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(((v1.a > 3) and (v1.b > 27)) or (v1.max_c > 550))", + "attached_condition": "v1.a > 3 and v1.b > 27 or v1.max_c > 550", "materialized": { "query_block": { "select_id": 4, - "having_condition": "((max_c < 707) and (((t1.a > 3) and (t1.b > 27)) or (max_c > 550)))", + "having_condition": "max_c < 707 and (t1.a > 3 and t1.b > 27 or max_c > 550)", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -4526,7 +4526,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t2.a = 1)" + "attached_condition": "t2.a = 1" }, "block-nl-join": { "table": { @@ -4534,16 +4534,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.a = 1) and ((v1.max_c < 500) or (v1.avg_c > 500)))" + "attached_condition": "v1.a = 1 and (v1.max_c < 500 or v1.avg_c > 500)" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "((v1.max_c < 500) or (v1.avg_c > 500))", + "attached_condition": "v1.max_c < 500 or v1.avg_c > 500", "materialized": { "query_block": { "select_id": 4, - "having_condition": "((max_c < 707) and ((max_c < 500) or (avg_c > 500)))", + "having_condition": "max_c < 707 and (max_c < 500 or avg_c > 500)", "filesort": { "sort_key": "t1.b", "temporary_table": { @@ -4552,7 +4552,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a = 1)" + "attached_condition": "t1.a = 1" } } } @@ -4569,7 +4569,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t2.a < 2)" + "attached_condition": "t2.a < 2" }, "block-nl-join": { "table": { @@ -4577,16 +4577,16 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(v2.b > 10)" + "attached_condition": "v2.b > 10" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "((v2.a < t2.b) or (v2.max_c > 200))", + "attached_condition": "v2.a < t2.b or v2.max_c > 200", "materialized": { "query_block": { "select_id": 5, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -4595,7 +4595,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a > 5) and (t1.b > 10))" + "attached_condition": "t1.a > 5 and t1.b > 10" } } } @@ -4612,7 +4612,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t2.c is not null)" + "attached_condition": "t2.c is not null" }, "table": { "table_name": "", @@ -4624,11 +4624,11 @@ EXPLAIN "ref": ["test.t2.c"], "rows": 2, "filtered": 100, - "attached_condition": "(v2.b < 10)", + "attached_condition": "v2.b < 10", "materialized": { "query_block": { "select_id": 6, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -4637,7 +4637,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a > 5) and (t1.b < 10))" + "attached_condition": "t1.a > 5 and t1.b < 10" } } } @@ -4698,7 +4698,7 @@ EXPLAIN "access_type": "ALL", "rows": 40, "filtered": 100, - "attached_condition": "((v_union.a < 3) and (v_union.c > 100))" + "attached_condition": "v_union.a < 3 and v_union.c > 100" }, "buffer_type": "flat", "buffer_size": "256Kb", @@ -4712,7 +4712,7 @@ EXPLAIN { "query_block": { "select_id": 2, - "having_condition": "((c > 109) and (c > 100))", + "having_condition": "c > 109 and c > 100", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -4721,7 +4721,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a < 10) and (t1.a < 3))" + "attached_condition": "t1.a < 10 and t1.a < 3" } } } @@ -4730,7 +4730,7 @@ EXPLAIN { "query_block": { "select_id": 3, - "having_condition": "((c < 300) and (c > 100))", + "having_condition": "c < 300 and c > 100", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -4739,7 +4739,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.b > 10) and (t1.a < 3))" + "attached_condition": "t1.b > 10 and t1.a < 3" } } } @@ -4805,12 +4805,12 @@ EXPLAIN "access_type": "ALL", "rows": 40, "filtered": 100, - "attached_condition": "(((v_union.a < 2) or (v_union.c > 800)) and (v_union.b > 12))" + "attached_condition": "(v_union.a < 2 or v_union.c > 800) and v_union.b > 12" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "((v_union.a < 2) or (v_union.c > 800))", + "attached_condition": "v_union.a < 2 or v_union.c > 800", "materialized": { "query_block": { "union_result": { @@ -4820,7 +4820,7 @@ EXPLAIN { "query_block": { "select_id": 2, - "having_condition": "((c > 109) and ((t1.a < 2) or (c > 800)))", + "having_condition": "c > 109 and (t1.a < 2 or c > 800)", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -4829,7 +4829,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a < 10) and (t1.b > 12))" + "attached_condition": "t1.a < 10 and t1.b > 12" } } } @@ -4838,7 +4838,7 @@ EXPLAIN { "query_block": { "select_id": 3, - "having_condition": "((c < 300) and ((t1.a < 2) or (c > 800)))", + "having_condition": "c < 300 and (t1.a < 2 or c > 800)", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -4847,7 +4847,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.b > 10) and (t1.b > 12))" + "attached_condition": "t1.b > 10 and t1.b > 12" } } } @@ -4893,7 +4893,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t2.a = 1)" + "attached_condition": "t2.a = 1" }, "block-nl-join": { "table": { @@ -4901,7 +4901,7 @@ EXPLAIN "access_type": "ALL", "rows": 40, "filtered": 100, - "attached_condition": "((v_union.a = 1) and (v_union.c < 200))" + "attached_condition": "v_union.a = 1 and v_union.c < 200" }, "buffer_type": "flat", "buffer_size": "256Kb", @@ -4915,7 +4915,7 @@ EXPLAIN { "query_block": { "select_id": 2, - "having_condition": "((c > 109) and (c < 200))", + "having_condition": "c > 109 and c < 200", "filesort": { "sort_key": "t1.b", "temporary_table": { @@ -4924,7 +4924,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a = 1)" + "attached_condition": "t1.a = 1" } } } @@ -4933,7 +4933,7 @@ EXPLAIN { "query_block": { "select_id": 3, - "having_condition": "((c < 300) and (c < 200))", + "having_condition": "c < 300 and c < 200", "filesort": { "sort_key": "t1.b", "temporary_table": { @@ -4942,7 +4942,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a = 1) and (t1.b > 10))" + "attached_condition": "t1.a = 1 and t1.b > 10" } } } @@ -4986,7 +4986,7 @@ EXPLAIN "access_type": "ALL", "rows": 12, "filtered": 100, - "attached_condition": "(t.a is not null)" + "attached_condition": "t.a is not null" }, "table": { "table_name": "", @@ -4998,11 +4998,11 @@ EXPLAIN "ref": ["test.t.a"], "rows": 2, "filtered": 100, - "attached_condition": "((v.b = 'Vika') and (v.max_c > 2))", + "attached_condition": "v.b = 'Vika' and v.max_c > 2", "materialized": { "query_block": { "select_id": 2, - "having_condition": "((max_c < 9) and (max_c > 2))", + "having_condition": "max_c < 9 and max_c > 2", "filesort": { "sort_key": "t1_char.a", "temporary_table": { @@ -5011,7 +5011,7 @@ EXPLAIN "access_type": "ALL", "rows": 12, "filtered": 100, - "attached_condition": "(t1_char.b = 'Vika')" + "attached_condition": "t1_char.b = 'Vika'" } } } @@ -5059,7 +5059,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t2.a = 1)" + "attached_condition": "t2.a = 1" }, "block-nl-join": { "table": { @@ -5067,7 +5067,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(v1.a = 1)" + "attached_condition": "v1.a = 1" }, "buffer_type": "flat", "buffer_size": "256Kb", @@ -5075,7 +5075,7 @@ EXPLAIN "materialized": { "query_block": { "select_id": 4, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.b", "temporary_table": { @@ -5084,7 +5084,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a = 1)" + "attached_condition": "t1.a = 1" } } } @@ -5097,12 +5097,12 @@ EXPLAIN "access_type": "ALL", "rows": 40, "filtered": 100, - "attached_condition": "(v_union.a = 1)" + "attached_condition": "v_union.a = 1" }, "buffer_type": "incremental", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "((v_union.c > 800) or (v1.max_c > 200))", + "attached_condition": "v_union.c > 800 or v1.max_c > 200", "materialized": { "query_block": { "union_result": { @@ -5112,7 +5112,7 @@ EXPLAIN { "query_block": { "select_id": 2, - "having_condition": "(c > 109)", + "having_condition": "c > 109", "filesort": { "sort_key": "t1.b", "temporary_table": { @@ -5121,7 +5121,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a = 1)" + "attached_condition": "t1.a = 1" } } } @@ -5130,7 +5130,7 @@ EXPLAIN { "query_block": { "select_id": 3, - "having_condition": "(c < 300)", + "having_condition": "c < 300", "filesort": { "sort_key": "t1.b", "temporary_table": { @@ -5139,7 +5139,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a = 1) and (t1.b > 10))" + "attached_condition": "t1.a = 1 and t1.b > 10" } } } @@ -5194,7 +5194,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(((t2.a = 6) or (t2.a = 8)) and (t2.a is not null))" + "attached_condition": "(t2.a = 6 or t2.a = 8) and t2.a is not null" }, "table": { "table_name": "", @@ -5206,7 +5206,7 @@ EXPLAIN "ref": ["test.t2.a"], "rows": 6, "filtered": 100, - "attached_condition": "(v.c > 200)", + "attached_condition": "v.c > 200", "materialized": { "query_block": { "union_result": { @@ -5216,7 +5216,7 @@ EXPLAIN { "query_block": { "select_id": 2, - "having_condition": "((c > 109) and (c > 200))", + "having_condition": "c > 109 and c > 200", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -5225,7 +5225,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a < 10) and ((t1.a = 6) or (t1.a = 8)))" + "attached_condition": "t1.a < 10 and (t1.a = 6 or t1.a = 8)" } } } @@ -5234,7 +5234,7 @@ EXPLAIN { "query_block": { "select_id": 3, - "having_condition": "((c < 300) and (c > 200))", + "having_condition": "c < 300 and c > 200", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -5243,7 +5243,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.b > 10) and ((t1.a = 6) or (t1.a = 8)))" + "attached_condition": "t1.b > 10 and (t1.a = 6 or t1.a = 8)" } } } @@ -5252,7 +5252,7 @@ EXPLAIN { "query_block": { "select_id": 4, - "having_condition": "((c < 707) and (c > 200))", + "having_condition": "c < 707 and c > 200", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -5261,7 +5261,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.c > 300) and ((t1.a = 6) or (t1.a = 8)))" + "attached_condition": "t1.c > 300 and (t1.a = 6 or t1.a = 8)" } } } @@ -5361,7 +5361,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t2.a is not null)" + "attached_condition": "t2.a is not null" }, "table": { "table_name": "", @@ -5373,7 +5373,7 @@ EXPLAIN "ref": ["test.t2.a"], "rows": 4, "filtered": 100, - "attached_condition": "(v.c > 6)", + "attached_condition": "v.c > 6", "materialized": { "query_block": { "union_result": { @@ -5388,7 +5388,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a < 10) and ((t1.a + 1) > 6))" + "attached_condition": "t1.a < 10 and t1.a + 1 > 6" } } }, @@ -5400,7 +5400,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.b > 10) and (t1.c > 100) and (t1.c > 6))" + "attached_condition": "t1.b > 10 and t1.c > 100 and t1.c > 6" } } } @@ -5478,7 +5478,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t2.a is not null)" + "attached_condition": "t2.a is not null" }, "table": { "table_name": "", @@ -5490,7 +5490,7 @@ EXPLAIN "ref": ["test.t2.a"], "rows": 4, "filtered": 100, - "attached_condition": "((t2.a > 1) or (v.b < 20))", + "attached_condition": "t2.a > 1 or v.b < 20", "materialized": { "query_block": { "union_result": { @@ -5505,7 +5505,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a < 10) and ((t1.a > 1) or (t1.b < 20)))" + "attached_condition": "t1.a < 10 and (t1.a > 1 or t1.b < 20)" } } }, @@ -5517,7 +5517,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.b > 10) and (t1.c > 100) and ((t1.a > 1) or (t1.b < 20)))" + "attached_condition": "t1.b > 10 and t1.c > 100 and (t1.a > 1 or t1.b < 20)" } } } @@ -5563,7 +5563,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t2.a is not null)" + "attached_condition": "t2.a is not null" }, "table": { "table_name": "", @@ -5575,7 +5575,7 @@ EXPLAIN "ref": ["test.t2.a"], "rows": 4, "filtered": 100, - "attached_condition": "(((v.b = 19) or (v.b = 21)) and ((v.c < 3) or (v.c > 600)))", + "attached_condition": "(v.b = 19 or v.b = 21) and (v.c < 3 or v.c > 600)", "materialized": { "query_block": { "union_result": { @@ -5590,7 +5590,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a < 10) and ((t1.b = 19) or (t1.b = 21)) and (((t1.a + 1) < 3) or ((t1.a + 1) > 600)))" + "attached_condition": "t1.a < 10 and (t1.b = 19 or t1.b = 21) and (t1.a + 1 < 3 or t1.a + 1 > 600)" } } }, @@ -5602,7 +5602,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.b > 10) and (t1.c > 100) and ((t1.b = 19) or (t1.b = 21)) and ((t1.c < 3) or (t1.c > 600)))" + "attached_condition": "t1.b > 10 and t1.c > 100 and (t1.b = 19 or t1.b = 21) and (t1.c < 3 or t1.c > 600)" } } } @@ -5645,7 +5645,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t2.a is not null)" + "attached_condition": "t2.a is not null" }, "table": { "table_name": "", @@ -5657,7 +5657,7 @@ EXPLAIN "ref": ["test.t2.a"], "rows": 4, "filtered": 100, - "attached_condition": "(v.b < 20)", + "attached_condition": "v.b < 20", "materialized": { "query_block": { "union_result": { @@ -5667,7 +5667,7 @@ EXPLAIN { "query_block": { "select_id": 2, - "having_condition": "(c > 109)", + "having_condition": "c > 109", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -5676,7 +5676,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a < 10) and (t1.b < 20))" + "attached_condition": "t1.a < 10 and t1.b < 20" } } } @@ -5690,7 +5690,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.b > 10) and (t1.b < 20))" + "attached_condition": "t1.b > 10 and t1.b < 20" } } } @@ -5752,7 +5752,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "(t2.a is not null)" + "attached_condition": "t2.a is not null" }, "table": { "table_name": "", @@ -5764,7 +5764,7 @@ EXPLAIN "ref": ["test.t2.a"], "rows": 4, "filtered": 100, - "attached_condition": "(((t2.a < 3) or (v.b < 40)) and (v.c > 500))", + "attached_condition": "(t2.a < 3 or v.b < 40) and v.c > 500", "materialized": { "query_block": { "union_result": { @@ -5774,7 +5774,7 @@ EXPLAIN { "query_block": { "select_id": 2, - "having_condition": "((c > 109) and (c > 500))", + "having_condition": "c > 109 and c > 500", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -5783,7 +5783,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a < 10) and ((t1.a < 3) or (t1.b < 40)))" + "attached_condition": "t1.a < 10 and (t1.a < 3 or t1.b < 40)" } } } @@ -5797,7 +5797,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.b > 10) and ((t1.a < 3) or (t1.b < 40)) and ((t1.c + 100) > 500))" + "attached_condition": "t1.b > 10 and (t1.a < 3 or t1.b < 40) and t1.c + 100 > 500" } } } @@ -5861,7 +5861,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(v4.a < 13)", + "attached_condition": "v4.a < 13", "materialized": { "query_block": { "select_id": 2, @@ -5873,11 +5873,11 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.a < 15) and (v1.a < 13))", + "attached_condition": "v1.a < 15 and v1.a < 13", "materialized": { "query_block": { "select_id": 3, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -5886,7 +5886,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a < 15) and (t1.a < 13))" + "attached_condition": "t1.a < 15 and t1.a < 13" } } } @@ -5904,7 +5904,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.a > 5) and (v1.b > 12))" + "attached_condition": "v1.a > 5 and v1.b > 12" }, "buffer_type": "flat", "buffer_size": "256Kb", @@ -5912,7 +5912,7 @@ EXPLAIN "materialized": { "query_block": { "select_id": 4, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -5921,7 +5921,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a > 5) and (t1.b > 12))" + "attached_condition": "t1.a > 5 and t1.b > 12" } } } @@ -5963,7 +5963,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "((t2.a is not null) and (t2.a is not null))" + "attached_condition": "t2.a is not null and t2.a is not null" }, "table": { "table_name": "", @@ -5986,11 +5986,11 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(v1.a < 15)", + "attached_condition": "v1.a < 15", "materialized": { "query_block": { "select_id": 3, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -5999,7 +5999,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a < 15)" + "attached_condition": "t1.a < 15" } } } @@ -6021,11 +6021,11 @@ EXPLAIN "ref": ["test.t2.a"], "rows": 2, "filtered": 100, - "attached_condition": "(v1.b > 30)", + "attached_condition": "v1.b > 30", "materialized": { "query_block": { "select_id": 4, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -6034,7 +6034,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.b > 30)" + "attached_condition": "t1.b > 30" } } } @@ -6078,7 +6078,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "((t2.a > 1) and (t2.a is not null) and (t2.a is not null))" + "attached_condition": "t2.a > 1 and t2.a is not null and t2.a is not null" }, "table": { "table_name": "", @@ -6090,11 +6090,11 @@ EXPLAIN "ref": ["test.t2.a"], "rows": 2, "filtered": 100, - "attached_condition": "(v4.min_c > 100)", + "attached_condition": "v4.min_c > 100", "materialized": { "query_block": { "select_id": 2, - "having_condition": "(min_c > 100)", + "having_condition": "min_c > 100", "filesort": { "sort_key": "v1.a, v1.b", "temporary_table": { @@ -6103,11 +6103,11 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.a < 15) and (v1.a > 1))", + "attached_condition": "v1.a < 15 and v1.a > 1", "materialized": { "query_block": { "select_id": 3, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -6116,7 +6116,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a < 15) and (t1.a > 1))" + "attached_condition": "t1.a < 15 and t1.a > 1" } } } @@ -6138,11 +6138,11 @@ EXPLAIN "ref": ["test.t2.a"], "rows": 2, "filtered": 100, - "attached_condition": "(v1.b < 30)", + "attached_condition": "v1.b < 30", "materialized": { "query_block": { "select_id": 4, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -6151,7 +6151,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a > 1) and (t1.b < 30))" + "attached_condition": "t1.a > 1 and t1.b < 30" } } } @@ -6287,12 +6287,12 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(((v4.b > 10) and (v4.a > 1)) or (v4.b < 20))" + "attached_condition": "v4.b > 10 and v4.a > 1 or v4.b < 20" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "((((v4.b > 10) and (v4.a > 1)) or (v4.b < 20)) and (v4.a is not null))", + "attached_condition": "(v4.b > 10 and v4.a > 1 or v4.b < 20) and v4.a is not null", "materialized": { "query_block": { "select_id": 2, @@ -6304,11 +6304,11 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.a < 15) and (((v1.b > 10) and (v1.a > 1)) or (v1.b < 20)))", + "attached_condition": "v1.a < 15 and (v1.b > 10 and v1.a > 1 or v1.b < 20)", "materialized": { "query_block": { "select_id": 3, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -6317,7 +6317,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a < 15) and (((t1.b > 10) and (t1.a > 1)) or (t1.b < 20)))" + "attached_condition": "t1.a < 15 and (t1.b > 10 and t1.a > 1 or t1.b < 20)" } } } @@ -6339,11 +6339,11 @@ EXPLAIN "ref": ["v4.a"], "rows": 2, "filtered": 100, - "attached_condition": "(v1.max_c > 200)", + "attached_condition": "v1.max_c > 200", "materialized": { "query_block": { "select_id": 4, - "having_condition": "((max_c < 707) and (max_c > 200))", + "having_condition": "max_c < 707 and max_c > 200", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -6389,11 +6389,11 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(((v4.a > 12) and (v4.min_c < 300) and (v4.b > 13)) or (v4.a < 1))", + "attached_condition": "v4.a > 12 and v4.min_c < 300 and v4.b > 13 or v4.a < 1", "materialized": { "query_block": { "select_id": 2, - "having_condition": "(((v1.a > 12) and (min_c < 300) and (v1.b > 13)) or (v1.a < 1))", + "having_condition": "v1.a > 12 and min_c < 300 and v1.b > 13 or v1.a < 1", "filesort": { "sort_key": "v1.a, v1.b", "temporary_table": { @@ -6402,11 +6402,11 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.a < 15) and (((v1.a > 12) and (v1.b > 13)) or (v1.a < 1)))", + "attached_condition": "v1.a < 15 and (v1.a > 12 and v1.b > 13 or v1.a < 1)", "materialized": { "query_block": { "select_id": 3, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -6415,7 +6415,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a < 15) and (((t1.a > 12) and (t1.b > 13)) or (t1.a < 1)))" + "attached_condition": "t1.a < 15 and (t1.a > 12 and t1.b > 13 or t1.a < 1)" } } } @@ -6440,7 +6440,7 @@ EXPLAIN "materialized": { "query_block": { "select_id": 4, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -6449,7 +6449,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a > 5)" + "attached_condition": "t1.a > 5" } } } @@ -6488,11 +6488,11 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v4.b = v4.a) and (v4.min_c < 100) and (v4.a is not null))", + "attached_condition": "v4.b = v4.a and v4.min_c < 100 and v4.a is not null", "materialized": { "query_block": { "select_id": 2, - "having_condition": "(min_c < 100)", + "having_condition": "min_c < 100", "filesort": { "sort_key": "v1.a, v1.b", "temporary_table": { @@ -6501,11 +6501,11 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.b = v1.a) and (v1.a < 15))", + "attached_condition": "v1.b = v1.a and v1.a < 15", "materialized": { "query_block": { "select_id": 3, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -6514,7 +6514,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.b = t1.a) and (t1.a < 15))" + "attached_condition": "t1.b = t1.a and t1.a < 15" } } } @@ -6539,7 +6539,7 @@ EXPLAIN "materialized": { "query_block": { "select_id": 4, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -6548,7 +6548,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a > 5)" + "attached_condition": "t1.a > 5" } } } @@ -6587,7 +6587,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v4.b = v4.a) and (v4.a < 30) and (v4.a is not null))", + "attached_condition": "v4.b = v4.a and v4.a < 30 and v4.a is not null", "materialized": { "query_block": { "select_id": 2, @@ -6599,11 +6599,11 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.b = v1.a) and (v1.a < 15) and (v1.a < 30))", + "attached_condition": "v1.b = v1.a and v1.a < 15 and v1.a < 30", "materialized": { "query_block": { "select_id": 3, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -6612,7 +6612,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.b = t1.a) and (t1.a < 15) and (t1.a < 30))" + "attached_condition": "t1.b = t1.a and t1.a < 15 and t1.a < 30" } } } @@ -6637,7 +6637,7 @@ EXPLAIN "materialized": { "query_block": { "select_id": 4, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -6646,7 +6646,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a > 5) and (t1.b < 30))" + "attached_condition": "t1.a > 5 and t1.b < 30" } } } @@ -6685,7 +6685,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v4.b = v4.a) and ((v4.a < 30) or (v4.a > 2)) and (v4.a is not null))", + "attached_condition": "v4.b = v4.a and (v4.a < 30 or v4.a > 2) and v4.a is not null", "materialized": { "query_block": { "select_id": 2, @@ -6697,11 +6697,11 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.b = v1.a) and (v1.a < 15) and ((v1.a < 30) or (v1.a > 2)))", + "attached_condition": "v1.b = v1.a and v1.a < 15 and (v1.a < 30 or v1.a > 2)", "materialized": { "query_block": { "select_id": 3, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -6710,7 +6710,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.b = t1.a) and (t1.a < 15) and ((t1.a < 30) or (t1.a > 2)))" + "attached_condition": "t1.b = t1.a and t1.a < 15 and (t1.a < 30 or t1.a > 2)" } } } @@ -6735,7 +6735,7 @@ EXPLAIN "materialized": { "query_block": { "select_id": 4, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -6744,7 +6744,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a > 5) and ((t1.b < 30) or (t1.b > 2)))" + "attached_condition": "t1.a > 5 and (t1.b < 30 or t1.b > 2)" } } } @@ -6791,11 +6791,11 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((((v4.a < 12) and (v4.b > 13)) or (v4.a > 10)) and (v4.min_c > 100) and (v4.min_c is not null))", + "attached_condition": "(v4.a < 12 and v4.b > 13 or v4.a > 10) and v4.min_c > 100 and v4.min_c is not null", "materialized": { "query_block": { "select_id": 2, - "having_condition": "(min_c > 100)", + "having_condition": "min_c > 100", "filesort": { "sort_key": "v1.a, v1.b", "temporary_table": { @@ -6804,11 +6804,11 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.a < 15) and (((v1.a < 12) and (v1.b > 13)) or (v1.a > 10)))", + "attached_condition": "v1.a < 15 and (v1.a < 12 and v1.b > 13 or v1.a > 10)", "materialized": { "query_block": { "select_id": 3, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -6817,7 +6817,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a < 15) and (((t1.a < 12) and (t1.b > 13)) or (t1.a > 10)))" + "attached_condition": "t1.a < 15 and (t1.a < 12 and t1.b > 13 or t1.a > 10)" } } } @@ -6842,7 +6842,7 @@ EXPLAIN "materialized": { "query_block": { "select_id": 4, - "having_condition": "((max_c < 707) and (max_c > 100))", + "having_condition": "max_c < 707 and max_c > 100", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -6851,7 +6851,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a > 5)" + "attached_condition": "t1.a > 5" } } } @@ -6897,7 +6897,7 @@ EXPLAIN "access_type": "ALL", "rows": 9, "filtered": 100, - "attached_condition": "((t2.c > 100) and (t2.c is not null))" + "attached_condition": "t2.c > 100 and t2.c is not null" }, "table": { "table_name": "", @@ -6909,11 +6909,11 @@ EXPLAIN "ref": ["test.t2.c"], "rows": 2, "filtered": 100, - "attached_condition": "(((v4.a < 12) and (t2.b > 13)) or (v4.a > 10))", + "attached_condition": "v4.a < 12 and t2.b > 13 or v4.a > 10", "materialized": { "query_block": { "select_id": 2, - "having_condition": "(min_c > 100)", + "having_condition": "min_c > 100", "filesort": { "sort_key": "v1.a, v1.b", "temporary_table": { @@ -6922,11 +6922,11 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((v1.a < 15) and ((v1.a < 12) or (v1.a > 10)))", + "attached_condition": "v1.a < 15 and (v1.a < 12 or v1.a > 10)", "materialized": { "query_block": { "select_id": 3, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -6935,7 +6935,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "((t1.a < 15) and ((t1.a < 12) or (t1.a > 10)))" + "attached_condition": "t1.a < 15 and (t1.a < 12 or t1.a > 10)" } } } @@ -6960,7 +6960,7 @@ EXPLAIN "materialized": { "query_block": { "select_id": 4, - "having_condition": "(max_c < 707)", + "having_condition": "max_c < 707", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -6969,7 +6969,7 @@ EXPLAIN "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "(t1.a > 5)" + "attached_condition": "t1.a > 5" } } } @@ -6996,7 +6996,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY ALL NULL NULL NULL NULL 2 100.00 Using where 3 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Warnings: -Note 1003 select `sq1`.`f` AS `f` from (select min(`test`.`t1`.`i`) AS `f` from `test`.`t1` having (`f` = 8)) `sq1` where (`sq1`.`f` = 8) +Note 1003 select `sq1`.`f` AS `f` from (select min(`test`.`t1`.`i`) AS `f` from `test`.`t1` having `f` = 8) `sq1` where `sq1`.`f` = 8 SELECT * FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2 WHERE f = 8; @@ -7083,3 +7083,1161 @@ a 3 6 drop table t1; +# +# MDEV-11072: pushdown of the condition obtained +# after constant row substitution +# +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2; +CREATE TABLE t3 (c INT) ENGINE=MyISAM; +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t3; +SELECT * FROM t1 WHERE a IN ( +SELECT b FROM v2 WHERE b < a OR b IN ( +SELECT c FROM v3 WHERE c = a +) +); +a +INSERT INTO t1 VALUES (2); +INSERT INTO t2 VALUES (3), (2); +INSERT INTO t3 VALUES (4), (1), (2), (7); +SELECT * FROM t1 WHERE a IN ( +SELECT b FROM v2 WHERE b < a OR b IN ( +SELECT c FROM v3 WHERE c = a +) +); +a +2 +EXPLAIN FORMAT=JSON +SELECT * FROM t1 WHERE a IN ( +SELECT b FROM v2 WHERE b < a OR b IN ( +SELECT c FROM v3 WHERE c = a +) +); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "const_condition": "0 or (2,(subquery#3))", + "table": { + "table_name": "t1", + "access_type": "system", + "rows": 1, + "filtered": 100 + }, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t2.b = 2", + "first_match": "t1" + }, + "subqueries": [ + { + "query_block": { + "select_id": 3, + "table": { + "table_name": "", + "access_type": "index_subquery", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["c"], + "ref": ["func"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 5, + "table": { + "table_name": "t3", + "access_type": "ALL", + "rows": 4, + "filtered": 100, + "attached_condition": "t3.c = 2" + } + } + } + } + } + } + ] + } +} +CREATE TABLE t4 (d INT, e INT) ENGINE=MyISAM; +INSERT INTO t4 VALUES (1,10),(3,11),(2,10),(2,20),(3,21); +CREATE OR REPLACE VIEW v4 AS +SELECT d, sum(e) AS s FROM t4 GROUP BY d; +set statement optimizer_switch='condition_pushdown_for_derived=off' for SELECT * FROM t1 WHERE a IN ( +SELECT b FROM v2 WHERE b < a OR b IN ( +SELECT d FROM v4 WHERE s > a +) +); +a +2 +SELECT * FROM t1 WHERE a IN ( +SELECT b FROM v2 WHERE b < a OR b IN ( +SELECT d FROM v4 WHERE s > a +) +); +a +2 +explain SELECT * FROM t1 WHERE a IN ( +SELECT b FROM v2 WHERE b < a OR b IN ( +SELECT d FROM v4 WHERE s > a +) +); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 system NULL NULL NULL NULL 1 +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; FirstMatch(t1) +3 DEPENDENT SUBQUERY index_subquery key0 key0 5 func 2 Using where +5 DERIVED t4 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +explain format=json SELECT * FROM t1 WHERE a IN ( +SELECT b FROM v2 WHERE b < a OR b IN ( +SELECT d FROM v4 WHERE s > a +) +); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "const_condition": "0 or (2,(subquery#3))", + "table": { + "table_name": "t1", + "access_type": "system", + "rows": 1, + "filtered": 100 + }, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t2.b = 2", + "first_match": "t1" + }, + "subqueries": [ + { + "query_block": { + "select_id": 3, + "table": { + "table_name": "", + "access_type": "index_subquery", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["d"], + "ref": ["func"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 5, + "filesort": { + "sort_key": "t4.d", + "temporary_table": { + "table": { + "table_name": "t4", + "access_type": "ALL", + "rows": 5, + "filtered": 100 + } + } + } + } + } + } + } + } + ] + } +} +DROP VIEW v2,v3,v4; +DROP TABLE t1,t2,t3,t4; +# +# MDEV-10800: pushdown of the condition obtained +# after constant row substitution +# +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3),(4); +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; +SELECT * FROM +( SELECT * FROM t1 +WHERE EXISTS ( SELECT * FROM v2 WHERE b = a ) ) AS sq; +a +EXPLAIN FORMAT=JSON +SELECT * FROM +( SELECT * FROM t1 +WHERE EXISTS ( SELECT * FROM v2 WHERE b = a ) ) AS sq; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "const_condition": "(1,exists(subquery#3))", + "table": { + "table_name": "t1", + "access_type": "system", + "rows": 1, + "filtered": 100 + }, + "subqueries": [ + { + "query_block": { + "select_id": 3, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v2.b = 1", + "materialized": { + "query_block": { + "select_id": 4, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t2.b = 1" + } + } + } + } + } + } + ] + } +} +DROP VIEW v2; +DROP TABLE t1,t2; +# +# MDEV-11102: condition pushdown into materialized inner table +# of outer join is not applied as not being valid +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0),(2); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (1),(2); +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; +SELECT * FROM t1 LEFT JOIN t2 ON a = b WHERE b IS NULL; +a b +0 NULL +SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL; +a b +0 NULL +EXPLAIN FORMAT=JSON +SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + }, + "table": { + "table_name": "", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["test.t1.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "trigcond(v2.b is null) and trigcond(trigcond(t1.a is not null))", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + } + } + } + } + } +} +DROP VIEW v2; +DROP TABLE t1,t2; +# +# MDEV-11103: pushdown condition with ANY subquery +# +CREATE TABLE t1 (i INT); +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (1),(2); +EXPLAIN FORMAT=JSON +SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "(v1.i <= 3)", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "(t1.i <= 3)" + } + } + } + } + } +} +Warnings: +Note 1249 Select 2 was reduced during optimization +SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 ); +i +1 +2 +DROP VIEW v1; +DROP TABLE t1; +# +# MDEV-11315: condition with outer reference to mergeable derived +# +CREATE TABLE t1 (pk1 INT PRIMARY KEY, a INT, b INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (10,7,1),(11,0,2); +CREATE TABLE t2 (pk2 INT PRIMARY KEY, c INT, d DATETIME) ENGINE=MyISAM; +INSERT INTO t2 VALUES +(1,4,'2008-09-27 00:34:58'), +(2,5,'2007-05-28 00:00:00'), +(3,6,'2009-07-25 09:21:20'); +CREATE VIEW v1 AS SELECT * FROM t1; +CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; +SELECT * FROM v1 AS sq +WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; +pk1 a b +10 7 1 +11 0 2 +EXPLAIN FORMAT=JSON +SELECT * FROM v1 AS sq +WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "(t1.b,(subquery#2)) or t1.b = 100" + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "", + "access_type": "index_subquery", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "4", + "used_key_parts": ["pk2"], + "ref": ["func"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 4, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + } + ] + } +} +SELECT * FROM ( SELECT * FROM t1 ) AS sq +WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; +pk1 a b +10 7 1 +11 0 2 +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT * FROM t1 ) AS sq +WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "(t1.b,(subquery#3)) or t1.b = 100" + }, + "subqueries": [ + { + "query_block": { + "select_id": 3, + "table": { + "table_name": "", + "access_type": "index_subquery", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "4", + "used_key_parts": ["pk2"], + "ref": ["func"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 4, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + } + ] + } +} +DROP VIEW v1,v2; +DROP TABLE t1,t2; +# +# MDEV-11313: pushdown of the condition obtained +# after constant row substitution +# +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (50); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +SELECT ( SELECT COUNT(*) FROM v1 WHERE a = t2.b ) AS f FROM t2 GROUP BY f; +f +0 +EXPLAIN FORMAT=JSON +SELECT ( SELECT COUNT(*) FROM v1 WHERE a = t2.b ) AS f FROM t2 GROUP BY f; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "system", + "rows": 1, + "filtered": 100 + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v1.a = 50", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.a = 50" + } + } + } + } + } + } + ] + } +} +CREATE TABLE t3 (a INT, b INT) ENGINE=MYISAM; +INSERT INTO t3 VALUES (1,10),(3,11),(2,10),(2,20),(3,21); +CREATE VIEW v2 AS SELECT a, sum(b) AS s FROM t3 GROUP BY a ; +SELECT ( SELECT COUNT(*) FROM v2 WHERE s < t2.b ) AS f FROM t2 GROUP BY f; +f +3 +EXPLAIN FORMAT=JSON +SELECT ( SELECT COUNT(*) FROM v2 WHERE s < t2.b ) AS f FROM t2 GROUP BY f; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "system", + "rows": 1, + "filtered": 100 + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 5, + "filtered": 100, + "attached_condition": "v2.s < 50", + "materialized": { + "query_block": { + "select_id": 3, + "filesort": { + "sort_key": "t3.a", + "temporary_table": { + "table": { + "table_name": "t3", + "access_type": "ALL", + "rows": 5, + "filtered": 100 + } + } + } + } + } + } + } + } + ] + } +} +DROP VIEW v1,v2; +DROP TABLE t1,t2,t3; +# +# MDEV-10882: pushdown of the predicate with cached value +# +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL) ENGINE=MyISAM; +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (1,2),(3,4); +CREATE TABLE t2 (c INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t2 VALUES (5),(6); +SELECT a, GROUP_CONCAT(b) FROM v1 +WHERE b IN ( SELECT COUNT(c) FROM t2 ) GROUP BY a; +a GROUP_CONCAT(b) +1 2 +EXPLAIN FORMAT=JSON +SELECT a, GROUP_CONCAT(b) FROM v1 +WHERE b IN ( SELECT COUNT(c) FROM t2 ) GROUP BY a; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 2, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "read_sorted_file": { + "filesort": { + "sort_key": "v1.a", + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v1.b = 2", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.b = 2" + } + } + } + } + } + } + } +} +DROP VIEW v1; +DROP TABLE t1,t2; +# +# MDEV-10836: pushdown of the predicate with cached value +# +CREATE TABLE t (pk INT PRIMARY KEY, f INT) ENGINE=MyISAM; +CREATE ALGORITHM=TEMPTABLE VIEW v AS SELECT * FROM t; +INSERT INTO t VALUES (1,1),(3,2); +SELECT * FROM v AS v1, v AS v2 +WHERE v2.pk > v1.f AND v1.f IN ( SELECT COUNT(pk) FROM t ); +pk f pk f +3 2 3 2 +EXPLAIN FORMAT=JSON +SELECT * FROM v AS v1, v AS v2 +WHERE v2.pk > v1.f AND v1.f IN ( SELECT COUNT(pk) FROM t ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 2, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v1.f = 2", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t.f = 2" + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v2.pk > 2" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "select_id": 4, + "table": { + "table_name": "t", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + } + } + } + } + } +} +DROP VIEW v; +DROP TABLE t; +# +# MDEV-11488: pushdown of the predicate with cached value +# +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(3),(2); +CREATE TABLE t2 (j INT, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3),(4); +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +3 +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 3, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "sq.i = 3", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.i = 3" + } + } + } + } + } +} +UPDATE t2 SET j = 2 WHERE j = 3; +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +2 +DROP TABLE t1,t2; +CREATE TABLE t1 (i FLOAT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1.5),(3.2),(2.71); +CREATE TABLE t2 (j FLOAT, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3.2),(2.71); +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +2.71 +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 3, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "sq.i = 2.7100000381469727", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.i = 2.7100000381469727" + } + } + } + } + } +} +DROP TABLE t1,t2; +CREATE TABLE t1 (i DECIMAL(10,2)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1.5),(3.21),(2.47); +CREATE TABLE t2 (j DECIMAL(10,2), KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3.21),(4.55); +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +3.21 +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 3, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "sq.i = 3.21", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.i = 3.21" + } + } + } + } + } +} +DROP TABLE t1,t2; +CREATE TABLE t1 (i VARCHAR(32)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('cc'),('aa'),('ddd'); +CREATE TABLE t2 (j VARCHAR(16), KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('bbb'),('aa'); +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +aa +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 3, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "sq.i = 'aa'", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.i = 'aa'" + } + } + } + } + } +} +DROP TABLE t1,t2; +CREATE TABLE t1 (i DATETIME) ENGINE=MyISAM; +INSERT INTO t1 VALUES +('2008-09-27 00:34:58'),('2007-05-28 00:00:00'), ('2009-07-25 09:21:20'); +CREATE TABLE t2 (j DATETIME, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES +('2007-05-28 00:00:00'), ('2010-08-25 00:00:00'); +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +2007-05-28 00:00:00 +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 3, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "sq.i = 2007-05-28 00:00:00", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.i = TIMESTAMP'2007-05-28 00:00:00'" + } + } + } + } + } +} +DROP TABLE t1,t2; +CREATE TABLE t1 (i DATE) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('2008-09-27'),('2007-05-28'), ('2009-07-25'); +CREATE TABLE t2 (j DATE, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('2007-05-28'), ('2010-08-25'); +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +2007-05-28 +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 3, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "sq.i = 2007-05-28", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.i = TIMESTAMP'2007-05-28 00:00:00'" + } + } + } + } + } +} +DROP TABLE t1,t2; +CREATE TABLE t1 (i TIME) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('00:34:58'),('10:00:02'), ('09:21:20'); +CREATE TABLE t2 (j TIME, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('10:00:02'), ('11:00:10'); +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +10:00:02 +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 3, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "sq.i = 10:00:02", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.i = TIME'10:00:02'" + } + } + } + } + } +} +DROP TABLE t1,t2; +# +# MDEV-11593: pushdown of condition with NULLIF +# +CREATE TABLE t1 (i INT); +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (2), (1); +SELECT * FROM v1 WHERE NULLIF(1, i); +i +2 +EXPLAIN FORMAT=JSON +SELECT * FROM v1 WHERE NULLIF(1, i); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "nullif(1,v1.i)", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "nullif(1,t1.i)" + } + } + } + } + } +} +DROP VIEW v1; +DROP TABLE t1; +# +# MDEV-11608: pushdown of the predicate with cached null value +# +CREATE TABLE t1 (c VARCHAR(3)); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES ('foo'),('bar'); +CREATE TABLE t2 (c VARCHAR(3)); +INSERT INTO t2 VALUES ('foo'),('xyz'); +SELECT * FROM v1 WHERE v1.c IN ( SELECT MIN(c) FROM t2 WHERE 0 ); +c +EXPLAIN FORMAT=JSON +SELECT * FROM v1 WHERE v1.c IN ( SELECT MIN(c) FROM t2 WHERE 0 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 2, + "table": { + "message": "Impossible WHERE" + } + } + } + }, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v1.c = NULL", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.c = NULL" + } + } + } + } + } +} +DROP VIEW v1; +DROP TABLE t1,t2; +CREATE TABLE t1 (d DECIMAL(10,2)); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (5.37),(1.1); +CREATE TABLE t2 (d DECIMAL(10,2)); +INSERT INTO t2 VALUES ('1.1'),('2.23'); +SELECT * FROM v1 WHERE v1.d IN ( SELECT MIN(d) FROM t2 WHERE 0 ); +d +DROP VIEW v1; +DROP TABLE t1,t2; diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result index 52df8bf0012..316d7bdc4bc 100644 --- a/mysql-test/r/derived_view.result +++ b/mysql-test/r/derived_view.result @@ -36,7 +36,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 1 SIMPLE t2 ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`f2` = `test`.`t1`.`f1`) +Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`f2` = `test`.`t1`.`f1` select * from (select * from t1 join t2 on f1=f2) tt; f1 f11 f2 f22 1 1 1 1 @@ -48,7 +48,7 @@ select * from (select * from t1 where f1 in (2,3)) tt where f11=2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where ((`test`.`t1`.`f11` = 2) and (`test`.`t1`.`f1` in (2,3))) +Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f11` = 2 and `test`.`t1`.`f1` in (2,3) select * from (select * from t1 where f1 in (2,3)) tt where f11=2; f1 f11 2 2 @@ -60,7 +60,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` join `test`.`t1` where ((`test`.`t1`.`f1` = `test`.`t1`.`f1`) and (`test`.`t1`.`f1` in (1,2)) and (`test`.`t1`.`f1` in (2,3))) +Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` join `test`.`t1` where `test`.`t1`.`f1` = `test`.`t1`.`f1` and `test`.`t1`.`f1` in (1,2) and `test`.`t1`.`f1` in (2,3) select * from (select * from t1 where f1 in (2,3)) tt join (select * from t1 where f1 in (1,2)) aa on tt.f1=aa.f1; f1 f11 f1 f11 @@ -71,7 +71,7 @@ select * from (select * from t1 where f1 in (2,3)) tt where f11=2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where ((`test`.`t1`.`f11` = 2) and (`test`.`t1`.`f1` in (2,3))) +Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f11` = 2 and `test`.`t1`.`f1` in (2,3) show status like 'Handler_read%'; Variable_name Value Handler_read_first 0 @@ -128,7 +128,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 1 SIMPLE t2 ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`f2` = `test`.`t1`.`f1`) +Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`f2` = `test`.`t1`.`f1` select * from v2; f1 f11 f2 f22 1 1 1 1 @@ -139,7 +139,7 @@ explain extended select * from v3 where f11 in (1,3); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where ((`test`.`t1`.`f11` in (1,3)) and (`test`.`t1`.`f1` in (2,3))) +Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f11` in (1,3) and `test`.`t1`.`f1` in (2,3) select * from v3 where f11 in (1,3); f1 f11 3 3 @@ -150,7 +150,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`f2` = `test`.`t1`.`f1`) and (`test`.`t1`.`f1` in (2,3)) and (`test`.`t1`.`f1` in (2,3))) +Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`f2` = `test`.`t1`.`f1` and `test`.`t1`.`f1` in (2,3) and `test`.`t1`.`f1` in (2,3) select * from v3 join v4 on f1=f2; f1 f11 f2 f22 3 3 3 3 @@ -160,7 +160,7 @@ explain extended select * from v4 where f2 in (1,3); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 11 100.00 Using where Warnings: -Note 1003 select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t2` where ((`test`.`t2`.`f2` in (1,3)) and (`test`.`t2`.`f2` in (2,3))) +Note 1003 select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t2` where `test`.`t2`.`f2` in (1,3) and `test`.`t2`.`f2` in (2,3) show status like 'Handler_read%'; Variable_name Value Handler_read_first 0 @@ -216,7 +216,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY ref key0 key0 5 test.t1.f1 2 100.00 2 DERIVED t2 ALL NULL NULL NULL NULL 11 100.00 Using temporary; Using filesort Warnings: -Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`tt`.`f2` AS `f2`,`tt`.`f22` AS `f22` from `test`.`t1` join (select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t2` group by `test`.`t2`.`f2`) `tt` where (`tt`.`f2` = `test`.`t1`.`f1`) +Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`tt`.`f2` AS `f2`,`tt`.`f22` AS `f22` from `test`.`t1` join (select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t2` group by `test`.`t2`.`f2`) `tt` where `tt`.`f2` = `test`.`t1`.`f1` select * from t1 join (select * from t2 group by f2) tt on f1=f2; f1 f11 f2 f22 1 1 1 1 @@ -290,7 +290,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY ref key0 key0 5 test.t1.f1 2 100.00 2 DERIVED t2 ALL NULL NULL NULL NULL 11 100.00 Using temporary; Using filesort Warnings: -Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`v2`.`f2` AS `f2`,`v2`.`f22` AS `f22` from `test`.`t1` join `test`.`v2` where (`v2`.`f2` = `test`.`t1`.`f1`) +Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`v2`.`f2` AS `f2`,`v2`.`f22` AS `f22` from `test`.`t1` join `test`.`v2` where `v2`.`f2` = `test`.`t1`.`f1` select * from t1 join v2 on f1=f2; f1 f11 f2 f22 1 1 1 1 @@ -307,7 +307,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 2 DERIVED t11 ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`v31`.`f1` AS `f1`,`v31`.`f11` AS `f11`,`v3`.`f1` AS `f1`,`v3`.`f11` AS `f11` from `test`.`t1` join `test`.`v3` `v31` join `test`.`v3` where ((`v31`.`f1` = `test`.`t1`.`f1`) and (`v3`.`f1` = `test`.`t1`.`f1`)) +Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`v31`.`f1` AS `f1`,`v31`.`f11` AS `f11`,`v3`.`f1` AS `f1`,`v3`.`f11` AS `f11` from `test`.`t1` join `test`.`v3` `v31` join `test`.`v3` where `v31`.`f1` = `test`.`t1`.`f1` and `v3`.`f1` = `test`.`t1`.`f1` flush status; select * from t1,v3 as v31,v3 where t1.f1=v31.f1 and t1.f1=v3.f1; f1 f11 f1 f11 f1 f11 @@ -374,7 +374,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY ref key0 key0 5 test.t2.f2 2 100.00 2 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort Warnings: -Note 1003 select `v1`.`f1` AS `f1`,`v1`.`f11` AS `f11`,`test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`v1` join `test`.`t2` where ((`v1`.`f1` = `test`.`t2`.`f2`) and (`test`.`t2`.`f2` in (2,3))) +Note 1003 select `v1`.`f1` AS `f1`,`v1`.`f11` AS `f11`,`test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`v1` join `test`.`t2` where `v1`.`f1` = `test`.`t2`.`f2` and `test`.`t2`.`f2` in (2,3) explain format=json select * from v1 join v4 on f1=f2; EXPLAIN { @@ -385,7 +385,7 @@ EXPLAIN "access_type": "ALL", "rows": 11, "filtered": 100, - "attached_condition": "((t2.f2 in (2,3)) and (t2.f2 is not null))" + "attached_condition": "t2.f2 in (2,3) and t2.f2 is not null" }, "table": { "table_name": "", @@ -408,7 +408,7 @@ EXPLAIN "access_type": "ALL", "rows": 11, "filtered": 100, - "attached_condition": "(t1.f1 in (2,3))" + "attached_condition": "t1.f1 in (2,3)" } } } @@ -427,7 +427,7 @@ explain extended select * from (select * from id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where ((`test`.`t1`.`f1` > 2) and (`test`.`t1`.`f1` < 7)) +Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f1` > 2 and `test`.`t1`.`f1` < 7 select * from (select * from (select * from t1 where f1 < 7) tt where f1 > 2) zz; f1 f11 @@ -440,7 +440,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY ALL NULL NULL NULL NULL 11 100.00 Using where 3 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort Warnings: -Note 1003 select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where ((`test`.`t1`.`f1` < 7) and (`test`.`t1`.`f1` > 2)) group by `test`.`t1`.`f1`) `tt` where (`tt`.`f1` > 2) +Note 1003 select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f1` < 7 and `test`.`t1`.`f1` > 2 group by `test`.`t1`.`f1`) `tt` where `tt`.`f1` > 2 select * from (select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) zz; f1 f11 @@ -453,7 +453,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY ALL NULL NULL NULL NULL 11 100.00 2 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort Warnings: -Note 1003 select `zz`.`f1` AS `f1`,`zz`.`f11` AS `f11` from (select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where ((`test`.`t1`.`f1` > 2) and (`test`.`t1`.`f1` < 7)) group by `test`.`t1`.`f1`) `zz` +Note 1003 select `zz`.`f1` AS `f1`,`zz`.`f11` AS `f11` from (select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f1` > 2 and `test`.`t1`.`f1` < 7 group by `test`.`t1`.`f1`) `zz` select * from (select * from (select * from t1 where f1 < 7) tt where f1 > 2 group by f1) zz; f1 f11 @@ -467,7 +467,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DERIVED ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort 3 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort Warnings: -Note 1003 select `zz`.`f1` AS `f1`,`zz`.`f11` AS `f11` from (select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where ((`test`.`t1`.`f1` < 7) and (`test`.`t1`.`f1` > 2)) group by `test`.`t1`.`f1`) `tt` where (`tt`.`f1` > 2) group by `tt`.`f1`) `zz` +Note 1003 select `zz`.`f1` AS `f1`,`zz`.`f11` AS `f11` from (select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f1` < 7 and `test`.`t1`.`f1` > 2 group by `test`.`t1`.`f1`) `tt` where `tt`.`f1` > 2 group by `tt`.`f1`) `zz` explain format=json select * from (select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) zz; EXPLAIN @@ -490,7 +490,7 @@ EXPLAIN "access_type": "ALL", "rows": 11, "filtered": 100, - "attached_condition": "(tt.f1 > 2)", + "attached_condition": "tt.f1 > 2", "materialized": { "query_block": { "select_id": 3, @@ -502,7 +502,7 @@ EXPLAIN "access_type": "ALL", "rows": 11, "filtered": 100, - "attached_condition": "((t1.f1 < 7) and (t1.f1 > 2))" + "attached_condition": "t1.f1 < 7 and t1.f1 > 2" } } } @@ -533,7 +533,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 5 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort 3 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort Warnings: -Note 1003 select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11`,`tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where ((`test`.`t1`.`f1` < 7) and (`test`.`t1`.`f1` > 2) and (`test`.`t1`.`f1` > 2)) group by `test`.`t1`.`f1`) `tt` join (select `t1`.`f1` AS `f1`,`t1`.`f11` AS `f11` from `test`.`t1` where ((`t1`.`f1` < 7) and (`t1`.`f1` > 2) and (`t1`.`f1` > 2)) group by `t1`.`f1`) `tt` where ((`tt`.`f1` = `tt`.`f1`) and (`tt`.`f1` > 2) and (`tt`.`f1` > 2)) +Note 1003 select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11`,`tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f1` < 7 and `test`.`t1`.`f1` > 2 and `test`.`t1`.`f1` > 2 group by `test`.`t1`.`f1`) `tt` join (select `t1`.`f1` AS `f1`,`t1`.`f11` AS `f11` from `test`.`t1` where `t1`.`f1` < 7 and `t1`.`f1` > 2 and `t1`.`f1` > 2 group by `t1`.`f1`) `tt` where `tt`.`f1` = `tt`.`f1` and `tt`.`f1` > 2 and `tt`.`f1` > 2 explain format=json select * from (select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) x join @@ -548,7 +548,7 @@ EXPLAIN "access_type": "ALL", "rows": 11, "filtered": 100, - "attached_condition": "((tt.f1 > 2) and (tt.f1 > 2) and (tt.f1 is not null))", + "attached_condition": "tt.f1 > 2 and tt.f1 > 2 and tt.f1 is not null", "materialized": { "query_block": { "select_id": 3, @@ -560,7 +560,7 @@ EXPLAIN "access_type": "ALL", "rows": 11, "filtered": 100, - "attached_condition": "((t1.f1 < 7) and (t1.f1 > 2) and (t1.f1 > 2))" + "attached_condition": "t1.f1 < 7 and t1.f1 > 2 and t1.f1 > 2" } } } @@ -588,7 +588,7 @@ EXPLAIN "access_type": "ALL", "rows": 11, "filtered": 100, - "attached_condition": "((t1.f1 < 7) and (t1.f1 > 2) and (t1.f1 > 2))" + "attached_condition": "t1.f1 < 7 and t1.f1 > 2 and t1.f1 > 2" } } } @@ -630,7 +630,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`t1`.`f1` AS `f1`,`t1`.`f11` AS `f11` from `test`.`t1` join `test`.`t1` where ((`t1`.`f1` = `test`.`t1`.`f1`) and (`test`.`t1`.`f1` > 2) and (`test`.`t1`.`f1` < 7) and (`test`.`t1`.`f1` > 2) and (`test`.`t1`.`f1` < 7)) +Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`t1`.`f1` AS `f1`,`t1`.`f11` AS `f11` from `test`.`t1` join `test`.`t1` where `t1`.`f1` = `test`.`t1`.`f1` and `test`.`t1`.`f1` > 2 and `test`.`t1`.`f1` < 7 and `test`.`t1`.`f1` > 2 and `test`.`t1`.`f1` < 7 select * from (select * from (select * from t1 where f1 < 7 ) tt where f1 > 2 ) x @@ -658,7 +658,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DERIVED ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort 3 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort Warnings: -Note 1003 select `x`.`f1` AS `f1`,`x`.`f11` AS `f11`,`z`.`f1` AS `f1`,`z`.`f11` AS `f11` from (select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where ((`test`.`t1`.`f1` < 7) and (`test`.`t1`.`f1` > 2)) group by `test`.`t1`.`f1`) `tt` where (`tt`.`f1` > 2) group by `tt`.`f1`) `x` join (select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (select `t1`.`f1` AS `f1`,`t1`.`f11` AS `f11` from `test`.`t1` where ((`t1`.`f1` < 7) and (`t1`.`f1` > 2)) group by `t1`.`f1`) `tt` where (`tt`.`f1` > 2) group by `tt`.`f1`) `z` where (`z`.`f1` = `x`.`f1`) +Note 1003 select `x`.`f1` AS `f1`,`x`.`f11` AS `f11`,`z`.`f1` AS `f1`,`z`.`f11` AS `f11` from (select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f1` < 7 and `test`.`t1`.`f1` > 2 group by `test`.`t1`.`f1`) `tt` where `tt`.`f1` > 2 group by `tt`.`f1`) `x` join (select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (select `t1`.`f1` AS `f1`,`t1`.`f11` AS `f11` from `test`.`t1` where `t1`.`f1` < 7 and `t1`.`f1` > 2 group by `t1`.`f1`) `tt` where `tt`.`f1` > 2 group by `tt`.`f1`) `z` where `z`.`f1` = `x`.`f1` explain format=json select * from (select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) x @@ -675,7 +675,7 @@ EXPLAIN "access_type": "ALL", "rows": 11, "filtered": 100, - "attached_condition": "(x.f1 is not null)", + "attached_condition": "x.f1 is not null", "materialized": { "query_block": { "select_id": 2, @@ -687,7 +687,7 @@ EXPLAIN "access_type": "ALL", "rows": 11, "filtered": 100, - "attached_condition": "(tt.f1 > 2)", + "attached_condition": "tt.f1 > 2", "materialized": { "query_block": { "select_id": 3, @@ -699,7 +699,7 @@ EXPLAIN "access_type": "ALL", "rows": 11, "filtered": 100, - "attached_condition": "((t1.f1 < 7) and (t1.f1 > 2))" + "attached_condition": "t1.f1 < 7 and t1.f1 > 2" } } } @@ -732,7 +732,7 @@ EXPLAIN "access_type": "ALL", "rows": 11, "filtered": 100, - "attached_condition": "(tt.f1 > 2)", + "attached_condition": "tt.f1 > 2", "materialized": { "query_block": { "select_id": 5, @@ -744,7 +744,7 @@ EXPLAIN "access_type": "ALL", "rows": 11, "filtered": 100, - "attached_condition": "((t1.f1 < 7) and (t1.f1 > 2))" + "attached_condition": "t1.f1 < 7 and t1.f1 > 2" } } } @@ -775,7 +775,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY ALL NULL NULL NULL NULL 11 100.00 2 DERIVED t2 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort Warnings: -Note 1003 select `tt`.`f2` AS `f2`,`tt`.`f22` AS `f22` from (select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t2` where (`test`.`t2`.`f2` in (2,3)) group by 1) `tt` +Note 1003 select `tt`.`f2` AS `f2`,`tt`.`f22` AS `f22` from (select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t2` where `test`.`t2`.`f2` in (2,3) group by 1) `tt` select * from (select * from v4 group by 1) tt; f2 f22 2 2 @@ -787,7 +787,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY ALL NULL NULL NULL NULL 11 100.00 Using where 3 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort Warnings: -Note 1003 select `v1`.`f1` AS `f1`,`v1`.`f11` AS `f11` from `test`.`v1` where (`v1`.`f1` < 7) +Note 1003 select `v1`.`f1` AS `f1`,`v1`.`f11` AS `f11` from `test`.`v1` where `v1`.`f1` < 7 explain format=json select * from ( select * from v1 where f1 < 7) tt; EXPLAIN @@ -799,7 +799,7 @@ EXPLAIN "access_type": "ALL", "rows": 11, "filtered": 100, - "attached_condition": "(v1.f1 < 7)", + "attached_condition": "v1.f1 < 7", "materialized": { "query_block": { "select_id": 3, @@ -811,7 +811,7 @@ EXPLAIN "access_type": "ALL", "rows": 11, "filtered": 100, - "attached_condition": "(t1.f1 < 7)" + "attached_condition": "t1.f1 < 7" } } } @@ -832,7 +832,7 @@ explain extended select * from (select * from v6) tt; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 11 100.00 Using where Warnings: -Note 1003 select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t2` where ((`test`.`t2`.`f2` < 7) and (`test`.`t2`.`f2` in (2,3))) +Note 1003 select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t2` where `test`.`t2`.`f2` < 7 and `test`.`t2`.`f2` in (2,3) select * from (select * from v6) tt; f2 f22 3 3 @@ -866,7 +866,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY ref key0 key0 5 test.t2.f2 2 100.00 5 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort Warnings: -Note 1003 select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22`,`v1`.`f1` AS `f1`,`v1`.`f11` AS `f11` from `test`.`t2` join `test`.`v1` where ((`v1`.`f1` = `test`.`t2`.`f2`) and (`test`.`t2`.`f2` < 7) and (`test`.`t2`.`f2` in (2,3))) +Note 1003 select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22`,`v1`.`f1` AS `f1`,`v1`.`f11` AS `f11` from `test`.`t2` join `test`.`v1` where `v1`.`f1` = `test`.`t2`.`f2` and `test`.`t2`.`f2` < 7 and `test`.`t2`.`f2` in (2,3) explain format=json select * from v6 join v7 on f2=f1; EXPLAIN { @@ -877,7 +877,7 @@ EXPLAIN "access_type": "ALL", "rows": 11, "filtered": 100, - "attached_condition": "((t2.f2 < 7) and (t2.f2 in (2,3)) and (t2.f2 is not null))" + "attached_condition": "t2.f2 < 7 and t2.f2 in (2,3) and t2.f2 is not null" }, "table": { "table_name": "", @@ -900,7 +900,7 @@ EXPLAIN "access_type": "ALL", "rows": 11, "filtered": 100, - "attached_condition": "(t1.f1 in (2,3))" + "attached_condition": "t1.f1 in (2,3)" } } } @@ -1050,7 +1050,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t`.`a` AS `a` from `test`.`t1` left join (`test`.`t2` `t` join `test`.`t3`) on(((`test`.`t`.`a` >= 1) and (`test`.`t3`.`b` > 5))) where 1 group by `test`.`t`.`a` +Note 1003 select `test`.`t`.`a` AS `a` from `test`.`t1` left join (`test`.`t2` `t` join `test`.`t3`) on(`test`.`t`.`a` >= 1 and `test`.`t3`.`b` > 5) where 1 group by `test`.`t`.`a` SELECT t.a FROM t1 LEFT JOIN (t2 t JOIN t3 ON t3.b > 5) ON t.a >= 1 GROUP BY t.a; @@ -1065,7 +1065,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`a` >= 1) and (`test`.`t3`.`b` > 5))) where 1 group by `test`.`t2`.`a` +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`a` >= 1 and `test`.`t3`.`b` > 5) where 1 group by `test`.`t2`.`a` SELECT t.a FROM t1 LEFT JOIN (( SELECT * FROM t2 ) t JOIN t3 ON t3.b > 5) ON t.a >= 1 GROUP BY t.a; @@ -1081,7 +1081,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`a` >= 1) and (`test`.`t3`.`b` > 5))) where 1 group by `test`.`t2`.`a` +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`a` >= 1 and `test`.`t3`.`b` > 5) where 1 group by `test`.`t2`.`a` SELECT t.a FROM t1 LEFT JOIN (v1 t JOIN t3 ON t3.b > 5) ON t.a >= 1 GROUP BY t.a; @@ -1143,7 +1143,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) 3 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00 Using temporary; Using filesort Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <`test`.`t3`.`a`>((`test`.`t3`.`a`,(select `v1`.`a` from `test`.`v1` join `test`.`t2` where ((`test`.`t2`.`a` = `v1`.`b`) and ((`test`.`t3`.`a`) = `v1`.`a`))))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <`test`.`t3`.`a`>((`test`.`t3`.`a`,(select `v1`.`a` from `test`.`v1` join `test`.`t2` where `test`.`t2`.`a` = `v1`.`b` and (`test`.`t3`.`a`) = `v1`.`a`))) SELECT * FROM t3 WHERE t3.a IN (SELECT v1.a FROM v1, t2 WHERE t2.a = v1.b); a @@ -1233,7 +1233,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 0 0.00 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t3`.`b` AS `b`,`test`.`t1`.`a` AS `a` from `test`.`t3` left join (`test`.`t2` join `test`.`t1`) on((`test`.`t3`.`a` <> 0)) where ((`test`.`t1`.`a` = `test`.`t1`.`a`) or (`test`.`t3`.`b` <> 0)) +Note 1003 select `test`.`t3`.`b` AS `b`,`test`.`t1`.`a` AS `a` from `test`.`t3` left join (`test`.`t2` join `test`.`t1`) on(`test`.`t3`.`a` <> 0) where `test`.`t1`.`a` = `test`.`t1`.`a` or `test`.`t3`.`b` <> 0 DROP VIEW v1; DROP TABLE t1,t2,t3; # @@ -1624,7 +1624,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 't.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (1,<`test`.`t1`.`a`>(exists(select 28 from `test`.`t3` where ('j' < `test`.`t1`.`a`)))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (1,<`test`.`t1`.`a`>(exists(select 28 from `test`.`t3` where 'j' < `test`.`t1`.`a`))) SELECT * FROM (SELECT * FROM t1) AS t WHERE EXISTS (SELECT t2.a FROM t3 RIGHT JOIN t2 ON (t3.a = t2.a) WHERE t2.b < t.a); @@ -1663,7 +1663,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t5 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select straight_join `test`.`s2`.`a` AS `a`,`test`.`s3`.`a` AS `a`,`test`.`s3`.`c` AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`test`.`t5`.`d` AS `d` from `test`.`t2` `s2` join `test`.`t3` `s3` left join (`test`.`t4` left join `test`.`t3` on((`test`.`t4`.`a` <> 0))) on((`test`.`s3`.`a` <> 0)) join `test`.`t5` where ((`test`.`t5`.`d` = 0) and (`test`.`s3`.`c` <> 0) and (`test`.`s2`.`a` <> 0)) +Note 1003 select straight_join `test`.`s2`.`a` AS `a`,`test`.`s3`.`a` AS `a`,`test`.`s3`.`c` AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`test`.`t5`.`d` AS `d` from `test`.`t2` `s2` join `test`.`t3` `s3` left join (`test`.`t4` left join `test`.`t3` on(`test`.`t4`.`a` <> 0)) on(`test`.`s3`.`a` <> 0) join `test`.`t5` where `test`.`t5`.`d` = 0 and `test`.`s3`.`c` <> 0 and `test`.`s2`.`a` <> 0 SELECT STRAIGHT_JOIN * FROM ( t2 AS s2 JOIN @@ -1690,7 +1690,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t4 ALL NULL NULL NULL NULL 0 0.00 Using where 1 SIMPLE s3 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select straight_join `test`.`s2`.`a` AS `a`,`test`.`t5`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`test`.`t4`.`a` AS `a`,`test`.`s3`.`a` AS `a`,`test`.`s3`.`c` AS `c` from `test`.`t2` `s2` join `test`.`t5` join `test`.`t3` left join (`test`.`t4` left join `test`.`t3` `s3` on((`test`.`t4`.`a` <> 0))) on((`test`.`t3`.`a` <> 0)) where ((`test`.`t5`.`d` = 0) and (`test`.`s2`.`a` <> 0) and (`test`.`t3`.`c` <> 0)) +Note 1003 select straight_join `test`.`s2`.`a` AS `a`,`test`.`t5`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`test`.`t4`.`a` AS `a`,`test`.`s3`.`a` AS `a`,`test`.`s3`.`c` AS `c` from `test`.`t2` `s2` join `test`.`t5` join `test`.`t3` left join (`test`.`t4` left join `test`.`t3` `s3` on(`test`.`t4`.`a` <> 0)) on(`test`.`t3`.`a` <> 0) where `test`.`t5`.`d` = 0 and `test`.`s2`.`a` <> 0 and `test`.`t3`.`c` <> 0 SELECT STRAIGHT_JOIN * FROM t2 AS s2 , t5, (t3 LEFT JOIN (t4 LEFT JOIN t3 AS s3 ON t4.a != 0) ON t3.a != 0) @@ -1712,7 +1712,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t4 ALL NULL NULL NULL NULL 0 0.00 Using where 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select straight_join `test`.`t2`.`a` AS `a`,`test`.`t5`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c` from `test`.`t2` join `test`.`t5` join `test`.`t3` left join (`test`.`t4` left join (`test`.`t3`) on((`test`.`t4`.`a` <> 0))) on((`test`.`t3`.`a` <> 0)) where ((`test`.`t5`.`d` = 0) and (`test`.`t2`.`a` <> 0) and (`test`.`t3`.`c` <> 0)) +Note 1003 select straight_join `test`.`t2`.`a` AS `a`,`test`.`t5`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c` from `test`.`t2` join `test`.`t5` join `test`.`t3` left join (`test`.`t4` left join (`test`.`t3`) on(`test`.`t4`.`a` <> 0)) on(`test`.`t3`.`a` <> 0) where `test`.`t5`.`d` = 0 and `test`.`t2`.`a` <> 0 and `test`.`t3`.`c` <> 0 SELECT STRAIGHT_JOIN * FROM v2 AS s2 , t5, (t3 LEFT JOIN (t4 LEFT JOIN v3 AS s3 ON t4.a != 0) ON t3.a != 0) @@ -2018,7 +2018,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t2`.`b` <> 0)) +Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t2`.`b` <> 0 SELECT t.b, t.c, t1.a FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t WHERE t.b AND t.c = t1.a; @@ -2033,7 +2033,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t2`.`b` <> 0)) +Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t2`.`b` <> 0 SELECT t.b, t.c, t1.a FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t WHERE t.b <> 0 AND t.c = t1.a; @@ -2049,7 +2049,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on((`test`.`t3`.`b` = `test`.`t2`.`a`)) where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t2`.`b` <> 0)) +Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`b` = `test`.`t2`.`a`) where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t2`.`b` <> 0 SELECT t.b, t.c, t1.a FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t WHERE t.b AND t.c = t1.a; @@ -2064,7 +2064,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on((`test`.`t3`.`b` = `test`.`t2`.`a`)) where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t2`.`b` <> 0)) +Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`b` = `test`.`t2`.`a`) where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t2`.`b` <> 0 SELECT t.b, t.c, t1.a FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t WHERE t.b <> 0 AND t.c = t1.a; @@ -2517,7 +2517,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY ref key0 key0 5 test.t2.c2 2 100.00 Using where 2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 Warnings: -Note 1003 select `v1`.`c1` AS `c1`,`v1`.`c2` AS `c2` from `test`.`v1` join `test`.`t2` where ((`v1`.`c1` = `test`.`t2`.`c1`) and (`v1`.`c2` = `test`.`t2`.`c2`)) +Note 1003 select `v1`.`c1` AS `c1`,`v1`.`c2` AS `c2` from `test`.`v1` join `test`.`t2` where `v1`.`c1` = `test`.`t2`.`c1` and `v1`.`c2` = `test`.`t2`.`c2` SELECT v1.c1, v1.c2 FROM v1, t2 WHERE v1.c1=t2.c1 AND v1.c2=t2.c2; c1 c2 c 3 @@ -2530,7 +2530,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY ref key0 key0 5 test.t2.c2 2 100.00 Using where 2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 Using temporary; Using filesort Warnings: -Note 1003 select `test`.`t2`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from (select `test`.`t1`.`c1` AS `g`,max(`test`.`t1`.`c2`) AS `m` from `test`.`t1` group by `test`.`t1`.`c1`) `t` join `test`.`t2` where ((`t`.`g` = `test`.`t2`.`c1`) and (`t`.`m` = `test`.`t2`.`c2`)) +Note 1003 select `test`.`t2`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from (select `test`.`t1`.`c1` AS `g`,max(`test`.`t1`.`c2`) AS `m` from `test`.`t1` group by `test`.`t1`.`c1`) `t` join `test`.`t2` where `t`.`g` = `test`.`t2`.`c1` and `t`.`m` = `test`.`t2`.`c2` SELECT t2.c1, t2.c2 FROM (SELECT c1 g, MAX(c2) m FROM t1 GROUP BY c1) t, t2 WHERE t.g=t2.c1 AND t.m=t2.c2; c1 c2 @@ -2542,7 +2542,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) 2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 Warnings: -Note 1003 select `v1`.`c1` AS `c1`,`v1`.`c2` AS `c2`,`test`.`t2`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`v1` join `test`.`t2` where (`v1`.`c1` = `test`.`t2`.`c1`) +Note 1003 select `v1`.`c1` AS `c1`,`v1`.`c2` AS `c2`,`test`.`t2`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`v1` join `test`.`t2` where `v1`.`c1` = `test`.`t2`.`c1` SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1; c1 c2 c1 c2 c 3 c 3 @@ -2826,5 +2826,90 @@ DROP TABLE t1,t2; # # end of 5.3 tests # +# +# Bug mdev-11161: The second execution of prepared statement +# does not use generated key for materialized +# derived table / view +# (actually this is a 5.3 bug.) +# +create table t1 ( +mat_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, +matintnum CHAR(6) NOT NULL, +test MEDIUMINT UNSIGNED NULL +); +create table t2 ( +mat_id MEDIUMINT UNSIGNED NOT NULL, +pla_id MEDIUMINT UNSIGNED NOT NULL +); +insert into t1 values +(NULL, 'a', 1), (NULL, 'b', 2), (NULL, 'c', 3), (NULL, 'd', 4), +(NULL, 'e', 5), (NULL, 'f', 6), (NULL, 'g', 7), (NULL, 'h', 8), +(NULL, 'i', 9); +insert into t2 values +(1, 100), (1, 101), (1, 102), (2, 100), (2, 103), (2, 104), +(3, 101), (3, 102), (3, 105); +explain +SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id +FROM t1 m2 +INNER JOIN +(SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum +FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id +GROUP BY mp.pla_id) d +ON d.matintnum=m2.matintnum; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY m2 ALL NULL NULL NULL NULL 9 +1 PRIMARY ref key0 key0 7 test.m2.matintnum 2 +2 DERIVED mp ALL NULL NULL NULL NULL 9 Using temporary; Using filesort +2 DERIVED m1 eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1 +prepare stmt1 from +"SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id + FROM t1 m2 + INNER JOIN + (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum + FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id + GROUP BY mp.pla_id) d + ON d.matintnum=m2.matintnum"; +flush status; +execute stmt1; +pla_id mat_id +102 1 +101 1 +100 1 +104 2 +103 2 +105 3 +show status like '%Handler_read%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 21 +Handler_read_last 0 +Handler_read_next 6 +Handler_read_prev 0 +Handler_read_retry 0 +Handler_read_rnd 6 +Handler_read_rnd_deleted 0 +Handler_read_rnd_next 27 +flush status; +execute stmt1; +pla_id mat_id +102 1 +101 1 +100 1 +104 2 +103 2 +105 3 +show status like '%Handler_read%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 21 +Handler_read_last 0 +Handler_read_next 6 +Handler_read_prev 0 +Handler_read_retry 0 +Handler_read_rnd 6 +Handler_read_rnd_deleted 0 +Handler_read_rnd_next 27 +deallocate prepare stmt1; +drop table t1,t2; set optimizer_switch=@exit_optimizer_switch; set join_cache_level=@exit_join_cache_level; diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index 6a67b5d0baf..8d7074cd270 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -920,7 +920,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) 2 DERIVED t1 ALL NULL NULL NULL NULL 96 100.00 Using where Warnings: -Note 1003 select straight_join distinct `test`.`t1`.`id` AS `id` from `test`.`t1` join `test`.`v1` join `test`.`t2` where ((`test`.`t2`.`i` = `v1`.`id`) and (`v1`.`i1` = `test`.`t1`.`i1`) and (`v1`.`id` <> 3)) +Note 1003 select straight_join distinct `test`.`t1`.`id` AS `id` from `test`.`t1` join `test`.`v1` join `test`.`t2` where `test`.`t2`.`i` = `v1`.`id` and `v1`.`i1` = `test`.`t1`.`i1` and `v1`.`id` <> 3 set join_buffer_size=1024; SELECT STRAIGHT_JOIN DISTINCT t1.id FROM t1, v1, t2 WHERE v1.id = t2.i AND t1.i1 = v1.i1 AND t2.i != 3; diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result index e2d69a75067..1a06380e66f 100644 --- a/mysql-test/r/drop.result +++ b/mysql-test/r/drop.result @@ -224,3 +224,9 @@ INSERT INTO table1 VALUES (1); ERROR 42S02: Unknown table 't.notable' DROP TABLE table1,table2; # End BUG#34750 +# +# MDEV-11105 Table named 'db' has weird side effect. +# +CREATE DATABASE mysqltest; +CREATE TABLE mysqltest.db(id INT); +DROP DATABASE mysqltest; diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result index 105123e2f1e..23d697835b0 100644 --- a/mysql-test/r/dyncol.result +++ b/mysql-test/r/dyncol.result @@ -157,7 +157,7 @@ select hex(COLUMN_CREATE(1, "afaf" AS char character set utf8, id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select hex(column_create(1,'afaf' AS char charset utf8 ,2,1212 AS unsigned int,3,1212 AS int,4,12.12 AS double,(4 + 1),12.12 AS decimal,6,'2011-04-05' AS date,7,'- 0:45:49.000001' AS time,8,'2011-04-05 0:45:49.000001' AS datetime)) AS `hex(COLUMN_CREATE(1, "afaf" AS char character set utf8, +Note 1003 select hex(column_create(1,'afaf' AS char charset utf8 ,2,1212 AS unsigned int,3,1212 AS int,4,12.12 AS double,4 + 1,12.12 AS decimal,6,'2011-04-05' AS date,7,'- 0:45:49.000001' AS time,8,'2011-04-05 0:45:49.000001' AS datetime)) AS `hex(COLUMN_CREATE(1, "afaf" AS char character set utf8, 2, 1212 AS unsigned int, 3, 1212 AS int, 4, 12.12 AS double, @@ -1731,36 +1731,36 @@ column_json(column_create(1, "val", 2, column_create(3, "val2"))) # Time encoding # select hex(column_create("t", "800:46:06.23434" AS time)) as hex, -column_json(column_create("t", "800:46:06.23434" AS time)) as json; -hex json +column_json(column_create("t", "800:46:06.23434" AS time)) as js; +hex js 04010001000000070074649363B82003 {"t":"800:46:06.234340"} select hex(column_create(1, "800:46:06.23434" AS time)) as hex, -column_json(column_create(1, "800:46:06.23434" AS time)) as json; -hex json +column_json(column_create(1, "800:46:06.23434" AS time)) as js; +hex js 000100010007649363B82003 {"1":"800:46:06.234340"} select hex(column_create("t", "800:46:06" AS time)) as hex, -column_json(column_create("t", "800:46:06" AS time)) as json; -hex json +column_json(column_create("t", "800:46:06" AS time)) as js; +hex js 04010001000000070074860B32 {"t":"800:46:06"} select hex(column_create(1, "800:46:06" AS time)) as hex, -column_json(column_create(1, "800:46:06" AS time)) as json; -hex json +column_json(column_create(1, "800:46:06" AS time)) as js; +hex js 000100010007000060B82003 {"1":"800:46:06"} select hex(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as hex, -column_json(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as json; -hex json +column_json(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as js; +hex js 0401000100000005007495B90F649363B80A00 {"t":"2012-12-21 10:46:06.234340"} select hex(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as hex, -column_json(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as json; -hex json +column_json(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as js; +hex js 00010001000595B90F649363B80A00 {"1":"2012-12-21 10:46:06.234340"} select hex(column_create("t", "2012-12-21 10:46:06" AS datetime)) as hex, -column_json(column_create("t", "2012-12-21 10:46:06" AS datetime)) as json; -hex json +column_json(column_create("t", "2012-12-21 10:46:06" AS datetime)) as js; +hex js 0401000100000005007495B90F86AB00 {"t":"2012-12-21 10:46:06"} select hex(column_create(1, "2012-12-21 10:46:06" AS datetime)) as hex, -column_json(column_create(1, "2012-12-21 10:46:06" AS datetime)) as json; -hex json +column_json(column_create(1, "2012-12-21 10:46:06" AS datetime)) as js; +hex js 00010001000595B90F000060B80A00 {"1":"2012-12-21 10:46:06"} # # MDEV-4849: Out of memory error and valgrind warnings on COLUMN_ADD @@ -1878,6 +1878,14 @@ COLUMN_JSON(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL)) # # Start of 10.2 tests # +create view v1 as select column_get(column_add(column_create(1 , 'blue' as char), 2, 'ttt'), 1 as char); +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select column_get(column_add(column_create(1,'blue' AS char charset utf8 ),2,'ttt'),1 as char charset utf8) AS `Name_exp_1` utf8 utf8_general_ci +select * from v1; +Name_exp_1 +blue +drop view v1; # # MDEV-10134 Add full support for DEFAULT # @@ -1900,16 +1908,16 @@ Table Create Table t1 CREATE TABLE `t1` ( `name` varchar(10) DEFAULT NULL, `value` varchar(10) DEFAULT NULL, - `dyncol0` blob DEFAULT COLUMN_CREATE(name, value), - `value_dyncol0_name0` varchar(10) DEFAULT (COLUMN_GET(dyncol0, 'name0' AS CHAR)), - `dyncol1` blob DEFAULT COLUMN_ADD(dyncol0, 'name1', 'value1'), - `value_dyncol1_name1` varchar(10) DEFAULT (COLUMN_GET(dyncol1, 'name1' AS CHAR)), - `dyncol2` blob DEFAULT COLUMN_DELETE(dyncol1, 'name1'), - `dyncol2_exists_name0` int(11) DEFAULT COLUMN_EXISTS(dyncol2, 'name0'), - `dyncol2_exists_name1` int(11) DEFAULT COLUMN_EXISTS(dyncol2, 'name1'), - `dyncol2_check` int(11) DEFAULT COLUMN_CHECK(dyncol2), - `dyncol1_list` text DEFAULT COLUMN_LIST(dyncol1), - `dyncol1_json` text DEFAULT COLUMN_JSON(dyncol1) + `dyncol0` blob DEFAULT column_create(`name`,`value`), + `value_dyncol0_name0` varchar(10) DEFAULT (column_get(`dyncol0`,'name0' as char charset utf8)), + `dyncol1` blob DEFAULT column_add(`dyncol0`,'name1','value1'), + `value_dyncol1_name1` varchar(10) DEFAULT (column_get(`dyncol1`,'name1' as char charset utf8)), + `dyncol2` blob DEFAULT column_add(`dyncol1`,'name1',NULL AS int), + `dyncol2_exists_name0` int(11) DEFAULT column_exists(`dyncol2`,'name0'), + `dyncol2_exists_name1` int(11) DEFAULT column_exists(`dyncol2`,'name1'), + `dyncol2_check` int(11) DEFAULT column_check(`dyncol2`), + `dyncol1_list` text DEFAULT column_list(`dyncol1`), + `dyncol1_json` text DEFAULT column_json(`dyncol1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (name,value) VALUES ('name0', 'value0'); SELECT value_dyncol0_name0, value_dyncol1_name1 FROM t1; diff --git a/mysql-test/r/errors.result b/mysql-test/r/errors.result index 3f5ad20fe6e..07fa646d558 100644 --- a/mysql-test/r/errors.result +++ b/mysql-test/r/errors.result @@ -142,7 +142,7 @@ SELECT (CONVERT('0' USING latin1) IN (CHAR(COT('v') USING utf8),'')); ERROR 22003: DOUBLE value is out of range in 'cot('v')' SET NAMES utf8 COLLATE utf8_latvian_ci ; SELECT UPDATEXML(-73 * -2465717823867977728,@@global.auto_increment_increment,null); -ERROR 22003: BIGINT value is out of range in '(-73 * -2465717823867977728)' +ERROR 22003: BIGINT value is out of range in '-73 * -2465717823867977728' # # End Bug#57882 # diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result index 81f75787c58..6d73f1ac4d6 100644 --- a/mysql-test/r/explain.result +++ b/mysql-test/r/explain.result @@ -99,45 +99,45 @@ KEY(b),KEY(b),KEY(b),KEY(b),KEY(b), KEY(b),KEY(b),KEY(b),KEY(b),KEY(b), KEY(b),KEY(b),KEY(b),KEY(b),KEY(b)); Warnings: -Note 1831 Duplicate index 'b_2' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_3' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_4' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_5' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_6' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_7' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_8' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_9' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_10' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_11' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_12' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_13' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_14' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_15' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_16' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_17' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_18' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_19' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_20' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_21' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_22' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_23' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_24' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_25' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_26' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_27' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_28' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_29' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_30' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_31' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_32' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_33' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_34' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_35' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_36' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_37' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_38' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_39' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'b_40' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_2`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_3`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_4`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_5`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_6`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_7`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_8`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_9`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_10`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_11`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_12`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_13`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_14`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_15`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_16`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_17`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_18`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_19`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_20`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_21`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_22`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_23`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_24`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_25`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_26`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_27`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_28`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_29`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_30`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_31`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_32`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_33`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_34`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_35`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_36`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_37`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_38`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_39`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `b_40`. This is deprecated and will be disallowed in a future release INSERT INTO t2 VALUES (),(),(); EXPLAIN SELECT 1 FROM (SELECT 1 FROM t2,t1 WHERE b < c GROUP BY 1 LIMIT 1) AS d2; @@ -268,7 +268,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1 -Note 1003 select (select 1 from `test`.`t2` where (`test`.`t2`.`d` = NULL)) AS `(SELECT 1 FROM t2 WHERE d = c)` from dual +Note 1003 select (select 1 from `test`.`t2` where `test`.`t2`.`d` = NULL) AS `(SELECT 1 FROM t2 WHERE d = c)` from dual DROP TABLE t1, t2; # # Bug#30302: Tables that were optimized away are printed in the @@ -288,7 +288,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select 1 AS `f1`,`test`.`t2`.`f2` AS `f2` from `test`.`t2` where (`test`.`t2`.`f2` = 1) +Note 1003 select 1 AS `f1`,`test`.`t2`.`f2` AS `f2` from `test`.`t2` where `test`.`t2`.`f2` = 1 drop table t1,t2; # # Bug #48419: another explain crash.. diff --git a/mysql-test/r/explain_json.result b/mysql-test/r/explain_json.result index ff0bc163a33..1af67cf6a4e 100644 --- a/mysql-test/r/explain_json.result +++ b/mysql-test/r/explain_json.result @@ -34,7 +34,7 @@ EXPLAIN "access_type": "ALL", "rows": 10, "filtered": 100, - "attached_condition": "(t0.a < 3)" + "attached_condition": "t0.a < 3" } } } @@ -56,7 +56,7 @@ EXPLAIN "access_type": "ALL", "rows": 10, "filtered": 100, - "attached_condition": "(t0.a is not null)" + "attached_condition": "t0.a is not null" }, "table": { "table_name": "t1", @@ -88,7 +88,7 @@ EXPLAIN "used_key_parts": ["a1"], "rows": 5, "filtered": 100, - "index_condition": "(t2.a1 < 5)" + "index_condition": "t2.a1 < 5" } } } @@ -116,7 +116,7 @@ EXPLAIN }, "rows": 2, "filtered": 100, - "attached_condition": "((t2.a1 = 1) or (t2.b1 = 2))" + "attached_condition": "t2.a1 = 1 or t2.b1 = 2" } } } @@ -144,7 +144,7 @@ EXPLAIN }, "rows": 2, "filtered": 100, - "attached_condition": "((t2.a1 = 1) or ((t2.b1 = 2) and (t2.b2 = 3)))" + "attached_condition": "t2.a1 = 1 or t2.b1 = 2 and t2.b2 = 3" } } } @@ -173,7 +173,7 @@ EXPLAIN }, "rows": 2, "filtered": 100, - "attached_condition": "(((t2.a1 = 1) and (t2.a2 = 1)) or ((t2.b1 = 2) and (t2.b2 = 1)))" + "attached_condition": "t2.a1 = 1 and t2.a2 = 1 or t2.b1 = 2 and t2.b2 = 1" } } } @@ -188,7 +188,7 @@ EXPLAIN "access_type": "ALL", "rows": 10, "filtered": 100, - "attached_condition": "(t0.a is not null)" + "attached_condition": "t0.a is not null" }, "table": { "table_name": "t2", @@ -302,7 +302,7 @@ EXPLAIN "access_type": "ALL", "rows": 10, "filtered": 100, - "attached_condition": "(t1.b = t0.a)" + "attached_condition": "t1.b = t0.a" } } } @@ -322,7 +322,7 @@ EXPLAIN "access_type": "ALL", "rows": 10, "filtered": 100, - "attached_condition": "((t0.a > (subquery#2)) or (t0.a < 3))" + "attached_condition": "t0.a > (subquery#2) or t0.a < 3" }, "subqueries": [ { @@ -335,7 +335,7 @@ EXPLAIN "access_type": "ALL", "rows": 10, "filtered": 100, - "attached_condition": "(t1.b = t0.a)" + "attached_condition": "t1.b = t0.a" } } } @@ -360,7 +360,7 @@ EXPLAIN "access_type": "ALL", "rows": 100, "filtered": 100, - "attached_condition": "(tbl1.b < 3)" + "attached_condition": "tbl1.b < 3" }, "block-nl-join": { "table": { @@ -368,12 +368,12 @@ EXPLAIN "access_type": "ALL", "rows": 100, "filtered": 100, - "attached_condition": "(tbl2.b < 5)" + "attached_condition": "tbl2.b < 5" }, "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(tbl2.a = tbl1.a)" + "attached_condition": "tbl2.a = tbl1.a" } } } @@ -411,7 +411,7 @@ EXPLAIN "table_name": "t0", "access_type": "ALL", "rows": 10, - "attached_condition": "(t0.a < 3)" + "attached_condition": "t0.a < 3" } } } @@ -425,7 +425,7 @@ EXPLAIN "table_name": "t0", "access_type": "ALL", "rows": 10, - "attached_condition": "(t0.a in (2,3,4))" + "attached_condition": "t0.a in (2,3,4)" } } } @@ -481,11 +481,11 @@ EXPLAIN "access_type": "ALL", "rows": 10, "filtered": 100, - "attached_condition": "(tbl.cnt > 0)", + "attached_condition": "tbl.cnt > 0", "materialized": { "query_block": { "select_id": 2, - "having_condition": "(cnt > 0)", + "having_condition": "cnt > 0", "filesort": { "sort_key": "t1.a", "temporary_table": { @@ -514,7 +514,7 @@ EXPLAIN "access_type": "ALL", "rows": 10, "filtered": 100, - "attached_condition": "(tbl2.a is not null)" + "attached_condition": "tbl2.a is not null" }, "table": { "table_name": "", @@ -526,7 +526,7 @@ EXPLAIN "ref": ["test.tbl2.a"], "rows": 2, "filtered": 100, - "attached_condition": "(tbl1.cnt = tbl2.a)", + "attached_condition": "tbl1.cnt = tbl2.a", "materialized": { "query_block": { "select_id": 2, @@ -560,7 +560,7 @@ EXPLAIN "access_type": "ALL", "rows": 10, "filtered": 100, - "attached_condition": "(t1.a is not null)" + "attached_condition": "t1.a is not null" }, "table": { "table_name": "", @@ -674,7 +674,7 @@ EXPLAIN "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "((t1.b = t2.b) and (t1.a = t2.a))" + "attached_condition": "t1.b = t2.b and t1.a = t2.a" } } } @@ -711,7 +711,7 @@ EXPLAIN "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "((t1.b = t2.b) and (t1.a = t2.a))" + "attached_condition": "t1.b = t2.b and t1.a = t2.a" } } } @@ -739,7 +739,7 @@ EXPLAIN "used_key_parts": ["a"], "rows": 1, "filtered": 100, - "index_condition": "(t1.a < 3)", + "index_condition": "t1.a < 3", "mrr_type": "Rowid-ordered scan" } } @@ -792,14 +792,14 @@ EXPLAIN "used_key_parts": ["a"], "rows": 2, "filtered": 100, - "attached_condition": "(not((outer_t1.a,(subquery#2))))", + "attached_condition": "!(outer_t1.a,(subquery#2))", "using_index": true }, "subqueries": [ { "query_block": { "select_id": 2, - "having_condition": "trigcond((t1.a))", + "having_condition": "trigcond(t1.a is null)", "full-scan-on-null_key": { "table": { "table_name": "t1", @@ -811,7 +811,7 @@ EXPLAIN "ref": ["func"], "rows": 2, "filtered": 100, - "attached_condition": "trigcond((((outer_t1.a) = t1.a) or isnull(t1.a)))", + "attached_condition": "trigcond((outer_t1.a) = t1.a or t1.a is null)", "using_index": true } }, @@ -825,7 +825,7 @@ EXPLAIN "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "((t2.b <> outer_t1.a) and trigcond((((outer_t1.a) = t1.a) or isnull(t1.a))))" + "attached_condition": "t2.b <> outer_t1.a and trigcond((outer_t1.a) = t1.a or t1.a is null)" } } } @@ -849,7 +849,7 @@ EXPLAIN { "query_block": { "select_id": 1, - "const_condition": "((20000,((subquery#2) >= 20000)))", + "const_condition": "((20000,(subquery#2) >= 20000))", "table": { "table_name": "t0", "access_type": "ALL", @@ -876,7 +876,7 @@ EXPLAIN "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "(tbl2.b = tbl1.b)" + "attached_condition": "tbl2.b = tbl1.b" } } } @@ -902,7 +902,7 @@ EXPLAIN "access_type": "ALL", "rows": 2, "filtered": 100, - "attached_condition": "(not((t1.a,t1.a in (subquery#2))))" + "attached_condition": "!(t1.a,t1.a in (subquery#2))" }, "subqueries": [ { @@ -1047,7 +1047,7 @@ EXPLAIN "used_key_parts": ["a1", "a2", "b"], "rows": 17, "filtered": 100, - "attached_condition": "((t1.b = 'a') and (t1.a2 >= 'b'))", + "attached_condition": "t1.b = 'a' and t1.a2 >= 'b'", "using_index_for_group_by": true } } @@ -1065,7 +1065,7 @@ EXPLAIN "used_key_parts": ["a1", "a2", "b", "c"], "rows": 65, "filtered": 100, - "attached_condition": "((t1.b = 'a') and (t1.c = 'i121') and (t1.a2 >= 'b'))", + "attached_condition": "t1.b = 'a' and t1.c = 'i121' and t1.a2 >= 'b'", "using_index_for_group_by": "scanning" } } @@ -1086,7 +1086,7 @@ EXPLAIN "access_type": "ALL", "rows": 2, "filtered": 100, - "attached_condition": "(t1.a = _latin1'\xDF')" + "attached_condition": "t1.a = _latin1'\xDF'" } } } @@ -1106,7 +1106,7 @@ EXPLAIN "access_type": "ALL", "rows": 2, "filtered": 100, - "attached_condition": "(case when convert(t1.a using utf8) = ((_utf8'a' collate utf8_bin)) then NULL else t1.a end)" + "attached_condition": "(case when convert(t1.a using utf8) = (_utf8'a' collate utf8_bin) then NULL else t1.a end)" } } } @@ -1130,7 +1130,7 @@ EXPLAIN { "query_block": { "select_id": 1, - "having_condition": "(TOP > t2.a)", + "having_condition": "TOP > t2.a", "filesort": { "sort_key": "t2.a", "temporary_table": { @@ -1323,7 +1323,7 @@ EXPLAIN "ref": ["test.t1.a"], "rows": 1, "filtered": 100, - "attached_condition": "(trigcond(isnull(t2.pk)) and trigcond(trigcond((t1.a is not null))))", + "attached_condition": "trigcond(t2.pk is null) and trigcond(trigcond(t1.a is not null))", "using_index": true, "not_exists": true } @@ -1361,7 +1361,7 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, - "attached_condition": "(trigcond(isnull(t2.pk)) and trigcond(trigcond((t1.a is not null))))", + "attached_condition": "trigcond(t2.pk is null) and trigcond(trigcond(t1.a is not null))", "using_index": true, "not_exists": true } @@ -1385,7 +1385,7 @@ EXPLAIN "access_type": "ALL", "rows": 2, "filtered": 100, - "attached_condition": "(t1.a is not null)" + "attached_condition": "t1.a is not null" }, "table": { "table_name": "t2", @@ -1421,7 +1421,7 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, - "attached_condition": "(t1.a is not null)" + "attached_condition": "t1.a is not null" }, "table": { "table_name": "t2", @@ -1473,7 +1473,7 @@ EXPLAIN "access_type": "ALL", "rows": 10, "filtered": 100, - "attached_condition": "(t3.a is not null)" + "attached_condition": "t3.a is not null" }, "block-nl-join": { "table": { @@ -1486,7 +1486,7 @@ EXPLAIN "ref": ["test.t3.a"], "rows": 1, "filtered": 100, - "index_condition_bka": "((t4.b + 1) <= (t3.b + 1))" + "index_condition_bka": "t4.b + 1 <= t3.b + 1" }, "buffer_type": "flat", "buffer_size": "256Kb", @@ -1512,7 +1512,7 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, - "attached_condition": "(t3.a is not null)" + "attached_condition": "t3.a is not null" }, "block-nl-join": { "table": { @@ -1529,7 +1529,7 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": null, - "index_condition_bka": "((t4.b + 1) <= (t3.b + 1))" + "index_condition_bka": "t4.b + 1 <= t3.b + 1" }, "buffer_type": "flat", "buffer_size": "256Kb", @@ -1567,13 +1567,13 @@ EXPLAIN "state": "uninitialized", "query_block": { "select_id": 2, - "outer_ref_condition": "(t0.a < 5)", + "outer_ref_condition": "t0.a < 5", "table": { "table_name": "t1", "access_type": "ALL", "rows": 10, "filtered": 100, - "attached_condition": "((t0.a < 5) and (t1.b < t0.a))" + "attached_condition": "t0.a < 5 and t1.b < t0.a" } } } diff --git a/mysql-test/r/explain_json_format_partitions.result b/mysql-test/r/explain_json_format_partitions.result index fa2b5681120..5d7fdbc4864 100644 --- a/mysql-test/r/explain_json_format_partitions.result +++ b/mysql-test/r/explain_json_format_partitions.result @@ -18,7 +18,7 @@ EXPLAIN "access_type": "ALL", "rows": 10, "filtered": 100, - "attached_condition": "(t1.a in (2,3,4))" + "attached_condition": "t1.a in (2,3,4)" } } } @@ -39,7 +39,7 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 30, - "attached_condition": "(t1.a in (2,3,4))" + "attached_condition": "t1.a in (2,3,4)" } } } @@ -59,7 +59,7 @@ ANALYZE "r_rows": 10, "r_filtered": 30, "r_total_time_ms": "REPLACED", - "attached_condition": "(t1.a in (2,3,4))" + "attached_condition": "t1.a in (2,3,4)" } } } @@ -79,7 +79,7 @@ ANALYZE "r_rows": 10, "r_filtered": 0, "r_total_time_ms": "REPLACED", - "attached_condition": "(t1.a in (20,30,40))" + "attached_condition": "t1.a in (20,30,40)" } } } diff --git a/mysql-test/r/explain_json_innodb.result b/mysql-test/r/explain_json_innodb.result index cc389c63bda..8cec65642b4 100644 --- a/mysql-test/r/explain_json_innodb.result +++ b/mysql-test/r/explain_json_innodb.result @@ -31,7 +31,7 @@ EXPLAIN "access_type": "ALL", "rows": 1, "filtered": 100, - "attached_condition": "((tbl_alias1.column_name_2 is not null) and (tbl_alias1.column_name_1 is not null))" + "attached_condition": "tbl_alias1.column_name_2 is not null and tbl_alias1.column_name_1 is not null" }, "table": { "table_name": "tbl_alias2", @@ -46,7 +46,7 @@ EXPLAIN ], "rows": 1, "filtered": 100, - "attached_condition": "(tbl_alias2.c = tbl_alias1.column_name_2)", + "attached_condition": "tbl_alias2.c = tbl_alias1.column_name_2", "using_index": true } } diff --git a/mysql-test/r/flush2.result b/mysql-test/r/flush2.result index ff5d8755f01..a66b0d5c688 100644 --- a/mysql-test/r/flush2.result +++ b/mysql-test/r/flush2.result @@ -4,6 +4,8 @@ show variables like 'log_bin%'; Variable_name Value log_bin OFF log_bin_basename +log_bin_compress OFF +log_bin_compress_min_len 256 log_bin_index log_bin_trust_function_creators ON show variables like 'relay_log%'; @@ -20,6 +22,8 @@ show variables like 'log_bin%'; Variable_name Value log_bin OFF log_bin_basename +log_bin_compress OFF +log_bin_compress_min_len 256 log_bin_index log_bin_trust_function_creators ON show variables like 'relay_log%'; diff --git a/mysql-test/r/fulltext_charsets.result b/mysql-test/r/fulltext_charsets.result new file mode 100644 index 00000000000..39ce02a3fce --- /dev/null +++ b/mysql-test/r/fulltext_charsets.result @@ -0,0 +1,7 @@ +set names utf8mb4; +create table t1 (a int, b text, fulltext (b)) charset=utf8mb4 collate=utf8mb4_unicode_ci; +insert t1 values (1000, 'C͓̙̯͔̩ͅͅi̩̘̜̲a̯̲̬̳̜̖̤o͕͓̜͓̺̖̗,̠̬͚ ̺T͇̲h͈̱e ̬̜DÌ–o̦̖͔̗͖̩̘c̣̼tÌ͉̫̮̗o͉̫̭r̙͎̗.͓̪̥'); +select a from t1 where match(b) against ('ciao' in boolean mode); +a +1000 +drop table t1; diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result index 9ef7f13487f..6857813559f 100644 --- a/mysql-test/r/func_compress.result +++ b/mysql-test/r/func_compress.result @@ -14,7 +14,7 @@ explain extended select uncompress(compress(@test_compress_string)); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select uncompress(compress((@`test_compress_string`))) AS `uncompress(compress(@test_compress_string))` +Note 1003 select uncompress(compress(@`test_compress_string`)) AS `uncompress(compress(@test_compress_string))` select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string); uncompressed_length(compress(@test_compress_string))=length(@test_compress_string) 1 @@ -22,7 +22,7 @@ explain extended select uncompressed_length(compress(@test_compress_string))=len id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select (uncompressed_length(compress((@`test_compress_string`))) = length((@`test_compress_string`))) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)` +Note 1003 select uncompressed_length(compress(@`test_compress_string`)) = length(@`test_compress_string`) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)` select uncompressed_length(compress(@test_compress_string)); uncompressed_length(compress(@test_compress_string)) 117 @@ -168,6 +168,30 @@ set global max_allowed_packet=default; # End of 5.5 tests # # +# Start of 10.1 tests +# +# +# MDEV-10864 Wrong result for WHERE .. (f2=COMPRESS('test') OR f2=COMPRESS('TEST')) +# +CREATE TABLE t1 (f1 VARCHAR(4), f2 VARCHAR(64), UNIQUE KEY k1 (f1,f2)); +INSERT INTO t1 VALUES ('test',compress('test')), ('TEST', compress('TEST')); +SELECT f1,HEX(f2) FROM t1 ignore index(k1) WHERE f1='test' AND (f2= compress("test") OR f2= compress("TEST")); +f1 HEX(f2) +test 04000000789C2B492D2E0100045D01C1 +TEST 04000000789C0B710D0E0100031D0141 +SELECT f1,HEX(f2) FROM t1 WHERE f1='test' AND (f2= compress("test") OR f2= compress("TEST")); +f1 HEX(f2) +TEST 04000000789C0B710D0E0100031D0141 +test 04000000789C2B492D2E0100045D01C1 +SELECT f1,HEX(f2) FROM t1 WHERE f1='test' AND (f2= compress("TEST") OR f2= compress("test")); +f1 HEX(f2) +TEST 04000000789C0B710D0E0100031D0141 +test 04000000789C2B492D2E0100045D01C1 +DROP TABLE t1; +# +# End of 10.1 tests +# +# # Start of 10.2 tests # # @@ -178,9 +202,9 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` text DEFAULT NULL, - `b` blob DEFAULT COMPRESS(a), - `bl` int(11) DEFAULT UNCOMPRESSED_LENGTH(b), - `a1` text DEFAULT UNCOMPRESS(b) + `b` blob DEFAULT compress(`a`), + `bl` int(11) DEFAULT uncompressed_length(`b`), + `a1` text DEFAULT uncompress(`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (REPEAT('a',100)); SELECT bl, a1 FROM t1; diff --git a/mysql-test/r/func_crypt.result b/mysql-test/r/func_crypt.result index 85c1cb2ce94..c8a621e2fd3 100644 --- a/mysql-test/r/func_crypt.result +++ b/mysql-test/r/func_crypt.result @@ -105,14 +105,91 @@ SELECT OLD_PASSWORD(c1), PASSWORD(c1) FROM t1; OLD_PASSWORD(c1) PASSWORD(c1) 77023ffe214c04ff *82E58A2C08AAFE72C8EB523069CD8ADB33F78F58 DROP TABLE t1; -End of 5.0 tests -Start of 10.2 tests +# End of 5.0 tests +# +# Start of 10.1 tests +# +# Start of func_str_ascii_checksum.inc +# +# MDEV-10850 Wrong result for WHERE .. (f2=TO_BASE64('test') OR f2=TO_BASE64('TEST')) +# +CREATE TABLE t1 (f1 VARCHAR(4), f2 VARCHAR(255), UNIQUE KEY k1 (f1,f2)); +INSERT INTO t1 VALUES ('test',password('test')), ('TEST', password('TEST')); +SELECT * FROM t1 IGNORE INDEX(k1) WHERE f1='test' AND (f2= password("test") OR f2= password("TEST")); +f1 f2 +test *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 +TEST *47A6B0EA08A36FAEBE4305B373FE37E3CF27C357 +SELECT * FROM t1 WHERE f1='test' AND (f2= password("test") OR f2= password("TEST")); +f1 f2 +TEST *47A6B0EA08A36FAEBE4305B373FE37E3CF27C357 +test *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 +SELECT * FROM t1 WHERE f1='test' AND (f2= password("TEST") OR f2= password("test")); +f1 f2 +TEST *47A6B0EA08A36FAEBE4305B373FE37E3CF27C357 +test *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 +DROP TABLE t1; +# +# MDEV-10425 Assertion `collation.derivation == DERIVATION_IMPLICIT' failed in Item_func_conv_charset::fix_length_and_dec() +# +PREPARE stmt FROM "SELECT password(CONVERT('foo' USING latin1))"; +EXECUTE stmt; +password(CONVERT('foo' USING latin1)) +*F3A2A51A9B0F2BE2468926B4132313728C250DBF +DEALLOCATE PREPARE stmt; +# End of func_str_ascii_checksum.inc +# Start of func_str_ascii_checksum.inc +# +# MDEV-10850 Wrong result for WHERE .. (f2=TO_BASE64('test') OR f2=TO_BASE64('TEST')) +# +CREATE TABLE t1 (f1 VARCHAR(4), f2 VARCHAR(255), UNIQUE KEY k1 (f1,f2)); +INSERT INTO t1 VALUES ('test',old_password('test')), ('TEST', old_password('TEST')); +SELECT * FROM t1 IGNORE INDEX(k1) WHERE f1='test' AND (f2= old_password("test") OR f2= old_password("TEST")); +f1 f2 +test 378b243e220ca493 +TEST 06df397e084be793 +SELECT * FROM t1 WHERE f1='test' AND (f2= old_password("test") OR f2= old_password("TEST")); +f1 f2 +TEST 06df397e084be793 +test 378b243e220ca493 +SELECT * FROM t1 WHERE f1='test' AND (f2= old_password("TEST") OR f2= old_password("test")); +f1 f2 +TEST 06df397e084be793 +test 378b243e220ca493 +DROP TABLE t1; +# +# MDEV-10425 Assertion `collation.derivation == DERIVATION_IMPLICIT' failed in Item_func_conv_charset::fix_length_and_dec() +# +PREPARE stmt FROM "SELECT old_password(CONVERT('foo' USING latin1))"; +EXECUTE stmt; +old_password(CONVERT('foo' USING latin1)) +7c786c222596437b +DEALLOCATE PREPARE stmt; +# End of func_str_ascii_checksum.inc +# +# MDEV-10864 Wrong result for WHERE .. (f2=COMPRESS('test') OR f2=COMPRESS('TEST')) +# +CREATE TABLE t1 (f1 VARCHAR(4), f2 VARCHAR(64), UNIQUE KEY k1 (f1,f2)); +INSERT INTO t1 VALUES ('test',encrypt('test','key')), ('TEST', encrypt('TEST','key')); +SELECT f1 FROM t1 ignore index(k1) WHERE f1='test' AND (f2= encrypt('test','key') OR f2= encrypt('TEST','key')); +f1 +test +TEST +SELECT f1 FROM t1 WHERE f1='test' AND (f2= encrypt('test','key') OR f2= encrypt('TEST','key')); +f1 +TEST +test +SELECT f1 FROM t1 WHERE f1='test' AND (f2= encrypt('TEST','key') OR f2= encrypt('test','key')); +f1 +TEST +test +DROP TABLE t1; +# Start of 10.2 tests CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(30) DEFAULT ENCRYPT(a,123)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(30) DEFAULT ENCRYPT(a,123) + `b` varchar(30) DEFAULT encrypt(`a`,123) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('hello'); SELECT * FROM t1; diff --git a/mysql-test/r/func_date_add.result b/mysql-test/r/func_date_add.result index e8fbba786a4..fa45353e094 100644 --- a/mysql-test/r/func_date_add.result +++ b/mysql-test/r/func_date_add.result @@ -102,3 +102,50 @@ select * from t1 where case a when adddate( '2012-12-12', 7 ) then true end; a drop table t1; End of 5.5 tests +create or replace view v1 as select 3 & 20010101 + interval 2 day as x; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 3 & 20010101 + interval 2 day AS `x` latin1 latin1_swedish_ci +select 3 & 20010101 + interval 2 day, x from v1; +3 & 20010101 + interval 2 day x +3 3 +create or replace view v1 as select (3 & 20010101) + interval 2 day as x; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (3 & 20010101) + interval 2 day AS `x` latin1 latin1_swedish_ci +select (3 & 20010101) + interval 2 day, x from v1; +(3 & 20010101) + interval 2 day x +NULL NULL +Warnings: +Warning 1292 Incorrect datetime value: '1' +Warning 1292 Incorrect datetime value: '1' +create or replace view v1 as select 3 & (20010101 + interval 2 day) as x; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 3 & 20010101 + interval 2 day AS `x` latin1 latin1_swedish_ci +select 3 & (20010101 + interval 2 day), x from v1; +3 & (20010101 + interval 2 day) x +3 3 +create or replace view v1 as select 30 + 20010101 + interval 2 day as x; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 30 + 20010101 + interval 2 day AS `x` latin1 latin1_swedish_ci +select 30 + 20010101 + interval 2 day, x from v1; +30 + 20010101 + interval 2 day x +2001-02-02 2001-02-02 +create or replace view v1 as select (30 + 20010101) + interval 2 day as x; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 30 + 20010101 + interval 2 day AS `x` latin1 latin1_swedish_ci +select (30 + 20010101) + interval 2 day, x from v1; +(30 + 20010101) + interval 2 day x +2001-02-02 2001-02-02 +create or replace view v1 as select 30 + (20010101 + interval 2 day) as x; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 30 + (20010101 + interval 2 day) AS `x` latin1 latin1_swedish_ci +select 30 + (20010101 + interval 2 day), x from v1; +30 + (20010101 + interval 2 day) x +20010133 20010133 +drop view v1; +End of 10.2 tests diff --git a/mysql-test/r/func_digest.result b/mysql-test/r/func_digest.result index 31a32da72ed..374d16ac687 100644 --- a/mysql-test/r/func_digest.result +++ b/mysql-test/r/func_digest.result @@ -1427,6 +1427,35 @@ def sha2('1',224) 253 56 56 Y 0 39 8 sha2('1',224) e25388fde8290dc286a6164fa2d97e551b53498dcbf7bc378eb1f178 # +# Start of 10.1 tests +# +# +# MDEV-10850 Wrong result for WHERE .. (f2=TO_BASE64('test') OR f2=TO_BAS E64('TEST')) +# +CREATE TABLE t1 (f1 VARCHAR(4), f2 VARCHAR(64), UNIQUE KEY k1 (f1,f2)); +INSERT INTO t1 VALUES ('test',SHA2('test',224)), ('TEST', SHA2('TEST',224)); +SELECT * FROM t1 IGNORE INDEX(k1) WHERE f1='test' AND (f2= SHA2("test",224) OR f2= SHA2("TEST",224)); +f1 f2 +test 90a3ed9e32b2aaf4c61c410eb925426119e1a9dc53d4286ade99a809 +TEST 917ecca24f3e6ceaf52375d8083381f1f80a21e6e49fbadc40afeb8e +SELECT * FROM t1 WHERE f1='test' AND (f2= SHA2("test",224) OR f2= SHA2("TEST",224)); +f1 f2 +test 90a3ed9e32b2aaf4c61c410eb925426119e1a9dc53d4286ade99a809 +TEST 917ecca24f3e6ceaf52375d8083381f1f80a21e6e49fbadc40afeb8e +SELECT * FROM t1 WHERE f1='test' AND (f2= SHA2("TEST",224) OR f2= SHA2("test",224)); +f1 f2 +test 90a3ed9e32b2aaf4c61c410eb925426119e1a9dc53d4286ade99a809 +TEST 917ecca24f3e6ceaf52375d8083381f1f80a21e6e49fbadc40afeb8e +DROP TABLE t1; +# +# MDEV-10425 Assertion `collation.derivation == DERIVATION_IMPLICIT' failed in Item_func_conv_charset::fix_length_and_dec() +# +PREPARE stmt FROM "SELECT SHA2(CONVERT('foo' USING latin1), 224)"; +EXECUTE stmt; +SHA2(CONVERT('foo' USING latin1), 224) +0808f64e60d58979fcb676c96ec938270dea42445aeefcd3a4e6f8db +DEALLOCATE PREPARE stmt; +# # Start of 10.2 tests # # @@ -1441,8 +1470,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, - `b` text DEFAULT SHA(a), - `c` text DEFAULT SHA2(a,224) + `b` text DEFAULT sha(`a`), + `c` text DEFAULT sha2(`a`,224) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('abc'); SELECT * FROM t1; diff --git a/mysql-test/r/func_encrypt.result b/mysql-test/r/func_encrypt.result index 34dff598452..68c44231e43 100644 --- a/mysql-test/r/func_encrypt.result +++ b/mysql-test/r/func_encrypt.result @@ -203,7 +203,7 @@ SELECT * FROM t1 WHERE a=1 AND DES_ENCRYPT('test',a)=_latin1 'abc' COLLATE latin id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and (des_encrypt('test',`test`.`t1`.`a`) = 'abc')) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and des_encrypt('test',`test`.`t1`.`a`) = 'abc' DROP TABLE t1; # # End of 10.1 tests @@ -223,8 +223,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, - `b` blob DEFAULT DES_ENCRYPT(a, 'passwd'), - `c` text DEFAULT DES_DECRYPT(b, 'passwd') + `b` blob DEFAULT des_encrypt(`a`,'passwd'), + `c` text DEFAULT des_decrypt(`b`,'passwd') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('test'); SELECT c FROM t1; diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index 4c4ad4da051..17d0baa0f01 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -1044,7 +1044,7 @@ DROP TABLE t1; CREATE TABLE t1(f1 int); INSERT INTO t1 values (0),(0); SELECT POLYGON((SELECT 1 FROM (SELECT 1 IN (GROUP_CONCAT(t1.f1)) FROM t1, t1 t GROUP BY t.f1 ) d)); -ERROR 22007: Illegal non geometric '(select 1 from (select (1 = group_concat(`test`.`t1`.`f1` separator ',')) AS `1 IN (GROUP_CONCAT(t1.f1))` from `test`.`t1` join `test`.`t1` `t` group by `test`.`t`.`f1`) `d`)' value found during parsing +ERROR 22007: Illegal non geometric '(select 1 from (select 1 = group_concat(`test`.`t1`.`f1` separator ',') AS `1 IN (GROUP_CONCAT(t1.f1))` from `test`.`t1` join `test`.`t1` `t` group by `test`.`t`.`f1`) `d`)' value found during parsing DROP TABLE t1; # # Bug#58396 group_concat and explain extended are still crashy diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index dbeb458345e..cb97ea298a0 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -1409,7 +1409,7 @@ EXPLAIN EXTENDED SELECT y FROM v1 GROUP BY v1.y; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort Warnings: -Note 1003 select (`test`.`t1`.`a` + 1) AS `y` from `test`.`t1` group by (`test`.`t1`.`a` + 1) +Note 1003 select `test`.`t1`.`a` + 1 AS `y` from `test`.`t1` group by `test`.`t1`.`a` + 1 DROP VIEW v1; DROP TABLE t1; SET SQL_MODE=DEFAULT; @@ -1860,7 +1860,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 range a a 4 NULL 4 100.00 Using where; Using index; Using join buffer (flat, BNL join) 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`a` = 1) and (`test`.`t2`.`b` = 2) and (`test`.`t1`.`a` < 10)) +Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`a` = 1 and `test`.`t2`.`b` = 2 and `test`.`t1`.`a` < 10 SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT a,b FROM t2 WHERE b<5) and a<10; MAX(a) NULL @@ -1869,7 +1869,7 @@ SELECT MAX(a) FROM t1 WHERE RAND()*0<>0 AND a<10; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range a a 4 NULL 4 100.00 Using where; Using index Warnings: -Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` where (((rand() * 0) <> 0) and (`test`.`t1`.`a` < 10)) +Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` where rand() * 0 <> 0 and `test`.`t1`.`a` < 10 SELECT MAX(a) FROM t1 WHERE RAND()*0<>0 AND a<10; MAX(a) NULL @@ -1891,7 +1891,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 100.00 Warnings: Note 1276 Field or reference 'test.t3.b' of SELECT #2 was resolved in SELECT #1 -Note 1003 select <`test`.`t3`.`b`>((select min(1) from dual where (10 = `test`.`t3`.`b`))) AS `(SELECT MIN(t1.a) FROM t1,t2 WHERE t2.a = t3.b)` from `test`.`t3` +Note 1003 select <`test`.`t3`.`b`>((select min(1) from dual where 10 = `test`.`t3`.`b`)) AS `(SELECT MIN(t1.a) FROM t1,t2 WHERE t2.a = t3.b)` from `test`.`t3` SELECT (SELECT MIN(t1.a) FROM t1,t2 WHERE t2.a = t3.b) FROM t3; (SELECT MIN(t1.a) FROM t1,t2 WHERE t2.a = t3.b) NULL @@ -2398,7 +2398,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t10.b' of SELECT #3 was resolved in SELECT #1 -Note 1003 select `test`.`t10`.`a` AS `a` from `test`.`t10` where ((`test`.`t10`.`c` < 3) or <`test`.`t10`.`a`,`test`.`t10`.`b`>((`test`.`t10`.`a`,(select `test`.`t12`.`c` from `test`.`t12` where ((`test`.`t10`.`a`) = `test`.`t12`.`c`) union select max(`test`.`t10`.`b`) from `test`.`t11` group by `test`.`t11`.`c` having ((`test`.`t10`.`a`) = (max(`test`.`t10`.`b`))))))) +Note 1003 select `test`.`t10`.`a` AS `a` from `test`.`t10` where `test`.`t10`.`c` < 3 or <`test`.`t10`.`a`,`test`.`t10`.`b`>((`test`.`t10`.`a`,(select `test`.`t12`.`c` from `test`.`t12` where (`test`.`t10`.`a`) = `test`.`t12`.`c` union select max(`test`.`t10`.`b`) from `test`.`t11` group by `test`.`t11`.`c` having (`test`.`t10`.`a`) = (max(`test`.`t10`.`b`))))) drop table t10,t11,t12; # # MDEV-10017: Get unexpected `Empty Set` for correlated subquery @@ -2429,12 +2429,21 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY tt system NULL NULL NULL NULL 1 100.00 Warnings: Note 1276 Field or reference 'test.t1.c1' of SELECT #3 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` having (`test`.`t1`.`c1` >= <`test`.`t1`.`c1`>((select 2 AS `c` from dual order by (select min((`test`.`t1`.`c1` + 2)) from dual)))) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` having `test`.`t1`.`c1` >= <`test`.`t1`.`c1`>((select 2 AS `c` from dual order by (select min(`test`.`t1`.`c1` + 2) from dual))) select c1 from t1 having c1 >= (select t.c1 as c from t2 t order by (select min(t1.c1+tt.c1) from t2 tt)); c1 2 3 drop table t1,t2; # +# MDEV-10556 Assertion `0' failed in virtual void Item_sum_field::set_result_field(Field*) +# +CREATE TABLE t1 (i INT, KEY(i)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (10),(20),(30); +SELECT DISTINCT STDDEV(1) FROM t1 GROUP BY i ORDER BY BENCHMARK(0, BIT_XOR(i)); +STDDEV(1) +0.0000 +DROP TABLE t1; +# # End of 10.1 tests # diff --git a/mysql-test/r/func_hybrid_type.result b/mysql-test/r/func_hybrid_type.result index ea9c203e3f6..746bc55ef85 100644 --- a/mysql-test/r/func_hybrid_type.result +++ b/mysql-test/r/func_hybrid_type.result @@ -2397,7 +2397,7 @@ FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `___________a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `___________a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `case_______a` timestamp NULL DEFAULT NULL, `case_____a_a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `coalesce___a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result index 637fd8cd2a2..09eb85d9fb6 100644 --- a/mysql-test/r/func_if.result +++ b/mysql-test/r/func_if.result @@ -43,7 +43,7 @@ explain extended select if(u=1,st,binary st) s from t1 where st like "%a%" order id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 7 100.00 Using where; Using filesort Warnings: -Note 1003 select if((`test`.`t1`.`u` = 1),`test`.`t1`.`st`,cast(`test`.`t1`.`st` as char charset binary)) AS `s` from `test`.`t1` where (`test`.`t1`.`st` like '%a%') order by if((`test`.`t1`.`u` = 1),`test`.`t1`.`st`,cast(`test`.`t1`.`st` as char charset binary)) +Note 1003 select if(`test`.`t1`.`u` = 1,`test`.`t1`.`st`,cast(`test`.`t1`.`st` as char charset binary)) AS `s` from `test`.`t1` where `test`.`t1`.`st` like '%a%' order by if(`test`.`t1`.`u` = 1,`test`.`t1`.`st`,cast(`test`.`t1`.`st` as char charset binary)) select nullif(u, 1) from t1; nullif(u, 1) NULL diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index 1855fa72523..aaf1d981e59 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -121,9 +121,9 @@ insert into t1 values ('a','c','c'); select * from t1 where a in (b); ERROR HY000: Illegal mix of collations (latin1_general_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '=' select * from t1 where a in (b,c); -ERROR HY000: Illegal mix of collations (latin1_general_ci,IMPLICIT), (latin1_swedish_ci,IMPLICIT), (latin1_danish_ci,IMPLICIT) for operation ' IN ' +ERROR HY000: Illegal mix of collations (latin1_general_ci,IMPLICIT), (latin1_swedish_ci,IMPLICIT), (latin1_danish_ci,IMPLICIT) for operation 'in' select * from t1 where 'a' in (a,b,c); -ERROR HY000: Illegal mix of collations for operation ' IN ' +ERROR HY000: Illegal mix of collations for operation 'in' select * from t1 where 'a' in (a); a b c A B C @@ -146,7 +146,7 @@ explain extended select * from t1 where 'a' in (a,b,c collate latin1_bin); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ('a' in (`test`.`t1`.`a`,`test`.`t1`.`b`,(`test`.`t1`.`c` collate latin1_bin))) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where 'a' in (`test`.`t1`.`a`,`test`.`t1`.`b`,`test`.`t1`.`c` collate latin1_bin) drop table t1; set names utf8; create table t1 (a char(10) character set utf8 not null); @@ -226,7 +226,7 @@ a CREATE VIEW v1 AS SELECT * FROM t1 WHERE a NOT IN (45); SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` <> 45) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where `t1`.`a` <> 45 latin1 latin1_swedish_ci SELECT * FROM v1; a 44 @@ -841,17 +841,17 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND a IN (1,2,3); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 1) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 # Ok to propagate equalities into IN () list, even if multiple comparison types EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND 1 IN (1,a,'3'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 1) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 # Not Ok to propagate equalities into the left IN argument in case of multiple comparison types EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND a IN (1,2,'3'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and (`test`.`t1`.`a` in (1,2,'3'))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and `test`.`t1`.`a` in (1,2,'3') DROP TABLE t1; diff --git a/mysql-test/r/func_json.result b/mysql-test/r/func_json.result new file mode 100644 index 00000000000..6c1987cc3e7 --- /dev/null +++ b/mysql-test/r/func_json.result @@ -0,0 +1,440 @@ +select json_valid('[1, 2]'); +json_valid('[1, 2]') +1 +select json_valid('"string"}'); +json_valid('"string"}') +0 +select json_valid('{"key1":1, "key2":[2,3]}'); +json_valid('{"key1":1, "key2":[2,3]}') +1 +select json_valid('[false, true, null]'); +json_valid('[false, true, null]') +1 +select json_valid(repeat('[', 1000)); +json_valid(repeat('[', 1000)) +0 +select json_valid(repeat('{"a":', 1000)); +json_valid(repeat('{"a":', 1000)) +0 +select json_value('{"key1":123}', '$.key2'); +json_value('{"key1":123}', '$.key2') +NULL +select json_value('{"key1":123}', '$.key1'); +json_value('{"key1":123}', '$.key1') +123 +select json_value('{"key1":[1,2,3]}', '$.key1'); +json_value('{"key1":[1,2,3]}', '$.key1') +NULL +select json_value('{"key1": [1,2,3], "key1":123}', '$.key1'); +json_value('{"key1": [1,2,3], "key1":123}', '$.key1') +123 +select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2'); +json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2') +NULL +select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key1'); +json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key1') +{"a":1, "b":[1,2]} +select json_query('{"key1": 1}', '$.key1'); +json_query('{"key1": 1}', '$.key1') +NULL +select json_query('{"key1":123, "key1": [1,2,3]}', '$.key1'); +json_query('{"key1":123, "key1": [1,2,3]}', '$.key1') +[1,2,3] +select json_query('{"key1":123, "key1": [1,2,3]}', concat('$', repeat('.k', 1000))); +json_query('{"key1":123, "key1": [1,2,3]}', concat('$', repeat('.k', 1000))) +NULL +select json_array(); +json_array() +[] +select json_array(1); +json_array(1) +[1] +select json_array(1, "text", false, null); +json_array(1, "text", false, null) +[1, "text", false, null] +select json_array_append('["a", "b"]', '$', FALSE); +json_array_append('["a", "b"]', '$', FALSE) +["a", "b", false] +select json_array_append('{"k1":1, "k2":["a", "b"]}', '$.k2', 2); +json_array_append('{"k1":1, "k2":["a", "b"]}', '$.k2', 2) +{"k1":1, "k2":["a", "b", 2]} +select json_array_append('["a", ["b", "c"], "d"]', '$[0]', 2); +json_array_append('["a", ["b", "c"], "d"]', '$[0]', 2) +[["a", 2], ["b", "c"], "d"] +select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1]', 'x'); +json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1]', 'x') +["a", "x", {"b": [1, 2]}, [3, 4]] +select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2]', 'x'); +json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2]', 'x') +["a", {"b": [1, 2]}, "x", [3, 4]] +select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[3]', 'x'); +json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[3]', 'x') +["a", {"b": [1, 2]}, [3, 4], "x"] +select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[4]', 'x'); +json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[4]', 'x') +["a", {"b": [1, 2]}, [3, 4], "x"] +select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1].b[0]', 'x'); +json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1].b[0]', 'x') +["a", {"b": ["x", 1, 2]}, [3, 4]] +select json_array_insert('true', '$', 1); +json_array_insert('true', '$', 1) +NULL +select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2][1]', 'y'); +json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2][1]', 'y') +["a", {"b": [1, 2]}, [3, "y", 4]] +select json_contains('{"k1":123, "k2":345}', '123', '$.k1'); +json_contains('{"k1":123, "k2":345}', '123', '$.k1') +1 +select json_contains('"you"', '"you"'); +json_contains('"you"', '"you"') +1 +select json_contains('"youth"', '"you"'); +json_contains('"youth"', '"you"') +0 +select json_contains('[1]', '[1]', '$', '$[0]'); +ERROR 42000: Incorrect parameter count in the call to native function 'json_contains' +select json_contains('', '', '$'); +json_contains('', '', '$') +NULL +Warnings: +Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_contains' +select json_contains('null', 'null', '$'); +json_contains('null', 'null', '$') +1 +select json_contains('"10"', '"10"', '$'); +json_contains('"10"', '"10"', '$') +1 +select json_contains('"10"', '10', '$'); +json_contains('"10"', '10', '$') +0 +select json_contains('10.1', '10', '$'); +json_contains('10.1', '10', '$') +0 +select json_contains('10.0', '10', '$'); +json_contains('10.0', '10', '$') +1 +select json_contains('[1]', '1'); +json_contains('[1]', '1') +1 +select json_contains('[2, 1]', '1'); +json_contains('[2, 1]', '1') +1 +select json_contains('[2, [2, 3], 1]', '1'); +json_contains('[2, [2, 3], 1]', '1') +1 +select json_contains('[4, [2, 3], 1]', '2'); +json_contains('[4, [2, 3], 1]', '2') +1 +select json_contains('[2, 1]', '[1, 2]'); +json_contains('[2, 1]', '[1, 2]') +1 +select json_contains('[2, 1]', '[1, 0, 2]'); +json_contains('[2, 1]', '[1, 0, 2]') +0 +select json_contains('[2, 0, 3, 1]', '[1, 2]'); +json_contains('[2, 0, 3, 1]', '[1, 2]') +1 +select json_contains('{"b":[1,2], "a":1}', '{"a":1, "b":2}'); +json_contains('{"b":[1,2], "a":1}', '{"a":1, "b":2}') +1 +select json_contains('{"a":1}', '{}'); +json_contains('{"a":1}', '{}') +1 +select json_contains('[1, {"a":1}]', '{}'); +json_contains('[1, {"a":1}]', '{}') +1 +select json_contains('[1, {"a":1}]', '{"a":1}'); +json_contains('[1, {"a":1}]', '{"a":1}') +1 +select json_contains('[{"abc":"def", "def":"abc"}]', '["foo","bar"]'); +json_contains('[{"abc":"def", "def":"abc"}]', '["foo","bar"]') +0 +select json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]'); +json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]') +1 +select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]"); +json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]") +1 +select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[10]"); +json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[10]") +0 +select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.ma"); +json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.ma") +0 +select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1"); +json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1") +1 +select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1", "$.ma"); +json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1", "$.ma") +1 +select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.ma"); +json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.ma") +0 +select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.key2"); +json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.key2") +1 +select json_contains_path('{ "a": true }', NULL, '$.a' ); +json_contains_path('{ "a": true }', NULL, '$.a' ) +NULL +select json_contains_path('{ "a": true }', 'all', NULL ); +json_contains_path('{ "a": true }', 'all', NULL ) +NULL +select json_contains_path('{"a":{"b":"c"}}', 'one', '$.a.*'); +json_contains_path('{"a":{"b":"c"}}', 'one', '$.a.*') +1 +select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1"); +json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1") +"asd" +select json_extract('{"key1":"asd", "key2":[2,3]}', "$.keyX", "$.keyY"); +json_extract('{"key1":"asd", "key2":[2,3]}', "$.keyX", "$.keyY") +NULL +select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1", "$.key2"); +json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1", "$.key2") +["asd", [2,3]] +select json_extract('{"key1":5, "key2":[2,3]}', "$.key1", "$.key2"); +json_extract('{"key1":5, "key2":[2,3]}', "$.key1", "$.key2") +[5, [2,3]] +select json_extract('{"key0":true, "key1":"qwe"}', "$.key1"); +json_extract('{"key0":true, "key1":"qwe"}', "$.key1") +"qwe" +select json_extract(json_object('foo', 'foobar'),'$'); +json_extract(json_object('foo', 'foobar'),'$') +{"foo": "foobar"} +select json_extract('[10, 20, [30, 40]]', '$[2][*]'); +json_extract('[10, 20, [30, 40]]', '$[2][*]') +[30, 40] +select json_extract('[10, 20, [{"a":3}, 30, 40]]', '$[2][*]'); +json_extract('[10, 20, [{"a":3}, 30, 40]]', '$[2][*]') +[{"a":3}, 30, 40] +select json_extract('1', '$'); +json_extract('1', '$') +1 +select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]'); +json_extract('[10, 20, [30, 40], 1, 10]', '$[1]') +20 +select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word'); +json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word') +{"a":1, "b":{"c":1, "k1":"word"}, "d":[1, 2]} +select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.d[3]', 3); +json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.d[3]', 3) +{"a":1, "b":{"c":1}, "d":[1, 2, 3]} +select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.a[2]', 2); +json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.a[2]', 2) +{"a":[1, 2], "b":{"c":1}, "d":[1, 2]} +select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.c', 'word'); +json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.c', 'word') +{"a":1, "b":{"c":1}, "d":[1, 2]} +select json_set('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]'); +json_set('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]') +{ "a": 10, "b": [2, 3], "c":"[true, false]"} +select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]'); +json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]') +{ "a": 10, "b": [2, 3]} +select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.b', '[true, false]'); +json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.b', '[true, false]') +{ "a": 10, "b": "[true, false]"} +set @j = '["a", ["b", "c"], "d"]'; +select json_remove(@j, '$[0]'); +json_remove(@j, '$[0]') +[ ["b", "c"], "d"] +select json_remove(@j, '$[1]'); +json_remove(@j, '$[1]') +["a", "d"] +select json_remove(@j, '$[2]'); +json_remove(@j, '$[2]') +["a", ["b", "c"]] +set @j = '{"a": 1, "b": [2, 3]}'; +select json_remove(@j, '$.b'); +json_remove(@j, '$.b') +{"a": 1} +select json_remove(@j, '$.a'); +json_remove(@j, '$.a') +{"b": [2, 3]} +select json_object(); +json_object() +{} +select json_object("ki", 1, "mi", "ya"); +json_object("ki", 1, "mi", "ya") +{"ki": 1, "mi": "ya"} +create table t1 as select json_object('id', 87, 'name', 'carrot') as f; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f` varchar(32) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t1; +f +{"id": 87, "name": "carrot"} +drop table t1; +select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2"); +json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2") +1 +select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[1]"); +json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[1]") +1 +select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[10]"); +json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[10]") +0 +select json_quote('"string"'); +json_quote('"string"') +"\"string\"" +create table t1 as select json_quote('foo'); +select * from t1; +json_quote('foo') +"foo" +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `json_quote('foo')` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select json_merge('string'); +ERROR 42000: Incorrect parameter count in the call to native function 'json_merge' +select json_merge('string', 123); +json_merge('string', 123) +NULL +Warnings: +Warning 4038 Syntax error in JSON text in argument 1 to function 'json_merge' at position 1 +select json_merge('"string"', 123); +json_merge('"string"', 123) +["string", 123] +select json_merge('[1, 2]', '[true, false]'); +json_merge('[1, 2]', '[true, false]') +[1, 2, true, false] +select json_merge('{"1": 2}', '{"true": false}'); +json_merge('{"1": 2}', '{"true": false}') +{"1": 2, "true": false} +select json_merge('{"1": 2}', '{"true": false}', '{"3": 4}'); +json_merge('{"1": 2}', '{"true": false}', '{"3": 4}') +{"1": 2, "true": false, "3": 4} +select json_merge(NULL,json_object('foo', 1)); +json_merge(NULL,json_object('foo', 1)) +NULL +select json_merge('a','b'); +json_merge('a','b') +NULL +Warnings: +Warning 4038 Syntax error in JSON text in argument 1 to function 'json_merge' at position 1 +select json_merge('{"a":"b"}','{"c":"d"}'); +json_merge('{"a":"b"}','{"c":"d"}') +{"a":"b", "c":"d"} +SELECT JSON_MERGE('[1, 2]', '{"id": 47}'); +JSON_MERGE('[1, 2]', '{"id": 47}') +[1, 2, {"id": 47}] +select json_type('{"k1":123, "k2":345}'); +json_type('{"k1":123, "k2":345}') +OBJECT +select json_type('[123, "k2", 345]'); +json_type('[123, "k2", 345]') +ARRAY +select json_type("true"); +json_type("true") +BOOLEAN +select json_type('123'); +json_type('123') +INTEGER +select json_type('123.12'); +json_type('123.12') +DOUBLE +select json_keys('{"a":{"c":1, "d":2}, "b":2}'); +json_keys('{"a":{"c":1, "d":2}, "b":2}') +["a", "b"] +select json_keys('{"a":{"c":1, "d":2}, "b":2}', "$.a"); +json_keys('{"a":{"c":1, "d":2}, "b":2}', "$.a") +["c", "d"] +select json_keys('{"a":{"c":1, "d":2}, "b":2}', "$.b"); +json_keys('{"a":{"c":1, "d":2}, "b":2}', "$.b") +NULL +select json_keys('foo'); +json_keys('foo') +NULL +Warnings: +Warning 4038 Syntax error in JSON text in argument 1 to function 'json_keys' at position 1 +SET @j = '["abc", [{"k": "10"}, "def"], {"x":"abc"}, {"y":"bcd"}]'; +select json_search(@j, 'one', 'abc'); +json_search(@j, 'one', 'abc') +"$[0]" +select json_search(@j, 'all', 'abc'); +json_search(@j, 'all', 'abc') +["$[0]", "$[2].x"] +select json_search(@j, 'all', 'abc', NULL, '$[2]'); +json_search(@j, 'all', 'abc', NULL, '$[2]') +"$[2].x" +select json_search(@j, 'all', 'abc', NULL, '$'); +json_search(@j, 'all', 'abc', NULL, '$') +["$[0]", "$[2].x"] +select json_search(@j, 'all', '10', NULL, '$'); +json_search(@j, 'all', '10', NULL, '$') +"$[1][0].k" +select json_search(@j, 'all', '10', NULL, '$[*]'); +json_search(@j, 'all', '10', NULL, '$[*]') +"$[1][0].k" +select json_search(@j, 'all', '10', NULL, '$[*][0].k'); +json_search(@j, 'all', '10', NULL, '$[*][0].k') +"$[1][0].k" +select json_search(@j, 'all', '10', NULL, '$**.k'); +json_search(@j, 'all', '10', NULL, '$**.k') +"$[1][0].k" +create table t1( json_col text ); +insert into t1 values +('{ "a": "foobar" }'), +('{ "a": "foobar", "b": "focus", "c": [ "arm", "foot", "shoulder" ] }'); +select json_search( json_col, 'all', 'foot' ) from t1; +json_search( json_col, 'all', 'foot' ) +NULL +"$.c[1]" +drop table t1; +select json_unquote('"abc"'); +json_unquote('"abc"') +abc +select json_unquote('abc'); +json_unquote('abc') +abc +select json_object("a", json_object("b", "abcd")); +json_object("a", json_object("b", "abcd")) +{"a": {"b": "abcd"}} +select json_object("a", '{"b": "abcd"}'); +json_object("a", '{"b": "abcd"}') +{"a": "{\"b\": \"abcd\"}"} +select json_object("a", cast('{"b": "abcd"}' as json)); +json_object("a", cast('{"b": "abcd"}' as json)) +{"a": {"b": "abcd"}} +select cast(NULL AS JSON); +cast(NULL AS JSON) +NULL +select json_depth(cast(NULL as JSON)); +json_depth(cast(NULL as JSON)) +NULL +select json_depth('[[], {}]'); +json_depth('[[], {}]') +2 +select json_depth('[[[1,2,3],"s"], {}, []]'); +json_depth('[[[1,2,3],"s"], {}, []]') +4 +select json_depth('[10, {"a": 20}]'); +json_depth('[10, {"a": 20}]') +3 +select json_length(''); +json_length('') +NULL +Warnings: +Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_length' +select json_length('{}'); +json_length('{}') +0 +select json_length('[1, 2, {"a": 3}]'); +json_length('[1, 2, {"a": 3}]') +3 +select json_length('{"a": 1, "b": {"c": 30}}', '$.b'); +json_length('{"a": 1, "b": {"c": 30}}', '$.b') +1 +select json_length('{"a": 1, "b": {"c": 30}}'); +json_length('{"a": 1, "b": {"c": 30}}') +2 +create table json (j INT); +show create table json; +Table Create Table +json CREATE TABLE `json` ( + `j` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table json; diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result index 9c8e9727d16..0a309bcfab6 100644 --- a/mysql-test/r/func_like.result +++ b/mysql-test/r/func_like.result @@ -5,12 +5,12 @@ explain extended select * from t1 where a like 'abc%'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index a a 13 NULL 5 20.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` like 'abc%') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` like 'abc%' explain extended select * from t1 where a like concat('abc','%'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index a a 13 NULL 5 20.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` like (concat('abc','%'))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` like (concat('abc','%')) select * from t1 where a like "abc%"; a abc @@ -224,7 +224,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10.0 AND a LIKE 10.00; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 10.0) and (`test`.`t1`.`a` like 10.00)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 10.0 and `test`.`t1`.`a` like 10.00 DROP TABLE t1; # # MDEV-8599 "WHERE varchar_field LIKE temporal_const" does not use range optimizer @@ -254,3 +254,38 @@ DROP TABLE t1; # # End of 10.1 tests # +create view v1 as select 'foo!' like 'foo!!', 'foo!' like 'foo!!' escape '!'; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'foo!' like 'foo!!' AS `'foo!' like 'foo!!'`,'foo!' like 'foo!!' escape '!' AS `'foo!' like 'foo!!' escape '!'` koi8r koi8r_general_ci +select * from v1; +'foo!' like 'foo!!' 'foo!' like 'foo!!' escape '!' +0 1 +drop view v1; +create table t1 (a varchar(100), +b int default (a like '%f\\_'), +c int default (a like '%f\\_' escape ''), +d int default (a like '%f\\_' escape '\\')); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(100) DEFAULT NULL, + `b` int(11) DEFAULT (`a` like '%f\\_'), + `c` int(11) DEFAULT (`a` like '%f\\_' escape ''), + `d` int(11) DEFAULT (`a` like '%f\\_' escape '\\') +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert t1 (a) values ('1 f_'), ('1 f\\_'); +set sql_mode=no_backslash_escapes; +insert t1 (a) values ('2 f_'), ('2 f\_'); +flush tables; +insert t1 (a) values ('3 f_'), ('3 f\_'); +set sql_mode=default; +select * from t1; +a b c d +1 f_ 1 0 1 +1 f\_ 0 1 0 +2 f_ 1 0 1 +2 f\_ 0 1 0 +3 f_ 1 0 1 +3 f\_ 0 1 0 +drop table t1; diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index a783fd3967d..f02776d4448 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -49,7 +49,7 @@ explain extended select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log( id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select log(exp(10)) AS `log(exp(10))`,exp((log(sqrt(10)) * 2)) AS `exp(log(sqrt(10))*2)`,log(-1) AS `log(-1)`,log(NULL) AS `log(NULL)`,log(1,1) AS `log(1,1)`,log(3,9) AS `log(3,9)`,log(-1,2) AS `log(-1,2)`,log(NULL,2) AS `log(NULL,2)` +Note 1003 select log(exp(10)) AS `log(exp(10))`,exp(log(sqrt(10)) * 2) AS `exp(log(sqrt(10))*2)`,log(-1) AS `log(-1)`,log(NULL) AS `log(NULL)`,log(1,1) AS `log(1,1)`,log(3,9) AS `log(3,9)`,log(-1,2) AS `log(-1,2)`,log(NULL,2) AS `log(NULL,2)` select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL); ln(exp(10)) exp(ln(sqrt(10))*2) ln(-1) ln(0) ln(NULL) 10 10.000000000000002 NULL NULL NULL @@ -57,7 +57,7 @@ explain extended select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select ln(exp(10)) AS `ln(exp(10))`,exp((ln(sqrt(10)) * 2)) AS `exp(ln(sqrt(10))*2)`,ln(-1) AS `ln(-1)`,ln(0) AS `ln(0)`,ln(NULL) AS `ln(NULL)` +Note 1003 select ln(exp(10)) AS `ln(exp(10))`,exp(ln(sqrt(10)) * 2) AS `exp(ln(sqrt(10))*2)`,ln(-1) AS `ln(-1)`,ln(0) AS `ln(0)`,ln(NULL) AS `ln(NULL)` select log2(8),log2(15),log2(-2),log2(0),log2(NULL); log2(8) log2(15) log2(-2) log2(0) log2(NULL) 3 3.9068905956085187 NULL NULL NULL @@ -98,7 +98,7 @@ explain extended select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format( id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select pi() AS `pi()`,format(sin((pi() / 2)),6) AS `format(sin(pi()/2),6)`,format(cos((pi() / 2)),6) AS `format(cos(pi()/2),6)`,format(abs(tan(pi())),6) AS `format(abs(tan(pi())),6)`,format(cot(1),6) AS `format(cot(1),6)`,format(asin(1),6) AS `format(asin(1),6)`,format(acos(0),6) AS `format(acos(0),6)`,format(atan(1),6) AS `format(atan(1),6)` +Note 1003 select pi() AS `pi()`,format(sin(pi() / 2),6) AS `format(sin(pi()/2),6)`,format(cos(pi() / 2),6) AS `format(cos(pi()/2),6)`,format(abs(tan(pi())),6) AS `format(abs(tan(pi())),6)`,format(cot(1),6) AS `format(cot(1),6)`,format(asin(1),6) AS `format(asin(1),6)`,format(acos(0),6) AS `format(acos(0),6)`,format(atan(1),6) AS `format(atan(1),6)` select degrees(pi()),radians(360); degrees(pi()) radians(360) 180 6.283185307179586 @@ -486,13 +486,13 @@ Warning 1292 Truncated incorrect INTEGER value: 'a' DROP TABLE t1; End of 5.0 tests SELECT 1e308 + 1e308; -ERROR 22003: DOUBLE value is out of range in '(1e308 + 1e308)' +ERROR 22003: DOUBLE value is out of range in '1e308 + 1e308' SELECT -1e308 - 1e308; -ERROR 22003: DOUBLE value is out of range in '(-1e308 - 1e308)' +ERROR 22003: DOUBLE value is out of range in '-1e308 - 1e308' SELECT 1e300 * 1e300; -ERROR 22003: DOUBLE value is out of range in '(1e300 * 1e300)' +ERROR 22003: DOUBLE value is out of range in '1e300 * 1e300' SELECT 1e300 / 1e-300; -ERROR 22003: DOUBLE value is out of range in '(1e300 / 1e-300)' +ERROR 22003: DOUBLE value is out of range in '1e300 / 1e-300' SELECT EXP(750); ERROR 22003: DOUBLE value is out of range in 'exp(750)' SELECT POW(10, 309); @@ -519,9 +519,9 @@ DROP TABLE t1; # Bug#57477 SIGFPE when dividing a huge number a negative number # SELECT -9999999999999999991 DIV -1; -ERROR 22003: BIGINT value is out of range in '(-9999999999999999991 DIV -1)' +ERROR 22003: BIGINT value is out of range in '-9999999999999999991 DIV -1' SELECT -9223372036854775808 DIV -1; -ERROR 22003: BIGINT value is out of range in '(-9223372036854775808 DIV -1)' +ERROR 22003: BIGINT value is out of range in '-9223372036854775808 DIV -1' SELECT -9223372036854775808 MOD -1; -9223372036854775808 MOD -1 0 @@ -529,13 +529,13 @@ SELECT -9223372036854775808999 MOD -1; -9223372036854775808999 MOD -1 0 select 123456789012345678901234567890.123456789012345678901234567890 div 1 as x; -ERROR 22003: BIGINT value is out of range in '(123456789012345678901234567890.123456789012345678901234567890 DIV 1)' +ERROR 22003: BIGINT value is out of range in '123456789012345678901234567890.123456789012345678901234567890 DIV 1' select "123456789012345678901234567890.123456789012345678901234567890" div 1 as x; -ERROR 22003: BIGINT value is out of range in '('123456789012345678901234567890.123456789012345678901234567890' DIV 1)' +ERROR 22003: BIGINT value is out of range in ''123456789012345678901234567890.123456789012345678901234567890' DIV 1' SHOW WARNINGS; Level Code Message Warning 1916 Got overflow when converting '123456789012345678901234567890' to INT. Value truncated -Error 1690 BIGINT value is out of range in '('123456789012345678901234567890.123456789012345678901234567890' DIV 1)' +Error 1690 BIGINT value is out of range in ''123456789012345678901234567890.123456789012345678901234567890' DIV 1' # # Bug#57810 case/when/then : Assertion failed: length || !scale # @@ -589,13 +589,13 @@ End of 5.1 tests # Bug #8433: Overflow must be an error # SELECT 1e308 + 1e308; -ERROR 22003: DOUBLE value is out of range in '(1e308 + 1e308)' +ERROR 22003: DOUBLE value is out of range in '1e308 + 1e308' SELECT -1e308 - 1e308; -ERROR 22003: DOUBLE value is out of range in '(-1e308 - 1e308)' +ERROR 22003: DOUBLE value is out of range in '-1e308 - 1e308' SELECT 1e300 * 1e300; -ERROR 22003: DOUBLE value is out of range in '(1e300 * 1e300)' +ERROR 22003: DOUBLE value is out of range in '1e300 * 1e300' SELECT 1e300 / 1e-300; -ERROR 22003: DOUBLE value is out of range in '(1e300 / 1e-300)' +ERROR 22003: DOUBLE value is out of range in '1e300 / 1e-300' SELECT EXP(750); ERROR 22003: DOUBLE value is out of range in 'exp(750)' SELECT POW(10, 309); @@ -605,86 +605,86 @@ ERROR 22003: DOUBLE value is out of range in 'cot(0)' SELECT DEGREES(1e307); ERROR 22003: DOUBLE value is out of range in 'degrees(1e307)' SELECT 9223372036854775808 + 9223372036854775808; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(9223372036854775808 + 9223372036854775808)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '9223372036854775808 + 9223372036854775808' SELECT 18446744073709551615 + 1; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '18446744073709551615 + 1' SELECT 1 + 18446744073709551615; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(1 + 18446744073709551615)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '1 + 18446744073709551615' SELECT -2 + CAST(1 AS UNSIGNED); -ERROR 22003: BIGINT UNSIGNED value is out of range in '(-2 + cast(1 as unsigned))' +ERROR 22003: BIGINT UNSIGNED value is out of range in '-2 + cast(1 as unsigned)' SELECT CAST(1 AS UNSIGNED) + -2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(cast(1 as unsigned) + -2)' +ERROR 22003: BIGINT UNSIGNED value is out of range in 'cast(1 as unsigned) + -2' SELECT -9223372036854775808 + -9223372036854775808; -ERROR 22003: BIGINT value is out of range in '(-9223372036854775808 + -9223372036854775808)' +ERROR 22003: BIGINT value is out of range in '-9223372036854775808 + -9223372036854775808' SELECT 9223372036854775807 + 9223372036854775807; -ERROR 22003: BIGINT value is out of range in '(9223372036854775807 + 9223372036854775807)' +ERROR 22003: BIGINT value is out of range in '9223372036854775807 + 9223372036854775807' SELECT CAST(0 AS UNSIGNED) - 9223372036854775809; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(cast(0 as unsigned) - 9223372036854775809)' +ERROR 22003: BIGINT UNSIGNED value is out of range in 'cast(0 as unsigned) - 9223372036854775809' SELECT 9223372036854775808 - 9223372036854775809; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(9223372036854775808 - 9223372036854775809)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '9223372036854775808 - 9223372036854775809' SELECT CAST(1 AS UNSIGNED) - 2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(cast(1 as unsigned) - 2)' +ERROR 22003: BIGINT UNSIGNED value is out of range in 'cast(1 as unsigned) - 2' SELECT 18446744073709551615 - (-1); -ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 - -1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '18446744073709551615 - -1' SELECT -1 - 9223372036854775808; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(-1 - 9223372036854775808)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '-1 - 9223372036854775808' SELECT -1 - CAST(1 AS UNSIGNED); -ERROR 22003: BIGINT UNSIGNED value is out of range in '(-1 - cast(1 as unsigned))' +ERROR 22003: BIGINT UNSIGNED value is out of range in '-1 - cast(1 as unsigned)' SELECT -9223372036854775808 - 1; -ERROR 22003: BIGINT value is out of range in '(-9223372036854775808 - 1)' +ERROR 22003: BIGINT value is out of range in '-9223372036854775808 - 1' SELECT 9223372036854775807 - -9223372036854775808; -ERROR 22003: BIGINT value is out of range in '(9223372036854775807 - -9223372036854775808)' +ERROR 22003: BIGINT value is out of range in '9223372036854775807 - -9223372036854775808' set SQL_MODE='NO_UNSIGNED_SUBTRACTION'; SELECT 18446744073709551615 - 1; -ERROR 22003: BIGINT value is out of range in '(18446744073709551615 - 1)' +ERROR 22003: BIGINT value is out of range in '18446744073709551615 - 1' SELECT 18446744073709551615 - CAST(1 AS UNSIGNED); -ERROR 22003: BIGINT value is out of range in '(18446744073709551615 - cast(1 as unsigned))' +ERROR 22003: BIGINT value is out of range in '18446744073709551615 - cast(1 as unsigned)' SELECT 18446744073709551614 - (-1); -ERROR 22003: BIGINT value is out of range in '(18446744073709551614 - -1)' +ERROR 22003: BIGINT value is out of range in '18446744073709551614 - -1' SELECT 9223372036854775807 - -1; -ERROR 22003: BIGINT value is out of range in '(9223372036854775807 - -1)' +ERROR 22003: BIGINT value is out of range in '9223372036854775807 - -1' set SQL_MODE=default; SELECT 4294967296 * 4294967296; -ERROR 22003: BIGINT value is out of range in '(4294967296 * 4294967296)' +ERROR 22003: BIGINT value is out of range in '4294967296 * 4294967296' SELECT 9223372036854775808 * 2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(9223372036854775808 * 2)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '9223372036854775808 * 2' SELECT 9223372036854775808 * 2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(9223372036854775808 * 2)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '9223372036854775808 * 2' SELECT 7158278827 * 3221225472; -ERROR 22003: BIGINT value is out of range in '(7158278827 * 3221225472)' +ERROR 22003: BIGINT value is out of range in '7158278827 * 3221225472' SELECT 9223372036854775807 * (-2); -ERROR 22003: BIGINT value is out of range in '(9223372036854775807 * -2)' +ERROR 22003: BIGINT value is out of range in '9223372036854775807 * -2' SELECT CAST(1 as UNSIGNED) * (-1); -ERROR 22003: BIGINT UNSIGNED value is out of range in '(cast(1 as unsigned) * -1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in 'cast(1 as unsigned) * -1' SELECT 9223372036854775807 * 2; -ERROR 22003: BIGINT value is out of range in '(9223372036854775807 * 2)' +ERROR 22003: BIGINT value is out of range in '9223372036854775807 * 2' SELECT ABS(-9223372036854775808); ERROR 22003: BIGINT value is out of range in 'abs(-9223372036854775808)' SELECT -9223372036854775808 DIV -1; -ERROR 22003: BIGINT value is out of range in '(-9223372036854775808 DIV -1)' +ERROR 22003: BIGINT value is out of range in '-9223372036854775808 DIV -1' SELECT 18446744073709551615 DIV -1; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 DIV -1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '18446744073709551615 DIV -1' CREATE TABLE t1(a BIGINT, b BIGINT UNSIGNED); INSERT INTO t1 VALUES(-9223372036854775808, 9223372036854775809); SELECT -a FROM t1; -ERROR 22003: BIGINT value is out of range in '-(`test`.`t1`.`a`)' +ERROR 22003: BIGINT value is out of range in '-`test`.`t1`.`a`' SELECT -b FROM t1; -ERROR 22003: BIGINT value is out of range in '-(`test`.`t1`.`b`)' +ERROR 22003: BIGINT value is out of range in '-`test`.`t1`.`b`' INSERT INTO t1 VALUES(0,0); SELECT -a FROM t1; -ERROR 22003: BIGINT value is out of range in '-(`test`.`t1`.`a`)' +ERROR 22003: BIGINT value is out of range in '-`test`.`t1`.`a`' SELECT -b FROM t1; -ERROR 22003: BIGINT value is out of range in '-(`test`.`t1`.`b`)' +ERROR 22003: BIGINT value is out of range in '-`test`.`t1`.`b`' DROP TABLE t1; SET @a:=999999999999999999999999999999999999999999999999999999999999999999999999999999999; SELECT @a + @a; -ERROR 22003: DECIMAL value is out of range in '((@`a`) + (@`a`))' +ERROR 22003: DECIMAL value is out of range in '@`a` + @`a`' SELECT @a * @a; -ERROR 22003: DECIMAL value is out of range in '((@`a`) * (@`a`))' +ERROR 22003: DECIMAL value is out of range in '@`a` * @`a`' SELECT -@a - @a; -ERROR 22003: DECIMAL value is out of range in '(-((@`a`)) - (@`a`))' +ERROR 22003: DECIMAL value is out of range in '-@`a` - @`a`' SELECT @a / 0.5; -ERROR 22003: DECIMAL value is out of range in '((@`a`) / 0.5)' +ERROR 22003: DECIMAL value is out of range in '@`a` / 0.5' SELECT COT(1/0); COT(1/0) NULL diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result index f6a04c6fb79..10423a4b105 100644 --- a/mysql-test/r/func_misc.result +++ b/mysql-test/r/func_misc.result @@ -354,7 +354,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY tv ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join) 2 DEPENDENT SUBQUERY tv system NULL NULL NULL NULL 1 100.00 Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` left join (`test`.`tv`) on((`test`.`tv`.`e` = `test`.`t1`.`a`)) where (not(((last_value(NULL,`test`.`tv`.`e`),(select last_value(NULL,'1') from dual where trigcond(((last_value(NULL,`test`.`tv`.`e`)) = last_value(NULL,'1')))))))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` left join (`test`.`tv`) on(`test`.`tv`.`e` = `test`.`t1`.`a`) where !((last_value(NULL,`test`.`tv`.`e`),(select last_value(NULL,'1') from dual where trigcond((last_value(NULL,`test`.`tv`.`e`)) = last_value(NULL,'1'))))) explain extended select a from t1 left join v_merge on (a=e) where e not in (select last_value(NULL,e) from vm); id select_type table type possible_keys key key_len ref rows filtered Extra @@ -362,7 +362,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY tv ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join) 2 DEPENDENT SUBQUERY tv system NULL NULL NULL NULL 1 100.00 Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` left join (`test`.`tv`) on((`test`.`tv`.`e` = `test`.`t1`.`a`)) where (not(<`test`.`tv`.`e`>((`test`.`tv`.`e`,(select last_value(NULL,'1') from dual where trigcond(((`test`.`tv`.`e`) = last_value(NULL,'1')))))))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` left join (`test`.`tv`) on(`test`.`tv`.`e` = `test`.`t1`.`a`) where !<`test`.`tv`.`e`>((`test`.`tv`.`e`,(select last_value(NULL,'1') from dual where trigcond((`test`.`tv`.`e`) = last_value(NULL,'1'))))) set optimizer_switch=@optimizer_switch_save; drop view v_merge, vm; drop table t1,tv; @@ -1457,10 +1457,10 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, - `b` bigint(20) DEFAULT INET_ATON(a), - `a1` varchar(30) DEFAULT INET_NTOA(b), - `c` int(11) DEFAULT IS_IPV4(a), - `d` int(11) DEFAULT IS_IPV6(a) + `b` bigint(20) DEFAULT inet_aton(`a`), + `a1` varchar(30) DEFAULT inet_ntoa(`b`), + `c` int(11) DEFAULT is_ipv4(`a`), + `d` int(11) DEFAULT is_ipv6(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('192.168.001.001'),('::1'),('xxx'); SELECT * FROM t1; @@ -1480,10 +1480,10 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `str` varchar(128) DEFAULT NULL, - `addr` varbinary(16) DEFAULT INET6_ATON(str), - `str1` varchar(128) DEFAULT INET6_NTOA(addr), - `b` int(11) DEFAULT IS_IPV4_COMPAT(addr), - `c` int(11) DEFAULT IS_IPV4_MAPPED(addr) + `addr` varbinary(16) DEFAULT inet6_aton(`str`), + `str1` varchar(128) DEFAULT inet6_ntoa(`addr`), + `b` int(11) DEFAULT is_ipv4_compat(`addr`), + `c` int(11) DEFAULT is_ipv4_mapped(`addr`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (str) VALUES ('::FFFF:192.168.0.1'),('::10.0.5.9'); SELECT str, str1, b,c FROM t1; diff --git a/mysql-test/r/func_op.result b/mysql-test/r/func_op.result index 0d738570035..685aba1075f 100644 --- a/mysql-test/r/func_op.result +++ b/mysql-test/r/func_op.result @@ -5,7 +5,7 @@ explain extended select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select (1 + 1) AS `1+1`,(1 - 1) AS `1-1`,(1 + (1 * 2)) AS `1+1*2`,(8 / 5) AS `8/5`,(8 % 5) AS `8%5`,(8 % 5) AS `mod(8,5)`,((8 % 5) | 0) AS `mod(8,5)|0`,(-((1 + 1)) * -2) AS `-(1+1)*-2` +Note 1003 select 1 + 1 AS `1+1`,1 - 1 AS `1-1`,1 + 1 * 2 AS `1+1*2`,8 / 5 AS `8/5`,8 % 5 AS `8%5`,8 % 5 AS `mod(8,5)`,8 % 5 | 0 AS `mod(8,5)|0`,-(1 + 1) * -2 AS `-(1+1)*-2` select 1 | (1+1),5 & 3,bit_count(7) ; 1 | (1+1) 5 & 3 bit_count(7) 3 1 3 @@ -13,7 +13,7 @@ explain extended select 1 | (1+1),5 & 3,bit_count(7) ; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select (1 | (1 + 1)) AS `1 | (1+1)`,(5 & 3) AS `5 & 3`,bit_count(7) AS `bit_count(7)` +Note 1003 select 1 | 1 + 1 AS `1 | (1+1)`,5 & 3 AS `5 & 3`,bit_count(7) AS `bit_count(7)` select 1 << 32,1 << 63, 1 << 64, 4 >> 2, 4 >> 63, 1<< 63 >> 60; 1 << 32 1 << 63 1 << 64 4 >> 2 4 >> 63 1<< 63 >> 60 4294967296 9223372036854775808 0 1 0 8 diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result index 96af966d367..3ffbe275fb9 100644 --- a/mysql-test/r/func_set.result +++ b/mysql-test/r/func_set.result @@ -5,7 +5,7 @@ explain extended select INTERVAL(55,10,20,30,40,50,60,70,80,90,100),interval(3,1 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select interval(55,10,20,30,40,50,60,70,80,90,100) AS `INTERVAL(55,10,20,30,40,50,60,70,80,90,100)`,interval(3,1,(1 + 1),(((1 + 1) + 1) + 1)) AS `interval(3,1,1+1,1+1+1+1)`,field('IBM','NCA','ICL','SUN','IBM','DIGITAL') AS `field("IBM","NCA","ICL","SUN","IBM","DIGITAL")`,field('A','B','C') AS `field("A","B","C")`,elt(2,'ONE','TWO','THREE') AS `elt(2,"ONE","TWO","THREE")`,interval(0,1,2,3,4) AS `interval(0,1,2,3,4)`,(elt(1,1,2,3) | 0) AS `elt(1,1,2,3)|0`,(elt(1,1.1,1.2,1.3) + 0) AS `elt(1,1.1,1.2,1.3)+0` +Note 1003 select interval(55,10,20,30,40,50,60,70,80,90,100) AS `INTERVAL(55,10,20,30,40,50,60,70,80,90,100)`,interval(3,1,1 + 1,1 + 1 + 1 + 1) AS `interval(3,1,1+1,1+1+1+1)`,field('IBM','NCA','ICL','SUN','IBM','DIGITAL') AS `field("IBM","NCA","ICL","SUN","IBM","DIGITAL")`,field('A','B','C') AS `field("A","B","C")`,elt(2,'ONE','TWO','THREE') AS `elt(2,"ONE","TWO","THREE")`,interval(0,1,2,3,4) AS `interval(0,1,2,3,4)`,elt(1,1,2,3) | 0 AS `elt(1,1,2,3)|0`,elt(1,1.1,1.2,1.3) + 0 AS `elt(1,1.1,1.2,1.3)+0` SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56); INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56) 1 diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index d4c17e68394..ac7ab2bede6 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -587,15 +587,15 @@ select _latin1'B' in (_latin1'a',_latin1'b' collate latin1_bin); _latin1'B' in (_latin1'a',_latin1'b' collate latin1_bin) 0 select _latin2'B' in (_latin1'a',_latin1'b'); -ERROR HY000: Illegal mix of collations (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation ' IN ' +ERROR HY000: Illegal mix of collations (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation 'in' select _latin1'B' in (_latin2'a',_latin1'b'); -ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation ' IN ' +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation 'in' select _latin1'B' in (_latin1'a',_latin2'b'); -ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE) for operation ' IN ' +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE) for operation 'in' select _latin1'B' COLLATE latin1_general_ci in (_latin1'a' COLLATE latin1_bin,_latin1'b'); -ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT), (latin1_bin,EXPLICIT), (latin1_swedish_ci,COERCIBLE) for operation ' IN ' +ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT), (latin1_bin,EXPLICIT), (latin1_swedish_ci,COERCIBLE) for operation 'in' select _latin1'B' COLLATE latin1_general_ci in (_latin1'a',_latin1'b' COLLATE latin1_bin); -ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT), (latin1_swedish_ci,COERCIBLE), (latin1_bin,EXPLICIT) for operation ' IN ' +ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT), (latin1_swedish_ci,COERCIBLE), (latin1_bin,EXPLICIT) for operation 'in' select collation(bin(130)), coercibility(bin(130)); collation(bin(130)) coercibility(bin(130)) latin1_swedish_ci 4 @@ -841,7 +841,7 @@ explain extended select 'mood' sounds like 'mud'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select (soundex('mood') = soundex('mud')) AS `'mood' sounds like 'mud'` +Note 1003 select soundex('mood') = soundex('mud') AS `'mood' sounds like 'mud'` explain extended select aes_decrypt(aes_encrypt('abc','1'),'1'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used @@ -921,7 +921,7 @@ explain extended select FIELD('b' COLLATE latin1_bin,'A','B'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select field(('b' collate latin1_bin),'A','B') AS `FIELD('b' COLLATE latin1_bin,'A','B')` +Note 1003 select field('b' collate latin1_bin,'A','B') AS `FIELD('b' COLLATE latin1_bin,'A','B')` explain extended select FIND_IN_SET(_latin1'B', _latin1'a,b,c,d'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used @@ -976,7 +976,7 @@ explain extended select quote(1/0); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select quote((1 / 0)) AS `quote(1/0)` +Note 1003 select quote(1 / 0) AS `quote(1/0)` explain extended select crc32("123"); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used @@ -1290,27 +1290,27 @@ EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(s) > 'ab'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(`test`.`t1`.`s`) > 'ab') +Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where trim(`test`.`t1`.`s`) > 'ab' EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM('y' FROM s) > 'ab'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(both 'y' from `test`.`t1`.`s`) > 'ab') +Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where trim(both 'y' from `test`.`t1`.`s`) > 'ab' EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(LEADING 'y' FROM s) > 'ab'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(leading 'y' from `test`.`t1`.`s`) > 'ab') +Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where trim(leading 'y' from `test`.`t1`.`s`) > 'ab' EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(TRAILING 'y' FROM s) > 'ab'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(trailing 'y' from `test`.`t1`.`s`) > 'ab') +Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where trim(trailing 'y' from `test`.`t1`.`s`) > 'ab' EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(BOTH 'y' FROM s) > 'ab'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(both 'y' from `test`.`t1`.`s`) > 'ab') +Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where trim(both 'y' from `test`.`t1`.`s`) > 'ab' DROP TABLE t1; create table t1(f1 varchar(4)); explain extended select encode(f1,'zxcv') as 'enc' from t1; @@ -1400,7 +1400,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 const PRIMARY PRIMARY 12 const 1 100.00 Using index 1 SIMPLE t1 ref code code 13 const 3 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`code` AS `code`,'a12' AS `id` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`code` = 'a12') and (length(`test`.`t1`.`code`) = 5)) +Note 1003 select `test`.`t1`.`code` AS `code`,'a12' AS `id` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`code` = 'a12' and length(`test`.`t1`.`code`) = 5 DROP TABLE t1,t2; select encode(NULL, NULL); encode(NULL, NULL) @@ -4575,7 +4575,7 @@ SELECT * FROM t1 WHERE a=18446744073709551615 AND FORMAT(a,0)='18,446,744,073,70 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 18446744073709551615) and (format(`test`.`t1`.`a`,0) = '18,446,744,073,709,551,615')) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 18446744073709551615 and format(`test`.`t1`.`a`,0) = '18,446,744,073,709,551,615' DROP TABLE t1; # # Bug#58081 Duplicate entry error when doing GROUP BY @@ -4588,6 +4588,80 @@ SELECT COUNT(*) FROM t1, t1 t2 GROUP BY INSERT('', t2.a, t1.a, @@global.max_binl COUNT(*) 25 DROP TABLE t1; +# Start of func_str_ascii_checksum.inc +# +# MDEV-10850 Wrong result for WHERE .. (f2=TO_BASE64('test') OR f2=TO_BASE64('TEST')) +# +CREATE TABLE t1 (f1 VARCHAR(4), f2 VARCHAR(255), UNIQUE KEY k1 (f1,f2)); +INSERT INTO t1 VALUES ('test',hex('test')), ('TEST', hex('TEST')); +SELECT * FROM t1 IGNORE INDEX(k1) WHERE f1='test' AND (f2= hex("test") OR f2= hex("TEST")); +f1 f2 +test 74657374 +TEST 54455354 +SELECT * FROM t1 WHERE f1='test' AND (f2= hex("test") OR f2= hex("TEST")); +f1 f2 +TEST 54455354 +test 74657374 +SELECT * FROM t1 WHERE f1='test' AND (f2= hex("TEST") OR f2= hex("test")); +f1 f2 +TEST 54455354 +test 74657374 +DROP TABLE t1; +# +# MDEV-10425 Assertion `collation.derivation == DERIVATION_IMPLICIT' failed in Item_func_conv_charset::fix_length_and_dec() +# +PREPARE stmt FROM "SELECT hex(CONVERT('foo' USING latin1))"; +EXECUTE stmt; +hex(CONVERT('foo' USING latin1)) +666F6F +DEALLOCATE PREPARE stmt; +# End of func_str_ascii_checksum.inc +# Start of func_str_ascii_checksum.inc +# +# MDEV-10850 Wrong result for WHERE .. (f2=TO_BASE64('test') OR f2=TO_BASE64('TEST')) +# +CREATE TABLE t1 (f1 VARCHAR(4), f2 VARCHAR(255), UNIQUE KEY k1 (f1,f2)); +INSERT INTO t1 VALUES ('test',to_base64('test')), ('TEST', to_base64('TEST')); +SELECT * FROM t1 IGNORE INDEX(k1) WHERE f1='test' AND (f2= to_base64("test") OR f2= to_base64("TEST")); +f1 f2 +test dGVzdA== +TEST VEVTVA== +SELECT * FROM t1 WHERE f1='test' AND (f2= to_base64("test") OR f2= to_base64("TEST")); +f1 f2 +test dGVzdA== +TEST VEVTVA== +SELECT * FROM t1 WHERE f1='test' AND (f2= to_base64("TEST") OR f2= to_base64("test")); +f1 f2 +test dGVzdA== +TEST VEVTVA== +DROP TABLE t1; +# +# MDEV-10425 Assertion `collation.derivation == DERIVATION_IMPLICIT' failed in Item_func_conv_charset::fix_length_and_dec() +# +PREPARE stmt FROM "SELECT to_base64(CONVERT('foo' USING latin1))"; +EXECUTE stmt; +to_base64(CONVERT('foo' USING latin1)) +Zm9v +DEALLOCATE PREPARE stmt; +# End of func_str_ascii_checksum.inc +# +# MDEV-10864 Wrong result for WHERE .. (f2=COMPRESS('test') OR f2=COMPRESS('TEST')) +# +CREATE TABLE t1 (f1 VARCHAR(4), f2 VARCHAR(128), UNIQUE KEY k1 (f1,f2)); +INSERT INTO t1 VALUES ('YQ==',from_base64('YQ==')), ('Yq==', from_base64('Yq==')); +SELECT f1,HEX(f2) FROM t1 ignore index(k1) WHERE f1='YQ==' AND (f2= from_base64("YQ==") OR f2= from_base64("Yq==")); +f1 HEX(f2) +YQ== 61 +Yq== 62 +SELECT f1,HEX(f2) FROM t1 WHERE f1='YQ==' AND (f2= from_base64("YQ==") OR f2= from_base64("Yq==")); +f1 HEX(f2) +YQ== 61 +Yq== 62 +SELECT f1,HEX(f2) FROM t1 WHERE f1='YQ==' AND (f2= from_base64("Yq==") OR f2= from_base64("YQ==")); +f1 HEX(f2) +YQ== 61 +Yq== 62 +DROP TABLE t1; # # End of 10.1 tests # diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result index ddd71e5d110..f999061e2e7 100644 --- a/mysql-test/r/func_test.result +++ b/mysql-test/r/func_test.result @@ -48,7 +48,7 @@ explain extended select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select (3 ^ 11) AS `3 ^ 11`,(1 ^ 1) AS `1 ^ 1`,(1 ^ 0) AS `1 ^ 0`,(1 ^ NULL) AS `1 ^ NULL`,(NULL ^ 1) AS `NULL ^ 1` +Note 1003 select 3 ^ 11 AS `3 ^ 11`,1 ^ 1 AS `1 ^ 1`,1 ^ 0 AS `1 ^ 0`,1 ^ NULL AS `1 ^ NULL`,NULL ^ 1 AS `NULL ^ 1` select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL; 1 XOR 1 1 XOR 0 0 XOR 1 0 XOR 0 NULL XOR 1 1 XOR NULL 0 XOR NULL 0 1 1 0 NULL NULL NULL @@ -62,7 +62,7 @@ explain extended select 10 % 7, 10 mod 7, 10 div 3; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select (10 % 7) AS `10 % 7`,(10 % 7) AS `10 mod 7`,(10 DIV 3) AS `10 div 3` +Note 1003 select 10 % 7 AS `10 % 7`,10 % 7 AS `10 mod 7`,10 DIV 3 AS `10 div 3` select 18446744073709551615, 18446744073709551615 DIV 1, 18446744073709551615 DIV 2; 18446744073709551615 18446744073709551615 DIV 1 18446744073709551615 DIV 2 18446744073709551615 18446744073709551615 9223372036854775807 @@ -70,7 +70,7 @@ explain extended select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select ((1 << 64) - 1) AS `(1 << 64)-1`,(((1 << 64) - 1) DIV 1) AS `((1 << 64)-1) DIV 1`,(((1 << 64) - 1) DIV 2) AS `((1 << 64)-1) DIV 2` +Note 1003 select (1 << 64) - 1 AS `(1 << 64)-1`,((1 << 64) - 1) DIV 1 AS `((1 << 64)-1) DIV 1`,((1 << 64) - 1) DIV 2 AS `((1 << 64)-1) DIV 2` create table t1 (a int); insert t1 values (1); select * from t1 where 1 xor 1; @@ -87,7 +87,7 @@ explain extended select - a from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 Warnings: -Note 1003 select -(1) AS `- a` from dual +Note 1003 select -1 AS `- a` from dual drop table t1; select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1; 5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1 @@ -108,7 +108,7 @@ explain extended select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select (_koi8r'a' = (_koi8r'A' collate koi8r_general_ci)) AS `_koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci` +Note 1003 select _koi8r'a' = _koi8r'A' collate koi8r_general_ci AS `_koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci` select _koi8r'a' = _koi8r'A' COLLATE koi8r_bin; _koi8r'a' = _koi8r'A' COLLATE koi8r_bin 0 @@ -291,7 +291,7 @@ explain extended select not a from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Warnings: -Note 1003 select (`test`.`t1`.`a` = 0) AS `not a` from `test`.`t1` +Note 1003 select `test`.`t1`.`a` = 0 AS `not a` from `test`.`t1` select * from t1 where not a; a 0 @@ -299,7 +299,7 @@ explain extended select * from t1 where not a; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 0) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 0 select not (a+0) from t1; not (a+0) 0 @@ -310,7 +310,7 @@ explain extended select not (a+0) from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Warnings: -Note 1003 select (not((`test`.`t1`.`a` + 0))) AS `not (a+0)` from `test`.`t1` +Note 1003 select !(`test`.`t1`.`a` + 0) AS `not (a+0)` from `test`.`t1` select * from t1 where not (a+0); a 0 @@ -318,7 +318,7 @@ explain extended select * from t1 where not (a+0); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (not((`test`.`t1`.`a` + 0))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where !(`test`.`t1`.`a` + 0) select not 1, not null, not not null, 1 is not null; not 1 not null not not null 1 is not null 0 NULL NULL 1 @@ -336,7 +336,7 @@ EXPLAIN EXTENDED SELECT NOT NOT strcmp('a','b'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select (strcmp('a','b') <> 0) AS `NOT NOT strcmp('a','b')` +Note 1003 select strcmp('a','b') <> 0 AS `NOT NOT strcmp('a','b')` # # End of 10.0 tests # diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index f4b1a39294c..4d0a2a021f9 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -874,7 +874,7 @@ explain extended select period_add("9602",-12),period_diff(199505,"9404"),from_d id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select period_add('9602',-12) AS `period_add("9602",-12)`,period_diff(199505,'9404') AS `period_diff(199505,"9404")`,from_days(to_days('960101')) AS `from_days(to_days("960101"))`,dayofmonth('1997-01-02') AS `dayofmonth("1997-01-02")`,month('1997-01-02') AS `month("1997-01-02")`,monthname('1972-03-04') AS `monthname("1972-03-04")`,dayofyear('0000-00-00') AS `dayofyear("0000-00-00")`,hour('1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute('23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week('1998-03-03',@@default_week_format) AS `WEEK("1998-03-03")`,yearweek('2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year('98-02-03') AS `year("98-02-03")`,(weekday(curdate()) - weekday(now())) AS `weekday(curdate())-weekday(now())`,dayname('1962-03-03') AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec('0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format('1997-01-02 03:04:05','%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp('1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,('1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,('1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,('1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from '1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,('1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)` +Note 1003 select period_add('9602',-12) AS `period_add("9602",-12)`,period_diff(199505,'9404') AS `period_diff(199505,"9404")`,from_days(to_days('960101')) AS `from_days(to_days("960101"))`,dayofmonth('1997-01-02') AS `dayofmonth("1997-01-02")`,month('1997-01-02') AS `month("1997-01-02")`,monthname('1972-03-04') AS `monthname("1972-03-04")`,dayofyear('0000-00-00') AS `dayofyear("0000-00-00")`,hour('1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute('23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week('1998-03-03') AS `WEEK("1998-03-03")`,yearweek('2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year('98-02-03') AS `year("98-02-03")`,weekday(curdate()) - weekday(current_timestamp()) AS `weekday(curdate())-weekday(now())`,dayname('1962-03-03') AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time(time_to_sec('0:30:47') / 6.21) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format('1997-01-02 03:04:05','%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp('1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,'1997-12-31 23:59:59' + interval 1 second AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,'1998-01-01 00:00:00' - interval 1 second AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,'1997-12-31' + interval 1 day AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from '1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,'1997-12-31 23:59:59' + interval 1 second AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)` SET @TMP='2007-08-01 12:22:49'; CREATE TABLE t1 (d DATETIME); INSERT INTO t1 VALUES ('2007-08-01 12:22:59'); @@ -1976,7 +1976,7 @@ select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010') microsecond('12:00:00.123456') microsecond('2009-12-31 23:59:59.000010') 123456 10 select now(258); -ERROR 42000: Too big precision 258 specified for 'now'. Maximum is 6 +ERROR 42000: Too big precision 258 specified for 'current_timestamp'. Maximum is 6 SELECT 1 FROM DUAL WHERE YEAR(TIMEDIFF(NULL, '12:12:12')); 1 SELECT 1 FROM DUAL WHERE MONTH(TIMEDIFF(NULL, '12:12:12')); @@ -2804,6 +2804,74 @@ Warning 1292 Truncated incorrect time value: '-1441:00:00' Warning 1292 Truncated incorrect time value: '-1441:00:00' Warning 1292 Truncated incorrect time value: '-1441:00:00' # +# MDEV-10787 Assertion `ltime->neg == 0' failed in void date_to_datetime(MYSQL_TIME*) +# +CREATE TABLE t1 (d DATE); +INSERT INTO t1 VALUES ('2005-07-20'),('2012-12-21'); +SELECT REPLACE( ADDDATE( d, INTERVAL 0.6732771076944444 HOUR_SECOND ), '2', 'x' ) FROM t1; +REPLACE( ADDDATE( d, INTERVAL 0.6732771076944444 HOUR_SECOND ), '2', 'x' ) +NULL +NULL +Warnings: +Warning 1441 Datetime function: datetime field overflow +Warning 1441 Datetime function: datetime field overflow +SELECT REPLACE( ADDDATE( d, INTERVAL '0.6732771076944444' HOUR_SECOND ), '2', 'x' ) FROM t1; +REPLACE( ADDDATE( d, INTERVAL '0.6732771076944444' HOUR_SECOND ), '2', 'x' ) +NULL +NULL +Warnings: +Warning 1441 Datetime function: datetime field overflow +Warning 1441 Datetime function: datetime field overflow +SELECT CAST(ADDDATE( d, INTERVAL 6732771076944444 SECOND) AS CHAR) FROM t1; +CAST(ADDDATE( d, INTERVAL 6732771076944444 SECOND) AS CHAR) +NULL +NULL +Warnings: +Warning 1441 Datetime function: datetime field overflow +Warning 1441 Datetime function: datetime field overflow +SELECT CAST(ADDDATE( d, INTERVAL '67327710769444:44' HOUR_SECOND) AS CHAR) FROM t1; +CAST(ADDDATE( d, INTERVAL '67327710769444:44' HOUR_SECOND) AS CHAR) +NULL +NULL +Warnings: +Warning 1441 Datetime function: datetime field overflow +Warning 1441 Datetime function: datetime field overflow +SELECT CAST(ADDDATE( d, INTERVAL '673277107694:44:44' HOUR_SECOND) AS CHAR) FROM t1; +CAST(ADDDATE( d, INTERVAL '673277107694:44:44' HOUR_SECOND) AS CHAR) +NULL +NULL +Warnings: +Warning 1441 Datetime function: datetime field overflow +Warning 1441 Datetime function: datetime field overflow +DROP TABLE t1; +SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:23:59:59' DAY_SECOND); +ADDDATE(DATE'0000-01-01', INTERVAL '3652423:23:59:59' DAY_SECOND) +9999-12-31 23:59:59 +SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:59:59' DAY_SECOND); +ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:59:59' DAY_SECOND) +9999-12-31 23:59:59 +SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:59' DAY_SECOND); +ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:59' DAY_SECOND) +9999-12-31 23:59:59 +SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:0:315569433599' DAY_SECOND); +ADDDATE(DATE'0000-01-01', INTERVAL '0:0:0:315569433599' DAY_SECOND) +9999-12-31 23:59:59 +SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND); +ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND) +NULL +Warnings: +Warning 1441 Datetime function: datetime field overflow +SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND); +ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND) +NULL +Warnings: +Warning 1441 Datetime function: datetime field overflow +SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND); +ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND) +NULL +Warnings: +Warning 1441 Datetime function: datetime field overflow +# # End of 10.0 tests # # diff --git a/mysql-test/r/func_time_hires.result b/mysql-test/r/func_time_hires.result index 7101dc8f121..0f822456724 100644 --- a/mysql-test/r/func_time_hires.result +++ b/mysql-test/r/func_time_hires.result @@ -24,7 +24,7 @@ select time_to_sec(sec_to_time(11111)), time_to_sec(sec_to_time(11111.22222)); time_to_sec(sec_to_time(11111)) 11111 time_to_sec(sec_to_time(11111.22222)) 11111.22222 select current_timestamp(7); -ERROR 42000: Too big precision 7 specified for 'now'. Maximum is 6 +ERROR 42000: Too big precision 7 specified for 'current_timestamp'. Maximum is 6 select curtime(7); ERROR 42000: Too big precision 7 specified for 'curtime'. Maximum is 6 drop table if exists t1; @@ -156,12 +156,12 @@ explain extended select cast(cast(@a as datetime(4)) as time(0)); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select cast(cast((@`a`) as datetime(4)) as time) AS `cast(cast(@a as datetime(4)) as time(0))` +Note 1003 select cast(cast(@`a` as datetime(4)) as time) AS `cast(cast(@a as datetime(4)) as time(0))` select cast(cast(@a as time(2)) as time(6)); cast(cast(@a as time(2)) as time(6)) 12:13:14.120000 select CAST(@a AS DATETIME(7)); -ERROR 42000: Too big precision 7 specified for '(@`a`)'. Maximum is 6 +ERROR 42000: Too big precision 7 specified for '@`a`'. Maximum is 6 SELECT CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00'); CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00') 2011-01-02 15:00:00 diff --git a/mysql-test/r/func_weight_string.result b/mysql-test/r/func_weight_string.result index 0f52e793843..04fd9962218 100644 --- a/mysql-test/r/func_weight_string.result +++ b/mysql-test/r/func_weight_string.result @@ -119,7 +119,7 @@ SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and isnull(weight_string(`test`.`t1`.`a`))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and weight_string(`test`.`t1`.`a`,0,0,1) is null ALTER TABLE t1 MODIFY a DOUBLE ZEROFILL; SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL; a @@ -129,7 +129,7 @@ SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and isnull(weight_string(`test`.`t1`.`a`))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and weight_string(`test`.`t1`.`a`,0,0,1) is null ALTER TABLE t1 MODIFY a DECIMAL(10,1) ZEROFILL; SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL; a @@ -139,7 +139,7 @@ SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and isnull(weight_string(`test`.`t1`.`a`))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and weight_string(`test`.`t1`.`a`,0,0,1) is null DROP TABLE t1; # # End of 10.1 tests @@ -155,13 +155,18 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varbinary(10) DEFAULT WEIGHT_STRING(a AS CHAR(10)) + `b` varbinary(10) DEFAULT weight_string(`a`,0,10,65) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('a'); SELECT a, HEX(b) FROM t1; a HEX(b) a 41202020202020202020 DROP TABLE t1; +create view v1 as select weight_string("MySQL" as char(4)); +select * from v1; +weight_string("MySQL" as char(4)) +MYSQ +drop view v1; # # End of 10.2 tests # diff --git a/mysql-test/r/function_defaults.result b/mysql-test/r/function_defaults.result index 987c505f1fb..4b8694ec838 100644 --- a/mysql-test/r/function_defaults.result +++ b/mysql-test/r/function_defaults.result @@ -483,7 +483,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 ( a INT, b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c TIMESTAMP NULL ); @@ -491,7 +491,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE C SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `a` int(11) DEFAULT NULL, `c` timestamp NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -501,7 +501,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE C SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -527,7 +527,7 @@ CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE N SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL, `c` timestamp NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -536,7 +536,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c` timestamp NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -546,7 +546,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` timestamp NULL DEFAULT NULL, - `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -554,7 +554,7 @@ CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL, `c` timestamp NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -563,7 +563,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c` timestamp NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -573,7 +573,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` timestamp NULL DEFAULT NULL, - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -586,7 +586,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; # @@ -650,7 +650,7 @@ CREATE TABLE t2 SELECT a FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t2; a @@ -659,7 +659,7 @@ CREATE TABLE t3 SELECT b FROM t1; SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP + `b` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t3; b @@ -668,7 +668,7 @@ CREATE TABLE t4 SELECT c FROM t1; SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP + `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t4; c @@ -695,7 +695,7 @@ CREATE TABLE t7 SELECT f FROM t1; SHOW CREATE TABLE t7; Table Create Table t7 CREATE TABLE `t7` ( - `f` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `f` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t7; f @@ -704,7 +704,7 @@ CREATE TABLE t8 SELECT g FROM t1; SHOW CREATE TABLE t8; Table Create Table t8 CREATE TABLE `t8` ( - `g` datetime DEFAULT CURRENT_TIMESTAMP + `g` datetime DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t8; g @@ -713,7 +713,7 @@ CREATE TABLE t9 SELECT h FROM t1; SHOW CREATE TABLE t9; Table Create Table t9 CREATE TABLE `t9` ( - `h` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP + `h` datetime DEFAULT NULL ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t9; h @@ -753,25 +753,25 @@ SELECT * FROM t1; SHOW CREATE TABLE t12; Table Create Table t12 CREATE TABLE `t12` ( - `k` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `l` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `m` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `n` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `k` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `l` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `m` timestamp NOT NULL DEFAULT current_timestamp(), + `n` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(), `o` timestamp NOT NULL DEFAULT '1986-09-27 03:00:00', `p` timestamp NULL DEFAULT NULL, - `q` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `r` datetime DEFAULT CURRENT_TIMESTAMP, - `s` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, + `q` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `r` datetime DEFAULT current_timestamp(), + `s` datetime DEFAULT NULL ON UPDATE current_timestamp(), `t` datetime DEFAULT NULL, `u` datetime DEFAULT '1986-09-27 03:00:00', - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `b` timestamp NOT NULL DEFAULT current_timestamp(), + `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(), `d` timestamp NOT NULL DEFAULT '1986-09-27 03:00:00', `e` timestamp NULL DEFAULT NULL, - `f` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `g` datetime DEFAULT CURRENT_TIMESTAMP, - `h` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, + `f` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `g` datetime DEFAULT current_timestamp(), + `h` datetime DEFAULT NULL ON UPDATE current_timestamp(), `i` datetime DEFAULT NULL, `j` datetime DEFAULT '1986-09-27 03:00:00' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -792,7 +792,7 @@ CREATE TABLE t2 SELECT a FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `a` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t2; a @@ -801,7 +801,7 @@ CREATE TABLE t3 SELECT b FROM t1; SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( - `b` datetime DEFAULT CURRENT_TIMESTAMP + `b` datetime DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t3; b @@ -810,7 +810,7 @@ CREATE TABLE t4 SELECT c FROM t1; SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP + `c` datetime DEFAULT NULL ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t4; c @@ -847,7 +847,7 @@ CREATE TABLE t2 ( b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRE SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SET TIMESTAMP = 2000.876543; @@ -1224,12 +1224,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime DEFAULT NULL, `b` datetime DEFAULT '2011-11-18 00:00:00', - `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `like_b` datetime DEFAULT current_timestamp(), `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', - `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `like_c` datetime NOT NULL DEFAULT current_timestamp(), + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(), `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', - `f` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NOT NULL DEFAULT current_timestamp(), `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -1276,12 +1276,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime DEFAULT NULL, `b` datetime DEFAULT '2011-11-18 00:00:00', - `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `like_b` datetime DEFAULT current_timestamp(), `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', - `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `like_c` datetime NOT NULL DEFAULT current_timestamp(), + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(), `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', - `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NULL DEFAULT current_timestamp(), `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -1343,12 +1343,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime DEFAULT NULL, `b` datetime DEFAULT '2011-11-18 00:00:00', - `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `like_b` datetime DEFAULT current_timestamp(), `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', - `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `like_c` datetime NOT NULL DEFAULT current_timestamp(), + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(), `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', - `f` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NOT NULL DEFAULT current_timestamp(), `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -1381,12 +1381,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime DEFAULT NULL, `b` datetime DEFAULT '2011-11-18 00:00:00', - `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `like_b` datetime DEFAULT current_timestamp(), `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', - `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `like_c` datetime NOT NULL DEFAULT current_timestamp(), + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(), `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', - `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NULL DEFAULT current_timestamp(), `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -1429,7 +1429,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 ( a ) VALUES ( 1 ); SELECT * FROM t1; @@ -2029,7 +2029,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), c TIMESTAMP(6) NULL ); @@ -2037,7 +2037,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UP SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `a` int(11) DEFAULT NULL, `c` timestamp(6) NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -2047,7 +2047,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UP SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2073,7 +2073,7 @@ CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDAT SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL, `c` timestamp(6) NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -2082,7 +2082,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `c` timestamp(6) NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2092,7 +2092,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` timestamp(6) NULL DEFAULT NULL, - `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2100,7 +2100,7 @@ CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE CURRENT_TIMES SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL, `c` timestamp(6) NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -2109,7 +2109,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `c` timestamp(6) NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2119,7 +2119,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` timestamp(6) NULL DEFAULT NULL, - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2132,7 +2132,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; # @@ -2196,7 +2196,7 @@ CREATE TABLE t2 SELECT a FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t2; a @@ -2205,7 +2205,7 @@ CREATE TABLE t3 SELECT b FROM t1; SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t3; b @@ -2214,7 +2214,7 @@ CREATE TABLE t4 SELECT c FROM t1; SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6) + `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t4; c @@ -2241,7 +2241,7 @@ CREATE TABLE t7 SELECT f FROM t1; SHOW CREATE TABLE t7; Table Create Table t7 CREATE TABLE `t7` ( - `f` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `f` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t7; f @@ -2250,7 +2250,7 @@ CREATE TABLE t8 SELECT g FROM t1; SHOW CREATE TABLE t8; Table Create Table t8 CREATE TABLE `t8` ( - `g` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) + `g` datetime(6) DEFAULT current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t8; g @@ -2259,7 +2259,7 @@ CREATE TABLE t9 SELECT h FROM t1; SHOW CREATE TABLE t9; Table Create Table t9 CREATE TABLE `t9` ( - `h` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6) + `h` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t9; h @@ -2299,25 +2299,25 @@ SELECT * FROM t1; SHOW CREATE TABLE t12; Table Create Table t12 CREATE TABLE `t12` ( - `k` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `l` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `m` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `n` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `k` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `l` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `m` timestamp(6) NOT NULL DEFAULT current_timestamp(6), + `n` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6), `o` timestamp(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765', `p` timestamp(6) NULL DEFAULT NULL, - `q` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `r` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), - `s` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6), + `q` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `r` datetime(6) DEFAULT current_timestamp(6), + `s` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6), `t` datetime(6) DEFAULT NULL, `u` datetime(6) DEFAULT '1986-09-27 03:00:00.098765', - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6), + `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6), `d` timestamp(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765', `e` timestamp(6) NULL DEFAULT NULL, - `f` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `g` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), - `h` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6), + `f` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `g` datetime(6) DEFAULT current_timestamp(6), + `h` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6), `i` datetime(6) DEFAULT NULL, `j` datetime(6) DEFAULT '1986-09-27 03:00:00.098765' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -2338,7 +2338,7 @@ CREATE TABLE t2 SELECT a FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `a` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t2; a @@ -2347,7 +2347,7 @@ CREATE TABLE t3 SELECT b FROM t1; SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( - `b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) + `b` datetime(6) DEFAULT current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t3; b @@ -2356,7 +2356,7 @@ CREATE TABLE t4 SELECT c FROM t1; SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6) + `c` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t4; c @@ -2393,7 +2393,7 @@ CREATE TABLE t2 ( b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SET TIMESTAMP = 2000.876543; @@ -2770,12 +2770,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime(6) DEFAULT NULL, `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', - `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `like_b` datetime(6) DEFAULT current_timestamp(6), `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', - `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6), `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', - `f` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), + `f` timestamp(6) NOT NULL DEFAULT current_timestamp(6), `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -2822,12 +2822,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime(6) DEFAULT NULL, `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', - `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `like_b` datetime(6) DEFAULT current_timestamp(6), `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', - `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6), `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', - `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NULL DEFAULT current_timestamp(), `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -2889,12 +2889,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime(6) DEFAULT NULL, `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', - `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `like_b` datetime(6) DEFAULT current_timestamp(6), `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', - `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6), `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', - `f` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), + `f` timestamp(6) NOT NULL DEFAULT current_timestamp(6), `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -2927,12 +2927,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime(6) DEFAULT NULL, `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', - `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `like_b` datetime(6) DEFAULT current_timestamp(6), `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', - `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6), `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', - `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NULL DEFAULT current_timestamp(), `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -2975,7 +2975,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 ( a ) VALUES ( 1 ); SELECT * FROM t1; diff --git a/mysql-test/r/function_defaults_innodb.result b/mysql-test/r/function_defaults_innodb.result index b539f70a3cb..fe97870ab88 100644 --- a/mysql-test/r/function_defaults_innodb.result +++ b/mysql-test/r/function_defaults_innodb.result @@ -484,7 +484,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 ( a INT, b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c TIMESTAMP NULL ); @@ -492,7 +492,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE C SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `a` int(11) DEFAULT NULL, `c` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 @@ -502,7 +502,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE C SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -528,7 +528,7 @@ CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE N SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL, `c` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 @@ -537,7 +537,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -547,7 +547,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` timestamp NULL DEFAULT NULL, - `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -555,7 +555,7 @@ CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL, `c` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 @@ -564,7 +564,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -574,7 +574,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` timestamp NULL DEFAULT NULL, - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -587,7 +587,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; # @@ -651,7 +651,7 @@ CREATE TABLE t2 SELECT a FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t2; a @@ -660,7 +660,7 @@ CREATE TABLE t3 SELECT b FROM t1; SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP + `b` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t3; b @@ -669,7 +669,7 @@ CREATE TABLE t4 SELECT c FROM t1; SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP + `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t4; c @@ -696,7 +696,7 @@ CREATE TABLE t7 SELECT f FROM t1; SHOW CREATE TABLE t7; Table Create Table t7 CREATE TABLE `t7` ( - `f` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `f` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t7; f @@ -705,7 +705,7 @@ CREATE TABLE t8 SELECT g FROM t1; SHOW CREATE TABLE t8; Table Create Table t8 CREATE TABLE `t8` ( - `g` datetime DEFAULT CURRENT_TIMESTAMP + `g` datetime DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t8; g @@ -714,7 +714,7 @@ CREATE TABLE t9 SELECT h FROM t1; SHOW CREATE TABLE t9; Table Create Table t9 CREATE TABLE `t9` ( - `h` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP + `h` datetime DEFAULT NULL ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t9; h @@ -754,25 +754,25 @@ SELECT * FROM t1; SHOW CREATE TABLE t12; Table Create Table t12 CREATE TABLE `t12` ( - `k` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `l` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `m` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `n` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `k` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `l` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `m` timestamp NOT NULL DEFAULT current_timestamp(), + `n` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(), `o` timestamp NOT NULL DEFAULT '1986-09-27 03:00:00', `p` timestamp NULL DEFAULT NULL, - `q` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `r` datetime DEFAULT CURRENT_TIMESTAMP, - `s` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, + `q` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `r` datetime DEFAULT current_timestamp(), + `s` datetime DEFAULT NULL ON UPDATE current_timestamp(), `t` datetime DEFAULT NULL, `u` datetime DEFAULT '1986-09-27 03:00:00', - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `b` timestamp NOT NULL DEFAULT current_timestamp(), + `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(), `d` timestamp NOT NULL DEFAULT '1986-09-27 03:00:00', `e` timestamp NULL DEFAULT NULL, - `f` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `g` datetime DEFAULT CURRENT_TIMESTAMP, - `h` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, + `f` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `g` datetime DEFAULT current_timestamp(), + `h` datetime DEFAULT NULL ON UPDATE current_timestamp(), `i` datetime DEFAULT NULL, `j` datetime DEFAULT '1986-09-27 03:00:00' ) ENGINE=InnoDB DEFAULT CHARSET=latin1 @@ -793,7 +793,7 @@ CREATE TABLE t2 SELECT a FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `a` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t2; a @@ -802,7 +802,7 @@ CREATE TABLE t3 SELECT b FROM t1; SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( - `b` datetime DEFAULT CURRENT_TIMESTAMP + `b` datetime DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t3; b @@ -811,7 +811,7 @@ CREATE TABLE t4 SELECT c FROM t1; SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP + `c` datetime DEFAULT NULL ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t4; c @@ -848,7 +848,7 @@ CREATE TABLE t2 ( b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRE SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SET TIMESTAMP = 2000.876543; @@ -1225,12 +1225,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime DEFAULT NULL, `b` datetime DEFAULT '2011-11-18 00:00:00', - `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `like_b` datetime DEFAULT current_timestamp(), `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', - `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `like_c` datetime NOT NULL DEFAULT current_timestamp(), + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(), `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', - `f` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NOT NULL DEFAULT current_timestamp(), `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -1277,12 +1277,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime DEFAULT NULL, `b` datetime DEFAULT '2011-11-18 00:00:00', - `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `like_b` datetime DEFAULT current_timestamp(), `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', - `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `like_c` datetime NOT NULL DEFAULT current_timestamp(), + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(), `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', - `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NULL DEFAULT current_timestamp(), `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -1344,12 +1344,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime DEFAULT NULL, `b` datetime DEFAULT '2011-11-18 00:00:00', - `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `like_b` datetime DEFAULT current_timestamp(), `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', - `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `like_c` datetime NOT NULL DEFAULT current_timestamp(), + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(), `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', - `f` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NOT NULL DEFAULT current_timestamp(), `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -1382,12 +1382,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime DEFAULT NULL, `b` datetime DEFAULT '2011-11-18 00:00:00', - `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `like_b` datetime DEFAULT current_timestamp(), `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', - `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `like_c` datetime NOT NULL DEFAULT current_timestamp(), + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(), `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', - `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NULL DEFAULT current_timestamp(), `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -1430,7 +1430,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 INSERT INTO t1 ( a ) VALUES ( 1 ); SELECT * FROM t1; @@ -2030,7 +2030,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), c TIMESTAMP(6) NULL ); @@ -2038,7 +2038,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UP SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `a` int(11) DEFAULT NULL, `c` timestamp(6) NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 @@ -2048,7 +2048,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UP SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2074,7 +2074,7 @@ CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDAT SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL, `c` timestamp(6) NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 @@ -2083,7 +2083,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `c` timestamp(6) NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2093,7 +2093,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` timestamp(6) NULL DEFAULT NULL, - `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2101,7 +2101,7 @@ CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE CURRENT_TIMES SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL, `c` timestamp(6) NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 @@ -2110,7 +2110,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `c` timestamp(6) NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2120,7 +2120,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` timestamp(6) NULL DEFAULT NULL, - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2133,7 +2133,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; # @@ -2197,7 +2197,7 @@ CREATE TABLE t2 SELECT a FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t2; a @@ -2206,7 +2206,7 @@ CREATE TABLE t3 SELECT b FROM t1; SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t3; b @@ -2215,7 +2215,7 @@ CREATE TABLE t4 SELECT c FROM t1; SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6) + `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t4; c @@ -2242,7 +2242,7 @@ CREATE TABLE t7 SELECT f FROM t1; SHOW CREATE TABLE t7; Table Create Table t7 CREATE TABLE `t7` ( - `f` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `f` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t7; f @@ -2251,7 +2251,7 @@ CREATE TABLE t8 SELECT g FROM t1; SHOW CREATE TABLE t8; Table Create Table t8 CREATE TABLE `t8` ( - `g` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) + `g` datetime(6) DEFAULT current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t8; g @@ -2260,7 +2260,7 @@ CREATE TABLE t9 SELECT h FROM t1; SHOW CREATE TABLE t9; Table Create Table t9 CREATE TABLE `t9` ( - `h` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6) + `h` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t9; h @@ -2300,25 +2300,25 @@ SELECT * FROM t1; SHOW CREATE TABLE t12; Table Create Table t12 CREATE TABLE `t12` ( - `k` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `l` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `m` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `n` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `k` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `l` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `m` timestamp(6) NOT NULL DEFAULT current_timestamp(6), + `n` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6), `o` timestamp(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765', `p` timestamp(6) NULL DEFAULT NULL, - `q` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `r` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), - `s` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6), + `q` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `r` datetime(6) DEFAULT current_timestamp(6), + `s` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6), `t` datetime(6) DEFAULT NULL, `u` datetime(6) DEFAULT '1986-09-27 03:00:00.098765', - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6), + `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6), `d` timestamp(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765', `e` timestamp(6) NULL DEFAULT NULL, - `f` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `g` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), - `h` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6), + `f` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `g` datetime(6) DEFAULT current_timestamp(6), + `h` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6), `i` datetime(6) DEFAULT NULL, `j` datetime(6) DEFAULT '1986-09-27 03:00:00.098765' ) ENGINE=InnoDB DEFAULT CHARSET=latin1 @@ -2339,7 +2339,7 @@ CREATE TABLE t2 SELECT a FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `a` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t2; a @@ -2348,7 +2348,7 @@ CREATE TABLE t3 SELECT b FROM t1; SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( - `b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) + `b` datetime(6) DEFAULT current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t3; b @@ -2357,7 +2357,7 @@ CREATE TABLE t4 SELECT c FROM t1; SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6) + `c` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t4; c @@ -2394,7 +2394,7 @@ CREATE TABLE t2 ( b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SET TIMESTAMP = 2000.876543; @@ -2771,12 +2771,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime(6) DEFAULT NULL, `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', - `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `like_b` datetime(6) DEFAULT current_timestamp(6), `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', - `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6), `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', - `f` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), + `f` timestamp(6) NOT NULL DEFAULT current_timestamp(6), `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -2823,12 +2823,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime(6) DEFAULT NULL, `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', - `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `like_b` datetime(6) DEFAULT current_timestamp(6), `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', - `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6), `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', - `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NULL DEFAULT current_timestamp(), `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -2890,12 +2890,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime(6) DEFAULT NULL, `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', - `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `like_b` datetime(6) DEFAULT current_timestamp(6), `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', - `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6), `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', - `f` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), + `f` timestamp(6) NOT NULL DEFAULT current_timestamp(6), `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -2928,12 +2928,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime(6) DEFAULT NULL, `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', - `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `like_b` datetime(6) DEFAULT current_timestamp(6), `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', - `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6), `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', - `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NULL DEFAULT current_timestamp(), `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -2976,7 +2976,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 INSERT INTO t1 ( a ) VALUES ( 1 ); SELECT * FROM t1; diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index d10cfec6003..ed0d8f540a0 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -488,7 +488,7 @@ explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimpl id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select st_issimple(st_multipoint(point(3,6),point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,st_issimple(point(3,6)) AS `issimple(Point(3, 6))` +Note 1003 select st_issimple(geometrycollection(point(3,6),point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,st_issimple(point(3,6)) AS `issimple(Point(3, 6))` create table t1 (a geometry not null); insert into t1 values (GeomFromText('Point(1 2)')); insert into t1 values ('Garbage'); @@ -1832,6 +1832,14 @@ DROP TABLE t1,t2; # # Start of 10.2 tests # +create view v1 as select AsWKT(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))); +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select st_astext(geometrycollection(point(44,6),geometrycollection(point(3,6),point(7,9)))) AS `Name_exp_1` latin1 latin1_swedish_ci +select * from v1; +Name_exp_1 +GEOMETRYCOLLECTION(POINT(44 6),GEOMETRYCOLLECTION(POINT(3 6),POINT(7 9))) +drop view v1; # # MDEV-10134 Add full support for DEFAULT # @@ -1840,8 +1848,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` point DEFAULT NULL, - `x` double DEFAULT x(a), - `y` double DEFAULT y(a) + `x` double DEFAULT st_x(`a`), + `y` double DEFAULT st_y(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (Point(1,2)); SELECT x,y FROM t1; @@ -1853,7 +1861,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `g` geometry DEFAULT NULL, - `area` double DEFAULT ST_AREA(g) + `area` double DEFAULT st_area(`g`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (g) VALUES (GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))')); SELECT area FROM t1; @@ -1865,7 +1873,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `g` geometry DEFAULT NULL, - `length` double DEFAULT ST_LENGTH(g) + `length` double DEFAULT st_length(`g`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (g) VALUES (GeomFromText('LINESTRING(0 0,20 0,20 20,0 20,0 0)')); SELECT length FROM t1; @@ -1877,7 +1885,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `g` point DEFAULT NULL, - `distance` double DEFAULT ST_DISTANCE(g, POINT(0,0)) + `distance` double DEFAULT st_distance(`g`,point(0,0)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (g) VALUES (Point(1,0)); SELECT distance FROM t1; @@ -1889,7 +1897,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` text DEFAULT NULL, - `g` geometry DEFAULT GeomFromText(a) + `g` geometry DEFAULT st_geometryfromtext(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('point(1 1)'); SELECT AsText(g) FROM t1; @@ -1902,7 +1910,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL, `y` int(11) DEFAULT NULL, - `g` geometry DEFAULT POINT(x,y) + `g` geometry DEFAULT point(`x`,`y`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (x,y) VALUES (10,20); SELECT AsText(g) FROM t1; @@ -1914,7 +1922,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` geometry DEFAULT PointN(a,2) + `b` geometry DEFAULT st_pointn(`a`,2) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,2 2,3 3)')); SELECT AsText(b) FROM t1; @@ -1926,7 +1934,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` geometry DEFAULT StartPoint(a) + `b` geometry DEFAULT st_startpoint(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,2 2,3 3)')); SELECT AsText(b) FROM t1; @@ -1939,7 +1947,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` geometry DEFAULT NULL, - `c` geometry DEFAULT GeometryCollection(a,b) + `c` geometry DEFAULT geometrycollection(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (Point(1,1), Point(2,2)); SELECT AsText(c) FROM t1; @@ -1951,7 +1959,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` geometry DEFAULT GeomFromWKB(AsBinary(a),20) + `b` geometry DEFAULT st_geometryfromwkb(st_aswkb(`a`),20) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('POINT(1 1)', 10)); SELECT AsText(a), SRID(a), AsText(b), SRID(b) FROM t1; @@ -1963,7 +1971,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` geometry DEFAULT BOUNDARY(a) + `b` geometry DEFAULT st_boundary(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))')); SELECT AsText(b) FROM t1; @@ -1975,7 +1983,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` geometry DEFAULT BUFFER(a,10) + `b` geometry DEFAULT st_buffer(`a`,10) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))')); SELECT GeometryType(b) FROM t1; @@ -1987,7 +1995,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` geometry DEFAULT CENTROID(a) + `b` geometry DEFAULT st_centroid(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))')); SELECT AsText(b) FROM t1; @@ -1999,7 +2007,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` geometry DEFAULT ENVELOPE(a) + `b` geometry DEFAULT st_envelope(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,4 4)')); SELECT AsText(b) FROM t1; @@ -2011,7 +2019,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` geometry DEFAULT PointOnSurface(a) + `b` geometry DEFAULT st_pointonsurface(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))')); SELECT GeometryType(b) FROM t1; @@ -2023,8 +2031,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` geometry DEFAULT Point(1,1), - `c` geometry DEFAULT ST_UNION(a,b) + `b` geometry DEFAULT point(1,1), + `c` geometry DEFAULT st_union(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (Point(0,0)); SELECT AsText(c) FROM t1; @@ -2036,7 +2044,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` varchar(20) DEFAULT GeometryType(a) + `b` varchar(20) DEFAULT st_geometrytype(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (Point(0, 0)); SELECT b FROM t1; @@ -2048,7 +2056,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` int(11) DEFAULT IsSimple(a) + `b` int(11) DEFAULT st_issimple(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (Point(0, 0)); SELECT b FROM t1; @@ -2060,7 +2068,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` int(11) DEFAULT IsEmpty(a) + `b` int(11) DEFAULT st_isempty(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (Point(0, 0)); SELECT b FROM t1; @@ -2072,7 +2080,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` int(11) DEFAULT IsRing(a) + `b` int(11) DEFAULT st_isring(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('LineString(0 0,0 1,1 1,1 0,0 0)')); SELECT b FROM t1; @@ -2084,7 +2092,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` int(11) DEFAULT IsClosed(a) + `b` int(11) DEFAULT st_isclosed(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('LineString(0 0,0 1,1 1,1 0,0 0)')); SELECT b FROM t1; @@ -2096,7 +2104,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` int(11) DEFAULT Dimension(a) + `b` int(11) DEFAULT st_dimension(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (Buffer(Point(1,1),1)); SELECT b FROM t1; @@ -2108,7 +2116,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` int(11) DEFAULT NumGeometries(a) + `b` int(11) DEFAULT st_numgeometries(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (ST_UNION(Point(1,1),Point(0,0))); SELECT b FROM t1; @@ -2120,7 +2128,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` int(11) DEFAULT NumInteriorRings(a) + `b` int(11) DEFAULT st_numinteriorrings(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))')); SELECT b FROM t1; @@ -2132,7 +2140,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` int(11) DEFAULT NumPoints(a) + `b` int(11) DEFAULT st_numpoints(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (LineString(Point(1,1),Point(0,0))); SELECT b FROM t1; @@ -2144,7 +2152,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` int(11) DEFAULT SRID(a) + `b` int(11) DEFAULT srid(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('Point(1 1)', 100)); SELECT b FROM t1; @@ -2157,7 +2165,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` geometry DEFAULT NULL, - `c` int(11) DEFAULT MBRDisjoint(a,b) + `c` int(11) DEFAULT mbrdisjoint(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1)); SELECT c FROM t1; @@ -2170,7 +2178,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` geometry DEFAULT NULL, - `c` int(11) DEFAULT ST_Disjoint(a,b) + `c` int(11) DEFAULT st_disjoint(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1)); SELECT c FROM t1; @@ -2183,7 +2191,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` geometry DEFAULT NULL, - `c` int(11) DEFAULT ST_Relate(a,b,'T*F**FFF*') + `c` int(11) DEFAULT st_relate(`a`,`b`,'T*F**FFF*') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1)); SELECT c FROM t1; diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index 8442f7fc401..2d6d9f3b632 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -685,7 +685,7 @@ Db char(64) NO PRI User char(80) NO PRI Table_name char(64) NO PRI Grantor char(141) NO MUL -Timestamp timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +Timestamp timestamp NO current_timestamp() on update current_timestamp() Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') NO Column_priv set('Select','Insert','Update','References') NO use test; @@ -1093,10 +1093,10 @@ SHOW CREATE VIEW mysqltest2.t_nn; ERROR HY000: 'mysqltest2.t_nn' is not VIEW SHOW CREATE VIEW mysqltest2.v_yy; View Create View character_set_client collation_connection -v_yy CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where (`mysqltest2`.`t_nn`.`c1` = 55) latin1 latin1_swedish_ci +v_yy CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where `mysqltest2`.`t_nn`.`c1` = 55 latin1 latin1_swedish_ci SHOW CREATE TABLE mysqltest2.v_yy; View Create View character_set_client collation_connection -v_yy CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where (`mysqltest2`.`t_nn`.`c1` = 55) latin1 latin1_swedish_ci +v_yy CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where `mysqltest2`.`t_nn`.`c1` = 55 latin1 latin1_swedish_ci connection master; SHOW CREATE TABLE mysqltest2.v_nn; View Create View character_set_client collation_connection @@ -2675,7 +2675,7 @@ CREATE TABLE t1 (a VARCHAR(30) DEFAULT USER()); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(30) DEFAULT USER() + `a` varchar(30) DEFAULT user() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (); GRANT ALL PRIVILEGES ON test.* TO dummy@localhost IDENTIFIED BY 'pwd'; diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 7cc5f1029b0..8788114583d 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -1789,7 +1789,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select <`test`.`t1`.`a`>((select `test`.`t1`.`a`)) AS `aa`,count(distinct `test`.`t1`.`b`) AS `COUNT(DISTINCT b)` from `test`.`t1` group by (<`test`.`t1`.`a`>((select `test`.`t1`.`a`)) + 0) +Note 1003 select <`test`.`t1`.`a`>((select `test`.`t1`.`a`)) AS `aa`,count(distinct `test`.`t1`.`b`) AS `COUNT(DISTINCT b)` from `test`.`t1` group by <`test`.`t1`.`a`>((select `test`.`t1`.`a`)) + 0 EXPLAIN EXTENDED SELECT (SELECT t1.a) aa, COUNT(DISTINCT b) FROM t1 GROUP BY -aa; id select_type table type possible_keys key key_len ref rows filtered Extra @@ -1797,7 +1797,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select <`test`.`t1`.`a`>((select `test`.`t1`.`a`)) AS `aa`,count(distinct `test`.`t1`.`b`) AS `COUNT(DISTINCT b)` from `test`.`t1` group by -(<`test`.`t1`.`a`>((select `test`.`t1`.`a`))) +Note 1003 select <`test`.`t1`.`a`>((select `test`.`t1`.`a`)) AS `aa`,count(distinct `test`.`t1`.`b`) AS `COUNT(DISTINCT b)` from `test`.`t1` group by -<`test`.`t1`.`a`>((select `test`.`t1`.`a`)) # should return only one record SELECT (SELECT tt.a FROM t1 tt LIMIT 1) aa, COUNT(DISTINCT b) FROM t1 GROUP BY aa; @@ -2627,6 +2627,20 @@ MAX(i) c 7 foo drop table t1,t2; # +# ONLY_FULL_GROUP_BY references +# +set @save_sql_mode = @@sql_mode; +set sql_mode='ONLY_FULL_GROUP_BY'; +create table t1 (a int, b int); +select a+b as x from t1 group by x having x > 1; +x +select a as x from t1 group by x having x > 1; +x +select a from t1 group by a having a > 1; +a +drop table t1; +set sql_mode= @save_sql_mode; +# # Bug #58782 # Missing rows with SELECT .. WHERE .. IN subquery # with full GROUP BY and no aggr diff --git a/mysql-test/r/group_by_innodb.result b/mysql-test/r/group_by_innodb.result index bf6b25f31fa..034866b63d5 100644 --- a/mysql-test/r/group_by_innodb.result +++ b/mysql-test/r/group_by_innodb.result @@ -123,6 +123,16 @@ id xtext optionen 2 number 22,25 1 select Kabel mit Stecker 5-polig,Kabel ohne Stecker DROP TABLE t1, t2; +# +# MDEV-11162: Assertion `num_records == m_idx_array.size()' failed in Filesort_buffer::alloc_sort_buffer(uint, uint) +# +CREATE TABLE t1 (i INT) ENGINE=InnoDB; +SELECT ( SELECT DISTINCT GROUP_CONCAT(SLEEP(0)) FROM t1 GROUP BY i ); +( SELECT DISTINCT GROUP_CONCAT(SLEEP(0)) FROM t1 GROUP BY i ) +NULL +SELECT i FROM t1 order by i LIMIT 1; +i +DROP TABLE t1; # Port of testcase: # # Bug#20819199 ASSERTION FAILED IN TEST_IF_SKIP_SORT_ORDER diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result index 5d2af550b81..36a44b05817 100644 --- a/mysql-test/r/group_min_max.result +++ b/mysql-test/r/group_min_max.result @@ -1715,7 +1715,7 @@ explain extended select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 50.78 Using where; Using index Warnings: -Note 1003 select distinct `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`b` = 'a') and (`test`.`t1`.`c` = 'i121') and (`test`.`t1`.`a2` >= 'b')) +Note 1003 select distinct `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where `test`.`t1`.`b` = 'a' and `test`.`t1`.`c` = 'i121' and `test`.`t1`.`a2` >= 'b' explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 14 Using where; Using index for group-by @@ -1732,7 +1732,7 @@ explain extended select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 50.61 Using where; Using index Warnings: -Note 1003 select distinct `test`.`t2`.`a1` AS `a1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`b` = 'a') and (`test`.`t2`.`c` = 'i121') and (`test`.`t2`.`a2` >= 'b')) +Note 1003 select distinct `test`.`t2`.`a1` AS `a1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`b` = 'a' and `test`.`t2`.`c` = 'i121' and `test`.`t2`.`a2` >= 'b' explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by @@ -1961,7 +1961,7 @@ explain extended select count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 14 100.00 Using where; Using index for group-by Warnings: -Note 1003 select count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`) AS `count(distinct a1,a2,b)` from `test`.`t1` where ((`test`.`t1`.`b` = 'c') and (`test`.`t1`.`a1` > 'a') and (`test`.`t1`.`a2` > 'a')) +Note 1003 select count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`) AS `count(distinct a1,a2,b)` from `test`.`t1` where `test`.`t1`.`b` = 'c' and `test`.`t1`.`a1` > 'a' and `test`.`t1`.`a2` > 'a' explain select count(distinct b) from t1 where (a2 >= 'b') and (b = 'a'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL idx_t1_2 147 NULL 128 Using where; Using index @@ -1969,7 +1969,7 @@ explain extended select 98 + count(distinct a1,a2,b) from t1 where (a1 > 'a') an id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 14 100.00 Using where; Using index for group-by Warnings: -Note 1003 select (98 + count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`)) AS `98 + count(distinct a1,a2,b)` from `test`.`t1` where ((`test`.`t1`.`a1` > 'a') and (`test`.`t1`.`a2` > 'a')) +Note 1003 select 98 + count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`) AS `98 + count(distinct a1,a2,b)` from `test`.`t1` where `test`.`t1`.`a1` > 'a' and `test`.`t1`.`a2` > 'a' select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a'); count(distinct a1,a2,b) 4 @@ -2077,19 +2077,19 @@ where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a1 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 76 85.53 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,min(`test`.`t1`.`b`) AS `min(b)`,max(`test`.`t1`.`b`) AS `max(b)` from `test`.`t1` where (((`test`.`t1`.`a1` = 'b') or (`test`.`t1`.`a1` = 'd') or (`test`.`t1`.`a1` = 'a') or (`test`.`t1`.`a1` = 'c')) and (`test`.`t1`.`a2` > 'a') and (`test`.`t1`.`c` > 'a111')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2` +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,min(`test`.`t1`.`b`) AS `min(b)`,max(`test`.`t1`.`b`) AS `max(b)` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`c` > 'a111' group by `test`.`t1`.`a1`,`test`.`t1`.`a2` explain extended select a1,a2,b,min(c),max(c) from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 50.78 Using where; Using temporary; Using filesort Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,min(`test`.`t1`.`c`) AS `min(c)`,max(`test`.`t1`.`c`) AS `max(c)` from `test`.`t1` where (((`test`.`t1`.`a1` = 'b') or (`test`.`t1`.`a1` = 'd') or (`test`.`t1`.`a1` = 'a') or (`test`.`t1`.`a1` = 'c')) and (`test`.`t1`.`a2` > 'a') and (`test`.`t1`.`d` > 'xy2')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,min(`test`.`t1`.`c`) AS `min(c)`,max(`test`.`t1`.`c`) AS `max(c)` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`d` > 'xy2' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` explain extended select a1,a2,b,c from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b,c; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 50.78 Using where; Using temporary; Using filesort Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (((`test`.`t1`.`a1` = 'b') or (`test`.`t1`.`a1` = 'd') or (`test`.`t1`.`a1` = 'a') or (`test`.`t1`.`a1` = 'c')) and (`test`.`t1`.`a2` > 'a') and (`test`.`t1`.`d` > 'xy2')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`,`test`.`t1`.`c` +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`d` > 'xy2' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`,`test`.`t1`.`c` explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') or (b < 'b') group by a1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index @@ -2097,7 +2097,7 @@ explain extended select a1,a2,b from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 76 85.53 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (((`test`.`t1`.`a1` = 'b') or (`test`.`t1`.`a1` = 'd') or (`test`.`t1`.`a1` = 'a') or (`test`.`t1`.`a1` = 'c')) and (`test`.`t1`.`a2` > 'a') and (`test`.`t1`.`c` > 'a111')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`c` > 'a111' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` explain select a1,a2,min(b),c from t2 where (a2 = 'a') and (c = 'a111') group by a1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index @@ -2121,12 +2121,12 @@ explain extended select a1,a2,count(a2) from t1 where (a1 > 'a') group by a1,a2, id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 75.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,count(`test`.`t1`.`a2`) AS `count(a2)` from `test`.`t1` where (`test`.`t1`.`a1` > 'a') group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,count(`test`.`t1`.`a2`) AS `count(a2)` from `test`.`t1` where `test`.`t1`.`a1` > 'a' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` explain extended select sum(ord(a1)) from t1 where (a1 > 'a') group by a1,a2,b; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 75.00 Using where; Using index Warnings: -Note 1003 select sum(ord(`test`.`t1`.`a1`)) AS `sum(ord(a1))` from `test`.`t1` where (`test`.`t1`.`a1` > 'a') group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` +Note 1003 select sum(ord(`test`.`t1`.`a1`)) AS `sum(ord(a1))` from `test`.`t1` where `test`.`t1`.`a1` > 'a' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` create table t4 as select distinct a1, a2, b, c from t1; alter table t4 add unique index idxt4 (a1, a2, b, c); # This is "superceded" by MDEV-7118, and Loose Index Scan is again an option: @@ -2562,7 +2562,7 @@ a MIN(b) MAX(b) AVG(b) DROP TABLE t1; create table t1 (a int, b int, key (a,b), key `index` (a,b)) engine=MyISAM; Warnings: -Note 1831 Duplicate index 'index' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `index`. This is deprecated and will be disallowed in a future release insert into t1 (a,b) values (0,0),(0,1),(0,2),(0,3),(0,4),(0,5),(0,6), (0,7),(0,8),(0,9),(0,10),(0,11),(0,12),(0,13), @@ -2636,7 +2636,7 @@ explain extended select sql_buffer_result a, max(b)+1 from t1 where a = 0 group id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ref a,index a 5 const 15 100.00 Using index; Using temporary Warnings: -Note 1003 select sql_buffer_result `test`.`t1`.`a` AS `a`,(max(`test`.`t1`.`b`) + 1) AS `max(b)+1` from `test`.`t1` where (`test`.`t1`.`a` = 0) group by `test`.`t1`.`a` +Note 1003 select sql_buffer_result `test`.`t1`.`a` AS `a`,max(`test`.`t1`.`b`) + 1 AS `max(b)+1` from `test`.`t1` where `test`.`t1`.`a` = 0 group by `test`.`t1`.`a` drop table t1; CREATE TABLE t1 (a int, b int, c int, d int, KEY foo (c,d,a,b), KEY bar (c,a,b,d)); diff --git a/mysql-test/r/group_min_max_innodb.result b/mysql-test/r/group_min_max_innodb.result index 9d8f8e7a26c..311032bc453 100644 --- a/mysql-test/r/group_min_max_innodb.result +++ b/mysql-test/r/group_min_max_innodb.result @@ -286,3 +286,19 @@ F 28 28 F 29 29 F 30 30 DROP TABLE t0,t1,t2; +# +# MDEV-MariaDB daemon leaks memory with specific query +# +CREATE TABLE t1 (`voter_id` int(11) unsigned NOT NULL, +`language_id` int(11) unsigned NOT NULL DEFAULT '1' +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE t2 (`voter_id` int(10) unsigned NOT NULL DEFAULT '0', +`serialized_c` mediumblob) ENGINE=InnoDB DEFAULT CHARSET=utf8; +insert into t2 values (1,repeat("a",1000)),(2,repeat("a",1000)),(3,repeat("b",1000)),(4,repeat("c",1000)),(4,repeat("b",1000)); +SELECT GROUP_CONCAT(t1.language_id SEPARATOR ',') AS `translation_resources`, `d`.`serialized_c` FROM t2 AS `d` LEFT JOIN t1 ON `d`.`voter_id` = t1.`voter_id` GROUP BY `d`.`voter_id` ORDER BY 10-d.voter_id+RAND()*0; +translation_resources serialized_c +NULL cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +NULL bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +NULL aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +NULL aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +drop table t1,t2; diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result index 627edd60141..c008f6b4d13 100644 --- a/mysql-test/r/having.result +++ b/mysql-test/r/having.result @@ -12,7 +12,7 @@ explain extended select count(a) as b from t1 where a=0 having b >=0; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select count(NULL) AS `b` from dual where 0 having (`b` >= 0) +Note 1003 select count(NULL) AS `b` from dual where 0 having `b` >= 0 drop table t1; CREATE TABLE t1 ( raw_id int(10) NOT NULL default '0', @@ -472,7 +472,7 @@ HAVING (table2.f2 = 8 AND table1.f1 >= 6); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING noticed after reading const tables Warnings: -Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where (`test`.`table1`.`f3` = 9) group by `test`.`table1`.`f1`,7 having 0 +Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where `test`.`table1`.`f3` = 9 group by `test`.`table1`.`f1`,7 having 0 EXPLAIN EXTENDED SELECT table1.f1, table2.f2 FROM t1 AS table1 @@ -483,7 +483,7 @@ HAVING (table2.f2 = 8); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING noticed after reading const tables Warnings: -Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where (`test`.`table1`.`f3` = 9) group by `test`.`table1`.`f1`,7 having 0 +Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where `test`.`table1`.`f3` = 9 group by `test`.`table1`.`f1`,7 having 0 DROP TABLE t1; # # Bug#52336 Segfault / crash in 5.1 copy_fields (param=0x9872980) at sql_select.cc:15355 @@ -631,7 +631,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL f10 4 NULL 2 100.00 Using index 2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select min(`test`.`t1`.`f10`) AS `field1` from `test`.`t1` where <7>((7,(select `test`.`t3`.`f3` from `test`.`t3` where ((7) = `test`.`t3`.`f3`)))) having ((`field1`) < 's') +Note 1003 select min(`test`.`t1`.`f10`) AS `field1` from `test`.`t1` where <7>((7,(select `test`.`t3`.`f3` from `test`.`t3` where (7) = `test`.`t3`.`f3`))) having (`field1`) < 's' set optimizer_switch=@save_optimizer_switch; drop table t1,t2,t3; End of 5.2 tests @@ -707,3 +707,23 @@ c1 c2 x x DROP TABLE t1,t2; End of 10.0 tests +# +# MDEV-10716: Assertion `real_type() != FIELD_ITEM' failed in +# Item_ref::build_equal_items(THD*, COND_EQUAL*, bool, COND_EQUAL**) +# +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); +SELECT i, COUNT(*) FROM t1 GROUP BY i HAVING i<>0 AND 1; +i COUNT(*) +1 1 +2 1 +SELECT i-1 A, COUNT(*) FROM t1 GROUP BY i HAVING A AND 1; +A COUNT(*) +1 1 +CREATE VIEW v1 as select i, i-1 as A from t1; +SELECT A, COUNT(*) FROM v1 GROUP BY i HAVING A AND 1; +A COUNT(*) +1 1 +DROP VIEW v1; +DROP TABLE t1; +End of 10.1 tests diff --git a/mysql-test/r/index_merge_innodb.result b/mysql-test/r/index_merge_innodb.result index 5202c79f3c7..0450622411a 100644 --- a/mysql-test/r/index_merge_innodb.result +++ b/mysql-test/r/index_merge_innodb.result @@ -311,6 +311,9 @@ set @d=@d*2; alter table t1 add index i2(key2); alter table t1 add index i3(key3); update t1 set key2=key1,key3=key1; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index_merge i2,i3 i3,i2 4,4 NULL REF Using sort_union(i3,i2); Using where @@ -549,7 +552,7 @@ primary key (pk1, pk2) ); explain select * from t1 where pk1 = 1 and pk2 < 80 and key1=0; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,key1 PRIMARY 8 NULL 9 Using where +1 SIMPLE t1 range PRIMARY,key1 PRIMARY 8 NULL 10 Using where select * from t1 where pk1 = 1 and pk2 < 80 and key1=0; pk1 pk2 key1 key2 pktail1ok pktail2ok pktail3bad pktail4bad pktail5bad pk2copy badkey filler1 filler2 1 10 0 0 0 0 0 0 0 10 0 filler-data-10 filler2 @@ -594,7 +597,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index_merge key1,pktail2ok key1,pktail2ok 4,4 NULL 1 Using intersect(key1,pktail2ok); Using where explain select * from t1 where (pktail2ok=1 and pk1< 50000) or key1=10; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge PRIMARY,key1,pktail2ok pktail2ok,key1 8,4 NULL 199 Using sort_union(pktail2ok,key1); Using where +1 SIMPLE t1 index_merge PRIMARY,key1,pktail2ok pktail2ok,key1 8,4 NULL 200 Using sort_union(pktail2ok,key1); Using where explain select * from t1 where pktail3bad=1 and key1=10; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref key1,pktail3bad key1 4 const 100 Using where @@ -696,8 +699,8 @@ SELECT COUNT(*) FROM (SELECT * FROM t1 FORCE INDEX(primary,idx) WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ALL NULL NULL NULL NULL 6144 -2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 6144 Using sort_union(idx,PRIMARY); Using where +1 PRIMARY ALL NULL NULL NULL NULL 6145 +2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 6145 Using sort_union(idx,PRIMARY); Using where SELECT COUNT(*) FROM (SELECT * FROM t1 FORCE INDEX(primary,idx) WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t; diff --git a/mysql-test/r/index_merge_myisam.result b/mysql-test/r/index_merge_myisam.result index 57074eded2a..21387f67893 100644 --- a/mysql-test/r/index_merge_myisam.result +++ b/mysql-test/r/index_merge_myisam.result @@ -224,7 +224,7 @@ index i2_1(key2, key2_1), index i2_2(key2, key2_1) ); Warnings: -Note 1831 Duplicate index 'i2_2' defined on the table 'test.t4'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `i2_2`. This is deprecated and will be disallowed in a future release insert into t4 select key1,key1,key1 div 10, key1 % 10, key1 % 10, key1 from t0; select * from t4 where key1a = 3 or key1b = 4; key1a key1b key2 key2_1 key2_2 key3 @@ -1146,6 +1146,9 @@ set @d=@d*2; alter table t1 add index i2(key2); alter table t1 add index i3(key3); update t1 set key2=key1,key3=key1; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index_merge i2,i3 i3,i2 4,4 NULL REF Using sort_union(i3,i2); Using where diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index c82b05d44ed..ce43e9f8a6b 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -455,10 +455,10 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par select * from information_schema.views where TABLE_NAME like "v%"; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM def test v0 select `information_schema`.`schemata`.`SCHEMA_NAME` AS `c` from `information_schema`.`schemata` NONE NO root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED -def test v1 select `information_schema`.`tables`.`TABLE_NAME` AS `c` from `information_schema`.`tables` where (`information_schema`.`tables`.`TABLE_NAME` = 'v1') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED -def test v2 select `information_schema`.`columns`.`COLUMN_NAME` AS `c` from `information_schema`.`columns` where (`information_schema`.`columns`.`TABLE_NAME` = 'v2') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED -def test v3 select `information_schema`.`character_sets`.`CHARACTER_SET_NAME` AS `c` from `information_schema`.`character_sets` where (`information_schema`.`character_sets`.`CHARACTER_SET_NAME` like 'latin1%') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED -def test v4 select `information_schema`.`collations`.`COLLATION_NAME` AS `c` from `information_schema`.`collations` where (`information_schema`.`collations`.`COLLATION_NAME` like 'latin1%') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED +def test v1 select `information_schema`.`tables`.`TABLE_NAME` AS `c` from `information_schema`.`tables` where `information_schema`.`tables`.`TABLE_NAME` = 'v1' NONE NO root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED +def test v2 select `information_schema`.`columns`.`COLUMN_NAME` AS `c` from `information_schema`.`columns` where `information_schema`.`columns`.`TABLE_NAME` = 'v2' NONE NO root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED +def test v3 select `information_schema`.`character_sets`.`CHARACTER_SET_NAME` AS `c` from `information_schema`.`character_sets` where `information_schema`.`character_sets`.`CHARACTER_SET_NAME` like 'latin1%' NONE NO root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED +def test v4 select `information_schema`.`collations`.`COLLATION_NAME` AS `c` from `information_schema`.`collations` where `information_schema`.`collations`.`COLLATION_NAME` like 'latin1%' NONE NO root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED drop view v0, v1, v2, v3, v4; create table t1 (a int); grant select,update,insert on t1 to mysqltest_1@localhost; @@ -508,10 +508,10 @@ create table t1 (a int null, primary key(a)); alter table t1 add constraint constraint_1 unique (a); alter table t1 add constraint unique key_1(a); Warnings: -Note 1831 Duplicate index 'key_1' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `key_1`. This is deprecated and will be disallowed in a future release alter table t1 add constraint constraint_2 unique key_2(a); Warnings: -Note 1831 Duplicate index 'key_2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `key_2`. This is deprecated and will be disallowed in a future release show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -1053,19 +1053,19 @@ Grants for user3@localhost GRANT USAGE ON *.* TO 'user3'@'localhost' GRANT SELECT ON `mysqltest`.* TO 'user3'@'localhost' connection con4; -select * from information_schema.column_privileges where grantee like '%user%' +select * from information_schema.column_privileges where grantee like '\'user%' order by grantee; GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE 'user1'@'localhost' def mysqltest t1 f1 SELECT NO -select * from information_schema.table_privileges where grantee like '%user%' +select * from information_schema.table_privileges where grantee like '\'user%' order by grantee; GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE 'user2'@'localhost' def mysqltest t2 SELECT NO -select * from information_schema.schema_privileges where grantee like '%user%' +select * from information_schema.schema_privileges where grantee like '\'user%' order by grantee; GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE 'user3'@'localhost' def mysqltest SELECT NO -select * from information_schema.user_privileges where grantee like '%user%' +select * from information_schema.user_privileges where grantee like '\'user%' order by grantee; GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE 'user1'@'localhost' def USAGE NO @@ -1247,7 +1247,6 @@ table_schema='information_schema' and or column_type = 'varchar(27)') group by column_type order by num; column_type group_concat(table_schema, '.', table_name) num -varchar(27) information_schema.COLUMNS 1 varchar(7) information_schema.ROUTINES,information_schema.VIEWS 2 varchar(20) information_schema.ALL_PLUGINS,information_schema.ALL_PLUGINS,information_schema.ALL_PLUGINS,information_schema.FILES,information_schema.FILES,information_schema.PLUGINS,information_schema.PLUGINS,information_schema.PLUGINS,information_schema.PROFILING 9 create table t1(f1 char(1) not null, f2 char(9) not null) @@ -2062,7 +2061,7 @@ where (table_schema = "osm") and (table_name = "test"); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE columns ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL NULL Using where; Open_frm_only; Scanned 0 databases Warnings: -Note 1003 select `information_schema`.`columns`.`COLUMN_NAME` AS `column_name` from `information_schema`.`columns` where ((`information_schema`.`columns`.`TABLE_SCHEMA` = 'osm') and (`information_schema`.`columns`.`TABLE_NAME` = 'test')) +Note 1003 select `information_schema`.`columns`.`COLUMN_NAME` AS `column_name` from `information_schema`.`columns` where `information_schema`.`columns`.`TABLE_SCHEMA` = 'osm' and `information_schema`.`columns`.`TABLE_NAME` = 'test' explain extended select information_schema.columns.column_name as column_name from information_schema.columns @@ -2070,7 +2069,7 @@ where (information_schema.columns.table_schema = 'osm') and (information_schema. id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE columns ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL NULL Using where; Open_frm_only; Scanned 0 databases Warnings: -Note 1003 select `information_schema`.`columns`.`COLUMN_NAME` AS `column_name` from `information_schema`.`columns` where ((`information_schema`.`columns`.`TABLE_SCHEMA` = 'osm') and (`information_schema`.`columns`.`TABLE_NAME` = 'test')) +Note 1003 select `information_schema`.`columns`.`COLUMN_NAME` AS `column_name` from `information_schema`.`columns` where `information_schema`.`columns`.`TABLE_SCHEMA` = 'osm' and `information_schema`.`columns`.`TABLE_NAME` = 'test' drop view v1; # # Clean-up. diff --git a/mysql-test/r/information_schema_all_engines.result b/mysql-test/r/information_schema_all_engines.result index 7f79dd883e2..126a6f4bccd 100644 --- a/mysql-test/r/information_schema_all_engines.result +++ b/mysql-test/r/information_schema_all_engines.result @@ -17,13 +17,17 @@ GEOMETRY_COLUMNS GLOBAL_STATUS GLOBAL_VARIABLES INDEX_STATISTICS -INNODB_CHANGED_PAGES +INNODB_BUFFER_PAGE +INNODB_BUFFER_PAGE_LRU +INNODB_BUFFER_POOL_STATS INNODB_CMP INNODB_CMPMEM INNODB_CMPMEM_RESET INNODB_CMP_PER_INDEX INNODB_CMP_RESET +INNODB_LOCKS INNODB_LOCK_WAITS +INNODB_METRICS INNODB_MUTEXES INNODB_SYS_COLUMNS INNODB_SYS_FIELDS @@ -32,6 +36,7 @@ INNODB_SYS_FOREIGN_COLS INNODB_SYS_INDEXES INNODB_SYS_TABLES INNODB_SYS_TABLESTATS +INNODB_SYS_VIRTUAL INNODB_TABLESPACES_ENCRYPTION INNODB_TABLESPACES_SCRUBBING INNODB_TRX @@ -91,13 +96,17 @@ GEOMETRY_COLUMNS F_TABLE_SCHEMA GLOBAL_STATUS VARIABLE_NAME GLOBAL_VARIABLES VARIABLE_NAME INDEX_STATISTICS TABLE_SCHEMA -INNODB_CHANGED_PAGES space_id +INNODB_BUFFER_PAGE POOL_ID +INNODB_BUFFER_PAGE_LRU POOL_ID +INNODB_BUFFER_POOL_STATS POOL_ID INNODB_CMP page_size INNODB_CMPMEM page_size INNODB_CMPMEM_RESET page_size INNODB_CMP_PER_INDEX database_name INNODB_CMP_RESET page_size +INNODB_LOCKS lock_id INNODB_LOCK_WAITS requesting_trx_id +INNODB_METRICS NAME INNODB_MUTEXES NAME INNODB_SYS_COLUMNS TABLE_ID INNODB_SYS_FIELDS INDEX_ID @@ -106,6 +115,7 @@ INNODB_SYS_FOREIGN_COLS ID INNODB_SYS_INDEXES INDEX_ID INNODB_SYS_TABLES TABLE_ID INNODB_SYS_TABLESTATS TABLE_ID +INNODB_SYS_VIRTUAL TABLE_ID INNODB_TABLESPACES_ENCRYPTION SPACE INNODB_TABLESPACES_SCRUBBING SPACE INNODB_TRX trx_id @@ -165,13 +175,17 @@ GEOMETRY_COLUMNS F_TABLE_SCHEMA GLOBAL_STATUS VARIABLE_NAME GLOBAL_VARIABLES VARIABLE_NAME INDEX_STATISTICS TABLE_SCHEMA -INNODB_CHANGED_PAGES space_id +INNODB_BUFFER_PAGE POOL_ID +INNODB_BUFFER_PAGE_LRU POOL_ID +INNODB_BUFFER_POOL_STATS POOL_ID INNODB_CMP page_size INNODB_CMPMEM page_size INNODB_CMPMEM_RESET page_size INNODB_CMP_PER_INDEX database_name INNODB_CMP_RESET page_size +INNODB_LOCKS lock_id INNODB_LOCK_WAITS requesting_trx_id +INNODB_METRICS NAME INNODB_MUTEXES NAME INNODB_SYS_COLUMNS TABLE_ID INNODB_SYS_FIELDS INDEX_ID @@ -180,6 +194,7 @@ INNODB_SYS_FOREIGN_COLS ID INNODB_SYS_INDEXES INDEX_ID INNODB_SYS_TABLES TABLE_ID INNODB_SYS_TABLESTATS TABLE_ID +INNODB_SYS_VIRTUAL TABLE_ID INNODB_TABLESPACES_ENCRYPTION SPACE INNODB_TABLESPACES_SCRUBBING SPACE INNODB_TRX trx_id @@ -244,13 +259,17 @@ GEOMETRY_COLUMNS information_schema.GEOMETRY_COLUMNS 1 GLOBAL_STATUS information_schema.GLOBAL_STATUS 1 GLOBAL_VARIABLES information_schema.GLOBAL_VARIABLES 1 INDEX_STATISTICS information_schema.INDEX_STATISTICS 1 -INNODB_CHANGED_PAGES information_schema.INNODB_CHANGED_PAGES 1 +INNODB_BUFFER_PAGE information_schema.INNODB_BUFFER_PAGE 1 +INNODB_BUFFER_PAGE_LRU information_schema.INNODB_BUFFER_PAGE_LRU 1 +INNODB_BUFFER_POOL_STATS information_schema.INNODB_BUFFER_POOL_STATS 1 INNODB_CMP information_schema.INNODB_CMP 1 INNODB_CMPMEM information_schema.INNODB_CMPMEM 1 INNODB_CMPMEM_RESET information_schema.INNODB_CMPMEM_RESET 1 INNODB_CMP_PER_INDEX information_schema.INNODB_CMP_PER_INDEX 1 INNODB_CMP_RESET information_schema.INNODB_CMP_RESET 1 +INNODB_LOCKS information_schema.INNODB_LOCKS 1 INNODB_LOCK_WAITS information_schema.INNODB_LOCK_WAITS 1 +INNODB_METRICS information_schema.INNODB_METRICS 1 INNODB_MUTEXES information_schema.INNODB_MUTEXES 1 INNODB_SYS_COLUMNS information_schema.INNODB_SYS_COLUMNS 1 INNODB_SYS_FIELDS information_schema.INNODB_SYS_FIELDS 1 @@ -259,6 +278,7 @@ INNODB_SYS_FOREIGN_COLS information_schema.INNODB_SYS_FOREIGN_COLS 1 INNODB_SYS_INDEXES information_schema.INNODB_SYS_INDEXES 1 INNODB_SYS_TABLES information_schema.INNODB_SYS_TABLES 1 INNODB_SYS_TABLESTATS information_schema.INNODB_SYS_TABLESTATS 1 +INNODB_SYS_VIRTUAL information_schema.INNODB_SYS_VIRTUAL 1 INNODB_TABLESPACES_ENCRYPTION information_schema.INNODB_TABLESPACES_ENCRYPTION 1 INNODB_TABLESPACES_SCRUBBING information_schema.INNODB_TABLESPACES_SCRUBBING 1 INNODB_TRX information_schema.INNODB_TRX 1 @@ -308,13 +328,17 @@ Database: information_schema | GLOBAL_STATUS | | GLOBAL_VARIABLES | | INDEX_STATISTICS | -| INNODB_CHANGED_PAGES | +| INNODB_BUFFER_PAGE | +| INNODB_BUFFER_PAGE_LRU | +| INNODB_BUFFER_POOL_STATS | | INNODB_CMP | | INNODB_CMPMEM | | INNODB_CMPMEM_RESET | | INNODB_CMP_PER_INDEX | | INNODB_CMP_RESET | +| INNODB_LOCKS | | INNODB_LOCK_WAITS | +| INNODB_METRICS | | INNODB_MUTEXES | | INNODB_SYS_COLUMNS | | INNODB_SYS_FIELDS | @@ -323,6 +347,7 @@ Database: information_schema | INNODB_SYS_INDEXES | | INNODB_SYS_TABLES | | INNODB_SYS_TABLESTATS | +| INNODB_SYS_VIRTUAL | | INNODB_TABLESPACES_ENCRYPTION | | INNODB_TABLESPACES_SCRUBBING | | INNODB_TRX | @@ -372,13 +397,17 @@ Database: INFORMATION_SCHEMA | GLOBAL_STATUS | | GLOBAL_VARIABLES | | INDEX_STATISTICS | -| INNODB_CHANGED_PAGES | +| INNODB_BUFFER_PAGE | +| INNODB_BUFFER_PAGE_LRU | +| INNODB_BUFFER_POOL_STATS | | INNODB_CMP | | INNODB_CMPMEM | | INNODB_CMPMEM_RESET | | INNODB_CMP_PER_INDEX | | INNODB_CMP_RESET | +| INNODB_LOCKS | | INNODB_LOCK_WAITS | +| INNODB_METRICS | | INNODB_MUTEXES | | INNODB_SYS_COLUMNS | | INNODB_SYS_FIELDS | @@ -387,6 +416,7 @@ Database: INFORMATION_SCHEMA | INNODB_SYS_INDEXES | | INNODB_SYS_TABLES | | INNODB_SYS_TABLESTATS | +| INNODB_SYS_VIRTUAL | | INNODB_TABLESPACES_ENCRYPTION | | INNODB_TABLESPACES_SCRUBBING | | INNODB_TRX | @@ -423,5 +453,5 @@ Wildcard: inf_rmation_schema | information_schema | SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') GROUP BY TABLE_SCHEMA; table_schema count(*) -information_schema 59 +information_schema 64 mysql 30 diff --git a/mysql-test/r/information_schema_part.result b/mysql-test/r/information_schema_part.result index b34183ebdee..e0a0f28dec6 100644 --- a/mysql-test/r/information_schema_part.result +++ b/mysql-test/r/information_schema_part.result @@ -120,9 +120,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) SUBPARTITION BY LINEAR HASH (a) -(PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM) */ +(PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM) select SUBPARTITION_METHOD FROM information_schema.partitions WHERE table_schema="test" AND table_name="t1"; SUBPARTITION_METHOD @@ -138,8 +138,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53) ENGINE = MyISAM) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53) ENGINE = MyISAM) SELECT PARTITION_DESCRIPTION FROM information_schema.partitions WHERE table_schema = "test" AND table_name = "t1"; PARTITION_DESCRIPTION diff --git a/mysql-test/r/innodb_group.result b/mysql-test/r/innodb_group.result new file mode 100644 index 00000000000..58bd75e0baf --- /dev/null +++ b/mysql-test/r/innodb_group.result @@ -0,0 +1,13 @@ +# +# Start of 10.1 tests +# +# +# MDEV-10556 Assertion `0' failed in virtual void Item_sum_field::set_result_field(Field*) +# +CREATE TABLE t1 (i INT) ENGINE=InnoDB; +SELECT DISTINCT STDDEV(1) FROM t1 GROUP BY i ORDER BY BENCHMARK(0, BIT_XOR(i)); +STDDEV(1) +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/innodb_icp.result b/mysql-test/r/innodb_icp.result index 18a6d6ecc02..abc41244c7d 100644 --- a/mysql-test/r/innodb_icp.result +++ b/mysql-test/r/innodb_icp.result @@ -722,8 +722,8 @@ b INT, c INT, d DATE NOT NULL, e VARCHAR(1), KEY (c), KEY (d), KEY k2(b), KEY k3(b), KEY k4(b) ); Warnings: -Note 1831 Duplicate index 'k3' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'k4' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `k3`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `k4`. This is deprecated and will be disallowed in a future release INSERT INTO t1 (b,c,d,e) VALUES (6,5,'2006-05-25','y'),(1,5,'2008-01-23','t'), (6,5,'2007-06-18','d'),(4,5,'1900-01-01','r'), diff --git a/mysql-test/r/innodb_mysql_lock.result b/mysql-test/r/innodb_mysql_lock.result index a7f45d355f1..110fa50d544 100644 --- a/mysql-test/r/innodb_mysql_lock.result +++ b/mysql-test/r/innodb_mysql_lock.result @@ -36,6 +36,7 @@ connection con3; set @@autocommit=1; connection default; disconnect con1; +disconnect con2; disconnect con3; # # Test for bug #37346 "innodb does not detect deadlock between update @@ -72,36 +73,6 @@ connection default; disconnect con37346; drop table t1; # -# Bug #42147 Concurrent DML and LOCK TABLE ... READ for InnoDB -# table cause warnings in errlog -# -# -# Note that this test for now relies on a global suppression of -# the warning "Found lock of type 6 that is write and read locked" -# This suppression rule can be removed once Bug#42147 is properly -# fixed. See bug page for more info. -# -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (i INT) engine= innodb; -# Get user-level lock -connection con2; -SELECT get_lock('bug42147_lock', 60); -get_lock('bug42147_lock', 60) -1 -connection default; -INSERT INTO t1 SELECT get_lock('bug42147_lock', 60); -connection con2; -LOCK TABLES t1 READ; -SELECT release_lock('bug42147_lock'); -release_lock('bug42147_lock') -1 -connection default; -connection con2; -UNLOCK TABLES; -connection default; -disconnect con2; -DROP TABLE t1; -# # Bug#53798 OPTIMIZE TABLE breaks repeatable read # DROP TABLE IF EXISTS t1; diff --git a/mysql-test/r/innodb_mysql_sync.result b/mysql-test/r/innodb_mysql_sync.result index 1cfebce6617..a8a264d6580 100644 --- a/mysql-test/r/innodb_mysql_sync.result +++ b/mysql-test/r/innodb_mysql_sync.result @@ -327,7 +327,7 @@ SET DEBUG_SYNC= 'now SIGNAL continue3'; connection default; # Reaping ALTER TABLE ... Warnings: -Note 1831 Duplicate index 'i2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `i2`. This is deprecated and will be disallowed in a future release SET DEBUG_SYNC= 'RESET'; DELETE FROM t1 WHERE a= 3; # @@ -377,7 +377,7 @@ SET DEBUG_SYNC= 'now SIGNAL continue4'; connection default; # Reaping ALTER TABLE ... Warnings: -Note 1831 Duplicate index 'i4' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `i4`. This is deprecated and will be disallowed in a future release SET DEBUG_SYNC= 'RESET'; connection default; disconnect con1; diff --git a/mysql-test/r/insert_notembedded.result b/mysql-test/r/insert_notembedded.result index d7ec70d36f8..d2733eac061 100644 --- a/mysql-test/r/insert_notembedded.result +++ b/mysql-test/r/insert_notembedded.result @@ -119,33 +119,5 @@ DROP USER user20989@localhost; disconnect root; connection default; DROP DATABASE meow; -connection: default -set low_priority_updates=1; -drop table if exists t1; -create table t1 (a int, b int, unique key t1$a (a)); -lock table t1 read; -connect update,localhost,root,,; -connection update; -connection: update -set low_priority_updates=1; -show variables like 'low_priority_updates'; -Variable_name Value -low_priority_updates ON -insert into t1 values (1, 2) ON DUPLICATE KEY UPDATE b = 2;; -connection default; -connect select,localhost,root,,; -connection: select -select * from t1; -a b -connection default; -connection: default -select * from t1; -a b -connection default; -disconnect update; -disconnect select; -unlock tables; -drop table t1; -set low_priority_updates=default; set local sql_mode=default; set global sql_mode=default; diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result index 7b476ca6415..61a78e65610 100644 --- a/mysql-test/r/join.result +++ b/mysql-test/r/join.result @@ -1137,7 +1137,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select 1 AS `1` from `test`.`t1` left join `test`.`t1` `t2` on((1 = 1)) left join (`test`.`t1` left join `test`.`t1` `t2` on((1 = 1))) on(rand()) where 1 +Note 1003 select 1 AS `1` from `test`.`t1` left join `test`.`t1` `t2` on(1 = 1) left join (`test`.`t1` left join `test`.`t1` `t2` on(1 = 1)) on(rand()) where 1 DROP VIEW v1; DROP TABLE t1; # @@ -1495,7 +1495,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select NULL AS `i1`,`v2`.`i2` AS `i2`,`v2`.`a` AS `a`,`v2`.`b` AS `b` from `test`.`v2` where ((`v2`.`i2` = NULL) and (`v2`.`a` < `v2`.`b`)) +Note 1003 select NULL AS `i1`,`v2`.`i2` AS `i2`,`v2`.`a` AS `a`,`v2`.`b` AS `b` from `test`.`v2` where `v2`.`i2` = NULL and `v2`.`a` < `v2`.`b` DROP VIEW v2; DROP TABLE t1,t2; SET optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/r/join_cache.result b/mysql-test/r/join_cache.result index c15f96fc2e5..74e64d92856 100644 --- a/mysql-test/r/join_cache.result +++ b/mysql-test/r/join_cache.result @@ -4776,7 +4776,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t4 ref idx idx 5 test.t1.a1 2 100.00 Using where 1 SIMPLE t5 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a1` AS `a1`,`test`.`t2`.`pk` AS `pk`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`c2` AS `c2`,`test`.`t2`.`d2` AS `d2`,`test`.`t3`.`pk` AS `pk`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`c3` AS `c3`,`test`.`t3`.`d3` AS `d3`,`test`.`t4`.`pk` AS `pk`,`test`.`t4`.`a4` AS `a4`,`test`.`t5`.`pk` AS `pk`,`test`.`t5`.`a5` AS `a5` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`d2` = `test`.`t1`.`pk`) and (`test`.`t3`.`a3` = `test`.`t2`.`c2`))) left join `test`.`t4` on(((`test`.`t4`.`a4` = `test`.`t1`.`a1`) and (`test`.`t1`.`a1` is not null))) left join `test`.`t5` on((`test`.`t5`.`a5` = `test`.`t3`.`a3`)) where 1 +Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a1` AS `a1`,`test`.`t2`.`pk` AS `pk`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`c2` AS `c2`,`test`.`t2`.`d2` AS `d2`,`test`.`t3`.`pk` AS `pk`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`c3` AS `c3`,`test`.`t3`.`d3` AS `d3`,`test`.`t4`.`pk` AS `pk`,`test`.`t4`.`a4` AS `a4`,`test`.`t5`.`pk` AS `pk`,`test`.`t5`.`a5` AS `a5` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`d2` = `test`.`t1`.`pk` and `test`.`t3`.`a3` = `test`.`t2`.`c2`) left join `test`.`t4` on(`test`.`t4`.`a4` = `test`.`t1`.`a1` and `test`.`t1`.`a1` is not null) left join `test`.`t5` on(`test`.`t5`.`a5` = `test`.`t3`.`a3`) where 1 SELECT * FROM ((t1 LEFT JOIN (t2 JOIN t3 ON t2.c2 = t3.a3) ON t1.pk = t2.d2) LEFT JOIN t4 ON t1.a1 = t4.a4) LEFT JOIN t5 ON t3.a3 = t5.a5; @@ -4798,7 +4798,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t4 ref idx idx 5 test.t1.a1 2 100.00 Using where 1 SIMPLE t5 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a1` AS `a1`,`test`.`t2`.`pk` AS `pk`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`c2` AS `c2`,`test`.`t2`.`d2` AS `d2`,`test`.`t3`.`pk` AS `pk`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`c3` AS `c3`,`test`.`t3`.`d3` AS `d3`,`test`.`t4`.`pk` AS `pk`,`test`.`t4`.`a4` AS `a4`,`test`.`t5`.`pk` AS `pk`,`test`.`t5`.`a5` AS `a5` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`d2` = `test`.`t1`.`pk`) and (`test`.`t3`.`a3` = `test`.`t2`.`c2`))) left join `test`.`t4` on(((`test`.`t4`.`a4` = `test`.`t1`.`a1`) and (`test`.`t1`.`a1` is not null))) left join `test`.`t5` on((`test`.`t5`.`a5` = `test`.`t3`.`a3`)) where 1 +Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a1` AS `a1`,`test`.`t2`.`pk` AS `pk`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`c2` AS `c2`,`test`.`t2`.`d2` AS `d2`,`test`.`t3`.`pk` AS `pk`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`c3` AS `c3`,`test`.`t3`.`d3` AS `d3`,`test`.`t4`.`pk` AS `pk`,`test`.`t4`.`a4` AS `a4`,`test`.`t5`.`pk` AS `pk`,`test`.`t5`.`a5` AS `a5` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`d2` = `test`.`t1`.`pk` and `test`.`t3`.`a3` = `test`.`t2`.`c2`) left join `test`.`t4` on(`test`.`t4`.`a4` = `test`.`t1`.`a1` and `test`.`t1`.`a1` is not null) left join `test`.`t5` on(`test`.`t5`.`a5` = `test`.`t3`.`a3`) where 1 SELECT * FROM ((t1 LEFT JOIN (t2 JOIN t3 ON t2.c2 = t3.a3) ON t1.pk = t2.d2) LEFT JOIN t4 ON t1.a1 = t4.a4) LEFT JOIN t5 ON t3.a3 = t5.a5; @@ -4820,7 +4820,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t4 ref idx idx 5 test.t1.a1 2 100.00 Using where 1 SIMPLE t5 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a1` AS `a1`,`test`.`t2`.`pk` AS `pk`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`c2` AS `c2`,`test`.`t2`.`d2` AS `d2`,`test`.`t3`.`pk` AS `pk`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`c3` AS `c3`,`test`.`t3`.`d3` AS `d3`,`test`.`t4`.`pk` AS `pk`,`test`.`t4`.`a4` AS `a4`,`test`.`t5`.`pk` AS `pk`,`test`.`t5`.`a5` AS `a5` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`d2` = `test`.`t1`.`pk`) and (`test`.`t3`.`a3` = `test`.`t2`.`c2`))) left join `test`.`t4` on(((`test`.`t4`.`a4` = `test`.`t1`.`a1`) and (`test`.`t1`.`a1` is not null))) left join `test`.`t5` on((`test`.`t5`.`a5` = `test`.`t3`.`a3`)) where 1 +Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a1` AS `a1`,`test`.`t2`.`pk` AS `pk`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`c2` AS `c2`,`test`.`t2`.`d2` AS `d2`,`test`.`t3`.`pk` AS `pk`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`c3` AS `c3`,`test`.`t3`.`d3` AS `d3`,`test`.`t4`.`pk` AS `pk`,`test`.`t4`.`a4` AS `a4`,`test`.`t5`.`pk` AS `pk`,`test`.`t5`.`a5` AS `a5` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`d2` = `test`.`t1`.`pk` and `test`.`t3`.`a3` = `test`.`t2`.`c2`) left join `test`.`t4` on(`test`.`t4`.`a4` = `test`.`t1`.`a1` and `test`.`t1`.`a1` is not null) left join `test`.`t5` on(`test`.`t5`.`a5` = `test`.`t3`.`a3`) where 1 SELECT * FROM ((t1 LEFT JOIN (t2 JOIN t3 ON t2.c2 = t3.a3) ON t1.pk = t2.d2) LEFT JOIN t4 ON t1.a1 = t4.a4) LEFT JOIN t5 ON t3.a3 = t5.a5; diff --git a/mysql-test/r/join_nested.result b/mysql-test/r/join_nested.result index 84b6ff640e9..28f8a1e5990 100644 --- a/mysql-test/r/join_nested.result +++ b/mysql-test/r/join_nested.result @@ -79,7 +79,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on((`test`.`t4`.`b` = `test`.`t2`.`b`)) where ((`test`.`t3`.`a` = 1) or isnull(`test`.`t3`.`c`)) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t4`.`b` = `test`.`t2`.`b`) where `test`.`t3`.`a` = 1 or `test`.`t3`.`c` is null SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b FROM t2 LEFT JOIN @@ -156,7 +156,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on((`test`.`t4`.`b` = `test`.`t2`.`b`)) where ((`test`.`t3`.`a` > 1) or isnull(`test`.`t3`.`c`)) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on(`test`.`t4`.`b` = `test`.`t2`.`b`) where `test`.`t3`.`a` > 1 or `test`.`t3`.`c` is null SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,t5.a,t5.b FROM t2 LEFT JOIN @@ -186,7 +186,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on((`test`.`t4`.`b` = `test`.`t2`.`b`)) where (((`test`.`t3`.`a` > 1) or isnull(`test`.`t3`.`c`)) and ((`test`.`t5`.`a` < 3) or isnull(`test`.`t5`.`c`))) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on(`test`.`t4`.`b` = `test`.`t2`.`b`) where (`test`.`t3`.`a` > 1 or `test`.`t3`.`c` is null) and (`test`.`t5`.`a` < 3 or `test`.`t5`.`c` is null) SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,t5.a,t5.b FROM t2 LEFT JOIN @@ -235,7 +235,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) 1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t7`.`b`) and (`test`.`t6`.`b` < 10))) where 1 +Note 1003 select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t7`.`b` and `test`.`t6`.`b` < 10) where 1 SELECT t6.a,t6.b,t7.a,t7.b,t8.a,t8.b FROM (t6, t7) LEFT JOIN @@ -556,7 +556,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b`) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b, t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b FROM t0,t1 @@ -652,7 +652,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b`) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t9`.`b` = `test`.`t8`.`b` or `test`.`t8`.`c` is null) SELECT t9.a,t9.b FROM t9; a b @@ -843,7 +843,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t1` join `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`))) where (`test`.`t1`.`a` <= 2) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t1` join `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b`) where `test`.`t1`.`a` <= 2 INSERT INTO t2 VALUES (-1,9,0), (-3,10,0), (-2,8,0), (-4,11,0), (-5,15,0); CREATE INDEX idx_b ON t2(b); EXPLAIN EXTENDED @@ -858,7 +858,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 2 100.00 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t3`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t3`.`b` is not null))) where 1 +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t3`.`b` and `test`.`t2`.`b` = `test`.`t3`.`b` and `test`.`t2`.`a` > 0 and `test`.`t3`.`b` is not null) where 1 SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b FROM (t3,t4) LEFT JOIN @@ -920,7 +920,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t3`.`b` = `test`.`t4`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t3`.`b` = `test`.`t4`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t9`.`b` = `test`.`t8`.`b` or `test`.`t8`.`c` is null) INSERT INTO t4 VALUES (-3,12,0), (-4,13,0), (-1,11,0), (-3,11,0), (-5,15,0); INSERT INTO t5 VALUES (-3,11,0), (-2,12,0), (-3,13,0), (-4,12,0); CREATE INDEX idx_b ON t4(b); @@ -972,7 +972,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0 and `test`.`t4`.`a` > 0 and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`a` > 0)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t8`.`b` = `test`.`t9`.`b` or `test`.`t8`.`c` is null) INSERT INTO t8 VALUES (-3,12,0), (-1,14,0), (-5,15,0), (-1,11,0), (-4,13,0); CREATE INDEX idx_b ON t8(b); EXPLAIN EXTENDED @@ -1022,7 +1022,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t8`.`a` >= 0) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0 and `test`.`t4`.`a` > 0 and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t8`.`a` >= 0 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`a` > 0)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t8`.`b` = `test`.`t9`.`b` or `test`.`t8`.`c` is null) INSERT INTO t1 VALUES (-1,133,0), (-2,12,0), (-3,11,0), (-5,15,0); CREATE INDEX idx_b ON t1(b); CREATE INDEX idx_a ON t0(a); @@ -1073,7 +1073,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2) and (`test`.`t1`.`a` > 0))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2 and `test`.`t1`.`a` > 0) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t8`.`b` = `test`.`t9`.`b` or `test`.`t8`.`c` is null) SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b, t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b FROM t0,t1 @@ -1843,7 +1843,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t3 ALL NULL NULL NULL NULL 1 100.00 Using where; Not exists 1 SIMPLE t4 ALL NULL NULL NULL NULL 0 0.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`b` AS `b` from `test`.`t1` left join (`test`.`t2` left join `test`.`t3` on((`test`.`t3`.`b` = `test`.`t1`.`a`)) left join `test`.`t4` on((`test`.`t4`.`b` = `test`.`t3`.`a`))) on((`test`.`t2`.`a` = `test`.`t1`.`a`)) where isnull(`test`.`t3`.`a`) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`b` AS `b` from `test`.`t1` left join (`test`.`t2` left join `test`.`t3` on(`test`.`t3`.`b` = `test`.`t1`.`a`) left join `test`.`t4` on(`test`.`t4`.`b` = `test`.`t3`.`a`)) on(`test`.`t2`.`a` = `test`.`t1`.`a`) where `test`.`t3`.`a` is null DROP TABLE t1,t2,t3,t4; SET optimizer_switch=@save_optimizer_switch; End of 5.0 tests diff --git a/mysql-test/r/join_nested_jcl6.result b/mysql-test/r/join_nested_jcl6.result index 3b47645ca79..d1f402054cf 100644 --- a/mysql-test/r/join_nested_jcl6.result +++ b/mysql-test/r/join_nested_jcl6.result @@ -90,7 +90,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) 1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) where ((`test`.`t3`.`a` = 1) or isnull(`test`.`t3`.`c`)) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) where `test`.`t3`.`a` = 1 or `test`.`t3`.`c` is null SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b FROM t2 LEFT JOIN @@ -167,7 +167,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) 1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) where ((`test`.`t3`.`a` > 1) or isnull(`test`.`t3`.`c`)) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on(`test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) where `test`.`t3`.`a` > 1 or `test`.`t3`.`c` is null SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,t5.a,t5.b FROM t2 LEFT JOIN @@ -197,7 +197,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) 1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) where (((`test`.`t3`.`a` > 1) or isnull(`test`.`t3`.`c`)) and ((`test`.`t5`.`a` < 3) or isnull(`test`.`t5`.`c`))) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on(`test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) where (`test`.`t3`.`a` > 1 or `test`.`t3`.`c` is null) and (`test`.`t5`.`a` < 3 or `test`.`t5`.`c` is null) SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,t5.a,t5.b FROM t2 LEFT JOIN @@ -246,7 +246,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) 1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t7.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) Warnings: -Note 1003 select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t7`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t7`.`b` is not null))) where 1 +Note 1003 select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t7`.`b` and `test`.`t6`.`b` < 10 and `test`.`t7`.`b` is not null) where 1 SELECT t6.a,t6.b,t7.a,t7.b,t8.a,t8.b FROM (t6, t7) LEFT JOIN @@ -567,7 +567,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) 1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b, t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b FROM t0,t1 @@ -663,7 +663,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) 1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t9`.`b` = `test`.`t8`.`b` or `test`.`t8`.`c` is null) SELECT t9.a,t9.b FROM t9; a b @@ -854,7 +854,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) 1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t1` join `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) where (`test`.`t1`.`a` <= 2) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t1` join `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) where `test`.`t1`.`a` <= 2 INSERT INTO t2 VALUES (-1,9,0), (-3,10,0), (-2,8,0), (-4,11,0), (-5,15,0); CREATE INDEX idx_b ON t2(b); EXPLAIN EXTENDED @@ -869,7 +869,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t3`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t3`.`b` is not null))) where 1 +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t3`.`b` and `test`.`t2`.`b` = `test`.`t3`.`b` and `test`.`t2`.`a` > 0 and `test`.`t3`.`b` is not null) where 1 SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b FROM (t3,t4) LEFT JOIN @@ -931,7 +931,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) 1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t3`.`b` = `test`.`t4`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0 and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t3`.`b` = `test`.`t4`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t9`.`b` = `test`.`t8`.`b` or `test`.`t8`.`c` is null) INSERT INTO t4 VALUES (-3,12,0), (-4,13,0), (-1,11,0), (-3,11,0), (-5,15,0); INSERT INTO t5 VALUES (-3,11,0), (-2,12,0), (-3,13,0), (-4,12,0); CREATE INDEX idx_b ON t4(b); @@ -983,7 +983,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) 1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0 and `test`.`t4`.`a` > 0 and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`a` > 0 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t8`.`b` = `test`.`t9`.`b` or `test`.`t8`.`c` is null) INSERT INTO t8 VALUES (-3,12,0), (-1,14,0), (-5,15,0), (-1,11,0), (-4,13,0); CREATE INDEX idx_b ON t8(b); EXPLAIN EXTENDED @@ -1033,7 +1033,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) 1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t8`.`a` >= 0) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0 and `test`.`t4`.`a` > 0 and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t8`.`a` >= 0 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`a` > 0 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t8`.`b` = `test`.`t9`.`b` or `test`.`t8`.`c` is null) INSERT INTO t1 VALUES (-1,133,0), (-2,12,0), (-3,11,0), (-5,15,0); CREATE INDEX idx_b ON t1(b); CREATE INDEX idx_a ON t0(a); @@ -1084,7 +1084,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) 1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2) and (`test`.`t1`.`a` > 0))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2 and `test`.`t1`.`a` > 0) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t8`.`b` = `test`.`t9`.`b` or `test`.`t8`.`c` is null) SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b, t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b FROM t0,t1 @@ -1854,7 +1854,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 test.t1.a 1 100.00 Using where; Not exists; Using join buffer (incremental, BNLH join) 1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t3.a 0 0.00 Using where; Using join buffer (incremental, BNLH join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`b` AS `b` from `test`.`t1` left join (`test`.`t2` left join `test`.`t3` on((`test`.`t3`.`b` = `test`.`t1`.`a`)) left join `test`.`t4` on(((`test`.`t4`.`b` = `test`.`t3`.`a`) and (`test`.`t3`.`a` is not null)))) on((`test`.`t2`.`a` = `test`.`t1`.`a`)) where isnull(`test`.`t3`.`a`) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`b` AS `b` from `test`.`t1` left join (`test`.`t2` left join `test`.`t3` on(`test`.`t3`.`b` = `test`.`t1`.`a`) left join `test`.`t4` on(`test`.`t4`.`b` = `test`.`t3`.`a` and `test`.`t3`.`a` is not null)) on(`test`.`t2`.`a` = `test`.`t1`.`a`) where `test`.`t3`.`a` is null DROP TABLE t1,t2,t3,t4; SET optimizer_switch=@save_optimizer_switch; End of 5.0 tests diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index 8b4ee17f20e..7fb3517ecb7 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -1386,7 +1386,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE jt5 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index 1 SIMPLE jt2 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt1` left join (`test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(((`test`.`jt6`.`f1` <> 0) and 1))) on(1) where 1 +Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt1` left join (`test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(`test`.`jt6`.`f1` <> 0 and 1)) on(1) where 1 EXPLAIN EXTENDED SELECT STRAIGHT_JOIN jt1.f1 FROM t1 AS jt1 RIGHT JOIN t1 AS jt2 RIGHT JOIN t1 AS jt3 @@ -1403,7 +1403,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE jt2 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index 1 SIMPLE jt1 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(((`test`.`jt6`.`f1` <> 0) and 1)) left join `test`.`t1` `jt1` on(1) where 1 +Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(`test`.`jt6`.`f1` <> 0 and 1) left join `test`.`t1` `jt1` on(1) where 1 DROP TABLE t1; # # Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field @@ -1746,7 +1746,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t4 eq_ref PRIMARY PRIMARY 4 test.t3.pk 1 100.00 Using where; Using index Warnings: Note 1276 Field or reference 'test.t2.pk' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`pk` AS `pk`,<`test`.`t2`.`pk`>((select (`test`.`t3`.`pk` + if(isnull(`test`.`t4`.`pk`),0,`test`.`t4`.`pk`)) from `test`.`t3` left join `test`.`t4` on((`test`.`t4`.`pk` = `test`.`t3`.`pk`)) where (`test`.`t3`.`pk` = (`test`.`t2`.`pk` + 1000)) limit 1)) AS `t` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`pk` = (`test`.`t1`.`pk` + 1000)) and (`test`.`t1`.`pk` > 1000)) group by `test`.`t2`.`pk` +Note 1003 select `test`.`t2`.`pk` AS `pk`,<`test`.`t2`.`pk`>((select `test`.`t3`.`pk` + if(`test`.`t4`.`pk` is null,0,`test`.`t4`.`pk`) from `test`.`t3` left join `test`.`t4` on(`test`.`t4`.`pk` = `test`.`t3`.`pk`) where `test`.`t3`.`pk` = `test`.`t2`.`pk` + 1000 limit 1)) AS `t` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`pk` = `test`.`t1`.`pk` + 1000 and `test`.`t1`.`pk` > 1000 group by `test`.`t2`.`pk` select t2.pk, (select t3.pk+if(isnull(t4.pk),0,t4.pk) from t3 left join t4 on t4.pk=t3.pk @@ -2008,7 +2008,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t3 hash_ALL PRIMARY #hash#PRIMARY 4 test.t1.b 10 10.00 Using join buffer (flat, BNLH join) 1 SIMPLE t2 hash_index PRIMARY #hash#PRIMARY:PRIMARY 4:4 test.t1.b 27 3.70 Using join buffer (incremental, BNLH join) Warnings: -Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t1`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t2` join `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`b` = `test`.`t1`.`b`)) +Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t1`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t2` join `test`.`t1` join `test`.`t3` where `test`.`t3`.`b` = `test`.`t1`.`b` and `test`.`t2`.`b` = `test`.`t1`.`b` PREPARE stmt FROM 'SELECT * FROM (t2 LEFT JOIN t1 ON t1.b = t2.b) JOIN t3 ON t1.b = t3.b'; EXECUTE stmt; @@ -2077,7 +2077,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ref idx idx 4 const 2 100.00 Using where 1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 Warnings: -Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = 5)) order by `test`.`t1`.`b` +Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`b` = 5 order by `test`.`t1`.`b` SELECT t1.b, t2.c, t2.d FROM t2 JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; @@ -2094,7 +2094,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where 1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 Warnings: -Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = 5)) order by `test`.`t1`.`b` +Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`b` = 5 order by `test`.`t1`.`b` SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; @@ -2221,7 +2221,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`d3` AS `d3` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`i2` = `test`.`t1`.`i1`) and (`test`.`t3`.`i3` = `test`.`t1`.`i1`))) where ((`test`.`t3`.`d3` = 0) or isnull(`test`.`t3`.`d3`)) +Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`d3` AS `d3` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`i2` = `test`.`t1`.`i1` and `test`.`t3`.`i3` = `test`.`t1`.`i1`) where `test`.`t3`.`d3` = 0 or `test`.`t3`.`d3` is null DROP TABLE t1,t2,t3; # # Bug mdev-6705: wrong on expression after constant row substitution @@ -2241,7 +2241,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select 10 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t2` left join `test`.`t3` on((`test`.`t3`.`d` = 10)) where ((`test`.`t2`.`c` = 8) and (`test`.`t3`.`d` = 8)) +Note 1003 select 10 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`d` = 10) where `test`.`t2`.`c` = 8 and `test`.`t3`.`d` = 8 SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a WHERE b IN (1,2,3) OR b = d; a b c d @@ -2317,7 +2317,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 Warnings: -Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`v3` = 4) and (`test`.`t1`.`i1` = `test`.`t3`.`i3`) and (`test`.`t2`.`i2` = `test`.`t3`.`i3`)) +Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`v3` = 4 and `test`.`t1`.`i1` = `test`.`t3`.`i3` and `test`.`t2`.`i2` = `test`.`t3`.`i3` # This should have the same join order like the query above: EXPLAIN EXTENDED SELECT * FROM @@ -2335,6 +2335,6 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 Warnings: -Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`v3` = 4) and (`test`.`t1`.`i1` = `test`.`t3`.`i3`) and (`test`.`t2`.`i2` = `test`.`t3`.`i3`)) +Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`v3` = 4 and `test`.`t1`.`i1` = `test`.`t3`.`i3` and `test`.`t2`.`i2` = `test`.`t3`.`i3` drop table t1,t2,t3; SET optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/r/join_outer_jcl6.result b/mysql-test/r/join_outer_jcl6.result index 9cdcea379b9..ef749768d4c 100644 --- a/mysql-test/r/join_outer_jcl6.result +++ b/mysql-test/r/join_outer_jcl6.result @@ -1397,7 +1397,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE jt5 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join) 1 SIMPLE jt2 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join) Warnings: -Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt1` left join (`test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(((`test`.`jt6`.`f1` <> 0) and 1))) on(1) where 1 +Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt1` left join (`test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(`test`.`jt6`.`f1` <> 0 and 1)) on(1) where 1 EXPLAIN EXTENDED SELECT STRAIGHT_JOIN jt1.f1 FROM t1 AS jt1 RIGHT JOIN t1 AS jt2 RIGHT JOIN t1 AS jt3 @@ -1414,7 +1414,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE jt2 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join) 1 SIMPLE jt1 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join) Warnings: -Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(((`test`.`jt6`.`f1` <> 0) and 1)) left join `test`.`t1` `jt1` on(1) where 1 +Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(`test`.`jt6`.`f1` <> 0 and 1) left join `test`.`t1` `jt1` on(1) where 1 DROP TABLE t1; # # Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field @@ -1757,7 +1757,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t4 eq_ref PRIMARY PRIMARY 4 test.t3.pk 1 100.00 Using where; Using index Warnings: Note 1276 Field or reference 'test.t2.pk' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`pk` AS `pk`,<`test`.`t2`.`pk`>((select (`test`.`t3`.`pk` + if(isnull(`test`.`t4`.`pk`),0,`test`.`t4`.`pk`)) from `test`.`t3` left join `test`.`t4` on((`test`.`t4`.`pk` = `test`.`t3`.`pk`)) where (`test`.`t3`.`pk` = (`test`.`t2`.`pk` + 1000)) limit 1)) AS `t` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`pk` = (`test`.`t1`.`pk` + 1000)) and (`test`.`t1`.`pk` > 1000)) group by `test`.`t2`.`pk` +Note 1003 select `test`.`t2`.`pk` AS `pk`,<`test`.`t2`.`pk`>((select `test`.`t3`.`pk` + if(`test`.`t4`.`pk` is null,0,`test`.`t4`.`pk`) from `test`.`t3` left join `test`.`t4` on(`test`.`t4`.`pk` = `test`.`t3`.`pk`) where `test`.`t3`.`pk` = `test`.`t2`.`pk` + 1000 limit 1)) AS `t` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`pk` = `test`.`t1`.`pk` + 1000 and `test`.`t1`.`pk` > 1000 group by `test`.`t2`.`pk` select t2.pk, (select t3.pk+if(isnull(t4.pk),0,t4.pk) from t3 left join t4 on t4.pk=t3.pk @@ -2019,7 +2019,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t3 hash_ALL PRIMARY #hash#PRIMARY 4 test.t1.b 10 10.00 Using join buffer (flat, BNLH join) 1 SIMPLE t2 hash_index PRIMARY #hash#PRIMARY:PRIMARY 4:4 test.t1.b 27 3.70 Using join buffer (incremental, BNLH join) Warnings: -Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t1`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t2` join `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`b` = `test`.`t1`.`b`)) +Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t1`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t2` join `test`.`t1` join `test`.`t3` where `test`.`t3`.`b` = `test`.`t1`.`b` and `test`.`t2`.`b` = `test`.`t1`.`b` PREPARE stmt FROM 'SELECT * FROM (t2 LEFT JOIN t1 ON t1.b = t2.b) JOIN t3 ON t1.b = t3.b'; EXECUTE stmt; @@ -2088,7 +2088,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ref idx idx 4 const 2 100.00 Using where 1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 Warnings: -Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = 5)) order by `test`.`t1`.`b` +Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`b` = 5 order by `test`.`t1`.`b` SELECT t1.b, t2.c, t2.d FROM t2 JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; @@ -2105,7 +2105,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where 1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 Warnings: -Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = 5)) order by `test`.`t1`.`b` +Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`b` = 5 order by `test`.`t1`.`b` SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; @@ -2232,7 +2232,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: -Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`d3` AS `d3` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`i2` = `test`.`t1`.`i1`) and (`test`.`t3`.`i3` = `test`.`t1`.`i1`))) where ((`test`.`t3`.`d3` = 0) or isnull(`test`.`t3`.`d3`)) +Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`d3` AS `d3` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`i2` = `test`.`t1`.`i1` and `test`.`t3`.`i3` = `test`.`t1`.`i1`) where `test`.`t3`.`d3` = 0 or `test`.`t3`.`d3` is null DROP TABLE t1,t2,t3; # # Bug mdev-6705: wrong on expression after constant row substitution @@ -2252,7 +2252,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select 10 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t2` left join `test`.`t3` on((`test`.`t3`.`d` = 10)) where ((`test`.`t2`.`c` = 8) and (`test`.`t3`.`d` = 8)) +Note 1003 select 10 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`d` = 10) where `test`.`t2`.`c` = 8 and `test`.`t3`.`d` = 8 SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a WHERE b IN (1,2,3) OR b = d; a b c d @@ -2328,7 +2328,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 Warnings: -Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`v3` = 4) and (`test`.`t1`.`i1` = `test`.`t3`.`i3`) and (`test`.`t2`.`i2` = `test`.`t3`.`i3`)) +Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`v3` = 4 and `test`.`t1`.`i1` = `test`.`t3`.`i3` and `test`.`t2`.`i2` = `test`.`t3`.`i3` # This should have the same join order like the query above: EXPLAIN EXTENDED SELECT * FROM @@ -2346,7 +2346,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 Warnings: -Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`v3` = 4) and (`test`.`t1`.`i1` = `test`.`t3`.`i3`) and (`test`.`t2`.`i2` = `test`.`t3`.`i3`)) +Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`v3` = 4 and `test`.`t1`.`i1` = `test`.`t3`.`i3` and `test`.`t2`.`i2` = `test`.`t3`.`i3` drop table t1,t2,t3; SET optimizer_switch=@save_optimizer_switch; set join_cache_level=default; diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result index cda028536cf..913e39ee140 100644 --- a/mysql-test/r/key.result +++ b/mysql-test/r/key.result @@ -428,14 +428,14 @@ index i5 (c1, c2, c3, c4), primary key (c2, c3), index (c2, c4)); Warnings: -Note 1831 Duplicate index 'i1' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `i1`. This is deprecated and will be disallowed in a future release show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(12) NOT NULL, `c3` varchar(123) NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`c2`,`c3`), UNIQUE KEY `i4` (`c4`), KEY `c1` (`c1`), @@ -448,17 +448,17 @@ t1 CREATE TABLE `t1` ( alter table t1 drop index c1; alter table t1 add index (c1); Warnings: -Note 1831 Duplicate index 'c1' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `c1`. This is deprecated and will be disallowed in a future release alter table t1 add index (c1); Warnings: -Note 1831 Duplicate index 'c1_2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `c1_2`. This is deprecated and will be disallowed in a future release alter table t1 drop index i3; alter table t1 add index i3 (c3); alter table t1 drop index i2, drop index i4; alter table t1 add index i2 (c2), add index i4 (c4); alter table t1 drop index i2, drop index i4, add index i6 (c2, c4); Warnings: -Note 1831 Duplicate index 'i6' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `i6`. This is deprecated and will be disallowed in a future release alter table t1 add index i2 (c2), add index i4 (c4), drop index i6; alter table t1 drop index i2, drop index i4, add unique i4 (c4); alter table t1 add index i2 (c2), drop index i4, add index i4 (c4); @@ -474,7 +474,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(12) NOT NULL, `c3` varchar(123) NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), KEY `i1` (`c1`), KEY `i5` (`c1`,`c2`,`c3`,`c4`), KEY `c1` (`c1`), diff --git a/mysql-test/r/keywords.result b/mysql-test/r/keywords.result index a3588017e97..f5bf600dc40 100644 --- a/mysql-test/r/keywords.result +++ b/mysql-test/r/keywords.result @@ -275,3 +275,8 @@ set option=1; ERROR HY000: Unknown system variable 'option' set option option=1; ERROR HY000: Unknown system variable 'option' +# +# MDEV-10585 EXECUTE IMMEDIATE statement +# +CREATE TABLE immediate (immediate int); +DROP TABLE immediate; diff --git a/mysql-test/r/lock_sync.result b/mysql-test/r/lock_sync.result index f075262c3db..7b61c5994b6 100644 --- a/mysql-test/r/lock_sync.result +++ b/mysql-test/r/lock_sync.result @@ -338,6 +338,7 @@ Success: 'load data infile '../../std_data/rpl_loaddata.dat' into table t2 (@a, # 2.8 REPLACE with a subquery. # # Same is true for this statement as well. +# Suppress warnings for REPLACE ... SELECT connection default; Success: 'replace into t2 select i+5 from t1' doesn't allow concurrent inserts into 't1'. connection default; @@ -704,87 +705,6 @@ disconnect con1; disconnect con2; set @@global.concurrent_insert= @old_concurrent_insert; # -# Test for bug #45143 "All connections hang on concurrent ALTER TABLE". -# -# Concurrent execution of statements which required weak write lock -# (TL_WRITE_ALLOW_WRITE) on several instances of the same table and -# statements which tried to acquire stronger write lock (TL_WRITE, -# TL_WRITE_ALLOW_READ) on this table might have led to deadlock. -drop table if exists t1; -drop view if exists v1; -# Create auxiliary connections used through the test. -connect con_bug45143_1,localhost,root,,test,,; -connect con_bug45143_3,localhost,root,,test,,; -connect con_bug45143_2,localhost,root,,test,,; -connection default; -# Reset DEBUG_SYNC facility before using it. -set debug_sync= 'RESET'; -# Turn off logging so calls to locking subsystem performed -# for general_log table won't interfere with our test. -set @old_general_log = @@global.general_log; -set @@global.general_log= OFF; -create table t1 (i int) engine=InnoDB; -# We have to use view in order to make LOCK TABLES avoid -# acquiring SNRW metadata lock on table. -create view v1 as select * from t1; -insert into t1 values (1); -# Prepare user lock which will be used for resuming execution of -# the first statement after it acquires TL_WRITE_ALLOW_WRITE lock. -select get_lock("lock_bug45143_wait", 0); -get_lock("lock_bug45143_wait", 0) -1 -connection con_bug45143_1; -# Sending: -insert into t1 values (get_lock("lock_bug45143_wait", 100));; -connection con_bug45143_2; -# Wait until the above INSERT takes TL_WRITE_ALLOW_WRITE lock on 't1' -# and then gets blocked on user lock 'lock_bug45143_wait'. -# Ensure that upcoming SELECT waits after acquiring TL_WRITE_ALLOW_WRITE -# lock for the first instance of 't1'. -set debug_sync='thr_multi_lock_after_thr_lock SIGNAL parked WAIT_FOR go'; -# Sending: -select count(*) > 0 from t1 as a, t1 as b for update;; -connection con_bug45143_3; -# Wait until the above SELECT ... FOR UPDATE is blocked after -# acquiring lock for the the first instance of 't1'. -set debug_sync= 'now WAIT_FOR parked'; -# Send LOCK TABLE statement which will try to get TL_WRITE lock on 't1': -lock table v1 write;; -connection default; -# Wait until this LOCK TABLES statement starts waiting for table lock. -# Allow SELECT ... FOR UPDATE to resume. -# Since it already has TL_WRITE_ALLOW_WRITE lock on the first instance -# of 't1' it should be able to get lock on the second instance without -# waiting, even although there is another thread which has such lock -# on this table and also there is a thread waiting for a TL_WRITE on it. -set debug_sync= 'now SIGNAL go'; -connection con_bug45143_2; -# Reap SELECT ... FOR UPDATE -count(*) > 0 -1 -connection default; -# Resume execution of the INSERT statement. -select release_lock("lock_bug45143_wait"); -release_lock("lock_bug45143_wait") -1 -connection con_bug45143_1; -# Reap INSERT statement. -# In Statement and Mixed replication mode we get here "Unsafe -# for binlog" warnings. In row mode there are no warnings. -# Hide the discrepancy. -connection con_bug45143_3; -# Reap LOCK TABLES statement. -unlock tables; -connection default; -# Do clean-up. -disconnect con_bug45143_1; -disconnect con_bug45143_2; -disconnect con_bug45143_3; -set debug_sync= 'RESET'; -set @@global.general_log= @old_general_log; -drop view v1; -drop table t1; -# # Bug#50821 Deadlock between LOCK TABLES and ALTER TABLE # DROP TABLE IF EXISTS t1, t2; @@ -827,44 +747,6 @@ connection default; DROP EVENT e2; SET DEBUG_SYNC="RESET"; # -# Bug#55930 Assertion `thd->transaction.stmt.is_empty() || -# thd->in_sub_stmt || (thd->state.. -# -DROP TABLE IF EXISTS t1; -CREATE TABLE t1(a INT) engine=InnoDB; -INSERT INTO t1 VALUES (1), (2); -connect con1, localhost, root; -connect con2, localhost, root; -connection con1; -SET SESSION lock_wait_timeout= 1; -SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL opti_recreate WAIT_FOR opti_analyze'; -# Sending: -OPTIMIZE TABLE t1; -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR opti_recreate'; -SET DEBUG_SYNC= 'after_lock_tables_takes_lock SIGNAL thrlock WAIT_FOR release_thrlock'; -# Sending: -INSERT INTO t1 VALUES (3); -connection default; -SET DEBUG_SYNC= 'now WAIT_FOR thrlock'; -SET DEBUG_SYNC= 'now SIGNAL opti_analyze'; -connection con1; -# Reaping: OPTIMIZE TABLE t1 -Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead -test.t1 optimize error Lock wait timeout exceeded; try restarting transaction -test.t1 optimize status Operation failed -Warnings: -Error 1205 Lock wait timeout exceeded; try restarting transaction -SET DEBUG_SYNC= 'now SIGNAL release_thrlock'; -disconnect con1; -connection con2; -# Reaping: INSERT INTO t1 VALUES (3) -disconnect con2; -connection default; -DROP TABLE t1; -SET DEBUG_SYNC= 'RESET'; -# # Bug#57130 crash in Item_field::print during SHOW CREATE TABLE or VIEW # DROP TABLE IF EXISTS t1; @@ -891,7 +773,7 @@ SET DEBUG_SYNC= 'now SIGNAL dropped'; connection con1; # Reaping: SHOW CREATE VIEW v1 View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`f1`() = 1) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where `f1`() = 1 latin1 latin1_swedish_ci Warnings: Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them connection con2; @@ -902,3 +784,74 @@ DROP VIEW v1; DROP TABLE t1; disconnect con1; disconnect con2; +# +# Bug#28587 SELECT is blocked by INSERT waiting on read lock, even with low_priority_updates +# +set low_priority_updates=1; +drop table if exists t1; +drop table if exists t2; +set debug_sync='RESET'; +create table t1 (a int, b int, unique key t1$a (a)); +create table t2 (j int, k int); +set debug_sync='after_lock_tables_takes_lock SIGNAL parked WAIT_FOR go'; +# Sending: +insert into t2 select * from t1;; +connect update,localhost,root,,; +connection update; +set debug_sync='now WAIT_FOR parked'; +set low_priority_updates=1; +show variables like 'low_priority_updates'; +Variable_name Value +low_priority_updates ON +insert into t1 values (1, 2) ON DUPLICATE KEY UPDATE b = 2;; +connect select,localhost,root,,; +select * from t1; +a b +set debug_sync='now SIGNAL go'; +connection default; +disconnect update; +disconnect select; +# Reaping INSERT SELECT +drop tables t1, t2; +set low_priority_updates=default; +set debug_sync='RESET'; +# +# Additional test coverage for LOCK TABLES ... READ LOCAL +# for InnoDB tables. +# +# Check that we correctly handle deadlocks which can occur +# during metadata lock upgrade which happens when one tries +# to use LOCK TABLES ... READ LOCAL for InnoDB tables. +CREATE TABLE t1 (i INT) ENGINE=InnoDB; +CREATE TABLE t2 (j INT) ENGINE=InnoDB; +# Execute LOCK TABLE READ LOCK which will pause after acquiring +# SR metadata lock and before upgrading it to SRO lock. +SET DEBUG_SYNC="after_open_table_mdl_shared SIGNAL locked WAIT_FOR go"; +# Sending: +LOCK TABLE t1 READ LOCAL; +connect con1, localhost, root; +SET DEBUG_SYNC="now WAIT_FOR locked"; +# Execute RENAME TABLE which will try to acquire X lock. +# Sending: +RENAME TABLE t1 TO t3, t2 TO t1, t3 TO t2; +connect con2, localhost, root; +# Wait until RENAME TABLE is blocked. +# Resume LOCK TABLE statement. It should try to +# upgrade SR lock to SRO lock which will create +# deadlock due to presence of pending X lock. +# Deadlock should be detected and LOCK TABLES should +# release its MDL and retry opening of tables. +SET DEBUG_SYNC="now SIGNAL go"; +connection con1; +# RENAME TABLE should be able to complete. Reap it. +connection default; +# Reap LOCK TABLES. +# Check that we see new version of table. +SELECT * FROM t1; +j +UNLOCK TABLES; +# Clean-up. +SET DEBUG_SYNC="RESET"; +disconnect con1; +disconnect con2; +DROP TABLES t1, t2; diff --git a/mysql-test/r/log_slow.result b/mysql-test/r/log_slow.result index 6a3f48506e3..383ad10ba66 100644 --- a/mysql-test/r/log_slow.result +++ b/mysql-test/r/log_slow.result @@ -46,7 +46,7 @@ select @@log_slow_verbosity; innodb show fields from mysql.slow_log; Field Type Null Key Default Extra -start_time timestamp(6) NO CURRENT_TIMESTAMP(6) on update CURRENT_TIMESTAMP +start_time timestamp(6) NO current_timestamp(6) on update current_timestamp(6) user_host mediumtext NO NULL query_time time(6) NO NULL lock_time time(6) NO NULL diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result index db2727c8234..2ec12bfe1c4 100644 --- a/mysql-test/r/log_tables.result +++ b/mysql-test/r/log_tables.result @@ -54,7 +54,7 @@ ERROR HY000: You can't use locks with log tables show create table mysql.general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -63,7 +63,7 @@ general_log CREATE TABLE `general_log` ( ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log' show fields from mysql.general_log; Field Type Null Key Default Extra -event_time timestamp(6) NO CURRENT_TIMESTAMP(6) on update CURRENT_TIMESTAMP +event_time timestamp(6) NO current_timestamp(6) on update current_timestamp(6) user_host mediumtext NO NULL thread_id bigint(21) unsigned NO NULL server_id int(10) unsigned NO NULL @@ -72,7 +72,7 @@ argument mediumtext NO NULL show create table mysql.slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `query_time` time(6) NOT NULL, `lock_time` time(6) NOT NULL, @@ -88,7 +88,7 @@ slow_log CREATE TABLE `slow_log` ( ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' show fields from mysql.slow_log; Field Type Null Key Default Extra -start_time timestamp(6) NO CURRENT_TIMESTAMP(6) on update CURRENT_TIMESTAMP +start_time timestamp(6) NO current_timestamp(6) on update current_timestamp(6) user_host mediumtext NO NULL query_time time(6) NO NULL lock_time time(6) NO NULL @@ -169,7 +169,7 @@ set global slow_query_log='OFF'; show create table mysql.general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -179,7 +179,7 @@ general_log CREATE TABLE `general_log` ( show create table mysql.slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `query_time` time(6) NOT NULL, `lock_time` time(6) NOT NULL, @@ -198,7 +198,7 @@ alter table mysql.slow_log engine=myisam; show create table mysql.general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -208,7 +208,7 @@ general_log CREATE TABLE `general_log` ( show create table mysql.slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `query_time` time(6) NOT NULL, `lock_time` time(6) NOT NULL, diff --git a/mysql-test/r/lowercase_table2.result b/mysql-test/r/lowercase_table2.result index a168e3d03ad..9194638a4d2 100644 --- a/mysql-test/r/lowercase_table2.result +++ b/mysql-test/r/lowercase_table2.result @@ -138,7 +138,7 @@ Tables_in_test (T1%) T1 alter table t1 add index (A); Warnings: -Note 1831 Duplicate index 'A_2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `A_2`. This is deprecated and will be disallowed in a future release show tables like 't1%'; Tables_in_test (t1%) t1 diff --git a/mysql-test/r/lowercase_view.result b/mysql-test/r/lowercase_view.result index 6bec4f34349..df303807407 100644 --- a/mysql-test/r/lowercase_view.result +++ b/mysql-test/r/lowercase_view.result @@ -142,7 +142,7 @@ CREATE OR REPLACE VIEW v1 AS select X.a from t1 AS X group by X.b having (X.a = 1); SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `x`.`a` AS `a` from `t1` `x` group by `x`.`b` having (`x`.`a` = 1) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `x`.`a` AS `a` from `t1` `x` group by `x`.`b` having `x`.`a` = 1 latin1 latin1_swedish_ci SELECT * FROM v1; a DROP VIEW v1; diff --git a/mysql-test/r/mdl_sync.result b/mysql-test/r/mdl_sync.result index 865e874f63e..1e285650c77 100644 --- a/mysql-test/r/mdl_sync.result +++ b/mysql-test/r/mdl_sync.result @@ -76,10 +76,6 @@ ERROR 42000: Key column 'not_exist' doesn't exist in table # lock. alter table t1 add primary key (c1); ERROR 23000: Duplicate entry '1' for key 'PRIMARY' -# Check that SNRW lock is compatible with S lock. -lock table t1 write; -insert into t1 values (1); -unlock tables; # Check that X lock is incompatible with S lock. # Sending: rename table t1 to t2;; @@ -117,29 +113,6 @@ connection mdl_con1; alter table t1 drop column c2; # connection default; -handler t1 open; -# -connection mdl_con1; -# Check that upgrade from SNRW to X is blocked by presence of S lock. -lock table t1 write; -# Sending: -alter table t1 add column c2 int;; -# -connection mdl_con2; -# Check that the above upgrade of SNRW to X in ALTER TABLE is blocked -# because of S lock. -# -connection default; -# Unblock ALTER TABLE. -handler t1 close; -# -connection mdl_con1; -# Reaping ALTER TABLE. -# Restore the original state of the things. -alter table t1 drop column c2; -unlock tables; -# -connection default; # # 2) Acquire SH (shared high-priority) lock on the table. # We have to involve DEBUG_SYNC facility for this as usually @@ -160,7 +133,7 @@ column_name c1 select count(*) from t1; count(*) -3 +2 insert into t1 values (1); # Check that SU lock is compatible with it. To do this use ALTER TABLE # which will fail when constructing .frm and thus obtaining SU metadata @@ -258,7 +231,7 @@ connection default; begin; select count(*) from t1; count(*) -3 +2 # connection mdl_con1; # Check that S, SH, SR and SW locks are compatible with it. @@ -270,7 +243,7 @@ column_name c1 select count(*) from t1; count(*) -3 +2 insert into t1 values (1); # Check that SU lock is compatible with it. To do this use ALTER TABLE # which will fail when constructing .frm and thus obtaining SU metadata @@ -300,7 +273,7 @@ connection default; begin; select count(*) from t1; count(*) -3 +2 # connection mdl_con1; # Check that X lock is incompatible with SR lock. @@ -323,7 +296,7 @@ connection default; begin; select count(*) from t1; count(*) -3 +2 # connection mdl_con1; # Check that upgrade from SNW to X is blocked by presence of SR lock. @@ -453,7 +426,7 @@ column_name c1 select count(*) from t1; count(*) -5 +4 delete from t1 limit 1; # Check that SU lock is incompatible with SU lock. # Sending: @@ -549,7 +522,7 @@ column_name c1 select count(*) from t1; count(*) -5 +4 # Check that SW lock is incompatible with SNW lock. # Sending: delete from t1 limit 2;; @@ -658,8 +631,6 @@ lock table t1 write; # connection mdl_con1; # Check that S and SH locks are compatible with it. -handler t1 open; -handler t1 close; select column_name from information_schema.columns where table_schema='test' and table_name='t1'; column_name @@ -676,7 +647,7 @@ unlock tables; connection mdl_con1; # Reaping SELECT. count(*) -4 +3 # connection default; lock table t1 write; @@ -847,7 +818,7 @@ ERROR 42S01: Table 't2' already exists connection mdl_con1; # Reaping SELECT. count(*) -4 +3 # connection mdl_con2; # Prepare for blocking RENAME TABLE. @@ -996,7 +967,7 @@ column_name c1 select count(*) from t1; count(*) -4 +3 # Check that SW is incompatible with pending SNW # Sending: delete from t1 limit 1;; @@ -1025,7 +996,7 @@ connection mdl_con2; begin; select count(*) from t1; count(*) -3 +2 # connection default; # Add pending SNRW lock. @@ -1035,8 +1006,6 @@ lock table t1 write;; connection mdl_con1; # Check that LOCK TABLE is waiting with pending SNRW lock. # Check that S and SH locks are compatible with pending SNRW -handler t1 open t; -handler t close; select column_name from information_schema.columns where table_schema='test' and table_name='t1'; column_name @@ -1057,14 +1026,14 @@ unlock tables; connection mdl_con1; # Reaping SELECT. count(*) -3 +2 # Restore pending SNRW lock. # connection mdl_con2; begin; select count(*) from t1; count(*) -3 +2 # connection default; # Sending: @@ -1093,7 +1062,7 @@ connection mdl_con2; begin; select count(*) from t1; count(*) -4 +3 # connection default; # Sending: @@ -1126,7 +1095,7 @@ connection mdl_con2; begin; select count(*) from t1; count(*) -4 +3 # connection default; # Add pending X lock. @@ -1162,7 +1131,7 @@ connection mdl_con2; begin; select count(*) from t1; count(*) -4 +3 # connection default; # Add pending X lock. @@ -1187,14 +1156,14 @@ ERROR 42S01: Table 't2' already exists connection mdl_con1; # Reaping SELECT. count(*) -4 +3 # Restore pending X lock. # connection mdl_con2; begin; select count(*) from t1; count(*) -4 +3 # connection default; # Add pending X lock. @@ -1224,7 +1193,7 @@ connection mdl_con2; begin; select count(*) from t1; count(*) -3 +2 # connection default; # Add pending X lock. @@ -1299,7 +1268,7 @@ connection default; begin; select count(*) from t1; count(*) -3 +2 # connection mdl_con1; # Create an active SNW lock on t2. @@ -1321,7 +1290,7 @@ commit; begin; select count(*) from t1; count(*) -3 +2 # Sending: insert into t2 values (1);; # @@ -1347,7 +1316,7 @@ commit; begin; select count(*) from t1; count(*) -3 +2 # connection mdl_con1; # Create an active SNW lock on t1. @@ -1360,7 +1329,7 @@ set debug_sync= 'now WAIT_FOR locked'; # We should still be able to get SR lock without waiting. select count(*) from t1; count(*) -3 +2 # Since the above ALTER TABLE is not upgrading SNW lock to X by waiting # for SW lock we won't create deadlock. # So the below INSERT should not end-up with ER_LOCK_DEADLOCK error. @@ -1397,7 +1366,7 @@ connection default; # We should still be able to get both SW and SR locks without waiting. select count(*) from t1; count(*) -5 +4 delete from t1 limit 1; # Unblock ALTER TABLE. commit; @@ -1416,7 +1385,7 @@ connection default; begin; select count(*) from t1; count(*) -4 +3 # connection mdl_con2; # Start transaction which will prevent SNW -> X upgrade from @@ -1454,7 +1423,7 @@ commit; begin; select count(*) from t1; count(*) -4 +3 # connection mdl_con2; # Start transaction which will prevent SNW -> X upgrade from @@ -1493,7 +1462,7 @@ commit; begin; select count(*) from t1; count(*) -4 +3 # connection mdl_con1; # Create SNW lock pending upgrade to X. @@ -1505,7 +1474,7 @@ connection default; # Check that transaction is still able to acquire SR lock. select count(*) from t1; count(*) -4 +3 # Waiting trying to acquire SW lock will cause deadlock and # therefore should cause an error. delete from t1 limit 1; @@ -1526,7 +1495,7 @@ connection default; begin; select count(*) from t1; count(*) -4 +3 # connection mdl_con1; lock table t2 write; @@ -1551,7 +1520,7 @@ commit; begin; select count(*) from t1; count(*) -4 +3 # connection mdl_con1; lock table t2 write; @@ -1580,7 +1549,7 @@ commit; begin; select count(*) from t1; count(*) -4 +3 # connection mdl_con1; # Sending: @@ -1591,7 +1560,7 @@ connection default; # Check that another instance of SR lock is granted without waiting. select count(*) from t1; count(*) -4 +3 # Attempt to wait for SW lock will lead to deadlock, thus # the below statement should end with ER_LOCK_DEADLOCK error. delete from t1 limit 1; @@ -1620,7 +1589,7 @@ connection default; # and errors. select count(*) from t1; count(*) -3 +2 insert into t1 values (1, 1); # Unblock LOCK TABLES. commit; @@ -1639,7 +1608,7 @@ connection default; begin; select count(*) from t1; count(*) -4 +3 # connection mdl_con2; # Start transaction which will prevent X lock from going away @@ -1677,7 +1646,7 @@ rename table t3 to t2; begin; select count(*) from t1; count(*) -4 +3 # connection mdl_con2; # Start transaction which will prevent X lock from going away @@ -1721,7 +1690,7 @@ rename table t3 to t2; begin; select count(*) from t1; count(*) -4 +3 # connection mdl_con1; # Sending: @@ -1732,7 +1701,7 @@ connection default; # Check that another instance of SR lock is granted without waiting. select count(*) from t1; count(*) -4 +3 # Attempt to wait for SW lock will lead to deadlock, thus # the below statement should end with ER_LOCK_DEADLOCK error. delete from t1 limit 1; @@ -1761,7 +1730,7 @@ connection default; # and errors. select count(*) from t1; count(*) -3 +2 insert into t1 values (1, 1); # Unblock RENAME TABLE. commit; @@ -1778,149 +1747,6 @@ disconnect mdl_con3; set debug_sync= 'RESET'; drop table t1, t2; # -# Additional coverage for some scenarios in which not quite -# correct use of S metadata locks by HANDLER statement might -# have caused deadlocks. -# -drop table if exists t1, t2; -connect handler_con1,localhost,root,,; -connect handler_con2,localhost,root,,; -connection default; -create table t1 (i int); -create table t2 (j int); -insert into t1 values (1); -# -# First, check scenario in which we upgrade SNRW lock to X lock -# on a table while having HANDLER READ trying to acquire TL_READ -# on the same table. -# -handler t1 open; -# -connection handler_con1; -lock table t1 write; -# Upgrade SNRW to X lock. -# Sending: -alter table t1 add column j int;; -# -connection handler_con2; -# Wait until ALTER is blocked during upgrade. -# -connection default; -# The below statement should not cause deadlock. -handler t1 read first;; -# -connection handler_con1; -# Reap ALTER TABLE. -unlock tables; -# -connection default; -# Reap HANDLER READ. -i j -1 NULL -handler t1 close; -# -# Now, check scenario in which upgrade of SNRW lock to X lock -# can be blocked by HANDLER which is open in connection currently -# waiting to get table-lock owned by connection doing upgrade. -# -handler t1 open; -# -connection handler_con1; -lock table t1 write, t2 read; -# -connection default; -# Execute statement which will be blocked on table-level lock -# owned by connection 'handler_con1'. -# Sending: -insert into t2 values (1);; -# -connection handler_con1; -# Wait until INSERT is blocked on table-level lock. -# Sending 'alter table t1 drop column j'. It should not cause -# deadlock. -alter table t1 drop column j; -connection handler_con2; -# Wait until ALTER is blocked during upgrade. -# -connection default; -# Reap INSERT. -ERROR HY000: Wait on a lock was aborted due to a pending exclusive lock -handler t1 close; -# -connection handler_con1; -# Reaping 'alter table t1 drop column j' -unlock tables; -connection default; -# Then, check the scenario in which upgrade of SNRW lock to X -# lock is blocked by HANDLER which is open in connection currently -# waiting to get SW lock on the same table. -# -handler t1 open; -# -connection handler_con1; -lock table t1 write; -# -connection default; -# The below insert should be blocked because active SNRW lock on 't1'. -# Sending: -insert into t1 values (1);; -# -connection handler_con1; -# Wait until INSERT is blocked because of SNRW lock. -# The below ALTER TABLE will be blocked because of presence of HANDLER. -# Sending: -alter table t1 add column j int;; -# -connection default; -# INSERT should be chosen as victim for resolving deadlock. -# Reaping INSERT. -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -# Close HANDLER to unblock ALTER TABLE. -handler t1 close; -# -connection handler_con1; -# Reaping ALTER TABLE. -unlock tables; -# -connection default; -# -# Finally, test in which upgrade of SNRW lock to X lock is blocked -# by HANDLER which is open in connection currently waiting to get -# SR lock on the table on which lock is upgraded. -# -handler t1 open; -# -connection handler_con1; -lock table t1 write, t2 write; -# -connection default; -# The below insert should be blocked because active SNRW lock on 't1'. -# Sending: -insert into t2 values (1);; -# -connection handler_con1; -# Wait until INSERT is blocked because of SNRW lock. -# The below ALTER TABLE will be blocked because of presence of HANDLER. -# Sending: -alter table t1 drop column j;; -# -connection default; -# INSERT should be chosen as victim for resolving deadlock. -# Reaping INSERT. -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -# Close HANDLER to unblock ALTER TABLE. -handler t1 close; -# -connection handler_con1; -# Reaping ALTER TABLE. -unlock tables; -# -connection default; -# Clean-up. -disconnect handler_con1; -disconnect handler_con2; -drop tables t1, t2; -# # Test coverage for basic deadlock detection in metadata # locking subsystem. # diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index b80d2a0be22..eadc56ec267 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -3862,6 +3862,23 @@ test.m1 repair error Corrupt # Clean-up. drop tables m1, t1, t4; drop view t3; +# +# MDEV-10424 - Assertion `ticket == __null' failed in +# MDL_request::set_type +# +CREATE TABLE t1 (f1 INT) ENGINE=MyISAM; +CREATE TABLE tmerge (f1 INT) ENGINE=MERGE UNION=(t1); +PREPARE stmt FROM "ANALYZE TABLE tmerge, t1"; +EXECUTE stmt; +Table Op Msg_type Msg_text +test.tmerge analyze note The storage engine for the table doesn't support analyze +test.t1 analyze status Table is already up to date +EXECUTE stmt; +Table Op Msg_type Msg_text +test.tmerge analyze note The storage engine for the table doesn't support analyze +test.t1 analyze status Table is already up to date +DEALLOCATE PREPARE stmt; +DROP TABLE t1, tmerge; End of 5.5 tests # # Additional coverage for refactoring which is made as part diff --git a/mysql-test/r/mix2_myisam.result b/mysql-test/r/mix2_myisam.result index 6d2d5b5f3a9..2971abb8a35 100644 --- a/mysql-test/r/mix2_myisam.result +++ b/mysql-test/r/mix2_myisam.result @@ -257,7 +257,7 @@ drop table t1; CREATE TABLE t1 (a int not null, b int not null,c int not null, key(a),primary key(a,b), unique(c),key(a),unique(b)) ENGINE = MyISAM; Warnings: -Note 1831 Duplicate index 'a_2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a_2`. This is deprecated and will be disallowed in a future release show index from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment t1 0 PRIMARY 1 a A # NULL NULL BTREE @@ -1550,7 +1550,7 @@ alter table t1 add unique(v); ERROR 23000: Duplicate entry '{ ' for key 'v_2' alter table t1 add key(v); Warnings: -Note 1831 Duplicate index 'v_2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `v_2`. This is deprecated and will be disallowed in a future release select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a'; qq *a*a*a* diff --git a/mysql-test/r/mrr_icp_extra.result b/mysql-test/r/mrr_icp_extra.result index 45459e3ea13..b27413a1a21 100644 --- a/mysql-test/r/mrr_icp_extra.result +++ b/mysql-test/r/mrr_icp_extra.result @@ -351,7 +351,7 @@ alter table t1 add unique(v); ERROR 23000: Duplicate entry '{ ' for key 'v_2' alter table t1 add key(v); Warnings: -Note 1831 Duplicate index 'v_2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `v_2`. This is deprecated and will be disallowed in a future release select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a'; qq *a*a*a* diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index b9c12be8d0d..1ae05a8cff9 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -1,10 +1,4 @@ CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT."); -drop table if exists t1,t2,t3; -drop database if exists mysqltest; -drop view if exists v1; -revoke all privileges on mysqltest.t1 from mysqltest_1@localhost; -revoke all privileges on mysqltest.* from mysqltest_1@localhost; -delete from mysql.user where user=_binary'mysqltest_1'; create table t1(id1 int not null auto_increment primary key, t char(12)); create table t2(id2 int not null, t char(12)); create table t3(id3 int not null, t char(12), index(id3)); @@ -452,44 +446,11 @@ ERROR HY000: Table 't1' is specified twice, both as a target for 'UPDATE' and as delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1; ERROR HY000: Table 't1' is specified twice, both as a target for 'DELETE' and as a separate source for data drop table t1,t2; -create table t1 ( -aclid bigint not null primary key, -status tinyint(1) not null -) engine = innodb; -create table t2 ( -refid bigint not null primary key, -aclid bigint, index idx_acl(aclid) -) engine = innodb; -insert into t2 values(1,null); -delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1'; -drop table t1, t2; create table t1(a int); create table t2(a int); delete from t1,t2 using t1,t2 where t1.a=(select a from t1); ERROR HY000: Table 't1' is specified twice, both as a target for 'DELETE' and as a separate source for data drop table t1, t2; -create table t1 ( c char(8) not null ) engine=innodb; -insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'); -insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F'); -alter table t1 add b char(8) not null; -alter table t1 add a char(8) not null; -alter table t1 add primary key (a,b,c); -update t1 set a=c, b=c; -create table t2 like t1; -insert into t2 select * from t1; -delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b; -drop table t1,t2; -create table t1 ( c char(8) not null ) engine=innodb; -insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'); -insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F'); -alter table t1 add b char(8) not null; -alter table t1 add a char(8) not null; -alter table t1 add primary key (a,b,c); -update t1 set a=c, b=c; -create table t2 like t1; -insert into t2 select * from t1; -delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b; -drop table t1,t2; create table t1 (a int, b int); insert into t1 values (1, 2), (2, 3), (3, 4); create table t2 (a int); @@ -646,7 +607,6 @@ master-bin.000001 # Update_rows_v1 # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT drop table t1, t2; set @@session.binlog_format= @sav_binlog_format; -drop table if exists t1, t2, t3; CREATE TABLE t1 (a int, PRIMARY KEY (a)); CREATE TABLE t2 (a int, PRIMARY KEY (a)); CREATE TABLE t3 (a int, PRIMARY KEY (a)) ENGINE=MyISAM; @@ -1040,57 +1000,3 @@ deallocate prepare stmt1; drop view v3,v2,v1; drop table t1,t2,t3; end of 5.5 tests - -# Bug mdev-5970 -# Bug#13256831 - ERROR 1032 (HY000): CAN'T FIND RECORD - -CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB; -CREATE TABLE t2 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (5, 7); -INSERT INTO t2 VALUES (6, 97); -CREATE ALGORITHM = MERGE VIEW v1 AS -SELECT a2.f1 AS f1, a2.f2 AS f2 -FROM t1 AS a1 JOIN t2 AS a2 ON a1.f2 > a2.f1 -WITH LOCAL CHECK OPTION; -SELECT * FROM v1; -f1 f2 -6 97 -UPDATE v1 SET f1 = 1; -SELECT * FROM v1; -f1 f2 -1 97 -DROP TABLE t1, t2; -DROP VIEW v1; -# -# MDEV-5973: MySQL Bug#11757486:49539: NON-DESCRIPTIVE ERR (ERROR 0 -# FROM STORAGE ENGINE) WITH MULTI-TABLE UPDATE -# -CREATE TABLE table_11757486 (field1 tinyint) ENGINE=INNODB; -INSERT INTO table_11757486 VALUES (0),(0); -SET SESSION SQL_MODE='STRICT_ALL_TABLES'; -UPDATE IGNORE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1; -Warnings: -Warning 1264 Out of range value for column 'field1' at row 1 -Warning 1264 Out of range value for column 'field1' at row 2 -UPDATE IGNORE table_11757486 SET field1=128; -Warnings: -Warning 1264 Out of range value for column 'field1' at row 1 -Warning 1264 Out of range value for column 'field1' at row 2 -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. UPDATE IGNORE is unsafe because the order in which rows are updated determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave. -UPDATE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1; -ERROR 22003: Out of range value for column 'field1' at row 1 -UPDATE table_11757486 SET field1=128; -ERROR 22003: Out of range value for column 'field1' at row 1 -SET SESSION SQL_MODE=''; -UPDATE IGNORE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1; -Warnings: -Warning 1264 Out of range value for column 'field1' at row 1 -Warning 1264 Out of range value for column 'field1' at row 2 -UPDATE IGNORE table_11757486 SET field1=128; -Warnings: -Warning 1264 Out of range value for column 'field1' at row 1 -Warning 1264 Out of range value for column 'field1' at row 2 -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. UPDATE IGNORE is unsafe because the order in which rows are updated determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave. -DROP TABLE table_11757486; -SET SESSION SQL_MODE=default; -end of 10.0 tests diff --git a/mysql-test/r/multi_update_innodb.result b/mysql-test/r/multi_update_innodb.result index 4c4aa9f4684..5890fd24f5f 100644 --- a/mysql-test/r/multi_update_innodb.result +++ b/mysql-test/r/multi_update_innodb.result @@ -67,3 +67,87 @@ SELECT * FROM t2; col_int_key pk_1 pk_2 col_int 1 2 3 4 DROP TABLE t1,t2; + +# Bug mdev-5970 +# Bug#13256831 - ERROR 1032 (HY000): CAN'T FIND RECORD + +CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB; +CREATE TABLE t2 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (5, 7); +INSERT INTO t2 VALUES (6, 97); +CREATE ALGORITHM = MERGE VIEW v1 AS +SELECT a2.f1 AS f1, a2.f2 AS f2 +FROM t1 AS a1 JOIN t2 AS a2 ON a1.f2 > a2.f1 +WITH LOCAL CHECK OPTION; +SELECT * FROM v1; +f1 f2 +6 97 +UPDATE v1 SET f1 = 1; +SELECT * FROM v1; +f1 f2 +1 97 +DROP TABLE t1, t2; +DROP VIEW v1; +# +# MDEV-5973: MySQL Bug#11757486:49539: NON-DESCRIPTIVE ERR (ERROR 0 +# FROM STORAGE ENGINE) WITH MULTI-TABLE UPDATE +# +CREATE TABLE table_11757486 (field1 tinyint) ENGINE=INNODB; +INSERT INTO table_11757486 VALUES (0),(0); +SET SESSION SQL_MODE='STRICT_ALL_TABLES'; +UPDATE IGNORE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1; +Warnings: +Warning 1264 Out of range value for column 'field1' at row 1 +Warning 1264 Out of range value for column 'field1' at row 2 +UPDATE IGNORE table_11757486 SET field1=128; +Warnings: +Warning 1264 Out of range value for column 'field1' at row 1 +Warning 1264 Out of range value for column 'field1' at row 2 +UPDATE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1; +ERROR 22003: Out of range value for column 'field1' at row 1 +UPDATE table_11757486 SET field1=128; +ERROR 22003: Out of range value for column 'field1' at row 1 +SET SESSION SQL_MODE=''; +UPDATE IGNORE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1; +Warnings: +Warning 1264 Out of range value for column 'field1' at row 1 +Warning 1264 Out of range value for column 'field1' at row 2 +UPDATE IGNORE table_11757486 SET field1=128; +Warnings: +Warning 1264 Out of range value for column 'field1' at row 1 +Warning 1264 Out of range value for column 'field1' at row 2 +DROP TABLE table_11757486; +SET SESSION SQL_MODE=default; +create table t1 ( +aclid bigint not null primary key, +status tinyint(1) not null +) engine = innodb; +create table t2 ( +refid bigint not null primary key, +aclid bigint, index idx_acl(aclid) +) engine = innodb; +insert into t2 values(1,null); +delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1'; +drop table t1, t2; +create table t1 ( c char(8) not null ) engine=innodb; +insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'); +insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F'); +alter table t1 add b char(8) not null; +alter table t1 add a char(8) not null; +alter table t1 add primary key (a,b,c); +update t1 set a=c, b=c; +create table t2 like t1; +insert into t2 select * from t1; +delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b; +drop table t1,t2; +create table t1 ( c char(8) not null ) engine=innodb; +insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'); +insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F'); +alter table t1 add b char(8) not null; +alter table t1 add a char(8) not null; +alter table t1 add primary key (a,b,c); +update t1 set a=c, b=c; +create table t2 like t1; +insert into t2 select * from t1; +delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b; +drop table t1,t2; diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index c47a9b9fc06..e0c7bb7c64e 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -1254,7 +1254,7 @@ alter table t1 add unique(v); ERROR 23000: Duplicate entry '{ ' for key 'v_2' alter table t1 add key(v); Warnings: -Note 1831 Duplicate index 'v_2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `v_2`. This is deprecated and will be disallowed in a future release select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a'; qq *a*a*a* @@ -2465,8 +2465,8 @@ SET myisam_repair_threads=2; SET myisam_sort_buffer_size=4096; CREATE TABLE t1(a CHAR(255), KEY(a), KEY(a), KEY(a)); Warnings: -Note 1831 Duplicate index 'a_2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a_3' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a_2`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a_3`. This is deprecated and will be disallowed in a future release INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(0),(1),(2),(3); REPAIR TABLE t1; Table Op Msg_type Msg_text diff --git a/mysql-test/r/myisam_explain_non_select_all.result b/mysql-test/r/myisam_explain_non_select_all.result index fc0f54286a1..e60bb9a8d08 100644 --- a/mysql-test/r/myisam_explain_non_select_all.result +++ b/mysql-test/r/myisam_explain_non_select_all.result @@ -23,7 +23,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a < 10; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` < 10) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 10 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -58,7 +58,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a < 10; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` < 10) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 10 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -93,7 +93,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 1) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -133,7 +133,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`a` = 1) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -175,7 +175,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t11 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` `t11` join `test`.`t2` where (`test`.`t11`.`a` = 1) +Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` `t11` join `test`.`t2` where `test`.`t11`.`a` = 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -217,7 +217,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where (`test`.`t2`.`b` < 3) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` < 3 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -261,7 +261,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 3)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` < 3 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -307,7 +307,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` semi join (`test`.`t2`) join `test`.`t2` where ((`test`.`t2`.`b` < 3)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` semi join (`test`.`t2`) join `test`.`t2` where `test`.`t2`.`b` < 3 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -441,7 +441,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t11 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` `t11` join `test`.`t2` where (`test`.`t11`.`a` > 1) +Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` `t11` join `test`.`t2` where `test`.`t11`.`a` > 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -476,7 +476,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > 1 LIMIT 1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > 1) limit 1 +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1 limit 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -611,7 +611,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a < 3; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range a a 5 NULL 1 100.00 Using index condition Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`a` < 3) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` < 3 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -676,7 +676,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE t1.a > 0 ORDER BY t1.a; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > 0) order by `test`.`t1`.`a` +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 0 order by `test`.`t1`.`a` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -713,7 +713,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE (@a:= a) ORDER BY a LIMIT 1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index NULL PRIMARY 4 NULL 1 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (@a:=`test`.`t1`.`a`) order by `test`.`t1`.`a` limit 1 +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where @a:=`test`.`t1`.`a` order by `test`.`t1`.`a` limit 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -800,7 +800,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1 100.00 Using index 1 SIMPLE t3 eq_ref PRIMARY PRIMARY 8 test.t2.b2,test.t1.b1 1 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`b3` AS `b3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where ((`test`.`t2`.`a2` = `test`.`t1`.`a1`) and (`test`.`t3`.`a3` = `test`.`t2`.`b2`) and (`test`.`t3`.`b3` = `test`.`t1`.`b1`)) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`b3` AS `b3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t2`.`a2` = `test`.`t1`.`a1` and `test`.`t3`.`a3` = `test`.`t2`.`b2` and `test`.`t3`.`b3` = `test`.`t1`.`b1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -888,7 +888,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 Using where 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1` from `test`.`t1` where <`test`.`t1`.`a1`>((`test`.`t1`.`a1`,(select `test`.`t2`.`a2` from `test`.`t2` where ((`test`.`t2`.`a2` > 2) and ((`test`.`t1`.`a1`) = `test`.`t2`.`a2`))))) +Note 1003 select `test`.`t1`.`a1` AS `a1` from `test`.`t1` where <`test`.`t1`.`a1`>((`test`.`t1`.`a1`,(select `test`.`t2`.`a2` from `test`.`t2` where `test`.`t2`.`a2` > 2 and (`test`.`t1`.`a1`) = `test`.`t2`.`a2`))) # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -926,7 +926,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 1 PRIMARY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`a2` > 2) and (`test`.`t1`.`a1` = `test`.`t2`.`a2`)) +Note 1003 select `test`.`t1`.`a1` AS `a1` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`a2` > 2 and `test`.`t1`.`a1` = `test`.`t2`.`a2` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -1034,7 +1034,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index NULL a 15 NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where (`test`.`t2`.`b` = 10) order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -1187,7 +1187,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 8 100.00 Using index condition Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`i` AS `i` from `test`.`t1` where ((`test`.`t1`.`i` > 10) and (`test`.`t1`.`i` <= 18)) order by `test`.`t1`.`i` limit 5 +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`i` AS `i` from `test`.`t1` where `test`.`t1`.`i` > 10 and `test`.`t1`.`i` <= 18 order by `test`.`t1`.`i` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -1226,7 +1226,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL i NULL NULL NULL 26 100.00 Using where; Using filesort Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`i` AS `i` from `test`.`t1` where ((`test`.`t1`.`i` > 10) and (`test`.`t1`.`i` <= 18)) order by `test`.`t1`.`i` limit 5 +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`i` AS `i` from `test`.`t1` where `test`.`t1`.`i` > 10 and `test`.`t1`.`i` <= 18 order by `test`.`t1`.`i` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -1271,7 +1271,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where (`test`.`t2`.`b` = 10) order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -1317,7 +1317,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index NULL a 15 NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where (`test`.`t2`.`b` = 10) order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -1358,7 +1358,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where (`test`.`t2`.`b` = 10) order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -1404,7 +1404,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where (`test`.`t2`.`b` = 10) order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -1451,7 +1451,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index_merge key1,key2 key1,key2 5,5 NULL 7 100.00 Using sort_union(key1,key2); Using where; Using filesort Warnings: -Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`key1` AS `key1`,`test`.`t2`.`key2` AS `key2` from `test`.`t2` where ((`test`.`t2`.`key1` < 13) or (`test`.`t2`.`key2` < 14)) order by `test`.`t2`.`key1` +Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`key1` AS `key1`,`test`.`t2`.`key2` AS `key2` from `test`.`t2` where `test`.`t2`.`key1` < 13 or `test`.`t2`.`key2` < 14 order by `test`.`t2`.`key1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -1498,7 +1498,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 8 100.00 Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where ((`test`.`t2`.`i` > 10) and (`test`.`t2`.`i` <= 18)) order by `test`.`t2`.`i` desc limit 5 +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` desc limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -1626,7 +1626,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 8 100.00 Using index condition Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where ((`test`.`t2`.`i` > 10) and (`test`.`t2`.`i` <= 18)) order by `test`.`t2`.`i` limit 5 +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -1668,7 +1668,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL i NULL NULL NULL 26 100.00 Using where; Using filesort Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where ((`test`.`t2`.`i` > 10) and (`test`.`t2`.`i` <= 18)) order by `test`.`t2`.`i` limit 5 +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -1714,7 +1714,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where (`test`.`t2`.`b` = 10) order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -1761,7 +1761,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index NULL a 15 NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where (`test`.`t2`.`b` = 10) order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -1803,7 +1803,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where (`test`.`t2`.`b` = 10) order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -1849,7 +1849,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where (`test`.`t2`.`b` = 10) order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -1896,7 +1896,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index_merge key1,key2 key1,key2 5,5 NULL 7 100.00 Using sort_union(key1,key2); Using where; Using filesort Warnings: -Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`key1` AS `key1`,`test`.`t2`.`key2` AS `key2` from `test`.`t2` where ((`test`.`t2`.`key1` < 13) or (`test`.`t2`.`key2` < 14)) order by `test`.`t2`.`key1` +Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`key1` AS `key1`,`test`.`t2`.`key2` AS `key2` from `test`.`t2` where `test`.`t2`.`key1` < 13 or `test`.`t2`.`key2` < 14 order by `test`.`t2`.`key1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -1943,7 +1943,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC L id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 8 100.00 Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where ((`test`.`t2`.`i` > 10) and (`test`.`t2`.`i` <= 18)) order by `test`.`t2`.`i` desc limit 5 +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` desc limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -2076,7 +2076,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ref c1_idx c1_idx 2 const 2 100.00 Using index condition; Using where; Using filesort Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1_idx` AS `c1_idx`,`test`.`t1`.`c2` AS `c2` from `test`.`t1` where (`test`.`t1`.`c1_idx` = 'y') order by `test`.`t1`.`pk` desc limit 2 +Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1_idx` AS `c1_idx`,`test`.`t1`.`c2` AS `c2` from `test`.`t1` where `test`.`t1`.`c1_idx` = 'y' order by `test`.`t1`.`pk` desc limit 2 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -2116,7 +2116,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ref c1_idx c1_idx 2 const 2 100.00 Using index condition; Using where; Using filesort Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1_idx` AS `c1_idx`,`test`.`t1`.`c2` AS `c2` from `test`.`t1` where (`test`.`t1`.`c1_idx` = 'y') order by `test`.`t1`.`pk` desc limit 2 +Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1_idx` AS `c1_idx`,`test`.`t1`.`c2` AS `c2` from `test`.`t1` where `test`.`t1`.`c1_idx` = 'y' order by `test`.`t1`.`pk` desc limit 2 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -2159,7 +2159,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > 34; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > 34) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 34 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -2237,7 +2237,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t1`.`c2` AS `c2`,`test`.`t1`.`c3` AS `c3`,NULL AS `c1`,NULL AS `c2` from `test`.`t1` where (`test`.`t1`.`c3` = 10) +Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t1`.`c2` AS `c2`,`test`.`t1`.`c3` AS `c3`,NULL AS `c1`,NULL AS `c2` from `test`.`t1` where `test`.`t1`.`c3` = 10 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value Handler_read_rnd_next 1 @@ -2281,7 +2281,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ALL IDX NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.f1' of SELECT #2 was resolved in SELECT #1 -Note 1003 select <`test`.`t1`.`f1`>((select max(`test`.`t2`.`f4`) from `test`.`t2` where (`test`.`t2`.`f3` = `test`.`t1`.`f1`))) AS `(SELECT MAX(t2.f4) FROM t2 WHERE t2.f3=t1.f1)` from `test`.`t1` +Note 1003 select <`test`.`t1`.`f1`>((select max(`test`.`t2`.`f4`) from `test`.`t2` where `test`.`t2`.`f3` = `test`.`t1`.`f1`)) AS `(SELECT MAX(t2.f4) FROM t2 WHERE t2.f3=t1.f1)` from `test`.`t1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -2344,7 +2344,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t11 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t12 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t12`.`a` AS `b` from `test`.`t1` `t11` join `test`.`t1` `t12` where (`test`.`t11`.`a` > 0) +Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t12`.`a` AS `b` from `test`.`t1` `t11` join `test`.`t1` `t12` where `test`.`t11`.`a` > 0 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -2382,7 +2382,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t11 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) 1 SIMPLE t12 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (incremental, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t11`.`a` AS `a`,`test`.`t12`.`a` AS `b` from `test`.`t1` join `test`.`t1` `t11` join `test`.`t1` `t12` where (`test`.`t11`.`a` = `test`.`t1`.`a`) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t11`.`a` AS `a`,`test`.`t12`.`a` AS `b` from `test`.`t1` join `test`.`t1` `t11` join `test`.`t1` `t12` where `test`.`t11`.`a` = `test`.`t1`.`a` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -2421,7 +2421,7 @@ EXPLAIN EXTENDED SELECT * FROM v1 WHERE a < 4; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` < 4) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 4 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -2465,7 +2465,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00 Using where 1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.x 1 100.00 Warnings: -Note 1003 select `test`.`t2`.`x` AS `x`,`test`.`t1`.`a` AS `a`,(`test`.`t1`.`b` + 1) AS `c` from `test`.`t2` join `test`.`t1` where (`test`.`t1`.`a` = `test`.`t2`.`x`) +Note 1003 select `test`.`t2`.`x` AS `x`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` + 1 AS `c` from `test`.`t2` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t2`.`x` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -2510,7 +2510,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00 Using where 1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.x 1 100.00 Warnings: -Note 1003 select `test`.`t2`.`x` AS `x`,`test`.`t1`.`a` AS `a`,(`test`.`t1`.`b` + 1) AS `c` from `test`.`t2` join `test`.`t1` where (`test`.`t1`.`a` = `test`.`t2`.`x`) +Note 1003 select `test`.`t2`.`x` AS `x`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` + 1 AS `c` from `test`.`t2` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t2`.`x` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -2808,7 +2808,7 @@ EXPLAIN EXTENDED SELECT a t1 FROM t1 WHERE a>10; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 5 20.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `t1` from `test`.`t1` where (`test`.`t1`.`a` > 10) +Note 1003 select `test`.`t1`.`a` AS `t1` from `test`.`t1` where `test`.`t1`.`a` > 10 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: @@ -2840,7 +2840,7 @@ EXPLAIN EXTENDED SELECT a t1 FROM t1 WHERE a>10 ORDER BY a+20; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 5 20.00 Using where; Using index; Using filesort Warnings: -Note 1003 select `test`.`t1`.`a` AS `t1` from `test`.`t1` where (`test`.`t1`.`a` > 10) order by (`test`.`t1`.`a` + 20) +Note 1003 select `test`.`t1`.`a` AS `t1` from `test`.`t1` where `test`.`t1`.`a` > 10 order by `test`.`t1`.`a` + 20 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: diff --git a/mysql-test/r/myisam_icp.result b/mysql-test/r/myisam_icp.result index 67612255d8e..374d4e45139 100644 --- a/mysql-test/r/myisam_icp.result +++ b/mysql-test/r/myisam_icp.result @@ -720,8 +720,8 @@ b INT, c INT, d DATE NOT NULL, e VARCHAR(1), KEY (c), KEY (d), KEY k2(b), KEY k3(b), KEY k4(b) ); Warnings: -Note 1831 Duplicate index 'k3' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'k4' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `k3`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `k4`. This is deprecated and will be disallowed in a future release INSERT INTO t1 (b,c,d,e) VALUES (6,5,'2006-05-25','y'),(1,5,'2008-01-23','t'), (6,5,'2007-06-18','d'),(4,5,'1900-01-01','r'), diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index ca19d2eb98b..4097a22ea43 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -514,6 +514,14 @@ DROP DATABASE connected_db; create database `aa``bb````cc`; DATABASE() aa`bb``cc +DATABASE() +test +DATABASE() +aa`bb``cc +DATABASE() +test +DATABASE() +aa`bb``cc drop database `aa``bb````cc`; a >>\ndelimiter\n<< diff --git a/mysql-test/r/mysql5613mysql.result b/mysql-test/r/mysql5613mysql.result index 1d2c3b97baf..183af7211d3 100644 --- a/mysql-test/r/mysql5613mysql.result +++ b/mysql-test/r/mysql5613mysql.result @@ -10,7 +10,7 @@ columns_priv CREATE TABLE `columns_priv` ( `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '', `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', `Column_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges' @@ -58,7 +58,7 @@ event CREATE TABLE `event` ( `execute_at` datetime DEFAULT NULL, `interval_value` int(11) DEFAULT NULL, `interval_field` enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `last_executed` datetime DEFAULT NULL, `starts` datetime DEFAULT NULL, @@ -115,7 +115,7 @@ proc CREATE TABLE `proc` ( `returns` longblob NOT NULL DEFAULT '', `body` longblob NOT NULL, `definer` char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '', `comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, @@ -138,7 +138,7 @@ procs_priv CREATE TABLE `procs_priv` ( `Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL, `Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '', `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`), KEY `Grantor` (`Grantor`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges' @@ -154,7 +154,7 @@ proxies_priv CREATE TABLE `proxies_priv` ( `Proxied_user` char(16) COLLATE utf8_bin NOT NULL DEFAULT '', `With_grant` tinyint(1) NOT NULL DEFAULT 0, `Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`Host`,`User`,`Proxied_host`,`Proxied_user`), KEY `Grantor` (`Grantor`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User proxy privileges' @@ -186,7 +186,7 @@ tables_priv CREATE TABLE `tables_priv` ( `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '', `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', `Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '', `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`), diff --git a/mysql-test/r/mysql57_virtual.result b/mysql-test/r/mysql57_virtual.result index ace8fe38d36..8186aa7cdec 100644 --- a/mysql-test/r/mysql57_virtual.result +++ b/mysql-test/r/mysql57_virtual.result @@ -5,8 +5,8 @@ SHOW CREATE TABLE mysql57_virtual; Table Create Table mysql57_virtual CREATE TABLE `mysql57_virtual` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS ((`a` + 1)) VIRTUAL, - `c` int(11) AS ((`a` + 3)) PERSISTENT + `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL, + `c` int(11) GENERATED ALWAYS AS (`a` + 3) STORED ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into mysql57_virtual (a) values (1),(2); select * from mysql57_virtual; @@ -20,8 +20,8 @@ SHOW CREATE TABLE mysql57_virtual; Table Create Table mysql57_virtual CREATE TABLE `mysql57_virtual` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS ((`a` + 1)) VIRTUAL, - `c` int(11) AS ((`a` + 3)) PERSISTENT + `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL, + `c` int(11) GENERATED ALWAYS AS (`a` + 3) STORED ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='I am now a MariaDB table' DROP TABLE mysql57_virtual; # @@ -32,7 +32,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a+1) PERSISTENT, - `c` int(11) AS (a+2) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (`a` + 1) STORED, + `c` int(11) GENERATED ALWAYS AS (`a` + 2) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; diff --git a/mysql-test/r/mysql_not_windows.result b/mysql-test/r/mysql_not_windows.result index d5670a1a9ca..1df62d9a12d 100644 --- a/mysql-test/r/mysql_not_windows.result +++ b/mysql-test/r/mysql_not_windows.result @@ -3,3 +3,9 @@ a 1 End of tests +1 +1 +2 +2 +X +3 diff --git a/mysql-test/r/mysqlbinlog_row_compressed.result b/mysql-test/r/mysqlbinlog_row_compressed.result new file mode 100644 index 00000000000..a612433fc2f --- /dev/null +++ b/mysql-test/r/mysqlbinlog_row_compressed.result @@ -0,0 +1,453 @@ +SET GLOBAL log_bin_compress=on; +SET GLOBAL log_bin_compress_min_len=10; +CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1)); +CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1)); +INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, ""); +INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL); +INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A"); +INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A"); +INSERT INTO t2 SELECT * FROM t1; +UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL; +DELETE FROM t1; +DELETE FROM t2; +FLUSH BINARY LOGS; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +DELIMITER /*!*/; +# at 4 +# server id 1 end_log_pos 256 CRC32 XXX Start: xxx +ROLLBACK/*!*/; +# at 256 +# server id 1 end_log_pos 285 CRC32 XXX Gtid list [] +# at 285 +# server id 1 end_log_pos 329 CRC32 XXX Binlog checkpoint master-bin.000001 +# at 329 +# server id 1 end_log_pos 371 CRC32 XXX GTID 0-1-1 ddl +/*!100101 SET @@session.skip_parallel_replication=0*//*!*/; +/*!100001 SET @@session.gtid_domain_id=0*//*!*/; +/*!100001 SET @@session.server_id=1*//*!*/; +/*!100001 SET @@session.gtid_seq_no=1*//*!*/; +# at 371 +# server id 1 end_log_pos 533 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0 +use `test`/*!*/; +SET TIMESTAMP=X/*!*/; +SET @@session.pseudo_thread_id=4/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.sql_mode=1342177280/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; +CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1)) +/*!*/; +# at 533 +# server id 1 end_log_pos 575 CRC32 XXX GTID 0-1-2 ddl +/*!100001 SET @@session.gtid_seq_no=2*//*!*/; +# at 575 +# server id 1 end_log_pos 727 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1)) +/*!*/; +# at 727 +# server id 1 end_log_pos 769 CRC32 XXX GTID 0-1-3 +/*!100001 SET @@session.gtid_seq_no=3*//*!*/; +BEGIN +/*!*/; +# at 769 +# server id 1 end_log_pos 825 CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at 825 +# server id 1 end_log_pos 893 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F +### INSERT INTO `test`.`t1` +### SET +### @1=10 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */ +### @5=4 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# at 893 +# server id 1 end_log_pos 966 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 966 +# server id 1 end_log_pos 1008 CRC32 XXX GTID 0-1-4 +/*!100001 SET @@session.gtid_seq_no=4*//*!*/; +BEGIN +/*!*/; +# at 1008 +# server id 1 end_log_pos 1064 CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at 1064 +# server id 1 end_log_pos 1131 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F +### INSERT INTO `test`.`t1` +### SET +### @1=11 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */ +### @5=4 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */ +# at 1131 +# server id 1 end_log_pos 1204 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 1204 +# server id 1 end_log_pos 1246 CRC32 XXX GTID 0-1-5 +/*!100001 SET @@session.gtid_seq_no=5*//*!*/; +BEGIN +/*!*/; +# at 1246 +# server id 1 end_log_pos 1302 CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at 1302 +# server id 1 end_log_pos 1368 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F +### INSERT INTO `test`.`t1` +### SET +### @1=12 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */ +### @5=NULL /* MEDIUMINT meta=0 nullable=1 is_null=1 */ +### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# at 1368 +# server id 1 end_log_pos 1441 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 1441 +# server id 1 end_log_pos 1483 CRC32 XXX GTID 0-1-6 +/*!100001 SET @@session.gtid_seq_no=6*//*!*/; +BEGIN +/*!*/; +# at 1483 +# server id 1 end_log_pos 1539 CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at 1539 +# server id 1 end_log_pos 1606 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F +### INSERT INTO `test`.`t1` +### SET +### @1=13 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */ +### @5=0 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# at 1606 +# server id 1 end_log_pos 1679 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 1679 +# server id 1 end_log_pos 1721 CRC32 XXX GTID 0-1-7 +/*!100001 SET @@session.gtid_seq_no=7*//*!*/; +BEGIN +/*!*/; +# at 1721 +# server id 1 end_log_pos 1777 CRC32 XXX Table_map: `test`.`t2` mapped to number num +# at 1777 +# server id 1 end_log_pos 1868 CRC32 XXX Write_compressed_rows: table id 31 flags: STMT_END_F +### INSERT INTO `test`.`t2` +### SET +### @1=10 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* INT meta=0 nullable=1 is_null=0 */ +### @5=4 /* INT meta=0 nullable=1 is_null=0 */ +### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +### INSERT INTO `test`.`t2` +### SET +### @1=11 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* INT meta=0 nullable=1 is_null=0 */ +### @5=4 /* INT meta=0 nullable=1 is_null=0 */ +### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */ +### INSERT INTO `test`.`t2` +### SET +### @1=12 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* INT meta=0 nullable=1 is_null=0 */ +### @5=NULL /* INT meta=0 nullable=1 is_null=1 */ +### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +### INSERT INTO `test`.`t2` +### SET +### @1=13 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* INT meta=0 nullable=1 is_null=0 */ +### @5=0 /* INT meta=0 nullable=1 is_null=0 */ +### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# at 1868 +# server id 1 end_log_pos 1941 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 1941 +# server id 1 end_log_pos 1983 CRC32 XXX GTID 0-1-8 +/*!100001 SET @@session.gtid_seq_no=8*//*!*/; +BEGIN +/*!*/; +# at 1983 +# server id 1 end_log_pos 2039 CRC32 XXX Table_map: `test`.`t2` mapped to number num +# at 2039 +# server id 1 end_log_pos 2138 CRC32 XXX Update_compressed_rows: table id 31 flags: STMT_END_F +### UPDATE `test`.`t2` +### WHERE +### @1=10 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* INT meta=0 nullable=1 is_null=0 */ +### @5=4 /* INT meta=0 nullable=1 is_null=0 */ +### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +### SET +### @1=10 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* INT meta=0 nullable=1 is_null=0 */ +### @5=5 /* INT meta=0 nullable=1 is_null=0 */ +### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +### UPDATE `test`.`t2` +### WHERE +### @1=11 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* INT meta=0 nullable=1 is_null=0 */ +### @5=4 /* INT meta=0 nullable=1 is_null=0 */ +### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */ +### SET +### @1=11 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* INT meta=0 nullable=1 is_null=0 */ +### @5=5 /* INT meta=0 nullable=1 is_null=0 */ +### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */ +### UPDATE `test`.`t2` +### WHERE +### @1=12 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* INT meta=0 nullable=1 is_null=0 */ +### @5=NULL /* INT meta=0 nullable=1 is_null=1 */ +### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +### SET +### @1=12 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* INT meta=0 nullable=1 is_null=0 */ +### @5=5 /* INT meta=0 nullable=1 is_null=0 */ +### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# at 2138 +# server id 1 end_log_pos 2211 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 2211 +# server id 1 end_log_pos 2253 CRC32 XXX GTID 0-1-9 +/*!100001 SET @@session.gtid_seq_no=9*//*!*/; +BEGIN +/*!*/; +# at 2253 +# server id 1 end_log_pos 2309 CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at 2309 +# server id 1 end_log_pos 2401 CRC32 XXX Delete_compressed_rows: table id 30 flags: STMT_END_F +### DELETE FROM `test`.`t1` +### WHERE +### @1=10 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */ +### @5=4 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +### DELETE FROM `test`.`t1` +### WHERE +### @1=11 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */ +### @5=4 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */ +### DELETE FROM `test`.`t1` +### WHERE +### @1=12 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */ +### @5=NULL /* MEDIUMINT meta=0 nullable=1 is_null=1 */ +### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +### DELETE FROM `test`.`t1` +### WHERE +### @1=13 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */ +### @5=0 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# at 2401 +# server id 1 end_log_pos 2474 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 2474 +# server id 1 end_log_pos 2516 CRC32 XXX GTID 0-1-10 +/*!100001 SET @@session.gtid_seq_no=10*//*!*/; +BEGIN +/*!*/; +# at 2516 +# server id 1 end_log_pos 2572 CRC32 XXX Table_map: `test`.`t2` mapped to number num +# at 2572 +# server id 1 end_log_pos 2657 CRC32 XXX Delete_compressed_rows: table id 31 flags: STMT_END_F +### DELETE FROM `test`.`t2` +### WHERE +### @1=10 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* INT meta=0 nullable=1 is_null=0 */ +### @5=5 /* INT meta=0 nullable=1 is_null=0 */ +### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +### DELETE FROM `test`.`t2` +### WHERE +### @1=11 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* INT meta=0 nullable=1 is_null=0 */ +### @5=5 /* INT meta=0 nullable=1 is_null=0 */ +### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */ +### DELETE FROM `test`.`t2` +### WHERE +### @1=12 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* INT meta=0 nullable=1 is_null=0 */ +### @5=5 /* INT meta=0 nullable=1 is_null=0 */ +### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +### DELETE FROM `test`.`t2` +### WHERE +### @1=13 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* INT meta=0 nullable=1 is_null=0 */ +### @5=0 /* INT meta=0 nullable=1 is_null=0 */ +### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# at 2657 +# server id 1 end_log_pos 2730 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 2730 +# server id 1 end_log_pos 2778 CRC32 XXX Rotate to master-bin.000002 pos: 4 +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; + +Test mysqlbinlog | mysql type point-in-time recovery with compressed events. + +FLUSH BINARY LOGS; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT, c VARCHAR(100)); +INSERT INTO t3 VALUES (0, 10, "hello"); +BEGIN; +INSERT INTO t3 VALUES (1, 10, "cat"), (2, 10, "mouse"), (3, 10, "dog"); +INSERT INTO t3 VALUES (4, 10, "goodbye"); +COMMIT; +UPDATE t3 SET b=b+100 where a<>1; +DELETE FROM t3 WHERE a=2; +SET @old_image=@@binlog_row_image; +SET binlog_row_image=minimal; +INSERT INTO t3 VALUES (5, 20, "red"), (6, 30, "green"), (7, 40, "blue"); +INSERT INTO t3 VALUES (8, 20, "rigel"); +UPDATE t3 SET c = concat("colour of ", c) WHERE a > 5; +UPDATE t3 SET b=b*2 WHERE a IN (5,6,7); +DELETE FROM t3 WHERE a=6; +SET binlog_row_image=@old_image; +SELECT * FROM t3 ORDER BY a; +a b c +0 110 hello +1 10 cat +3 110 dog +4 110 goodbye +5 40 red +7 80 colour of blue +8 20 colour of rigel +FLUSH LOGS; +DROP TABLE t3; +SELECT * FROM t3 ORDER BY a; +a b c +0 110 hello +1 10 cat +3 110 dog +4 110 goodbye +5 40 red +7 80 colour of blue +8 20 colour of rigel +DROP TABLE t1,t2,t3; +SET GLOBAL log_bin_compress=off; +SET GLOBAL log_bin_compress_min_len=256; diff --git a/mysql-test/r/mysqlbinlog_row_minimal.result b/mysql-test/r/mysqlbinlog_row_minimal.result index 2737d61eca4..2fb721d4103 100644 --- a/mysql-test/r/mysqlbinlog_row_minimal.result +++ b/mysql-test/r/mysqlbinlog_row_minimal.result @@ -14,20 +14,20 @@ FLUSH BINARY LOGS; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at 4 -# server id 1 end_log_pos 249 CRC32 XXX Start: xxx +# server id 1 end_log_pos 256 CRC32 XXX Start: xxx ROLLBACK/*!*/; -# at 249 -# server id 1 end_log_pos 278 CRC32 XXX Gtid list [] -# at 278 -# server id 1 end_log_pos 322 CRC32 XXX Binlog checkpoint master-bin.000001 -# at 322 -# server id 1 end_log_pos 364 CRC32 XXX GTID 0-1-1 ddl +# at 256 +# server id 1 end_log_pos 285 CRC32 XXX Gtid list [] +# at 285 +# server id 1 end_log_pos 329 CRC32 XXX Binlog checkpoint master-bin.000001 +# at 329 +# server id 1 end_log_pos 371 CRC32 XXX GTID 0-1-1 ddl /*!100101 SET @@session.skip_parallel_replication=0*//*!*/; /*!100001 SET @@session.gtid_domain_id=0*//*!*/; /*!100001 SET @@session.server_id=1*//*!*/; /*!100001 SET @@session.gtid_seq_no=1*//*!*/; -# at 364 -# server id 1 end_log_pos 548 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +# at 371 +# server id 1 end_log_pos 555 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 use `test`/*!*/; SET TIMESTAMP=X/*!*/; SET @@session.pseudo_thread_id=4/*!*/; @@ -40,23 +40,23 @@ SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1)) /*!*/; -# at 548 -# server id 1 end_log_pos 590 CRC32 XXX GTID 0-1-2 ddl +# at 555 +# server id 1 end_log_pos 597 CRC32 XXX GTID 0-1-2 ddl /*!100001 SET @@session.gtid_seq_no=2*//*!*/; -# at 590 -# server id 1 end_log_pos 767 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +# at 597 +# server id 1 end_log_pos 774 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1)) /*!*/; -# at 767 -# server id 1 end_log_pos 809 CRC32 XXX GTID 0-1-3 +# at 774 +# server id 1 end_log_pos 816 CRC32 XXX GTID 0-1-3 /*!100001 SET @@session.gtid_seq_no=3*//*!*/; BEGIN /*!*/; -# at 809 -# server id 1 end_log_pos 865 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 865 -# server id 1 end_log_pos 934 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F +# at 816 +# server id 1 end_log_pos 872 CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at 872 +# server id 1 end_log_pos 941 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -68,20 +68,20 @@ BEGIN ### @7=6 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */ -# at 934 -# server id 1 end_log_pos 1007 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +# at 941 +# server id 1 end_log_pos 1014 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1007 -# server id 1 end_log_pos 1049 CRC32 XXX GTID 0-1-4 +# at 1014 +# server id 1 end_log_pos 1056 CRC32 XXX GTID 0-1-4 /*!100001 SET @@session.gtid_seq_no=4*//*!*/; BEGIN /*!*/; -# at 1049 -# server id 1 end_log_pos 1105 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 1105 -# server id 1 end_log_pos 1173 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F +# at 1056 +# server id 1 end_log_pos 1112 CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at 1112 +# server id 1 end_log_pos 1180 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=11 /* INT meta=0 nullable=0 is_null=0 */ @@ -93,20 +93,20 @@ BEGIN ### @7=6 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */ -# at 1173 -# server id 1 end_log_pos 1246 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +# at 1180 +# server id 1 end_log_pos 1253 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1246 -# server id 1 end_log_pos 1288 CRC32 XXX GTID 0-1-5 +# at 1253 +# server id 1 end_log_pos 1295 CRC32 XXX GTID 0-1-5 /*!100001 SET @@session.gtid_seq_no=5*//*!*/; BEGIN /*!*/; -# at 1288 -# server id 1 end_log_pos 1344 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 1344 -# server id 1 end_log_pos 1411 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F +# at 1295 +# server id 1 end_log_pos 1351 CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at 1351 +# server id 1 end_log_pos 1418 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=12 /* INT meta=0 nullable=0 is_null=0 */ @@ -118,20 +118,20 @@ BEGIN ### @7=6 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ -# at 1411 -# server id 1 end_log_pos 1484 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +# at 1418 +# server id 1 end_log_pos 1491 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1484 -# server id 1 end_log_pos 1526 CRC32 XXX GTID 0-1-6 +# at 1491 +# server id 1 end_log_pos 1533 CRC32 XXX GTID 0-1-6 /*!100001 SET @@session.gtid_seq_no=6*//*!*/; BEGIN /*!*/; -# at 1526 -# server id 1 end_log_pos 1582 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 1582 -# server id 1 end_log_pos 1652 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F +# at 1533 +# server id 1 end_log_pos 1589 CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at 1589 +# server id 1 end_log_pos 1659 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=13 /* INT meta=0 nullable=0 is_null=0 */ @@ -143,20 +143,20 @@ BEGIN ### @7=6 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ -# at 1652 -# server id 1 end_log_pos 1725 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +# at 1659 +# server id 1 end_log_pos 1732 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1725 -# server id 1 end_log_pos 1767 CRC32 XXX GTID 0-1-7 +# at 1732 +# server id 1 end_log_pos 1774 CRC32 XXX GTID 0-1-7 /*!100001 SET @@session.gtid_seq_no=7*//*!*/; BEGIN /*!*/; -# at 1767 -# server id 1 end_log_pos 1823 CRC32 XXX Table_map: `test`.`t2` mapped to number num -# at 1823 -# server id 1 end_log_pos 1990 CRC32 XXX Write_rows: table id 31 flags: STMT_END_F +# at 1774 +# server id 1 end_log_pos 1830 CRC32 XXX Table_map: `test`.`t2` mapped to number num +# at 1830 +# server id 1 end_log_pos 1997 CRC32 XXX Write_rows: table id 31 flags: STMT_END_F ### INSERT INTO `test`.`t2` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -201,20 +201,20 @@ BEGIN ### @7=6 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ -# at 1990 -# server id 1 end_log_pos 2063 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +# at 1997 +# server id 1 end_log_pos 2070 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2063 -# server id 1 end_log_pos 2105 CRC32 XXX GTID 0-1-8 +# at 2070 +# server id 1 end_log_pos 2112 CRC32 XXX GTID 0-1-8 /*!100001 SET @@session.gtid_seq_no=8*//*!*/; BEGIN /*!*/; -# at 2105 -# server id 1 end_log_pos 2161 CRC32 XXX Table_map: `test`.`t2` mapped to number num -# at 2161 -# server id 1 end_log_pos 2235 CRC32 XXX Update_rows: table id 31 flags: STMT_END_F +# at 2112 +# server id 1 end_log_pos 2168 CRC32 XXX Table_map: `test`.`t2` mapped to number num +# at 2168 +# server id 1 end_log_pos 2242 CRC32 XXX Update_rows: table id 31 flags: STMT_END_F ### UPDATE `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -233,20 +233,20 @@ BEGIN ### @5=NULL /* INT meta=0 nullable=1 is_null=1 */ ### SET ### @5=5 /* INT meta=0 nullable=1 is_null=0 */ -# at 2235 -# server id 1 end_log_pos 2308 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +# at 2242 +# server id 1 end_log_pos 2315 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2308 -# server id 1 end_log_pos 2350 CRC32 XXX GTID 0-1-9 +# at 2315 +# server id 1 end_log_pos 2357 CRC32 XXX GTID 0-1-9 /*!100001 SET @@session.gtid_seq_no=9*//*!*/; BEGIN /*!*/; -# at 2350 -# server id 1 end_log_pos 2406 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 2406 -# server id 1 end_log_pos 2460 CRC32 XXX Delete_rows: table id 30 flags: STMT_END_F +# at 2357 +# server id 1 end_log_pos 2413 CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at 2413 +# server id 1 end_log_pos 2467 CRC32 XXX Delete_rows: table id 30 flags: STMT_END_F ### DELETE FROM `test`.`t1` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -259,20 +259,20 @@ BEGIN ### DELETE FROM `test`.`t1` ### WHERE ### @1=13 /* INT meta=0 nullable=0 is_null=0 */ -# at 2460 -# server id 1 end_log_pos 2533 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +# at 2467 +# server id 1 end_log_pos 2540 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2533 -# server id 1 end_log_pos 2575 CRC32 XXX GTID 0-1-10 +# at 2540 +# server id 1 end_log_pos 2582 CRC32 XXX GTID 0-1-10 /*!100001 SET @@session.gtid_seq_no=10*//*!*/; BEGIN /*!*/; -# at 2575 -# server id 1 end_log_pos 2631 CRC32 XXX Table_map: `test`.`t2` mapped to number num -# at 2631 -# server id 1 end_log_pos 2685 CRC32 XXX Delete_rows: table id 31 flags: STMT_END_F +# at 2582 +# server id 1 end_log_pos 2638 CRC32 XXX Table_map: `test`.`t2` mapped to number num +# at 2638 +# server id 1 end_log_pos 2692 CRC32 XXX Delete_rows: table id 31 flags: STMT_END_F ### DELETE FROM `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -285,13 +285,13 @@ BEGIN ### DELETE FROM `test`.`t2` ### WHERE ### @1=13 /* INT meta=0 nullable=0 is_null=0 */ -# at 2685 -# server id 1 end_log_pos 2758 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +# at 2692 +# server id 1 end_log_pos 2765 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2758 -# server id 1 end_log_pos 2806 CRC32 XXX Rotate to master-bin.000002 pos: 4 +# at 2765 +# server id 1 end_log_pos 2813 CRC32 XXX Rotate to master-bin.000002 pos: 4 DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; diff --git a/mysql-test/r/mysqlbinlog_stmt_compressed.result b/mysql-test/r/mysqlbinlog_stmt_compressed.result new file mode 100644 index 00000000000..99f9c7e9914 --- /dev/null +++ b/mysql-test/r/mysqlbinlog_stmt_compressed.result @@ -0,0 +1,207 @@ +SET GLOBAL log_bin_compress=on; +SET GLOBAL log_bin_compress_min_len=10; +CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1)); +CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1)); +INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, ""); +INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL); +INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A"); +INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A"); +INSERT INTO t2 SELECT * FROM t1; +UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL; +DELETE FROM t1; +DELETE FROM t2; +FLUSH BINARY LOGS; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +DELIMITER /*!*/; +# at 4 +# server id 1 end_log_pos 256 CRC32 XXX Start: xxx +ROLLBACK/*!*/; +# at 256 +# server id 1 end_log_pos 285 CRC32 XXX Gtid list [] +# at 285 +# server id 1 end_log_pos 329 CRC32 XXX Binlog checkpoint master-bin.000001 +# at 329 +# server id 1 end_log_pos 371 CRC32 XXX GTID 0-1-1 ddl +/*!100101 SET @@session.skip_parallel_replication=0*//*!*/; +/*!100001 SET @@session.gtid_domain_id=0*//*!*/; +/*!100001 SET @@session.server_id=1*//*!*/; +/*!100001 SET @@session.gtid_seq_no=1*//*!*/; +# at 371 +# server id 1 end_log_pos 533 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0 +use `test`/*!*/; +SET TIMESTAMP=X/*!*/; +SET @@session.pseudo_thread_id=4/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.sql_mode=1342177280/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; +CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1)) +/*!*/; +# at 533 +# server id 1 end_log_pos 575 CRC32 XXX GTID 0-1-2 ddl +/*!100001 SET @@session.gtid_seq_no=2*//*!*/; +# at 575 +# server id 1 end_log_pos 727 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1)) +/*!*/; +# at 727 +# server id 1 end_log_pos 769 CRC32 XXX GTID 0-1-3 +/*!100001 SET @@session.gtid_seq_no=3*//*!*/; +BEGIN +/*!*/; +# at 769 +# server id 1 end_log_pos 897 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "") +/*!*/; +# at 897 +# server id 1 end_log_pos 970 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 970 +# server id 1 end_log_pos 1012 CRC32 XXX GTID 0-1-4 +/*!100001 SET @@session.gtid_seq_no=4*//*!*/; +BEGIN +/*!*/; +# at 1012 +# server id 1 end_log_pos 1140 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL) +/*!*/; +# at 1140 +# server id 1 end_log_pos 1213 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 1213 +# server id 1 end_log_pos 1255 CRC32 XXX GTID 0-1-5 +/*!100001 SET @@session.gtid_seq_no=5*//*!*/; +BEGIN +/*!*/; +# at 1255 +# server id 1 end_log_pos 1385 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A") +/*!*/; +# at 1385 +# server id 1 end_log_pos 1458 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 1458 +# server id 1 end_log_pos 1500 CRC32 XXX GTID 0-1-6 +/*!100001 SET @@session.gtid_seq_no=6*//*!*/; +BEGIN +/*!*/; +# at 1500 +# server id 1 end_log_pos 1627 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A") +/*!*/; +# at 1627 +# server id 1 end_log_pos 1700 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 1700 +# server id 1 end_log_pos 1742 CRC32 XXX GTID 0-1-7 +/*!100001 SET @@session.gtid_seq_no=7*//*!*/; +BEGIN +/*!*/; +# at 1742 +# server id 1 end_log_pos 1850 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +INSERT INTO t2 SELECT * FROM t1 +/*!*/; +# at 1850 +# server id 1 end_log_pos 1923 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 1923 +# server id 1 end_log_pos 1965 CRC32 XXX GTID 0-1-8 +/*!100001 SET @@session.gtid_seq_no=8*//*!*/; +BEGIN +/*!*/; +# at 1965 +# server id 1 end_log_pos 2082 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL +/*!*/; +# at 2082 +# server id 1 end_log_pos 2155 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 2155 +# server id 1 end_log_pos 2197 CRC32 XXX GTID 0-1-9 +/*!100001 SET @@session.gtid_seq_no=9*//*!*/; +BEGIN +/*!*/; +# at 2197 +# server id 1 end_log_pos 2288 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +DELETE FROM t1 +/*!*/; +# at 2288 +# server id 1 end_log_pos 2361 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 2361 +# server id 1 end_log_pos 2403 CRC32 XXX GTID 0-1-10 +/*!100001 SET @@session.gtid_seq_no=10*//*!*/; +BEGIN +/*!*/; +# at 2403 +# server id 1 end_log_pos 2494 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +DELETE FROM t2 +/*!*/; +# at 2494 +# server id 1 end_log_pos 2567 CRC32 XXX Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 2567 +# server id 1 end_log_pos 2615 CRC32 XXX Rotate to master-bin.000002 pos: 4 +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; + +Test mysqlbinlog | mysql type point-in-time recovery with compressed events. + +FLUSH BINARY LOGS; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT, c VARCHAR(100)); +INSERT INTO t3 VALUES (0, 10, "hello"); +BEGIN; +INSERT INTO t3 VALUES (1, 10, "cat"), (2, 10, "mouse"), (3, 10, "dog"); +INSERT INTO t3 VALUES (4, 10, "goodbye"); +COMMIT; +DELETE FROM t3 WHERE a=2; +SELECT * FROM t3 ORDER BY a; +a b c +0 10 hello +1 10 cat +3 10 dog +4 10 goodbye +FLUSH LOGS; +DROP TABLE t3; +SELECT * FROM t3 ORDER BY a; +a b c +0 10 hello +1 10 cat +3 10 dog +4 10 goodbye +DROP TABLE t1,t2,t3; +SET GLOBAL log_bin_compress=off; +SET GLOBAL log_bin_compress_min_len=256; diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result index e498caebb4d..203921ce08f 100644 --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result @@ -344,6 +344,10 @@ The following options may be given as the first argument: We strongly recommend to use either --log-basename or specify a filename to ensure that replication doesn't stop if the real hostname of the computer changes. + --log-bin-compress Whether the binary log can be compressed + --log-bin-compress-min-len[=#] + Minimum length of sql statement(in statement mode) or + record(in row mode)that can be compressed. --log-bin-index=name File that holds the names for last binary log files. --log-bin-trust-function-creators @@ -774,6 +778,9 @@ The following options may be given as the first argument: --range-alloc-block-size=# Allocation block size for storing ranges during optimization + --read-binlog-speed-limit=# + Maximum speed(KB/s) to read binlog from master (0 = no + limit) --read-buffer-size=# Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do @@ -1264,6 +1271,8 @@ lc-time-names en_US local-infile TRUE lock-wait-timeout 31536000 log-bin (No default value) +log-bin-compress FALSE +log-bin-compress-min-len 256 log-bin-index (No default value) log-bin-trust-function-creators FALSE log-error @@ -1374,7 +1383,7 @@ performance-schema-max-rwlock-instances -1 performance-schema-max-socket-classes 10 performance-schema-max-socket-instances -1 performance-schema-max-stage-classes 150 -performance-schema-max-statement-classes 184 +performance-schema-max-statement-classes 185 performance-schema-max-table-handles -1 performance-schema-max-table-instances -1 performance-schema-max-thread-classes 50 @@ -1399,6 +1408,7 @@ query-cache-type OFF query-cache-wlock-invalidate FALSE query-prealloc-size 24576 range-alloc-block-size 4096 +read-binlog-speed-limit 0 read-buffer-size 131072 read-only FALSE read-rnd-buffer-size 262144 diff --git a/mysql-test/r/mysqldump-nl.result b/mysql-test/r/mysqldump-nl.result new file mode 100644 index 00000000000..829bf980103 --- /dev/null +++ b/mysql-test/r/mysqldump-nl.result @@ -0,0 +1,126 @@ +create database `mysqltest1 +1tsetlqsym`; +use `mysqltest1 +1tsetlqsym`; +create table `t1 +1t` (`foobar +raboof` int); +create view `v1 +1v` as select * from `t1 +1t`; +create procedure sp() select * from `v1 +1v`; +flush tables; +use test; + +-- +-- Current Database: `mysqltest1 +-- 1tsetlqsym` +-- + +/*!40000 DROP DATABASE IF EXISTS `mysqltest1 +1tsetlqsym`*/; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1 +1tsetlqsym` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `mysqltest1 +1tsetlqsym`; + +-- +-- Table structure for table `t1 +-- 1t` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1 +1t` ( + `foobar +raboof` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `t1 +-- 1t` +-- + +-- +-- Temporary table structure for view `v1 +-- 1v` +-- + +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `v1 +1v` ( + `foobar +raboof` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Dumping routines for database 'mysqltest1 +-- 1tsetlqsym' +-- +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `sp`() +select * from `v1 +1v` ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Current Database: `mysqltest1 +-- 1tsetlqsym` +-- + +USE `mysqltest1 +1tsetlqsym`; + +-- +-- Final view structure for view `v1 +-- 1v` +-- + +/*!50001 DROP TABLE IF EXISTS `v1 +1v`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v1 +1v` AS select `t1 +1t`.`foobar +raboof` AS `foobar +raboof` from `t1 +1t` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +show tables from `mysqltest1 +1tsetlqsym`; +Tables_in_mysqltest1 +1tsetlqsym +t1 +1t +v1 +1v +drop database `mysqltest1 +1tsetlqsym`; diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 04612e02b7f..dae6aaf776f 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -2086,7 +2086,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like 'a%') */ +/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where `t2`.`a` like 'a%' */ /*!50002 WITH CASCADED CHECK OPTION */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -2254,7 +2254,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like 'a%') */ +/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where `t2`.`a` like 'a%' */ /*!50002 WITH CASCADED CHECK OPTION */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -2388,7 +2388,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v1` AS select `v3`.`a` AS `a`,`v3`.`b` AS `b`,`v3`.`c` AS `c` from `v3` where (`v3`.`b` in (1,2,3,4,5,6,7)) */; +/*!50001 VIEW `v1` AS select `v3`.`a` AS `a`,`v3`.`b` AS `b`,`v3`.`c` AS `c` from `v3` where `v3`.`b` in (1,2,3,4,5,6,7) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -2402,7 +2402,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v2` AS select `v3`.`a` AS `a` from (`v3` join `v1`) where ((`v1`.`a` = `v3`.`a`) and (`v3`.`b` = 3)) limit 1 */; +/*!50001 VIEW `v2` AS select `v3`.`a` AS `a` from (`v3` join `v1`) where `v1`.`a` = `v3`.`a` and `v3`.`b` = 3 limit 1 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -2923,7 +2923,7 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( - `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `d` (`d`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -2960,7 +2960,7 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( - `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `d` (`d`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -3414,7 +3414,7 @@ mysqldump { /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v1` AS select `t`.`qty` AS `qty`,`t`.`price` AS `price`,(`t`.`qty` * `t`.`price`) AS `value` from `t` */; +/*!50001 VIEW `v1` AS select `t`.`qty` AS `qty`,`t`.`price` AS `price`,`t`.`qty` * `t`.`price` AS `value` from `t` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -5254,13 +5254,10 @@ SET @@global.log_output="TABLE"; SET @@global.general_log='OFF'; SET @@global.slow_query_log='OFF'; DROP DATABASE mysql; -Warnings: -Error 1146 Table 'mysql.proc' doesn't exist -Error 1146 Table 'mysql.event' doesn't exist SHOW CREATE TABLE mysql.general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -5270,7 +5267,7 @@ general_log CREATE TABLE `general_log` ( SHOW CREATE TABLE mysql.slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `query_time` time(6) NOT NULL, `lock_time` time(6) NOT NULL, diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 9a5db536893..f8f0b8e379d 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -271,12 +271,6 @@ source database echo message echo message mysqltest: At line 1: Missing argument in exec -1 -1 -2 -2 -X -3 MySQL "MySQL" MySQL: The diff --git a/mysql-test/r/named_pipe.result b/mysql-test/r/named_pipe.result index 85cc6235e75..89b3881eb5d 100644 --- a/mysql-test/r/named_pipe.result +++ b/mysql-test/r/named_pipe.result @@ -1509,7 +1509,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where Warnings: -Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> '')) +Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> '' select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3; companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1) 00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087 diff --git a/mysql-test/r/negation_elimination.result b/mysql-test/r/negation_elimination.result index aea6518b676..1b08baee60a 100644 --- a/mysql-test/r/negation_elimination.result +++ b/mysql-test/r/negation_elimination.result @@ -482,13 +482,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE NOT ((NOT a) XOR (a)); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index NULL a 5 NULL 21 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` xor `test`.`t1`.`a`) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` xor `test`.`t1`.`a` # Should be simplified to "...WHERE (a XOR a) EXPLAIN EXTENDED SELECT * FROM t1 WHERE NOT (a XOR (NOT a)); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index NULL a 5 NULL 21 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` xor `test`.`t1`.`a`) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` xor `test`.`t1`.`a` # End XOR delete from t1 where a > 3; select a, not(not(a)) from t1; @@ -502,5 +502,5 @@ explain extended select a, not(not(a)), not(a <= 2 and not(a)), not(a not like " id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range a a 5 NULL 4 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,(`test`.`t1`.`a` <> 0) AS `not(not(a))`,((`test`.`t1`.`a` > 2) or (`test`.`t1`.`a` <> 0)) AS `not(a <= 2 and not(a))`,(`test`.`t1`.`a` like '1') AS `not(a not like "1")`,(`test`.`t1`.`a` in (1,2)) AS `not (a not in (1,2))`,(`test`.`t1`.`a` = 2) AS `not(a != 2)` from `test`.`t1` where (`test`.`t1`.`a` <> 0) having (`test`.`t1`.`a` <> 0) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a` <> 0 AS `not(not(a))`,`test`.`t1`.`a` > 2 or `test`.`t1`.`a` <> 0 AS `not(a <= 2 and not(a))`,`test`.`t1`.`a` like '1' AS `not(a not like "1")`,`test`.`t1`.`a` in (1,2) AS `not (a not in (1,2))`,`test`.`t1`.`a` = 2 AS `not(a != 2)` from `test`.`t1` where `test`.`t1`.`a` <> 0 having `test`.`t1`.`a` <> 0 drop table t1; diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result index 222ccc809b1..1c88a607541 100644 --- a/mysql-test/r/null.result +++ b/mysql-test/r/null.result @@ -6,7 +6,7 @@ explain extended select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnu id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select NULL AS `NULL`,NULL AS `NULL`,isnull(NULL) AS `isnull(null)`,isnull((1 / 0)) AS `isnull(1/0)`,isnull(((1 / 0) = NULL)) AS `isnull(1/0 = null)`,ifnull(NULL,1) AS `ifnull(null,1)`,ifnull(NULL,'TRUE') AS `ifnull(null,"TRUE")`,ifnull('TRUE','ERROR') AS `ifnull("TRUE","ERROR")`,isnull((1 / 0)) AS `1/0 is null`,(1 is not null) AS `1 is not null` +Note 1003 select NULL AS `NULL`,NULL AS `NULL`,NULL is null AS `isnull(null)`,1 / 0 is null AS `isnull(1/0)`,1 / 0 = NULL is null AS `isnull(1/0 = null)`,ifnull(NULL,1) AS `ifnull(null,1)`,ifnull(NULL,'TRUE') AS `ifnull(null,"TRUE")`,ifnull('TRUE','ERROR') AS `ifnull("TRUE","ERROR")`,1 / 0 is null AS `1/0 is null`,1 is not null AS `1 is not null` select 1 | NULL,1 & NULL,1+NULL,1-NULL; 1 | NULL 1 & NULL 1+NULL 1-NULL NULL NULL NULL NULL @@ -32,7 +32,7 @@ explain extended select 2 between null and 1,2 between 3 AND NULL,NULL between 1 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select (2 between NULL and 1) AS `2 between null and 1`,(2 between 3 and NULL) AS `2 between 3 AND NULL`,(NULL between 1 and 2) AS `NULL between 1 and 2`,(2 between NULL and 3) AS `2 between NULL and 3`,(2 between 1 and NULL) AS `2 between 1 AND null` +Note 1003 select 2 between NULL and 1 AS `2 between null and 1`,2 between 3 and NULL AS `2 between 3 AND NULL`,NULL between 1 and 2 AS `NULL between 1 and 2`,2 between NULL and 3 AS `2 between NULL and 3`,2 between 1 and NULL AS `2 between 1 AND null` SELECT NULL AND NULL, 1 AND NULL, NULL AND 1, NULL OR NULL, 0 OR NULL, NULL OR 0; NULL AND NULL 1 AND NULL NULL AND 1 NULL OR NULL 0 OR NULL NULL OR 0 NULL NULL NULL NULL NULL NULL @@ -1372,7 +1372,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND NULLIF(10.1,a) IS NULL; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 SELECT * FROM t1 WHERE a=2010 AND CASE WHEN 10.1=a THEN NULL ELSE 10.1 END IS NULL; a 2010 @@ -1380,7 +1380,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND CASE WHEN 10.1=a THEN NULL EL id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 DROP TABLE t1; # Two warnings expected CREATE TABLE t1 AS SELECT @@ -1409,7 +1409,7 @@ EXPLAIN EXTENDED SELECT NULLIF(a,_utf8'a' COLLATE utf8_bin) IS NULL AS expr FROM id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Warnings: -Note 1003 select isnull((case when convert(`test`.`t1`.`a` using utf8) = (_utf8'a' collate utf8_bin) then NULL else `test`.`t1`.`a` end)) AS `expr` from `test`.`t1` +Note 1003 select (case when convert(`test`.`t1`.`a` using utf8) = _utf8'a' collate utf8_bin then NULL else `test`.`t1`.`a` end) is null AS `expr` from `test`.`t1` DROP TABLE t1; # # MDEV-8740 Wrong result for SELECT..WHERE year_field=10 AND NULLIF(year_field,2011.1)='2011' @@ -1432,13 +1432,13 @@ SELECT * FROM t1 WHERE a=10 AND NULLIF(a,2011.1)='2011'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 2010) and ((case when 2010 = 2011 then NULL else `test`.`t1`.`a` end) = '2011')) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 and (case when 2010 = 2011 then NULL else `test`.`t1`.`a` end) = '2011' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND NULLIF(a,2011.1)=CONCAT('2011',RAND()); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 2010) and ((case when 2010 = 2011 then NULL else `test`.`t1`.`a` end) = concat('2011',rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 and (case when 2010 = 2011 then NULL else `test`.`t1`.`a` end) = concat('2011',rand()) DROP TABLE t1; # # MDEV-8754 Wrong result for SELECT..WHERE year_field=2020 AND NULLIF(year_field,2010)='2020' @@ -1459,13 +1459,13 @@ SELECT * FROM t1 WHERE a=2020 AND NULLIF(a,2010)='2020'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 2020) and ((case when 2020 = 2010 then NULL else `test`.`t1`.`a` end) = '2020')) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2020 and (case when 2020 = 2010 then NULL else `test`.`t1`.`a` end) = '2020' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2020 AND NULLIF(a,2010)=CONCAT('2020',RAND()); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 2020) and ((case when 2020 = 2010 then NULL else `test`.`t1`.`a` end) = concat('2020',rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2020 and (case when 2020 = 2010 then NULL else `test`.`t1`.`a` end) = concat('2020',rand()) DROP TABLE t1; # # MDEV-9181 (NULLIF(count(table.col)), 0) gives wrong result on 10.1.x @@ -1575,6 +1575,23 @@ SELECT * FROM t1 WHERE NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(N i DROP TABLE t1; # +# MDEV-10347 mysqld got signal 11 +# +CREATE TABLE t1 (f1 VARCHAR(10), f2 VARCHAR(40)); +CREATE TABLE t2 (f3 VARCHAR(20)); +PREPARE stmt FROM " + SELECT ( + SELECT IFNULL(f3,4) FROM t2 + WHERE IFNULL(NULLIF(f1,''),1) + ) AS sq + FROM t1 + GROUP BY f2 +"; +EXECUTE stmt; +sq +DEALLOCATE PREPARE stmt; +DROP TABLE t2,t1; +# # MDEV-10236 Where expression with NOT function gives incorrect result # CREATE TABLE t1 (c1 INT); @@ -1584,7 +1601,7 @@ SELECT * FROM t1 WHERE ((c1 IS NOT NULL) >= (NOT TRUE)) IS NOT NULL; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (((`test`.`t1`.`c1` is not null) >= ((not(1)))) is not null) +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where `test`.`t1`.`c1` is not null >= 0 is not null SELECT * FROM t1 WHERE ((c1 IS NOT NULL) >= (NOT TRUE)) IS NOT NULL; c1 1 diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 262529ef0ce..b4d78ac8347 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -2570,7 +2570,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE r range PRIMARY PRIMARY 4 NULL 12 100.00 Using where; Using index 1 SIMPLE s eq_ref PRIMARY PRIMARY 4 test.r.a 1 100.00 Using index Warnings: -Note 1003 select `test`.`r`.`a` AS `a`,`test`.`s`.`a` AS `a` from `test`.`t1` `r` join `test`.`t1` `s` where ((`test`.`s`.`a` = `test`.`r`.`a`) and ((`test`.`r`.`a` in (2,9)) or ((`test`.`r`.`a` < 100) and (`test`.`r`.`a` <> 0)))) order by 1 limit 10 +Note 1003 select `test`.`r`.`a` AS `a`,`test`.`s`.`a` AS `a` from `test`.`t1` `r` join `test`.`t1` `s` where `test`.`s`.`a` = `test`.`r`.`a` and (`test`.`r`.`a` in (2,9) or `test`.`r`.`a` < 100 and `test`.`r`.`a` <> 0) order by 1 limit 10 SELECT * FROM t1 r JOIN t1 s ON r.a = s.a WHERE s.a IN (2,9) OR s.a < 100 AND s.a != 0 ORDER BY 1 LIMIT 10; @@ -2637,7 +2637,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 5 100.00 Using index 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.i1 1 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`i2` = `test`.`t1`.`i1`) order by `test`.`t1`.`i1` limit 5 +Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`i2` = `test`.`t1`.`i1` order by `test`.`t1`.`i1` limit 5 SELECT t1.*, t2.* FROM t1 JOIN t2 ON t1.i1 = t2.i2 LEFT JOIN t3 ON t2.i2 = t3.i3 ORDER BY t1.i1 LIMIT 5; @@ -2678,28 +2678,28 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Warnings: -Note 1003 select `test`.`t2`.`b` AS `field1` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`a` = `test`.`t1`.`b`) group by `test`.`t2`.`b` order by `test`.`t1`.`b` +Note 1003 select `test`.`t2`.`b` AS `field1` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`b` group by `test`.`t2`.`b` order by `test`.`t1`.`b` explain extended SELECT t2.b, t1.b FROM t1, t2 WHERE t1.b = t2.a GROUP BY t2.b ORDER BY t1.b, t2.b; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Warnings: -Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t1`.`b` AS `b` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`a` = `test`.`t1`.`b`) group by `test`.`t2`.`b` order by `test`.`t1`.`b` +Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t1`.`b` AS `b` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`b` group by `test`.`t2`.`b` order by `test`.`t1`.`b` explain extended SELECT t2.b,t1.b FROM t1, t2 WHERE t1.b = t2.a GROUP BY t2.b ORDER BY t1.b; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Warnings: -Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t1`.`b` AS `b` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`a` = `test`.`t1`.`b`) group by `test`.`t2`.`b` order by `test`.`t1`.`b` +Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t1`.`b` AS `b` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`b` group by `test`.`t2`.`b` order by `test`.`t1`.`b` explain extended SELECT t2.b FROM t1, t2 WHERE t1.b = t2.a GROUP BY t2.b ORDER BY t1.b; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Warnings: -Note 1003 select `test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`a` = `test`.`t1`.`b`) group by `test`.`t2`.`b` order by `test`.`t1`.`b` +Note 1003 select `test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`b` group by `test`.`t2`.`b` order by `test`.`t1`.`b` drop table t1,t2; End of 5.2 tests # diff --git a/mysql-test/r/parser.result b/mysql-test/r/parser.result index 8ebb45b927b..7a0a8667350 100644 --- a/mysql-test/r/parser.result +++ b/mysql-test/r/parser.result @@ -664,6 +664,15 @@ select 0 1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select 1 AS `1` from `test`.`t1` where (`test`.`t1`.`a` > 1) +Note 1003 select 1 AS `1` from `test`.`t1` where `test`.`t1`.`a` > 1 DROP TABLE t1; # # Bug#57778: failed primary key add to partitioned innodb table @@ -94,8 +94,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` int(11) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 2 */ + PARTITION BY KEY (a) +PARTITIONS 2 SELECT * FROM t1; a b 0 1 @@ -187,12 +187,12 @@ t1 CREATE TABLE `t1` ( `new_field0` varchar(50) DEFAULT NULL, PRIMARY KEY (`ID`,`aaaa,aaaaa`,`ddddddddd`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (ID) + PARTITION BY RANGE (ID) SUBPARTITION BY LINEAR KEY (`ID`,`aaaa,aaaaa`) SUBPARTITIONS 2 (PARTITION p01 VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION p11 VALUES LESS THAN (200) ENGINE = MyISAM, - PARTITION p21 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p21 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) drop table t1; CREATE TABLE t1 (a INT, b INT) PARTITION BY LIST (a) @@ -260,14 +260,14 @@ id select_type table partitions type possible_keys key key_len ref rows Extra SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp(), `b` varchar(10) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (UNIX_TIMESTAMP(a)) + PARTITION BY RANGE (UNIX_TIMESTAMP(a)) (PARTITION p1 VALUES LESS THAN (1199134800) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1247688000) ENGINE = MyISAM, - PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) DROP TABLE t1; create table t1 (a int NOT NULL, b varchar(5) NOT NULL) default charset=utf8 @@ -300,7 +300,7 @@ create index i on t1 (a); ERROR 42000: Duplicate key name 'i' create index i2 on t1 (a); Warnings: -Note 1831 Duplicate index 'i2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `i2`. This is deprecated and will be disallowed in a future release drop table t1; CREATE TABLE t1 (a INT, FOREIGN KEY (a) REFERENCES t0 (a)) ENGINE=MyISAM @@ -376,9 +376,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION p0 ENGINE = MEMORY, - PARTITION p1 ENGINE = MEMORY) */ + PARTITION p1 ENGINE = MEMORY) DROP TABLE t1; SET sql_mode=DEFAULT; CREATE TABLE t1 (a INT NOT NULL, KEY(a)) @@ -775,20 +775,20 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) SUBPARTITION BY KEY (a) (PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN (2) ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN (2) ENGINE = MyISAM) alter table t1 reorganize partition p1 into (partition p1 values less than (3)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) SUBPARTITION BY KEY (a) (PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN (3) ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN (3) ENGINE = MyISAM) drop table t1; CREATE TABLE t1 ( a int not null, @@ -807,7 +807,7 @@ t1 CREATE TABLE `t1` ( `c` int(11) NOT NULL, PRIMARY KEY (`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) */ + PARTITION BY KEY (a) drop table t1; CREATE TABLE t1 ( a int not null, @@ -985,8 +985,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION x1 VALUES IN (1) ENGINE = MEMORY) */ + PARTITION BY LIST (a) +(PARTITION x1 VALUES IN (1) ENGINE = MEMORY) drop table t1; CREATE TABLE t1 (a int, unique(a)) PARTITION BY LIST (a) @@ -1011,8 +1011,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) -PARTITIONS 5 */ + PARTITION BY HASH (a) +PARTITIONS 5 drop table t1; CREATE TABLE t1 (a int) PARTITION BY RANGE (a) @@ -1040,10 +1040,10 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION p2 VALUES LESS THAN (30) ENGINE = MyISAM) */ + PARTITION p2 VALUES LESS THAN (30) ENGINE = MyISAM) drop table t1; CREATE TABLE t1 (a int, b int) PARTITION BY RANGE (a) @@ -1065,7 +1065,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION x1 VALUES LESS THAN (6) ENGINE = MyISAM, PARTITION x3 VALUES LESS THAN (8) ENGINE = MyISAM, PARTITION x4 VALUES LESS THAN (10) ENGINE = MyISAM, @@ -1073,7 +1073,7 @@ t1 CREATE TABLE `t1` ( PARTITION x6 VALUES LESS THAN (14) ENGINE = MyISAM, PARTITION x7 VALUES LESS THAN (16) ENGINE = MyISAM, PARTITION x8 VALUES LESS THAN (18) ENGINE = MyISAM, - PARTITION x9 VALUES LESS THAN (20) ENGINE = MyISAM) */ + PARTITION x9 VALUES LESS THAN (20) ENGINE = MyISAM) drop table t1; create table t1 (a int not null, b int not null) partition by LIST (a+b) ( partition p0 values in (12), @@ -1128,36 +1128,36 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, - PARTITION p1 ENGINE = MyISAM) */ + PARTITION p1 ENGINE = MyISAM) alter table t1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, - PARTITION p1 ENGINE = MyISAM) */ + PARTITION p1 ENGINE = MyISAM) alter table t1 engine=myisam; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, - PARTITION p1 ENGINE = MyISAM) */ + PARTITION p1 ENGINE = MyISAM) alter table t1 engine=heap; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, - PARTITION p1 ENGINE = MEMORY) */ + PARTITION p1 ENGINE = MEMORY) alter table t1 remove partitioning; show create table t1; Table Create Table @@ -1175,9 +1175,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, - PARTITION p1 ENGINE = MyISAM) */ + PARTITION p1 ENGINE = MyISAM) alter table t1 add column b int remove partitioning; show create table t1; Table Create Table @@ -1195,9 +1195,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, - PARTITION p1 ENGINE = MyISAM) */ + PARTITION p1 ENGINE = MyISAM) alter table t1 engine=heap partition by key(a) @@ -1208,9 +1208,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, - PARTITION p1 ENGINE = MEMORY) */ + PARTITION p1 ENGINE = MEMORY) alter table t1 engine=myisam, add column c int remove partitioning; show create table t1; Table Create Table @@ -1230,9 +1230,9 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, - PARTITION p1 ENGINE = MEMORY) */ + PARTITION p1 ENGINE = MEMORY) alter table t1 partition by key (a) (partition p0, partition p1); @@ -1243,9 +1243,9 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, - PARTITION p1 ENGINE = MEMORY) */ + PARTITION p1 ENGINE = MEMORY) alter table t1 engine=heap partition by key (a) @@ -1257,9 +1257,9 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, - PARTITION p1 ENGINE = MEMORY) */ + PARTITION p1 ENGINE = MEMORY) alter table t1 partition by key(a) (partition p0, partition p1 engine=heap); @@ -1403,9 +1403,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) -(PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM) */ +(PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM) alter table t1 add partition (partition p1 values less than (200) (subpartition subpart21)); show create table t1; @@ -1413,12 +1413,12 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION p0 VALUES LESS THAN (100) (SUBPARTITION p0sp0 ENGINE = MyISAM), PARTITION p1 VALUES LESS THAN (200) - (SUBPARTITION subpart21 ENGINE = MyISAM)) */ + (SUBPARTITION subpart21 ENGINE = MyISAM)) drop table t1; create table t1 (a int) partition by key (a); @@ -1427,16 +1427,16 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) */ + PARTITION BY KEY (a) alter table t1 add partition (partition p1); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, - PARTITION p1 ENGINE = MyISAM) */ + PARTITION p1 ENGINE = MyISAM) drop table t1; create table t1 (a int, b int) partition by range (a) @@ -1520,9 +1520,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p1 VALUES IN (1) ENGINE = MyISAM, - PARTITION p2 VALUES IN (2) ENGINE = MyISAM) */ + PARTITION p2 VALUES IN (2) ENGINE = MyISAM) drop table t1; create table t1 (a int unsigned not null auto_increment primary key) partition by key(a); @@ -1534,7 +1534,7 @@ t2 CREATE TABLE `t2` ( `c` char(10) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='no comment' -/*!50100 PARTITION BY KEY (a) */ + PARTITION BY KEY (a) drop table t2; create table t1 (f1 int) partition by hash (f1) as select 1; drop table t1; @@ -1731,8 +1731,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (NULL) ENGINE = MyISAM) DROP TABLE t1; CREATE TABLE t1 (a int) PARTITION BY RANGE(a) @@ -1769,8 +1769,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) -/*!50100 PARTITION BY KEY (a) -(PARTITION p0) */ + PARTITION BY KEY (a) +(PARTITION p0) set session sql_mode=''; drop table t1; create table t1 (a int) @@ -1785,7 +1785,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) */ + PARTITION BY KEY (a) drop table t1; CREATE TABLE t1 (a int) ENGINE = MYISAM PARTITION BY KEY(a); INSERT into t1 values (1), (2); @@ -1858,8 +1858,8 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) unsigned NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 10 */ + PARTITION BY KEY (a) +PARTITIONS 10 insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612); select * from t1; @@ -2024,9 +2024,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (b) + PARTITION BY RANGE (b) (PARTITION p1 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p2 VALUES LESS THAN (20) ENGINE = MyISAM) */ + PARTITION p2 VALUES LESS THAN (20) ENGINE = MyISAM) drop table t1, t2; create table t1 (s1 timestamp on update current_timestamp, s2 int) @@ -2164,12 +2164,12 @@ t1 CREATE TABLE `t1` ( `user` char(25) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (id) + PARTITION BY RANGE (id) SUBPARTITION BY HASH (id) SUBPARTITIONS 2 (PARTITION pa1 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION pa2 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION pa11 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION pa11 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) drop table t1; CREATE TABLE t1 ( `ID` bigint(20) NOT NULL AUTO_INCREMENT, diff --git a/mysql-test/r/partition_bug18198.result b/mysql-test/r/partition_bug18198.result index 80f11edaaf6..ee7bf514807 100644 --- a/mysql-test/r/partition_bug18198.result +++ b/mysql-test/r/partition_bug18198.result @@ -130,8 +130,7 @@ ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitio create table t1 (col1 datetime) partition by range(week(col1)) (partition p0 values less than (10), partition p1 values less than (30)); -ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ') -(partition p0 values less than (10), partition p1 values less than (30))' at line 2 +ERROR HY000: This partition function is not allowed create table t1 (col1 varchar(25)) partition by range(cast(col1 as signed)) (partition p0 values less than (10), partition p1 values less than (30)); diff --git a/mysql-test/r/partition_cache_innodb.result b/mysql-test/r/partition_cache_innodb.result index c12ff3588b0..f0e4f83ddb3 100644 --- a/mysql-test/r/partition_cache_innodb.result +++ b/mysql-test/r/partition_cache_innodb.result @@ -23,10 +23,10 @@ t1 CREATE TABLE `t1` ( `created_at` datetime NOT NULL, `cool` tinyint(4) DEFAULT 0 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (TO_DAYS(created_at)) + PARTITION BY RANGE (TO_DAYS(created_at)) (PARTITION month_2010_4 VALUES LESS THAN (734258) ENGINE = InnoDB, PARTITION month_2010_5 VALUES LESS THAN (734289) ENGINE = InnoDB, - PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = InnoDB) INSERT INTO t1 VALUES (1, now(), 0); flush status; show status like "Qcache_queries_in_cache"; @@ -72,12 +72,12 @@ t1 CREATE TABLE `t1` ( `created_at` datetime NOT NULL, `cool` tinyint(4) DEFAULT 0 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (TO_DAYS(created_at)) + PARTITION BY RANGE (TO_DAYS(created_at)) SUBPARTITION BY HASH (cool) SUBPARTITIONS 3 (PARTITION month_2010_4 VALUES LESS THAN (734258) ENGINE = InnoDB, PARTITION month_2010_5 VALUES LESS THAN (734289) ENGINE = InnoDB, - PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = InnoDB) INSERT INTO t1 VALUES (1, now(), 0); flush status; show status like "Qcache_queries_in_cache"; diff --git a/mysql-test/r/partition_cache_myisam.result b/mysql-test/r/partition_cache_myisam.result index d20a8baeab7..2b6c34b1cd9 100644 --- a/mysql-test/r/partition_cache_myisam.result +++ b/mysql-test/r/partition_cache_myisam.result @@ -23,10 +23,10 @@ t1 CREATE TABLE `t1` ( `created_at` datetime NOT NULL, `cool` tinyint(4) DEFAULT 0 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (TO_DAYS(created_at)) + PARTITION BY RANGE (TO_DAYS(created_at)) (PARTITION month_2010_4 VALUES LESS THAN (734258) ENGINE = MyISAM, PARTITION month_2010_5 VALUES LESS THAN (734289) ENGINE = MyISAM, - PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = MyISAM) INSERT INTO t1 VALUES (1, now(), 0); flush status; show status like "Qcache_queries_in_cache"; @@ -72,12 +72,12 @@ t1 CREATE TABLE `t1` ( `created_at` datetime NOT NULL, `cool` tinyint(4) DEFAULT 0 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (TO_DAYS(created_at)) + PARTITION BY RANGE (TO_DAYS(created_at)) SUBPARTITION BY HASH (cool) SUBPARTITIONS 3 (PARTITION month_2010_4 VALUES LESS THAN (734258) ENGINE = MyISAM, PARTITION month_2010_5 VALUES LESS THAN (734289) ENGINE = MyISAM, - PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = MyISAM) INSERT INTO t1 VALUES (1, now(), 0); flush status; show status like "Qcache_queries_in_cache"; diff --git a/mysql-test/r/partition_column.result b/mysql-test/r/partition_column.result index a494656a6a6..06d39771466 100644 --- a/mysql-test/r/partition_column.result +++ b/mysql-test/r/partition_column.result @@ -30,9 +30,9 @@ t1 CREATE TABLE `t1` ( `department` varchar(10) DEFAULT NULL, `country` varchar(255) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY LIST COLUMNS(department,country) + PARTITION BY LIST COLUMNS(department,country) (PARTITION first_office VALUES IN (('dep1','Russia'),('dep1','Croatia')) ENGINE = MyISAM, - PARTITION second_office VALUES IN (('dep2','Russia')) ENGINE = MyISAM) */ + PARTITION second_office VALUES IN (('dep2','Russia')) ENGINE = MyISAM) SELECT * FROM t1 WHERE department = 'dep2' and country = 'Croatia'; id name department country SELECT * FROM t1 WHERE department = 'dep1' and country = 'Croatia'; @@ -173,10 +173,10 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY LIST COLUMNS(a) + PARTITION BY LIST COLUMNS(a) (PARTITION p0 VALUES IN ('''') ENGINE = MyISAM, PARTITION p1 VALUES IN ('\\') ENGINE = MyISAM, - PARTITION p2 VALUES IN ('\0') ENGINE = MyISAM) */ + PARTITION p2 VALUES IN ('\0') ENGINE = MyISAM) drop table t1; set @@sql_mode=allow_invalid_dates; create table t1 (a char, b char, c date) @@ -232,13 +232,13 @@ t1 CREATE TABLE `t1` ( `c` varchar(25) DEFAULT NULL, `d` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY RANGE COLUMNS(a,b,c,d) + PARTITION BY RANGE COLUMNS(a,b,c,d) SUBPARTITION BY HASH (to_seconds(d)) SUBPARTITIONS 4 (PARTITION p0 VALUES LESS THAN (1,'0',MAXVALUE,'1900-01-01') ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1,'a',MAXVALUE,'1999-01-01') ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1,'b',MAXVALUE,MAXVALUE) ENGINE = MyISAM, - PARTITION p3 VALUES LESS THAN (1,MAXVALUE,MAXVALUE,MAXVALUE) ENGINE = MyISAM) */ + PARTITION p3 VALUES LESS THAN (1,MAXVALUE,MAXVALUE,MAXVALUE) ENGINE = MyISAM) drop table t1; create table t1 (a int, b int) partition by range columns (a,b) @@ -315,10 +315,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY LIST COLUMNS(a,b) + PARTITION BY LIST COLUMNS(a,b) (PARTITION p0 VALUES IN ((1,NULL),(2,NULL),(NULL,NULL)) ENGINE = MyISAM, PARTITION p1 VALUES IN ((1,1),(2,2)) ENGINE = MyISAM, - PARTITION p2 VALUES IN ((3,NULL),(NULL,1)) ENGINE = MyISAM) */ + PARTITION p2 VALUES IN ((3,NULL),(NULL,1)) ENGINE = MyISAM) insert into t1 values (3, NULL); insert into t1 values (NULL, 1); insert into t1 values (NULL, NULL); @@ -349,10 +349,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY LIST COLUMNS(a,b) + PARTITION BY LIST COLUMNS(a,b) (PARTITION p0 VALUES IN ((1,NULL),(2,NULL),(NULL,NULL)) ENGINE = MyISAM, PARTITION p1 VALUES IN ((1,1),(2,2)) ENGINE = MyISAM, - PARTITION p2 VALUES IN ((3,NULL),(NULL,1)) ENGINE = MyISAM) */ + PARTITION p2 VALUES IN ((3,NULL),(NULL,1)) ENGINE = MyISAM) drop table t1; create table t1 (a int) partition by list (a) @@ -373,9 +373,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (2,1) ENGINE = MyISAM, - PARTITION p1 VALUES IN (NULL,4,3) ENGINE = MyISAM) */ + PARTITION p1 VALUES IN (NULL,4,3) ENGINE = MyISAM) insert into t1 values (1); insert into t1 values (2); insert into t1 values (3); @@ -403,9 +403,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY LIST COLUMNS(a) + PARTITION BY LIST COLUMNS(a) (PARTITION p0 VALUES IN (2,1) ENGINE = MyISAM, - PARTITION p1 VALUES IN (4,NULL,3) ENGINE = MyISAM) */ + PARTITION p1 VALUES IN (4,NULL,3) ENGINE = MyISAM) insert into t1 values (1); insert into t1 values (2); insert into t1 values (3); @@ -418,9 +418,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY LIST COLUMNS(a) + PARTITION BY LIST COLUMNS(a) (PARTITION p0 VALUES IN (2,1) ENGINE = MyISAM, - PARTITION p1 VALUES IN (4,NULL,3) ENGINE = MyISAM) */ + PARTITION p1 VALUES IN (4,NULL,3) ENGINE = MyISAM) drop table t1; create table t1 (a int, b char(10), c varchar(5), d int) partition by range columns(a,b,c) @@ -453,13 +453,13 @@ t1 CREATE TABLE `t1` ( `c` varchar(5) DEFAULT NULL, `d` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY RANGE COLUMNS(a,b,c) + PARTITION BY RANGE COLUMNS(a,b,c) SUBPARTITION BY KEY (c,d) SUBPARTITIONS 3 (PARTITION p0 VALUES LESS THAN (1,'abc','abc') ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (2,'abc','abc') ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (3,'abc','abc') ENGINE = MyISAM, - PARTITION p3 VALUES LESS THAN (4,'abc','abc') ENGINE = MyISAM) */ + PARTITION p3 VALUES LESS THAN (4,'abc','abc') ENGINE = MyISAM) insert into t1 values (1,'a','b',1),(2,'a','b',2),(3,'a','b',3); insert into t1 values (1,'b','c',1),(2,'b','c',2),(3,'b','c',3); insert into t1 values (1,'c','d',1),(2,'c','d',2),(3,'c','d',3); @@ -486,9 +486,9 @@ t1 CREATE TABLE `t1` ( `b` varchar(2) DEFAULT NULL, `c` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY RANGE COLUMNS(a,b,c) + PARTITION BY RANGE COLUMNS(a,b,c) (PARTITION p0 VALUES LESS THAN (1,'A',1) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN (1,'B',1) ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN (1,'B',1) ENGINE = MyISAM) insert into t1 values (1, 'A', 1); explain partitions select * from t1 where a = 1 AND b <= 'A' and c = 1; id select_type table partitions type possible_keys key key_len ref rows Extra diff --git a/mysql-test/r/partition_datatype.result b/mysql-test/r/partition_datatype.result index fa58df3dec3..31d265d95ee 100644 --- a/mysql-test/r/partition_datatype.result +++ b/mysql-test/r/partition_datatype.result @@ -329,10 +329,10 @@ t1 CREATE TABLE `t1` ( `a` bit(27) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM, - PARTITION p2 ENGINE = MyISAM) */ + PARTITION p2 ENGINE = MyISAM) insert into t1 values (1),(4),(7),(10),(13),(16),(19),(22),(25),(28),(31),(34); select hex(a) from t1 where a = 7; hex(a) @@ -850,7 +850,7 @@ t2 CREATE TABLE `t2` ( `a` timestamp NULL DEFAULT NULL, `tz` varchar(16) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (UNIX_TIMESTAMP(a)) + PARTITION BY RANGE (UNIX_TIMESTAMP(a)) (PARTITION p0 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `p-2000` VALUES LESS THAN (946684800) ENGINE = MyISAM, PARTITION `p-2011-MSK` VALUES LESS THAN (1301180400) ENGINE = MyISAM, @@ -859,7 +859,7 @@ t2 CREATE TABLE `t2` ( PARTITION `p-2012-MSK-1` VALUES LESS THAN (1319932800) ENGINE = MyISAM, PARTITION `p-2012-MSK-2` VALUES LESS THAN (1332630000) ENGINE = MyISAM, PARTITION pEnd VALUES LESS THAN (2147483647) ENGINE = MyISAM, - PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) TRUNCATE TABLE t2; SET @@session.time_zone = 'Europe/Moscow'; INSERT INTO t2 SELECT * FROM t1; @@ -1334,7 +1334,7 @@ t2 CREATE TABLE `t2` ( `a` timestamp NULL DEFAULT NULL, `tz` varchar(16) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (UNIX_TIMESTAMP(a)) + PARTITION BY RANGE (UNIX_TIMESTAMP(a)) (PARTITION p0 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `p-2000` VALUES LESS THAN (946684800) ENGINE = MyISAM, PARTITION `p-2011-MSK` VALUES LESS THAN (1301180400) ENGINE = MyISAM, @@ -1343,7 +1343,7 @@ t2 CREATE TABLE `t2` ( PARTITION `p-2012-MSK-1` VALUES LESS THAN (1319932800) ENGINE = MyISAM, PARTITION `p-2012-MSK-2` VALUES LESS THAN (1332630000) ENGINE = MyISAM, PARTITION pEnd VALUES LESS THAN (2147483647) ENGINE = MyISAM, - PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) TRUNCATE TABLE t2; DROP TABLE t1, t2; SET @@session.time_zone= @old_time_zone; diff --git a/mysql-test/r/partition_debug_sync.result b/mysql-test/r/partition_debug_sync.result index 971bc63e2e7..b79385686b7 100644 --- a/mysql-test/r/partition_debug_sync.result +++ b/mysql-test/r/partition_debug_sync.result @@ -64,29 +64,3 @@ disconnect con1; connection default; SET DEBUG_SYNC= 'RESET'; End of 5.1 tests -# -# Coverage test for non pruned ha_partition::store_lock() -# -CREATE TABLE t1 (a int) ENGINE = InnoDB; -CREATE TABLE t2 (a int PRIMARY KEY) -ENGINE = InnoDB PARTITION BY HASH (a) PARTITIONS 3; -HANDLER t1 OPEN; -connect con1, localhost, root,,; -LOCK TABLES t1 WRITE, t2 READ; -connection default; -SET DEBUG_SYNC="wait_for_lock SIGNAL locking"; -INSERT INTO t2 VALUES (1), (2), (3); -connection con1; -SET DEBUG_SYNC="now WAIT_FOR locking"; -ALTER TABLE t1 ADD COLUMN b int; -connection default; -ERROR HY000: Wait on a lock was aborted due to a pending exclusive lock -SELECT 1; -1 -1 -connection con1; -UNLOCK TABLES; -disconnect con1; -connection default; -SET DEBUG_SYNC = 'RESET'; -DROP TABLE t1, t2; diff --git a/mysql-test/r/partition_default.result b/mysql-test/r/partition_default.result index fcf16ba7ccf..2833d92de32 100644 --- a/mysql-test/r/partition_default.result +++ b/mysql-test/r/partition_default.result @@ -22,10 +22,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p2 VALUES IN (4,5,6) ENGINE = MyISAM, PARTITION p1 VALUES IN (1) ENGINE = MyISAM, - PARTITION p0 DEFAULT ENGINE = MyISAM) */ + PARTITION p0 DEFAULT ENGINE = MyISAM) insert into t1 values (10,10); insert into t1 values (4,4); select * from t1; @@ -72,10 +72,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 DEFAULT ENGINE = MyISAM, PARTITION p2 VALUES IN (4,5,6) ENGINE = MyISAM, - PARTITION p1 VALUES IN (1) ENGINE = MyISAM) */ + PARTITION p1 VALUES IN (1) ENGINE = MyISAM) insert into t1 values (10,10); select * from t1; a b @@ -100,10 +100,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 DEFAULT ENGINE = MyISAM, PARTITION p2 VALUES IN (4,5,6) ENGINE = MyISAM, - PARTITION p1 VALUES IN (1,0) ENGINE = MyISAM) */ + PARTITION p1 VALUES IN (1,0) ENGINE = MyISAM) insert into t1 values (10,10); select * from t1; a b @@ -128,10 +128,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY LIST COLUMNS(a,b) + PARTITION BY LIST COLUMNS(a,b) (PARTITION p2 VALUES IN ((1,4),(2,5),(3,6)) ENGINE = MyISAM, PARTITION p1 VALUES IN ((1,1),(0,0)) ENGINE = MyISAM, - PARTITION p0 DEFAULT ENGINE = MyISAM) */ + PARTITION p0 DEFAULT ENGINE = MyISAM) insert into t1 values (10,10); select * from t1; a b @@ -176,10 +176,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p2 VALUES IN (4,5,6) ENGINE = MyISAM, PARTITION p1 VALUES IN (1,20) ENGINE = MyISAM, - PARTITION p0 DEFAULT ENGINE = MyISAM) */ + PARTITION p0 DEFAULT ENGINE = MyISAM) insert into t1 values (10,10); select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1'; partition_name table_rows @@ -256,10 +256,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY LIST COLUMNS(a,b) + PARTITION BY LIST COLUMNS(a,b) (PARTITION p2 VALUES IN ((1,4),(2,5),(3,6),(5,5)) ENGINE = MyISAM, PARTITION p1 VALUES IN ((1,1),(20,20)) ENGINE = MyISAM, - PARTITION p0 DEFAULT ENGINE = MyISAM) */ + PARTITION p0 DEFAULT ENGINE = MyISAM) insert into t1 values (10,10); select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1'; partition_name table_rows @@ -325,10 +325,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a+b) + PARTITION BY LIST (a+b) (PARTITION p2 VALUES IN (1,2,3,7) ENGINE = MyISAM, PARTITION p1 VALUES IN (21,0) ENGINE = MyISAM, - PARTITION p0 DEFAULT ENGINE = MyISAM) */ + PARTITION p0 DEFAULT ENGINE = MyISAM) select * from t1; a b 2 5 @@ -362,10 +362,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a+5) + PARTITION BY LIST (a+5) (PARTITION p2 VALUES IN (1,2,3,7) ENGINE = MyISAM, PARTITION p1 VALUES IN (0) ENGINE = MyISAM, - PARTITION p0 DEFAULT ENGINE = MyISAM) */ + PARTITION p0 DEFAULT ENGINE = MyISAM) select * from t1; a b 2 5 @@ -832,10 +832,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p2 VALUES IN (1,2,3) ENGINE = MyISAM, PARTITION p1 VALUES IN (20,0) ENGINE = MyISAM, - PARTITION p0 DEFAULT ENGINE = MyISAM) */ + PARTITION p0 DEFAULT ENGINE = MyISAM) select * from t1; a b 2 5 @@ -866,10 +866,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p2 VALUES IN (1,2,3) ENGINE = MyISAM, PARTITION p1 VALUES IN (20,0) ENGINE = MyISAM, - PARTITION p0 VALUES IN (10) ENGINE = MyISAM) */ + PARTITION p0 VALUES IN (10) ENGINE = MyISAM) select * from t1; a b 2 5 @@ -900,10 +900,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p2 DEFAULT ENGINE = MyISAM, PARTITION p1 VALUES IN (20,0) ENGINE = MyISAM, - PARTITION p0 VALUES IN (10) ENGINE = MyISAM) */ + PARTITION p0 VALUES IN (10) ENGINE = MyISAM) select * from t1; a b 2 5 @@ -930,9 +930,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p1 VALUES IN (20,0) ENGINE = MyISAM, - PARTITION p0 VALUES IN (10) ENGINE = MyISAM) */ + PARTITION p0 VALUES IN (10) ENGINE = MyISAM) select * from t1; a b 0 0 @@ -948,10 +948,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p1 VALUES IN (20,0) ENGINE = MyISAM, PARTITION p0 VALUES IN (10) ENGINE = MyISAM, - PARTITION pd DEFAULT ENGINE = MyISAM) */ + PARTITION pd DEFAULT ENGINE = MyISAM) alter table t1 add partition (PARTITION pdd DEFAULT); ERROR HY000: Only one DEFAULT partition allowed alter table t1 drop partition pd; @@ -980,10 +980,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY LIST COLUMNS(a,b) + PARTITION BY LIST COLUMNS(a,b) (PARTITION p2 VALUES IN ((1,4),(2,5),(3,6)) ENGINE = MyISAM, PARTITION p1 VALUES IN ((1,1),(0,0)) ENGINE = MyISAM, - PARTITION p0 DEFAULT ENGINE = MyISAM) */ + PARTITION p0 DEFAULT ENGINE = MyISAM) select * from t1; a b 2 5 @@ -1014,10 +1014,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY LIST COLUMNS(a,b) + PARTITION BY LIST COLUMNS(a,b) (PARTITION p2 VALUES IN ((1,4),(2,5),(3,6)) ENGINE = MyISAM, PARTITION p1 VALUES IN ((1,1),(0,0)) ENGINE = MyISAM, - PARTITION p0 VALUES IN ((10,10)) ENGINE = MyISAM) */ + PARTITION p0 VALUES IN ((10,10)) ENGINE = MyISAM) select * from t1; a b 2 5 @@ -1048,10 +1048,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY LIST COLUMNS(a,b) + PARTITION BY LIST COLUMNS(a,b) (PARTITION p2 DEFAULT ENGINE = MyISAM, PARTITION p1 VALUES IN ((1,1),(0,0)) ENGINE = MyISAM, - PARTITION p0 VALUES IN ((10,10)) ENGINE = MyISAM) */ + PARTITION p0 VALUES IN ((10,10)) ENGINE = MyISAM) select * from t1; a b 2 5 @@ -1078,9 +1078,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY LIST COLUMNS(a,b) + PARTITION BY LIST COLUMNS(a,b) (PARTITION p1 VALUES IN ((1,1),(0,0)) ENGINE = MyISAM, - PARTITION p0 VALUES IN ((10,10)) ENGINE = MyISAM) */ + PARTITION p0 VALUES IN ((10,10)) ENGINE = MyISAM) select * from t1; a b 0 0 @@ -1096,10 +1096,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY LIST COLUMNS(a,b) + PARTITION BY LIST COLUMNS(a,b) (PARTITION p1 VALUES IN ((1,1),(0,0)) ENGINE = MyISAM, PARTITION p0 VALUES IN ((10,10)) ENGINE = MyISAM, - PARTITION pd DEFAULT ENGINE = MyISAM) */ + PARTITION pd DEFAULT ENGINE = MyISAM) alter table t1 add partition (PARTITION pdd DEFAULT); ERROR HY000: Only one DEFAULT partition allowed alter table t1 drop partition pd; @@ -1144,10 +1144,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY LIST COLUMNS(a,b) + PARTITION BY LIST COLUMNS(a,b) (PARTITION p0 DEFAULT ENGINE = MyISAM, PARTITION p2 VALUES IN ((1,4),(2,5),(3,6)) ENGINE = MyISAM, - PARTITION p1 VALUES IN ((1,1),(0,0)) ENGINE = MyISAM) */ + PARTITION p1 VALUES IN ((1,1),(0,0)) ENGINE = MyISAM) drop table t1; # # MDEV-10765: Wrong result - query does not retrieve values from diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result index f05b145053d..eeea5215218 100644 --- a/mysql-test/r/partition_error.result +++ b/mysql-test/r/partition_error.result @@ -781,9 +781,9 @@ t1 CREATE TABLE `t1` ( `id` int(11) DEFAULT NULL, `purchased` date DEFAULT NULL ) ENGINE= DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (YEAR(purchased)) + PARTITION BY RANGE (YEAR(purchased)) SUBPARTITION BY HASH (TO_DAYS(purchased)) -(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = ) */ +(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = ) DROP TABLE t1; CREATE TABLE t1 (id INT, purchased DATE) PARTITION BY RANGE(YEAR(purchased)) @@ -802,11 +802,11 @@ t1 CREATE TABLE `t1` ( `id` int(11) DEFAULT NULL, `purchased` date DEFAULT NULL ) ENGINE= DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (YEAR(purchased)) + PARTITION BY RANGE (YEAR(purchased)) SUBPARTITION BY HASH (TO_DAYS(purchased)) (PARTITION p0 VALUES LESS THAN MAXVALUE (SUBPARTITION sp0 ENGINE = , - SUBPARTITION sp1 ENGINE = )) */ + SUBPARTITION sp1 ENGINE = )) DROP TABLE t1; CREATE TABLE t1 (id INT, purchased DATE) PARTITION BY RANGE(YEAR(purchased)) @@ -822,8 +822,8 @@ t1 CREATE TABLE `t1` ( `id` int(11) DEFAULT NULL, `purchased` date DEFAULT NULL ) ENGINE= DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (YEAR(purchased)) -(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = ) */ + PARTITION BY RANGE (YEAR(purchased)) +(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = ) DROP TABLE t1; SET @@sql_mode= @org_mode; CREATE TABLE t1 (a INTEGER NOT NULL, PRIMARY KEY (a)); @@ -1783,14 +1783,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) SUBPARTITION BY HASH (a) (PARTITION p1 VALUES IN (1) (SUBPARTITION p1spFirst COMMENT = 'SubPartition comment in p1spFirst' ENGINE = MyISAM, SUBPARTITION p1spSecond COMMENT = 'SubPartition comment in p1spSecond' ENGINE = MyISAM), PARTITION p2 VALUES IN (2) (SUBPARTITION p2spFirst COMMENT = 'SubPartition comment in p2spFirst' ENGINE = MyISAM, - SUBPARTITION p2spSecond COMMENT = 'SubPartition comment in p2spSecond' ENGINE = MyISAM)) */ + SUBPARTITION p2spSecond COMMENT = 'SubPartition comment in p2spSecond' ENGINE = MyISAM)) SELECT PARTITION_NAME, SUBPARTITION_NAME, PARTITION_COMMENT FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test'; PARTITION_NAME SUBPARTITION_NAME PARTITION_COMMENT @@ -1813,14 +1813,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) SUBPARTITION BY HASH (a) (PARTITION p1 VALUES IN (1) (SUBPARTITION p1spFirst COMMENT = 'SubPartition comment in p1spFirst' ENGINE = MyISAM, SUBPARTITION p1spSecond ENGINE = MyISAM), PARTITION p2 VALUES IN (2) (SUBPARTITION p2spFirst COMMENT = 'Comment in p2' ENGINE = MyISAM, - SUBPARTITION p2spSecond COMMENT = 'SubPartition comment in p2spSecond' ENGINE = MyISAM)) */ + SUBPARTITION p2spSecond COMMENT = 'SubPartition comment in p2spSecond' ENGINE = MyISAM)) SELECT PARTITION_NAME, SUBPARTITION_NAME, PARTITION_COMMENT FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test'; PARTITION_NAME SUBPARTITION_NAME PARTITION_COMMENT @@ -1849,14 +1849,14 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, KEY `inx_a` (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION pUpTo10 VALUES LESS THAN (10) (SUBPARTITION `p-10sp0` COMMENT = 'This is a long comment (2050 ascii characters) 50 pUpTo10 partition ......80-!.................. 100 ................................................................................................ 200....................................................................................................................................................................................................................................................................................................... 500 ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... 1000 ..............1024-|' ENGINE = MyISAM, SUBPARTITION `p-10sp1` COMMENT = 'This is a long comment (2050 ascii characters) 50 pUpTo10 partition ......80-!.................. 100 ................................................................................................ 200....................................................................................................................................................................................................................................................................................................... 500 ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... 1000 ..............1024-|' ENGINE = MyISAM), PARTITION pMax VALUES LESS THAN MAXVALUE (SUBPARTITION pMaxsp0 COMMENT = 'This is a long comment (2050 ascii characters) 50 pMax partition comment .80-!.................. 100 ................................................................................................ 200....................................................................................................................................................................................................................................................................................................... 500 ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... 1000 ..............1024-|' ENGINE = MyISAM, - SUBPARTITION pMaxsp1 COMMENT = 'This is a long comment (2050 ascii characters) 50 pMax partition comment .80-!.................. 100 ................................................................................................ 200....................................................................................................................................................................................................................................................................................................... 500 ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... 1000 ..............1024-|' ENGINE = MyISAM)) */ + SUBPARTITION pMaxsp1 COMMENT = 'This is a long comment (2050 ascii characters) 50 pMax partition comment .80-!.................. 100 ................................................................................................ 200....................................................................................................................................................................................................................................................................................................... 500 ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... 1000 ..............1024-|' ENGINE = MyISAM)) SELECT PARTITION_NAME, SUBPARTITION_NAME, PARTITION_COMMENT FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test'; PARTITION_NAME SUBPARTITION_NAME PARTITION_COMMENT diff --git a/mysql-test/r/partition_example.result b/mysql-test/r/partition_example.result index 2129eea0818..9e1a4ccdad9 100644 --- a/mysql-test/r/partition_example.result +++ b/mysql-test/r/partition_example.result @@ -8,9 +8,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL ) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (1) ENGINE = EXAMPLE, - PARTITION p1 VALUES IN (2) ENGINE = EXAMPLE) */ + PARTITION p1 VALUES IN (2) ENGINE = EXAMPLE) drop table t1; create table t1 (a int not null) engine=example ull=12340 @@ -21,9 +21,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL ) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=12340 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (1) ENGINE = EXAMPLE, - PARTITION p1 VALUES IN (2) ENGINE = EXAMPLE) */ + PARTITION p1 VALUES IN (2) ENGINE = EXAMPLE) drop table t1; select 1; 1 diff --git a/mysql-test/r/partition_exchange.result b/mysql-test/r/partition_exchange.result index 0f6ac2cf480..f7b2d7647ff 100644 --- a/mysql-test/r/partition_exchange.result +++ b/mysql-test/r/partition_exchange.result @@ -28,8 +28,8 @@ Create Table CREATE TABLE `t1` ( `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT -/*!50100 PARTITION BY HASH (id) -PARTITIONS 2 */ + PARTITION BY HASH (id) +PARTITIONS 2 SHOW CREATE TABLE t2; Table t2 Create Table CREATE TABLE `t2` ( @@ -64,8 +64,8 @@ Create Table CREATE TABLE `t1` ( `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT -/*!50100 PARTITION BY HASH (id) -PARTITIONS 2 */ + PARTITION BY HASH (id) +PARTITIONS 2 SHOW CREATE TABLE t2; Table t2 Create Table CREATE TABLE `t2` ( @@ -112,8 +112,8 @@ Create Table CREATE TABLE `t1` ( `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT -/*!50100 PARTITION BY HASH (id) -PARTITIONS 2 */ + PARTITION BY HASH (id) +PARTITIONS 2 SHOW CREATE TABLE t2; Table t2 Create Table CREATE TABLE `t2` ( @@ -172,8 +172,8 @@ Create Table CREATE TABLE `t1` ( `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (id) -PARTITIONS 2 */ + PARTITION BY HASH (id) +PARTITIONS 2 SHOW CREATE TABLE t2; Table t2 Create Table CREATE TABLE `t2` ( @@ -232,8 +232,8 @@ Create Table CREATE TABLE `t1` ( `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (id) -PARTITIONS 2 */ + PARTITION BY HASH (id) +PARTITIONS 2 SHOW CREATE TABLE t2; Table t2 Create Table CREATE TABLE `t2` ( @@ -292,8 +292,8 @@ Create Table CREATE TABLE `t1` ( `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT -/*!50100 PARTITION BY HASH (id) -PARTITIONS 2 */ + PARTITION BY HASH (id) +PARTITIONS 2 SHOW CREATE TABLE t2; Table t2 Create Table CREATE TABLE `t2` ( @@ -349,8 +349,8 @@ Create Table CREATE TABLE `t1` ( `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (id) -PARTITIONS 2 */ + PARTITION BY HASH (id) +PARTITIONS 2 SHOW CREATE TABLE t2; Table t2 Create Table CREATE TABLE `t2` ( @@ -406,8 +406,8 @@ Create Table CREATE TABLE `t1` ( `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT -/*!50100 PARTITION BY HASH (id) -PARTITIONS 2 */ + PARTITION BY HASH (id) +PARTITIONS 2 SHOW CREATE TABLE t2; Table t2 Create Table CREATE TABLE `t2` ( @@ -496,9 +496,9 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t; a b 1 First value @@ -534,9 +534,9 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t; a b 10 Ten @@ -594,9 +594,9 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t; a b 1 First value @@ -650,9 +650,9 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SHOW CREATE TABLE tsp; Table Create Table tsp CREATE TABLE `tsp` ( @@ -660,14 +660,14 @@ tsp CREATE TABLE `tsp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION p0 VALUES LESS THAN (100) (SUBPARTITION sp0 ENGINE = MyISAM, SUBPARTITION sp1 ENGINE = MyISAM), PARTITION p1 VALUES LESS THAN MAXVALUE (SUBPARTITION sp2 ENGINE = MyISAM, - SUBPARTITION sp3 ENGINE = MyISAM)) */ + SUBPARTITION sp3 ENGINE = MyISAM)) SELECT * FROM t; a b 1 First value @@ -704,9 +704,9 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t; a b 10 Ten @@ -742,9 +742,9 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t; a b 1 First value @@ -781,14 +781,14 @@ tsp CREATE TABLE `tsp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION p0 VALUES LESS THAN (100) (SUBPARTITION sp0 ENGINE = MyISAM, SUBPARTITION sp1 ENGINE = MyISAM), PARTITION p1 VALUES LESS THAN MAXVALUE (SUBPARTITION sp2 ENGINE = MyISAM, - SUBPARTITION sp3 ENGINE = MyISAM)) */ + SUBPARTITION sp3 ENGINE = MyISAM)) SELECT * FROM t; a b 61 Sixty one @@ -826,9 +826,9 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t; a b 1 First value @@ -864,9 +864,9 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t; a b 10 Ten @@ -905,9 +905,9 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MariaDB SHOW CREATE TABLE t; @@ -924,9 +924,9 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) # Test different charsets ALTER TABLE t ENGINE = MyISAM; CREATE TABLE tmp LIKE t; @@ -957,9 +957,9 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; ERROR HY000: Non matching attribute 'MAX_ROWS' between partition and table SHOW WARNINGS; @@ -988,9 +988,9 @@ tp CREATE TABLE `tp` ( PRIMARY KEY (`a`), KEY `ba_key` (`b`,`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t; a b 10 Ten @@ -1047,9 +1047,9 @@ tp CREATE TABLE `tp` ( PRIMARY KEY (`a`), KEY `ba_key` (`b`,`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; ERROR HY000: Table to exchange with partition is temporary: 't' SHOW CREATE TABLE t; @@ -1068,9 +1068,9 @@ tp CREATE TABLE `tp` ( PRIMARY KEY (`a`), KEY `ba_key` (`b`,`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) DROP TEMPORARY TABLE t; ALTER TABLE tmp2 RENAME TO t; # Test non partitioned table diff --git a/mysql-test/r/partition_explicit_prune.result b/mysql-test/r/partition_explicit_prune.result index 0cf9bde225c..1a3f5029978 100644 --- a/mysql-test/r/partition_explicit_prune.result +++ b/mysql-test/r/partition_explicit_prune.result @@ -202,7 +202,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`a`), KEY `b` (`b`,`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION pNeg VALUES LESS THAN (0) (SUBPARTITION subp0 ENGINE = InnoDB, @@ -215,7 +215,7 @@ SUBPARTITION BY HASH (a) SUBPARTITION subp5 ENGINE = InnoDB), PARTITION `p100-99999` VALUES LESS THAN (100000) (SUBPARTITION subp6 ENGINE = InnoDB, - SUBPARTITION subp7 ENGINE = InnoDB)) */ + SUBPARTITION subp7 ENGINE = InnoDB)) # First test that the syntax is OK SHOW CREATE TABLE t1 PARTITION (subp0); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PARTITION (subp0)' at line 1 @@ -1125,7 +1125,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`a`), KEY `b` (`b`,`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION pNeg VALUES LESS THAN (0) (SUBPARTITION subp0 ENGINE = InnoDB, @@ -1138,7 +1138,7 @@ SUBPARTITION BY HASH (a) SUBPARTITION subp5 ENGINE = InnoDB), PARTITION `p100-99999` VALUES LESS THAN (100000) (SUBPARTITION subp6 ENGINE = InnoDB, - SUBPARTITION subp7 ENGINE = InnoDB)) */ + SUBPARTITION subp7 ENGINE = InnoDB)) SELECT * FROM t1; a b -4 (pNeg-)subp0, Updated, Updated2, Updated from a = -2 @@ -1157,7 +1157,7 @@ t2 CREATE TABLE `t2` ( PRIMARY KEY (`a`), KEY `b` (`b`,`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION pNeg VALUES LESS THAN (0) (SUBPARTITION subp0 ENGINE = InnoDB, @@ -1170,7 +1170,7 @@ SUBPARTITION BY HASH (a) SUBPARTITION subp5 ENGINE = InnoDB), PARTITION `p100-99999` VALUES LESS THAN (100000) (SUBPARTITION subp6 ENGINE = InnoDB, - SUBPARTITION subp7 ENGINE = InnoDB)) */ + SUBPARTITION subp7 ENGINE = InnoDB)) SELECT * FROM t2; a b 10 p10-99 @@ -1657,7 +1657,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`a`), KEY `b` (`b`,`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION pNeg VALUES LESS THAN (0) (SUBPARTITION subp0 ENGINE = InnoDB, @@ -1678,7 +1678,7 @@ SUBPARTITION BY HASH (a) PARTITION `p3000-299999` VALUES LESS THAN (300000) (SUBPARTITION subp12 ENGINE = InnoDB, SUBPARTITION subp13 ENGINE = InnoDB, - SUBPARTITION subp14 ENGINE = InnoDB)) */ + SUBPARTITION subp14 ENGINE = InnoDB)) INSERT INTO t1 VALUES (-9, "negative nine"), (-8, "-8"), (-7, "-7"), (-6, "-6"), (-5, "-5"), (-4, "-4"), (-3, "-3"), (-2, "-2"), (-1, "-1"); INSERT INTO t1 VALUES (9, "nine"), (8, "8"), (7, "7"), (6, "6"), (5, "5"), (4, "4"), (3, "3"), (2, "2"), (1, "1"); INSERT INTO t1 VALUES (39, "Thirty nine"), (38, "38"), (37, "37"), (36, "36"), (35, "35"), (34, "34"), (33, "33"), (32, "32"), (31, "31"); diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result index df0bab4a6b4..c40669fd17b 100644 --- a/mysql-test/r/partition_innodb.result +++ b/mysql-test/r/partition_innodb.result @@ -446,7 +446,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) */ + PARTITION BY KEY (a) drop table t1; create table t1 (a int) engine = innodb @@ -460,8 +460,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0) ENGINE = InnoDB) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0) ENGINE = InnoDB) drop table t1; SET SQL_MODE=default; create table t1 @@ -539,10 +539,10 @@ t1 CREATE TABLE `t1` ( `int_column` int(11) DEFAULT NULL, `char_column` char(5) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (int_column) + PARTITION BY RANGE (int_column) SUBPARTITION BY KEY (char_column) SUBPARTITIONS 2 -(PARTITION p1 VALUES LESS THAN (5) ENGINE = MyISAM) */ +(PARTITION p1 VALUES LESS THAN (5) ENGINE = MyISAM) drop table t1; CREATE TABLE t1 (a INT) ENGINE=InnoDB PARTITION BY list(a) (PARTITION p1 VALUES IN (1)); @@ -587,8 +587,8 @@ t1 CREATE TABLE `t1` ( `b` int(11) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 2 */ + PARTITION BY KEY (a) +PARTITIONS 2 SELECT * FROM t1; a b 1 2 @@ -616,7 +616,7 @@ c INT, PRIMARY KEY (c,a), KEY (a),KEY (a) ) ENGINE=INNODB PARTITION BY KEY () PARTITIONS 2; Warnings: -Note 1831 Duplicate index 'a_2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a_2`. This is deprecated and will be disallowed in a future release INSERT INTO t1 VALUES (1,5,1),(2,4,1),(3,3,1),(4,2,1),(5,1,1); UPDATE t1 SET b = 0, c=1 WHERE a <=>0; SELECT * FROM t1; diff --git a/mysql-test/r/partition_innodb_plugin.result b/mysql-test/r/partition_innodb_plugin.result index 16b5daad620..cd5dfade0ab 100644 --- a/mysql-test/r/partition_innodb_plugin.result +++ b/mysql-test/r/partition_innodb_plugin.result @@ -29,9 +29,9 @@ t1 CREATE TABLE `t1` ( `id2` bigint(20) NOT NULL, PRIMARY KEY (`id`,`time`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 -/*!50100 PARTITION BY RANGE (TO_DAYS(time)) + PARTITION BY RANGE (TO_DAYS(time)) (PARTITION p10 VALUES LESS THAN (734708) ENGINE = InnoDB, - PARTITION p20 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p20 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) DROP TABLE t1; call mtr.add_suppression("InnoDB: Error: table `test`.`t1` .* InnoDB internal"); # @@ -62,8 +62,8 @@ t1 CREATE TABLE `t1` ( `user_num` char(10) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4 -/*!50100 PARTITION BY HASH (id) -PARTITIONS 1 */ + PARTITION BY HASH (id) +PARTITIONS 1 SET GLOBAL innodb_file_per_table = OFF; disconnect con1; connect con2,localhost,root,,; @@ -100,8 +100,8 @@ t1 CREATE TABLE `t1` ( `user_num` char(10) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4 -/*!50100 PARTITION BY HASH (id) -PARTITIONS 3 */ + PARTITION BY HASH (id) +PARTITIONS 3 DROP TABLE t1; disconnect con2; connection default; diff --git a/mysql-test/r/partition_mgm.result b/mysql-test/r/partition_mgm.result index 2ff6e3f1923..2acaf7356ef 100644 --- a/mysql-test/r/partition_mgm.result +++ b/mysql-test/r/partition_mgm.result @@ -24,8 +24,8 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) -PARTITIONS 2 */ + PARTITION BY HASH (YEAR(f_date)) +PARTITIONS 2 ALTER TABLE t1 COALESCE PARTITION 1; SHOW CREATE TABLE t1; Table Create Table @@ -33,8 +33,8 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) -PARTITIONS 1 */ + PARTITION BY HASH (YEAR(f_date)) +PARTITIONS 1 drop table t1; create table t1 (a int) partition by list (a) @@ -58,8 +58,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) -PARTITIONS 5 */ + PARTITION BY HASH (a) +PARTITIONS 5 DROP TABLE t1; CREATE TABLE t1 (a INT) /*!50100 PARTITION BY HASH (a) @@ -70,8 +70,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) -PARTITIONS 5 */ + PARTITION BY HASH (a) +PARTITIONS 5 DROP TABLE t1; CREATE TABLE t1 (a INT) /*!50100 PARTITION BY HASH (a) @@ -81,8 +81,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) -PARTITIONS 5 */ + PARTITION BY HASH (a) +PARTITIONS 5 DROP TABLE t1; CREATE TABLE t1 (a INT) /*!50100 PARTITION BY HASH (a) PARTITIONS 5 */; SHOW CREATE TABLE t1; @@ -90,6 +90,6 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) -PARTITIONS 5 */ + PARTITION BY HASH (a) +PARTITIONS 5 DROP TABLE t1; diff --git a/mysql-test/r/partition_mgm_err.result b/mysql-test/r/partition_mgm_err.result index cbf45a2b7be..9cfe0594a0c 100644 --- a/mysql-test/r/partition_mgm_err.result +++ b/mysql-test/r/partition_mgm_err.result @@ -145,8 +145,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 2 */ + PARTITION BY KEY (a) +PARTITIONS 2 DROP TABLE t1; CREATE TABLE t1 (a INT) PARTITION BY HASH(a); ALTER TABLE t1 ADD PARTITION PARTITIONS 4; diff --git a/mysql-test/r/partition_myisam.result b/mysql-test/r/partition_myisam.result index bb1a7b19a9d..f9f917a2803 100644 --- a/mysql-test/r/partition_myisam.result +++ b/mysql-test/r/partition_myisam.result @@ -27,10 +27,10 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CHECKSUM=1 -/*!50100 PARTITION BY RANGE (i) + PARTITION BY RANGE (i) (PARTITION p3 VALUES LESS THAN (3) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN (5) ENGINE = MyISAM, - PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) DROP TABLE t1; # Same test without partitioning CREATE TABLE t1 ( @@ -131,7 +131,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`a`) ) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) */ + PARTITION BY KEY (a) INSERT INTO t1 VALUES (NULL); SELECT * FROM t1; a diff --git a/mysql-test/r/partition_not_windows.result b/mysql-test/r/partition_not_windows.result index a1da9af675b..afde7977961 100644 --- a/mysql-test/r/partition_not_windows.result +++ b/mysql-test/r/partition_not_windows.result @@ -31,8 +31,8 @@ Table Create Table t2 CREATE TABLE `t2` ( `i` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (i) -(PARTITION p01 VALUES LESS THAN (1000) ENGINE = MyISAM) */ + PARTITION BY RANGE (i) +(PARTITION p01 VALUES LESS THAN (1000) ENGINE = MyISAM) DROP TABLE t1, t2; set @@sql_mode=@org_mode; CREATE TABLE t1(a INT) diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result index fe19473f8e4..0fb24b74218 100644 --- a/mysql-test/r/partition_pruning.result +++ b/mysql-test/r/partition_pruning.result @@ -2872,7 +2872,7 @@ explain extended select * from t2 where b = 6; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ref b b 5 const 96 100.00 Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = 6) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = 6 explain partitions select * from t2 where b = 6; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 96 @@ -2880,7 +2880,7 @@ explain extended select * from t2 where b in (1,3,5); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL b NULL NULL NULL 910 51.65 Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` in (1,3,5)) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (1,3,5) explain partitions select * from t2 where b in (1,3,5); id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where @@ -2888,7 +2888,7 @@ explain extended select * from t2 where b in (2,4,6); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL b NULL NULL NULL 910 31.65 Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` in (2,4,6)) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (2,4,6) explain partitions select * from t2 where b in (2,4,6); id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where @@ -2896,7 +2896,7 @@ explain extended select * from t2 where b in (7,8,9); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL b NULL NULL NULL 910 19.12 Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` in (7,8,9)) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (7,8,9) explain partitions select * from t2 where b in (7,8,9); id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where @@ -2904,7 +2904,7 @@ explain extended select * from t2 where b > 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL b NULL NULL NULL 910 29.23 Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` > 5) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5 explain partitions select * from t2 where b > 5; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where @@ -2912,7 +2912,7 @@ explain extended select * from t2 where b > 5 and b < 8; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL b NULL NULL NULL 910 28.13 Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where ((`test`.`t2`.`b` > 5) and (`test`.`t2`.`b` < 8)) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5 and `test`.`t2`.`b` < 8 explain partitions select * from t2 where b > 5 and b < 8; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where @@ -2920,7 +2920,7 @@ explain extended select * from t2 where b > 5 and b < 7; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 range b b 5 NULL 96 100.00 Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where ((`test`.`t2`.`b` > 5) and (`test`.`t2`.`b` < 7)) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5 and `test`.`t2`.`b` < 7 explain partitions select * from t2 where b > 5 and b < 7; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 range b b 5 NULL 96 Using where @@ -2928,7 +2928,7 @@ explain extended select * from t2 where b > 0 and b < 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL b NULL NULL NULL 910 53.19 Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where ((`test`.`t2`.`b` > 0) and (`test`.`t2`.`b` < 5)) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 0 and `test`.`t2`.`b` < 5 explain partitions select * from t2 where b > 0 and b < 5; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where diff --git a/mysql-test/r/partition_range.result b/mysql-test/r/partition_range.result index 339f2209cb3..94c727f6339 100644 --- a/mysql-test/r/partition_range.result +++ b/mysql-test/r/partition_range.result @@ -22,9 +22,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY RANGE (TO_DAYS(a)) + PARTITION BY RANGE (TO_DAYS(a)) SUBPARTITION BY HASH (to_seconds(a)) -(PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM) */ +(PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM) drop table t1; create table t1 (a int) partition by range (a) @@ -62,9 +62,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY RANGE (TO_SECONDS(a)) + PARTITION BY RANGE (TO_SECONDS(a)) (PARTITION p0 VALUES LESS THAN (63340531200) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN (63342604800) ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN (63342604800) ENGINE = MyISAM) drop table t1; create table t1 (a date) partition by range(to_seconds(a)) @@ -93,9 +93,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY RANGE (to_seconds(a)) + PARTITION BY RANGE (to_seconds(a)) (PARTITION p0 VALUES LESS THAN (63240134400) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN (63271756800) ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN (63271756800) ENGINE = MyISAM) drop table t1; create table t1 (a datetime) partition by range(to_seconds(a)) @@ -123,9 +123,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY RANGE (to_seconds(a)) + PARTITION BY RANGE (to_seconds(a)) (PARTITION p0 VALUES LESS THAN (63240177600) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN (63271800000) ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN (63271800000) ENGINE = MyISAM) drop table t1; create table t1 (a int, b char(20)) partition by range columns(a,b) @@ -153,8 +153,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) -(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION BY RANGE (a) +(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) drop table t1; create table t1 (a integer) partition by range (a) @@ -284,10 +284,10 @@ t1 CREATE TABLE `t1` ( `c` int(11) NOT NULL, PRIMARY KEY (`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION x1 VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM, PARTITION x2 VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM, - PARTITION x3 VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM) */ + PARTITION x3 VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM) ALTER TABLE t1 partition by range (a) partitions 3 @@ -308,10 +308,10 @@ t1 CREATE TABLE `t1` ( `c` int(11) NOT NULL, PRIMARY KEY (`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION x1 VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM, PARTITION x2 VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM, - PARTITION x3 VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM) */ + PARTITION x3 VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM) drop table if exists t1; CREATE TABLE t1 ( a int not null, @@ -409,14 +409,14 @@ t1 CREATE TABLE `t1` ( `c` int(11) NOT NULL, PRIMARY KEY (`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) SUBPARTITION BY HASH (a+b) (PARTITION x1 VALUES LESS THAN (1) (SUBPARTITION x11 ENGINE = MyISAM, SUBPARTITION x12 ENGINE = MyISAM), PARTITION x2 VALUES LESS THAN (5) (SUBPARTITION x21 ENGINE = MyISAM, - SUBPARTITION x22 ENGINE = MyISAM)) */ + SUBPARTITION x22 ENGINE = MyISAM)) ALTER TABLE t1 ADD COLUMN d int; show create table t1; Table Create Table @@ -427,14 +427,14 @@ t1 CREATE TABLE `t1` ( `d` int(11) DEFAULT NULL, PRIMARY KEY (`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) SUBPARTITION BY HASH (a+b) (PARTITION x1 VALUES LESS THAN (1) (SUBPARTITION x11 ENGINE = MyISAM, SUBPARTITION x12 ENGINE = MyISAM), PARTITION x2 VALUES LESS THAN (5) (SUBPARTITION x21 ENGINE = MyISAM, - SUBPARTITION x22 ENGINE = MyISAM)) */ + SUBPARTITION x22 ENGINE = MyISAM)) drop table t1; CREATE TABLE t1 ( a int not null, @@ -658,9 +658,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) unsigned DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (0) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN (10) ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN (10) ENGINE = MyISAM) drop table t1; create table t1 (a bigint unsigned) partition by range (a) @@ -671,9 +671,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) unsigned DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (2) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN (10) ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN (10) ENGINE = MyISAM) insert into t1 values (0xFFFFFFFFFFFFFFFF); ERROR HY000: Table has no partition for value 18446744073709551615 drop table t1; diff --git a/mysql-test/r/partition_symlink.result b/mysql-test/r/partition_symlink.result index 387717ab7e7..3f175bb7534 100644 --- a/mysql-test/r/partition_symlink.result +++ b/mysql-test/r/partition_symlink.result @@ -22,10 +22,10 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM, PARTITION p1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM, - PARTITION p2 VALUES IN (2) ENGINE = MyISAM) */ + PARTITION p2 VALUES IN (2) ENGINE = MyISAM) SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -158,8 +158,8 @@ Table Create Table t2 CREATE TABLE `t2` ( `i` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (i) -(PARTITION p01 VALUES LESS THAN (1000) ENGINE = MyISAM) */ + PARTITION BY RANGE (i) +(PARTITION p01 VALUES LESS THAN (1000) ENGINE = MyISAM) DROP TABLE t1, t2; set @@sql_mode=@org_mode; create table t1 (a int) diff --git a/mysql-test/r/partition_utf8.result b/mysql-test/r/partition_utf8.result index 339871f1f4a..c359980be51 100644 --- a/mysql-test/r/partition_utf8.result +++ b/mysql-test/r/partition_utf8.result @@ -7,8 +7,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(2) CHARACTER SET cp1250 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY LIST COLUMNS(a) -(PARTITION p0 VALUES IN (_cp1250 0x81) ENGINE = MyISAM) */ + PARTITION BY LIST COLUMNS(a) +(PARTITION p0 VALUES IN (_cp1250 0x81) ENGINE = MyISAM) drop table t1; create table t1 (a varchar(2) character set cp1250) partition by list columns (a) @@ -18,8 +18,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(2) CHARACTER SET cp1250 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY LIST COLUMNS(a) -(PARTITION p0 VALUES IN ('€') ENGINE = MyISAM) */ + PARTITION BY LIST COLUMNS(a) +(PARTITION p0 VALUES IN ('€') ENGINE = MyISAM) drop table t1; create table t1 (a varchar(1500), b varchar(1570)) partition by list columns(a,b) @@ -45,9 +45,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(2) CHARACTER SET ucs2 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY LIST COLUMNS(a) + PARTITION BY LIST COLUMNS(a) (PARTITION p0 VALUES IN ('†') ENGINE = MyISAM, - PARTITION p1 VALUES IN ('') ENGINE = MyISAM) */ + PARTITION p1 VALUES IN ('') ENGINE = MyISAM) insert into t1 values (''); insert into t1 values (_ucs2 0x2020); drop table t1; diff --git a/mysql-test/r/plugin_auth.result b/mysql-test/r/plugin_auth.result index 436db33af36..8bb360e96ae 100644 --- a/mysql-test/r/plugin_auth.result +++ b/mysql-test/r/plugin_auth.result @@ -27,7 +27,7 @@ proxies_priv CREATE TABLE `proxies_priv` ( `Proxied_user` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', `With_grant` tinyint(1) NOT NULL DEFAULT 0, `Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`Host`,`User`,`Proxied_host`,`Proxied_user`), KEY `Grantor` (`Grantor`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User proxy privileges' diff --git a/mysql-test/r/pool_of_threads.result b/mysql-test/r/pool_of_threads.result index f2e08b12359..f5cef38a904 100644 --- a/mysql-test/r/pool_of_threads.result +++ b/mysql-test/r/pool_of_threads.result @@ -1510,7 +1510,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where Warnings: -Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> '')) +Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> '' select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3; companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1) 00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087 diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 7e7a20ca9e6..5b7d4b6fa7f 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -1783,7 +1783,7 @@ prepare stmt from "create view v1 (c) as select b+1 from t1"; execute stmt; show create view v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`b` + 1 AS `c` from `t1` latin1 latin1_swedish_ci select * from v1; c drop view v1; @@ -1791,7 +1791,7 @@ execute stmt; deallocate prepare stmt; show create view v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`b` + 1 AS `c` from `t1` latin1 latin1_swedish_ci select * from v1; c drop view v1; @@ -1799,7 +1799,7 @@ prepare stmt from "create view v1 (c,d,e,f) as select a,b,a in (select a+2 from execute stmt; show create view v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select (`t1`.`a` + 2) from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select `t1`.`a` + 2 from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci select * from v1; c d e f drop view v1; @@ -1807,7 +1807,7 @@ execute stmt; deallocate prepare stmt; show create view v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select (`t1`.`a` + 2) from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select `t1`.`a` + 2 from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci select * from v1; c d e f drop view v1; @@ -1853,7 +1853,7 @@ prepare stmt from "create view v1 (x) as select a from t1 where a > 1"; execute stmt; show create view v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `x` from `t1` where (`t1`.`a` > 1) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `x` from `t1` where `t1`.`a` > 1 latin1 latin1_swedish_ci select * from v1; x drop view v1; @@ -1861,7 +1861,7 @@ execute stmt; deallocate prepare stmt; show create view v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `x` from `t1` where (`t1`.`a` > 1) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `x` from `t1` where `t1`.`a` > 1 latin1 latin1_swedish_ci select * from v1; x drop view v1; @@ -4067,9 +4067,9 @@ DROP TABLE t1, t2; # CREATE TABLE t1 (a INT); PREPARE stmt FROM "SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1"; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '18446744073709551615 + 1' SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '18446744073709551615 + 1' drop table t1; # End of 5.3 tests # @@ -4092,4 +4092,658 @@ id value deallocate prepare stmt; SET SESSION sql_mode = @save_sql_mode; DROP TABLE t1,t2; -# End of 10.0 tests +# +# MDEV-8833: Crash of server on prepared statement with +# conversion to semi-join +# +CREATE TABLE t1 (column1 INT); +INSERT INTO t1 VALUES (3),(9); +CREATE TABLE t2 (column2 INT); +INSERT INTO t2 VALUES (1),(4); +CREATE TABLE t3 (column3 INT); +INSERT INTO t3 VALUES (6),(8); +CREATE TABLE t4 (column4 INT); +INSERT INTO t4 VALUES (2),(5); +PREPARE stmt FROM "SELECT ( SELECT MAX( table1.column1 ) AS field1 +FROM t1 AS table1 +WHERE table3.column3 IN ( SELECT table2.column2 AS field2 FROM t2 AS table2 ) +) AS sq +FROM t3 AS table3, t4 AS table4"; +EXECUTE stmt; +sq +NULL +NULL +NULL +NULL +EXECUTE stmt; +sq +NULL +NULL +NULL +NULL +deallocate prepare stmt; +drop table t1,t2,t3,t4; +# End of 5.5 tests +# +# Start of 10.2 tests +# +# +# MDEV-10709 Expressions as parameters to Dynamic SQL +# +# +# Using a simple expressions as an EXECUTE parameter +# +PREPARE stmt FROM 'SELECT ? FROM DUAL'; +EXECUTE stmt USING 10; +? +10 +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM 'SELECT ? FROM DUAL'; +EXECUTE stmt USING TO_BASE64('xxx'); +? +eHh4 +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM 'SELECT ?+? FROM DUAL'; +EXECUTE stmt USING 10, 10 + 10; +?+? +30 +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM 'SELECT CONCAT(?,?) FROM DUAL'; +EXECUTE stmt USING 'xxx', CONCAT('yyy','zzz'); +CONCAT(?,?) +xxxyyyzzz +DEALLOCATE PREPARE stmt; +# +# Testing disallowed expressions in USING +# +PREPARE stmt FROM 'SELECT ? FROM DUAL'; +EXECUTE stmt USING (SELECT 1); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1)' at line 1 +DEALLOCATE PREPARE stmt; +CREATE FUNCTION f1() RETURNS VARCHAR(10) RETURN 'test'; +PREPARE stmt FROM 'SELECT ? FROM DUAL'; +EXECUTE stmt USING f1(); +ERROR 42000: EXECUTE..USING does not support subqueries or stored functions +DEALLOCATE PREPARE stmt; +DROP FUNCTION f1; +# +# Testing erroneous expressions in USING +# +PREPARE stmt FROM 'SELECT ?'; +EXECUTE stmt USING _latin1'a'=_latin2'a'; +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation '=' +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM 'SELECT ?'; +EXECUTE stmt USING ROW(1,2); +ERROR 21000: Operand should contain 1 column(s) +DEALLOCATE PREPARE stmt; +# +# Creating tables from EXECUTE parameters +# +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ? AS c1 FROM DUAL'; +EXECUTE stmt USING 10; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` bigint(21) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE stmt USING 10.123; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` decimal(5,3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE stmt USING 10.123e0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` double NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE stmt USING CURRENT_DATE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE stmt USING CURRENT_TIMESTAMP; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE stmt USING CURRENT_TIMESTAMP(3); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` datetime(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE stmt USING CURRENT_TIMESTAMP(6); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` datetime(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE stmt USING CURRENT_TIME; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` time DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE stmt USING CURRENT_TIME(3); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` time(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE stmt USING CURRENT_TIME(6); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` time(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +DEALLOCATE PREPARE stmt; +# +# Using a user variable as an EXECUTE..USING out parameter +# +CREATE PROCEDURE p1(OUT a INT) +BEGIN +SET a:= 10; +END; +/ +SET @a=1; +CALL p1(@a); +SELECT @a; +@a +10 +SET @a=2; +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING @a; +SELECT @a; +@a +10 +DROP PROCEDURE p1; +# +# Using an SP variable as an EXECUTE..USING out parameter +# +CREATE PROCEDURE p1 (OUT a INT) +BEGIN +SET a=10; +END; +/ +CREATE PROCEDURE p2 (OUT a INT) +BEGIN +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING a; +END; +/ +SET @a= 1; +CALL p2(@a); +SELECT @a; +@a +10 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +# +# Testing re-prepare on a table metadata update between PREPARE and EXECUTE +# +CREATE TABLE t1 (a INT); +CREATE PROCEDURE p1(a INT) +BEGIN +INSERT INTO t1 VALUES (a); +END; +/ +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING 10; +SELECT * FROM t1; +a +10 +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=NEW.a+1; +EXECUTE stmt USING 20; +SELECT * FROM t1; +a +10 +21 +DEALLOCATE PREPARE stmt; +DROP PROCEDURE p1; +DROP TABLE t1; +# +# End of MDEV-10709 Expressions as parameters to Dynamic SQL +# +# +# MDEV-10585 EXECUTE IMMEDIATE statement +# +EXECUTE IMMEDIATE 'SELECT 1 AS a'; +a +1 +SET @a=10; +EXECUTE IMMEDIATE 'SELECT ? AS a' USING @a; +a +10 +EXECUTE IMMEDIATE 'SELECT ? AS a' USING 20; +a +20 +# +# Erroneous queries +# +EXECUTE IMMEDIATE 'xxx'; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'xxx' at line 1 +EXECUTE IMMEDIATE 'SELECT 1' USING @a; +ERROR HY000: Incorrect arguments to EXECUTE +EXECUTE IMMEDIATE 'SELECT ?'; +ERROR HY000: Incorrect arguments to EXECUTE +EXECUTE IMMEDIATE 'EXECUTE IMMEDIATE "SELECT 1"'; +ERROR HY000: This command is not supported in the prepared statement protocol yet +EXECUTE IMMEDIATE 'PREPARE stmt FROM "SELECT 1"'; +ERROR HY000: This command is not supported in the prepared statement protocol yet +EXECUTE IMMEDIATE 'EXECUTE stmt'; +ERROR HY000: This command is not supported in the prepared statement protocol yet +EXECUTE IMMEDIATE 'DEALLOCATE PREPARE stmt'; +ERROR HY000: This command is not supported in the prepared statement protocol yet +EXECUTE IMMEDIATE 'SELECT ?' USING _latin1'a'=_latin2'a'; +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation '=' +EXECUTE IMMEDIATE 'SELECT ?' USING ROW(1,2); +ERROR 21000: Operand should contain 1 column(s) +# +# Testing disallowed expressions in USING +# +EXECUTE IMMEDIATE 'SELECT ? FROM DUAL' USING (SELECT 1); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1)' at line 1 +CREATE FUNCTION f1() RETURNS VARCHAR(10) RETURN 'test'; +EXECUTE IMMEDIATE 'SELECT ? FROM DUAL' USING f1(); +ERROR 42000: EXECUTE..USING does not support subqueries or stored functions +DROP FUNCTION f1; +# +# DDL +# +EXECUTE IMMEDIATE 'CREATE TABLE t1 (a INT)'; +EXECUTE IMMEDIATE 'SHOW CREATE TABLE t1'; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +EXECUTE IMMEDIATE 'DROP TABLE t1'; +SET @stmt= 'CREATE TABLE t1 (a INT)'; +EXECUTE IMMEDIATE @stmt; +SET @stmt= 'SHOW CREATE TABLE t1'; +EXECUTE IMMEDIATE @stmt; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SET @stmt= 'DROP TABLE t1'; +EXECUTE IMMEDIATE @stmt; +# +# DDL with parameters +# +SET @a= 10, @b= 10.1, @c= 10e0, @d='str'; +EXECUTE IMMEDIATE +'CREATE TABLE t1 AS SELECT ? AS a,? AS b,? AS c,? AS d' + USING @a,@b,@c,@d; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(21) NOT NULL, + `b` decimal(3,1) DEFAULT NULL, + `c` double NOT NULL, + `d` varchar(3) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE IMMEDIATE +'CREATE TABLE t1 AS SELECT ? AS a,? AS b,? AS c,? AS d' + USING 10, 10.1, 10e0, 'str'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(21) NOT NULL, + `b` decimal(3,1) DEFAULT NULL, + `c` double NOT NULL, + `d` varchar(3) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE IMMEDIATE +'CREATE TABLE t1 AS SELECT ? AS t1,? AS t2, ? AS d1,? AS dt1, ? AS dt2' + USING TIME'10:20:30', +TIME'10:20:30.123', +DATE'2001-01-01', +TIMESTAMP'2001-01-01 10:20:30', +TIMESTAMP'2001-01-01 10:20:30.123'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `t1` time DEFAULT NULL, + `t2` time(3) DEFAULT NULL, + `d1` date DEFAULT NULL, + `dt1` datetime DEFAULT NULL, + `dt2` datetime(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# Using a user variable as an EXECUTE IMMEDIATE..USING out parameter +# +CREATE PROCEDURE p1(OUT a INT) +BEGIN +SET a:= 10; +END; +/ +SET @a=1; +CALL p1(@a); +SELECT @a; +@a +10 +SET @a=2; +EXECUTE IMMEDIATE 'CALL p1(?)' USING @a; +SELECT @a; +@a +10 +DROP PROCEDURE p1; +# +# Using an SP variable as an EXECUTE IMMEDIATE..USING out parameter +# +CREATE PROCEDURE p1 (OUT a INT) +BEGIN +SET a=10; +END; +/ +CREATE PROCEDURE p2 (OUT a INT) +BEGIN +EXECUTE IMMEDIATE 'CALL p1(?)' USING a; +END; +/ +SET @a= 1; +CALL p2(@a); +SELECT @a; +@a +10 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +# +# Changing user variables +# +SET @a=10; +EXECUTE IMMEDIATE 'SET @a=@a+1'; +SELECT @a; +@a +11 +# +# SET STATEMENT +# +SET @@max_sort_length=1024; +EXECUTE IMMEDIATE 'SET STATEMENT max_sort_length=1025 FOR SELECT @@max_sort_length'; +@@max_sort_length +1025 +SELECT @@max_sort_length; +@@max_sort_length +1024 +SET @@max_sort_length=DEFAULT; +# +# Similar to prepared EXECUTE, IMMEDIATE is not allowed in stored functions +# +CREATE FUNCTION f1() RETURNS INT +BEGIN +EXECUTE IMMEDIATE 'DO 1'; +RETURN 1; +END; +$$ +ERROR 0A000: Dynamic SQL is not allowed in stored function or trigger +# +# Status variables +# +CREATE FUNCTION get_status_var(name TEXT) RETURNS INT +RETURN (SELECT CAST(VARIABLE_VALUE AS INT) +FROM INFORMATION_SCHEMA.SESSION_STATUS +WHERE VARIABLE_NAME=name); +CREATE PROCEDURE test_status_var(name TEXT) +BEGIN +SET @cnt0=get_status_var(name); +EXECUTE IMMEDIATE 'DO 1'; +SET @cnt1=get_status_var(name); +SELECT @cnt1-@cnt0 AS increment; +END; +$$ +# Note, EXECUTE IMMEDIATE does not increment COM_EXECUTE_SQL +# It increments COM_EXECUTE_IMMEDIATE instead. +CALL test_status_var('COM_EXECUTE_SQL'); +increment +0 +CALL test_status_var('COM_EXECUTE_IMMEDIATE'); +increment +1 +CALL test_status_var('COM_STMT_PREPARE'); +increment +1 +CALL test_status_var('COM_STMT_EXECUTE'); +increment +1 +CALL test_status_var('COM_STMT_CLOSE'); +increment +1 +DROP PROCEDURE test_status_var; +DROP FUNCTION get_status_var; +# +# End of MDEV-10585 EXECUTE IMMEDIATE statement +# +# +# MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions +# +# +# Testing erroneous and diallowed prepare source +# +EXECUTE IMMEDIATE CONCAT(_latin1'SELECT 1 AS c FROM ', _latin2 'DUAL'); +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'concat' +PREPARE stmt FROM CONCAT(_latin1'SELECT 1 AS c FROM ', _latin2 'DUAL'); +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'concat' +EXECUTE IMMEDIATE (SELECT 'SELECT 1'); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 'SELECT 1')' at line 1 +PREPARE stmt FROM (SELECT 'SELECT 1'); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 'SELECT 1')' at line 1 +EXECUTE IMMEDIATE a; +ERROR 42S22: Unknown column 'a' in 'field list' +PREPARE stmt FROM a; +ERROR 42S22: Unknown column 'a' in 'field list' +EXECUTE IMMEDIATE NULL; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1 +PREPARE stmt FROM NULL; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1 +EXECUTE IMMEDIATE CONCAT(NULL); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1 +PREPARE stmt FROM CONCAT(NULL); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1 +EXECUTE IMMEDIATE ? USING 'SELECT 1'; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '? USING 'SELECT 1'' at line 1 +EXECUTE IMMEDIATE 10; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '10' at line 1 +EXECUTE IMMEDIATE TIME'10:20:30'; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '10:20:30' at line 1 +EXECUTE IMMEDIATE ROW('SELECT 1','SELECT 2'); +ERROR 21000: Operand should contain 1 column(s) +EXECUTE IMMEDIATE MAX('SELECT 1 AS c'); +ERROR HY000: Invalid use of group function +EXECUTE IMMEDIATE DEFAULT(a); +ERROR 42S22: Unknown column 'a' in 'field list' +EXECUTE IMMEDIATE VALUES(a); +ERROR 42S22: Unknown column 'a' in 'field list' +CREATE FUNCTION f1() RETURNS VARCHAR(64) RETURN 't1'; +EXECUTE IMMEDIATE f1(); +ERROR 42000: EXECUTE IMMEDIATE does not support subqueries or stored functions +PREPARE stmt FROM f1(); +ERROR 42000: PREPARE..FROM does not support subqueries or stored functions +DROP FUNCTION f1; +EXECUTE IMMEDIATE non_existent(); +ERROR 42000: EXECUTE IMMEDIATE does not support subqueries or stored functions +# +# Testing literals in prepare source +# +EXECUTE IMMEDIATE N'SELECT 1 AS c'; +c +1 +EXECUTE IMMEDIATE _latin1'SELECT 1 AS c'; +c +1 +EXECUTE IMMEDIATE 'SELECT ' '1' ' AS c' ' FROM ' 'DUAL'; +c +1 +EXECUTE IMMEDIATE 0x53454C4543542031 /*This is 'SELECT 1'*/; +1 +1 +# +# Testing user variables in prepare source +# +SET @stmt='SELECT 1 AS c FROM DUAL'; +EXECUTE IMMEDIATE @stmt; +c +1 +PREPARE stmt FROM @stmt; +EXECUTE stmt; +c +1 +DEALLOCATE PREPARE stmt; +SET @table_name='DUAL'; +EXECUTE IMMEDIATE CONCAT('SELECT 1 AS a FROM ', @table_name); +a +1 +PREPARE stmt FROM CONCAT('SELECT 1 AS a FROM ', @table_name); +EXECUTE stmt; +a +1 +DEALLOCATE PREPARE stmt; +# +# Testing SP parameters and variables in prepare source +# +CREATE PROCEDURE p1(table_name VARCHAR(64)) +BEGIN +EXECUTE IMMEDIATE CONCAT('SELECT 1 AS c FROM ', table_name); +END; +$$ +CALL p1('DUAL'); +c +1 +DROP PROCEDURE p1; +CREATE PROCEDURE p1() +BEGIN +DECLARE table_name VARCHAR(64) DEFAULT 'DUAL'; +EXECUTE IMMEDIATE CONCAT('SELECT 1 AS c FROM ', table_name); +END; +$$ +CALL p1(); +c +1 +DROP PROCEDURE p1; +# +# Testing complex expressions +# +EXECUTE IMMEDIATE CONVERT('SELECT 1 AS c' USING utf8); +c +1 +EXECUTE IMMEDIATE CAST('SELECT 1 AS c' AS CHAR); +c +1 +EXECUTE IMMEDIATE _latin1'SELECT 1 AS c' COLLATE latin1_bin; +c +1 +EXECUTE IMMEDIATE (((('SELECT 1 AS c')))); +c +1 +EXECUTE IMMEDIATE CASE WHEN 1>2 THEN 'SELECT 1 AS c' ELSE 'SELECT 2 AS c' END; +c +2 +EXECUTE IMMEDIATE TRIM('SELECT 1 AS c'); +c +1 +EXECUTE IMMEDIATE SUBSTRING('SELECT 1 AS c' FROM 1); +c +1 +EXECUTE IMMEDIATE COALESCE(NULL, 'SELECT 1 AS c'); +c +1 +# +# Testing SET STATEMENT and system variables +# +CREATE TABLE t1 (a INT); +SET STATEMENT max_sort_length=1025 FOR EXECUTE IMMEDIATE CONCAT('INSERT INTO t1 VALUES (', @@max_sort_length, ')'); +SELECT * FROM t1; +a +1025 +DROP TABLE t1; +# +# End of MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions +# +# +# End of 10.2 tests +# +# +# MDEV-11360 Dynamic SQL: DEFAULT as a bind parameter +# +CREATE TABLE t1 (a INT DEFAULT 10, b INT DEFAULT NULL); +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?,?)' USING DEFAULT, DEFAULT; +SELECT * FROM t1; +a b +10 NULL +UPDATE t1 SET a=20, b=30; +SELECT * FROM t1; +a b +20 30 +EXECUTE IMMEDIATE 'UPDATE t1 SET a=?,b=?' USING DEFAULT, DEFAULT; +SELECT * FROM t1; +a b +10 NULL +DROP TABLE t1; +CREATE TABLE t1 (a INT DEFAULT 10); +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?+1)' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (CONCAT(?,?))' USING DEFAULT, 'test'; +ERROR HY000: Default/ignore value is not supported for such parameter usage +DROP TABLE t1; +CREATE TABLE t1 (a INT DEFAULT 10); +INSERT INTO t1 VALUES (20); +EXECUTE IMMEDIATE 'UPDATE t1 SET a=?+1' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'UPDATE t1 SET a=CONCAT(?,?)' USING DEFAULT, 'test'; +ERROR HY000: Default/ignore value is not supported for such parameter usage +DROP TABLE t1; +EXECUTE IMMEDIATE 'SELECT CAST(? AS SIGNED)' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT CAST(? AS DOUBLE)' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT CAST(? AS CHAR)' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT CAST(? AS DECIMAL(10,1))' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT CAST(? AS TIME)' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT CAST(? AS DATE)' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT CAST(? AS DATETIME)' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT ?+1' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT CONCAT(?,?)' USING DEFAULT,'test'; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT 1 LIMIT ?' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +CREATE TABLE t1 (a INT DEFAULT 10); +INSERT INTO t1 VALUES (1),(2),(3); +EXECUTE IMMEDIATE 'SELECT * FROM t1 LIMIT ?' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +DROP TABLE t1; +# The output of this query in 'Note' is a syntactically incorrect query. +# But as it's never logged, it's ok. It should be human readable only. +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT ?' USING DEFAULT; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select default AS `?` +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>?+a' USING DEFAULT,DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +DROP TABLE t1; diff --git a/mysql-test/r/ps_ddl.result b/mysql-test/r/ps_ddl.result index a665224f59d..e69c6e06193 100644 --- a/mysql-test/r/ps_ddl.result +++ b/mysql-test/r/ps_ddl.result @@ -1310,7 +1310,7 @@ create algorithm=temptable view v1 as select a*a as a2 from t1; # statement code, and should not raise ER_PS_INVALIDATED errors show create view v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (`t1`.`a` * `t1`.`a`) AS `a2` from `t1` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` * `t1`.`a` AS `a2` from `t1` latin1 latin1_swedish_ci prepare stmt from "select * from v1"; insert into t1 values (1), (2), (3); execute stmt; @@ -2554,3 +2554,32 @@ EXECUTE stmt3; EXECUTE stmt3; DEALLOCATE PREPARE stmt3; DROP TEMPORARY TABLES tm, t1; +# +# Start of 10.1 tests +# +# +# MDEV-10702 Crash in SET STATEMENT FOR EXECUTE +# +CREATE TABLE t1 (a INT); +PREPARE stmt FROM 'INSERT INTO t1 VALUES (@@max_sort_length)'; +SET STATEMENT max_sort_length=2048 FOR EXECUTE stmt; +SELECT * FROM t1; +a +2048 +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=NEW.a + 1; +SET STATEMENT max_sort_length=2048 FOR EXECUTE stmt; +SELECT * FROM t1; +a +2048 +1025 +DROP TRIGGER tr1; +SET STATEMENT max_sort_length=2048 FOR EXECUTE stmt; +SELECT * FROM t1; +a +2048 +1025 +1024 +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index 5adb8225b38..5027fffe047 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -2258,26 +2258,26 @@ explain extended select * from t2 where (b > 25 and b < 15) or a<44; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`a` < 44) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`a` < 44 # EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: explain extended select * from t2 where a < 44 or (b > 25 and b < 15); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`a` < 44) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`a` < 44 # Here, conditions b will not be removed, because "c<44" is not sargable # and hence (b.. and .. b) part is not analyzed at all: explain extended select * from t2 where c < 44 or (b > 25 and b < 15); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` < 44) or ((`test`.`t2`.`b` > 25) and (`test`.`t2`.`b` < 15))) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`c` < 44 or `test`.`t2`.`b` > 25 and `test`.`t2`.`b` < 15 # EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: explain extended select * from t2 where (b > 25 and b < 15) or c < 44; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` < 44)) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`c` < 44 # Try a case where both OR parts produce SEL_ARG::IMPOSSIBLE: explain extended select * from t2 where (b > 25 and b < 15) or (a>55 and a<44); id select_type table type possible_keys key key_len ref rows filtered Extra diff --git a/mysql-test/r/range_mrr_icp.result b/mysql-test/r/range_mrr_icp.result index 4ef7c0b658c..7d009070150 100644 --- a/mysql-test/r/range_mrr_icp.result +++ b/mysql-test/r/range_mrr_icp.result @@ -2260,26 +2260,26 @@ explain extended select * from t2 where (b > 25 and b < 15) or a<44; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition; Rowid-ordered scan Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`a` < 44) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`a` < 44 # EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: explain extended select * from t2 where a < 44 or (b > 25 and b < 15); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition; Rowid-ordered scan Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`a` < 44) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`a` < 44 # Here, conditions b will not be removed, because "c<44" is not sargable # and hence (b.. and .. b) part is not analyzed at all: explain extended select * from t2 where c < 44 or (b > 25 and b < 15); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` < 44) or ((`test`.`t2`.`b` > 25) and (`test`.`t2`.`b` < 15))) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`c` < 44 or `test`.`t2`.`b` > 25 and `test`.`t2`.`b` < 15 # EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: explain extended select * from t2 where (b > 25 and b < 15) or c < 44; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` < 44)) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`c` < 44 # Try a case where both OR parts produce SEL_ARG::IMPOSSIBLE: explain extended select * from t2 where (b > 25 and b < 15) or (a>55 and a<44); id select_type table type possible_keys key key_len ref rows filtered Extra diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result index 9a19c3b0604..9b796c24354 100644 --- a/mysql-test/r/row.result +++ b/mysql-test/r/row.result @@ -49,7 +49,7 @@ explain extended select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,N id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select ((1,2,(3,4)) in ((3,2,(3,4)),(1,2,(3,NULL)))) AS `row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)))` +Note 1003 select (1,2,(3,4)) in ((3,2,(3,4)),(1,2,(3,NULL))) AS `row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)))` select row(1,2,row(3,null)) IN (row(3,2,row(3,4)), row(1,2,row(4,5))); row(1,2,row(3,null)) IN (row(3,2,row(3,4)), row(1,2,row(4,5))) 0 @@ -373,7 +373,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 100.00 Using index 1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = (`test`.`t2`.`b` + 1))) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t1`.`b` = `test`.`t2`.`b` + 1 SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,t2.b+1); a b a b c 1 2 1 1 1 @@ -385,7 +385,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index NULL PRIMARY 8 NULL 6 100.00 Using index 1 SIMPLE t2 index NULL PRIMARY 12 NULL 7 100.00 Using where; Using index; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where (((`test`.`t1`.`a` - 1) = (`test`.`t2`.`a` - 1)) and (`test`.`t1`.`b` = (`test`.`t2`.`b` + 1))) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` - 1 = `test`.`t2`.`a` - 1 and `test`.`t1`.`b` = `test`.`t2`.`b` + 1 SELECT * FROM t1,t2 WHERE (t1.a-1,t1.b)=(t2.a-1,t2.b+1); a b a b c 1 2 1 1 2 @@ -411,7 +411,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 100.00 Using index 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 12 test.t1.a,const,const 1 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t2`.`b` = 2) and (`test`.`t2`.`c` = 1)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t2`.`b` = 2 and `test`.`t2`.`c` = 1 SELECT * FROM t1,t2 WHERE (t2.a,(t2.b,t2.c))=(t1.a,(2,1)); a b a b c 1 1 1 2 1 @@ -421,7 +421,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 100.00 Using index 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 12 test.t1.a,const,const 1 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t2`.`b` = 2) and (`test`.`t2`.`c` = 1)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t2`.`b` = 2 and `test`.`t2`.`c` = 1 SELECT * FROM t1,t2 WHERE t2.a=t1.a AND (t2.b,t2.c)=(2,1); a b a b c 1 1 1 2 1 @@ -507,12 +507,12 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND b=10 AND a>=10; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 10) and (`test`.`t1`.`b` = 10)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 10 and `test`.`t1`.`b` = 10 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a,b)=(10,10) AND a>=10; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 10) and (`test`.`t1`.`b` = 10)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 10 and `test`.`t1`.`b` = 10 DROP TABLE t1; # # MDEV-9369 IN operator with ( num, NULL ) gives inconsistent result diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index f8ff343e8bb..a7c4c76dc8c 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -1510,7 +1510,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where Warnings: -Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> '')) +Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> '' select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3; companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1) 00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087 @@ -4395,12 +4395,12 @@ EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND a = b LIMIT 2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 1)) limit 2 +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` > 1 limit 2 EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND b = a LIMIT 2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 1)) limit 2 +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` > 1 limit 2 DROP TABLE t1; # # Bug#47019: Assertion failed: 0, file .\rt_mbr.c, line 138 when @@ -4767,7 +4767,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 1 + 1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = ((1 + 1))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = (1 + 1) SELECT * FROM t1 HAVING a = 1 + 1; a 2 @@ -4775,7 +4775,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 HAVING a = 1 + 1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` having (`test`.`t1`.`a` = ((1 + 1))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` having `test`.`t1`.`a` = (1 + 1) SELECT * FROM t1, t2 WHERE a = b + (1 + 1); a b 4 2 @@ -4784,7 +4784,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,2 AS `b` from `test`.`t1` where (`test`.`t1`.`a` = ((2 + (1 + 1)))) +Note 1003 select `test`.`t1`.`a` AS `a`,2 AS `b` from `test`.`t1` where `test`.`t1`.`a` = (2 + 1 + 1) SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1; b a 2 3 @@ -4798,7 +4798,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > UNIX_TIMESTAMP('2009-03-10 00:00:00' id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > (unix_timestamp('2009-03-10 00:00:00'))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > (unix_timestamp('2009-03-10 00:00:00')) CREATE FUNCTION f1() RETURNS INT DETERMINISTIC BEGIN SET @cnt := @cnt + 1; @@ -4815,7 +4815,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = f1(); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = (`f1`())) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = (`f1`()) DROP TABLE t1, t2; DROP FUNCTION f1; # End of bug#33546 @@ -5383,7 +5383,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 system idx NULL NULL NULL 1 100.00 1 SIMPLE t2 ref idx idx 5 const 1 100.00 Using index Warnings: -Note 1003 select 8 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`c` = 8) +Note 1003 select 8 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`c` = 8 SELECT * FROM t1 INNER JOIN t2 ON ( c = a ) WHERE 1 IS NULL OR b < 33 AND b = c; a b c @@ -5413,7 +5413,7 @@ SELECT * FROM t1 WHERE (1 != 1 OR a = 5) AND (b != 1 OR a = 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 5) and (`test`.`t1`.`b` <> 1)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1 SELECT * FROM t1 WHERE (1 != 1 OR a = 5) AND (b != 1 OR a = 1); a b 5 11 @@ -5422,7 +5422,7 @@ SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (1 != 1 OR a = 5); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 5) and (`test`.`t1`.`b` <> 1)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1 SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (1 != 1 OR a = 5); a b 5 11 @@ -5431,7 +5431,7 @@ SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (a = 5 OR 1 != 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 5) and (`test`.`t1`.`b` <> 1)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1 SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (a = 5 OR 1 != 1); a b 5 11 @@ -5448,7 +5448,7 @@ SELECT * FROM t1 WHERE (b = 1 OR a = 5) AND (b = 5 AND a = 5 OR 1 != 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = 5) and (`test`.`t1`.`a` = 5)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = 5 and `test`.`t1`.`a` = 5 SELECT * FROM t1 WHERE (b = 1 OR a = 5) AND (b = 5 AND a = 5 OR 1 != 1); a b DROP TABLE t1; @@ -5466,7 +5466,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,'k' AS `c`,'k' AS `d` from `test`.`t1` where ((`test`.`t1`.`b` = 'k') and (`test`.`t1`.`a` = 136)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,'k' AS `c`,'k' AS `d` from `test`.`t1` where `test`.`t1`.`b` = 'k' and `test`.`t1`.`a` = 136 SELECT * FROM t1, t2 WHERE c=b AND (1=2 OR ((b='h' OR a=136) AND d=b)); a b c d DROP TABLE t1,t2; @@ -5507,7 +5507,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 system PRIMARY NULL NULL NULL 1 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,1 AS `pk2`,1 AS `a2` from `test`.`t1` where ((`test`.`t1`.`a1` = 1) and (`test`.`t1`.`b1` = 6)) +Note 1003 select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,1 AS `pk2`,1 AS `a2` from `test`.`t1` where `test`.`t1`.`a1` = 1 and `test`.`t1`.`b1` = 6 INSERT INTO t1 VALUES (3,1,6); SELECT * FROM t1, t2 WHERE a1 = pk2 AND ( ( b1 = 6 OR a2 > 4 ) AND pk2 = a2 OR pk1 IS NULL ); diff --git a/mysql-test/r/select_jcl6.result b/mysql-test/r/select_jcl6.result index c5f28395535..19d1733c52e 100644 --- a/mysql-test/r/select_jcl6.result +++ b/mysql-test/r/select_jcl6.result @@ -1521,7 +1521,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where Warnings: -Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> '')) +Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> '' select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3; companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1) 00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087 @@ -4406,12 +4406,12 @@ EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND a = b LIMIT 2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where; Rowid-ordered scan Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 1)) limit 2 +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` > 1 limit 2 EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND b = a LIMIT 2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where; Rowid-ordered scan Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 1)) limit 2 +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` > 1 limit 2 DROP TABLE t1; # # Bug#47019: Assertion failed: 0, file .\rt_mbr.c, line 138 when @@ -4778,7 +4778,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 1 + 1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = ((1 + 1))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = (1 + 1) SELECT * FROM t1 HAVING a = 1 + 1; a 2 @@ -4786,7 +4786,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 HAVING a = 1 + 1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` having (`test`.`t1`.`a` = ((1 + 1))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` having `test`.`t1`.`a` = (1 + 1) SELECT * FROM t1, t2 WHERE a = b + (1 + 1); a b 4 2 @@ -4795,7 +4795,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,2 AS `b` from `test`.`t1` where (`test`.`t1`.`a` = ((2 + (1 + 1)))) +Note 1003 select `test`.`t1`.`a` AS `a`,2 AS `b` from `test`.`t1` where `test`.`t1`.`a` = (2 + 1 + 1) SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1; b a 2 3 @@ -4809,7 +4809,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > UNIX_TIMESTAMP('2009-03-10 00:00:00' id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > (unix_timestamp('2009-03-10 00:00:00'))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > (unix_timestamp('2009-03-10 00:00:00')) CREATE FUNCTION f1() RETURNS INT DETERMINISTIC BEGIN SET @cnt := @cnt + 1; @@ -4826,7 +4826,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = f1(); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = (`f1`())) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = (`f1`()) DROP TABLE t1, t2; DROP FUNCTION f1; # End of bug#33546 @@ -5394,7 +5394,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 system idx NULL NULL NULL 1 100.00 1 SIMPLE t2 ref idx idx 5 const 1 100.00 Using index Warnings: -Note 1003 select 8 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`c` = 8) +Note 1003 select 8 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`c` = 8 SELECT * FROM t1 INNER JOIN t2 ON ( c = a ) WHERE 1 IS NULL OR b < 33 AND b = c; a b c @@ -5424,7 +5424,7 @@ SELECT * FROM t1 WHERE (1 != 1 OR a = 5) AND (b != 1 OR a = 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 5) and (`test`.`t1`.`b` <> 1)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1 SELECT * FROM t1 WHERE (1 != 1 OR a = 5) AND (b != 1 OR a = 1); a b 5 11 @@ -5433,7 +5433,7 @@ SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (1 != 1 OR a = 5); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 5) and (`test`.`t1`.`b` <> 1)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1 SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (1 != 1 OR a = 5); a b 5 11 @@ -5442,7 +5442,7 @@ SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (a = 5 OR 1 != 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 5) and (`test`.`t1`.`b` <> 1)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1 SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (a = 5 OR 1 != 1); a b 5 11 @@ -5459,7 +5459,7 @@ SELECT * FROM t1 WHERE (b = 1 OR a = 5) AND (b = 5 AND a = 5 OR 1 != 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = 5) and (`test`.`t1`.`a` = 5)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = 5 and `test`.`t1`.`a` = 5 SELECT * FROM t1 WHERE (b = 1 OR a = 5) AND (b = 5 AND a = 5 OR 1 != 1); a b DROP TABLE t1; @@ -5477,7 +5477,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,'k' AS `c`,'k' AS `d` from `test`.`t1` where ((`test`.`t1`.`b` = 'k') and (`test`.`t1`.`a` = 136)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,'k' AS `c`,'k' AS `d` from `test`.`t1` where `test`.`t1`.`b` = 'k' and `test`.`t1`.`a` = 136 SELECT * FROM t1, t2 WHERE c=b AND (1=2 OR ((b='h' OR a=136) AND d=b)); a b c d DROP TABLE t1,t2; @@ -5518,7 +5518,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 system PRIMARY NULL NULL NULL 1 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,1 AS `pk2`,1 AS `a2` from `test`.`t1` where ((`test`.`t1`.`a1` = 1) and (`test`.`t1`.`b1` = 6)) +Note 1003 select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,1 AS `pk2`,1 AS `a2` from `test`.`t1` where `test`.`t1`.`a1` = 1 and `test`.`t1`.`b1` = 6 INSERT INTO t1 VALUES (3,1,6); SELECT * FROM t1, t2 WHERE a1 = pk2 AND ( ( b1 = 6 OR a2 > 4 ) AND pk2 = a2 OR pk1 IS NULL ); diff --git a/mysql-test/r/select_pkeycache.result b/mysql-test/r/select_pkeycache.result index f8ff343e8bb..a7c4c76dc8c 100644 --- a/mysql-test/r/select_pkeycache.result +++ b/mysql-test/r/select_pkeycache.result @@ -1510,7 +1510,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where Warnings: -Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> '')) +Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> '' select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3; companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1) 00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087 @@ -4395,12 +4395,12 @@ EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND a = b LIMIT 2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 1)) limit 2 +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` > 1 limit 2 EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND b = a LIMIT 2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 1)) limit 2 +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` > 1 limit 2 DROP TABLE t1; # # Bug#47019: Assertion failed: 0, file .\rt_mbr.c, line 138 when @@ -4767,7 +4767,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 1 + 1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = ((1 + 1))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = (1 + 1) SELECT * FROM t1 HAVING a = 1 + 1; a 2 @@ -4775,7 +4775,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 HAVING a = 1 + 1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` having (`test`.`t1`.`a` = ((1 + 1))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` having `test`.`t1`.`a` = (1 + 1) SELECT * FROM t1, t2 WHERE a = b + (1 + 1); a b 4 2 @@ -4784,7 +4784,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,2 AS `b` from `test`.`t1` where (`test`.`t1`.`a` = ((2 + (1 + 1)))) +Note 1003 select `test`.`t1`.`a` AS `a`,2 AS `b` from `test`.`t1` where `test`.`t1`.`a` = (2 + 1 + 1) SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1; b a 2 3 @@ -4798,7 +4798,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > UNIX_TIMESTAMP('2009-03-10 00:00:00' id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > (unix_timestamp('2009-03-10 00:00:00'))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > (unix_timestamp('2009-03-10 00:00:00')) CREATE FUNCTION f1() RETURNS INT DETERMINISTIC BEGIN SET @cnt := @cnt + 1; @@ -4815,7 +4815,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = f1(); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = (`f1`())) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = (`f1`()) DROP TABLE t1, t2; DROP FUNCTION f1; # End of bug#33546 @@ -5383,7 +5383,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 system idx NULL NULL NULL 1 100.00 1 SIMPLE t2 ref idx idx 5 const 1 100.00 Using index Warnings: -Note 1003 select 8 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`c` = 8) +Note 1003 select 8 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`c` = 8 SELECT * FROM t1 INNER JOIN t2 ON ( c = a ) WHERE 1 IS NULL OR b < 33 AND b = c; a b c @@ -5413,7 +5413,7 @@ SELECT * FROM t1 WHERE (1 != 1 OR a = 5) AND (b != 1 OR a = 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 5) and (`test`.`t1`.`b` <> 1)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1 SELECT * FROM t1 WHERE (1 != 1 OR a = 5) AND (b != 1 OR a = 1); a b 5 11 @@ -5422,7 +5422,7 @@ SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (1 != 1 OR a = 5); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 5) and (`test`.`t1`.`b` <> 1)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1 SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (1 != 1 OR a = 5); a b 5 11 @@ -5431,7 +5431,7 @@ SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (a = 5 OR 1 != 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 5) and (`test`.`t1`.`b` <> 1)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1 SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (a = 5 OR 1 != 1); a b 5 11 @@ -5448,7 +5448,7 @@ SELECT * FROM t1 WHERE (b = 1 OR a = 5) AND (b = 5 AND a = 5 OR 1 != 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = 5) and (`test`.`t1`.`a` = 5)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = 5 and `test`.`t1`.`a` = 5 SELECT * FROM t1 WHERE (b = 1 OR a = 5) AND (b = 5 AND a = 5 OR 1 != 1); a b DROP TABLE t1; @@ -5466,7 +5466,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,'k' AS `c`,'k' AS `d` from `test`.`t1` where ((`test`.`t1`.`b` = 'k') and (`test`.`t1`.`a` = 136)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,'k' AS `c`,'k' AS `d` from `test`.`t1` where `test`.`t1`.`b` = 'k' and `test`.`t1`.`a` = 136 SELECT * FROM t1, t2 WHERE c=b AND (1=2 OR ((b='h' OR a=136) AND d=b)); a b c d DROP TABLE t1,t2; @@ -5507,7 +5507,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 system PRIMARY NULL NULL NULL 1 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,1 AS `pk2`,1 AS `a2` from `test`.`t1` where ((`test`.`t1`.`a1` = 1) and (`test`.`t1`.`b1` = 6)) +Note 1003 select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,1 AS `pk2`,1 AS `a2` from `test`.`t1` where `test`.`t1`.`a1` = 1 and `test`.`t1`.`b1` = 6 INSERT INTO t1 VALUES (3,1,6); SELECT * FROM t1, t2 WHERE a1 = pk2 AND ( ( b1 = 6 OR a2 > 4 ) AND pk2 = a2 OR pk1 IS NULL ); diff --git a/mysql-test/r/selectivity.result b/mysql-test/r/selectivity.result index 4238359c201..64199f983ee 100644 --- a/mysql-test/r/selectivity.result +++ b/mysql-test/r/selectivity.result @@ -27,13 +27,13 @@ select * from t1 where a is null; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 40.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where isnull(`test`.`t1`.`a`) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is null explain extended select * from t1 where a is not null; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 60.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` is not null) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not null drop table t1; set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; DROP DATABASE IF EXISTS dbt3_s001; @@ -80,7 +80,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 100.00 Using where Warnings: Note 1276 Field or reference 'dbt3_s001.part.p_partkey' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `dbt3_s001`.`supplier`.`s_acctbal` AS `s_acctbal`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`nation`.`n_name` AS `n_name`,`dbt3_s001`.`part`.`p_partkey` AS `p_partkey`,`dbt3_s001`.`part`.`p_mfgr` AS `p_mfgr`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`dbt3_s001`.`supplier`.`s_comment` AS `s_comment` from `dbt3_s001`.`part` join `dbt3_s001`.`supplier` join `dbt3_s001`.`partsupp` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where ((`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`part`.`p_size` = 9) and (`dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey`) and (`dbt3_s001`.`region`.`r_regionkey` = `dbt3_s001`.`nation`.`n_regionkey`) and (`dbt3_s001`.`region`.`r_name` = 'ASIA') and (`dbt3_s001`.`part`.`p_type` like '%TIN') and (`dbt3_s001`.`partsupp`.`ps_supplycost` = <`dbt3_s001`.`part`.`p_partkey`>((select min(`dbt3_s001`.`partsupp`.`ps_supplycost`) from `dbt3_s001`.`partsupp` join `dbt3_s001`.`supplier` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where ((`dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey`) and (`dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey`) and (`dbt3_s001`.`region`.`r_name` = 'ASIA') and (`dbt3_s001`.`part`.`p_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`)))))) order by `dbt3_s001`.`supplier`.`s_acctbal` desc,`dbt3_s001`.`nation`.`n_name`,`dbt3_s001`.`supplier`.`s_name`,`dbt3_s001`.`part`.`p_partkey` +Note 1003 select `dbt3_s001`.`supplier`.`s_acctbal` AS `s_acctbal`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`nation`.`n_name` AS `n_name`,`dbt3_s001`.`part`.`p_partkey` AS `p_partkey`,`dbt3_s001`.`part`.`p_mfgr` AS `p_mfgr`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`dbt3_s001`.`supplier`.`s_comment` AS `s_comment` from `dbt3_s001`.`part` join `dbt3_s001`.`supplier` join `dbt3_s001`.`partsupp` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`part`.`p_size` = 9 and `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`region`.`r_regionkey` = `dbt3_s001`.`nation`.`n_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_type` like '%TIN' and `dbt3_s001`.`partsupp`.`ps_supplycost` = <`dbt3_s001`.`part`.`p_partkey`>((select min(`dbt3_s001`.`partsupp`.`ps_supplycost`) from `dbt3_s001`.`partsupp` join `dbt3_s001`.`supplier` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`)) order by `dbt3_s001`.`supplier`.`s_acctbal` desc,`dbt3_s001`.`nation`.`n_name`,`dbt3_s001`.`supplier`.`s_name`,`dbt3_s001`.`part`.`p_partkey` set optimizer_use_condition_selectivity=4; explain extended select @@ -121,7 +121,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 100.00 Using where Warnings: Note 1276 Field or reference 'dbt3_s001.part.p_partkey' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `dbt3_s001`.`supplier`.`s_acctbal` AS `s_acctbal`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`nation`.`n_name` AS `n_name`,`dbt3_s001`.`part`.`p_partkey` AS `p_partkey`,`dbt3_s001`.`part`.`p_mfgr` AS `p_mfgr`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`dbt3_s001`.`supplier`.`s_comment` AS `s_comment` from `dbt3_s001`.`part` join `dbt3_s001`.`supplier` join `dbt3_s001`.`partsupp` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where ((`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey`) and (`dbt3_s001`.`part`.`p_size` = 9) and (`dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey`) and (`dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey`) and (`dbt3_s001`.`region`.`r_name` = 'ASIA') and (`dbt3_s001`.`part`.`p_type` like '%TIN') and (`dbt3_s001`.`partsupp`.`ps_supplycost` = <`dbt3_s001`.`part`.`p_partkey`>((select min(`dbt3_s001`.`partsupp`.`ps_supplycost`) from `dbt3_s001`.`partsupp` join `dbt3_s001`.`supplier` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where ((`dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey`) and (`dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey`) and (`dbt3_s001`.`region`.`r_name` = 'ASIA') and (`dbt3_s001`.`part`.`p_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`)))))) order by `dbt3_s001`.`supplier`.`s_acctbal` desc,`dbt3_s001`.`nation`.`n_name`,`dbt3_s001`.`supplier`.`s_name`,`dbt3_s001`.`part`.`p_partkey` +Note 1003 select `dbt3_s001`.`supplier`.`s_acctbal` AS `s_acctbal`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`nation`.`n_name` AS `n_name`,`dbt3_s001`.`part`.`p_partkey` AS `p_partkey`,`dbt3_s001`.`part`.`p_mfgr` AS `p_mfgr`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`dbt3_s001`.`supplier`.`s_comment` AS `s_comment` from `dbt3_s001`.`part` join `dbt3_s001`.`supplier` join `dbt3_s001`.`partsupp` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey` and `dbt3_s001`.`part`.`p_size` = 9 and `dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey` and `dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_type` like '%TIN' and `dbt3_s001`.`partsupp`.`ps_supplycost` = <`dbt3_s001`.`part`.`p_partkey`>((select min(`dbt3_s001`.`partsupp`.`ps_supplycost`) from `dbt3_s001`.`partsupp` join `dbt3_s001`.`supplier` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`)) order by `dbt3_s001`.`supplier`.`s_acctbal` desc,`dbt3_s001`.`nation`.`n_name`,`dbt3_s001`.`supplier`.`s_name`,`dbt3_s001`.`part`.`p_partkey` === Q15 === create view revenue0 (supplier_no, total_revenue) as select l_suppkey, sum(l_extendedprice * (1 - l_discount)) @@ -145,7 +145,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 SUBQUERY ALL NULL NULL NULL NULL 268 100.00 4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 268 100.00 Using where; Using temporary; Using filesort Warnings: -Note 1003 select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where ((`revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey`) and (`revenue0`.`total_revenue` = (select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`))) order by `dbt3_s001`.`supplier`.`s_suppkey` +Note 1003 select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where `revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey` and `revenue0`.`total_revenue` = (select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`) order by `dbt3_s001`.`supplier`.`s_suppkey` select s_suppkey, s_name, s_address, s_phone, total_revenue from supplier, revenue0 where s_suppkey = supplier_no @@ -166,7 +166,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 SUBQUERY ALL NULL NULL NULL NULL 268 100.00 4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 268 100.00 Using where; Using temporary; Using filesort Warnings: -Note 1003 select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where ((`revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey`) and (`revenue0`.`total_revenue` = (select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`))) order by `dbt3_s001`.`supplier`.`s_suppkey` +Note 1003 select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where `revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey` and `revenue0`.`total_revenue` = (select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`) order by `dbt3_s001`.`supplier`.`s_suppkey` select s_suppkey, s_name, s_address, s_phone, total_revenue from supplier, revenue0 where s_suppkey = supplier_no @@ -193,7 +193,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY partsupp ref PRIMARY,i_ps_partkey PRIMARY 4 dbt3_s001.part.p_partkey 3 100.00 Using where; Using index 2 MATERIALIZED supplier ALL PRIMARY NULL NULL NULL 10 100.00 Using where Warnings: -Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where ((`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`part`.`p_brand` <> 'Brand#11') and (not((`dbt3_s001`.`part`.`p_type` like 'SMALL POLISHED%'))) and (`dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8)) and (not(<`dbt3_s001`.`partsupp`.`ps_suppkey`>((`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where (`dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%') ), (`dbt3_s001`.`partsupp`.`ps_suppkey` in on distinct_key where ((`dbt3_s001`.`partsupp`.`ps_suppkey` = ``.`s_suppkey`))))))))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` +Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`part`.`p_brand` <> 'Brand#11' and `dbt3_s001`.`part`.`p_type` not like 'SMALL POLISHED%' and `dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8) and !<`dbt3_s001`.`partsupp`.`ps_suppkey`>((`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where `dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%' ), (`dbt3_s001`.`partsupp`.`ps_suppkey` in on distinct_key where `dbt3_s001`.`partsupp`.`ps_suppkey` = ``.`s_suppkey`)))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` select p_brand, p_type, p_size, count(distinct ps_suppkey) as supplier_cnt from partsupp, part where p_partkey = ps_partkey @@ -237,7 +237,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY partsupp ref PRIMARY,i_ps_partkey PRIMARY 4 dbt3_s001.part.p_partkey 3 100.00 Using where; Using index 2 MATERIALIZED supplier ALL PRIMARY NULL NULL NULL 10 100.00 Using where Warnings: -Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where ((`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`part`.`p_brand` <> 'Brand#11') and (not((`dbt3_s001`.`part`.`p_type` like 'SMALL POLISHED%'))) and (`dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8)) and (not(<`dbt3_s001`.`partsupp`.`ps_suppkey`>((`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where (`dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%') ), (`dbt3_s001`.`partsupp`.`ps_suppkey` in on distinct_key where ((`dbt3_s001`.`partsupp`.`ps_suppkey` = ``.`s_suppkey`))))))))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` +Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`part`.`p_brand` <> 'Brand#11' and `dbt3_s001`.`part`.`p_type` not like 'SMALL POLISHED%' and `dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8) and !<`dbt3_s001`.`partsupp`.`ps_suppkey`>((`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where `dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%' ), (`dbt3_s001`.`partsupp`.`ps_suppkey` in on distinct_key where `dbt3_s001`.`partsupp`.`ps_suppkey` = ``.`s_suppkey`)))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` select p_brand, p_type, p_size, count(distinct ps_suppkey) as supplier_cnt from partsupp, part where p_partkey = ps_partkey @@ -281,7 +281,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY partsupp ref PRIMARY,i_ps_partkey PRIMARY 4 dbt3_s001.part.p_partkey 3 100.00 Using where; Using index 2 MATERIALIZED supplier ALL PRIMARY NULL NULL NULL 10 100.00 Using where Warnings: -Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where ((`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`part`.`p_brand` <> 'Brand#11') and (not((`dbt3_s001`.`part`.`p_type` like 'SMALL POLISHED%'))) and (`dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8)) and (not(<`dbt3_s001`.`partsupp`.`ps_suppkey`>((`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where (`dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%') ), (`dbt3_s001`.`partsupp`.`ps_suppkey` in on distinct_key where ((`dbt3_s001`.`partsupp`.`ps_suppkey` = ``.`s_suppkey`))))))))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` +Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`part`.`p_brand` <> 'Brand#11' and `dbt3_s001`.`part`.`p_type` not like 'SMALL POLISHED%' and `dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8) and !<`dbt3_s001`.`partsupp`.`ps_suppkey`>((`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where `dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%' ), (`dbt3_s001`.`partsupp`.`ps_suppkey` in on distinct_key where `dbt3_s001`.`partsupp`.`ps_suppkey` = ``.`s_suppkey`)))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` select p_brand, p_type, p_size, count(distinct ps_suppkey) as supplier_cnt from partsupp, part where p_partkey = ps_partkey @@ -328,7 +328,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY lineitem ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey_quantity 4 dbt3_s001.orders.o_orderkey 4 100.00 Using index 2 MATERIALIZED lineitem index NULL i_l_orderkey_quantity 13 NULL 6005 100.00 Using index Warnings: -Note 1003 select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from (select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having (sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250)) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey`) and (``.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey`) and (`dbt3_s001`.`lineitem`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey`)) group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`,`dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE` +Note 1003 select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from (select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where `dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey` and ``.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey` and `dbt3_s001`.`lineitem`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey` group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`,`dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE` select c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity) from customer, orders, lineitem @@ -362,7 +362,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY lineitem ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 .l_orderkey 4 100.00 2 MATERIALIZED lineitem index NULL i_l_orderkey_quantity 13 NULL 6005 100.00 Using index Warnings: -Note 1003 select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from (select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having (sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250)) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey`) and (`dbt3_s001`.`orders`.`o_orderkey` = ``.`l_orderkey`) and (`dbt3_s001`.`lineitem`.`l_orderkey` = ``.`l_orderkey`)) group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`,`dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE` +Note 1003 select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from (select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where `dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey` and `dbt3_s001`.`orders`.`o_orderkey` = ``.`l_orderkey` and `dbt3_s001`.`lineitem`.`l_orderkey` = ``.`l_orderkey` group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`,`dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE` select c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity) from customer, orders, lineitem @@ -400,7 +400,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 SUBQUERY customer ALL NULL NULL NULL NULL 150 100.00 Using where Warnings: Note 1276 Field or reference 'dbt3_s001.customer.c_custkey' of SELECT #4 was resolved in SELECT #2 -Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where ((substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and (`dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where ((`dbt3_s001`.`customer`.`c_acctbal` > 0.00) and (substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25'))))) and (not((1,exists(select 1 from `dbt3_s001`.`orders` where (`dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`)))))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) +Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25') and `dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where `dbt3_s001`.`customer`.`c_acctbal` > 0.00 and substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and !(1,exists(select 1 from `dbt3_s001`.`orders` where `dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`)) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) select cntrycode, count(*) as numcust, sum(c_acctbal) as totacctbal from ( select substr(c_phone, 1, 2) as cntrycode, c_acctbal @@ -441,7 +441,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 SUBQUERY customer ALL NULL NULL NULL NULL 150 91.00 Using where Warnings: Note 1276 Field or reference 'dbt3_s001.customer.c_custkey' of SELECT #4 was resolved in SELECT #2 -Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where ((substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and (`dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where ((`dbt3_s001`.`customer`.`c_acctbal` > 0.00) and (substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25'))))) and (not((1,exists(select 1 from `dbt3_s001`.`orders` where (`dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`)))))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) +Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25') and `dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where `dbt3_s001`.`customer`.`c_acctbal` > 0.00 and substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and !(1,exists(select 1 from `dbt3_s001`.`orders` where `dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`)) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) select cntrycode, count(*) as numcust, sum(c_acctbal) as totacctbal from ( select substr(c_phone, 1, 2) as cntrycode, c_acctbal @@ -491,7 +491,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2 Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2 -Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= (cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < ((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10 +Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`nation`.`n_name` = 'UNITED STATES' and `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_availqty` > <`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select 0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`) from `dbt3_s001`.`lineitem` where `dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey` and `dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`lineitem`.`l_shipDATE` >= (cast('1993-01-01' as date)) and `dbt3_s001`.`lineitem`.`l_shipDATE` < (cast('1993-01-01' as date) + interval '1' year))) and `dbt3_s001`.`part`.`p_name` like 'g%' order by `dbt3_s001`.`supplier`.`s_name` limit 10 select sql_calc_found_rows s_name, s_address from supplier, nation @@ -544,7 +544,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2 Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2 -Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= (cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < ((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10 +Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where `dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey` and `dbt3_s001`.`nation`.`n_name` = 'UNITED STATES' and `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey` and `dbt3_s001`.`partsupp`.`ps_availqty` > <`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select 0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`) from `dbt3_s001`.`lineitem` where `dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey` and `dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`lineitem`.`l_shipDATE` >= (cast('1993-01-01' as date)) and `dbt3_s001`.`lineitem`.`l_shipDATE` < (cast('1993-01-01' as date) + interval '1' year))) and `dbt3_s001`.`part`.`p_name` like 'g%' order by `dbt3_s001`.`supplier`.`s_name` limit 10 select sql_calc_found_rows s_name, s_address from supplier, nation @@ -599,7 +599,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2 Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2 -Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= (cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < ((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10 +Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where `dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey` and `dbt3_s001`.`nation`.`n_name` = 'UNITED STATES' and `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey` and `dbt3_s001`.`partsupp`.`ps_availqty` > <`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select 0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`) from `dbt3_s001`.`lineitem` where `dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey` and `dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`lineitem`.`l_shipDATE` >= (cast('1993-01-01' as date)) and `dbt3_s001`.`lineitem`.`l_shipDATE` < (cast('1993-01-01' as date) + interval '1' year))) and `dbt3_s001`.`part`.`p_name` like 'g%' order by `dbt3_s001`.`supplier`.`s_name` limit 10 select sql_calc_found_rows s_name, s_address from supplier, nation @@ -654,7 +654,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2 Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2 -Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= (cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < ((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10 +Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where `dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey` and `dbt3_s001`.`nation`.`n_name` = 'UNITED STATES' and `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey` and `dbt3_s001`.`partsupp`.`ps_availqty` > <`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select 0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`) from `dbt3_s001`.`lineitem` where `dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey` and `dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`lineitem`.`l_shipDATE` >= (cast('1993-01-01' as date)) and `dbt3_s001`.`lineitem`.`l_shipDATE` < (cast('1993-01-01' as date) + interval '1' year))) and `dbt3_s001`.`part`.`p_name` like 'g%' order by `dbt3_s001`.`supplier`.`s_name` limit 10 select sql_calc_found_rows s_name, s_address from supplier, nation @@ -709,7 +709,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2 Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2 -Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= (cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < ((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10 +Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where `dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey` and `dbt3_s001`.`nation`.`n_name` = 'UNITED STATES' and `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey` and `dbt3_s001`.`partsupp`.`ps_availqty` > <`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select 0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`) from `dbt3_s001`.`lineitem` where `dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey` and `dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`lineitem`.`l_shipDATE` >= (cast('1993-01-01' as date)) and `dbt3_s001`.`lineitem`.`l_shipDATE` < (cast('1993-01-01' as date) + interval '1' year))) and `dbt3_s001`.`part`.`p_name` like 'g%' order by `dbt3_s001`.`supplier`.`s_name` limit 10 select sql_calc_found_rows s_name, s_address from supplier, nation @@ -754,7 +754,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t2 ref idx idx 5 test.t1.b 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t2`.`d` = `test`.`t1`.`b`)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t2`.`d` = `test`.`t1`.`b` SELECT * FROM v1 INNER JOIN t2 ON ( a = c AND b = d ); a b c d 0 7 0 7 @@ -775,7 +775,7 @@ select * from t1 where a < 1 and a > 7; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` < 1) and (`test`.`t1`.`a` > 7)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1 and `test`.`t1`.`a` > 7 select * from t1 where a < 1 and a > 7; a set optimizer_use_condition_selectivity=3; @@ -833,7 +833,7 @@ explain extended select * from t1 where a=0; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 1025 0.39 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 0) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 0 drop table t1; set histogram_size=@save_histogram_size; set histogram_type=@save_histogram_type; @@ -902,7 +902,7 @@ SELECT * FROM t1 WHERE a > 3; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 75.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > 3) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 3 SELECT * FROM t1 WHERE a > 3; a 9 @@ -985,7 +985,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 SUBQUERY t2 ALL NULL NULL NULL NULL 7 100.00 2 SUBQUERY t1 ALL NULL NULL NULL NULL 14 100.00 Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where ((((1,exists(select 1 from `test`.`t1` join `test`.`t2`))) and (`test`.`t1`.`a` <> `test`.`t2`.`b`)) or (`test`.`t1`.`a` <= 4)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where ((1,exists(select 1 from `test`.`t1` join `test`.`t2`))) and `test`.`t1`.`a` <> `test`.`t2`.`b` or `test`.`t1`.`a` <= 4 set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; DROP TABLE t1,t2; set use_stat_tables=@save_use_stat_tables; @@ -1008,25 +1008,25 @@ SELECT * FROM t1 WHERE a IS NULL; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 14 28.57 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where isnull(`test`.`t1`.`a`) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is null EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IS NOT NULL; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 14 71.43 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` is not null) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not null EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IS NULL OR a IS NOT NULL; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 14 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (isnull(`test`.`t1`.`a`) or (`test`.`t1`.`a` is not null)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is null or `test`.`t1`.`a` is not null EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IS NULL OR a < 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 14 69.39 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (isnull(`test`.`t1`.`a`) or (`test`.`t1`.`a` < 5)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is null or `test`.`t1`.`a` < 5 set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; DROP TABLE t1; set use_stat_tables=@save_use_stat_tables; @@ -1135,7 +1135,7 @@ explain extended select * from t1 where a between 5 and 7; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 25.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` between 5 and 7) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` between 5 and 7 alter table t1 change column a a int; analyze table t1; Table Op Msg_type Msg_text @@ -1146,7 +1146,7 @@ explain extended select * from t1 where a between 5 and 7; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 25.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` between 5 and 7) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` between 5 and 7 set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; drop table t1; set use_stat_tables=@save_use_stat_tables; @@ -1179,7 +1179,7 @@ WHERE 2 IN ( SELECT pk2 FROM t2 LEFT JOIN t3 ON (c3 = c2 ) WHERE i2 = 3 ); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` left join `test`.`t3` on((`test`.`t3`.`c3` = 'b'))) where 0 +Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` left join `test`.`t3` on(`test`.`t3`.`c3` = 'b')) where 0 set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; DROP TABLE t1,t2,t3; # @@ -1246,7 +1246,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE language ALL NULL NULL NULL NULL 6 0.00 Using where; Using join buffer (flat, BNL join) 1 SIMPLE continent ALL NULL NULL NULL NULL 6 100.00 Using join buffer (incremental, BNL join) Warnings: -Note 1003 select `test`.`language`.`lang_group` AS `lang_group`,`test`.`language`.`lang` AS `lang`,`test`.`country`.`code` AS `code`,`test`.`country`.`country_group` AS `country_group`,`test`.`continent`.`cont_group` AS `cont_group`,`test`.`continent`.`cont` AS `cont` from `test`.`language` join `test`.`country` join `test`.`continent` where ((`test`.`language`.`lang_group` = `test`.`country`.`country_group`) and isnull(`test`.`country`.`country_group`)) +Note 1003 select `test`.`language`.`lang_group` AS `lang_group`,`test`.`language`.`lang` AS `lang`,`test`.`country`.`code` AS `code`,`test`.`country`.`country_group` AS `country_group`,`test`.`continent`.`cont_group` AS `cont_group`,`test`.`continent`.`cont` AS `cont` from `test`.`language` join `test`.`country` join `test`.`continent` where `test`.`language`.`lang_group` = `test`.`country`.`country_group` and `test`.`country`.`country_group` is null set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; drop table language, country, continent; set use_stat_tables=@save_use_stat_tables; @@ -1294,7 +1294,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ref c,d c 5 test.t1.b 5 100.00 1 SIMPLE t3 ALL NULL NULL NULL NULL 262144 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t1` `t3` where ((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t3`.`a` = `test`.`t2`.`d`) and (`test`.`t3`.`b` < 5) and (`test`.`t1`.`a` < 2000)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t1` `t3` where `test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t3`.`a` = `test`.`t2`.`d` and `test`.`t3`.`b` < 5 and `test`.`t1`.`a` < 2000 select * from t1, t2, t1 as t3 where t1.b=t2.c and t2.d=t3.a and t3.b<5 and t1.a < 2000; a b c d a b @@ -1311,7 +1311,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ref c,d d 5 test.t3.a 7 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 262144 2.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t1` `t3` where ((`test`.`t1`.`b` = `test`.`t2`.`c`) and (`test`.`t2`.`d` = `test`.`t3`.`a`) and (`test`.`t3`.`b` < 5) and (`test`.`t1`.`a` < 2000)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t1` `t3` where `test`.`t1`.`b` = `test`.`t2`.`c` and `test`.`t2`.`d` = `test`.`t3`.`a` and `test`.`t3`.`b` < 5 and `test`.`t1`.`a` < 2000 select * from t1, t2, t1 as t3 where t1.b=t2.c and t2.d=t3.a and t3.b<5 and t1.a < 2000; a b c d a b @@ -1372,14 +1372,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 0.99 Using where 1 SIMPLE t2 ref a a 5 test.t1.a 10 100.00 Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 10)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t1`.`a` < 10 explain extended select * from t1 straight_join t2 where t1.a=t2.a and t2.a<10; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 0.99 Using where 1 SIMPLE t2 ref a a 5 test.t1.a 10 100.00 Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 10)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t1`.`a` < 10 set histogram_size=@save_histogram_size; set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; drop table t0,t1,t2; @@ -1405,7 +1405,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE a ALL NULL NULL NULL NULL 1000 100.00 Using where 1 SIMPLE b ALL NULL NULL NULL NULL 1000 100.00 Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`a`.`a` AS `a`,`test`.`a`.`b` AS `b`,`test`.`b`.`a` AS `a`,`test`.`b`.`b` AS `b` from `test`.`t2` `a` straight_join `test`.`t2` `b` where isnull(`test`.`a`.`a`) +Note 1003 select `test`.`a`.`a` AS `a`,`test`.`a`.`b` AS `b`,`test`.`b`.`a` AS `a`,`test`.`b`.`b` AS `b` from `test`.`t2` `a` straight_join `test`.`t2` `b` where `test`.`a`.`a` is null set histogram_size=@save_histogram_size; set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; drop table t0,t1,t2; @@ -1433,10 +1433,103 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ref PRIMARY,b b 5 const 1 100.00 Using index condition; Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 14 100.00 Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`i` AS `i` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`a` <> 'USARussian') and isnull(`test`.`t1`.`b`)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`i` AS `i` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` <> 'USARussian' and `test`.`t1`.`b` is null SELECT * FROM t1, t2 WHERE a <> 'USARussian' AND b IS NULL; a b i set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; DROP TABLE t1,t2; set use_stat_tables=@save_use_stat_tables; +# +# Bug mdev-11096: range condition over column without statistical data +# +set use_stat_tables='preferably'; +set optimizer_use_condition_selectivity=3; +create table t1(col1 char(32)); +insert into t1 values ('a'),('b'),('c'),('d'), ('e'),('f'),('g'),('h'); +analyze table t1 persistent for columns () indexes (); +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +explain extended +select * from t1 where col1 > 'b' and col1 < 'e'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` > 'b' and `test`.`t1`.`col1` < 'e' +select * from t1 where col1 > 'b' and col1 < 'e'; +col1 +c +d +drop table t1; +set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +set use_stat_tables=@save_use_stat_tables; +# +# Bug mdev-9628: unindexed blob column without min-max statistics +# with optimizer_use_condition_selectivity=3 +# +set use_stat_tables='preferably'; +set optimizer_use_condition_selectivity=3; +create table t1(col1 char(32)); +insert into t1 values ('a'),('b'),('c'),('d'), ('e'),('f'),('g'),('h'); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +create table t2(col1 text); +insert into t2 values ('a'),('b'),('c'),('d'), ('e'),('f'),('g'),('h'); +analyze table t2; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze Warning Engine-independent statistics are not collected for column 'col1' +test.t2 analyze status OK +select * from t1 where col1 > 'b' and col1 < 'd'; +col1 +c +explain extended +select * from t1 where col1 > 'b' and col1 < 'd'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 28.57 Using where +Warnings: +Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` > 'b' and `test`.`t1`.`col1` < 'd' +select * from t2 where col1 > 'b' and col1 < 'd'; +col1 +c +explain extended +select * from t2 where col1 > 'b' and col1 < 'd'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where +Warnings: +Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` > 'b' and `test`.`t2`.`col1` < 'd' +select * from t2 where col1 < 'b' and col1 > 'd'; +col1 +explain extended +select * from t2 where col1 < 'b' and col1 > 'd'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where 0 +drop table t1,t2; +set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +set use_stat_tables=@save_use_stat_tables; +# +# Bug mdev-11364: IS NULL over not nullable datetime column +# in mergeable derived +# +set use_stat_tables='preferably'; +set optimizer_use_condition_selectivity=4; +set HISTOGRAM_SIZE = 255; +CREATE TABLE t1 (t TIME, d DATE NOT NULL); +INSERT INTO t1 VALUES ('10:00:00', '0000-00-00'),('11:00:00','0000-00-00'); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +SELECT * FROM (SELECT t FROM t1 WHERE d IS NULL) sq; +t +10:00:00 +11:00:00 +DROP TABLE t1; +set histogram_size=@save_histogram_size; +set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +set use_stat_tables=@save_use_stat_tables; diff --git a/mysql-test/r/selectivity_innodb.result b/mysql-test/r/selectivity_innodb.result index 2c1913f0929..a05c14c8e71 100644 --- a/mysql-test/r/selectivity_innodb.result +++ b/mysql-test/r/selectivity_innodb.result @@ -30,13 +30,13 @@ select * from t1 where a is null; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 40.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where isnull(`test`.`t1`.`a`) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is null explain extended select * from t1 where a is not null; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 60.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` is not null) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not null drop table t1; set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; DROP DATABASE IF EXISTS dbt3_s001; @@ -83,7 +83,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 100.00 Using where Warnings: Note 1276 Field or reference 'dbt3_s001.part.p_partkey' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `dbt3_s001`.`supplier`.`s_acctbal` AS `s_acctbal`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`nation`.`n_name` AS `n_name`,`dbt3_s001`.`part`.`p_partkey` AS `p_partkey`,`dbt3_s001`.`part`.`p_mfgr` AS `p_mfgr`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`dbt3_s001`.`supplier`.`s_comment` AS `s_comment` from `dbt3_s001`.`part` join `dbt3_s001`.`supplier` join `dbt3_s001`.`partsupp` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where ((`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`part`.`p_size` = 9) and (`dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey`) and (`dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey`) and (`dbt3_s001`.`region`.`r_name` = 'ASIA') and (`dbt3_s001`.`part`.`p_type` like '%TIN') and (`dbt3_s001`.`partsupp`.`ps_supplycost` = <`dbt3_s001`.`part`.`p_partkey`>((select min(`dbt3_s001`.`partsupp`.`ps_supplycost`) from `dbt3_s001`.`partsupp` join `dbt3_s001`.`supplier` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where ((`dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey`) and (`dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey`) and (`dbt3_s001`.`region`.`r_name` = 'ASIA') and (`dbt3_s001`.`part`.`p_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`)))))) order by `dbt3_s001`.`supplier`.`s_acctbal` desc,`dbt3_s001`.`nation`.`n_name`,`dbt3_s001`.`supplier`.`s_name`,`dbt3_s001`.`part`.`p_partkey` +Note 1003 select `dbt3_s001`.`supplier`.`s_acctbal` AS `s_acctbal`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`nation`.`n_name` AS `n_name`,`dbt3_s001`.`part`.`p_partkey` AS `p_partkey`,`dbt3_s001`.`part`.`p_mfgr` AS `p_mfgr`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`dbt3_s001`.`supplier`.`s_comment` AS `s_comment` from `dbt3_s001`.`part` join `dbt3_s001`.`supplier` join `dbt3_s001`.`partsupp` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`part`.`p_size` = 9 and `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_type` like '%TIN' and `dbt3_s001`.`partsupp`.`ps_supplycost` = <`dbt3_s001`.`part`.`p_partkey`>((select min(`dbt3_s001`.`partsupp`.`ps_supplycost`) from `dbt3_s001`.`partsupp` join `dbt3_s001`.`supplier` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`)) order by `dbt3_s001`.`supplier`.`s_acctbal` desc,`dbt3_s001`.`nation`.`n_name`,`dbt3_s001`.`supplier`.`s_name`,`dbt3_s001`.`part`.`p_partkey` set optimizer_use_condition_selectivity=4; explain extended select @@ -124,7 +124,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 100.00 Using where Warnings: Note 1276 Field or reference 'dbt3_s001.part.p_partkey' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `dbt3_s001`.`supplier`.`s_acctbal` AS `s_acctbal`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`nation`.`n_name` AS `n_name`,`dbt3_s001`.`part`.`p_partkey` AS `p_partkey`,`dbt3_s001`.`part`.`p_mfgr` AS `p_mfgr`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`dbt3_s001`.`supplier`.`s_comment` AS `s_comment` from `dbt3_s001`.`part` join `dbt3_s001`.`supplier` join `dbt3_s001`.`partsupp` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where ((`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`part`.`p_size` = 9) and (`dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey`) and (`dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey`) and (`dbt3_s001`.`region`.`r_name` = 'ASIA') and (`dbt3_s001`.`part`.`p_type` like '%TIN') and (`dbt3_s001`.`partsupp`.`ps_supplycost` = <`dbt3_s001`.`part`.`p_partkey`>((select min(`dbt3_s001`.`partsupp`.`ps_supplycost`) from `dbt3_s001`.`partsupp` join `dbt3_s001`.`supplier` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where ((`dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey`) and (`dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey`) and (`dbt3_s001`.`region`.`r_name` = 'ASIA') and (`dbt3_s001`.`part`.`p_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`)))))) order by `dbt3_s001`.`supplier`.`s_acctbal` desc,`dbt3_s001`.`nation`.`n_name`,`dbt3_s001`.`supplier`.`s_name`,`dbt3_s001`.`part`.`p_partkey` +Note 1003 select `dbt3_s001`.`supplier`.`s_acctbal` AS `s_acctbal`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`nation`.`n_name` AS `n_name`,`dbt3_s001`.`part`.`p_partkey` AS `p_partkey`,`dbt3_s001`.`part`.`p_mfgr` AS `p_mfgr`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`dbt3_s001`.`supplier`.`s_comment` AS `s_comment` from `dbt3_s001`.`part` join `dbt3_s001`.`supplier` join `dbt3_s001`.`partsupp` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`part`.`p_size` = 9 and `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_type` like '%TIN' and `dbt3_s001`.`partsupp`.`ps_supplycost` = <`dbt3_s001`.`part`.`p_partkey`>((select min(`dbt3_s001`.`partsupp`.`ps_supplycost`) from `dbt3_s001`.`partsupp` join `dbt3_s001`.`supplier` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`)) order by `dbt3_s001`.`supplier`.`s_acctbal` desc,`dbt3_s001`.`nation`.`n_name`,`dbt3_s001`.`supplier`.`s_name`,`dbt3_s001`.`part`.`p_partkey` === Q15 === create view revenue0 (supplier_no, total_revenue) as select l_suppkey, sum(l_extendedprice * (1 - l_discount)) @@ -148,7 +148,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 SUBQUERY ALL NULL NULL NULL NULL 229 100.00 4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 229 100.00 Using where; Using temporary; Using filesort Warnings: -Note 1003 select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where ((`revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey`) and (`revenue0`.`total_revenue` = (select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`))) order by `dbt3_s001`.`supplier`.`s_suppkey` +Note 1003 select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where `revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey` and `revenue0`.`total_revenue` = (select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`) order by `dbt3_s001`.`supplier`.`s_suppkey` select s_suppkey, s_name, s_address, s_phone, total_revenue from supplier, revenue0 where s_suppkey = supplier_no @@ -169,7 +169,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 SUBQUERY ALL NULL NULL NULL NULL 228 100.00 4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 229 100.00 Using where; Using temporary; Using filesort Warnings: -Note 1003 select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where ((`revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey`) and (`revenue0`.`total_revenue` = (select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`))) order by `dbt3_s001`.`supplier`.`s_suppkey` +Note 1003 select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where `revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey` and `revenue0`.`total_revenue` = (select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`) order by `dbt3_s001`.`supplier`.`s_suppkey` select s_suppkey, s_name, s_address, s_phone, total_revenue from supplier, revenue0 where s_suppkey = supplier_no @@ -196,7 +196,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY partsupp ref PRIMARY,i_ps_partkey i_ps_partkey 4 dbt3_s001.part.p_partkey 3 100.00 Using where; Using index 2 MATERIALIZED supplier ALL PRIMARY NULL NULL NULL 10 100.00 Using where Warnings: -Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where ((`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`part`.`p_brand` <> 'Brand#11') and (not((`dbt3_s001`.`part`.`p_type` like 'SMALL POLISHED%'))) and (`dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8)) and (not(<`dbt3_s001`.`partsupp`.`ps_suppkey`>((`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where (`dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%') ), (`dbt3_s001`.`partsupp`.`ps_suppkey` in on distinct_key where ((`dbt3_s001`.`partsupp`.`ps_suppkey` = ``.`s_suppkey`))))))))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` +Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`part`.`p_brand` <> 'Brand#11' and `dbt3_s001`.`part`.`p_type` not like 'SMALL POLISHED%' and `dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8) and !<`dbt3_s001`.`partsupp`.`ps_suppkey`>((`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where `dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%' ), (`dbt3_s001`.`partsupp`.`ps_suppkey` in on distinct_key where `dbt3_s001`.`partsupp`.`ps_suppkey` = ``.`s_suppkey`)))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` select p_brand, p_type, p_size, count(distinct ps_suppkey) as supplier_cnt from partsupp, part where p_partkey = ps_partkey @@ -240,7 +240,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY partsupp ref PRIMARY,i_ps_partkey i_ps_partkey 4 dbt3_s001.part.p_partkey 3 100.00 Using where; Using index 2 MATERIALIZED supplier ALL PRIMARY NULL NULL NULL 10 100.00 Using where Warnings: -Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where ((`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`part`.`p_brand` <> 'Brand#11') and (not((`dbt3_s001`.`part`.`p_type` like 'SMALL POLISHED%'))) and (`dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8)) and (not(<`dbt3_s001`.`partsupp`.`ps_suppkey`>((`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where (`dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%') ), (`dbt3_s001`.`partsupp`.`ps_suppkey` in on distinct_key where ((`dbt3_s001`.`partsupp`.`ps_suppkey` = ``.`s_suppkey`))))))))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` +Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`part`.`p_brand` <> 'Brand#11' and `dbt3_s001`.`part`.`p_type` not like 'SMALL POLISHED%' and `dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8) and !<`dbt3_s001`.`partsupp`.`ps_suppkey`>((`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where `dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%' ), (`dbt3_s001`.`partsupp`.`ps_suppkey` in on distinct_key where `dbt3_s001`.`partsupp`.`ps_suppkey` = ``.`s_suppkey`)))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` select p_brand, p_type, p_size, count(distinct ps_suppkey) as supplier_cnt from partsupp, part where p_partkey = ps_partkey @@ -284,7 +284,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY partsupp ref PRIMARY,i_ps_partkey i_ps_partkey 4 dbt3_s001.part.p_partkey 3 100.00 Using where; Using index 2 MATERIALIZED supplier ALL PRIMARY NULL NULL NULL 10 100.00 Using where Warnings: -Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where ((`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`part`.`p_brand` <> 'Brand#11') and (not((`dbt3_s001`.`part`.`p_type` like 'SMALL POLISHED%'))) and (`dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8)) and (not(<`dbt3_s001`.`partsupp`.`ps_suppkey`>((`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where (`dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%') ), (`dbt3_s001`.`partsupp`.`ps_suppkey` in on distinct_key where ((`dbt3_s001`.`partsupp`.`ps_suppkey` = ``.`s_suppkey`))))))))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` +Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`part`.`p_brand` <> 'Brand#11' and `dbt3_s001`.`part`.`p_type` not like 'SMALL POLISHED%' and `dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8) and !<`dbt3_s001`.`partsupp`.`ps_suppkey`>((`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where `dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%' ), (`dbt3_s001`.`partsupp`.`ps_suppkey` in on distinct_key where `dbt3_s001`.`partsupp`.`ps_suppkey` = ``.`s_suppkey`)))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` select p_brand, p_type, p_size, count(distinct ps_suppkey) as supplier_cnt from partsupp, part where p_partkey = ps_partkey @@ -331,7 +331,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY lineitem ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey_quantity 4 dbt3_s001.orders.o_orderkey 4 100.00 Using index 2 MATERIALIZED lineitem index NULL PRIMARY 8 NULL 6005 100.00 Warnings: -Note 1003 select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from (select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having (sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250)) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey`) and (``.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey`) and (`dbt3_s001`.`lineitem`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey`)) group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`,`dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE` +Note 1003 select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from (select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where `dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey` and ``.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey` and `dbt3_s001`.`lineitem`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey` group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`,`dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE` select c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity) from customer, orders, lineitem @@ -365,7 +365,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY lineitem ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 .l_orderkey 4 100.00 2 MATERIALIZED lineitem index NULL PRIMARY 8 NULL 6005 100.00 Warnings: -Note 1003 select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from (select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having (sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250)) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey`) and (`dbt3_s001`.`orders`.`o_orderkey` = ``.`l_orderkey`) and (`dbt3_s001`.`lineitem`.`l_orderkey` = ``.`l_orderkey`)) group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`,`dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE` +Note 1003 select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from (select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where `dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey` and `dbt3_s001`.`orders`.`o_orderkey` = ``.`l_orderkey` and `dbt3_s001`.`lineitem`.`l_orderkey` = ``.`l_orderkey` group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`,`dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE` select c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity) from customer, orders, lineitem @@ -403,7 +403,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 SUBQUERY customer ALL NULL NULL NULL NULL 150 100.00 Using where Warnings: Note 1276 Field or reference 'dbt3_s001.customer.c_custkey' of SELECT #4 was resolved in SELECT #2 -Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where ((substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and (`dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where ((`dbt3_s001`.`customer`.`c_acctbal` > 0.00) and (substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25'))))) and (not((1,exists(select 1 from `dbt3_s001`.`orders` where (`dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`)))))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) +Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25') and `dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where `dbt3_s001`.`customer`.`c_acctbal` > 0.00 and substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and !(1,exists(select 1 from `dbt3_s001`.`orders` where `dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`)) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) select cntrycode, count(*) as numcust, sum(c_acctbal) as totacctbal from ( select substr(c_phone, 1, 2) as cntrycode, c_acctbal @@ -444,7 +444,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 SUBQUERY customer ALL NULL NULL NULL NULL 150 91.00 Using where Warnings: Note 1276 Field or reference 'dbt3_s001.customer.c_custkey' of SELECT #4 was resolved in SELECT #2 -Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where ((substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and (`dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where ((`dbt3_s001`.`customer`.`c_acctbal` > 0.00) and (substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25'))))) and (not((1,exists(select 1 from `dbt3_s001`.`orders` where (`dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`)))))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) +Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25') and `dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where `dbt3_s001`.`customer`.`c_acctbal` > 0.00 and substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and !(1,exists(select 1 from `dbt3_s001`.`orders` where `dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`)) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) select cntrycode, count(*) as numcust, sum(c_acctbal) as totacctbal from ( select substr(c_phone, 1, 2) as cntrycode, c_acctbal @@ -494,7 +494,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2 Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2 -Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= (cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < ((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10 +Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`nation`.`n_name` = 'UNITED STATES' and `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_availqty` > <`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select 0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`) from `dbt3_s001`.`lineitem` where `dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey` and `dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`lineitem`.`l_shipDATE` >= (cast('1993-01-01' as date)) and `dbt3_s001`.`lineitem`.`l_shipDATE` < (cast('1993-01-01' as date) + interval '1' year))) and `dbt3_s001`.`part`.`p_name` like 'g%' order by `dbt3_s001`.`supplier`.`s_name` limit 10 select sql_calc_found_rows s_name, s_address from supplier, nation @@ -548,7 +548,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2 Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2 -Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= (cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < ((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10 +Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where `dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey` and `dbt3_s001`.`nation`.`n_name` = 'UNITED STATES' and `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_availqty` > <`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select 0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`) from `dbt3_s001`.`lineitem` where `dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey` and `dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`lineitem`.`l_shipDATE` >= (cast('1993-01-01' as date)) and `dbt3_s001`.`lineitem`.`l_shipDATE` < (cast('1993-01-01' as date) + interval '1' year))) and `dbt3_s001`.`part`.`p_name` like 'g%' order by `dbt3_s001`.`supplier`.`s_name` limit 10 select sql_calc_found_rows s_name, s_address from supplier, nation @@ -604,7 +604,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2 Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2 -Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= (cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < ((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10 +Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where `dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey` and `dbt3_s001`.`nation`.`n_name` = 'UNITED STATES' and `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_availqty` > <`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select 0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`) from `dbt3_s001`.`lineitem` where `dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey` and `dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`lineitem`.`l_shipDATE` >= (cast('1993-01-01' as date)) and `dbt3_s001`.`lineitem`.`l_shipDATE` < (cast('1993-01-01' as date) + interval '1' year))) and `dbt3_s001`.`part`.`p_name` like 'g%' order by `dbt3_s001`.`supplier`.`s_name` limit 10 select sql_calc_found_rows s_name, s_address from supplier, nation @@ -660,7 +660,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2 Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2 -Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= (cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < ((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10 +Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where `dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey` and `dbt3_s001`.`nation`.`n_name` = 'UNITED STATES' and `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_availqty` > <`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select 0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`) from `dbt3_s001`.`lineitem` where `dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey` and `dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`lineitem`.`l_shipDATE` >= (cast('1993-01-01' as date)) and `dbt3_s001`.`lineitem`.`l_shipDATE` < (cast('1993-01-01' as date) + interval '1' year))) and `dbt3_s001`.`part`.`p_name` like 'g%' order by `dbt3_s001`.`supplier`.`s_name` limit 10 select sql_calc_found_rows s_name, s_address from supplier, nation @@ -716,7 +716,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2 Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2 -Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= (cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < ((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10 +Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where `dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey` and `dbt3_s001`.`nation`.`n_name` = 'UNITED STATES' and `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_availqty` > <`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select 0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`) from `dbt3_s001`.`lineitem` where `dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey` and `dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`lineitem`.`l_shipDATE` >= (cast('1993-01-01' as date)) and `dbt3_s001`.`lineitem`.`l_shipDATE` < (cast('1993-01-01' as date) + interval '1' year))) and `dbt3_s001`.`part`.`p_name` like 'g%' order by `dbt3_s001`.`supplier`.`s_name` limit 10 select sql_calc_found_rows s_name, s_address from supplier, nation @@ -761,7 +761,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t2 ref idx idx 5 test.t1.b 1 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t2`.`d` = `test`.`t1`.`b`)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t2`.`d` = `test`.`t1`.`b` SELECT * FROM v1 INNER JOIN t2 ON ( a = c AND b = d ); a b c d 0 7 0 7 @@ -782,7 +782,7 @@ select * from t1 where a < 1 and a > 7; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` < 1) and (`test`.`t1`.`a` > 7)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1 and `test`.`t1`.`a` > 7 select * from t1 where a < 1 and a > 7; a set optimizer_use_condition_selectivity=3; @@ -802,11 +802,11 @@ insert into t2 values (2),(3); explain extended select * from t1 where a in ( select b from t2 ) AND ( a > 3 ); id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 1 0.00 Using where +1 PRIMARY t1 ALL NULL NULL NULL NULL 1 100.00 Using where 1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 0.00 +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t1`.`a` > 3)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t1`.`a` > 3 select * from t1 where a in ( select b from t2 ) AND ( a > 3 ); a drop table t1,t2; @@ -842,7 +842,7 @@ explain extended select * from t1 where a=0; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 1025 0.39 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 0) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 0 drop table t1; set histogram_size=@save_histogram_size; set histogram_type=@save_histogram_type; @@ -911,7 +911,7 @@ SELECT * FROM t1 WHERE a > 3; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 75.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > 3) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 3 SELECT * FROM t1 WHERE a > 3; a 9 @@ -944,7 +944,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range a a 5 NULL 1 0.00 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`a` > 9) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` > 9 SELECT * FROM t1, t2 WHERE a > 9; a b c set optimizer_switch=@save_optimizer_switch; @@ -995,7 +995,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 SUBQUERY t2 ALL NULL NULL NULL NULL 7 100.00 2 SUBQUERY t1 ALL NULL NULL NULL NULL 14 100.00 Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where ((((1,exists(select 1 from `test`.`t1` join `test`.`t2`))) and (`test`.`t1`.`a` <> `test`.`t2`.`b`)) or (`test`.`t1`.`a` <= 4)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where ((1,exists(select 1 from `test`.`t1` join `test`.`t2`))) and `test`.`t1`.`a` <> `test`.`t2`.`b` or `test`.`t1`.`a` <= 4 set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; DROP TABLE t1,t2; set use_stat_tables=@save_use_stat_tables; @@ -1018,25 +1018,25 @@ SELECT * FROM t1 WHERE a IS NULL; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 14 28.57 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where isnull(`test`.`t1`.`a`) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is null EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IS NOT NULL; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 14 71.43 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` is not null) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not null EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IS NULL OR a IS NOT NULL; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 14 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (isnull(`test`.`t1`.`a`) or (`test`.`t1`.`a` is not null)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is null or `test`.`t1`.`a` is not null EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IS NULL OR a < 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 14 69.39 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (isnull(`test`.`t1`.`a`) or (`test`.`t1`.`a` < 5)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is null or `test`.`t1`.`a` < 5 set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; DROP TABLE t1; set use_stat_tables=@save_use_stat_tables; @@ -1145,7 +1145,7 @@ explain extended select * from t1 where a between 5 and 7; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 25.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` between 5 and 7) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` between 5 and 7 alter table t1 change column a a int; analyze table t1; Table Op Msg_type Msg_text @@ -1156,7 +1156,7 @@ explain extended select * from t1 where a between 5 and 7; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 25.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` between 5 and 7) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` between 5 and 7 set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; drop table t1; set use_stat_tables=@save_use_stat_tables; @@ -1189,7 +1189,7 @@ WHERE 2 IN ( SELECT pk2 FROM t2 LEFT JOIN t3 ON (c3 = c2 ) WHERE i2 = 3 ); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` left join `test`.`t3` on((`test`.`t3`.`c3` = 'b'))) where 0 +Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` left join `test`.`t3` on(`test`.`t3`.`c3` = 'b')) where 0 set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; DROP TABLE t1,t2,t3; # @@ -1256,7 +1256,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE language ALL NULL NULL NULL NULL 6 0.00 Using where; Using join buffer (flat, BNL join) 1 SIMPLE continent ALL NULL NULL NULL NULL 6 100.00 Using join buffer (incremental, BNL join) Warnings: -Note 1003 select `test`.`language`.`lang_group` AS `lang_group`,`test`.`language`.`lang` AS `lang`,`test`.`country`.`code` AS `code`,`test`.`country`.`country_group` AS `country_group`,`test`.`continent`.`cont_group` AS `cont_group`,`test`.`continent`.`cont` AS `cont` from `test`.`language` join `test`.`country` join `test`.`continent` where ((`test`.`language`.`lang_group` = `test`.`country`.`country_group`) and isnull(`test`.`country`.`country_group`)) +Note 1003 select `test`.`language`.`lang_group` AS `lang_group`,`test`.`language`.`lang` AS `lang`,`test`.`country`.`code` AS `code`,`test`.`country`.`country_group` AS `country_group`,`test`.`continent`.`cont_group` AS `cont_group`,`test`.`continent`.`cont` AS `cont` from `test`.`language` join `test`.`country` join `test`.`continent` where `test`.`language`.`lang_group` = `test`.`country`.`country_group` and `test`.`country`.`country_group` is null set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; drop table language, country, continent; set use_stat_tables=@save_use_stat_tables; @@ -1304,7 +1304,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ref c,d c 5 test.t1.b 5 100.00 1 SIMPLE t3 ALL NULL NULL NULL NULL 262144 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t1` `t3` where ((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t3`.`a` = `test`.`t2`.`d`) and (`test`.`t3`.`b` < 5) and (`test`.`t1`.`a` < 2000)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t1` `t3` where `test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t3`.`a` = `test`.`t2`.`d` and `test`.`t3`.`b` < 5 and `test`.`t1`.`a` < 2000 select * from t1, t2, t1 as t3 where t1.b=t2.c and t2.d=t3.a and t3.b<5 and t1.a < 2000; a b c d a b @@ -1321,7 +1321,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ref c,d d 5 test.t3.a 7 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 262144 2.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t1` `t3` where ((`test`.`t1`.`b` = `test`.`t2`.`c`) and (`test`.`t2`.`d` = `test`.`t3`.`a`) and (`test`.`t3`.`b` < 5) and (`test`.`t1`.`a` < 2000)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t1` `t3` where `test`.`t1`.`b` = `test`.`t2`.`c` and `test`.`t2`.`d` = `test`.`t3`.`a` and `test`.`t3`.`b` < 5 and `test`.`t1`.`a` < 2000 select * from t1, t2, t1 as t3 where t1.b=t2.c and t2.d=t3.a and t3.b<5 and t1.a < 2000; a b c d a b @@ -1382,14 +1382,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 0.99 Using where 1 SIMPLE t2 ref a a 5 test.t1.a 10 100.00 Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 10)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t1`.`a` < 10 explain extended select * from t1 straight_join t2 where t1.a=t2.a and t2.a<10; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 0.99 Using where 1 SIMPLE t2 ref a a 5 test.t1.a 10 100.00 Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 10)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t1`.`a` < 10 set histogram_size=@save_histogram_size; set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; drop table t0,t1,t2; @@ -1415,7 +1415,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE a ALL NULL NULL NULL NULL 1000 100.00 Using where 1 SIMPLE b ALL NULL NULL NULL NULL 1000 100.00 Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`a`.`a` AS `a`,`test`.`a`.`b` AS `b`,`test`.`b`.`a` AS `a`,`test`.`b`.`b` AS `b` from `test`.`t2` `a` straight_join `test`.`t2` `b` where isnull(`test`.`a`.`a`) +Note 1003 select `test`.`a`.`a` AS `a`,`test`.`a`.`b` AS `b`,`test`.`b`.`a` AS `a`,`test`.`b`.`b` AS `b` from `test`.`t2` `a` straight_join `test`.`t2` `b` where `test`.`a`.`a` is null set histogram_size=@save_histogram_size; set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; drop table t0,t1,t2; @@ -1443,13 +1443,106 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ref PRIMARY,b b 5 const 2 66.67 Using where; Using index 1 SIMPLE t2 ALL NULL NULL NULL NULL 14 100.00 Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`i` AS `i` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`a` <> 'USARussian') and isnull(`test`.`t1`.`b`)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`i` AS `i` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` <> 'USARussian' and `test`.`t1`.`b` is null SELECT * FROM t1, t2 WHERE a <> 'USARussian' AND b IS NULL; a b i set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; DROP TABLE t1,t2; set use_stat_tables=@save_use_stat_tables; +# +# Bug mdev-11096: range condition over column without statistical data +# +set use_stat_tables='preferably'; +set optimizer_use_condition_selectivity=3; +create table t1(col1 char(32)); +insert into t1 values ('a'),('b'),('c'),('d'), ('e'),('f'),('g'),('h'); +analyze table t1 persistent for columns () indexes (); +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +explain extended +select * from t1 where col1 > 'b' and col1 < 'e'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` > 'b' and `test`.`t1`.`col1` < 'e' +select * from t1 where col1 > 'b' and col1 < 'e'; +col1 +c +d +drop table t1; +set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +set use_stat_tables=@save_use_stat_tables; +# +# Bug mdev-9628: unindexed blob column without min-max statistics +# with optimizer_use_condition_selectivity=3 +# +set use_stat_tables='preferably'; +set optimizer_use_condition_selectivity=3; +create table t1(col1 char(32)); +insert into t1 values ('a'),('b'),('c'),('d'), ('e'),('f'),('g'),('h'); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +create table t2(col1 text); +insert into t2 values ('a'),('b'),('c'),('d'), ('e'),('f'),('g'),('h'); +analyze table t2; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze Warning Engine-independent statistics are not collected for column 'col1' +test.t2 analyze status OK +select * from t1 where col1 > 'b' and col1 < 'd'; +col1 +c +explain extended +select * from t1 where col1 > 'b' and col1 < 'd'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 28.57 Using where +Warnings: +Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` > 'b' and `test`.`t1`.`col1` < 'd' +select * from t2 where col1 > 'b' and col1 < 'd'; +col1 +c +explain extended +select * from t2 where col1 > 'b' and col1 < 'd'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where +Warnings: +Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` > 'b' and `test`.`t2`.`col1` < 'd' +select * from t2 where col1 < 'b' and col1 > 'd'; +col1 +explain extended +select * from t2 where col1 < 'b' and col1 > 'd'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where 0 +drop table t1,t2; +set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +set use_stat_tables=@save_use_stat_tables; +# +# Bug mdev-11364: IS NULL over not nullable datetime column +# in mergeable derived +# +set use_stat_tables='preferably'; +set optimizer_use_condition_selectivity=4; +set HISTOGRAM_SIZE = 255; +CREATE TABLE t1 (t TIME, d DATE NOT NULL); +INSERT INTO t1 VALUES ('10:00:00', '0000-00-00'),('11:00:00','0000-00-00'); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +SELECT * FROM (SELECT t FROM t1 WHERE d IS NULL) sq; +t +10:00:00 +11:00:00 +DROP TABLE t1; +set histogram_size=@save_histogram_size; +set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +set use_stat_tables=@save_use_stat_tables; set optimizer_switch=@save_optimizer_switch_for_selectivity_test; set @tmp_ust= @@use_stat_tables; set @tmp_oucs= @@optimizer_use_condition_selectivity; @@ -1536,8 +1629,67 @@ where t1.child_user_id=t3.id and t1.child_group_id is null and t2.lower_group_na parent_id child_group_id child_user_id id lower_group_name directory_id id drop table t1,t2,t3; # +# MDEV-9187: duplicate of bug mdev-9628 +# +set use_stat_tables = preferably; +set optimizer_use_condition_selectivity=3; +CREATE TABLE t1 (f1 char(32)) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('foo'),('bar'),('qux'); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +SELECT * FROM t1 WHERE f1 < 'm'; +f1 +foo +bar +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE f1 < 'm'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 72.09 Using where +Warnings: +Note 1003 select `test`.`t1`.`f1` AS `f1` from `test`.`t1` where `test`.`t1`.`f1` < 'm' +CREATE TABLE t2 (f1 TEXT) ENGINE=InnoDB; +INSERT INTO t2 VALUES ('foo'),('bar'),('qux'); +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze Warning Engine-independent statistics are not collected for column 'f1' +test.t2 analyze status OK +SELECT * FROM t2 WHERE f1 <> 'qux'; +f1 +foo +bar +EXPLAIN EXTENDED +SELECT * FROM t2 WHERE f1 <> 'qux'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 select `test`.`t2`.`f1` AS `f1` from `test`.`t2` where `test`.`t2`.`f1` <> 'qux' +DROP TABLE t1,t2; +# # End of 10.0 tests # +# +# Start of 10.1 tests +# +# +# MDEV-11060: sql/protocol.cc:532: void Protocol::end_statement(): Assertion `0' failed +# +set optimizer_use_condition_selectivity=4; +drop view if exists v1; +create table t1 (a int not null, b int, c int) engine=InnoDB; +create trigger trgi before insert on t1 for each row set new.a=if(new.a is null,new.b,new.c); +create table t2 (d int, e int) engine=InnoDB; +update t1, t2 set a=NULL, b=2, c=NULL where b=d and e=200; +create view v1 as select * from t1, t2 where d=2; +insert v1 (a,c) values (NULL, 20); +ERROR 23000: Column 'a' cannot be null +drop table t1,t2; +drop view v1; +# +# End of 10.1 tests +# set use_stat_tables= @tmp_ust; set optimizer_use_condition_selectivity= @tmp_oucs; SET SESSION STORAGE_ENGINE=DEFAULT; diff --git a/mysql-test/r/selectivity_no_engine.result b/mysql-test/r/selectivity_no_engine.result index da210b09c23..7fc3c6e9909 100644 --- a/mysql-test/r/selectivity_no_engine.result +++ b/mysql-test/r/selectivity_no_engine.result @@ -38,12 +38,12 @@ explain extended select * from t2 where col1 IN (20, 180); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 1100 1.35 Using where Warnings: -Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where (`test`.`t2`.`col1` in (20,180)) +Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` in (20,180) explain extended select * from t2 where col1 IN (180, 20); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 1100 1.35 Using where Warnings: -Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where (`test`.`t2`.`col1` in (180,20)) +Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` in (180,20) drop table t1, t2; # # MDEV-5926: EITS: Histogram estimates for column=least_possible_value are wrong @@ -65,25 +65,25 @@ explain extended select * from t1 where a=2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 9.52 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2 # Should select about 10%: explain extended select * from t1 where a=1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 9.52 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 1) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 # Must not have filtered=100%: explain extended select * from t1 where a=0; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 9.52 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 0) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 0 # Again, must not have filtered=100%: explain extended select * from t1 where a=-1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 9.52 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = -1) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = -1 drop table t0, t1; # # MDEV-4362: Selectivity estimates for IN (...) do not depend on whether the values are in range @@ -104,18 +104,18 @@ explain extended select * from t1 where col1 in (1,2,3); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 3.37 Using where Warnings: -Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where (`test`.`t1`.`col1` in (1,2,3)) +Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` in (1,2,3) # Must not cause fp division by zero, or produce nonsense numbers: explain extended select * from t1 where col1 in (-1,-2,-3); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 5.94 Using where Warnings: -Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where (`test`.`t1`.`col1` in (-1,-2,-3)) +Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` in (-1,-2,-3) explain extended select * from t1 where col1<=-1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 1.00 Using where Warnings: -Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where (`test`.`t1`.`col1` <= -1) +Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` <= -1 drop table t1, t2; # # MDEV-5984: EITS: Incorrect filtered% value for single-table select with range access @@ -136,7 +136,7 @@ explain extended select * from t2 where a in (1,2,3) and b in (1,2,3); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 range a a 10 NULL 9 100.00 Using index condition Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col2` AS `col2` from `test`.`t2` where ((`test`.`t2`.`a` in (1,2,3)) and (`test`.`t2`.`b` in (1,2,3))) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col2` AS `col2` from `test`.`t2` where `test`.`t2`.`a` in (1,2,3) and `test`.`t2`.`b` in (1,2,3) drop table t2, t1; # # MDEV-5980: EITS: if condition is used for REF access, its selectivity is still in filtered% @@ -157,13 +157,13 @@ explain extended select * from t1 where col1=2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 9.90 Using where Warnings: -Note 1003 select `test`.`t1`.`key1` AS `key1`,`test`.`t1`.`col1` AS `col1` from `test`.`t1` where (`test`.`t1`.`col1` = 2) +Note 1003 select `test`.`t1`.`key1` AS `key1`,`test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` = 2 # Must show 100%, not 10% explain extended select * from t1 where key1=2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ref key1 key1 5 const 98 100.00 Warnings: -Note 1003 select `test`.`t1`.`key1` AS `key1`,`test`.`t1`.`col1` AS `col1` from `test`.`t1` where (`test`.`t1`.`key1` = 2) +Note 1003 select `test`.`t1`.`key1` AS `key1`,`test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`key1` = 2 drop table t0, t1; # MDEV-6003: EITS: ref access, keypart2=const vs keypart2=expr - inconsistent filtered% value # @@ -195,14 +195,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t0 ALL NULL NULL NULL NULL 10 100.00 Using where 1 SIMPLE t1 ref kp1 kp1 10 test.t0.a,func 10 100.00 Using index condition Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t1`.`kp1` AS `kp1`,`test`.`t1`.`kp2` AS `kp2`,`test`.`t1`.`filler1` AS `filler1`,`test`.`t1`.`filler2` AS `filler2` from `test`.`t0` join `test`.`t1` where ((`test`.`t1`.`kp1` = `test`.`t0`.`a`) and (`test`.`t1`.`kp2` = (`test`.`t0`.`a` + 1))) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t1`.`kp1` AS `kp1`,`test`.`t1`.`kp2` AS `kp2`,`test`.`t1`.`filler1` AS `filler1`,`test`.`t1`.`filler2` AS `filler2` from `test`.`t0` join `test`.`t1` where `test`.`t1`.`kp1` = `test`.`t0`.`a` and `test`.`t1`.`kp2` = `test`.`t0`.`a` + 1 # NOTE: t0: 10*100% is ok, t1: 10*9.90% is bad. t1 should have 10*100%. explain extended select * from t0, t1 where t1.kp1=t0.a and t1.kp2=4; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t0 ALL NULL NULL NULL NULL 10 100.00 Using where 1 SIMPLE t1 ref kp1 kp1 10 test.t0.a,const 10 100.00 Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t1`.`kp1` AS `kp1`,`test`.`t1`.`kp2` AS `kp2`,`test`.`t1`.`filler1` AS `filler1`,`test`.`t1`.`filler2` AS `filler2` from `test`.`t0` join `test`.`t1` where ((`test`.`t1`.`kp1` = `test`.`t0`.`a`) and (`test`.`t1`.`kp2` = 4)) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t1`.`kp1` AS `kp1`,`test`.`t1`.`kp2` AS `kp2`,`test`.`t1`.`filler1` AS `filler1`,`test`.`t1`.`filler2` AS `filler2` from `test`.`t0` join `test`.`t1` where `test`.`t1`.`kp1` = `test`.`t0`.`a` and `test`.`t1`.`kp2` = 4 drop table t0, t1; # # MDEV-6209: Assertion `join->best_read < double(1.79769313486231570815e+308L)' @@ -267,14 +267,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE ta ALL NULL NULL NULL NULL 1000 4.95 Using where 1 SIMPLE tb ALL NULL NULL NULL NULL 1000 9.90 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`ta`.`a` AS `a`,`test`.`tb`.`a` AS `a` from `test`.`t1` `ta` join `test`.`t2` `tb` where ((`test`.`ta`.`a` < 40) and (`test`.`tb`.`a` < 100)) +Note 1003 select `test`.`ta`.`a` AS `a`,`test`.`tb`.`a` AS `a` from `test`.`t1` `ta` join `test`.`t2` `tb` where `test`.`ta`.`a` < 40 and `test`.`tb`.`a` < 100 # Here, tb.filtered should not become 100%: explain extended select * from t1 ta, t2 tb where ta.a < 40 and tb.a < 100 and tb.a=ta.a; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE ta ALL NULL NULL NULL NULL 1000 4.95 Using where 1 SIMPLE tb ALL NULL NULL NULL NULL 1000 4.95 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`ta`.`a` AS `a`,`test`.`tb`.`a` AS `a` from `test`.`t1` `ta` join `test`.`t2` `tb` where ((`test`.`tb`.`a` = `test`.`ta`.`a`) and (`test`.`ta`.`a` < 40) and (`test`.`ta`.`a` < 100)) +Note 1003 select `test`.`ta`.`a` AS `a`,`test`.`tb`.`a` AS `a` from `test`.`t1` `ta` join `test`.`t2` `tb` where `test`.`tb`.`a` = `test`.`ta`.`a` and `test`.`ta`.`a` < 40 and `test`.`ta`.`a` < 100 drop table t0,t1,t2; # # MDEV-8779: mysqld got signal 11 in sql/opt_range_mrr.cc:100(step_down_to) diff --git a/mysql-test/r/set_statement.result b/mysql-test/r/set_statement.result index a66d636d18e..4cb143f6ba5 100644 --- a/mysql-test/r/set_statement.result +++ b/mysql-test/r/set_statement.result @@ -1152,7 +1152,7 @@ explain extended select week(a) from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 Warnings: -Note 1003 select week('2000-01-01',@@default_week_format) AS `week(a)` from dual +Note 1003 select week('2000-01-01') AS `week(a)` from dual prepare stmt1 from "select week(a) from t1"; execute stmt1; week(a) diff --git a/mysql-test/r/shm.result b/mysql-test/r/shm.result index cd3e6a559b8..65187b6b19b 100644 --- a/mysql-test/r/shm.result +++ b/mysql-test/r/shm.result @@ -1509,7 +1509,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where Warnings: -Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> '')) +Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> '' select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3; companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1) 00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087 diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index ed768343581..7ef480a6019 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -342,7 +342,7 @@ t1 CREATE TABLE `t1` ( `empty_char` char(0) DEFAULT NULL, `type_char` char(2) DEFAULT NULL, `type_varchar` varchar(10) DEFAULT NULL, - `type_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `type_timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `type_date` date NOT NULL DEFAULT '0000-00-00', `type_time` time NOT NULL DEFAULT '00:00:00', `type_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', @@ -742,17 +742,17 @@ DROP VIEW v1; CREATE VIEW v1 AS SELECT NOW(); SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select now() AS `NOW()` binary binary +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select current_timestamp() AS `NOW()` binary binary DROP VIEW v1; CREATE VIEW v1 AS SELECT SQL_CACHE NOW(); SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_cache now() AS `NOW()` binary binary +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_cache current_timestamp() AS `NOW()` binary binary DROP VIEW v1; CREATE VIEW v1 AS SELECT SQL_NO_CACHE NOW(); SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache now() AS `NOW()` binary binary +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache current_timestamp() AS `NOW()` binary binary DROP VIEW v1; CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE NOW(); ERROR HY000: Incorrect usage of SQL_CACHE and SQL_NO_CACHE @@ -979,7 +979,7 @@ def information_schema COLUMNS COLUMNS CHARACTER_SET_NAME CHARACTER_SET_NAME 253 def information_schema COLUMNS COLUMNS COLLATION_NAME COLLATION_NAME 253 96 0 Y 0 0 33 def information_schema COLUMNS COLUMNS COLUMN_TYPE COLUMN_TYPE 252 589815 7 N 17 0 33 def information_schema COLUMNS COLUMNS COLUMN_KEY COLUMN_KEY 253 9 3 N 1 0 33 -def information_schema COLUMNS COLUMNS EXTRA EXTRA 253 81 0 N 1 0 33 +def information_schema COLUMNS COLUMNS EXTRA EXTRA 253 90 0 N 1 0 33 def information_schema COLUMNS COLUMNS PRIVILEGES PRIVILEGES 253 240 31 N 1 0 33 def information_schema COLUMNS COLUMNS COLUMN_COMMENT COLUMN_COMMENT 253 3072 0 N 1 0 33 TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT @@ -998,7 +998,7 @@ def information_schema COLUMNS COLUMNS COLUMN_TYPE Type 252 589815 7 N 17 0 33 def information_schema COLUMNS COLUMNS IS_NULLABLE Null 253 9 2 N 1 0 33 def information_schema COLUMNS COLUMNS COLUMN_KEY Key 253 9 3 N 1 0 33 def information_schema COLUMNS COLUMNS COLUMN_DEFAULT Default 252 589815 0 Y 16 0 33 -def information_schema COLUMNS COLUMNS EXTRA Extra 253 81 0 N 1 0 33 +def information_schema COLUMNS COLUMNS EXTRA Extra 253 90 0 N 1 0 33 Field Type Null Key Default Extra c int(11) NO PRI NULL ---------------------------------------------------------------- diff --git a/mysql-test/r/show_explain_ps.result b/mysql-test/r/show_explain_ps.result index f5c487e9e44..71c8f117fa2 100644 --- a/mysql-test/r/show_explain_ps.result +++ b/mysql-test/r/show_explain_ps.result @@ -1,3 +1,5 @@ +truncate table performance_schema.events_statements_history_long; +truncate table performance_schema.events_stages_history_long; drop table if exists t0, t1; select * from performance_schema.setup_instruments where name like '%show_explain%'; NAME ENABLED TIMED @@ -28,8 +30,13 @@ count(*) 10 set debug_dbug=''; select event_name -from performance_schema.events_waits_history_long -where event_name='wait/synch/cond/sql/show_explain'; +from +performance_schema.events_stages_history_long +where +event_name like '%show explain' and +thread_id in(select thread_id +from performance_schema.events_statements_history_long +where EVENT_NAME='statement/sql/show_explain'); event_name -wait/synch/cond/sql/show_explain +stage/sql/show explain drop table t0; diff --git a/mysql-test/r/slowlog_enospace-10508.result b/mysql-test/r/slowlog_enospace-10508.result new file mode 100644 index 00000000000..f39bfa2f00e --- /dev/null +++ b/mysql-test/r/slowlog_enospace-10508.result @@ -0,0 +1,60 @@ +call mtr.add_suppression('Error writing file.*errno: 28 '); +create table t1 (a int, b int) engine=memory; +insert t1 select seq, seq+1 from seq_1_to_1000; +set global general_log=0; +set global log_queries_not_using_indexes=1; +set debug_dbug='+d,simulate_file_write_error'; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +select * from t1 where a>10; +set debug_dbug=''; +set global general_log=1; +set global log_queries_not_using_indexes=default; +drop table t1; diff --git a/mysql-test/r/sp-code.result b/mysql-test/r/sp-code.result index c9d2f7b023a..f6a7fff5d4e 100644 --- a/mysql-test/r/sp-code.result +++ b/mysql-test/r/sp-code.result @@ -51,10 +51,10 @@ Pos Instruction 9 set err@1 1 10 hreturn 5 11 cfetch c@0 n@4 -12 jump_if_not 15(17) isnull(n@4) -13 set nulls@2 (nulls@2 + 1) +12 jump_if_not 15(17) n@4 is null +13 set nulls@2 nulls@2 + 1 14 jump 17 -15 set count@3 (count@3 + 1) +15 set count@3 count@3 + 1 16 stmt 4 "update t2 set idx = count where name=n" 17 hpop 1 18 jump 7 @@ -167,35 +167,35 @@ Pos Instruction 12 set v_schedmax@5 NULL 13 stmt 0 "select count(*) into v_schedmax from ..." 14 set v_tcounter@6 0 -15 jump_if_not 39(39) (v_i@3 <= v_schedmax@5) +15 jump_if_not 39(39) v_i@3 <= v_schedmax@5 16 set v_row@7 NULL 17 set v_col@8 NULL 18 stmt 0 "select row,col into v_row,v_col from ..." 19 stmt 0 "select dig into v_dig from sudoku_wor..." 20 set_case_expr (34) 0 v_dig@4 -21 jump_if_not 25(34) (case_expr@0 = 0) +21 jump_if_not 25(34) case_expr@0 = 0 22 set v_dig@4 1 23 stmt 4 "update sudoku_work set dig = 1 where ..." 24 jump 34 -25 jump_if_not 32(34) (case_expr@0 = 9) -26 jump_if_not 30(34) (v_i@3 > 0) +25 jump_if_not 32(34) case_expr@0 = 9 +26 jump_if_not 30(34) v_i@3 > 0 27 stmt 4 "update sudoku_work set dig = 0 where ..." -28 set v_i@3 (v_i@3 - 1) +28 set v_i@3 v_i@3 - 1 29 jump 15 30 stmt 0 "select v_scounter as 'Solutions'" 31 jump 45 -32 set v_dig@4 (v_dig@4 + 1) +32 set v_dig@4 v_dig@4 + 1 33 stmt 4 "update sudoku_work set dig = v_dig wh..." -34 set v_tcounter@6 (v_tcounter@6 + 1) -35 jump_if_not 37(37) (not(`sudoku_digit_ok`(v_row@7,v_col@8,v_dig@4))) +34 set v_tcounter@6 v_tcounter@6 + 1 +35 jump_if_not 37(37) !`sudoku_digit_ok`(v_row@7,v_col@8,v_dig@4) 36 jump 15 -37 set v_i@3 (v_i@3 + 1) +37 set v_i@3 v_i@3 + 1 38 jump 15 39 stmt 0 "select dig from sudoku_work" 40 stmt 0 "select v_tcounter as 'Tests'" -41 set v_scounter@2 (v_scounter@2 + 1) -42 jump_if_not 45(14) (p_all@1 and (v_i@3 > 0)) -43 set v_i@3 (v_i@3 - 1) +41 set v_scounter@2 v_scounter@2 + 1 +42 jump_if_not 45(14) p_all@1 and v_i@3 > 0 +43 set v_i@3 v_i@3 - 1 44 jump 14 45 stmt 9 "drop temporary table sudoku_work, sud..." drop procedure sudoku_solve; @@ -323,13 +323,13 @@ SHOW PROCEDURE CODE proc_19194_simple; Pos Instruction 0 set str@1 NULL 1 set_case_expr (12) 0 i@0 -2 jump_if_not 5(12) (case_expr@0 = 1) +2 jump_if_not 5(12) case_expr@0 = 1 3 set str@1 '1' 4 jump 12 -5 jump_if_not 8(12) (case_expr@0 = 2) +5 jump_if_not 8(12) case_expr@0 = 2 6 set str@1 '2' 7 jump 12 -8 jump_if_not 11(12) (case_expr@0 = 3) +8 jump_if_not 11(12) case_expr@0 = 3 9 set str@1 '3' 10 jump 12 11 set str@1 'unknown' @@ -337,13 +337,13 @@ Pos Instruction SHOW PROCEDURE CODE proc_19194_searched; Pos Instruction 0 set str@1 NULL -1 jump_if_not 4(11) (i@0 = 1) +1 jump_if_not 4(11) i@0 = 1 2 set str@1 '1' 3 jump 11 -4 jump_if_not 7(11) (i@0 = 2) +4 jump_if_not 7(11) i@0 = 2 5 set str@1 '2' 6 jump 11 -7 jump_if_not 10(11) (i@0 = 3) +7 jump_if_not 10(11) i@0 = 3 8 set str@1 '3' 9 jump 11 10 set str@1 'unknown' @@ -353,27 +353,27 @@ Pos Instruction 0 set str_i@2 NULL 1 set str_j@3 NULL 2 set_case_expr (27) 0 i@0 -3 jump_if_not 6(27) (case_expr@0 = 10) +3 jump_if_not 6(27) case_expr@0 = 10 4 set str_i@2 '10' 5 jump 27 -6 jump_if_not 20(27) (case_expr@0 = 20) +6 jump_if_not 20(27) case_expr@0 = 20 7 set str_i@2 '20' -8 jump_if_not 11(18) (j@1 = 1) +8 jump_if_not 11(18) j@1 = 1 9 set str_j@3 '1' 10 jump 18 -11 jump_if_not 14(18) (j@1 = 2) +11 jump_if_not 14(18) j@1 = 2 12 set str_j@3 '2' 13 jump 18 -14 jump_if_not 17(18) (j@1 = 3) +14 jump_if_not 17(18) j@1 = 3 15 set str_j@3 '3' 16 jump 18 17 set str_j@3 'unknown' 18 stmt 0 "select "i was 20"" 19 jump 27 -20 jump_if_not 23(27) (case_expr@0 = 30) +20 jump_if_not 23(27) case_expr@0 = 30 21 set str_i@2 '30' 22 jump 27 -23 jump_if_not 26(27) (case_expr@0 = 40) +23 jump_if_not 26(27) case_expr@0 = 40 24 set str_i@2 '40' 25 jump 27 26 set str_i@2 'unknown' @@ -382,28 +382,28 @@ SHOW PROCEDURE CODE proc_19194_nested_2; Pos Instruction 0 set str_i@2 NULL 1 set str_j@3 NULL -2 jump_if_not 5(27) (i@0 = 10) +2 jump_if_not 5(27) i@0 = 10 3 set str_i@2 '10' 4 jump 27 -5 jump_if_not 20(27) (i@0 = 20) +5 jump_if_not 20(27) i@0 = 20 6 set str_i@2 '20' 7 set_case_expr (18) 0 j@1 -8 jump_if_not 11(18) (case_expr@0 = 1) +8 jump_if_not 11(18) case_expr@0 = 1 9 set str_j@3 '1' 10 jump 18 -11 jump_if_not 14(18) (case_expr@0 = 2) +11 jump_if_not 14(18) case_expr@0 = 2 12 set str_j@3 '2' 13 jump 18 -14 jump_if_not 17(18) (case_expr@0 = 3) +14 jump_if_not 17(18) case_expr@0 = 3 15 set str_j@3 '3' 16 jump 18 17 set str_j@3 'unknown' 18 stmt 0 "select "i was 20"" 19 jump 27 -20 jump_if_not 23(27) (i@0 = 30) +20 jump_if_not 23(27) i@0 = 30 21 set str_i@2 '30' 22 jump 27 -23 jump_if_not 26(27) (i@0 = 40) +23 jump_if_not 26(27) i@0 = 40 24 set str_i@2 '40' 25 jump 27 26 set str_i@2 'unknown' @@ -413,28 +413,28 @@ Pos Instruction 0 set str_i@2 NULL 1 set str_j@3 NULL 2 set_case_expr (28) 0 i@0 -3 jump_if_not 6(28) (case_expr@0 = 10) +3 jump_if_not 6(28) case_expr@0 = 10 4 set str_i@2 '10' 5 jump 28 -6 jump_if_not 21(28) (case_expr@0 = 20) +6 jump_if_not 21(28) case_expr@0 = 20 7 set str_i@2 '20' 8 set_case_expr (19) 1 j@1 -9 jump_if_not 12(19) (case_expr@1 = 1) +9 jump_if_not 12(19) case_expr@1 = 1 10 set str_j@3 '1' 11 jump 19 -12 jump_if_not 15(19) (case_expr@1 = 2) +12 jump_if_not 15(19) case_expr@1 = 2 13 set str_j@3 '2' 14 jump 19 -15 jump_if_not 18(19) (case_expr@1 = 3) +15 jump_if_not 18(19) case_expr@1 = 3 16 set str_j@3 '3' 17 jump 19 18 set str_j@3 'unknown' 19 stmt 0 "select "i was 20"" 20 jump 28 -21 jump_if_not 24(28) (case_expr@0 = 30) +21 jump_if_not 24(28) case_expr@0 = 30 22 set str_i@2 '30' 23 jump 28 -24 jump_if_not 27(28) (case_expr@0 = 40) +24 jump_if_not 27(28) case_expr@0 = 40 25 set str_i@2 '40' 26 jump 28 27 set str_i@2 'unknown' @@ -443,27 +443,27 @@ SHOW PROCEDURE CODE proc_19194_nested_4; Pos Instruction 0 set str_i@2 NULL 1 set str_j@3 NULL -2 jump_if_not 5(26) (i@0 = 10) +2 jump_if_not 5(26) i@0 = 10 3 set str_i@2 '10' 4 jump 26 -5 jump_if_not 19(26) (i@0 = 20) +5 jump_if_not 19(26) i@0 = 20 6 set str_i@2 '20' -7 jump_if_not 10(17) (j@1 = 1) +7 jump_if_not 10(17) j@1 = 1 8 set str_j@3 '1' 9 jump 17 -10 jump_if_not 13(17) (j@1 = 2) +10 jump_if_not 13(17) j@1 = 2 11 set str_j@3 '2' 12 jump 17 -13 jump_if_not 16(17) (j@1 = 3) +13 jump_if_not 16(17) j@1 = 3 14 set str_j@3 '3' 15 jump 17 16 set str_j@3 'unknown' 17 stmt 0 "select "i was 20"" 18 jump 26 -19 jump_if_not 22(26) (i@0 = 30) +19 jump_if_not 22(26) i@0 = 30 20 set str_i@2 '30' 21 jump 26 -22 jump_if_not 25(26) (i@0 = 40) +22 jump_if_not 25(26) i@0 = 40 23 set str_i@2 '40' 24 jump 26 25 set str_i@2 'unknown' @@ -668,8 +668,8 @@ Pos Instruction 0 set i@1 5 1 hpush_jump 8 2 CONTINUE 2 stmt 0 "select 'caught something'" -3 jump_if_not 7(7) (i@1 > 0) -4 set i@1 (i@1 - 1) +3 jump_if_not 7(7) i@1 > 0 +4 set i@1 i@1 - 1 5 stmt 0 "select 'looping', i" 6 jump 3 7 hreturn 2 @@ -683,8 +683,8 @@ Pos Instruction 0 set i@1 5 1 hpush_jump 9 2 CONTINUE 2 stmt 0 "select 'caught something'" -3 jump_if_not 7(7) (i@1 > 0) -4 set i@1 (i@1 - 1) +3 jump_if_not 7(7) i@1 > 0 +4 set i@1 i@1 - 1 5 stmt 0 "select 'looping', i" 6 jump 3 7 stmt 0 "select 'optimizer: keep hreturn'" @@ -796,8 +796,8 @@ Pos Instruction 0 set count1@1 '0' 1 set vb@2 NULL 2 set last_row@3 NULL -3 jump_if_not 24(24) (num@0 >= 1) -4 set num@0 (num@0 - 1) +3 jump_if_not 24(24) num@0 >= 1 +4 set num@0 num@0 - 1 5 cpush cur1@0 6 hpush_jump 9 4 CONTINUE 7 set last_row@3 1 @@ -807,11 +807,11 @@ Pos Instruction 11 hpush_jump 13 4 EXIT 12 hreturn 0 17 13 cfetch cur1@0 vb@2 -14 jump_if_not 17(17) (last_row@3 = 1) +14 jump_if_not 17(17) last_row@3 = 1 15 hpop 1 16 jump 19 17 hpop 1 -18 jump_if_not 11(19) (last_row@3 = 1) +18 jump_if_not 11(19) last_row@3 = 1 19 cclose cur1@0 20 hpop 1 21 cpop 1 @@ -821,8 +821,8 @@ Pos Instruction 0 set count1@1 '0' 1 set vb@2 NULL 2 set last_row@3 NULL -3 jump_if_not 23(23) (num@0 >= 1) -4 set num@0 (num@0 - 1) +3 jump_if_not 23(23) num@0 >= 1 +4 set num@0 num@0 - 1 5 cpush cur1@0 6 hpush_jump 9 4 CONTINUE 7 set last_row@3 1 @@ -831,11 +831,11 @@ Pos Instruction 10 copen cur1@0 11 cpush cur2@1 12 cfetch cur1@0 vb@2 -13 jump_if_not 16(16) (last_row@3 = 1) +13 jump_if_not 16(16) last_row@3 = 1 14 cpop 1 15 jump 18 16 cpop 1 -17 jump_if_not 11(18) (last_row@3 = 1) +17 jump_if_not 11(18) last_row@3 = 1 18 cclose cur1@0 19 hpop 1 20 cpop 1 @@ -883,7 +883,7 @@ SHOW PROCEDURE CODE p1; Pos Instruction 0 set dummy@0 0 1 set_case_expr (6) 0 12 -2 jump_if_not 5(6) (case_expr@0 = 12) +2 jump_if_not 5(6) case_expr@0 = 12 3 set dummy@0 0 4 jump 6 5 error 1339 diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 130e789d3eb..02cca6b7284 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -6045,12 +6045,12 @@ select bug20777(9223372036854775810) as '9223372036854775810 2**63+2'; 9223372036854775810 2**63+2 9223372036854775810 select bug20777(-9223372036854775808) as 'lower bounds signed bigint'; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(f1@0 - 10)' +ERROR 22003: BIGINT UNSIGNED value is out of range in 'f1@0 - 10' select bug20777(9223372036854775807) as 'upper bounds signed bigint'; upper bounds signed bigint 9223372036854775807 select bug20777(0) as 'lower bounds unsigned bigint'; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(f1@0 - 10)' +ERROR 22003: BIGINT UNSIGNED value is out of range in 'f1@0 - 10' select bug20777(18446744073709551615) as 'upper bounds unsigned bigint'; upper bounds unsigned bigint 18446744073709551615 @@ -6060,7 +6060,7 @@ upper bounds unsigned bigint + 1 Warnings: Warning 1264 Out of range value for column 'f1' at row 1 select bug20777(-1) as 'lower bounds unsigned bigint - 1'; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(f1@0 - 10)' +ERROR 22003: BIGINT UNSIGNED value is out of range in 'f1@0 - 10' create table examplebug20777 as select 0 as 'i', bug20777(9223372036854775806) as '2**63-2', @@ -7870,6 +7870,45 @@ v1 6 DROP PROCEDURE p1; DROP TABLE t1; +# +# MDEV-10713: signal 11 error on multi-table update - crash in +# handler::increment_statistics or in make_select or assertion +# failure pfs_thread == ((PFS_thread*) pthread_getspecific((THR_PFS))) +# +CREATE TABLE `t1` ( +`CLOSE_YN` varchar(10) COLLATE utf8_bin DEFAULT NULL +) DEFAULT CHARSET=utf8 COLLATE=utf8_bin ; +CREATE TABLE `t2` ( +`ap_close_to` varchar(8) COLLATE utf8_bin DEFAULT NULL +) DEFAULT CHARSET=utf8 COLLATE=utf8_bin ; +insert t1 values (1); +CREATE FUNCTION `f1`(`P_DC_CD` VARBINARY(50), `P_SYS_DATE` DATETIME) RETURNS datetime +DETERMINISTIC +SQL SECURITY INVOKER +BEGIN +DECLARE V_SYS_DATE DATETIME; +SELECT now() AS LOC_DATE INTO V_SYS_DATE ; +RETURN v_sys_date ; +END $$ +update t1 S +JOIN +( +SELECT CASE +WHEN DATE_FORMAT( f1('F01', NOW()) , '%Y%m%d') <= CLOSE_YMD +THEN '99991231' + ELSE '' END ACCOUNT_APPLY_YYYYMMDD +FROM ( +select case +when 'AP'='AP' + then ap_close_to +end AS CLOSE_YMD +from t2 +) A +) X +SET S.CLOSE_YN = '' +where 1=1; +drop function if exists f1; +drop table t1,t2; # End of 5.5 test # # MDEV-7040: Crash in field_conv, memcpy_field_possible, part#2 @@ -8001,3 +8040,52 @@ return 1; end | ERROR 0A000: Not allowed to return a result set from a function drop table t1,t2; +# +# MDEV-11584: GRANT inside an SP does not work well on 2nd execution +# +CREATE PROCEDURE sp1() +GRANT ALL PRIVILEGES ON *.* TO 'foo'@'%' IDENTIFIED BY 'pass'; +CALL sp1(); +CALL sp1(); +drop user 'foo'@'%'; +drop procedure sp1; +#End of 10.1 tests +# +# MDEV-11081: CURSOR for query with GROUP BY +# +CREATE TABLE t1 (name VARCHAR(10), value INT); +INSERT INTO t1 VALUES ('b',1); +INSERT INTO t1 VALUES ('b',1); +INSERT INTO t1 VALUES ('c',1); +INSERT INTO t1 VALUES ('a',1); +INSERT INTO t1 VALUES ('a',1); +INSERT INTO t1 VALUES ('a',1); +CREATE PROCEDURE p1 () +BEGIN +DECLARE done INT DEFAULT FALSE; +DECLARE v_name VARCHAR(10); +DECLARE v_total INT; +DECLARE c CURSOR FOR +SELECT name, SUM(value) AS total FROM t1 GROUP BY name; +DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; +OPEN c; +read_loop: +LOOP +FETCH c INTO v_name, v_total; +IF done THEN +LEAVE read_loop; +END IF; +SELECT v_name, v_total; +END LOOP; +CLOSE c; +END; +| +CALL p1(); +v_name v_total +a 3 +v_name v_total +b 2 +v_name v_total +c 1 +DROP PROCEDURE p1; +DROP TABLE t1; diff --git a/mysql-test/r/sql_mode.result b/mysql-test/r/sql_mode.result index e1afb964f0a..782ae00bb33 100644 --- a/mysql-test/r/sql_mode.result +++ b/mysql-test/r/sql_mode.result @@ -149,7 +149,7 @@ show create table t1; Table Create Table t1 CREATE TABLE "t1" ( "f1" int(11) NOT NULL AUTO_INCREMENT, - "f2" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + "f2" timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY ("f1") ) set session sql_mode=no_field_options; @@ -157,7 +157,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, - `f2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `f2` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`f1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; diff --git a/mysql-test/r/ssl.result b/mysql-test/r/ssl.result index 566314cf7a9..ac18da81b93 100644 --- a/mysql-test/r/ssl.result +++ b/mysql-test/r/ssl.result @@ -1518,7 +1518,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where Warnings: -Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> '')) +Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> '' select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3; companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1) 00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087 diff --git a/mysql-test/r/ssl_compress.result b/mysql-test/r/ssl_compress.result index dcf9a41de29..4e37cc68a24 100644 --- a/mysql-test/r/ssl_compress.result +++ b/mysql-test/r/ssl_compress.result @@ -1515,7 +1515,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where Warnings: -Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> '')) +Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> '' select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3; companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1) 00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087 diff --git a/mysql-test/r/statistics.result b/mysql-test/r/statistics.result index 52986fa9a6b..bf5cb4f1748 100644 --- a/mysql-test/r/statistics.result +++ b/mysql-test/r/statistics.result @@ -1676,6 +1676,26 @@ analyze table t1; Table Op Msg_type Msg_text test.t1 analyze status Table is already up to date drop table t1; +# +# MDEV-10435 crash with bad stat tables +# +set use_stat_tables='preferably'; +call mtr.add_suppression("Column count of mysql.table_stats is wrong. Expected 3, found 1. The table is probably corrupted"); +rename table mysql.table_stats to test.table_stats; +flush tables; +create table t1 (a int); +rename table t1 to t2, t3 to t4; +ERROR 42S02: Table 'test.t3' doesn't exist +drop table t1; +rename table test.table_stats to mysql.table_stats; +rename table mysql.table_stats to test.table_stats; +create table mysql.table_stats (a int); +flush tables; +create table t1 (a int); +rename table t1 to t2, t3 to t4; +ERROR 42S02: Table 'test.t3' doesn't exist +drop table t1, mysql.table_stats; +rename table test.table_stats to mysql.table_stats; set use_stat_tables=@save_use_stat_tables; # # Start of 10.2 tests @@ -1688,7 +1708,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` blob DEFAULT NULL, - `b` text DEFAULT DECODE_HISTOGRAM('SINGLE_PREC_HB',a) + `b` text DEFAULT decode_histogram('SINGLE_PREC_HB',`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (0x0000000000000000000000000101010101010101010202020303030304040404050505050606070707080809090A0A0B0C0D0D0E0E0F10111213131415161718191B1C1E202224292A2E33373B4850575F6A76818C9AA7B9C4CFDADFE5EBF0F4F8FAFCFF); SELECT b FROM t1; diff --git a/mysql-test/r/status.result b/mysql-test/r/status.result index 9d75a262592..4966418dbfd 100644 --- a/mysql-test/r/status.result +++ b/mysql-test/r/status.result @@ -4,6 +4,7 @@ SET @old_log_output = @@global.log_output; SET GLOBAL LOG_OUTPUT = 'FILE'; connect con1,localhost,root,,; connect con2,localhost,root,,; +connection default; flush status; show status like 'Table_lock%'; Variable_name Value @@ -13,33 +14,42 @@ select * from information_schema.session_status where variable_name like 'Table_ VARIABLE_NAME VARIABLE_VALUE TABLE_LOCKS_IMMEDIATE 0 TABLE_LOCKS_WAITED 0 -connection con1; set sql_log_bin=0; set @old_general_log = @@global.general_log; set global general_log = 'OFF'; drop table if exists t1; create table t1(n int) engine=myisam; insert into t1 values(1); -select 1; -1 +select get_lock('mysqltest_lock', 100); +get_lock('mysqltest_lock', 100) 1 connection con2; -lock tables t1 read; -unlock tables; -lock tables t1 read; +# Sending: +update t1 set n = get_lock('mysqltest_lock', 100); connection con1; +# Wait for the first UPDATE to get blocked. +# Sending: update t1 set n = 3; +connection default; +# wait for the second UPDATE to get blocked +select release_lock('mysqltest_lock'); +release_lock('mysqltest_lock') +1 connection con2; -unlock tables; +# Reaping first UPDATE +select release_lock('mysqltest_lock'); +release_lock('mysqltest_lock') +1 connection con1; +# Reaping second UPDATE show status like 'Table_locks_waited'; Variable_name Value Table_locks_waited 1 +connection default; drop table t1; set global general_log = @old_general_log; disconnect con2; disconnect con1; -connection default; select 1; 1 1 diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index 4da77f21792..49a7c45de6e 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -897,7 +897,7 @@ ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES ('-1.2E-3'); ERROR 22003: Out of range value for column 'col2' at row 1 UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0; -ERROR 22003: DOUBLE value is out of range in '("test"."t1"."col1" * 5000)' +ERROR 22003: DOUBLE value is out of range in '"test"."t1"."col1" * 5000' UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0; ERROR 22012: Division by 0 UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0; @@ -1273,7 +1273,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index ff5823c10d9..dee15c3b451 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -56,7 +56,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select 1 AS `1` from dual having ((select 1) = 1) +Note 1003 select 1 AS `1` from dual having (select 1) = 1 SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; 1 1 @@ -197,7 +197,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) from `test`.`t2`))) +Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1)) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where `test`.`t4`.`b` = (select max(`test`.`t2`.`a`) * 4 from `test`.`t2`)) select (select a from t3 where a 1)) `tt` +Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where `test`.`t3`.`a` < 8 order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`a` > 1) `tt` set optimizer_switch=@tmp_optimizer_switch; select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1); a @@ -237,7 +237,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select `test`.`t4`.`b` AS `b`,<`test`.`t4`.`a`>((select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` +Note 1003 select `test`.`t4`.`b` AS `b`,<`test`.`t4`.`a`>((select avg(`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` select * from t3 where exists (select * from t2 where t2.b=t3.a); a 7 @@ -283,7 +283,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select min(`test`.`t2`.`b`) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2); a 7 @@ -327,7 +327,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select <`test`.`t2`.`a`>((select 2 from dual where (2 = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`))) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2` +Note 1003 select <`test`.`t2`.`a`>((select 2 from dual where 2 = `test`.`t2`.`a` union select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2` select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2; ERROR 21000: Subquery returns more than 1 row create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq)); @@ -345,7 +345,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t6 ALL i1 NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where (`test`.`t6`.`clinic_uq` = `test`.`t7`.`uq`) +Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where `test`.`t6`.`clinic_uq` = `test`.`t7`.`uq` select * from t1 where a= (select a from t2,t4 where t2.b=t4.b); ERROR 23000: Column 'a' in field list is ambiguous drop table t1,t2,t3; @@ -406,13 +406,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03') +Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03' EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'); 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 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` +Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03') AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; date 2002-08-03 @@ -559,7 +559,7 @@ EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: -Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1') +Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where `test`.`t1`.`numeropost` = '1' EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index @@ -741,7 +741,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ref id id 5 const 1 100.00 Using index Warnings: Note 1249 Select 2 was reduced during optimization -Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = 1) +Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = 1 SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3); id 1 @@ -754,7 +754,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1249 Select 3 was reduced during optimization Note 1249 Select 2 was reduced during optimization -Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = ((1 + 1))) +Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = (1 + 1) EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index @@ -762,7 +762,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <`test`.`t2`.`id`>((`test`.`t2`.`id`,(select 1 having ((`test`.`t2`.`id`) = (1)) union select 3 having ((`test`.`t2`.`id`) = (3))))) +Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <`test`.`t2`.`id`>((`test`.`t2`.`id`,(select 1 having (`test`.`t2`.`id`) = (1) union select 3 having (`test`.`t2`.`id`) = (3)))) SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3); id SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2); @@ -888,7 +888,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1249 Select 2 was reduced during optimization -Note 1003 select (`test`.`t1`.`a` + 1) AS `(select a+1)` from `test`.`t1` +Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` select (select a+1) from t1; (select a+1) 2.5 @@ -910,7 +910,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index 2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,<`test`.`t1`.`a`>((`test`.`t1`.`a`,(((`test`.`t1`.`a`) in t2 on a checking NULL having (`test`.`t2`.`a`))))) AS `t1.a in (select t2.a from t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`a` AS `a`,<`test`.`t1`.`a`>((`test`.`t1`.`a`,(((`test`.`t1`.`a`) in t2 on a checking NULL having `test`.`t2`.`a` is null)))) AS `t1.a in (select t2.a from t2)` from `test`.`t1` CREATE TABLE t3 (a int(11) default '0'); INSERT INTO t3 VALUES (1),(2),(3); SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1; @@ -925,7 +925,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using where; Using index 2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,<`test`.`t1`.`a`>((`test`.`t1`.`a`,(select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and (((`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having (`test`.`t2`.`a`)))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1` +Note 1003 select `test`.`t1`.`a` AS `a`,<`test`.`t1`.`a`>((`test`.`t1`.`a`,(select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a` and ((`test`.`t1`.`a`) = `test`.`t2`.`a` or `test`.`t2`.`a` is null) having `test`.`t2`.`a` is null))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1` drop table t1,t2,t3; # check correct NULL Processing for normal IN/ALL/ANY # and 2 ways of max/min optimization @@ -1325,7 +1325,7 @@ 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 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)` +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'); SELECT 0 IN (SELECT 1 FROM t1 a); 0 IN (SELECT 1 FROM t1 a) @@ -1335,7 +1335,7 @@ 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 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)` +Note 1003 select (0,(select 1 from `test`.`t1` `a` where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)` drop table t1; CREATE TABLE `t1` ( `i` int(11) NOT NULL default '0', @@ -1380,7 +1380,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: -Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`)) +Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`) drop table t1; CREATE TABLE t1 ( ID int(10) unsigned NOT NULL auto_increment, @@ -1442,7 +1442,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index 1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 75.00 Using where; Using index; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` select * from t2 where t2.a in (select a from t1 where t1.b <> 30); a 2 @@ -1452,7 +1452,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index 1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); a 2 @@ -1463,7 +1463,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) 1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` = `test`.`t2`.`a`)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`a` drop table t1, t2, t3; create table t1 (a int, b int, index a (a,b)); create table t2 (a int, index a (a)); @@ -1485,7 +1485,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index 1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using index; FirstMatch(t2) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where (`test`.`t1`.`a` = `test`.`t2`.`a`) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` select * from t2 where t2.a in (select a from t1 where t1.b <> 30); a 2 @@ -1495,7 +1495,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index 1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); a 2 @@ -1506,7 +1506,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 index a a 5 NULL 3 100.00 Using where; Using index 1 PRIMARY t1 ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`b` = `test`.`t3`.`a`) and (`test`.`t1`.`a` = `test`.`t2`.`a`)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where `test`.`t1`.`b` = `test`.`t3`.`a` and `test`.`t1`.`a` = `test`.`t2`.`a` insert into t1 values (3,31); select * from t2 where t2.a in (select a from t1 where t1.b <> 30); a @@ -1522,7 +1522,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index 1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 drop table t0, t1, t2, t3; create table t1 (a int, b int); create table t2 (a int, b int); @@ -1613,25 +1613,25 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond((`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,!<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond((`test`.`t2`.`s1`)))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond((`test`.`t2`.`s1`)))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,!<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < 'a2') having trigcond((`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,!<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` drop table t1,t2; create table t2 (a int, b int not null); create table t3 (a int); @@ -1646,7 +1646,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); a explain extended select * from t3 where a >= some (select b from t2); @@ -1654,7 +1654,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); a 6 @@ -1665,7 +1665,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); a explain extended select * from t3 where a >= some (select b from t2 group by 1); @@ -1673,7 +1673,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); a explain extended select * from t3 where NULL >= any (select b from t2); @@ -1716,7 +1716,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= (`test`.`t3`.`a`))) drop table t2, t3; CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ; INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now()); @@ -1886,14 +1886,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where 2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where Warnings: -Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where (not(<`test`.`t1`.`id`>((`test`.`t1`.`id`,(((`test`.`t1`.`id`) in t1 on PRIMARY where ((`test`.`t1`.`id` < 8) and ((`test`.`t1`.`id`) = `test`.`t1`.`id`)))))))) +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where !<`test`.`t1`.`id`>((`test`.`t1`.`id`,(((`test`.`t1`.`id`) in t1 on PRIMARY where `test`.`t1`.`id` < 8 and (`test`.`t1`.`id`) = `test`.`t1`.`id`)))) explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where 2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index Warnings: Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not((1,<`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null)))))) +Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !(1,<`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null))) insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001'); create table t2 (id int not null, text varchar(20) not null default '', primary key (id)); insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10'); @@ -1919,7 +1919,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00 1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition Warnings: -Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(((`test`.`b`.`id` = `test`.`a`.`id`) or isnull(`test`.`b`.`id`))) join `test`.`t1` `c` where (if(isnull(`test`.`b`.`id`),1000,`test`.`b`.`id`) = `test`.`c`.`id`) +Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(`test`.`b`.`id` = `test`.`a`.`id` or `test`.`b`.`id` is null) join `test`.`t1` `c` where if(`test`.`b`.`id` is null,1000,`test`.`b`.`id`) = `test`.`c`.`id` drop table t1,t2; create table t1 (a int); insert into t1 values (1); @@ -2977,20 +2977,20 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<`test`.`t1`.`one`,`test`.`t1`.`two`>(((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(trigcond((((`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)))) and trigcond(trigcond((((`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))))) having (trigcond((`test`.`t2`.`one`)) and trigcond((`test`.`t2`.`two`)))))) AS `test` from `test`.`t1` +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<`test`.`t1`.`one`,`test`.`t1`.`two`>(((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond((`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond((`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null)))) AS `test` from `test`.`t1` explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 1 PRIMARY eq_ref distinct_key distinct_key 8 func,func 1 100.00 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where (`test`.`t2`.`flag` = 'N') +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`flag` = 'N' explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<`test`.`t1`.`one`,`test`.`t1`.`two`>(((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(trigcond((((`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)))) and trigcond(trigcond((((`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))))) having (trigcond((`test`.`t2`.`one`)) and trigcond((`test`.`t2`.`two`)))))) AS `test` from `test`.`t1` +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<`test`.`t1`.`one`,`test`.`t1`.`two`>(((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond((`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond((`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null)))) AS `test` from `test`.`t1` DROP TABLE t1,t2; set optimizer_switch=@tmp11867_optimizer_switch; CREATE TABLE t1 (a char(5), b char(5)); @@ -4456,7 +4456,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select 2 AS `2` from `test`.`t1` where <`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)))) +Note 1003 select 2 AS `2` from `test`.`t1` where <`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`))) DROP TABLE t1,t2; create table t0(a int); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); @@ -4537,14 +4537,14 @@ 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 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary Warnings: -Note 1003 select 1 AS `1` from (select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` where (``.`min(a)` = 1) +Note 1003 select 1 AS `1` from (select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` where ``.`min(a)` = 1 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 const distinct_key distinct_key 4 const 1 100.00 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary Warnings: -Note 1003 select 1 AS `1` from (select min(`test`.`t1`.`a`) from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a`) join `test`.`t1` where (``.`min(a)` = 1) +Note 1003 select 1 AS `1` from (select min(`test`.`t1`.`a`) from `test`.`t1` where `test`.`t1`.`a` > 3 group by `test`.`t1`.`a`) join `test`.`t1` where ``.`min(a)` = 1 SET join_cache_level=@save_join_cache_level; DROP TABLE t1; # @@ -7130,6 +7130,17 @@ a DROP TABLE t1; SET SESSION big_tables=0; # +# MDEV-10776: Server crash on query +# +create table t1 (field1 int); +insert into t1 values (1); +select round((select 1 from t1 limit 1)) +from t1 +group by round((select 1 from t1 limit 1)); +round((select 1 from t1 limit 1)) +1 +drop table t1; +# # MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE || # m_lock_type != 2' failed in handler::ha_index_read_map # diff --git a/mysql-test/r/subselect2.result b/mysql-test/r/subselect2.result index 75e8c084026..e87f4b9b451 100644 --- a/mysql-test/r/subselect2.result +++ b/mysql-test/r/subselect2.result @@ -262,7 +262,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2c ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`c1` AS `c1` from `test`.`t1` where (not(<`test`.`t1`.`c1`,`test`.`t1`.`a`>((`test`.`t1`.`c1`,(select `test`.`t2a`.`c2` from `test`.`t2` `t2a` join `test`.`t2` `t2b` join `test`.`t2` `t2c` where (((`test`.`t2b`.`m` <> `test`.`t1`.`a`) or (`test`.`t2b`.`m` = `test`.`t2a`.`m`)) and trigcond((((`test`.`t1`.`c1`) = `test`.`t2a`.`c2`) or isnull(`test`.`t2a`.`c2`))) and (`test`.`t2c`.`c2` = `test`.`t2b`.`c2`) and (`test`.`t2b`.`n` = `test`.`t2a`.`m`)) having trigcond((`test`.`t2a`.`c2`))))))) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`c1` AS `c1` from `test`.`t1` where !<`test`.`t1`.`c1`,`test`.`t1`.`a`>((`test`.`t1`.`c1`,(select `test`.`t2a`.`c2` from `test`.`t2` `t2a` join `test`.`t2` `t2b` join `test`.`t2` `t2c` where (`test`.`t2b`.`m` <> `test`.`t1`.`a` or `test`.`t2b`.`m` = `test`.`t2a`.`m`) and trigcond((`test`.`t1`.`c1`) = `test`.`t2a`.`c2` or `test`.`t2a`.`c2` is null) and `test`.`t2c`.`c2` = `test`.`t2b`.`c2` and `test`.`t2b`.`n` = `test`.`t2a`.`m` having trigcond(`test`.`t2a`.`c2` is null)))) DROP TABLE t1,t2; # # MDEV-614, also MDEV-536, also LP:1050806: @@ -342,7 +342,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ref idx idx 6 func 2 100.00 Using where; Using index 2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on((`test`.`t3`.`a` = `test`.`t1`.`a`)) where ((`test`.`t1`.`a` = (select min(`test`.`t1`.`a`) from `test`.`t1`)) and (`test`.`t2`.`a` = (select min(`test`.`t1`.`a`) from `test`.`t1`))) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t1`.`a`) where `test`.`t1`.`a` = (select min(`test`.`t1`.`a`) from `test`.`t1`) and `test`.`t2`.`a` = (select min(`test`.`t1`.`a`) from `test`.`t1`) select * from t1, t2 left join t3 on ( t2.a = t3.a ) where t1.a = t2.a and ( t1.a = ( select min(a) from t1 ) or 0 ); a a a diff --git a/mysql-test/r/subselect3.result b/mysql-test/r/subselect3.result index a7e051e7c06..673b53b9c04 100644 --- a/mysql-test/r/subselect3.result +++ b/mysql-test/r/subselect3.result @@ -33,7 +33,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<`test`.`t2`.`a`,`test`.`t2`.`oref`>((`test`.`t2`.`a`,(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having trigcond(((`test`.`t2`.`a`) = (max(`test`.`t1`.`ie`))))))) AS `Z` from `test`.`t2` +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<`test`.`t2`.`a`,`test`.`t2`.`oref`>((`test`.`t2`.`a`,(select max(`test`.`t1`.`ie`) from `test`.`t1` where `test`.`t1`.`oref` = `test`.`t2`.`oref` group by `test`.`t1`.`grp` having trigcond((`test`.`t2`.`a`) = (max(`test`.`t1`.`ie`)))))) AS `Z` from `test`.`t2` explain extended select a, oref from t2 where a in (select max(ie) from t1 where oref=t2.oref group by grp); @@ -42,7 +42,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref` from `test`.`t2` where <`test`.`t2`.`a`,`test`.`t2`.`oref`>((`test`.`t2`.`a`,(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having ((`test`.`t2`.`a`) = (max(`test`.`t1`.`ie`)))))) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref` from `test`.`t2` where <`test`.`t2`.`a`,`test`.`t2`.`oref`>((`test`.`t2`.`a`,(select max(`test`.`t1`.`ie`) from `test`.`t1` where `test`.`t1`.`oref` = `test`.`t2`.`oref` group by `test`.`t1`.`grp` having (`test`.`t2`.`a`) = (max(`test`.`t1`.`ie`))))) select a, oref, a in ( select max(ie) from t1 where oref=t2.oref group by grp union select max(ie) from t1 where oref=t2.oref group by grp @@ -73,7 +73,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary Warnings: -Note 1003 select <`test`.`t3`.`a`>((`test`.`t3`.`a`,(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = 4) group by `test`.`t1`.`grp` having trigcond(((`test`.`t3`.`a`) = (max(`test`.`t1`.`ie`))))))) AS `a in (select max(ie) from t1 where oref=4 group by grp)` from `test`.`t3` +Note 1003 select <`test`.`t3`.`a`>((`test`.`t3`.`a`,(select max(`test`.`t1`.`ie`) from `test`.`t1` where `test`.`t1`.`oref` = 4 group by `test`.`t1`.`grp` having trigcond((`test`.`t3`.`a`) = (max(`test`.`t1`.`ie`)))))) AS `a in (select max(ie) from t1 where oref=4 group by grp)` from `test`.`t3` set @@optimizer_switch=@save_optimizer_switch; drop table t1, t2, t3; create table t1 (a int, oref int, key(a)); @@ -99,7 +99,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 2 100.00 Using where; Full scan on NULL key Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,<`test`.`t2`.`a`,`test`.`t2`.`oref`>((`test`.`t2`.`a`,(((`test`.`t2`.`a`) in t1 on a checking NULL where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) having trigcond((`test`.`t1`.`a`)))))) AS `Z` from `test`.`t2` +Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,<`test`.`t2`.`a`,`test`.`t2`.`oref`>((`test`.`t2`.`a`,(((`test`.`t2`.`a`) in t1 on a checking NULL where `test`.`t1`.`oref` = `test`.`t2`.`oref` having trigcond(`test`.`t1`.`a` is null))))) AS `Z` from `test`.`t2` flush status; select oref, a from t2 where a in (select a from t1 where oref=t2.oref); oref a @@ -169,7 +169,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ref a a 5 test.t1.b 1 100.00 Using where Warnings: Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<`test`.`t3`.`a`,`test`.`t3`.`oref`>((`test`.`t3`.`a`,(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond((((`test`.`t3`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`))) and (`test`.`t2`.`a` = `test`.`t1`.`b`)) having trigcond((`test`.`t1`.`a`))))) AS `Z` from `test`.`t3` +Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<`test`.`t3`.`a`,`test`.`t3`.`oref`>((`test`.`t3`.`a`,(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`b` = `test`.`t3`.`oref` and trigcond((`test`.`t3`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null) and `test`.`t2`.`a` = `test`.`t1`.`b` having trigcond(`test`.`t1`.`a` is null)))) AS `Z` from `test`.`t3` drop table t1, t2, t3; create table t1 (a int NOT NULL, b int NOT NULL, key(a)); insert into t1 values @@ -197,7 +197,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ref a a 4 test.t1.b 1 100.00 Using where Warnings: Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<`test`.`t3`.`a`,`test`.`t3`.`oref`>((`test`.`t3`.`a`,(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond(((`test`.`t3`.`a`) = `test`.`t1`.`a`)) and (`test`.`t2`.`a` = `test`.`t1`.`b`))))) AS `Z` from `test`.`t3` +Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<`test`.`t3`.`a`,`test`.`t3`.`oref`>((`test`.`t3`.`a`,(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`b` = `test`.`t3`.`oref` and trigcond((`test`.`t3`.`a`) = `test`.`t1`.`a`) and `test`.`t2`.`a` = `test`.`t1`.`b`))) AS `Z` from `test`.`t3` drop table t1,t2,t3; create table t1 (oref int, grp int); insert into t1 (oref, grp) values @@ -221,7 +221,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary Warnings: Note 1276 Field or reference 't2.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<`test`.`t2`.`a`,`test`.`t2`.`oref`>((`test`.`t2`.`a`,(select count(0) from `test`.`t1` group by `test`.`t1`.`grp` having ((`test`.`t1`.`grp` = `test`.`t2`.`oref`) and trigcond(((`test`.`t2`.`a`) = (count(0)))))))) AS `Z` from `test`.`t2` +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<`test`.`t2`.`a`,`test`.`t2`.`oref`>((`test`.`t2`.`a`,(select count(0) from `test`.`t1` group by `test`.`t1`.`grp` having `test`.`t1`.`grp` = `test`.`t2`.`oref` and trigcond((`test`.`t2`.`a`) = (count(0)))))) AS `Z` from `test`.`t2` drop table t1, t2; create table t1 (a int, b int, primary key (a)); insert into t1 values (1,1), (3,1),(100,1); @@ -253,7 +253,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 2 100.00 Using where; Full scan on NULL key Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(((`test`.`t2`.`a`,`test`.`t2`.`b`),(((`test`.`t2`.`a`) in t1 on a checking NULL where ((`test`.`t1`.`c` = `test`.`t2`.`oref`) and trigcond(trigcond((((`test`.`t2`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)))) and trigcond(trigcond((((`test`.`t2`.`b`) = `test`.`t1`.`b`) or isnull(`test`.`t1`.`b`))))) having (trigcond((`test`.`t1`.`a`)) and trigcond((`test`.`t1`.`b`))))))) AS `Z` from `test`.`t2` +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(((`test`.`t2`.`a`,`test`.`t2`.`b`),(((`test`.`t2`.`a`) in t1 on a checking NULL where `test`.`t1`.`c` = `test`.`t2`.`oref` and trigcond(trigcond((`test`.`t2`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null)) and trigcond(trigcond((`test`.`t2`.`b`) = `test`.`t1`.`b` or `test`.`t1`.`b` is null)) having trigcond(`test`.`t1`.`a` is null) and trigcond(`test`.`t1`.`b` is null))))) AS `Z` from `test`.`t2` select a,b, oref, (a,b) in (select a,b from t1 where c=t2.oref) Z from t2; a b oref Z NULL 1 100 0 @@ -270,7 +270,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 100 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(((`test`.`t2`.`a`,`test`.`t2`.`b`),(select `test`.`t1`.`a`,`test`.`t1`.`b` from `test`.`t1` join `test`.`t4` where ((`test`.`t1`.`c` = `test`.`t2`.`oref`) and trigcond(trigcond((((`test`.`t2`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)))) and trigcond(trigcond((((`test`.`t2`.`b`) = `test`.`t1`.`b`) or isnull(`test`.`t1`.`b`))))) having (trigcond((`test`.`t1`.`a`)) and trigcond((`test`.`t1`.`b`)))))) AS `Z` from `test`.`t2` +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(((`test`.`t2`.`a`,`test`.`t2`.`b`),(select `test`.`t1`.`a`,`test`.`t1`.`b` from `test`.`t1` join `test`.`t4` where `test`.`t1`.`c` = `test`.`t2`.`oref` and trigcond(trigcond((`test`.`t2`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null)) and trigcond(trigcond((`test`.`t2`.`b`) = `test`.`t1`.`b` or `test`.`t1`.`b` is null)) having trigcond(`test`.`t1`.`a` is null) and trigcond(`test`.`t1`.`b` is null)))) AS `Z` from `test`.`t2` select a,b, oref, (a,b) in (select a,b from t1,t4 where c=t2.oref) Z from t2; @@ -315,7 +315,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t1 index_subquery idx idx 5 func 4 100.00 Using where; Full scan on NULL key Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(((`test`.`t2`.`a`,`test`.`t2`.`b`),(((`test`.`t2`.`a`) in t1 on idx checking NULL where ((`test`.`t1`.`oref` = `test`.`t2`.`oref`) and trigcond(trigcond((((`test`.`t2`.`a`) = `test`.`t1`.`ie1`) or isnull(`test`.`t1`.`ie1`)))) and trigcond(trigcond((((`test`.`t2`.`b`) = `test`.`t1`.`ie2`) or isnull(`test`.`t1`.`ie2`))))) having (trigcond((`test`.`t1`.`ie1`)) and trigcond((`test`.`t1`.`ie2`))))))) AS `Z` from `test`.`t2` where ((`test`.`t2`.`a` = 10) and (`test`.`t2`.`b` = 10)) +Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(((`test`.`t2`.`a`,`test`.`t2`.`b`),(((`test`.`t2`.`a`) in t1 on idx checking NULL where `test`.`t1`.`oref` = `test`.`t2`.`oref` and trigcond(trigcond((`test`.`t2`.`a`) = `test`.`t1`.`ie1` or `test`.`t1`.`ie1` is null)) and trigcond(trigcond((`test`.`t2`.`b`) = `test`.`t1`.`ie2` or `test`.`t1`.`ie2` is null)) having trigcond(`test`.`t1`.`ie1` is null) and trigcond(`test`.`t1`.`ie2` is null))))) AS `Z` from `test`.`t2` where `test`.`t2`.`a` = 10 and `test`.`t2`.`b` = 10 drop table t1, t2; create table t1 (oref char(4), grp int, ie int); insert into t1 (oref, grp, ie) values @@ -585,7 +585,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t1 index_subquery idx idx 5 func 4 100.00 Using where; Full scan on NULL key Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(((`test`.`t2`.`a`,`test`.`t2`.`b`),(((`test`.`t2`.`a`) in t1 on idx checking NULL where ((`test`.`t1`.`oref` = `test`.`t2`.`oref`) and trigcond(trigcond((((`test`.`t2`.`a`) = `test`.`t1`.`ie1`) or isnull(`test`.`t1`.`ie1`)))) and trigcond(trigcond((((`test`.`t2`.`b`) = `test`.`t1`.`ie2`) or isnull(`test`.`t1`.`ie2`))))) having (trigcond((`test`.`t1`.`ie1`)) and trigcond((`test`.`t1`.`ie2`))))))) AS `Z` from `test`.`t2` +Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(((`test`.`t2`.`a`,`test`.`t2`.`b`),(((`test`.`t2`.`a`) in t1 on idx checking NULL where `test`.`t1`.`oref` = `test`.`t2`.`oref` and trigcond(trigcond((`test`.`t2`.`a`) = `test`.`t1`.`ie1` or `test`.`t1`.`ie1` is null)) and trigcond(trigcond((`test`.`t2`.`b`) = `test`.`t1`.`ie2` or `test`.`t1`.`ie2` is null)) having trigcond(`test`.`t1`.`ie1` is null) and trigcond(`test`.`t1`.`ie2` is null))))) AS `Z` from `test`.`t2` drop table t1,t2; create table t1 (oref char(4), grp int, ie int primary key); insert into t1 (oref, grp, ie) values @@ -716,7 +716,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using index 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`b` = `test`.`t1`.`a`) and (not(<`test`.`t1`.`a`>((`test`.`t1`.`a`,(select `test`.`t1`.`a` from `test`.`t1` where trigcond((((`test`.`t2`.`b`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`))) having trigcond((`test`.`t1`.`a`)))))))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`b` = `test`.`t1`.`a` and !<`test`.`t1`.`a`>((`test`.`t1`.`a`,(select `test`.`t1`.`a` from `test`.`t1` where trigcond((`test`.`t2`.`b`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null) having trigcond(`test`.`t1`.`a` is null)))) SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1)); a SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1 WHERE a > 4)); @@ -1418,7 +1418,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY c eq_ref PRIMARY PRIMARY 4 test.cona.idContact 1 100.00 Using where 1 PRIMARY a eq_ref PRIMARY PRIMARY 4 test.c.idObj 1 100.00 Using index; End temporary Warnings: -Note 1003 select `test`.`a`.`idIndividual` AS `idIndividual` from `test`.`t1` `a` semi join (`test`.`t3` `cona` join `test`.`t2` `c`) where ((`test`.`cona`.`postalStripped` = 'T2H3B2') and (`test`.`a`.`idIndividual` = `test`.`c`.`idObj`) and (`test`.`c`.`idContact` = `test`.`cona`.`idContact`)) +Note 1003 select `test`.`a`.`idIndividual` AS `idIndividual` from `test`.`t1` `a` semi join (`test`.`t3` `cona` join `test`.`t2` `c`) where `test`.`cona`.`postalStripped` = 'T2H3B2' and `test`.`a`.`idIndividual` = `test`.`c`.`idObj` and `test`.`c`.`idContact` = `test`.`cona`.`idContact` set @@optimizer_switch=@save_optimizer_switch; drop table t1,t2,t3; # @@ -1541,7 +1541,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t2.v' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`v` AS `v`,<`test`.`t2`.`v`>((select count(distinct `test`.`t1`.`i`) from `test`.`t1` where (`test`.`t1`.`v` = `test`.`t2`.`v`))) AS `subsel` from `test`.`t2` +Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`v` AS `v`,<`test`.`t2`.`v`>((select count(distinct `test`.`t1`.`i`) from `test`.`t1` where `test`.`t1`.`v` = `test`.`t2`.`v`)) AS `subsel` from `test`.`t2` DROP TABLE t1,t2; End of 5.6 tests set @@optimizer_switch=@subselect3_tmp; diff --git a/mysql-test/r/subselect3_jcl6.result b/mysql-test/r/subselect3_jcl6.result index fd28084fa43..06a5e2c5aa4 100644 --- a/mysql-test/r/subselect3_jcl6.result +++ b/mysql-test/r/subselect3_jcl6.result @@ -43,7 +43,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<`test`.`t2`.`a`,`test`.`t2`.`oref`>((`test`.`t2`.`a`,(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having trigcond(((`test`.`t2`.`a`) = (max(`test`.`t1`.`ie`))))))) AS `Z` from `test`.`t2` +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<`test`.`t2`.`a`,`test`.`t2`.`oref`>((`test`.`t2`.`a`,(select max(`test`.`t1`.`ie`) from `test`.`t1` where `test`.`t1`.`oref` = `test`.`t2`.`oref` group by `test`.`t1`.`grp` having trigcond((`test`.`t2`.`a`) = (max(`test`.`t1`.`ie`)))))) AS `Z` from `test`.`t2` explain extended select a, oref from t2 where a in (select max(ie) from t1 where oref=t2.oref group by grp); @@ -52,7 +52,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref` from `test`.`t2` where <`test`.`t2`.`a`,`test`.`t2`.`oref`>((`test`.`t2`.`a`,(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having ((`test`.`t2`.`a`) = (max(`test`.`t1`.`ie`)))))) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref` from `test`.`t2` where <`test`.`t2`.`a`,`test`.`t2`.`oref`>((`test`.`t2`.`a`,(select max(`test`.`t1`.`ie`) from `test`.`t1` where `test`.`t1`.`oref` = `test`.`t2`.`oref` group by `test`.`t1`.`grp` having (`test`.`t2`.`a`) = (max(`test`.`t1`.`ie`))))) select a, oref, a in ( select max(ie) from t1 where oref=t2.oref group by grp union select max(ie) from t1 where oref=t2.oref group by grp @@ -83,7 +83,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary Warnings: -Note 1003 select <`test`.`t3`.`a`>((`test`.`t3`.`a`,(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = 4) group by `test`.`t1`.`grp` having trigcond(((`test`.`t3`.`a`) = (max(`test`.`t1`.`ie`))))))) AS `a in (select max(ie) from t1 where oref=4 group by grp)` from `test`.`t3` +Note 1003 select <`test`.`t3`.`a`>((`test`.`t3`.`a`,(select max(`test`.`t1`.`ie`) from `test`.`t1` where `test`.`t1`.`oref` = 4 group by `test`.`t1`.`grp` having trigcond((`test`.`t3`.`a`) = (max(`test`.`t1`.`ie`)))))) AS `a in (select max(ie) from t1 where oref=4 group by grp)` from `test`.`t3` set @@optimizer_switch=@save_optimizer_switch; drop table t1, t2, t3; create table t1 (a int, oref int, key(a)); @@ -109,7 +109,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 2 100.00 Using where; Full scan on NULL key Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,<`test`.`t2`.`a`,`test`.`t2`.`oref`>((`test`.`t2`.`a`,(((`test`.`t2`.`a`) in t1 on a checking NULL where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) having trigcond((`test`.`t1`.`a`)))))) AS `Z` from `test`.`t2` +Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,<`test`.`t2`.`a`,`test`.`t2`.`oref`>((`test`.`t2`.`a`,(((`test`.`t2`.`a`) in t1 on a checking NULL where `test`.`t1`.`oref` = `test`.`t2`.`oref` having trigcond(`test`.`t1`.`a` is null))))) AS `Z` from `test`.`t2` flush status; select oref, a from t2 where a in (select a from t1 where oref=t2.oref); oref a @@ -179,7 +179,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ref a a 5 test.t1.b 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan Warnings: Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<`test`.`t3`.`a`,`test`.`t3`.`oref`>((`test`.`t3`.`a`,(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond((((`test`.`t3`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`))) and (`test`.`t2`.`a` = `test`.`t1`.`b`)) having trigcond((`test`.`t1`.`a`))))) AS `Z` from `test`.`t3` +Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<`test`.`t3`.`a`,`test`.`t3`.`oref`>((`test`.`t3`.`a`,(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`b` = `test`.`t3`.`oref` and trigcond((`test`.`t3`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null) and `test`.`t2`.`a` = `test`.`t1`.`b` having trigcond(`test`.`t1`.`a` is null)))) AS `Z` from `test`.`t3` drop table t1, t2, t3; create table t1 (a int NOT NULL, b int NOT NULL, key(a)); insert into t1 values @@ -207,7 +207,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ref a a 4 test.t1.b 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan Warnings: Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<`test`.`t3`.`a`,`test`.`t3`.`oref`>((`test`.`t3`.`a`,(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond(((`test`.`t3`.`a`) = `test`.`t1`.`a`)) and (`test`.`t2`.`a` = `test`.`t1`.`b`))))) AS `Z` from `test`.`t3` +Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<`test`.`t3`.`a`,`test`.`t3`.`oref`>((`test`.`t3`.`a`,(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`b` = `test`.`t3`.`oref` and trigcond((`test`.`t3`.`a`) = `test`.`t1`.`a`) and `test`.`t2`.`a` = `test`.`t1`.`b`))) AS `Z` from `test`.`t3` drop table t1,t2,t3; create table t1 (oref int, grp int); insert into t1 (oref, grp) values @@ -231,7 +231,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary Warnings: Note 1276 Field or reference 't2.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<`test`.`t2`.`a`,`test`.`t2`.`oref`>((`test`.`t2`.`a`,(select count(0) from `test`.`t1` group by `test`.`t1`.`grp` having ((`test`.`t1`.`grp` = `test`.`t2`.`oref`) and trigcond(((`test`.`t2`.`a`) = (count(0)))))))) AS `Z` from `test`.`t2` +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<`test`.`t2`.`a`,`test`.`t2`.`oref`>((`test`.`t2`.`a`,(select count(0) from `test`.`t1` group by `test`.`t1`.`grp` having `test`.`t1`.`grp` = `test`.`t2`.`oref` and trigcond((`test`.`t2`.`a`) = (count(0)))))) AS `Z` from `test`.`t2` drop table t1, t2; create table t1 (a int, b int, primary key (a)); insert into t1 values (1,1), (3,1),(100,1); @@ -263,7 +263,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 2 100.00 Using where; Full scan on NULL key Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(((`test`.`t2`.`a`,`test`.`t2`.`b`),(((`test`.`t2`.`a`) in t1 on a checking NULL where ((`test`.`t1`.`c` = `test`.`t2`.`oref`) and trigcond(trigcond((((`test`.`t2`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)))) and trigcond(trigcond((((`test`.`t2`.`b`) = `test`.`t1`.`b`) or isnull(`test`.`t1`.`b`))))) having (trigcond((`test`.`t1`.`a`)) and trigcond((`test`.`t1`.`b`))))))) AS `Z` from `test`.`t2` +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(((`test`.`t2`.`a`,`test`.`t2`.`b`),(((`test`.`t2`.`a`) in t1 on a checking NULL where `test`.`t1`.`c` = `test`.`t2`.`oref` and trigcond(trigcond((`test`.`t2`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null)) and trigcond(trigcond((`test`.`t2`.`b`) = `test`.`t1`.`b` or `test`.`t1`.`b` is null)) having trigcond(`test`.`t1`.`a` is null) and trigcond(`test`.`t1`.`b` is null))))) AS `Z` from `test`.`t2` select a,b, oref, (a,b) in (select a,b from t1 where c=t2.oref) Z from t2; a b oref Z NULL 1 100 0 @@ -280,7 +280,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 100 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(((`test`.`t2`.`a`,`test`.`t2`.`b`),(select `test`.`t1`.`a`,`test`.`t1`.`b` from `test`.`t1` join `test`.`t4` where ((`test`.`t1`.`c` = `test`.`t2`.`oref`) and trigcond(trigcond((((`test`.`t2`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)))) and trigcond(trigcond((((`test`.`t2`.`b`) = `test`.`t1`.`b`) or isnull(`test`.`t1`.`b`))))) having (trigcond((`test`.`t1`.`a`)) and trigcond((`test`.`t1`.`b`)))))) AS `Z` from `test`.`t2` +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(((`test`.`t2`.`a`,`test`.`t2`.`b`),(select `test`.`t1`.`a`,`test`.`t1`.`b` from `test`.`t1` join `test`.`t4` where `test`.`t1`.`c` = `test`.`t2`.`oref` and trigcond(trigcond((`test`.`t2`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null)) and trigcond(trigcond((`test`.`t2`.`b`) = `test`.`t1`.`b` or `test`.`t1`.`b` is null)) having trigcond(`test`.`t1`.`a` is null) and trigcond(`test`.`t1`.`b` is null)))) AS `Z` from `test`.`t2` select a,b, oref, (a,b) in (select a,b from t1,t4 where c=t2.oref) Z from t2; @@ -325,7 +325,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t1 index_subquery idx idx 5 func 4 100.00 Using where; Full scan on NULL key Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(((`test`.`t2`.`a`,`test`.`t2`.`b`),(((`test`.`t2`.`a`) in t1 on idx checking NULL where ((`test`.`t1`.`oref` = `test`.`t2`.`oref`) and trigcond(trigcond((((`test`.`t2`.`a`) = `test`.`t1`.`ie1`) or isnull(`test`.`t1`.`ie1`)))) and trigcond(trigcond((((`test`.`t2`.`b`) = `test`.`t1`.`ie2`) or isnull(`test`.`t1`.`ie2`))))) having (trigcond((`test`.`t1`.`ie1`)) and trigcond((`test`.`t1`.`ie2`))))))) AS `Z` from `test`.`t2` where ((`test`.`t2`.`a` = 10) and (`test`.`t2`.`b` = 10)) +Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(((`test`.`t2`.`a`,`test`.`t2`.`b`),(((`test`.`t2`.`a`) in t1 on idx checking NULL where `test`.`t1`.`oref` = `test`.`t2`.`oref` and trigcond(trigcond((`test`.`t2`.`a`) = `test`.`t1`.`ie1` or `test`.`t1`.`ie1` is null)) and trigcond(trigcond((`test`.`t2`.`b`) = `test`.`t1`.`ie2` or `test`.`t1`.`ie2` is null)) having trigcond(`test`.`t1`.`ie1` is null) and trigcond(`test`.`t1`.`ie2` is null))))) AS `Z` from `test`.`t2` where `test`.`t2`.`a` = 10 and `test`.`t2`.`b` = 10 drop table t1, t2; create table t1 (oref char(4), grp int, ie int); insert into t1 (oref, grp, ie) values @@ -595,7 +595,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t1 index_subquery idx idx 5 func 4 100.00 Using where; Full scan on NULL key Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(((`test`.`t2`.`a`,`test`.`t2`.`b`),(((`test`.`t2`.`a`) in t1 on idx checking NULL where ((`test`.`t1`.`oref` = `test`.`t2`.`oref`) and trigcond(trigcond((((`test`.`t2`.`a`) = `test`.`t1`.`ie1`) or isnull(`test`.`t1`.`ie1`)))) and trigcond(trigcond((((`test`.`t2`.`b`) = `test`.`t1`.`ie2`) or isnull(`test`.`t1`.`ie2`))))) having (trigcond((`test`.`t1`.`ie1`)) and trigcond((`test`.`t1`.`ie2`))))))) AS `Z` from `test`.`t2` +Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(((`test`.`t2`.`a`,`test`.`t2`.`b`),(((`test`.`t2`.`a`) in t1 on idx checking NULL where `test`.`t1`.`oref` = `test`.`t2`.`oref` and trigcond(trigcond((`test`.`t2`.`a`) = `test`.`t1`.`ie1` or `test`.`t1`.`ie1` is null)) and trigcond(trigcond((`test`.`t2`.`b`) = `test`.`t1`.`ie2` or `test`.`t1`.`ie2` is null)) having trigcond(`test`.`t1`.`ie1` is null) and trigcond(`test`.`t1`.`ie2` is null))))) AS `Z` from `test`.`t2` drop table t1,t2; create table t1 (oref char(4), grp int, ie int primary key); insert into t1 (oref, grp, ie) values @@ -726,7 +726,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using index 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`b` = `test`.`t1`.`a`) and (not(<`test`.`t1`.`a`>((`test`.`t1`.`a`,(select `test`.`t1`.`a` from `test`.`t1` where trigcond((((`test`.`t2`.`b`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`))) having trigcond((`test`.`t1`.`a`)))))))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`b` = `test`.`t1`.`a` and !<`test`.`t1`.`a`>((`test`.`t1`.`a`,(select `test`.`t1`.`a` from `test`.`t1` where trigcond((`test`.`t2`.`b`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null) having trigcond(`test`.`t1`.`a` is null)))) SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1)); a SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1 WHERE a > 4)); @@ -1428,7 +1428,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY c eq_ref PRIMARY PRIMARY 4 test.cona.idContact 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan 1 PRIMARY a eq_ref PRIMARY PRIMARY 4 test.c.idObj 1 100.00 Using index; End temporary Warnings: -Note 1003 select `test`.`a`.`idIndividual` AS `idIndividual` from `test`.`t1` `a` semi join (`test`.`t3` `cona` join `test`.`t2` `c`) where ((`test`.`cona`.`postalStripped` = 'T2H3B2') and (`test`.`a`.`idIndividual` = `test`.`c`.`idObj`) and (`test`.`c`.`idContact` = `test`.`cona`.`idContact`)) +Note 1003 select `test`.`a`.`idIndividual` AS `idIndividual` from `test`.`t1` `a` semi join (`test`.`t3` `cona` join `test`.`t2` `c`) where `test`.`cona`.`postalStripped` = 'T2H3B2' and `test`.`a`.`idIndividual` = `test`.`c`.`idObj` and `test`.`c`.`idContact` = `test`.`cona`.`idContact` set @@optimizer_switch=@save_optimizer_switch; drop table t1,t2,t3; # @@ -1551,7 +1551,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t2.v' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`v` AS `v`,<`test`.`t2`.`v`>((select count(distinct `test`.`t1`.`i`) from `test`.`t1` where (`test`.`t1`.`v` = `test`.`t2`.`v`))) AS `subsel` from `test`.`t2` +Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`v` AS `v`,<`test`.`t2`.`v`>((select count(distinct `test`.`t1`.`i`) from `test`.`t1` where `test`.`t1`.`v` = `test`.`t2`.`v`)) AS `subsel` from `test`.`t2` DROP TABLE t1,t2; End of 5.6 tests set @@optimizer_switch=@subselect3_tmp; diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result index 992892b8fb6..792ce657ba0 100644 --- a/mysql-test/r/subselect4.result +++ b/mysql-test/r/subselect4.result @@ -2349,7 +2349,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select 3 AS `f` from dual where (not(<3>((3,(select `test`.`t1`.`b` from `test`.`t1` where (((`test`.`t1`.`c` = 'USA') or (`test`.`t1`.`c` <> 'USA')) and trigcond((((3) = `test`.`t1`.`b`) or isnull(`test`.`t1`.`b`))) and (`test`.`t1`.`b` = `test`.`t1`.`a`)) having trigcond((`test`.`t1`.`b`))))))) +Note 1003 select 3 AS `f` from dual where !<3>((3,(select `test`.`t1`.`b` from `test`.`t1` where (`test`.`t1`.`c` = 'USA' or `test`.`t1`.`c` <> 'USA') and trigcond((3) = `test`.`t1`.`b` or `test`.`t1`.`b` is null) and `test`.`t1`.`b` = `test`.`t1`.`a` having trigcond(`test`.`t1`.`b` is null)))) SELECT * FROM t2 WHERE f NOT IN (SELECT b FROM t1 WHERE 0 OR (c IN ('USA') OR c NOT IN ('USA')) AND a = b); diff --git a/mysql-test/r/subselect_cache.result b/mysql-test/r/subselect_cache.result index 97a5f5a77f6..86bc78dc204 100644 --- a/mysql-test/r/subselect_cache.result +++ b/mysql-test/r/subselect_cache.result @@ -76,7 +76,7 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 18.75, - "attached_condition": "(t1.b = t2.c)" + "attached_condition": "t1.b = t2.c" } } } @@ -128,7 +128,7 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 18.75, - "attached_condition": "(t1.b = t2.c)" + "attached_condition": "t1.b = t2.c" } } }, @@ -162,7 +162,7 @@ ANALYZE "r_total_time_ms": "REPLACED", "filtered": 100, "r_filtered": 18.75, - "attached_condition": "(t1.b = t2.c)" + "attached_condition": "t1.b = t2.c" } } } @@ -193,7 +193,7 @@ EXPLAIN "access_type": "ALL", "rows": 4, "filtered": 100, - "attached_condition": "(t1.b = t2.c)" + "attached_condition": "t1.b = t2.c" } } } @@ -230,7 +230,7 @@ EXPLAIN "access_type": "ALL", "rows": 4, "filtered": 100, - "attached_condition": "(t1.b = t2.c)" + "attached_condition": "t1.b = t2.c" } } }, @@ -257,7 +257,7 @@ EXPLAIN "access_type": "ALL", "rows": 4, "filtered": 100, - "attached_condition": "(t1.b = t2.c)" + "attached_condition": "t1.b = t2.c" } } } @@ -3613,7 +3613,7 @@ 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 Using where 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <`test`.`t1`.`a`>((`test`.`t1`.`a`,(select `test`.`t2`.`b` from `test`.`t2` where ((`test`.`t1`.`a`) = `test`.`t2`.`b`)))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <`test`.`t1`.`a`>((`test`.`t1`.`a`,(select `test`.`t2`.`b` from `test`.`t2` where (`test`.`t1`.`a`) = `test`.`t2`.`b`))) drop table t1,t2; set @@optimizer_switch= default; # LP BUG#615760 (part 2: incorrect heap table index flags) diff --git a/mysql-test/r/subselect_exists2in.result b/mysql-test/r/subselect_exists2in.result index 1d0732060b7..07b5557506b 100644 --- a/mysql-test/r/subselect_exists2in.result +++ b/mysql-test/r/subselect_exists2in.result @@ -55,7 +55,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL bb NULL NULL NULL 2 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t3`) where (`test`.`t3`.`b` = `test`.`t1`.`a`) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t3`) where `test`.`t3`.`b` = `test`.`t1`.`a` -- EXIST to IN then IN to EXISTS set optimizer_switch='exists_to_in=on,in_to_exists=on,semijoin=off,materialization=off,subquery_cache=off'; SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a); @@ -68,7 +68,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t3 ALL bb NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a`,(select `test`.`t3`.`b` from `test`.`t3` where ((`test`.`t1`.`a`) = `test`.`t3`.`b`))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a`,(select `test`.`t3`.`b` from `test`.`t3` where (`test`.`t1`.`a`) = `test`.`t3`.`b`)) -- EXIST2IN then MATERIALIZATION set optimizer_switch='exists_to_in=on,in_to_exists=off,semijoin=off,materialization=on,subquery_cache=off'; SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a); @@ -81,7 +81,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t3`.`b` from `test`.`t3` where 1 ), (`test`.`t1`.`a` in on distinct_key where ((`test`.`t1`.`a` = ``.`b`))))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t3`.`b` from `test`.`t3` where 1 ), (`test`.`t1`.`a` in on distinct_key where `test`.`t1`.`a` = ``.`b`))) -- NO EXIST2IN set optimizer_switch='exists_to_in=off,subquery_cache=off'; SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a); @@ -94,7 +94,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t3 ALL bb NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`b` = `test`.`t1`.`a`)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(select `test`.`t3`.`a` from `test`.`t3` where `test`.`t3`.`b` = `test`.`t1`.`a`) set optimizer_switch=default; set optimizer_switch='exists_to_in=on'; drop table t1,t2,t3; @@ -313,7 +313,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (<`test`.`t1`.`a`>((`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t2`.`b` from `test`.`t2` where 1 ), (`test`.`t1`.`a` in on distinct_key where ((`test`.`t1`.`a` = ``.`b`)))))) or (`test`.`t1`.`a` > 0)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <`test`.`t1`.`a`>((`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t2`.`b` from `test`.`t2` where 1 ), (`test`.`t1`.`a` in on distinct_key where `test`.`t1`.`a` = ``.`b`)))) or `test`.`t1`.`a` > 0 drop tables t1,t2; CREATE TABLE t1 ( a INT ); INSERT INTO t1 VALUES (1),(5); @@ -330,7 +330,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2 -Note 1003 select (select 1 from dual where (not(((1 is not null) and (1,1 in ( (select `test`.`t3`.`c` from `test`.`t3` where (`test`.`t3`.`c` is not null) ), (1 in on distinct_key where ((1 = ``.`c`))))))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1` +Note 1003 select (select 1 from dual where !(1 is not null and (1,1 in ( (select `test`.`t3`.`c` from `test`.`t3` where `test`.`t3`.`c` is not null ), (1 in on distinct_key where 1 = ``.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1` SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) 1 @@ -344,7 +344,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2 -Note 1003 select (select 1 from dual where (not(((1 is not null) and (1,1 in ( (select `test`.`t3`.`c` from `test`.`t3` where (`test`.`t3`.`c` is not null) ), (1 in on distinct_key where ((1 = ``.`c`))))))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1` +Note 1003 select (select 1 from dual where !(1 is not null and (1,1 in ( (select `test`.`t3`.`c` from `test`.`t3` where `test`.`t3`.`c` is not null ), (1 in on distinct_key where 1 = ``.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1` SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) 1 @@ -358,7 +358,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2 -Note 1003 select (select 1 from dual where (not(exists(select `test`.`t3`.`c` from `test`.`t3` where (`test`.`t3`.`c` = 1))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1` +Note 1003 select (select 1 from dual where !exists(select `test`.`t3`.`c` from `test`.`t3` where `test`.`t3`.`c` = 1)) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1` SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) 1 @@ -387,7 +387,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a1' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` semi join (`test`.`t3`) where ((`test`.`t1`.`a` = `test`.`t3`.`b`) and (`test`.`t1`.`a1` = `test`.`t3`.`b1`)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` semi join (`test`.`t3`) where `test`.`t1`.`a` = `test`.`t3`.`b` and `test`.`t1`.`a1` = `test`.`t3`.`b1` -- EXIST to IN then IN to EXISTS set optimizer_switch='exists_to_in=on,in_to_exists=on,semijoin=off,materialization=off,subquery_cache=off'; SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1); @@ -401,7 +401,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a1' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` where ((`test`.`t1`.`a`,`test`.`t1`.`a1`),(((`test`.`t1`.`a`) in t3 on bb where (((`test`.`t1`.`a`) = `test`.`t3`.`b`) and ((`test`.`t1`.`a1`) = `test`.`t3`.`b1`))))) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` where ((`test`.`t1`.`a`,`test`.`t1`.`a1`),(((`test`.`t1`.`a`) in t3 on bb where (`test`.`t1`.`a`) = `test`.`t3`.`b` and (`test`.`t1`.`a1`) = `test`.`t3`.`b1`))) -- EXIST2IN then MATERIALIZATION set optimizer_switch='exists_to_in=on,in_to_exists=off,semijoin=off,materialization=on,subquery_cache=off'; SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1); @@ -415,7 +415,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a1' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` where ((`test`.`t1`.`a`,`test`.`t1`.`a1`),(`test`.`t1`.`a`,`test`.`t1`.`a1`) in ( (select `test`.`t3`.`b`,`test`.`t3`.`b1` from `test`.`t3` where 1 ), (`test`.`t1`.`a` in on distinct_key where ((`test`.`t1`.`a` = ``.`b`) and (`test`.`t1`.`a1` = ``.`b1`))))) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` where ((`test`.`t1`.`a`,`test`.`t1`.`a1`),(`test`.`t1`.`a`,`test`.`t1`.`a1`) in ( (select `test`.`t3`.`b`,`test`.`t3`.`b1` from `test`.`t3` where 1 ), (`test`.`t1`.`a` in on distinct_key where `test`.`t1`.`a` = ``.`b` and `test`.`t1`.`a1` = ``.`b1`))) -- NO EXIST2IN set optimizer_switch='exists_to_in=off,subquery_cache=off'; SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1); @@ -429,7 +429,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a1' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` where exists(select 1 from `test`.`t3` where ((`test`.`t3`.`b` = `test`.`t1`.`a`) and (`test`.`t3`.`b1` = `test`.`t1`.`a1`))) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` where exists(select 1 from `test`.`t3` where `test`.`t3`.`b` = `test`.`t1`.`a` and `test`.`t3`.`b1` = `test`.`t1`.`a1`) set optimizer_switch=default; set optimizer_switch='exists_to_in=on'; drop table t1,t3; @@ -466,7 +466,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'v.d' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'v.b' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`b`,(select `test`.`t2`.`b` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`a` <= `test`.`t2`.`d`) and ((`test`.`t2`.`b`) = `test`.`t2`.`b`)))) and (`test`.`t2`.`b` < 1)) +Note 1003 select `test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`b`,(select `test`.`t2`.`b` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` <= `test`.`t2`.`d` and (`test`.`t2`.`b`) = `test`.`t2`.`b`)) and `test`.`t2`.`b` < 1 set optimizer_switch=default; set optimizer_switch='exists_to_in=on'; drop view v; @@ -544,7 +544,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'test.alias2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.alias1.b' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`alias1`.`a` AS `a`,`test`.`alias1`.`b` AS `b`,`test`.`alias2`.`a` AS `a`,`test`.`alias2`.`b` AS `b` from `test`.`t1` `alias1` join `test`.`t1` `alias2` where (<`test`.`alias1`.`b`,`test`.`alias2`.`a`>((`test`.`alias1`.`b`,(select `test`.`t2`.`c` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`a` <= `test`.`alias2`.`a`) and ((`test`.`alias1`.`b`) = `test`.`t2`.`c`))))) or (`test`.`alias1`.`a` = 'foo')) +Note 1003 select `test`.`alias1`.`a` AS `a`,`test`.`alias1`.`b` AS `b`,`test`.`alias2`.`a` AS `a`,`test`.`alias2`.`b` AS `b` from `test`.`t1` `alias1` join `test`.`t1` `alias2` where <`test`.`alias1`.`b`,`test`.`alias2`.`a`>((`test`.`alias1`.`b`,(select `test`.`t2`.`c` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` <= `test`.`alias2`.`a` and (`test`.`alias1`.`b`) = `test`.`t2`.`c`))) or `test`.`alias1`.`a` = 'foo' drop table t1,t2; set optimizer_switch=default; set optimizer_switch='exists_to_in=on'; @@ -568,7 +568,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (not(((`test`.`t1`.`a` is not null) and <`test`.`t1`.`a`>((`test`.`t1`.`a`,(select `test`.`t2`.`b` from `test`.`t2` where ((`test`.`t2`.`b` is not null) and ((`test`.`t1`.`a`) = `test`.`t2`.`b`)))))))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where !(`test`.`t1`.`a` is not null and <`test`.`t1`.`a`>((`test`.`t1`.`a`,(select `test`.`t2`.`b` from `test`.`t2` where `test`.`t2`.`b` is not null and (`test`.`t1`.`a`) = `test`.`t2`.`b`)))) drop table t1,t2; set optimizer_switch=default; set optimizer_switch='exists_to_in=on'; @@ -592,7 +592,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'test.alias.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.alias.b' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`alias`.`a` AS `a`,`test`.`alias`.`b` AS `b` from `test`.`t1` `alias` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`alias`.`b`) and (`test`.`alias`.`b` > `test`.`alias`.`a`)) +Note 1003 select `test`.`alias`.`a` AS `a`,`test`.`alias`.`b` AS `b` from `test`.`t1` `alias` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`alias`.`b` and `test`.`alias`.`b` > `test`.`alias`.`a` SET optimizer_switch = REPLACE( @@optimizer_switch, '=on', '=off' ); SET optimizer_switch = 'exists_to_in=on,materialization=on,semijoin=off'; SELECT * FROM t1 AS alias @@ -608,7 +608,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'test.alias.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.alias.b' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`alias`.`a` AS `a`,`test`.`alias`.`b` AS `b` from `test`.`t1` `alias` where (`test`.`alias`.`b`,(select `test`.`t1`.`a` from `test`.`t1` where ((`test`.`t1`.`a` > `test`.`alias`.`a`) and ((`test`.`alias`.`b`) = `test`.`t1`.`a`)))) +Note 1003 select `test`.`alias`.`a` AS `a`,`test`.`alias`.`b` AS `b` from `test`.`t1` `alias` where (`test`.`alias`.`b`,(select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` > `test`.`alias`.`a` and (`test`.`alias`.`b`) = `test`.`t1`.`a`)) SET optimizer_switch = 'exists_to_in=on,materialization=on,semijoin=on'; SELECT * FROM t1 AS alias WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b ); @@ -623,7 +623,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'test.alias.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.alias.b' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`alias`.`a` AS `a`,`test`.`alias`.`b` AS `b` from `test`.`t1` `alias` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`alias`.`b`) and (`test`.`alias`.`b` > `test`.`alias`.`a`)) +Note 1003 select `test`.`alias`.`a` AS `a`,`test`.`alias`.`b` AS `b` from `test`.`t1` `alias` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`alias`.`b` and `test`.`alias`.`b` > `test`.`alias`.`a` drop table t1; set optimizer_switch=default; set optimizer_switch='exists_to_in=on'; @@ -661,7 +661,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'test.alias1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.alias2.b' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`alias1`.`a` AS `a`,`test`.`alias2`.`b` AS `b` from `test`.`t1` `alias1` join `test`.`t2` `alias2` where (<`test`.`alias1`.`a`,`test`.`alias2`.`b`>((`test`.`alias1`.`a`,(select `test`.`t2`.`b` from `test`.`t2` where ((`test`.`t2`.`b` > `test`.`alias2`.`b`) and ((`test`.`alias1`.`a`) = `test`.`t2`.`b`))))) or (`test`.`alias1`.`a` = 5)) +Note 1003 select `test`.`alias1`.`a` AS `a`,`test`.`alias2`.`b` AS `b` from `test`.`t1` `alias1` join `test`.`t2` `alias2` where <`test`.`alias1`.`a`,`test`.`alias2`.`b`>((`test`.`alias1`.`a`,(select `test`.`t2`.`b` from `test`.`t2` where `test`.`t2`.`b` > `test`.`alias2`.`b` and (`test`.`alias1`.`a`) = `test`.`t2`.`b`))) or `test`.`alias1`.`a` = 5 drop table t1, t2; set optimizer_switch=default; set optimizer_switch='exists_to_in=on'; diff --git a/mysql-test/r/subselect_extra.result b/mysql-test/r/subselect_extra.result index 48b80e02e1a..73642c09324 100644 --- a/mysql-test/r/subselect_extra.result +++ b/mysql-test/r/subselect_extra.result @@ -71,7 +71,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY x1 ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t1.cur_date' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`cur_date` AS `cur_date` from `test`.`t1` semi join (`test`.`t1` `x1`) where ((`test`.`x1`.`id` = `test`.`t1`.`id`) and (`test`.`t1`.`cur_date` = 0)) +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`cur_date` AS `cur_date` from `test`.`t1` semi join (`test`.`t1` `x1`) where `test`.`x1`.`id` = `test`.`t1`.`id` and `test`.`t1`.`cur_date` = 0 select * from t1 where id in (select id from t1 as x1 where (t1.cur_date is null)); id cur_date @@ -83,7 +83,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY x1 ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(t2); Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t2.cur_date' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`id` AS `id`,`test`.`t2`.`cur_date` AS `cur_date` from `test`.`t2` semi join (`test`.`t2` `x1`) where ((`test`.`x1`.`id` = `test`.`t2`.`id`) and (`test`.`t2`.`cur_date` = 0)) +Note 1003 select `test`.`t2`.`id` AS `id`,`test`.`t2`.`cur_date` AS `cur_date` from `test`.`t2` semi join (`test`.`t2` `x1`) where `test`.`x1`.`id` = `test`.`t2`.`id` and `test`.`t2`.`cur_date` = 0 select * from t2 where id in (select id from t2 as x1 where (t2.cur_date is null)); id cur_date diff --git a/mysql-test/r/subselect_extra_no_semijoin.result b/mysql-test/r/subselect_extra_no_semijoin.result index 7cfce6dd006..8ed260cb31a 100644 --- a/mysql-test/r/subselect_extra_no_semijoin.result +++ b/mysql-test/r/subselect_extra_no_semijoin.result @@ -75,7 +75,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY x1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.cur_date' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`cur_date` AS `cur_date` from `test`.`t1` where <`test`.`t1`.`id`,`test`.`t1`.`cur_date`>((`test`.`t1`.`id`,(select `test`.`x1`.`id` from `test`.`t1` `x1` where ((`test`.`t1`.`cur_date` = 0) and ((`test`.`t1`.`id`) = `test`.`x1`.`id`))))) +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`cur_date` AS `cur_date` from `test`.`t1` where <`test`.`t1`.`id`,`test`.`t1`.`cur_date`>((`test`.`t1`.`id`,(select `test`.`x1`.`id` from `test`.`t1` `x1` where `test`.`t1`.`cur_date` = 0 and (`test`.`t1`.`id`) = `test`.`x1`.`id`))) select * from t1 where id in (select id from t1 as x1 where (t1.cur_date is null)); id cur_date @@ -87,7 +87,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY x1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t2.cur_date' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`id` AS `id`,`test`.`t2`.`cur_date` AS `cur_date` from `test`.`t2` where <`test`.`t2`.`id`,`test`.`t2`.`cur_date`>((`test`.`t2`.`id`,(select `test`.`x1`.`id` from `test`.`t2` `x1` where ((`test`.`t2`.`cur_date` = 0) and ((`test`.`t2`.`id`) = `test`.`x1`.`id`))))) +Note 1003 select `test`.`t2`.`id` AS `id`,`test`.`t2`.`cur_date` AS `cur_date` from `test`.`t2` where <`test`.`t2`.`id`,`test`.`t2`.`cur_date`>((`test`.`t2`.`id`,(select `test`.`x1`.`id` from `test`.`t2` `x1` where `test`.`t2`.`cur_date` = 0 and (`test`.`t2`.`id`) = `test`.`x1`.`id`))) select * from t2 where id in (select id from t2 as x1 where (t2.cur_date is null)); id cur_date @@ -351,7 +351,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where 3 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` where <0>((0,(select 0 from dual where ((0) = 0)))) +Note 1003 select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` where <0>((0,(select 0 from dual where (0) = 0))) SELECT * FROM t2 RIGHT JOIN v1 AS t ON t.a != 0 WHERE t.a IN (SELECT b FROM t1); a a b @@ -364,7 +364,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where 2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` where <0>((0,(select 0 from dual where ((0) = 0)))) +Note 1003 select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` where <0>((0,(select 0 from dual where (0) = 0))) DROP VIEW v1; DROP TABLE t1,t2; # diff --git a/mysql-test/r/subselect_mat.result b/mysql-test/r/subselect_mat.result index af3df9ec811..0d40ca3d01f 100644 --- a/mysql-test/r/subselect_mat.result +++ b/mysql-test/r/subselect_mat.result @@ -50,7 +50,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`>((`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( (select `test`.`t2`.`b1` from `test`.`t2` where (`test`.`t2`.`b1` > '0') ), (`test`.`t1`.`a1` in on distinct_key where ((`test`.`t1`.`a1` = ``.`b1`)))))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`>((`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( (select `test`.`t2`.`b1` from `test`.`t2` where `test`.`t2`.`b1` > '0' ), (`test`.`t1`.`a1` in on distinct_key where `test`.`t1`.`a1` = ``.`b1`)))) select * from t1 where a1 in (select b1 from t2 where b1 > '0'); a1 a2 1 - 01 2 - 01 @@ -61,7 +61,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`>((`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( (select `test`.`t2`.`b1` from `test`.`t2` where (`test`.`t2`.`b1` > '0') ), (`test`.`t1`.`a1` in on distinct_key where ((`test`.`t1`.`a1` = ``.`b1`)))))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`>((`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( (select `test`.`t2`.`b1` from `test`.`t2` where `test`.`t2`.`b1` > '0' ), (`test`.`t1`.`a1` in on distinct_key where `test`.`t1`.`a1` = ``.`b1`)))) select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1); a1 a2 1 - 01 2 - 01 @@ -72,7 +72,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where (`test`.`t2`.`b1` > '0') ), (`test`.`t1`.`a1` in on distinct_key where ((`test`.`t1`.`a1` = ``.`b1`) and (`test`.`t1`.`a2` = ``.`b2`)))))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where `test`.`t2`.`b1` > '0' ), (`test`.`t1`.`a1` in on distinct_key where `test`.`t1`.`a1` = ``.`b1` and `test`.`t1`.`a2` = ``.`b2`)))) select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2); a1 a2 1 - 01 2 - 01 @@ -83,7 +83,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t2`.`b1`,min(`test`.`t2`.`b2`) from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1` ), (`test`.`t1`.`a1` in on distinct_key where ((`test`.`t1`.`a1` = ``.`b1`) and (`test`.`t1`.`a2` = ``.`min(b2)`)))))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t2`.`b1`,min(`test`.`t2`.`b2`) from `test`.`t2` where `test`.`t2`.`b1` > '0' group by `test`.`t2`.`b1` ), (`test`.`t1`.`a1` in on distinct_key where `test`.`t1`.`a1` = ``.`b1` and `test`.`t1`.`a2` = ``.`min(b2)`)))) select * from t1 where (a1, a2) in (select b1, min(b2) from t2 where b1 > '0' group by b1); a1 a2 1 - 01 2 - 01 @@ -94,7 +94,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1i index NULL _it1_idx # NULL 3 100.00 Using where; 2 MATERIALIZED t2i index it2i1,it2i3 it2i1 # NULL 5 100.00 Using where; Warnings: -Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <`test`.`t1i`.`a1`>((`test`.`t1i`.`a1`,`test`.`t1i`.`a1` in ( (select `test`.`t2i`.`b1` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), (`test`.`t1i`.`a1` in on distinct_key where ((`test`.`t1i`.`a1` = ``.`b1`)))))) +Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <`test`.`t1i`.`a1`>((`test`.`t1i`.`a1`,`test`.`t1i`.`a1` in ( (select `test`.`t2i`.`b1` from `test`.`t2i` where `test`.`t2i`.`b1` > '0' ), (`test`.`t1i`.`a1` in on distinct_key where `test`.`t1i`.`a1` = ``.`b1`)))) select * from t1i where a1 in (select b1 from t2i where b1 > '0'); a1 a2 1 - 01 2 - 01 @@ -105,7 +105,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1i index NULL # 18 # 3 100.00 # 2 MATERIALIZED t2i range it2i1,it2i3 # 9 # 5 100.00 # Warnings: -Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <`test`.`t1i`.`a1`>((`test`.`t1i`.`a1`,`test`.`t1i`.`a1` in ( (select max(`test`.`t2i`.`b1`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), (`test`.`t1i`.`a1` in on distinct_key where ((`test`.`t1i`.`a1` = ``.`max(b1)`)))))) +Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <`test`.`t1i`.`a1`>((`test`.`t1i`.`a1`,`test`.`t1i`.`a1` in ( (select max(`test`.`t2i`.`b1`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1` ), (`test`.`t1i`.`a1` in on distinct_key where `test`.`t1i`.`a1` = ``.`max(b1)`)))) select * from t1i where a1 in (select max(b1) from t2i where b1 > '0' group by b1); a1 a2 1 - 01 2 - 01 @@ -116,7 +116,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1i index NULL _it1_idx # NULL 3 100.00 Using where; 2 MATERIALIZED t2i index it2i1,it2i3 it2i3 # NULL 5 100.00 Using where; Warnings: -Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), (`test`.`t1i`.`a1` in on distinct_key where ((`test`.`t1i`.`a1` = ``.`b1`) and (`test`.`t1i`.`a2` = ``.`b2`)))))) +Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b1` > '0' ), (`test`.`t1i`.`a1` in on distinct_key where `test`.`t1i`.`a1` = ``.`b1` and `test`.`t1i`.`a2` = ``.`b2`)))) select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0'); a1 a2 1 - 01 2 - 01 @@ -127,7 +127,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1i index NULL # # # 3 100.00 # 2 MATERIALIZED t2i range it2i1,it2i3 # # # 3 100.00 # Warnings: -Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), (`test`.`t1i`.`a1` in on distinct_key where ((`test`.`t1i`.`a1` = ``.`b1`) and (`test`.`t1i`.`a2` = ``.`max(b2)`)))))) +Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1` ), (`test`.`t1i`.`a1` in on distinct_key where `test`.`t1i`.`a1` = ``.`b1` and `test`.`t1i`.`a2` = ``.`max(b2)`)))) select * from t1i where (a1, a2) in (select b1, max(b2) from t2i where b1 > '0' group by b1); a1 a2 1 - 01 2 - 01 @@ -138,7 +138,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1i index NULL # # # 3 100.00 # 2 MATERIALIZED t2i range it2i1,it2i3 # # # 3 100.00 # Warnings: -Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), (`test`.`t1i`.`a1` in on distinct_key where ((`test`.`t1i`.`a1` = ``.`b1`) and (`test`.`t1i`.`a2` = ``.`min(b2)`)))))) +Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1` ), (`test`.`t1i`.`a1` in on distinct_key where `test`.`t1i`.`a1` = ``.`b1` and `test`.`t1i`.`a2` = ``.`min(b2)`)))) select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1); a1 a2 1 - 01 2 - 01 @@ -149,7 +149,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 2 MATERIALIZED t2i range NULL it2i3 9 NULL 3 100.00 Using index for group-by Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` group by `test`.`t2i`.`b1` ), (`test`.`t1`.`a1` in on distinct_key where ((`test`.`t1`.`a1` = ``.`b1`) and (`test`.`t1`.`a2` = ``.`max(b2)`)))))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` group by `test`.`t2i`.`b1` ), (`test`.`t1`.`a1` in on distinct_key where `test`.`t1`.`a1` = ``.`b1` and `test`.`t1`.`a2` = ``.`max(b2)`)))) select * from t1 where (a1, a2) in (select b1, max(b2) from t2i group by b1); a1 a2 1 - 01 2 - 01 @@ -178,7 +178,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 2 MATERIALIZED t2i range it2i1,it2i3 it2i3 18 NULL 3 100.00 Using where; Using index for group-by Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), (`test`.`t1`.`a1` in on distinct_key where ((`test`.`t1`.`a1` = ``.`b1`) and (`test`.`t1`.`a2` = ``.`min(b2)`)))))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1` ), (`test`.`t1`.`a1` in on distinct_key where `test`.`t1`.`a1` = ``.`b1` and `test`.`t1`.`a2` = ``.`min(b2)`)))) select * from t1 where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1); a1 a2 1 - 01 2 - 01 @@ -225,7 +225,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` order by `test`.`t2`.`b1`,`test`.`t2`.`b2` ), (`test`.`t1`.`a1` in on distinct_key where ((`test`.`t1`.`a1` = ``.`b1`) and (`test`.`t1`.`a2` = ``.`b2`)))))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` order by `test`.`t2`.`b1`,`test`.`t2`.`b2` ), (`test`.`t1`.`a1` in on distinct_key where `test`.`t1`.`a1` = ``.`b1` and `test`.`t1`.`a2` = ``.`b2`)))) select * from t1 where (a1, a2) in (select b1, b2 from t2 order by b1, b2); a1 a2 1 - 01 2 - 01 @@ -236,7 +236,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1i index NULL it1i3 18 NULL 3 100.00 Using where; Using index 2 MATERIALIZED t2i index NULL it2i3 18 NULL 5 100.00 Using index Warnings: -Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` order by `test`.`t2i`.`b1`,`test`.`t2i`.`b2` ), (`test`.`t1i`.`a1` in on distinct_key where ((`test`.`t1i`.`a1` = ``.`b1`) and (`test`.`t1i`.`a2` = ``.`b2`)))))) +Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` order by `test`.`t2i`.`b1`,`test`.`t2i`.`b2` ), (`test`.`t1i`.`a1` in on distinct_key where `test`.`t1i`.`a1` = ``.`b1` and `test`.`t1i`.`a2` = ``.`b2`)))) select * from t1i where (a1, a2) in (select b1, b2 from t2i order by b1, b2); a1 a2 1 - 01 2 - 01 @@ -291,7 +291,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 4 MATERIALIZED t2i index it2i2 it2i3 18 NULL 5 100.00 Using where; Using index 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where (`test`.`t2`.`b1` > '0') ), (`test`.`t1`.`a1` in on distinct_key where ((`test`.`t1`.`a1` = ``.`b1`) and (`test`.`t1`.`a2` = ``.`b2`)))))) and <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <`test`.`t3`.`c1`,`test`.`t3`.`c2`>(((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), (`test`.`t3`.`c1` in on distinct_key where ((`test`.`t3`.`c1` = ``.`b1`) and (`test`.`t3`.`c2` = ``.`b2`)))))) ), (`test`.`t1`.`a1` in on distinct_key where ((`test`.`t1`.`a1` = ``.`c1`) and (`test`.`t1`.`a2` = ``.`c2`))))))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where `test`.`t2`.`b1` > '0' ), (`test`.`t1`.`a1` in on distinct_key where `test`.`t1`.`a1` = ``.`b1` and `test`.`t1`.`a2` = ``.`b2`)))) and <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <`test`.`t3`.`c1`,`test`.`t3`.`c2`>(((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b2` > '0' ), (`test`.`t3`.`c1` in on distinct_key where `test`.`t3`.`c1` = ``.`b1` and `test`.`t3`.`c2` = ``.`b2`)))) ), (`test`.`t1`.`a1` in on distinct_key where `test`.`t1`.`a1` = ``.`c1` and `test`.`t1`.`a2` = ``.`c2`)))) select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0') and (a1, a2) in (select c1, c2 from t3 @@ -310,7 +310,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 4 MATERIALIZED t2i index it2i2 # # # 5 100.00 # 2 MATERIALIZED t2i index it2i1,it2i3 # # # 5 100.00 # Warnings: -Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where (<`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), (`test`.`t1i`.`a1` in on distinct_key where ((`test`.`t1i`.`a1` = ``.`b1`) and (`test`.`t1i`.`a2` = ``.`b2`)))))) and <`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( (select `test`.`t3i`.`c1`,`test`.`t3i`.`c2` from `test`.`t3i` where <`test`.`t3i`.`c1`,`test`.`t3i`.`c2`>(((`test`.`t3i`.`c1`,`test`.`t3i`.`c2`),(`test`.`t3i`.`c1`,`test`.`t3i`.`c2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), (`test`.`t3i`.`c1` in on distinct_key where ((`test`.`t3i`.`c1` = ``.`b1`) and (`test`.`t3i`.`c2` = ``.`b2`)))))) ), (`test`.`t1i`.`a1` in on distinct_key where ((`test`.`t1i`.`a1` = ``.`c1`) and (`test`.`t1i`.`a2` = ``.`c2`))))))) +Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b1` > '0' ), (`test`.`t1i`.`a1` in on distinct_key where `test`.`t1i`.`a1` = ``.`b1` and `test`.`t1i`.`a2` = ``.`b2`)))) and <`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( (select `test`.`t3i`.`c1`,`test`.`t3i`.`c2` from `test`.`t3i` where <`test`.`t3i`.`c1`,`test`.`t3i`.`c2`>(((`test`.`t3i`.`c1`,`test`.`t3i`.`c2`),(`test`.`t3i`.`c1`,`test`.`t3i`.`c2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b2` > '0' ), (`test`.`t3i`.`c1` in on distinct_key where `test`.`t3i`.`c1` = ``.`b1` and `test`.`t3i`.`c2` = ``.`b2`)))) ), (`test`.`t1i`.`a1` in on distinct_key where `test`.`t1i`.`a1` = ``.`c1` and `test`.`t1i`.`a2` = ``.`c2`)))) select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and (a1, a2) in (select c1, c2 from t3i @@ -333,7 +333,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where 3 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where (<`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), (`test`.`t2`.`b2` in on distinct_key where ((`test`.`t2`.`b2` = ``.`c2`)))))) or <`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), (`test`.`t2`.`b2` in on distinct_key where ((`test`.`t2`.`b2` = ``.`c2`))))))) ), (`test`.`t1`.`a1` in on distinct_key where ((`test`.`t1`.`a1` = ``.`b1`) and (`test`.`t1`.`a2` = ``.`b2`)))))) and <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <`test`.`t3`.`c1`,`test`.`t3`.`c2`>(((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), (`test`.`t3`.`c1` in on distinct_key where ((`test`.`t3`.`c1` = ``.`b1`) and (`test`.`t3`.`c2` = ``.`b2`)))))) ), (`test`.`t1`.`a1` in on distinct_key where ((`test`.`t1`.`a1` = ``.`c1`) and (`test`.`t1`.`a2` = ``.`c2`))))))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where <`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%02' ), (`test`.`t2`.`b2` in on distinct_key where `test`.`t2`.`b2` = ``.`c2`)))) or <`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%03' ), (`test`.`t2`.`b2` in on distinct_key where `test`.`t2`.`b2` = ``.`c2`)))) ), (`test`.`t1`.`a1` in on distinct_key where `test`.`t1`.`a1` = ``.`b1` and `test`.`t1`.`a2` = ``.`b2`)))) and <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <`test`.`t3`.`c1`,`test`.`t3`.`c2`>(((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b2` > '0' ), (`test`.`t3`.`c1` in on distinct_key where `test`.`t3`.`c1` = ``.`b1` and `test`.`t3`.`c2` = ``.`b2`)))) ), (`test`.`t1`.`a1` in on distinct_key where `test`.`t1`.`a1` = ``.`c1` and `test`.`t1`.`a2` = ``.`c2`)))) select * from t1 where (a1, a2) in (select b1, b2 from t2 where b2 in (select c2 from t3 where c2 LIKE '%02') or @@ -358,7 +358,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t3a ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((<`test`.`t2`.`b2`,`test`.`t1`.`a1`>((`test`.`t2`.`b2`,(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and ((`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))))) or <`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), (`test`.`t2`.`b2` in on distinct_key where ((`test`.`t2`.`b2` = ``.`c2`))))))) and ((`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and ((`test`.`t1`.`a2`) = `test`.`t2`.`b2`))))) and <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t3c`.`c1`,`test`.`t3c`.`c2` from `test`.`t3` `t3c` where <`test`.`t3c`.`c1`,`test`.`t3c`.`c2`>(((`test`.`t3c`.`c1`,`test`.`t3c`.`c2`),(`test`.`t3c`.`c1`,`test`.`t3c`.`c2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), (`test`.`t3c`.`c1` in on distinct_key where ((`test`.`t3c`.`c1` = ``.`b1`) and (`test`.`t3c`.`c2` = ``.`b2`)))))) ), (`test`.`t1`.`a1` in on distinct_key where ((`test`.`t1`.`a1` = ``.`c1`) and (`test`.`t1`.`a2` = ``.`c2`))))))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where (<`test`.`t2`.`b2`,`test`.`t1`.`a1`>((`test`.`t2`.`b2`,(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where `test`.`t3a`.`c1` = `test`.`t1`.`a1` and (`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))) or <`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where `test`.`t3b`.`c2` like '%03' ), (`test`.`t2`.`b2` in on distinct_key where `test`.`t2`.`b2` = ``.`c2`))))) and (`test`.`t1`.`a1`) = `test`.`t2`.`b1` and (`test`.`t1`.`a2`) = `test`.`t2`.`b2`))) and <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t3c`.`c1`,`test`.`t3c`.`c2` from `test`.`t3` `t3c` where <`test`.`t3c`.`c1`,`test`.`t3c`.`c2`>(((`test`.`t3c`.`c1`,`test`.`t3c`.`c2`),(`test`.`t3c`.`c1`,`test`.`t3c`.`c2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b2` > '0' ), (`test`.`t3c`.`c1` in on distinct_key where `test`.`t3c`.`c1` = ``.`b1` and `test`.`t3c`.`c2` = ``.`b2`)))) ), (`test`.`t1`.`a1` in on distinct_key where `test`.`t1`.`a1` = ``.`c1` and `test`.`t1`.`a2` = ``.`c2`)))) select * from t1 where (a1, a2) in (select b1, b2 from t2 where b2 in (select c2 from t3 t3a where c1 = a1) or @@ -394,7 +394,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 8 MATERIALIZED t2i index it2i1,it2i3 # # # 5 100.00 # NULL UNION RESULT ALL NULL # # # NULL NULL # Warnings: -Note 1003 (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where (<`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), (`test`.`t2`.`b2` in on distinct_key where ((`test`.`t2`.`b2` = ``.`c2`)))))) or <`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), (`test`.`t2`.`b2` in on distinct_key where ((`test`.`t2`.`b2` = ``.`c2`))))))) ), (`test`.`t1`.`a1` in on distinct_key where ((`test`.`t1`.`a1` = ``.`b1`) and (`test`.`t1`.`a2` = ``.`b2`)))))) and <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <`test`.`t3`.`c1`,`test`.`t3`.`c2`>(((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), (`test`.`t3`.`c1` in on distinct_key where ((`test`.`t3`.`c1` = ``.`b1`) and (`test`.`t3`.`c2` = ``.`b2`)))))) ), (`test`.`t1`.`a1` in on distinct_key where ((`test`.`t1`.`a1` = ``.`c1`) and (`test`.`t1`.`a2` = ``.`c2`)))))))) union (select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where (<`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), (`test`.`t1i`.`a1` in on distinct_key where ((`test`.`t1i`.`a1` = ``.`b1`) and (`test`.`t1i`.`a2` = ``.`b2`)))))) and <`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( (select `test`.`t3i`.`c1`,`test`.`t3i`.`c2` from `test`.`t3i` where <`test`.`t3i`.`c1`,`test`.`t3i`.`c2`>(((`test`.`t3i`.`c1`,`test`.`t3i`.`c2`),(`test`.`t3i`.`c1`,`test`.`t3i`.`c2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), (`test`.`t3i`.`c1` in on distinct_key where ((`test`.`t3i`.`c1` = ``.`b1`) and (`test`.`t3i`.`c2` = ``.`b2`)))))) ), (`test`.`t1i`.`a1` in on distinct_key where ((`test`.`t1i`.`a1` = ``.`c1`) and (`test`.`t1i`.`a2` = ``.`c2`)))))))) +Note 1003 (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where <`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%02' ), (`test`.`t2`.`b2` in on distinct_key where `test`.`t2`.`b2` = ``.`c2`)))) or <`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%03' ), (`test`.`t2`.`b2` in on distinct_key where `test`.`t2`.`b2` = ``.`c2`)))) ), (`test`.`t1`.`a1` in on distinct_key where `test`.`t1`.`a1` = ``.`b1` and `test`.`t1`.`a2` = ``.`b2`)))) and <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <`test`.`t3`.`c1`,`test`.`t3`.`c2`>(((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b2` > '0' ), (`test`.`t3`.`c1` in on distinct_key where `test`.`t3`.`c1` = ``.`b1` and `test`.`t3`.`c2` = ``.`b2`)))) ), (`test`.`t1`.`a1` in on distinct_key where `test`.`t1`.`a1` = ``.`c1` and `test`.`t1`.`a2` = ``.`c2`))))) union (select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b1` > '0' ), (`test`.`t1i`.`a1` in on distinct_key where `test`.`t1i`.`a1` = ``.`b1` and `test`.`t1i`.`a2` = ``.`b2`)))) and <`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( (select `test`.`t3i`.`c1`,`test`.`t3i`.`c2` from `test`.`t3i` where <`test`.`t3i`.`c1`,`test`.`t3i`.`c2`>(((`test`.`t3i`.`c1`,`test`.`t3i`.`c2`),(`test`.`t3i`.`c1`,`test`.`t3i`.`c2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b2` > '0' ), (`test`.`t3i`.`c1` in on distinct_key where `test`.`t3i`.`c1` = ``.`b1` and `test`.`t3i`.`c2` = ``.`b2`)))) ), (`test`.`t1i`.`a1` in on distinct_key where `test`.`t1i`.`a1` = ``.`c1` and `test`.`t1i`.`a2` = ``.`c2`))))) (select * from t1 where (a1, a2) in (select b1, b2 from t2 where b2 in (select c2 from t3 where c2 LIKE '%02') or @@ -423,7 +423,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and ((`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and ((`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and ((`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and ((`test`.`t1`.`a2`) = `test`.`t2`.`b2`))))) and <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <`test`.`t3`.`c1`,`test`.`t3`.`c2`>(((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), (`test`.`t3`.`c1` in on distinct_key where ((`test`.`t3`.`c1` = ``.`b1`) and (`test`.`t3`.`c2` = ``.`b2`)))))) ), (`test`.`t1`.`a1` in on distinct_key where ((`test`.`t1`.`a1` = ``.`c1`) and (`test`.`t1`.`a2` = ``.`c2`))))))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where `test`.`t1`.`a1` > '0' and (`test`.`t1`.`a1`) = `test`.`t1`.`a1` and (`test`.`t1`.`a2`) = `test`.`t1`.`a2` union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where `test`.`t2`.`b1` < '9' and (`test`.`t1`.`a1`) = `test`.`t2`.`b1` and (`test`.`t1`.`a2`) = `test`.`t2`.`b2`))) and <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <`test`.`t3`.`c1`,`test`.`t3`.`c2`>(((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b2` > '0' ), (`test`.`t3`.`c1` in on distinct_key where `test`.`t3`.`c1` = ``.`b1` and `test`.`t3`.`c2` = ``.`b2`)))) ), (`test`.`t1`.`a1` in on distinct_key where `test`.`t1`.`a1` = ``.`c1` and `test`.`t1`.`a2` = ``.`c2`)))) select * from t1 where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where b1 < '9') and (a1, a2) in (select c1, c2 from t3 @@ -446,7 +446,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`c1` = `test`.`t1`.`a1`) and <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and ((`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and ((`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and ((`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and ((`test`.`t1`.`a2`) = `test`.`t2`.`b2`))))) and <`test`.`t3`.`c1`,`test`.`t3`.`c2`>(((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <`test`.`t3`.`c1`,`test`.`t3`.`c2`>(((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), (`test`.`t3`.`c1` in on distinct_key where ((`test`.`t3`.`c1` = ``.`b1`) and (`test`.`t3`.`c2` = ``.`b2`)))))) ), (`test`.`t3`.`c1` in on distinct_key where ((`test`.`t3`.`c1` = ``.`c1`) and (`test`.`t3`.`c2` = ``.`c2`))))))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t1` join `test`.`t3` where `test`.`t3`.`c1` = `test`.`t1`.`a1` and <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where `test`.`t1`.`a1` > '0' and (`test`.`t1`.`a1`) = `test`.`t1`.`a1` and (`test`.`t1`.`a2`) = `test`.`t1`.`a2` union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where `test`.`t2`.`b1` < '9' and (`test`.`t1`.`a1`) = `test`.`t2`.`b1` and (`test`.`t1`.`a2`) = `test`.`t2`.`b2`))) and <`test`.`t3`.`c1`,`test`.`t3`.`c2`>(((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <`test`.`t3`.`c1`,`test`.`t3`.`c2`>(((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b2` > '0' ), (`test`.`t3`.`c1` in on distinct_key where `test`.`t3`.`c1` = ``.`b1` and `test`.`t3`.`c2` = ``.`b2`)))) ), (`test`.`t3`.`c1` in on distinct_key where `test`.`t3`.`c1` = ``.`c1` and `test`.`t3`.`c2` = ``.`c2`)))) select * from t1, t3 where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where b1 < '9') and (c1, c2) in (select c1, c2 from t3 @@ -468,7 +468,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <`test`.`t3`.`c1`>((`test`.`t3`.`c1`,(select `test`.`t1`.`a1` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and ((`test`.`t3`.`c1`) = `test`.`t1`.`a1`)) union select `test`.`t2`.`b1` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and ((`test`.`t3`.`c1`) = `test`.`t2`.`b1`))))) +Note 1003 select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <`test`.`t3`.`c1`>((`test`.`t3`.`c1`,(select `test`.`t1`.`a1` from `test`.`t1` where `test`.`t1`.`a1` > '0' and (`test`.`t3`.`c1`) = `test`.`t1`.`a1` union select `test`.`t2`.`b1` from `test`.`t2` where `test`.`t2`.`b1` < '9' and (`test`.`t3`.`c1`) = `test`.`t2`.`b1`))) select * from t3 where c1 in (select a1 from t1 where a1 > '0' UNION select b1 from t2 where b1 < '9'); c1 c2 @@ -492,14 +492,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a2' of SELECT #6 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((<`test`.`t2`.`b2`,`test`.`t1`.`a1`>((`test`.`t2`.`b2`,(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and ((`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))))) or <`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), (`test`.`t2`.`b2` in on distinct_key where ((`test`.`t2`.`b2` = ``.`c2`))))))) and ((`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and ((`test`.`t1`.`a2`) = `test`.`t2`.`b2`))))) and <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(select `test`.`t3c`.`c1`,`test`.`t3c`.`c2` from `test`.`t3` `t3c` where (<`test`.`t3c`.`c1`,`test`.`t3c`.`c2`,`test`.`t1`.`a2`>(((`test`.`t3c`.`c1`,`test`.`t3c`.`c2`),(((`test`.`t3c`.`c1`) in t2i on it2i3 where (((`test`.`t2i`.`b2` > '0') or (`test`.`t2i`.`b2` = `test`.`t1`.`a2`)) and ((`test`.`t3c`.`c1`) = `test`.`t2i`.`b1`) and ((`test`.`t3c`.`c2`) = `test`.`t2i`.`b2`)))))) and ((`test`.`t1`.`a1`) = `test`.`t3c`.`c1`) and ((`test`.`t1`.`a2`) = `test`.`t3c`.`c2`)))))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where (<`test`.`t2`.`b2`,`test`.`t1`.`a1`>((`test`.`t2`.`b2`,(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where `test`.`t3a`.`c1` = `test`.`t1`.`a1` and (`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))) or <`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where `test`.`t3b`.`c2` like '%03' ), (`test`.`t2`.`b2` in on distinct_key where `test`.`t2`.`b2` = ``.`c2`))))) and (`test`.`t1`.`a1`) = `test`.`t2`.`b1` and (`test`.`t1`.`a2`) = `test`.`t2`.`b2`))) and <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(select `test`.`t3c`.`c1`,`test`.`t3c`.`c2` from `test`.`t3` `t3c` where <`test`.`t3c`.`c1`,`test`.`t3c`.`c2`,`test`.`t1`.`a2`>(((`test`.`t3c`.`c1`,`test`.`t3c`.`c2`),(((`test`.`t3c`.`c1`) in t2i on it2i3 where (`test`.`t2i`.`b2` > '0' or `test`.`t2i`.`b2` = `test`.`t1`.`a2`) and (`test`.`t3c`.`c1`) = `test`.`t2i`.`b1` and (`test`.`t3c`.`c2`) = `test`.`t2i`.`b2`)))) and (`test`.`t1`.`a1`) = `test`.`t3c`.`c1` and (`test`.`t1`.`a2`) = `test`.`t3c`.`c2`))) explain extended select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(select '1 - 01','2 - 01' having ((((`test`.`t1`.`a1`) = '1 - 01') or isnull('1 - 01')) and (((`test`.`t1`.`a2`) = '2 - 01') or isnull('2 - 01')) and ('1 - 01') and ('2 - 01'))))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(select '1 - 01','2 - 01' having ((`test`.`t1`.`a1`) = '1 - 01' or '1 - 01' is null) and ((`test`.`t1`.`a2`) = '2 - 01' or '2 - 01' is null) and '1 - 01' is null and '2 - 01' is null))) select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01'); a1 a2 1 - 01 2 - 01 @@ -509,7 +509,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(select '1 - 01','2 - 01' having ((((`test`.`t1`.`a1`) = '1 - 01') or isnull('1 - 01')) and (((`test`.`t1`.`a2`) = '2 - 01') or isnull('2 - 01')) and ('1 - 01') and ('2 - 01'))))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(select '1 - 01','2 - 01' having ((`test`.`t1`.`a1`) = '1 - 01' or '1 - 01' is null) and ((`test`.`t1`.`a2`) = '2 - 01' or '2 - 01' is null) and '1 - 01' is null and '2 - 01' is null))) select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01' from dual); a1 a2 1 - 01 2 - 01 @@ -541,7 +541,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using temporary; Using filesort 2 DEPENDENT SUBQUERY columns unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where; Full scan on NULL key Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` group by <`test`.`t1`.`a1`>((`test`.`t1`.`a1`,(((`test`.`t1`.`a1`) in columns on PRIMARY where trigcond(((`test`.`t1`.`a1`) = `test`.`columns`.`col`)))))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` group by <`test`.`t1`.`a1`>((`test`.`t1`.`a1`,(((`test`.`t1`.`a1`) in columns on PRIMARY where trigcond((`test`.`t1`.`a1`) = `test`.`columns`.`col`))))) select * from t1 group by (a1 in (select col from columns)); a1 a2 1 - 00 2 - 00 @@ -602,7 +602,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where 2 DEPENDENT SUBQUERY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <`test`.`t1_16`.`a1`>((`test`.`t1_16`.`a1`,(select `test`.`t2_16`.`b1` from `test`.`t2_16` where ((`test`.`t2_16`.`b1` > '0') and ((`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1`))))) +Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <`test`.`t1_16`.`a1`>((`test`.`t1_16`.`a1`,(select `test`.`t2_16`.`b1` from `test`.`t2_16` where `test`.`t2_16`.`b1` > '0' and (`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1`))) select left(a1,7), left(a2,7) from t1_16 where a1 in (select b1 from t2_16 where b1 > '0'); @@ -616,7 +616,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where 2 DEPENDENT SUBQUERY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`>(((`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`),(select `test`.`t2_16`.`b1`,`test`.`t2_16`.`b2` from `test`.`t2_16` where ((`test`.`t2_16`.`b1` > '0') and ((`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1`) and ((`test`.`t1_16`.`a2`) = `test`.`t2_16`.`b2`))))) +Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`>(((`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`),(select `test`.`t2_16`.`b1`,`test`.`t2_16`.`b2` from `test`.`t2_16` where `test`.`t2_16`.`b1` > '0' and (`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1` and (`test`.`t1_16`.`a2`) = `test`.`t2_16`.`b2`))) select left(a1,7), left(a2,7) from t1_16 where (a1,a2) in (select b1, b2 from t2_16 where b1 > '0'); @@ -630,7 +630,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where 2 MATERIALIZED t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <`test`.`t1_16`.`a1`>((`test`.`t1_16`.`a1`,`test`.`t1_16`.`a1` in ( (select substr(`test`.`t2_16`.`b1`,1,16) from `test`.`t2_16` where (`test`.`t2_16`.`b1` > '0') ), (`test`.`t1_16`.`a1` in on distinct_key where ((`test`.`t1_16`.`a1` = ``.`substring(b1,1,16)`)))))) +Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <`test`.`t1_16`.`a1`>((`test`.`t1_16`.`a1`,`test`.`t1_16`.`a1` in ( (select substr(`test`.`t2_16`.`b1`,1,16) from `test`.`t2_16` where `test`.`t2_16`.`b1` > '0' ), (`test`.`t1_16`.`a1` in on distinct_key where `test`.`t1_16`.`a1` = ``.`substring(b1,1,16)`)))) select left(a1,7), left(a2,7) from t1_16 where a1 in (select substring(b1,1,16) from t2_16 where b1 > '0'); @@ -644,7 +644,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where 2 DEPENDENT SUBQUERY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: -Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <`test`.`t1_16`.`a1`>((`test`.`t1_16`.`a1`,(select group_concat(`test`.`t2_16`.`b1` separator ',') from `test`.`t2_16` group by `test`.`t2_16`.`b2` having ((`test`.`t1_16`.`a1`) = (group_concat(`test`.`t2_16`.`b1` separator ',')))))) +Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <`test`.`t1_16`.`a1`>((`test`.`t1_16`.`a1`,(select group_concat(`test`.`t2_16`.`b1` separator ',') from `test`.`t2_16` group by `test`.`t2_16`.`b2` having (`test`.`t1_16`.`a1`) = (group_concat(`test`.`t2_16`.`b1` separator ','))))) select left(a1,7), left(a2,7) from t1_16 where a1 in (select group_concat(b1) from t2_16 group by b2); @@ -659,7 +659,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where 2 MATERIALIZED t2_16 ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: -Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <`test`.`t1_16`.`a1`>((`test`.`t1_16`.`a1`,`test`.`t1_16`.`a1` in ( (select group_concat(`test`.`t2_16`.`b1` separator ',') from `test`.`t2_16` group by `test`.`t2_16`.`b2` ), (`test`.`t1_16`.`a1` in on distinct_key where ((`test`.`t1_16`.`a1` = ``.`group_concat(b1)`)))))) +Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <`test`.`t1_16`.`a1`>((`test`.`t1_16`.`a1`,`test`.`t1_16`.`a1` in ( (select group_concat(`test`.`t2_16`.`b1` separator ',') from `test`.`t2_16` group by `test`.`t2_16`.`b2` ), (`test`.`t1_16`.`a1` in on distinct_key where `test`.`t1_16`.`a1` = ``.`group_concat(b1)`)))) select left(a1,7), left(a2,7) from t1_16 where a1 in (select group_concat(b1) from t2_16 group by b2); @@ -681,7 +681,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) 4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where ((concat(`test`.`t1`.`a1`,'x'),(select left(`test`.`t1_16`.`a1`,8) from `test`.`t1_16` where (<`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`>(((`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`),(select `test`.`t2_16`.`b1`,`test`.`t2_16`.`b2` from `test`.`t2_16` join `test`.`t2` where ((`test`.`t2`.`b2` = substr(`test`.`t2_16`.`b2`,1,6)) and <`test`.`t2`.`b1`>((`test`.`t2`.`b1`,`test`.`t2`.`b1` in ( (select `test`.`t3`.`c1` from `test`.`t3` where (`test`.`t3`.`c2` > '0') ), (`test`.`t2`.`b1` in on distinct_key where ((`test`.`t2`.`b1` = ``.`c1`)))))) and ((`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1`) and ((`test`.`t1_16`.`a2`) = `test`.`t2_16`.`b2`))))) and ((concat(`test`.`t1`.`a1`,'x')) = left(`test`.`t1_16`.`a1`,8)))))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where ((concat(`test`.`t1`.`a1`,'x'),(select left(`test`.`t1_16`.`a1`,8) from `test`.`t1_16` where <`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`>(((`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`),(select `test`.`t2_16`.`b1`,`test`.`t2_16`.`b2` from `test`.`t2_16` join `test`.`t2` where `test`.`t2`.`b2` = substr(`test`.`t2_16`.`b2`,1,6) and <`test`.`t2`.`b1`>((`test`.`t2`.`b1`,`test`.`t2`.`b1` in ( (select `test`.`t3`.`c1` from `test`.`t3` where `test`.`t3`.`c2` > '0' ), (`test`.`t2`.`b1` in on distinct_key where `test`.`t2`.`b1` = ``.`c1`)))) and (`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1` and (`test`.`t1_16`.`a2`) = `test`.`t2_16`.`b2`))) and (concat(`test`.`t1`.`a1`,'x')) = left(`test`.`t1_16`.`a1`,8)))) drop table t1_16, t2_16, t3_16; set @blob_len = 512; set @suffix_len = @blob_len - @prefix_len; @@ -715,7 +715,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where 2 DEPENDENT SUBQUERY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <`test`.`t1_512`.`a1`>((`test`.`t1_512`.`a1`,(select `test`.`t2_512`.`b1` from `test`.`t2_512` where ((`test`.`t2_512`.`b1` > '0') and ((`test`.`t1_512`.`a1`) = `test`.`t2_512`.`b1`))))) +Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <`test`.`t1_512`.`a1`>((`test`.`t1_512`.`a1`,(select `test`.`t2_512`.`b1` from `test`.`t2_512` where `test`.`t2_512`.`b1` > '0' and (`test`.`t1_512`.`a1`) = `test`.`t2_512`.`b1`))) select left(a1,7), left(a2,7) from t1_512 where a1 in (select b1 from t2_512 where b1 > '0'); @@ -729,7 +729,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where 2 DEPENDENT SUBQUERY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <`test`.`t1_512`.`a1`,`test`.`t1_512`.`a2`>(((`test`.`t1_512`.`a1`,`test`.`t1_512`.`a2`),(select `test`.`t2_512`.`b1`,`test`.`t2_512`.`b2` from `test`.`t2_512` where ((`test`.`t2_512`.`b1` > '0') and ((`test`.`t1_512`.`a1`) = `test`.`t2_512`.`b1`) and ((`test`.`t1_512`.`a2`) = `test`.`t2_512`.`b2`))))) +Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <`test`.`t1_512`.`a1`,`test`.`t1_512`.`a2`>(((`test`.`t1_512`.`a1`,`test`.`t1_512`.`a2`),(select `test`.`t2_512`.`b1`,`test`.`t2_512`.`b2` from `test`.`t2_512` where `test`.`t2_512`.`b1` > '0' and (`test`.`t1_512`.`a1`) = `test`.`t2_512`.`b1` and (`test`.`t1_512`.`a2`) = `test`.`t2_512`.`b2`))) select left(a1,7), left(a2,7) from t1_512 where (a1,a2) in (select b1, b2 from t2_512 where b1 > '0'); @@ -743,7 +743,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where 2 MATERIALIZED t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <`test`.`t1_512`.`a1`>((`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( (select substr(`test`.`t2_512`.`b1`,1,512) from `test`.`t2_512` where (`test`.`t2_512`.`b1` > '0') ), (`test`.`t1_512`.`a1` in on distinct_key where ((`test`.`t1_512`.`a1` = ``.`substring(b1,1,512)`)))))) +Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <`test`.`t1_512`.`a1`>((`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( (select substr(`test`.`t2_512`.`b1`,1,512) from `test`.`t2_512` where `test`.`t2_512`.`b1` > '0' ), (`test`.`t1_512`.`a1` in on distinct_key where `test`.`t1_512`.`a1` = ``.`substring(b1,1,512)`)))) select left(a1,7), left(a2,7) from t1_512 where a1 in (select substring(b1,1,512) from t2_512 where b1 > '0'); @@ -757,7 +757,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where 2 MATERIALIZED t2_512 ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: -Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <`test`.`t1_512`.`a1`>((`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( (select group_concat(`test`.`t2_512`.`b1` separator ',') from `test`.`t2_512` group by `test`.`t2_512`.`b2` ), (`test`.`t1_512`.`a1` in on distinct_key where ((`test`.`t1_512`.`a1` = ``.`group_concat(b1)`)))))) +Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <`test`.`t1_512`.`a1`>((`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( (select group_concat(`test`.`t2_512`.`b1` separator ',') from `test`.`t2_512` group by `test`.`t2_512`.`b2` ), (`test`.`t1_512`.`a1` in on distinct_key where `test`.`t1_512`.`a1` = ``.`group_concat(b1)`)))) select left(a1,7), left(a2,7) from t1_512 where a1 in (select group_concat(b1) from t2_512 group by b2); @@ -774,7 +774,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where 2 MATERIALIZED t2_512 ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: -Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <`test`.`t1_512`.`a1`>((`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( (select group_concat(`test`.`t2_512`.`b1` separator ',') from `test`.`t2_512` group by `test`.`t2_512`.`b2` ), (`test`.`t1_512`.`a1` in on distinct_key where ((`test`.`t1_512`.`a1` = ``.`group_concat(b1)`)))))) +Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <`test`.`t1_512`.`a1`>((`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( (select group_concat(`test`.`t2_512`.`b1` separator ',') from `test`.`t2_512` group by `test`.`t2_512`.`b2` ), (`test`.`t1_512`.`a1` in on distinct_key where `test`.`t1_512`.`a1` = ``.`group_concat(b1)`)))) select left(a1,7), left(a2,7) from t1_512 where a1 in (select group_concat(b1) from t2_512 group by b2); @@ -816,7 +816,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where 2 DEPENDENT SUBQUERY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <`test`.`t1_1024`.`a1`>((`test`.`t1_1024`.`a1`,(select `test`.`t2_1024`.`b1` from `test`.`t2_1024` where ((`test`.`t2_1024`.`b1` > '0') and ((`test`.`t1_1024`.`a1`) = `test`.`t2_1024`.`b1`))))) +Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <`test`.`t1_1024`.`a1`>((`test`.`t1_1024`.`a1`,(select `test`.`t2_1024`.`b1` from `test`.`t2_1024` where `test`.`t2_1024`.`b1` > '0' and (`test`.`t1_1024`.`a1`) = `test`.`t2_1024`.`b1`))) select left(a1,7), left(a2,7) from t1_1024 where a1 in (select b1 from t2_1024 where b1 > '0'); @@ -830,7 +830,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where 2 DEPENDENT SUBQUERY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a2`>(((`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a2`),(select `test`.`t2_1024`.`b1`,`test`.`t2_1024`.`b2` from `test`.`t2_1024` where ((`test`.`t2_1024`.`b1` > '0') and ((`test`.`t1_1024`.`a1`) = `test`.`t2_1024`.`b1`) and ((`test`.`t1_1024`.`a2`) = `test`.`t2_1024`.`b2`))))) +Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a2`>(((`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a2`),(select `test`.`t2_1024`.`b1`,`test`.`t2_1024`.`b2` from `test`.`t2_1024` where `test`.`t2_1024`.`b1` > '0' and (`test`.`t1_1024`.`a1`) = `test`.`t2_1024`.`b1` and (`test`.`t1_1024`.`a2`) = `test`.`t2_1024`.`b2`))) select left(a1,7), left(a2,7) from t1_1024 where (a1,a2) in (select b1, b2 from t2_1024 where b1 > '0'); @@ -844,7 +844,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where 2 DEPENDENT SUBQUERY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <`test`.`t1_1024`.`a1`>((`test`.`t1_1024`.`a1`,(select substr(`test`.`t2_1024`.`b1`,1,1024) from `test`.`t2_1024` where ((`test`.`t2_1024`.`b1` > '0') and ((`test`.`t1_1024`.`a1`) = substr(`test`.`t2_1024`.`b1`,1,1024)))))) +Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <`test`.`t1_1024`.`a1`>((`test`.`t1_1024`.`a1`,(select substr(`test`.`t2_1024`.`b1`,1,1024) from `test`.`t2_1024` where `test`.`t2_1024`.`b1` > '0' and (`test`.`t1_1024`.`a1`) = substr(`test`.`t2_1024`.`b1`,1,1024)))) select left(a1,7), left(a2,7) from t1_1024 where a1 in (select substring(b1,1,1024) from t2_1024 where b1 > '0'); @@ -858,7 +858,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where 2 MATERIALIZED t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: -Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <`test`.`t1_1024`.`a1`>((`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in ( (select group_concat(`test`.`t2_1024`.`b1` separator ',') from `test`.`t2_1024` group by `test`.`t2_1024`.`b2` ), (`test`.`t1_1024`.`a1` in on distinct_key where ((`test`.`t1_1024`.`a1` = ``.`group_concat(b1)`)))))) +Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <`test`.`t1_1024`.`a1`>((`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in ( (select group_concat(`test`.`t2_1024`.`b1` separator ',') from `test`.`t2_1024` group by `test`.`t2_1024`.`b2` ), (`test`.`t1_1024`.`a1` in on distinct_key where `test`.`t1_1024`.`a1` = ``.`group_concat(b1)`)))) select left(a1,7), left(a2,7) from t1_1024 where a1 in (select group_concat(b1) from t2_1024 group by b2); @@ -875,7 +875,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where 2 MATERIALIZED t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: -Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <`test`.`t1_1024`.`a1`>((`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in ( (select group_concat(`test`.`t2_1024`.`b1` separator ',') from `test`.`t2_1024` group by `test`.`t2_1024`.`b2` ), (`test`.`t1_1024`.`a1` in on distinct_key where ((`test`.`t1_1024`.`a1` = ``.`group_concat(b1)`)))))) +Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <`test`.`t1_1024`.`a1`>((`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in ( (select group_concat(`test`.`t2_1024`.`b1` separator ',') from `test`.`t2_1024` group by `test`.`t2_1024`.`b2` ), (`test`.`t1_1024`.`a1` in on distinct_key where `test`.`t1_1024`.`a1` = ``.`group_concat(b1)`)))) select left(a1,7), left(a2,7) from t1_1024 where a1 in (select group_concat(b1) from t2_1024 group by b2); @@ -917,7 +917,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where 2 DEPENDENT SUBQUERY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <`test`.`t1_1025`.`a1`>((`test`.`t1_1025`.`a1`,(select `test`.`t2_1025`.`b1` from `test`.`t2_1025` where ((`test`.`t2_1025`.`b1` > '0') and ((`test`.`t1_1025`.`a1`) = `test`.`t2_1025`.`b1`))))) +Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <`test`.`t1_1025`.`a1`>((`test`.`t1_1025`.`a1`,(select `test`.`t2_1025`.`b1` from `test`.`t2_1025` where `test`.`t2_1025`.`b1` > '0' and (`test`.`t1_1025`.`a1`) = `test`.`t2_1025`.`b1`))) select left(a1,7), left(a2,7) from t1_1025 where a1 in (select b1 from t2_1025 where b1 > '0'); @@ -931,7 +931,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where 2 DEPENDENT SUBQUERY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a2`>(((`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a2`),(select `test`.`t2_1025`.`b1`,`test`.`t2_1025`.`b2` from `test`.`t2_1025` where ((`test`.`t2_1025`.`b1` > '0') and ((`test`.`t1_1025`.`a1`) = `test`.`t2_1025`.`b1`) and ((`test`.`t1_1025`.`a2`) = `test`.`t2_1025`.`b2`))))) +Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a2`>(((`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a2`),(select `test`.`t2_1025`.`b1`,`test`.`t2_1025`.`b2` from `test`.`t2_1025` where `test`.`t2_1025`.`b1` > '0' and (`test`.`t1_1025`.`a1`) = `test`.`t2_1025`.`b1` and (`test`.`t1_1025`.`a2`) = `test`.`t2_1025`.`b2`))) select left(a1,7), left(a2,7) from t1_1025 where (a1,a2) in (select b1, b2 from t2_1025 where b1 > '0'); @@ -945,7 +945,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where 2 DEPENDENT SUBQUERY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <`test`.`t1_1025`.`a1`>((`test`.`t1_1025`.`a1`,(select substr(`test`.`t2_1025`.`b1`,1,1025) from `test`.`t2_1025` where ((`test`.`t2_1025`.`b1` > '0') and ((`test`.`t1_1025`.`a1`) = substr(`test`.`t2_1025`.`b1`,1,1025)))))) +Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <`test`.`t1_1025`.`a1`>((`test`.`t1_1025`.`a1`,(select substr(`test`.`t2_1025`.`b1`,1,1025) from `test`.`t2_1025` where `test`.`t2_1025`.`b1` > '0' and (`test`.`t1_1025`.`a1`) = substr(`test`.`t2_1025`.`b1`,1,1025)))) select left(a1,7), left(a2,7) from t1_1025 where a1 in (select substring(b1,1,1025) from t2_1025 where b1 > '0'); @@ -959,7 +959,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where 2 MATERIALIZED t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: -Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <`test`.`t1_1025`.`a1`>((`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in ( (select group_concat(`test`.`t2_1025`.`b1` separator ',') from `test`.`t2_1025` group by `test`.`t2_1025`.`b2` ), (`test`.`t1_1025`.`a1` in on distinct_key where ((`test`.`t1_1025`.`a1` = ``.`group_concat(b1)`)))))) +Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <`test`.`t1_1025`.`a1`>((`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in ( (select group_concat(`test`.`t2_1025`.`b1` separator ',') from `test`.`t2_1025` group by `test`.`t2_1025`.`b2` ), (`test`.`t1_1025`.`a1` in on distinct_key where `test`.`t1_1025`.`a1` = ``.`group_concat(b1)`)))) select left(a1,7), left(a2,7) from t1_1025 where a1 in (select group_concat(b1) from t2_1025 group by b2); @@ -976,7 +976,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where 2 MATERIALIZED t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: -Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <`test`.`t1_1025`.`a1`>((`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in ( (select group_concat(`test`.`t2_1025`.`b1` separator ',') from `test`.`t2_1025` group by `test`.`t2_1025`.`b2` ), (`test`.`t1_1025`.`a1` in on distinct_key where ((`test`.`t1_1025`.`a1` = ``.`group_concat(b1)`)))))) +Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <`test`.`t1_1025`.`a1`>((`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in ( (select group_concat(`test`.`t2_1025`.`b1` separator ',') from `test`.`t2_1025` group by `test`.`t2_1025`.`b2` ), (`test`.`t1_1025`.`a1` in on distinct_key where `test`.`t1_1025`.`a1` = ``.`group_concat(b1)`)))) select left(a1,7), left(a2,7) from t1_1025 where a1 in (select group_concat(b1) from t2_1025 group by b2); @@ -1001,7 +1001,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1bit ALL NULL NULL NULL NULL 3 100.00 Using where 2 MATERIALIZED t2bit ALL NULL NULL NULL NULL 3 100.00 Warnings: -Note 1003 select conv(`test`.`t1bit`.`a1`,10,2) AS `bin(a1)`,conv(`test`.`t1bit`.`a2`,10,2) AS `bin(a2)` from `test`.`t1bit` where <`test`.`t1bit`.`a1`,`test`.`t1bit`.`a2`>(((`test`.`t1bit`.`a1`,`test`.`t1bit`.`a2`),(`test`.`t1bit`.`a1`,`test`.`t1bit`.`a2`) in ( (select `test`.`t2bit`.`b1`,`test`.`t2bit`.`b2` from `test`.`t2bit` ), (`test`.`t1bit`.`a1` in on distinct_key where ((`test`.`t1bit`.`a1` = ``.`b1`) and (`test`.`t1bit`.`a2` = ``.`b2`)))))) +Note 1003 select conv(`test`.`t1bit`.`a1`,10,2) AS `bin(a1)`,conv(`test`.`t1bit`.`a2`,10,2) AS `bin(a2)` from `test`.`t1bit` where <`test`.`t1bit`.`a1`,`test`.`t1bit`.`a2`>(((`test`.`t1bit`.`a1`,`test`.`t1bit`.`a2`),(`test`.`t1bit`.`a1`,`test`.`t1bit`.`a2`) in ( (select `test`.`t2bit`.`b1`,`test`.`t2bit`.`b2` from `test`.`t2bit` ), (`test`.`t1bit`.`a1` in on distinct_key where `test`.`t1bit`.`a1` = ``.`b1` and `test`.`t1bit`.`a2` = ``.`b2`)))) select bin(a1), bin(a2) from t1bit where (a1, a2) in (select b1, b2 from t2bit); @@ -1024,7 +1024,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1bb ALL NULL NULL NULL NULL 3 100.00 Using where 2 DEPENDENT SUBQUERY t2bb ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select conv(`test`.`t1bb`.`a1`,10,2) AS `bin(a1)`,`test`.`t1bb`.`a2` AS `a2` from `test`.`t1bb` where <`test`.`t1bb`.`a1`,`test`.`t1bb`.`a2`>(((`test`.`t1bb`.`a1`,`test`.`t1bb`.`a2`),(select `test`.`t2bb`.`b1`,`test`.`t2bb`.`b2` from `test`.`t2bb` where (((`test`.`t1bb`.`a1`) = `test`.`t2bb`.`b1`) and ((`test`.`t1bb`.`a2`) = `test`.`t2bb`.`b2`))))) +Note 1003 select conv(`test`.`t1bb`.`a1`,10,2) AS `bin(a1)`,`test`.`t1bb`.`a2` AS `a2` from `test`.`t1bb` where <`test`.`t1bb`.`a1`,`test`.`t1bb`.`a2`>(((`test`.`t1bb`.`a1`,`test`.`t1bb`.`a2`),(select `test`.`t2bb`.`b1`,`test`.`t2bb`.`b2` from `test`.`t2bb` where (`test`.`t1bb`.`a1`) = `test`.`t2bb`.`b1` and (`test`.`t1bb`.`a2`) = `test`.`t2bb`.`b2`))) select bin(a1), a2 from t1bb where (a1, a2) in (select b1, b2 from t2bb); @@ -1072,7 +1072,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 7 100.00 Using where 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <`test`.`t1`.`a`>((`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t2`.`c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), (`test`.`t1`.`a` in on distinct_key where ((`test`.`t1`.`a` = ``.`c`)))))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <`test`.`t1`.`a`>((`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t2`.`c` from `test`.`t2` where `test`.`t2`.`d` >= 20 ), (`test`.`t1`.`a` in on distinct_key where `test`.`t1`.`a` = ``.`c`)))) select a from t1 where a in (select c from t2 where d >= 20); a 2 @@ -1086,7 +1086,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using where; Using index 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <`test`.`t1`.`a`>((`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t2`.`c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), (`test`.`t1`.`a` in on distinct_key where ((`test`.`t1`.`a` = ``.`c`)))))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <`test`.`t1`.`a`>((`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t2`.`c` from `test`.`t2` where `test`.`t2`.`d` >= 20 ), (`test`.`t1`.`a` in on distinct_key where `test`.`t1`.`a` = ``.`c`)))) select a from t1 where a in (select c from t2 where d >= 20); a 2 @@ -1100,7 +1100,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using where; Using index 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 7 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <`test`.`t1`.`a`>((`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t2`.`c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), (`test`.`t1`.`a` in on distinct_key where ((`test`.`t1`.`a` = ``.`c`)))))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <`test`.`t1`.`a`>((`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t2`.`c` from `test`.`t2` where `test`.`t2`.`d` >= 20 ), (`test`.`t1`.`a` in on distinct_key where `test`.`t1`.`a` = ``.`c`)))) select a from t1 where a in (select c from t2 where d >= 20); a 2 @@ -1113,7 +1113,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using index 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 7 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <`test`.`t1`.`a`>((`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t2`.`c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), (`test`.`t1`.`a` in on distinct_key where ((`test`.`t1`.`a` = ``.`c`)))))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <`test`.`t1`.`a`>((`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t2`.`c` from `test`.`t2` where `test`.`t2`.`d` >= 20 ), (`test`.`t1`.`a` in on distinct_key where `test`.`t1`.`a` = ``.`c`)))) select a from t1 group by a having a in (select c from t2 where d >= 20); a 2 @@ -1125,7 +1125,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using index 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 7 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <`test`.`t1`.`a`>((`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t2`.`c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), (`test`.`t1`.`a` in on distinct_key where ((`test`.`t1`.`a` = ``.`c`)))))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <`test`.`t1`.`a`>((`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t2`.`c` from `test`.`t2` where `test`.`t2`.`d` >= 20 ), (`test`.`t1`.`a` in on distinct_key where `test`.`t1`.`a` = ``.`c`)))) select a from t1 group by a having a in (select c from t2 where d >= 20); a 2 @@ -1140,7 +1140,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1 Note 1981 Aggregate function 'max()' of SELECT #3 belongs to SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <`test`.`t1`.`a`,`test`.`t1`.`b`,max(`test`.`t1`.`b`),max(`test`.`t1`.`b`)>((`test`.`t1`.`a`,(select `test`.`t2`.`c` from `test`.`t2` where ((<`test`.`t2`.`d`,`test`.`t1`.`b`,max(`test`.`t1`.`b`),max(`test`.`t1`.`b`)>((`test`.`t2`.`d`,(select `test`.`t3`.`e` from `test`.`t3` where (max(`test`.`t1`.`b`) = `test`.`t3`.`e`) having ((`test`.`t2`.`d`) >= (`test`.`t3`.`e`)))))) and ((`test`.`t1`.`a`) = `test`.`t2`.`c`))))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <`test`.`t1`.`a`,`test`.`t1`.`b`,max(`test`.`t1`.`b`),max(`test`.`t1`.`b`)>((`test`.`t1`.`a`,(select `test`.`t2`.`c` from `test`.`t2` where (<`test`.`t2`.`d`,`test`.`t1`.`b`,max(`test`.`t1`.`b`),max(`test`.`t1`.`b`)>((`test`.`t2`.`d`,(select `test`.`t3`.`e` from `test`.`t3` where max(`test`.`t1`.`b`) = `test`.`t3`.`e` having (`test`.`t2`.`d`) >= (`test`.`t3`.`e`))))) and (`test`.`t1`.`a`) = `test`.`t2`.`c`))) select a from t1 group by a having a in (select c from t2 where d >= some(select e from t3 where max(b)=e)); a @@ -1155,7 +1155,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <`test`.`t1`.`a`,`test`.`t1`.`b`>((`test`.`t1`.`a`,(select `test`.`t2`.`c` from `test`.`t2` where ((<`test`.`t2`.`d`,`test`.`t1`.`b`>((`test`.`t2`.`d`,(select `test`.`t3`.`e` from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and ((`test`.`t2`.`d`) >= `test`.`t3`.`e`)))))) and ((`test`.`t1`.`a`) = `test`.`t2`.`c`))))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <`test`.`t1`.`a`,`test`.`t1`.`b`>((`test`.`t1`.`a`,(select `test`.`t2`.`c` from `test`.`t2` where (<`test`.`t2`.`d`,`test`.`t1`.`b`>((`test`.`t2`.`d`,(select `test`.`t3`.`e` from `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`e` and (`test`.`t2`.`d`) >= `test`.`t3`.`e`)))) and (`test`.`t1`.`a`) = `test`.`t2`.`c`))) select a from t1 where a in (select c from t2 where d >= some(select e from t3 where b=e)); a @@ -1824,7 +1824,7 @@ 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 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: -Note 1003 select 8 AS `a` from dual where <8>((8,(select min(`test`.`t1`.`a`) from `test`.`t1` having ((8) = (min(`test`.`t1`.`a`)))))) +Note 1003 select 8 AS `a` from dual where <8>((8,(select min(`test`.`t1`.`a`) from `test`.`t1` having (8) = (min(`test`.`t1`.`a`))))) DROP TABLE t1; # # BUG#904432: Wrong result with LEFT JOIN, constant table, semijoin=ON,materialization=ON @@ -1925,7 +1925,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from (select max(`test`.`t2`.`c`) from `test`.`t2`) join `test`.`t1` where ((`test`.`t1`.`b` = 7) and (`test`.`t1`.`a` = ``.`MAX(c)`) and ((isnull(``.`MAX(c)`)) or (``.`MAX(c)` = 7))) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from (select max(`test`.`t2`.`c`) from `test`.`t2`) join `test`.`t1` where `test`.`t1`.`b` = 7 and `test`.`t1`.`a` = ``.`MAX(c)` and ((``.`MAX(c)` is null) or ``.`MAX(c)` = 7) SELECT * FROM t1 WHERE a IN (SELECT MAX(c) FROM t2) AND b=7 AND (a IS NULL OR a=b); a b @@ -2168,7 +2168,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 eq_ref db db 764 information_schema.schemata.SCHEMA_NAME 1 100.00 Using where; Using index 2 MATERIALIZED schemata ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 select `test`.`t1`.`db` AS `db` from `test`.`t1` semi join (`information_schema`.`schemata`) where (`test`.`t1`.`db` = `information_schema`.`schemata`.`SCHEMA_NAME`) order by `test`.`t1`.`db` desc +Note 1003 select `test`.`t1`.`db` AS `db` from `test`.`t1` semi join (`information_schema`.`schemata`) where `test`.`t1`.`db` = `information_schema`.`schemata`.`SCHEMA_NAME` order by `test`.`t1`.`db` desc drop table t1; drop database mysqltest1; drop database mysqltest2; diff --git a/mysql-test/r/subselect_mat_cost_bugs.result b/mysql-test/r/subselect_mat_cost_bugs.result index 24640154c59..c7b0f0d46c6 100644 --- a/mysql-test/r/subselect_mat_cost_bugs.result +++ b/mysql-test/r/subselect_mat_cost_bugs.result @@ -100,7 +100,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 index c3 c3 9 NULL 2 100.00 Using where; Using index; Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t1.pk' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` where <`test`.`t1`.`c1`,`test`.`t1`.`pk`>((`test`.`t1`.`c1`,(select `test`.`t1a`.`c1` from `test`.`t1b` join `test`.`t2` left join `test`.`t1a` on(((`test`.`t1a`.`c2` = `test`.`t1b`.`pk`) and 2)) where ((`test`.`t1`.`pk` <> 0) and ((`test`.`t1`.`c1`) = `test`.`t1a`.`c1`) and (`test`.`t2`.`c3` = `test`.`t1b`.`c4`))))) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` where <`test`.`t1`.`c1`,`test`.`t1`.`pk`>((`test`.`t1`.`c1`,(select `test`.`t1a`.`c1` from `test`.`t1b` join `test`.`t2` left join `test`.`t1a` on(`test`.`t1a`.`c2` = `test`.`t1b`.`pk` and 2) where `test`.`t1`.`pk` <> 0 and (`test`.`t1`.`c1`) = `test`.`t1a`.`c1` and `test`.`t2`.`c3` = `test`.`t1b`.`c4`))) SELECT pk FROM t1 WHERE c1 IN diff --git a/mysql-test/r/subselect_no_exists_to_in.result b/mysql-test/r/subselect_no_exists_to_in.result index 303303f4619..7f6ff7a6a16 100644 --- a/mysql-test/r/subselect_no_exists_to_in.result +++ b/mysql-test/r/subselect_no_exists_to_in.result @@ -60,7 +60,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select 1 AS `1` from dual having ((select 1) = 1) +Note 1003 select 1 AS `1` from dual having (select 1) = 1 SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; 1 1 @@ -201,7 +201,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) from `test`.`t2`))) +Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1)) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where `test`.`t4`.`b` = (select max(`test`.`t2`.`a`) * 4 from `test`.`t2`)) select (select a from t3 where a 1)) `tt` +Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where `test`.`t3`.`a` < 8 order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`a` > 1) `tt` set optimizer_switch=@tmp_optimizer_switch; select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1); a @@ -241,7 +241,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select `test`.`t4`.`b` AS `b`,<`test`.`t4`.`a`>((select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` +Note 1003 select `test`.`t4`.`b` AS `b`,<`test`.`t4`.`a`>((select avg(`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` select * from t3 where exists (select * from t2 where t2.b=t3.a); a 7 @@ -287,7 +287,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select min(`test`.`t2`.`b`) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2); a 7 @@ -331,7 +331,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select <`test`.`t2`.`a`>((select 2 from dual where (2 = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`))) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2` +Note 1003 select <`test`.`t2`.`a`>((select 2 from dual where 2 = `test`.`t2`.`a` union select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2` select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2; ERROR 21000: Subquery returns more than 1 row create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq)); @@ -349,7 +349,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 100.00 Using index Warnings: Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <`test`.`t6`.`clinic_uq`>(exists(select 1 from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`))) +Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <`test`.`t6`.`clinic_uq`>(exists(select 1 from `test`.`t7` where `test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`)) select * from t1 where a= (select a from t2,t4 where t2.b=t4.b); ERROR 23000: Column 'a' in field list is ambiguous drop table t1,t2,t3; @@ -410,13 +410,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03') +Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03' EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'); 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 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` +Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03') AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; date 2002-08-03 @@ -563,7 +563,7 @@ EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: -Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1') +Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where `test`.`t1`.`numeropost` = '1' EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index @@ -745,7 +745,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ref id id 5 const 1 100.00 Using index Warnings: Note 1249 Select 2 was reduced during optimization -Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = 1) +Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = 1 SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3); id 1 @@ -758,7 +758,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1249 Select 3 was reduced during optimization Note 1249 Select 2 was reduced during optimization -Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = ((1 + 1))) +Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = (1 + 1) EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index @@ -766,7 +766,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <`test`.`t2`.`id`>((`test`.`t2`.`id`,(select 1 having ((`test`.`t2`.`id`) = (1)) union select 3 having ((`test`.`t2`.`id`) = (3))))) +Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <`test`.`t2`.`id`>((`test`.`t2`.`id`,(select 1 having (`test`.`t2`.`id`) = (1) union select 3 having (`test`.`t2`.`id`) = (3)))) SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3); id SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2); @@ -892,7 +892,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1249 Select 2 was reduced during optimization -Note 1003 select (`test`.`t1`.`a` + 1) AS `(select a+1)` from `test`.`t1` +Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` select (select a+1) from t1; (select a+1) 2.5 @@ -914,7 +914,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index 2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,<`test`.`t1`.`a`>((`test`.`t1`.`a`,(((`test`.`t1`.`a`) in t2 on a checking NULL having (`test`.`t2`.`a`))))) AS `t1.a in (select t2.a from t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`a` AS `a`,<`test`.`t1`.`a`>((`test`.`t1`.`a`,(((`test`.`t1`.`a`) in t2 on a checking NULL having `test`.`t2`.`a` is null)))) AS `t1.a in (select t2.a from t2)` from `test`.`t1` CREATE TABLE t3 (a int(11) default '0'); INSERT INTO t3 VALUES (1),(2),(3); SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1; @@ -929,7 +929,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using where; Using index 2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,<`test`.`t1`.`a`>((`test`.`t1`.`a`,(select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and (((`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having (`test`.`t2`.`a`)))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1` +Note 1003 select `test`.`t1`.`a` AS `a`,<`test`.`t1`.`a`>((`test`.`t1`.`a`,(select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a` and ((`test`.`t1`.`a`) = `test`.`t2`.`a` or `test`.`t2`.`a` is null) having `test`.`t2`.`a` is null))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1` drop table t1,t2,t3; # check correct NULL Processing for normal IN/ALL/ANY # and 2 ways of max/min optimization @@ -1329,7 +1329,7 @@ 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 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)` +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'); SELECT 0 IN (SELECT 1 FROM t1 a); 0 IN (SELECT 1 FROM t1 a) @@ -1339,7 +1339,7 @@ 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 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)` +Note 1003 select (0,(select 1 from `test`.`t1` `a` where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)` drop table t1; CREATE TABLE `t1` ( `i` int(11) NOT NULL default '0', @@ -1384,7 +1384,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: -Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`)) +Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`) drop table t1; CREATE TABLE t1 ( ID int(10) unsigned NOT NULL auto_increment, @@ -1446,7 +1446,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index 1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 75.00 Using where; Using index; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` select * from t2 where t2.a in (select a from t1 where t1.b <> 30); a 2 @@ -1456,7 +1456,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index 1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); a 2 @@ -1467,7 +1467,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) 1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` = `test`.`t2`.`a`)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`a` drop table t1, t2, t3; create table t1 (a int, b int, index a (a,b)); create table t2 (a int, index a (a)); @@ -1489,7 +1489,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index 1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using index; FirstMatch(t2) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where (`test`.`t1`.`a` = `test`.`t2`.`a`) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` select * from t2 where t2.a in (select a from t1 where t1.b <> 30); a 2 @@ -1499,7 +1499,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index 1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); a 2 @@ -1510,7 +1510,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 index a a 5 NULL 3 100.00 Using where; Using index 1 PRIMARY t1 ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`b` = `test`.`t3`.`a`) and (`test`.`t1`.`a` = `test`.`t2`.`a`)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where `test`.`t1`.`b` = `test`.`t3`.`a` and `test`.`t1`.`a` = `test`.`t2`.`a` insert into t1 values (3,31); select * from t2 where t2.a in (select a from t1 where t1.b <> 30); a @@ -1526,7 +1526,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index 1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 drop table t0, t1, t2, t3; create table t1 (a int, b int); create table t2 (a int, b int); @@ -1617,25 +1617,25 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond((`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,!<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond((`test`.`t2`.`s1`)))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond((`test`.`t2`.`s1`)))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,!<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < 'a2') having trigcond((`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,!<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` drop table t1,t2; create table t2 (a int, b int not null); create table t3 (a int); @@ -1650,7 +1650,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); a explain extended select * from t3 where a >= some (select b from t2); @@ -1658,7 +1658,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); a 6 @@ -1669,7 +1669,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); a explain extended select * from t3 where a >= some (select b from t2 group by 1); @@ -1677,7 +1677,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); a explain extended select * from t3 where NULL >= any (select b from t2); @@ -1720,7 +1720,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= (`test`.`t3`.`a`))) drop table t2, t3; CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ; INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now()); @@ -1890,14 +1890,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where 2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where Warnings: -Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where (not(<`test`.`t1`.`id`>((`test`.`t1`.`id`,(((`test`.`t1`.`id`) in t1 on PRIMARY where ((`test`.`t1`.`id` < 8) and ((`test`.`t1`.`id`) = `test`.`t1`.`id`)))))))) +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where !<`test`.`t1`.`id`>((`test`.`t1`.`id`,(((`test`.`t1`.`id`) in t1 on PRIMARY where `test`.`t1`.`id` < 8 and (`test`.`t1`.`id`) = `test`.`t1`.`id`)))) explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where 2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index Warnings: Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(<`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))) +Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null)) insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001'); create table t2 (id int not null, text varchar(20) not null default '', primary key (id)); insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10'); @@ -1923,7 +1923,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00 1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition Warnings: -Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(((`test`.`b`.`id` = `test`.`a`.`id`) or isnull(`test`.`b`.`id`))) join `test`.`t1` `c` where (if(isnull(`test`.`b`.`id`),1000,`test`.`b`.`id`) = `test`.`c`.`id`) +Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(`test`.`b`.`id` = `test`.`a`.`id` or `test`.`b`.`id` is null) join `test`.`t1` `c` where if(`test`.`b`.`id` is null,1000,`test`.`b`.`id`) = `test`.`c`.`id` drop table t1,t2; create table t1 (a int); insert into t1 values (1); @@ -2433,7 +2433,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <`test`.`up`.`a`>(exists(select 1 from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`))) +Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <`test`.`up`.`a`>(exists(select 1 from `test`.`t1` where `test`.`t1`.`a` = `test`.`up`.`a`)) drop table t1; CREATE TABLE t1 (t1_a int); INSERT INTO t1 VALUES (1); @@ -2980,20 +2980,20 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<`test`.`t1`.`one`,`test`.`t1`.`two`>(((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(trigcond((((`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)))) and trigcond(trigcond((((`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))))) having (trigcond((`test`.`t2`.`one`)) and trigcond((`test`.`t2`.`two`)))))) AS `test` from `test`.`t1` +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<`test`.`t1`.`one`,`test`.`t1`.`two`>(((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond((`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond((`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null)))) AS `test` from `test`.`t1` explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 1 PRIMARY eq_ref distinct_key distinct_key 8 func,func 1 100.00 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where (`test`.`t2`.`flag` = 'N') +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`flag` = 'N' explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<`test`.`t1`.`one`,`test`.`t1`.`two`>(((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(trigcond((((`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)))) and trigcond(trigcond((((`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))))) having (trigcond((`test`.`t2`.`one`)) and trigcond((`test`.`t2`.`two`)))))) AS `test` from `test`.`t1` +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<`test`.`t1`.`one`,`test`.`t1`.`two`>(((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond((`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond((`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null)))) AS `test` from `test`.`t1` DROP TABLE t1,t2; set optimizer_switch=@tmp11867_optimizer_switch; CREATE TABLE t1 (a char(5), b char(5)); @@ -4446,7 +4446,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select 2 AS `2` from `test`.`t1` where <`test`.`t1`.`a`>(exists(select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))) +Note 1003 select 2 AS `2` from `test`.`t1` where <`test`.`t1`.`a`>(exists(select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`)) EXPLAIN EXTENDED SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION (SELECT 1 FROM t2 WHERE t1.a = t2.a)); @@ -4458,7 +4458,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select 2 AS `2` from `test`.`t1` where <`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)))) +Note 1003 select 2 AS `2` from `test`.`t1` where <`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`))) DROP TABLE t1,t2; create table t0(a int); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); @@ -4539,14 +4539,14 @@ 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 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary Warnings: -Note 1003 select 1 AS `1` from (select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` where (``.`min(a)` = 1) +Note 1003 select 1 AS `1` from (select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` where ``.`min(a)` = 1 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 const distinct_key distinct_key 4 const 1 100.00 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary Warnings: -Note 1003 select 1 AS `1` from (select min(`test`.`t1`.`a`) from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a`) join `test`.`t1` where (``.`min(a)` = 1) +Note 1003 select 1 AS `1` from (select min(`test`.`t1`.`a`) from `test`.`t1` where `test`.`t1`.`a` > 3 group by `test`.`t1`.`a`) join `test`.`t1` where ``.`min(a)` = 1 SET join_cache_level=@save_join_cache_level; DROP TABLE t1; # @@ -7130,6 +7130,17 @@ a DROP TABLE t1; SET SESSION big_tables=0; # +# MDEV-10776: Server crash on query +# +create table t1 (field1 int); +insert into t1 values (1); +select round((select 1 from t1 limit 1)) +from t1 +group by round((select 1 from t1 limit 1)); +round((select 1 from t1 limit 1)) +1 +drop table t1; +# # MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE || # m_lock_type != 2' failed in handler::ha_index_read_map # diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result index 6bdb5d1fbc2..6a17f8c8bf5 100644 --- a/mysql-test/r/subselect_no_mat.result +++ b/mysql-test/r/subselect_no_mat.result @@ -63,7 +63,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select 1 AS `1` from dual having ((select 1) = 1) +Note 1003 select 1 AS `1` from dual having (select 1) = 1 SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; 1 1 @@ -204,7 +204,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) from `test`.`t2`))) +Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1)) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where `test`.`t4`.`b` = (select max(`test`.`t2`.`a`) * 4 from `test`.`t2`)) select (select a from t3 where a 1)) `tt` +Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where `test`.`t3`.`a` < 8 order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`a` > 1) `tt` set optimizer_switch=@tmp_optimizer_switch; select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1); a @@ -244,7 +244,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select `test`.`t4`.`b` AS `b`,<`test`.`t4`.`a`>((select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` +Note 1003 select `test`.`t4`.`b` AS `b`,<`test`.`t4`.`a`>((select avg(`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` select * from t3 where exists (select * from t2 where t2.b=t3.a); a 7 @@ -290,7 +290,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select min(`test`.`t2`.`b`) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2); a 7 @@ -334,7 +334,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select <`test`.`t2`.`a`>((select 2 from dual where (2 = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`))) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2` +Note 1003 select <`test`.`t2`.`a`>((select 2 from dual where 2 = `test`.`t2`.`a` union select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2` select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2; ERROR 21000: Subquery returns more than 1 row create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq)); @@ -352,7 +352,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t6 ALL i1 NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where (`test`.`t6`.`clinic_uq` = `test`.`t7`.`uq`) +Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where `test`.`t6`.`clinic_uq` = `test`.`t7`.`uq` select * from t1 where a= (select a from t2,t4 where t2.b=t4.b); ERROR 23000: Column 'a' in field list is ambiguous drop table t1,t2,t3; @@ -413,13 +413,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03') +Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03' EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'); 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 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` +Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03') AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; date 2002-08-03 @@ -566,7 +566,7 @@ EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: -Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1') +Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where `test`.`t1`.`numeropost` = '1' EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index @@ -748,7 +748,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ref id id 5 const 1 100.00 Using index Warnings: Note 1249 Select 2 was reduced during optimization -Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = 1) +Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = 1 SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3); id 1 @@ -761,7 +761,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1249 Select 3 was reduced during optimization Note 1249 Select 2 was reduced during optimization -Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = ((1 + 1))) +Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = (1 + 1) EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index @@ -769,7 +769,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <`test`.`t2`.`id`>((`test`.`t2`.`id`,(select 1 having ((`test`.`t2`.`id`) = (1)) union select 3 having ((`test`.`t2`.`id`) = (3))))) +Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <`test`.`t2`.`id`>((`test`.`t2`.`id`,(select 1 having (`test`.`t2`.`id`) = (1) union select 3 having (`test`.`t2`.`id`) = (3)))) SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3); id SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2); @@ -895,7 +895,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1249 Select 2 was reduced during optimization -Note 1003 select (`test`.`t1`.`a` + 1) AS `(select a+1)` from `test`.`t1` +Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` select (select a+1) from t1; (select a+1) 2.5 @@ -917,7 +917,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index 2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,<`test`.`t1`.`a`>((`test`.`t1`.`a`,(((`test`.`t1`.`a`) in t2 on a checking NULL having (`test`.`t2`.`a`))))) AS `t1.a in (select t2.a from t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`a` AS `a`,<`test`.`t1`.`a`>((`test`.`t1`.`a`,(((`test`.`t1`.`a`) in t2 on a checking NULL having `test`.`t2`.`a` is null)))) AS `t1.a in (select t2.a from t2)` from `test`.`t1` CREATE TABLE t3 (a int(11) default '0'); INSERT INTO t3 VALUES (1),(2),(3); SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1; @@ -932,7 +932,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using where; Using index 2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,<`test`.`t1`.`a`>((`test`.`t1`.`a`,(select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and (((`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having (`test`.`t2`.`a`)))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1` +Note 1003 select `test`.`t1`.`a` AS `a`,<`test`.`t1`.`a`>((`test`.`t1`.`a`,(select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a` and ((`test`.`t1`.`a`) = `test`.`t2`.`a` or `test`.`t2`.`a` is null) having `test`.`t2`.`a` is null))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1` drop table t1,t2,t3; # check correct NULL Processing for normal IN/ALL/ANY # and 2 ways of max/min optimization @@ -1332,7 +1332,7 @@ 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 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)` +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'); SELECT 0 IN (SELECT 1 FROM t1 a); 0 IN (SELECT 1 FROM t1 a) @@ -1342,7 +1342,7 @@ 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 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)` +Note 1003 select (0,(select 1 from `test`.`t1` `a` where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)` drop table t1; CREATE TABLE `t1` ( `i` int(11) NOT NULL default '0', @@ -1387,7 +1387,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: -Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`)) +Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`) drop table t1; CREATE TABLE t1 ( ID int(10) unsigned NOT NULL auto_increment, @@ -1449,7 +1449,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index 1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 75.00 Using where; Using index; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` select * from t2 where t2.a in (select a from t1 where t1.b <> 30); a 2 @@ -1459,7 +1459,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index 1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); a 2 @@ -1470,7 +1470,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) 1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` = `test`.`t2`.`a`)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`a` drop table t1, t2, t3; create table t1 (a int, b int, index a (a,b)); create table t2 (a int, index a (a)); @@ -1492,7 +1492,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index 1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using index; FirstMatch(t2) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where (`test`.`t1`.`a` = `test`.`t2`.`a`) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` select * from t2 where t2.a in (select a from t1 where t1.b <> 30); a 2 @@ -1502,7 +1502,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index 1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); a 2 @@ -1513,7 +1513,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 index a a 5 NULL 3 100.00 Using where; Using index 1 PRIMARY t1 ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`b` = `test`.`t3`.`a`) and (`test`.`t1`.`a` = `test`.`t2`.`a`)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where `test`.`t1`.`b` = `test`.`t3`.`a` and `test`.`t1`.`a` = `test`.`t2`.`a` insert into t1 values (3,31); select * from t2 where t2.a in (select a from t1 where t1.b <> 30); a @@ -1529,7 +1529,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index 1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 drop table t0, t1, t2, t3; create table t1 (a int, b int); create table t2 (a int, b int); @@ -1620,25 +1620,25 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond((`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,!<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond((`test`.`t2`.`s1`)))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond((`test`.`t2`.`s1`)))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,!<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < 'a2') having trigcond((`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,!<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` drop table t1,t2; create table t2 (a int, b int not null); create table t3 (a int); @@ -1653,7 +1653,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); a explain extended select * from t3 where a >= some (select b from t2); @@ -1661,7 +1661,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); a 6 @@ -1672,7 +1672,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); a explain extended select * from t3 where a >= some (select b from t2 group by 1); @@ -1680,7 +1680,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); a explain extended select * from t3 where NULL >= any (select b from t2); @@ -1723,7 +1723,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= (`test`.`t3`.`a`))) drop table t2, t3; CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ; INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now()); @@ -1893,14 +1893,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where 2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where Warnings: -Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where (not(<`test`.`t1`.`id`>((`test`.`t1`.`id`,(((`test`.`t1`.`id`) in t1 on PRIMARY where ((`test`.`t1`.`id` < 8) and ((`test`.`t1`.`id`) = `test`.`t1`.`id`)))))))) +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where !<`test`.`t1`.`id`>((`test`.`t1`.`id`,(((`test`.`t1`.`id`) in t1 on PRIMARY where `test`.`t1`.`id` < 8 and (`test`.`t1`.`id`) = `test`.`t1`.`id`)))) explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where 2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index Warnings: Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not((1,<`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null)))))) +Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !(1,<`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null))) insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001'); create table t2 (id int not null, text varchar(20) not null default '', primary key (id)); insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10'); @@ -1926,7 +1926,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00 1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition Warnings: -Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(((`test`.`b`.`id` = `test`.`a`.`id`) or isnull(`test`.`b`.`id`))) join `test`.`t1` `c` where (if(isnull(`test`.`b`.`id`),1000,`test`.`b`.`id`) = `test`.`c`.`id`) +Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(`test`.`b`.`id` = `test`.`a`.`id` or `test`.`b`.`id` is null) join `test`.`t1` `c` where if(`test`.`b`.`id` is null,1000,`test`.`b`.`id`) = `test`.`c`.`id` drop table t1,t2; create table t1 (a int); insert into t1 values (1); @@ -2436,7 +2436,7 @@ 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 Using where; FirstMatch(up); Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` semi join (`test`.`t1`) where (`test`.`t1`.`a` = `test`.`up`.`a`) +Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`up`.`a` drop table t1; CREATE TABLE t1 (t1_a int); INSERT INTO t1 VALUES (1); @@ -2983,19 +2983,19 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<`test`.`t1`.`one`,`test`.`t1`.`two`>(((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(trigcond((((`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)))) and trigcond(trigcond((((`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))))) having (trigcond((`test`.`t2`.`one`)) and trigcond((`test`.`t2`.`two`)))))) AS `test` from `test`.`t1` +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<`test`.`t1`.`one`,`test`.`t1`.`two`>(((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond((`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond((`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null)))) AS `test` from `test`.`t1` explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 1 PRIMARY t2 ALL NULL NULL NULL NULL 9 100.00 Using where; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`flag` = 'N') and (`test`.`t2`.`one` = `test`.`t1`.`one`) and (`test`.`t2`.`two` = `test`.`t1`.`two`)) +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`flag` = 'N' and `test`.`t2`.`one` = `test`.`t1`.`one` and `test`.`t2`.`two` = `test`.`t1`.`two` explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<`test`.`t1`.`one`,`test`.`t1`.`two`>(((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(trigcond((((`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)))) and trigcond(trigcond((((`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))))) having (trigcond((`test`.`t2`.`one`)) and trigcond((`test`.`t2`.`two`)))))) AS `test` from `test`.`t1` +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<`test`.`t1`.`one`,`test`.`t1`.`two`>(((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond((`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond((`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null)))) AS `test` from `test`.`t1` DROP TABLE t1,t2; set optimizer_switch=@tmp11867_optimizer_switch; CREATE TABLE t1 (a char(5), b char(5)); @@ -4446,7 +4446,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select 2 AS `2` from `test`.`t1` semi join (`test`.`t2`) where (`test`.`t2`.`a` = `test`.`t1`.`a`) +Note 1003 select 2 AS `2` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`a` = `test`.`t1`.`a` EXPLAIN EXTENDED SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION (SELECT 1 FROM t2 WHERE t1.a = t2.a)); @@ -4458,7 +4458,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select 2 AS `2` from `test`.`t1` where <`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)))) +Note 1003 select 2 AS `2` from `test`.`t1` where <`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`))) DROP TABLE t1,t2; create table t0(a int); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); @@ -7123,6 +7123,17 @@ a DROP TABLE t1; SET SESSION big_tables=0; # +# MDEV-10776: Server crash on query +# +create table t1 (field1 int); +insert into t1 values (1); +select round((select 1 from t1 limit 1)) +from t1 +group by round((select 1 from t1 limit 1)); +round((select 1 from t1 limit 1)) +1 +drop table t1; +# # MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE || # m_lock_type != 2' failed in handler::ha_index_read_map # diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result index 2ce0188cc6d..c37fc66613f 100644 --- a/mysql-test/r/subselect_no_opts.result +++ b/mysql-test/r/subselect_no_opts.result @@ -59,7 +59,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select 1 AS `1` from dual having ((select 1) = 1) +Note 1003 select 1 AS `1` from dual having (select 1) = 1 SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; 1 1 @@ -200,7 +200,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) from `test`.`t2`))) +Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1)) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where `test`.`t4`.`b` = (select max(`test`.`t2`.`a`) * 4 from `test`.`t2`)) select (select a from t3 where a 1)) `tt` +Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where `test`.`t3`.`a` < 8 order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`a` > 1) `tt` set optimizer_switch=@tmp_optimizer_switch; select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1); a @@ -240,7 +240,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select `test`.`t4`.`b` AS `b`,(select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` +Note 1003 select `test`.`t4`.`b` AS `b`,(select avg(`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` select * from t3 where exists (select * from t2 where t2.b=t3.a); a 7 @@ -286,7 +286,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select min(`test`.`t2`.`b`) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2); a 7 @@ -330,7 +330,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select (select 2 from dual where (2 = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2` +Note 1003 select (select 2 from dual where 2 = `test`.`t2`.`a` union select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2` select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2; ERROR 21000: Subquery returns more than 1 row create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq)); @@ -409,13 +409,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03') +Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03' EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'); 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 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` +Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03') AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; date 2002-08-03 @@ -562,7 +562,7 @@ EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: -Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1') +Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where `test`.`t1`.`numeropost` = '1' EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index @@ -744,7 +744,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ref id id 5 const 1 100.00 Using index Warnings: Note 1249 Select 2 was reduced during optimization -Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = 1) +Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = 1 SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3); id 1 @@ -757,7 +757,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1249 Select 3 was reduced during optimization Note 1249 Select 2 was reduced during optimization -Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = ((1 + 1))) +Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = (1 + 1) EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index @@ -765,7 +765,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id`,(select 1 having ((`test`.`t2`.`id`) = (1)) union select 3 having ((`test`.`t2`.`id`) = (3)))) +Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id`,(select 1 having (`test`.`t2`.`id`) = (1) union select 3 having (`test`.`t2`.`id`) = (3))) SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3); id SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2); @@ -891,7 +891,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1249 Select 2 was reduced during optimization -Note 1003 select (`test`.`t1`.`a` + 1) AS `(select a+1)` from `test`.`t1` +Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` select (select a+1) from t1; (select a+1) 2.5 @@ -913,7 +913,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index 2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,(`test`.`t1`.`a`,(((`test`.`t1`.`a`) in t2 on a checking NULL having (`test`.`t2`.`a`)))) AS `t1.a in (select t2.a from t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`a` AS `a`,(`test`.`t1`.`a`,(((`test`.`t1`.`a`) in t2 on a checking NULL having `test`.`t2`.`a` is null))) AS `t1.a in (select t2.a from t2)` from `test`.`t1` CREATE TABLE t3 (a int(11) default '0'); INSERT INTO t3 VALUES (1),(2),(3); SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1; @@ -928,7 +928,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using where; Using index 2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,(`test`.`t1`.`a`,(select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and (((`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having (`test`.`t2`.`a`))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1` +Note 1003 select `test`.`t1`.`a` AS `a`,(`test`.`t1`.`a`,(select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a` and ((`test`.`t1`.`a`) = `test`.`t2`.`a` or `test`.`t2`.`a` is null) having `test`.`t2`.`a` is null)) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1` drop table t1,t2,t3; # check correct NULL Processing for normal IN/ALL/ANY # and 2 ways of max/min optimization @@ -1328,7 +1328,7 @@ 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 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)` +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'); SELECT 0 IN (SELECT 1 FROM t1 a); 0 IN (SELECT 1 FROM t1 a) @@ -1338,7 +1338,7 @@ 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 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)` +Note 1003 select (0,(select 1 from `test`.`t1` `a` where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)` drop table t1; CREATE TABLE `t1` ( `i` int(11) NOT NULL default '0', @@ -1383,7 +1383,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: -Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`)) +Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`) drop table t1; CREATE TABLE t1 ( ID int(10) unsigned NOT NULL auto_increment, @@ -1455,7 +1455,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index 2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where (`test`.`t2`.`a`,(((`test`.`t2`.`a`) in t1 on PRIMARY where ((`test`.`t1`.`b` <> 30) and ((`test`.`t2`.`a`) = `test`.`t1`.`a`))))) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where (`test`.`t2`.`a`,(((`test`.`t2`.`a`) in t1 on PRIMARY where `test`.`t1`.`b` <> 30 and (`test`.`t2`.`a`) = `test`.`t1`.`a`))) select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); a 2 @@ -1466,7 +1466,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where 2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where (`test`.`t2`.`a`,(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and ((`test`.`t2`.`a`) = `test`.`t1`.`a`)))) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where (`test`.`t2`.`a`,(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t1`.`b` and (`test`.`t2`.`a`) = `test`.`t1`.`a`)) drop table t1, t2, t3; create table t1 (a int, b int, index a (a,b)); create table t2 (a int, index a (a)); @@ -1498,7 +1498,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index 2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where (`test`.`t2`.`a`,(((`test`.`t2`.`a`) in t1 on a where ((`test`.`t1`.`b` <> 30) and ((`test`.`t2`.`a`) = `test`.`t1`.`a`))))) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where (`test`.`t2`.`a`,(((`test`.`t2`.`a`) in t1 on a where `test`.`t1`.`b` <> 30 and (`test`.`t2`.`a`) = `test`.`t1`.`a`))) select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); a 2 @@ -1509,7 +1509,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 100.00 Using where; Using index 2 DEPENDENT SUBQUERY t1 ref a a 10 func,test.t3.a 1167 100.00 Using index Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where (`test`.`t2`.`a`,(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`a`) and ((`test`.`t2`.`a`) = `test`.`t1`.`a`)))) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where (`test`.`t2`.`a`,(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`a` and (`test`.`t2`.`a`) = `test`.`t1`.`a`)) insert into t1 values (3,31); select * from t2 where t2.a in (select a from t1 where t1.b <> 30); a @@ -1525,7 +1525,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index 2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where (`test`.`t2`.`a`,(((`test`.`t2`.`a`) in t1 on a where ((`test`.`t1`.`b` <> 30) and ((`test`.`t2`.`a`) = `test`.`t1`.`a`))))) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where (`test`.`t2`.`a`,(((`test`.`t2`.`a`) in t1 on a where `test`.`t1`.`b` <> 30 and (`test`.`t2`.`a`) = `test`.`t1`.`a`))) drop table t0, t1, t2, t3; create table t1 (a int, b int); create table t2 (a int, b int); @@ -1616,25 +1616,25 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,(not((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond((`test`.`t2`.`s1`))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,!(`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null)))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,(`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond((`test`.`t2`.`s1`))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,(`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null)))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,(not((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond((`test`.`t2`.`s1`))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,!(`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null)))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,(not((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < 'a2') having trigcond((`test`.`t2`.`s1`))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,!(`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null)))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` drop table t1,t2; create table t2 (a int, b int not null); create table t3 (a int); @@ -1649,7 +1649,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); a explain extended select * from t3 where a >= some (select b from t2); @@ -1657,7 +1657,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); a 6 @@ -1668,7 +1668,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); a explain extended select * from t3 where a >= some (select b from t2 group by 1); @@ -1676,7 +1676,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); a explain extended select * from t3 where NULL >= any (select b from t2); @@ -1719,7 +1719,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= (`test`.`t3`.`a`))) drop table t2, t3; CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ; INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now()); @@ -1889,14 +1889,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where 2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where Warnings: -Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where (not((`test`.`t1`.`id`,(((`test`.`t1`.`id`) in t1 on PRIMARY where ((`test`.`t1`.`id` < 8) and ((`test`.`t1`.`id`) = `test`.`t1`.`id`))))))) +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where !(`test`.`t1`.`id`,(((`test`.`t1`.`id`) in t1 on PRIMARY where `test`.`t1`.`id` < 8 and (`test`.`t1`.`id`) = `test`.`t1`.`id`))) explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where 2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index Warnings: Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not((1,exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))) +Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !(1,exists(select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null)) insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001'); create table t2 (id int not null, text varchar(20) not null default '', primary key (id)); insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10'); @@ -1922,7 +1922,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00 1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition Warnings: -Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(((`test`.`b`.`id` = `test`.`a`.`id`) or isnull(`test`.`b`.`id`))) join `test`.`t1` `c` where (if(isnull(`test`.`b`.`id`),1000,`test`.`b`.`id`) = `test`.`c`.`id`) +Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(`test`.`b`.`id` = `test`.`a`.`id` or `test`.`b`.`id` is null) join `test`.`t1` `c` where if(`test`.`b`.`id` is null,1000,`test`.`b`.`id`) = `test`.`c`.`id` drop table t1,t2; create table t1 (a int); insert into t1 values (1); @@ -2432,7 +2432,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where (`test`.`up`.`a`,(select `test`.`t1`.`a` from `test`.`t1` where ((`test`.`up`.`a`) = `test`.`t1`.`a`))) +Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where (`test`.`up`.`a`,(select `test`.`t1`.`a` from `test`.`t1` where (`test`.`up`.`a`) = `test`.`t1`.`a`)) drop table t1; CREATE TABLE t1 (t1_a int); INSERT INTO t1 VALUES (1); @@ -2979,19 +2979,19 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(trigcond((((`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)))) and trigcond(trigcond((((`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))))) having (trigcond((`test`.`t2`.`one`)) and trigcond((`test`.`t2`.`two`))))) AS `test` from `test`.`t1` +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond((`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond((`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null))) AS `test` from `test`.`t1` explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 Using where 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where ((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = 'N') and ((`test`.`t1`.`one`) = `test`.`t2`.`one`) and ((`test`.`t1`.`two`) = `test`.`t2`.`two`)))) +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where ((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = 'N' and (`test`.`t1`.`one`) = `test`.`t2`.`one` and (`test`.`t1`.`two`) = `test`.`t2`.`two`)) explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(trigcond((((`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)))) and trigcond(trigcond((((`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))))) having (trigcond((`test`.`t2`.`one`)) and trigcond((`test`.`t2`.`two`))))) AS `test` from `test`.`t1` +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond((`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond((`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null))) AS `test` from `test`.`t1` DROP TABLE t1,t2; set optimizer_switch=@tmp11867_optimizer_switch; CREATE TABLE t1 (a char(5), b char(5)); @@ -4442,7 +4442,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select 2 AS `2` from `test`.`t1` where (`test`.`t1`.`a`,(select `test`.`t2`.`a` from `test`.`t2` where ((`test`.`t1`.`a`) = `test`.`t2`.`a`))) +Note 1003 select 2 AS `2` from `test`.`t1` where (`test`.`t1`.`a`,(select `test`.`t2`.`a` from `test`.`t2` where (`test`.`t1`.`a`) = `test`.`t2`.`a`)) EXPLAIN EXTENDED SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION (SELECT 1 FROM t2 WHERE t1.a = t2.a)); @@ -4454,7 +4454,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select 2 AS `2` from `test`.`t1` where exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))) +Note 1003 select 2 AS `2` from `test`.`t1` where exists((select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`)) DROP TABLE t1,t2; create table t0(a int); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); @@ -7121,6 +7121,17 @@ a DROP TABLE t1; SET SESSION big_tables=0; # +# MDEV-10776: Server crash on query +# +create table t1 (field1 int); +insert into t1 values (1); +select round((select 1 from t1 limit 1)) +from t1 +group by round((select 1 from t1 limit 1)); +round((select 1 from t1 limit 1)) +1 +drop table t1; +# # MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE || # m_lock_type != 2' failed in handler::ha_index_read_map # diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result index 22f25cb0d50..0fec9524dd5 100644 --- a/mysql-test/r/subselect_no_scache.result +++ b/mysql-test/r/subselect_no_scache.result @@ -62,7 +62,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select 1 AS `1` from dual having ((select 1) = 1) +Note 1003 select 1 AS `1` from dual having (select 1) = 1 SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; 1 1 @@ -203,7 +203,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) from `test`.`t2`))) +Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1)) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where `test`.`t4`.`b` = (select max(`test`.`t2`.`a`) * 4 from `test`.`t2`)) select (select a from t3 where a 1)) `tt` +Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where `test`.`t3`.`a` < 8 order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`a` > 1) `tt` set optimizer_switch=@tmp_optimizer_switch; select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1); a @@ -243,7 +243,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select `test`.`t4`.`b` AS `b`,(select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` +Note 1003 select `test`.`t4`.`b` AS `b`,(select avg(`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` select * from t3 where exists (select * from t2 where t2.b=t3.a); a 7 @@ -289,7 +289,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select min(`test`.`t2`.`b`) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2); a 7 @@ -333,7 +333,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select (select 2 from dual where (2 = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2` +Note 1003 select (select 2 from dual where 2 = `test`.`t2`.`a` union select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2` select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2; ERROR 21000: Subquery returns more than 1 row create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq)); @@ -351,7 +351,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t6 ALL i1 NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where (`test`.`t6`.`clinic_uq` = `test`.`t7`.`uq`) +Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where `test`.`t6`.`clinic_uq` = `test`.`t7`.`uq` select * from t1 where a= (select a from t2,t4 where t2.b=t4.b); ERROR 23000: Column 'a' in field list is ambiguous drop table t1,t2,t3; @@ -412,13 +412,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03') +Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03' EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'); 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 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` +Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03') AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; date 2002-08-03 @@ -565,7 +565,7 @@ EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: -Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1') +Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where `test`.`t1`.`numeropost` = '1' EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index @@ -747,7 +747,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ref id id 5 const 1 100.00 Using index Warnings: Note 1249 Select 2 was reduced during optimization -Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = 1) +Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = 1 SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3); id 1 @@ -760,7 +760,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1249 Select 3 was reduced during optimization Note 1249 Select 2 was reduced during optimization -Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = ((1 + 1))) +Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = (1 + 1) EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index @@ -768,7 +768,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id`,(select 1 having ((`test`.`t2`.`id`) = (1)) union select 3 having ((`test`.`t2`.`id`) = (3)))) +Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id`,(select 1 having (`test`.`t2`.`id`) = (1) union select 3 having (`test`.`t2`.`id`) = (3))) SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3); id SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2); @@ -894,7 +894,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1249 Select 2 was reduced during optimization -Note 1003 select (`test`.`t1`.`a` + 1) AS `(select a+1)` from `test`.`t1` +Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` select (select a+1) from t1; (select a+1) 2.5 @@ -916,7 +916,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index 2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,(`test`.`t1`.`a`,(((`test`.`t1`.`a`) in t2 on a checking NULL having (`test`.`t2`.`a`)))) AS `t1.a in (select t2.a from t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`a` AS `a`,(`test`.`t1`.`a`,(((`test`.`t1`.`a`) in t2 on a checking NULL having `test`.`t2`.`a` is null))) AS `t1.a in (select t2.a from t2)` from `test`.`t1` CREATE TABLE t3 (a int(11) default '0'); INSERT INTO t3 VALUES (1),(2),(3); SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1; @@ -931,7 +931,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using where; Using index 2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,(`test`.`t1`.`a`,(select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and (((`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having (`test`.`t2`.`a`))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1` +Note 1003 select `test`.`t1`.`a` AS `a`,(`test`.`t1`.`a`,(select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a` and ((`test`.`t1`.`a`) = `test`.`t2`.`a` or `test`.`t2`.`a` is null) having `test`.`t2`.`a` is null)) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1` drop table t1,t2,t3; # check correct NULL Processing for normal IN/ALL/ANY # and 2 ways of max/min optimization @@ -1331,7 +1331,7 @@ 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 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)` +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'); SELECT 0 IN (SELECT 1 FROM t1 a); 0 IN (SELECT 1 FROM t1 a) @@ -1341,7 +1341,7 @@ 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 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)` +Note 1003 select (0,(select 1 from `test`.`t1` `a` where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)` drop table t1; CREATE TABLE `t1` ( `i` int(11) NOT NULL default '0', @@ -1386,7 +1386,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: -Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`)) +Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`) drop table t1; CREATE TABLE t1 ( ID int(10) unsigned NOT NULL auto_increment, @@ -1448,7 +1448,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index 1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 75.00 Using where; Using index; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` select * from t2 where t2.a in (select a from t1 where t1.b <> 30); a 2 @@ -1458,7 +1458,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index 1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); a 2 @@ -1469,7 +1469,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) 1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` = `test`.`t2`.`a`)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`a` drop table t1, t2, t3; create table t1 (a int, b int, index a (a,b)); create table t2 (a int, index a (a)); @@ -1491,7 +1491,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index 1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using index; FirstMatch(t2) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where (`test`.`t1`.`a` = `test`.`t2`.`a`) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` select * from t2 where t2.a in (select a from t1 where t1.b <> 30); a 2 @@ -1501,7 +1501,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index 1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); a 2 @@ -1512,7 +1512,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 index a a 5 NULL 3 100.00 Using where; Using index 1 PRIMARY t1 ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`b` = `test`.`t3`.`a`) and (`test`.`t1`.`a` = `test`.`t2`.`a`)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where `test`.`t1`.`b` = `test`.`t3`.`a` and `test`.`t1`.`a` = `test`.`t2`.`a` insert into t1 values (3,31); select * from t2 where t2.a in (select a from t1 where t1.b <> 30); a @@ -1528,7 +1528,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index 1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30)) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 drop table t0, t1, t2, t3; create table t1 (a int, b int); create table t2 (a int, b int); @@ -1619,25 +1619,25 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,(not((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond((`test`.`t2`.`s1`))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,!(`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null)))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,(`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond((`test`.`t2`.`s1`))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,(`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null)))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,(not((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond((`test`.`t2`.`s1`))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,!(`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null)))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,(not((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < 'a2') having trigcond((`test`.`t2`.`s1`))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,!(`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null)))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` drop table t1,t2; create table t2 (a int, b int not null); create table t3 (a int); @@ -1652,7 +1652,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); a explain extended select * from t3 where a >= some (select b from t2); @@ -1660,7 +1660,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); a 6 @@ -1671,7 +1671,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); a explain extended select * from t3 where a >= some (select b from t2 group by 1); @@ -1679,7 +1679,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); a explain extended select * from t3 where NULL >= any (select b from t2); @@ -1722,7 +1722,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= (`test`.`t3`.`a`))) drop table t2, t3; CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ; INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now()); @@ -1892,14 +1892,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where 2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where Warnings: -Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where (not((`test`.`t1`.`id`,(((`test`.`t1`.`id`) in t1 on PRIMARY where ((`test`.`t1`.`id` < 8) and ((`test`.`t1`.`id`) = `test`.`t1`.`id`))))))) +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where !(`test`.`t1`.`id`,(((`test`.`t1`.`id`) in t1 on PRIMARY where `test`.`t1`.`id` < 8 and (`test`.`t1`.`id`) = `test`.`t1`.`id`))) explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where 2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index Warnings: Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not((1,exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))) +Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !(1,exists(select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null)) insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001'); create table t2 (id int not null, text varchar(20) not null default '', primary key (id)); insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10'); @@ -1925,7 +1925,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00 1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition Warnings: -Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(((`test`.`b`.`id` = `test`.`a`.`id`) or isnull(`test`.`b`.`id`))) join `test`.`t1` `c` where (if(isnull(`test`.`b`.`id`),1000,`test`.`b`.`id`) = `test`.`c`.`id`) +Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(`test`.`b`.`id` = `test`.`a`.`id` or `test`.`b`.`id` is null) join `test`.`t1` `c` where if(`test`.`b`.`id` is null,1000,`test`.`b`.`id`) = `test`.`c`.`id` drop table t1,t2; create table t1 (a int); insert into t1 values (1); @@ -2983,20 +2983,20 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(trigcond((((`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)))) and trigcond(trigcond((((`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))))) having (trigcond((`test`.`t2`.`one`)) and trigcond((`test`.`t2`.`two`))))) AS `test` from `test`.`t1` +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond((`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond((`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null))) AS `test` from `test`.`t1` explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 1 PRIMARY eq_ref distinct_key distinct_key 8 func,func 1 100.00 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where (`test`.`t2`.`flag` = 'N') +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`flag` = 'N' explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(trigcond((((`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)))) and trigcond(trigcond((((`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))))) having (trigcond((`test`.`t2`.`one`)) and trigcond((`test`.`t2`.`two`))))) AS `test` from `test`.`t1` +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond((`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond((`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null))) AS `test` from `test`.`t1` DROP TABLE t1,t2; set optimizer_switch=@tmp11867_optimizer_switch; CREATE TABLE t1 (a char(5), b char(5)); @@ -4462,7 +4462,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select 2 AS `2` from `test`.`t1` where exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))) +Note 1003 select 2 AS `2` from `test`.`t1` where exists((select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`)) DROP TABLE t1,t2; create table t0(a int); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); @@ -4543,14 +4543,14 @@ 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 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary Warnings: -Note 1003 select 1 AS `1` from (select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` where (``.`min(a)` = 1) +Note 1003 select 1 AS `1` from (select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` where ``.`min(a)` = 1 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 const distinct_key distinct_key 4 const 1 100.00 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary Warnings: -Note 1003 select 1 AS `1` from (select min(`test`.`t1`.`a`) from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a`) join `test`.`t1` where (``.`min(a)` = 1) +Note 1003 select 1 AS `1` from (select min(`test`.`t1`.`a`) from `test`.`t1` where `test`.`t1`.`a` > 3 group by `test`.`t1`.`a`) join `test`.`t1` where ``.`min(a)` = 1 SET join_cache_level=@save_join_cache_level; DROP TABLE t1; # @@ -7136,6 +7136,17 @@ a DROP TABLE t1; SET SESSION big_tables=0; # +# MDEV-10776: Server crash on query +# +create table t1 (field1 int); +insert into t1 values (1); +select round((select 1 from t1 limit 1)) +from t1 +group by round((select 1 from t1 limit 1)); +round((select 1 from t1 limit 1)) +1 +drop table t1; +# # MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE || # m_lock_type != 2' failed in handler::ha_index_read_map # diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result index 017e9623c76..6b45582eb45 100644 --- a/mysql-test/r/subselect_no_semijoin.result +++ b/mysql-test/r/subselect_no_semijoin.result @@ -59,7 +59,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select 1 AS `1` from dual having ((select 1) = 1) +Note 1003 select 1 AS `1` from dual having (select 1) = 1 SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; 1 1 @@ -200,7 +200,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) from `test`.`t2`))) +Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1)) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where `test`.`t4`.`b` = (select max(`test`.`t2`.`a`) * 4 from `test`.`t2`)) select (select a from t3 where a 1)) `tt` +Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where `test`.`t3`.`a` < 8 order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`a` > 1) `tt` set optimizer_switch=@tmp_optimizer_switch; select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1); a @@ -240,7 +240,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select `test`.`t4`.`b` AS `b`,<`test`.`t4`.`a`>((select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` +Note 1003 select `test`.`t4`.`b` AS `b`,<`test`.`t4`.`a`>((select avg(`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` select * from t3 where exists (select * from t2 where t2.b=t3.a); a 7 @@ -286,7 +286,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select min(`test`.`t2`.`b`) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2); a 7 @@ -330,7 +330,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select <`test`.`t2`.`a`>((select 2 from dual where (2 = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`))) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2` +Note 1003 select <`test`.`t2`.`a`>((select 2 from dual where 2 = `test`.`t2`.`a` union select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2` select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2; ERROR 21000: Subquery returns more than 1 row create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq)); @@ -348,7 +348,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 MATERIALIZED t7 index PRIMARY PRIMARY 4 NULL 2 100.00 Using index Warnings: Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <`test`.`t6`.`clinic_uq`>((`test`.`t6`.`clinic_uq`,`test`.`t6`.`clinic_uq` in ( (select `test`.`t7`.`uq` from `test`.`t7` where 1 ), (`test`.`t6`.`clinic_uq` in on distinct_key where ((`test`.`t6`.`clinic_uq` = ``.`uq`)))))) +Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <`test`.`t6`.`clinic_uq`>((`test`.`t6`.`clinic_uq`,`test`.`t6`.`clinic_uq` in ( (select `test`.`t7`.`uq` from `test`.`t7` where 1 ), (`test`.`t6`.`clinic_uq` in on distinct_key where `test`.`t6`.`clinic_uq` = ``.`uq`)))) select * from t1 where a= (select a from t2,t4 where t2.b=t4.b); ERROR 23000: Column 'a' in field list is ambiguous drop table t1,t2,t3; @@ -409,13 +409,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03') +Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03' EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'); 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 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` +Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03') AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; date 2002-08-03 @@ -562,7 +562,7 @@ EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: -Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1') +Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where `test`.`t1`.`numeropost` = '1' EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index @@ -744,7 +744,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ref id id 5 const 1 100.00 Using index Warnings: Note 1249 Select 2 was reduced during optimization -Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = 1) +Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = 1 SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3); id 1 @@ -757,7 +757,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1249 Select 3 was reduced during optimization Note 1249 Select 2 was reduced during optimization -Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = ((1 + 1))) +Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = (1 + 1) EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index @@ -765,7 +765,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <`test`.`t2`.`id`>((`test`.`t2`.`id`,(select 1 having ((`test`.`t2`.`id`) = (1)) union select 3 having ((`test`.`t2`.`id`) = (3))))) +Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <`test`.`t2`.`id`>((`test`.`t2`.`id`,(select 1 having (`test`.`t2`.`id`) = (1) union select 3 having (`test`.`t2`.`id`) = (3)))) SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3); id SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2); @@ -891,7 +891,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1249 Select 2 was reduced during optimization -Note 1003 select (`test`.`t1`.`a` + 1) AS `(select a+1)` from `test`.`t1` +Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` select (select a+1) from t1; (select a+1) 2.5 @@ -913,7 +913,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index 2 MATERIALIZED t2 index a a 5 NULL 3 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,<`test`.`t1`.`a`>((`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t2`.`a` from `test`.`t2` ), (`test`.`t1`.`a` in on distinct_key where ((`test`.`t1`.`a` = ``.`a`)))))) AS `t1.a in (select t2.a from t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`a` AS `a`,<`test`.`t1`.`a`>((`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t2`.`a` from `test`.`t2` ), (`test`.`t1`.`a` in on distinct_key where `test`.`t1`.`a` = ``.`a`)))) AS `t1.a in (select t2.a from t2)` from `test`.`t1` CREATE TABLE t3 (a int(11) default '0'); INSERT INTO t3 VALUES (1),(2),(3); SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1; @@ -928,7 +928,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 MATERIALIZED t2 index a a 5 NULL 3 100.00 Using index 2 MATERIALIZED t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,<`test`.`t1`.`a`>((`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where (`test`.`t3`.`a` = `test`.`t2`.`a`) ), (`test`.`t1`.`a` in on distinct_key where ((`test`.`t1`.`a` = ``.`a`)))))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1` +Note 1003 select `test`.`t1`.`a` AS `a`,<`test`.`t1`.`a`>((`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a` ), (`test`.`t1`.`a` in on distinct_key where `test`.`t1`.`a` = ``.`a`)))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1` drop table t1,t2,t3; # check correct NULL Processing for normal IN/ALL/ANY # and 2 ways of max/min optimization @@ -1328,7 +1328,7 @@ 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 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)` +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'); SELECT 0 IN (SELECT 1 FROM t1 a); 0 IN (SELECT 1 FROM t1 a) @@ -1338,7 +1338,7 @@ 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 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)` +Note 1003 select (0,(select 1 from `test`.`t1` `a` where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)` drop table t1; CREATE TABLE `t1` ( `i` int(11) NOT NULL default '0', @@ -1383,7 +1383,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: -Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`)) +Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`) drop table t1; CREATE TABLE t1 ( ID int(10) unsigned NOT NULL auto_increment, @@ -1445,7 +1445,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index 2 MATERIALIZED t1 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <`test`.`t2`.`a`>((`test`.`t2`.`a`,`test`.`t2`.`a` in ( (select `test`.`t1`.`a` from `test`.`t1` ), (`test`.`t2`.`a` in on distinct_key where ((`test`.`t2`.`a` = ``.`a`)))))) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <`test`.`t2`.`a`>((`test`.`t2`.`a`,`test`.`t2`.`a` in ( (select `test`.`t1`.`a` from `test`.`t1` ), (`test`.`t2`.`a` in on distinct_key where `test`.`t2`.`a` = ``.`a`)))) select * from t2 where t2.a in (select a from t1 where t1.b <> 30); a 2 @@ -1455,7 +1455,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index 2 MATERIALIZED t1 ALL PRIMARY NULL NULL NULL 4 100.00 Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <`test`.`t2`.`a`>((`test`.`t2`.`a`,`test`.`t2`.`a` in ( (select `test`.`t1`.`a` from `test`.`t1` where (`test`.`t1`.`b` <> 30) ), (`test`.`t2`.`a` in on distinct_key where ((`test`.`t2`.`a` = ``.`a`)))))) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <`test`.`t2`.`a`>((`test`.`t2`.`a`,`test`.`t2`.`a` in ( (select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`b` <> 30 ), (`test`.`t2`.`a` in on distinct_key where `test`.`t2`.`a` = ``.`a`)))) select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); a 2 @@ -1466,7 +1466,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 MATERIALIZED t3 index PRIMARY PRIMARY 4 NULL 3 100.00 Using index 2 MATERIALIZED t1 ALL PRIMARY NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <`test`.`t2`.`a`>((`test`.`t2`.`a`,`test`.`t2`.`a` in ( (select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where (`test`.`t1`.`b` = `test`.`t3`.`a`) ), (`test`.`t2`.`a` in on distinct_key where ((`test`.`t2`.`a` = ``.`a`)))))) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <`test`.`t2`.`a`>((`test`.`t2`.`a`,`test`.`t2`.`a` in ( (select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`a` ), (`test`.`t2`.`a` in on distinct_key where `test`.`t2`.`a` = ``.`a`)))) drop table t1, t2, t3; create table t1 (a int, b int, index a (a,b)); create table t2 (a int, index a (a)); @@ -1498,7 +1498,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index 2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <`test`.`t2`.`a`>((`test`.`t2`.`a`,(((`test`.`t2`.`a`) in t1 on a where ((`test`.`t1`.`b` <> 30) and ((`test`.`t2`.`a`) = `test`.`t1`.`a`)))))) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <`test`.`t2`.`a`>((`test`.`t2`.`a`,(((`test`.`t2`.`a`) in t1 on a where `test`.`t1`.`b` <> 30 and (`test`.`t2`.`a`) = `test`.`t1`.`a`)))) select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); a 2 @@ -1509,7 +1509,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 100.00 Using where; Using index 2 DEPENDENT SUBQUERY t1 ref a a 10 func,test.t3.a 1167 100.00 Using index Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <`test`.`t2`.`a`>((`test`.`t2`.`a`,(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`a`) and ((`test`.`t2`.`a`) = `test`.`t1`.`a`))))) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <`test`.`t2`.`a`>((`test`.`t2`.`a`,(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`a` and (`test`.`t2`.`a`) = `test`.`t1`.`a`))) insert into t1 values (3,31); select * from t2 where t2.a in (select a from t1 where t1.b <> 30); a @@ -1525,7 +1525,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index 2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <`test`.`t2`.`a`>((`test`.`t2`.`a`,(((`test`.`t2`.`a`) in t1 on a where ((`test`.`t1`.`b` <> 30) and ((`test`.`t2`.`a`) = `test`.`t1`.`a`)))))) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <`test`.`t2`.`a`>((`test`.`t2`.`a`,(((`test`.`t2`.`a`) in t1 on a where `test`.`t1`.`b` <> 30 and (`test`.`t2`.`a`) = `test`.`t1`.`a`)))) drop table t0, t1, t2, t3; create table t1 (a int, b int); create table t2 (a int, b int); @@ -1616,25 +1616,25 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 MATERIALIZED t2 index s1 s1 6 NULL 2 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( (select `test`.`t2`.`s1` from `test`.`t2` ), (`test`.`t1`.`s1` in on distinct_key where ((`test`.`t1`.`s1` = ``.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,!<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( (select `test`.`t2`.`s1` from `test`.`t2` ), (`test`.`t1`.`s1` in on distinct_key where `test`.`t1`.`s1` = ``.`s1`)))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 MATERIALIZED t2 index s1 s1 6 NULL 2 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( (select `test`.`t2`.`s1` from `test`.`t2` ), (`test`.`t1`.`s1` in on distinct_key where ((`test`.`t1`.`s1` = ``.`s1`)))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( (select `test`.`t2`.`s1` from `test`.`t2` ), (`test`.`t1`.`s1` in on distinct_key where `test`.`t1`.`s1` = ``.`s1`)))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 MATERIALIZED t2 index s1 s1 6 NULL 2 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( (select `test`.`t2`.`s1` from `test`.`t2` ), (`test`.`t1`.`s1` in on distinct_key where ((`test`.`t1`.`s1` = ``.`s1`)))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,!<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( (select `test`.`t2`.`s1` from `test`.`t2` ), (`test`.`t1`.`s1` in on distinct_key where `test`.`t1`.`s1` = ``.`s1`)))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 MATERIALIZED t2 index s1 s1 6 NULL 2 50.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( (select `test`.`t2`.`s1` from `test`.`t2` where (`test`.`t2`.`s1` < 'a2') ), (`test`.`t1`.`s1` in on distinct_key where ((`test`.`t1`.`s1` = ``.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,!<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( (select `test`.`t2`.`s1` from `test`.`t2` where `test`.`t2`.`s1` < 'a2' ), (`test`.`t1`.`s1` in on distinct_key where `test`.`t1`.`s1` = ``.`s1`)))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` drop table t1,t2; create table t2 (a int, b int not null); create table t3 (a int); @@ -1649,7 +1649,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); a explain extended select * from t3 where a >= some (select b from t2); @@ -1657,7 +1657,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); a 6 @@ -1668,7 +1668,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); a explain extended select * from t3 where a >= some (select b from t2 group by 1); @@ -1676,7 +1676,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); a explain extended select * from t3 where NULL >= any (select b from t2); @@ -1719,7 +1719,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary Warnings: -Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,((select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= (`test`.`t3`.`a`)))) +Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= (`test`.`t3`.`a`))) drop table t2, t3; CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ; INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now()); @@ -1889,14 +1889,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where 2 MATERIALIZED t1 range PRIMARY PRIMARY 4 NULL 7 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where (not(<`test`.`t1`.`id`>((`test`.`t1`.`id`,`test`.`t1`.`id` in ( (select `test`.`t1`.`id` from `test`.`t1` where (`test`.`t1`.`id` < 8) ), (`test`.`t1`.`id` in on distinct_key where ((`test`.`t1`.`id` = ``.`id`)))))))) +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where !<`test`.`t1`.`id`>((`test`.`t1`.`id`,`test`.`t1`.`id` in ( (select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 ), (`test`.`t1`.`id` in on distinct_key where `test`.`t1`.`id` = ``.`id`)))) explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where 2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index Warnings: Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not((1,<`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null)))))) +Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !(1,<`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null))) insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001'); create table t2 (id int not null, text varchar(20) not null default '', primary key (id)); insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10'); @@ -1922,7 +1922,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00 1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition Warnings: -Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(((`test`.`b`.`id` = `test`.`a`.`id`) or isnull(`test`.`b`.`id`))) join `test`.`t1` `c` where (if(isnull(`test`.`b`.`id`),1000,`test`.`b`.`id`) = `test`.`c`.`id`) +Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(`test`.`b`.`id` = `test`.`a`.`id` or `test`.`b`.`id` is null) join `test`.`t1` `c` where if(`test`.`b`.`id` is null,1000,`test`.`b`.`id`) = `test`.`c`.`id` drop table t1,t2; create table t1 (a int); insert into t1 values (1); @@ -2432,7 +2432,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <`test`.`up`.`a`>((`test`.`up`.`a`,`test`.`up`.`a` in ( (select `test`.`t1`.`a` from `test`.`t1` where 1 ), (`test`.`up`.`a` in on distinct_key where ((`test`.`up`.`a` = ``.`a`)))))) +Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <`test`.`up`.`a`>((`test`.`up`.`a`,`test`.`up`.`a` in ( (select `test`.`t1`.`a` from `test`.`t1` where 1 ), (`test`.`up`.`a` in on distinct_key where `test`.`up`.`a` = ``.`a`)))) drop table t1; CREATE TABLE t1 (t1_a int); INSERT INTO t1 VALUES (1); @@ -2979,19 +2979,19 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<`test`.`t1`.`one`,`test`.`t1`.`two`>(((`test`.`t1`.`one`,`test`.`t1`.`two`),(`test`.`t1`.`one`,`test`.`t1`.`two`) in ( (select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where (`test`.`t2`.`flag` = '0') ), (`test`.`t1`.`one` in on distinct_key where ((`test`.`t1`.`one` = ``.`one`) and (`test`.`t1`.`two` = ``.`two`)))))) AS `test` from `test`.`t1` +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<`test`.`t1`.`one`,`test`.`t1`.`two`>(((`test`.`t1`.`one`,`test`.`t1`.`two`),(`test`.`t1`.`one`,`test`.`t1`.`two`) in ( (select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' ), (`test`.`t1`.`one` in on distinct_key where `test`.`t1`.`one` = ``.`one` and `test`.`t1`.`two` = ``.`two`)))) AS `test` from `test`.`t1` explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 Using where 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <`test`.`t1`.`one`,`test`.`t1`.`two`>(((`test`.`t1`.`one`,`test`.`t1`.`two`),(`test`.`t1`.`one`,`test`.`t1`.`two`) in ( (select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where (`test`.`t2`.`flag` = 'N') ), (`test`.`t1`.`one` in on distinct_key where ((`test`.`t1`.`one` = ``.`one`) and (`test`.`t1`.`two` = ``.`two`)))))) +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <`test`.`t1`.`one`,`test`.`t1`.`two`>(((`test`.`t1`.`one`,`test`.`t1`.`two`),(`test`.`t1`.`one`,`test`.`t1`.`two`) in ( (select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = 'N' ), (`test`.`t1`.`one` in on distinct_key where `test`.`t1`.`one` = ``.`one` and `test`.`t1`.`two` = ``.`two`)))) explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<`test`.`t1`.`one`,`test`.`t1`.`two`>(((`test`.`t1`.`one`,`test`.`t1`.`two`),(`test`.`t1`.`one`,`test`.`t1`.`two`) in ( (select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where (`test`.`t2`.`flag` = '0') ), (`test`.`t1`.`one` in on distinct_key where ((`test`.`t1`.`one` = ``.`one`) and (`test`.`t1`.`two` = ``.`two`)))))) AS `test` from `test`.`t1` +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<`test`.`t1`.`one`,`test`.`t1`.`two`>(((`test`.`t1`.`one`,`test`.`t1`.`two`),(`test`.`t1`.`one`,`test`.`t1`.`two`) in ( (select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' ), (`test`.`t1`.`one` in on distinct_key where `test`.`t1`.`one` = ``.`one` and `test`.`t1`.`two` = ``.`two`)))) AS `test` from `test`.`t1` DROP TABLE t1,t2; set optimizer_switch=@tmp11867_optimizer_switch; CREATE TABLE t1 (a char(5), b char(5)); @@ -4442,7 +4442,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select 2 AS `2` from `test`.`t1` where <`test`.`t1`.`a`>((`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t2`.`a` from `test`.`t2` where 1 ), (`test`.`t1`.`a` in on distinct_key where ((`test`.`t1`.`a` = ``.`a`)))))) +Note 1003 select 2 AS `2` from `test`.`t1` where <`test`.`t1`.`a`>((`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t2`.`a` from `test`.`t2` where 1 ), (`test`.`t1`.`a` in on distinct_key where `test`.`t1`.`a` = ``.`a`)))) EXPLAIN EXTENDED SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION (SELECT 1 FROM t2 WHERE t1.a = t2.a)); @@ -4454,7 +4454,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select 2 AS `2` from `test`.`t1` where <`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)))) +Note 1003 select 2 AS `2` from `test`.`t1` where <`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`))) DROP TABLE t1,t2; create table t0(a int); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); @@ -7121,6 +7121,17 @@ a DROP TABLE t1; SET SESSION big_tables=0; # +# MDEV-10776: Server crash on query +# +create table t1 (field1 int); +insert into t1 values (1); +select round((select 1 from t1 limit 1)) +from t1 +group by round((select 1 from t1 limit 1)); +round((select 1 from t1 limit 1)) +1 +drop table t1; +# # MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE || # m_lock_type != 2' failed in handler::ha_index_read_map # diff --git a/mysql-test/r/subselect_partial_match.result b/mysql-test/r/subselect_partial_match.result index 9dc2b44fd30..256295cef28 100644 --- a/mysql-test/r/subselect_partial_match.result +++ b/mysql-test/r/subselect_partial_match.result @@ -775,7 +775,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using where 3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 Warnings: -Note 1003 select `table1`.`a1` AS `a1`,`table1`.`a2` AS `a2` from (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (not((`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( (select `test`.`t2`.`b2` from `test`.`t2` ), (`test`.`t1`.`a1` in on distinct_key where ((`test`.`t1`.`a1` = ``.`b2`)))))))) `table1` +Note 1003 select `table1`.`a1` AS `a1`,`table1`.`a2` AS `a2` from (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where !(`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( (select `test`.`t2`.`b2` from `test`.`t2` ), (`test`.`t1`.`a1` in on distinct_key where `test`.`t1`.`a1` = ``.`b2`)))) `table1` set optimizer_switch=@tmp_optimizer_switch; DROP TABLE t1, t2; # diff --git a/mysql-test/r/subselect_sj.result b/mysql-test/r/subselect_sj.result index fdcfa800d1f..91d05a31dfa 100644 --- a/mysql-test/r/subselect_sj.result +++ b/mysql-test/r/subselect_sj.result @@ -74,7 +74,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t10 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using where 1 PRIMARY t12 eq_ref PRIMARY PRIMARY 4 test.t10.a 1 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t12`.`pk` = `test`.`t10`.`a`) and (`test`.`t10`.`pk` = `test`.`t1`.`a`)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where `test`.`t12`.`pk` = `test`.`t10`.`a` and `test`.`t10`.`pk` = `test`.`t1`.`a` subqueries within outer joins go into ON expr. explAin extended select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); @@ -84,7 +84,7 @@ id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA 1 PRIMARY B ALL NULL NULL NULL NULL 3 100.00 Using where 2 MATERIALIZED t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`A`.`A` = `test`.`t1`.`A`) And (`test`.`B`.`A`,`test`.`B`.`A` in ( (select `test`.`t10`.`pk` from `test`.`t10` ), (`test`.`B`.`A` in on distinct_key where ((`test`.`B`.`A` = ``.`pk`))))))) where 1 +Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on(`test`.`A`.`A` = `test`.`t1`.`A` And (`test`.`B`.`A`,`test`.`B`.`A` in ( (select `test`.`t10`.`pk` from `test`.`t10` ), (`test`.`B`.`A` in on distinct_key where `test`.`B`.`A` = ``.`pk`)))) where 1 t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" explAin extended select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); @@ -93,7 +93,7 @@ id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA 1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where 2 MATERIALIZED t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on(((`test`.`t2`.`A` = `test`.`t1`.`A`) And (`test`.`t1`.`A`,`test`.`t1`.`A` in ( (select `test`.`t10`.`pk` from `test`.`t10` ), (`test`.`t1`.`A` in on distinct_key where ((`test`.`t1`.`A` = ``.`pk`))))))) where 1 +Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`A` = `test`.`t1`.`A` And (`test`.`t1`.`A`,`test`.`t1`.`A` in ( (select `test`.`t10`.`pk` from `test`.`t10` ), (`test`.`t1`.`A` in on distinct_key where `test`.`t1`.`A` = ``.`pk`)))) where 1 set join_buffer_size=8*1024; we shouldn't flatten if we're going to get a join of > MAX_TABLES. explain select * from @@ -207,7 +207,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t10 range PRIMARY PRIMARY 4 NULL 4 100.00 Using where; Using index 1 PRIMARY t1 ALL NULL NULL NULL NULL 103 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t1` where ((`test`.`t1`.`a` = `test`.`t10`.`pk`) and (`test`.`t10`.`pk` < 3)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t10`.`pk` and `test`.`t10`.`pk` < 3 drop table t0, t1, t2; drop table t10, t11, t12; @@ -503,7 +503,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t0.pk 1 100.00 Using where 1 PRIMARY t2 ref vkey vkey 4 test.t1.vnokey 2 100.00 Using index; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t0`.`vkey` AS `vkey` from `test`.`t0` `t1` semi join (`test`.`t0` `t2`) join `test`.`t0` where ((`test`.`t1`.`pk` = `test`.`t0`.`pk`) and (`test`.`t2`.`vkey` = `test`.`t1`.`vnokey`)) +Note 1003 select `test`.`t0`.`vkey` AS `vkey` from `test`.`t0` `t1` semi join (`test`.`t0` `t2`) join `test`.`t0` where `test`.`t1`.`pk` = `test`.`t0`.`pk` and `test`.`t2`.`vkey` = `test`.`t1`.`vnokey` SELECT vkey FROM t0 WHERE pk IN (SELECT t1.pk FROM t0 t1 JOIN t0 t2 ON t2.vkey = t1.vnokey); vkey @@ -767,11 +767,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (<`test`.`t2`.`d`,`test`.`t1`.`b`>((`test`.`t2`.`d`,(select `test`.`t3`.`e` from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and ((`test`.`t2`.`d`) >= `test`.`t3`.`e`))))))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`c` = `test`.`t1`.`a` and (<`test`.`t2`.`d`,`test`.`t1`.`b`>((`test`.`t2`.`d`,(select `test`.`t3`.`e` from `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`e` and (`test`.`t2`.`d`) >= `test`.`t3`.`e`)))) show warnings; Level Code Message Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (<`test`.`t2`.`d`,`test`.`t1`.`b`>((`test`.`t2`.`d`,(select `test`.`t3`.`e` from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and ((`test`.`t2`.`d`) >= `test`.`t3`.`e`))))))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`c` = `test`.`t1`.`a` and (<`test`.`t2`.`d`,`test`.`t1`.`b`>((`test`.`t2`.`d`,(select `test`.`t3`.`e` from `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`e` and (`test`.`t2`.`d`) >= `test`.`t3`.`e`)))) select a from t1 where a in (select c from t2 where d >= some(select e from t3 where b=e)); a @@ -807,7 +807,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 11 func,func 1 100.00 2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (a, b) IN (SELECT a, b FROM t2 WHERE pk > 0); pk 2 @@ -816,7 +816,7 @@ 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 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`c` = `test`.`t1`.`c`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`c` = `test`.`t1`.`c` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, c) IN (SELECT b, c FROM t2 WHERE pk > 0); pk 1 @@ -826,7 +826,7 @@ 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 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`d` = `test`.`t1`.`d`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`d` = `test`.`t1`.`d` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, d) IN (SELECT b, d FROM t2 WHERE pk > 0); pk 2 @@ -835,7 +835,7 @@ 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 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`e` = `test`.`t1`.`e`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`e` = `test`.`t1`.`e` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, e) IN (SELECT b, e FROM t2 WHERE pk > 0); pk 1 @@ -845,7 +845,7 @@ 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 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`f` = `test`.`t1`.`f`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`f` = `test`.`t1`.`f` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, f) IN (SELECT b, f FROM t2 WHERE pk > 0); pk 1 @@ -855,7 +855,7 @@ 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 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`g` = `test`.`t1`.`g`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`g` = `test`.`t1`.`g` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, g) IN (SELECT b, g FROM t2 WHERE pk > 0); pk 1 @@ -865,7 +865,7 @@ 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 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`h` = `test`.`t1`.`h`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`h` = `test`.`t1`.`h` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, h) IN (SELECT b, h FROM t2 WHERE pk > 0); pk 1 @@ -875,7 +875,7 @@ 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 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`i` = `test`.`t1`.`i`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`i` = `test`.`t1`.`i` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, i) IN (SELECT b, i FROM t2 WHERE pk > 0); pk 1 @@ -885,7 +885,7 @@ 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 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`j` = `test`.`t1`.`j`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`j` = `test`.`t1`.`j` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, j) IN (SELECT b, j FROM t2 WHERE pk > 0); pk 1 @@ -895,7 +895,7 @@ 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 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`k` = `test`.`t1`.`k`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`k` = `test`.`t1`.`k` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, k) IN (SELECT b, k FROM t2 WHERE pk > 0); pk 1 @@ -976,7 +976,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) 2 MATERIALIZED t1 ALL varchar_key NULL NULL NULL 15 100.00 Using where Warnings: -Note 1003 select `test`.`t2`.`varchar_nokey` AS `varchar_nokey` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`varchar_nokey` = `test`.`t1`.`varchar_key`) and (`test`.`t2`.`varchar_nokey` = `test`.`t1`.`varchar_key`) and ((`test`.`t1`.`varchar_key` < 'n') xor `test`.`t1`.`pk`)) +Note 1003 select `test`.`t2`.`varchar_nokey` AS `varchar_nokey` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`varchar_nokey` = `test`.`t1`.`varchar_key` and `test`.`t2`.`varchar_nokey` = `test`.`t1`.`varchar_key` and (`test`.`t1`.`varchar_key` < 'n' xor `test`.`t1`.`pk`) SELECT varchar_nokey FROM t2 WHERE ( `varchar_nokey` , `varchar_nokey` ) IN ( @@ -1996,7 +1996,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) 1 PRIMARY t3 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2`,`test`.`t2`.`f3` AS `f3`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` semi join (`test`.`t4`) join `test`.`t2` join `test`.`t3` where ((`test`.`t4`.`f2` = `test`.`t2`.`f3`) and (`test`.`t3`.`f1` = `test`.`t1`.`f1`) and (`test`.`t1`.`f2` = `test`.`t2`.`f2`)) +Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2`,`test`.`t2`.`f3` AS `f3`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` semi join (`test`.`t4`) join `test`.`t2` join `test`.`t3` where `test`.`t4`.`f2` = `test`.`t2`.`f3` and `test`.`t3`.`f1` = `test`.`t1`.`f1` and `test`.`t1`.`f2` = `test`.`t2`.`f2` SELECT * FROM t1 NATURAL LEFT JOIN (t2, t3) WHERE t2.f3 IN (SELECT * FROM t4); f1 f2 f3 f3 2 0 0 0 @@ -2973,7 +2973,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t1.pk 1 100.00 1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Using where; End temporary Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1` AS `c1`,'x' AS `c2` from `test`.`t1` semi join (`test`.`t1` left join `test`.`t3` on((`test`.`t1`.`c1` = `test`.`t3`.`c3`))) where (`test`.`t1`.`pk` = `test`.`t1`.`pk`) order by 'x',`test`.`t1`.`c1` +Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1` AS `c1`,'x' AS `c2` from `test`.`t1` semi join (`test`.`t1` left join `test`.`t3` on(`test`.`t1`.`c1` = `test`.`t3`.`c3`)) where `test`.`t1`.`pk` = `test`.`t1`.`pk` order by 'x',`test`.`t1`.`c1` DROP TABLE t1,t2,t3; # # MDEV-5059: Wrong result (missing row) wih semijoin, join_cache_level > 2, LEFT JOIN, ORDER BY diff --git a/mysql-test/r/subselect_sj2.result b/mysql-test/r/subselect_sj2.result index 98a8907f741..8f37c09efcf 100644 --- a/mysql-test/r/subselect_sj2.result +++ b/mysql-test/r/subselect_sj2.result @@ -456,7 +456,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2) Warnings: Note 1276 Field or reference 'test.t0.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where ((`test`.`t2`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`b` = `test`.`t2`.`b`)) +Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where `test`.`t2`.`a` = `test`.`t0`.`a` and `test`.`t1`.`a` = `test`.`t0`.`a` and `test`.`t1`.`b` = `test`.`t2`.`b` update t1 set a=3, b=11 where a=4; update t2 set b=11 where a=3; select * from t0 where t0.a in diff --git a/mysql-test/r/subselect_sj2_jcl6.result b/mysql-test/r/subselect_sj2_jcl6.result index 1b8c1fc1158..021646a7599 100644 --- a/mysql-test/r/subselect_sj2_jcl6.result +++ b/mysql-test/r/subselect_sj2_jcl6.result @@ -468,7 +468,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2); Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan Warnings: Note 1276 Field or reference 'test.t0.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where ((`test`.`t2`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`b` = `test`.`t2`.`b`)) +Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where `test`.`t2`.`a` = `test`.`t0`.`a` and `test`.`t1`.`a` = `test`.`t0`.`a` and `test`.`t1`.`b` = `test`.`t2`.`b` update t1 set a=3, b=11 where a=4; update t2 set b=11 where a=3; # Not anymore: diff --git a/mysql-test/r/subselect_sj2_mat.result b/mysql-test/r/subselect_sj2_mat.result index ac38e57d60a..46da52fe0eb 100644 --- a/mysql-test/r/subselect_sj2_mat.result +++ b/mysql-test/r/subselect_sj2_mat.result @@ -458,7 +458,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2) Warnings: Note 1276 Field or reference 'test.t0.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where ((`test`.`t2`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`b` = `test`.`t2`.`b`)) +Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where `test`.`t2`.`a` = `test`.`t0`.`a` and `test`.`t1`.`a` = `test`.`t0`.`a` and `test`.`t1`.`b` = `test`.`t2`.`b` update t1 set a=3, b=11 where a=4; update t2 set b=11 where a=3; select * from t0 where t0.a in @@ -1473,7 +1473,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ref idx idx 2 test.t4.a4 1 100.00 Using index; End temporary 1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on((`test`.`t2`.`a2` = `test`.`t4`.`a4`)) where ((`test`.`t4`.`b4` = `test`.`t4`.`a4`) and (`test`.`t1`.`b1` = `test`.`t4`.`a4`)) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(`test`.`t2`.`a2` = `test`.`t4`.`a4`) where `test`.`t4`.`b4` = `test`.`t4`.`a4` and `test`.`t1`.`b1` = `test`.`t4`.`a4` SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 ) WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4); a1 b1 a2 b2 @@ -1492,7 +1492,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 2 MATERIALIZED t4 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(((`test`.`t1`.`b1` = `test`.`t4`.`a4`) and (`test`.`t2`.`a2` = `test`.`t4`.`a4`))) where ((`test`.`t4`.`b4` = `test`.`t4`.`a4`) and (`test`.`t1`.`b1` = `test`.`t4`.`a4`)) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(`test`.`t1`.`b1` = `test`.`t4`.`a4` and `test`.`t2`.`a2` = `test`.`t4`.`a4`) where `test`.`t4`.`b4` = `test`.`t4`.`a4` and `test`.`t1`.`b1` = `test`.`t4`.`a4` SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 ) WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4); a1 b1 a2 b2 @@ -1527,7 +1527,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 10 100.00 Using where; End temporary; Using join buffer (flat, BNL join) 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(((`test`.`t2`.`c2` = `test`.`t1`.`c1`) or (`test`.`t1`.`c1` > 'z'))) where ((`test`.`t4`.`c4` = `test`.`t1`.`c1`) and (`test`.`t3`.`c3` = `test`.`t1`.`c1`)) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(`test`.`t2`.`c2` = `test`.`t1`.`c1` or `test`.`t1`.`c1` > 'z') where `test`.`t4`.`c4` = `test`.`t1`.`c1` and `test`.`t3`.`c3` = `test`.`t1`.`c1` SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z') WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4); a1 c1 c2 @@ -1545,7 +1545,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 MATERIALIZED t4 ALL NULL NULL NULL NULL 2 100.00 2 MATERIALIZED t3 ALL NULL NULL NULL NULL 10 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(((`test`.`t2`.`c2` = `test`.`t1`.`c1`) or (`test`.`t1`.`c1` > 'z'))) where (`test`.`t3`.`c3` = `test`.`t4`.`c4`) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(`test`.`t2`.`c2` = `test`.`t1`.`c1` or `test`.`t1`.`c1` > 'z') where `test`.`t3`.`c3` = `test`.`t4`.`c4` SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z') WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4); a1 c1 c2 @@ -1575,7 +1575,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 2 DEPENDENT SUBQUERY t3 hash_ALL NULL #hash#$hj 5 func 3 100.00 Using where; Using join buffer (flat, BNLH join) Warnings: -Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` where <`test`.`t1`.`i1`>((`test`.`t1`.`i1`,(select `test`.`t3`.`i3` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`i3` = `test`.`t2`.`i2`) and ((`test`.`t1`.`i1`) = `test`.`t3`.`i3`))))) +Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` where <`test`.`t1`.`i1`>((`test`.`t1`.`i1`,(select `test`.`t3`.`i3` from `test`.`t2` join `test`.`t3` where `test`.`t3`.`i3` = `test`.`t2`.`i2` and (`test`.`t1`.`i1`) = `test`.`t3`.`i3`))) SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2); i1 7 @@ -1588,7 +1588,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 Using where 2 MATERIALIZED t3 hash_ALL NULL #hash#$hj 5 test.t2.i2 3 100.00 Using where; Using join buffer (flat, BNLH join) Warnings: -Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` join `test`.`t3`) where ((`test`.`t3`.`i3` = `test`.`t2`.`i2`) and (`test`.`t1`.`i1` = `test`.`t2`.`i2`)) +Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` join `test`.`t3`) where `test`.`t3`.`i3` = `test`.`t2`.`i2` and `test`.`t1`.`i1` = `test`.`t2`.`i2` SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2); i1 7 @@ -1601,7 +1601,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 Using where 2 MATERIALIZED t3 hash_ALL NULL #hash#$hj 5 test.t2.i2 3 100.00 Using where; Using join buffer (flat, BNLH join) Warnings: -Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` join `test`.`t3`) where ((`test`.`t3`.`i3` = `test`.`t2`.`i2`) and (`test`.`t1`.`i1` = `test`.`t2`.`i2`) and (`test`.`t3`.`i3` > 0)) +Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` join `test`.`t3`) where `test`.`t3`.`i3` = `test`.`t2`.`i2` and `test`.`t1`.`i1` = `test`.`t2`.`i2` and `test`.`t3`.`i3` > 0 SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 > 0 AND i3 = i2 OR 1=2); i1 diff --git a/mysql-test/r/subselect_sj_jcl6.result b/mysql-test/r/subselect_sj_jcl6.result index 2886118db30..09d88c9996f 100644 --- a/mysql-test/r/subselect_sj_jcl6.result +++ b/mysql-test/r/subselect_sj_jcl6.result @@ -87,7 +87,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t10 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan 1 PRIMARY t12 eq_ref PRIMARY PRIMARY 4 test.t10.a 1 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t12`.`pk` = `test`.`t10`.`a`) and (`test`.`t10`.`pk` = `test`.`t1`.`a`)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where `test`.`t12`.`pk` = `test`.`t10`.`a` and `test`.`t10`.`pk` = `test`.`t1`.`a` subqueries within outer joins go into ON expr. explAin extended select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); @@ -97,7 +97,7 @@ id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA 1 PRIMARY B ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (incrementAl, BNL join) 2 MATERIALIZED t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`A`.`A` = `test`.`t1`.`A`) And (`test`.`B`.`A`,`test`.`B`.`A` in ( (select `test`.`t10`.`pk` from `test`.`t10` ), (`test`.`B`.`A` in on distinct_key where ((`test`.`B`.`A` = ``.`pk`))))))) where 1 +Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on(`test`.`A`.`A` = `test`.`t1`.`A` And (`test`.`B`.`A`,`test`.`B`.`A` in ( (select `test`.`t10`.`pk` from `test`.`t10` ), (`test`.`B`.`A` in on distinct_key where `test`.`B`.`A` = ``.`pk`)))) where 1 t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" explAin extended select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); @@ -106,7 +106,7 @@ id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA 1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (flAt, BNL join) 2 MATERIALIZED t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on(((`test`.`t2`.`A` = `test`.`t1`.`A`) And (`test`.`t1`.`A`,`test`.`t1`.`A` in ( (select `test`.`t10`.`pk` from `test`.`t10` ), (`test`.`t1`.`A` in on distinct_key where ((`test`.`t1`.`A` = ``.`pk`))))))) where 1 +Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`A` = `test`.`t1`.`A` And (`test`.`t1`.`A`,`test`.`t1`.`A` in ( (select `test`.`t10`.`pk` from `test`.`t10` ), (`test`.`t1`.`A` in on distinct_key where `test`.`t1`.`A` = ``.`pk`)))) where 1 set join_buffer_size=8*1024; we shouldn't flatten if we're going to get a join of > MAX_TABLES. explain select * from @@ -220,7 +220,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t10 range PRIMARY PRIMARY 4 NULL 4 100.00 Using where; Using index 1 PRIMARY t1 ALL NULL NULL NULL NULL 103 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t1` where ((`test`.`t1`.`a` = `test`.`t10`.`pk`) and (`test`.`t10`.`pk` < 3)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t10`.`pk` and `test`.`t10`.`pk` < 3 drop table t0, t1, t2; drop table t10, t11, t12; @@ -516,7 +516,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t0.pk 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan 1 PRIMARY t2 ref vkey vkey 4 test.t1.vnokey 2 100.00 Using index; FirstMatch(t1) Warnings: -Note 1003 select `test`.`t0`.`vkey` AS `vkey` from `test`.`t0` `t1` semi join (`test`.`t0` `t2`) join `test`.`t0` where ((`test`.`t1`.`pk` = `test`.`t0`.`pk`) and (`test`.`t2`.`vkey` = `test`.`t1`.`vnokey`)) +Note 1003 select `test`.`t0`.`vkey` AS `vkey` from `test`.`t0` `t1` semi join (`test`.`t0` `t2`) join `test`.`t0` where `test`.`t1`.`pk` = `test`.`t0`.`pk` and `test`.`t2`.`vkey` = `test`.`t1`.`vnokey` SELECT vkey FROM t0 WHERE pk IN (SELECT t1.pk FROM t0 t1 JOIN t0 t2 ON t2.vkey = t1.vnokey); vkey @@ -780,11 +780,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (<`test`.`t2`.`d`,`test`.`t1`.`b`>((`test`.`t2`.`d`,(select `test`.`t3`.`e` from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and ((`test`.`t2`.`d`) >= `test`.`t3`.`e`))))))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`c` = `test`.`t1`.`a` and (<`test`.`t2`.`d`,`test`.`t1`.`b`>((`test`.`t2`.`d`,(select `test`.`t3`.`e` from `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`e` and (`test`.`t2`.`d`) >= `test`.`t3`.`e`)))) show warnings; Level Code Message Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (<`test`.`t2`.`d`,`test`.`t1`.`b`>((`test`.`t2`.`d`,(select `test`.`t3`.`e` from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and ((`test`.`t2`.`d`) >= `test`.`t3`.`e`))))))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`c` = `test`.`t1`.`a` and (<`test`.`t2`.`d`,`test`.`t1`.`b`>((`test`.`t2`.`d`,(select `test`.`t3`.`e` from `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`e` and (`test`.`t2`.`d`) >= `test`.`t3`.`e`)))) select a from t1 where a in (select c from t2 where d >= some(select e from t3 where b=e)); a @@ -820,7 +820,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 11 func,func 1 100.00 2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (a, b) IN (SELECT a, b FROM t2 WHERE pk > 0); pk 2 @@ -829,7 +829,7 @@ 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 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`c` = `test`.`t1`.`c`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`c` = `test`.`t1`.`c` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, c) IN (SELECT b, c FROM t2 WHERE pk > 0); pk 1 @@ -839,7 +839,7 @@ 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 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`d` = `test`.`t1`.`d`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`d` = `test`.`t1`.`d` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, d) IN (SELECT b, d FROM t2 WHERE pk > 0); pk 2 @@ -848,7 +848,7 @@ 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 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`e` = `test`.`t1`.`e`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`e` = `test`.`t1`.`e` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, e) IN (SELECT b, e FROM t2 WHERE pk > 0); pk 1 @@ -858,7 +858,7 @@ 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 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`f` = `test`.`t1`.`f`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`f` = `test`.`t1`.`f` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, f) IN (SELECT b, f FROM t2 WHERE pk > 0); pk 1 @@ -868,7 +868,7 @@ 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 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`g` = `test`.`t1`.`g`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`g` = `test`.`t1`.`g` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, g) IN (SELECT b, g FROM t2 WHERE pk > 0); pk 1 @@ -878,7 +878,7 @@ 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 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`h` = `test`.`t1`.`h`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`h` = `test`.`t1`.`h` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, h) IN (SELECT b, h FROM t2 WHERE pk > 0); pk 1 @@ -888,7 +888,7 @@ 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 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`i` = `test`.`t1`.`i`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`i` = `test`.`t1`.`i` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, i) IN (SELECT b, i FROM t2 WHERE pk > 0); pk 1 @@ -898,7 +898,7 @@ 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 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`j` = `test`.`t1`.`j`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`j` = `test`.`t1`.`j` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, j) IN (SELECT b, j FROM t2 WHERE pk > 0); pk 1 @@ -908,7 +908,7 @@ 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 1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`k` = `test`.`t1`.`k`) and (`test`.`t2`.`pk` > 0)) +Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`k` = `test`.`t1`.`k` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, k) IN (SELECT b, k FROM t2 WHERE pk > 0); pk 1 @@ -989,7 +989,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) 2 MATERIALIZED t1 ALL varchar_key NULL NULL NULL 15 100.00 Using where Warnings: -Note 1003 select `test`.`t2`.`varchar_nokey` AS `varchar_nokey` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`varchar_nokey` = `test`.`t1`.`varchar_key`) and (`test`.`t2`.`varchar_nokey` = `test`.`t1`.`varchar_key`) and ((`test`.`t1`.`varchar_key` < 'n') xor `test`.`t1`.`pk`)) +Note 1003 select `test`.`t2`.`varchar_nokey` AS `varchar_nokey` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`varchar_nokey` = `test`.`t1`.`varchar_key` and `test`.`t2`.`varchar_nokey` = `test`.`t1`.`varchar_key` and (`test`.`t1`.`varchar_key` < 'n' xor `test`.`t1`.`pk`) SELECT varchar_nokey FROM t2 WHERE ( `varchar_nokey` , `varchar_nokey` ) IN ( @@ -2010,7 +2010,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (incremental, BNL join) 2 MATERIALIZED t4 index f2 f2 5 NULL 2 100.00 Using index Warnings: -Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2`,`test`.`t2`.`f3` AS `f3`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` semi join (`test`.`t4`) join `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`f1` = `test`.`t1`.`f1`) and (`test`.`t1`.`f2` = `test`.`t2`.`f2`)) +Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2`,`test`.`t2`.`f3` AS `f3`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` semi join (`test`.`t4`) join `test`.`t2` join `test`.`t3` where `test`.`t3`.`f1` = `test`.`t1`.`f1` and `test`.`t1`.`f2` = `test`.`t2`.`f2` SELECT * FROM t1 NATURAL LEFT JOIN (t2, t3) WHERE t2.f3 IN (SELECT * FROM t4); f1 f2 f3 f3 2 0 0 0 @@ -2987,7 +2987,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t1.pk 1 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan 1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Using where; End temporary; Using join buffer (incremental, BNL join) Warnings: -Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1` AS `c1`,'x' AS `c2` from `test`.`t1` semi join (`test`.`t1` left join `test`.`t3` on((`test`.`t1`.`c1` = `test`.`t3`.`c3`))) where (`test`.`t1`.`pk` = `test`.`t1`.`pk`) order by 'x',`test`.`t1`.`c1` +Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1` AS `c1`,'x' AS `c2` from `test`.`t1` semi join (`test`.`t1` left join `test`.`t3` on(`test`.`t1`.`c1` = `test`.`t3`.`c3`)) where `test`.`t1`.`pk` = `test`.`t1`.`pk` order by 'x',`test`.`t1`.`c1` DROP TABLE t1,t2,t3; # # MDEV-5059: Wrong result (missing row) wih semijoin, join_cache_level > 2, LEFT JOIN, ORDER BY diff --git a/mysql-test/r/subselect_sj_mat.result b/mysql-test/r/subselect_sj_mat.result index 9aa223b83f2..fa74cc36612 100644 --- a/mysql-test/r/subselect_sj_mat.result +++ b/mysql-test/r/subselect_sj_mat.result @@ -50,7 +50,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 8 func 1 100.00 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b1` > '0')) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b1` > '0' select * from t1 where a1 in (select b1 from t2 where b1 > '0'); a1 a2 1 - 01 2 - 01 @@ -62,7 +62,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 8 func 1 100.00 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b1` > '0')) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b1` > '0' select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1); a1 a2 1 - 01 2 - 01 @@ -74,7 +74,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 16 func,func 1 100.00 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b1` > '0')) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b1` > '0' select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2); a1 a2 1 - 01 2 - 01 @@ -86,7 +86,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from (select `test`.`t2`.`b1`,min(`test`.`t2`.`b2`) from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1`) join `test`.`t1` where ((``.`b1` = `test`.`t1`.`a1`) and (``.`min(b2)` = `test`.`t1`.`a2`)) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from (select `test`.`t2`.`b1`,min(`test`.`t2`.`b2`) from `test`.`t2` where `test`.`t2`.`b1` > '0' group by `test`.`t2`.`b1`) join `test`.`t1` where ``.`b1` = `test`.`t1`.`a1` and ``.`min(b2)` = `test`.`t1`.`a2` select * from t1 where (a1, a2) in (select b1, min(b2) from t2 where b1 > '0' group by b1); a1 a2 1 - 01 2 - 01 @@ -97,7 +97,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2i index it2i1,it2i3 it2i1 # NULL 5 50.00 Using where; Using index; LooseScan 1 PRIMARY t1i ref _it1_idx _it1_idx # _ref_ 1 100.00 Warnings: -Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) where ((`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` > '0')) +Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) where `test`.`t1i`.`a1` = `test`.`t2i`.`b1` and `test`.`t2i`.`b1` > '0' select * from t1i where a1 in (select b1 from t2i where b1 > '0'); a1 a2 1 - 01 2 - 01 @@ -109,7 +109,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key # 8 # 1 100.00 # 2 MATERIALIZED t2i range it2i1,it2i3 # 9 # 5 100.00 # Warnings: -Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from (select max(`test`.`t2i`.`b1`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1i` where (``.`max(b1)` = `test`.`t1i`.`a1`) +Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from (select max(`test`.`t2i`.`b1`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1`) join `test`.`t1i` where ``.`max(b1)` = `test`.`t1i`.`a1` select * from t1i where a1 in (select max(b1) from t2i where b1 > '0' group by b1); a1 a2 1 - 01 2 - 01 @@ -120,7 +120,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2i index it2i1,it2i2,it2i3 it2i3 # NULL 5 50.00 Using where; Using index; LooseScan 1 PRIMARY t1i ref _it1_idx _it1_idx # _ref_ 1 100.00 Warnings: -Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) where ((`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t1i`.`a2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b1` > '0')) +Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) where `test`.`t1i`.`a1` = `test`.`t2i`.`b1` and `test`.`t1i`.`a2` = `test`.`t2i`.`b2` and `test`.`t2i`.`b1` > '0' select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0'); a1 a2 1 - 01 2 - 01 @@ -132,7 +132,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key # # # 1 100.00 # 2 MATERIALIZED t2i range it2i1,it2i3 # # # 3 100.00 # Warnings: -Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1i` where ((``.`b1` = `test`.`t1i`.`a1`) and (``.`max(b2)` = `test`.`t1i`.`a2`)) +Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1`) join `test`.`t1i` where ``.`b1` = `test`.`t1i`.`a1` and ``.`max(b2)` = `test`.`t1i`.`a2` select * from t1i where (a1, a2) in (select b1, max(b2) from t2i where b1 > '0' group by b1); a1 a2 1 - 01 2 - 01 @@ -144,7 +144,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key # # # 1 100.00 # 2 MATERIALIZED t2i range it2i1,it2i3 # # # 3 100.00 # Warnings: -Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1i` where ((``.`b1` = `test`.`t1i`.`a1`) and (``.`min(b2)` = `test`.`t1i`.`a2`)) +Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1`) join `test`.`t1i` where ``.`b1` = `test`.`t1i`.`a1` and ``.`min(b2)` = `test`.`t1i`.`a2` select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1); a1 a2 1 - 01 2 - 01 @@ -156,7 +156,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00 2 MATERIALIZED t2i range NULL it2i3 9 NULL 3 100.00 Using index for group-by Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` group by `test`.`t2i`.`b1`) join `test`.`t1` where ((``.`b1` = `test`.`t1`.`a1`) and (``.`max(b2)` = `test`.`t1`.`a2`)) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` group by `test`.`t2i`.`b1`) join `test`.`t1` where ``.`b1` = `test`.`t1`.`a1` and ``.`max(b2)` = `test`.`t1`.`a2` select * from t1 where (a1, a2) in (select b1, max(b2) from t2i group by b1); a1 a2 1 - 01 2 - 01 @@ -188,7 +188,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00 2 MATERIALIZED t2i range it2i1,it2i3 it2i3 18 NULL 3 100.00 Using where; Using index for group-by Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1` where ((``.`b1` = `test`.`t1`.`a1`) and (``.`min(b2)` = `test`.`t1`.`a2`)) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1`) join `test`.`t1` where ``.`b1` = `test`.`t1`.`a1` and ``.`min(b2)` = `test`.`t1`.`a2` select * from t1 where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1); a1 a2 1 - 01 2 - 01 @@ -236,7 +236,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` order by `test`.`t2`.`b1`,`test`.`t2`.`b2`) join `test`.`t1` where ((``.`b1` = `test`.`t1`.`a1`) and (``.`b2` = `test`.`t1`.`a2`)) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` order by `test`.`t2`.`b1`,`test`.`t2`.`b2`) join `test`.`t1` where ``.`b1` = `test`.`t1`.`a1` and ``.`b2` = `test`.`t1`.`a2` select * from t1 where (a1, a2) in (select b1, b2 from t2 order by b1, b2); a1 a2 1 - 01 2 - 01 @@ -248,7 +248,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 16 test.t1i.a1,test.t1i.a2 1 100.00 2 MATERIALIZED t2i index NULL it2i3 18 NULL 5 100.00 Using index Warnings: -Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` order by `test`.`t2i`.`b1`,`test`.`t2i`.`b2`) join `test`.`t1i` where ((``.`b1` = `test`.`t1i`.`a1`) and (``.`b2` = `test`.`t1i`.`a2`)) +Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` order by `test`.`t2i`.`b1`,`test`.`t2i`.`b2`) join `test`.`t1i` where ``.`b1` = `test`.`t1i`.`a1` and ``.`b2` = `test`.`t1i`.`a2` select * from t1i where (a1, a2) in (select b1, b2 from t2i order by b1, b2); a1 a2 1 - 01 2 - 01 @@ -305,7 +305,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 MATERIALIZED t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 80.00 Using where; Using index; Using join buffer (flat, BNL join) 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (`test`.`t2`.`b1` > '0') and (`test`.`t3`.`c2` > '0')) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where `test`.`t2i`.`b1` = `test`.`t3`.`c1` and `test`.`t2i`.`b2` = `test`.`t3`.`c2` and `test`.`t2`.`b1` > '0' and `test`.`t3`.`c2` > '0' select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0') and (a1, a2) in (select c1, c2 from t3 @@ -324,7 +324,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3i ref it3i1,it3i2,it3i3 # # # 1 100.00 # 1 PRIMARY t2i ref it2i1,it2i2,it2i3 # # # 2 100.00 # Warnings: -Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where ((`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t3i`.`c1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` = `test`.`t2i`.`b1`) and (`test`.`t1i`.`a2` = `test`.`t2i`.`b2`) and (`test`.`t3i`.`c2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b1` > '0') and (`test`.`t2i`.`b2` > '0')) +Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where `test`.`t1i`.`a1` = `test`.`t2i`.`b1` and `test`.`t3i`.`c1` = `test`.`t2i`.`b1` and `test`.`t2i`.`b1` = `test`.`t2i`.`b1` and `test`.`t1i`.`a2` = `test`.`t2i`.`b2` and `test`.`t3i`.`c2` = `test`.`t2i`.`b2` and `test`.`t2i`.`b2` = `test`.`t2i`.`b2` and `test`.`t2i`.`b1` > '0' and `test`.`t2i`.`b2` > '0' select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and (a1, a2) in (select c1, c2 from t3i @@ -349,7 +349,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where 3 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (<`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), (`test`.`t2`.`b2` in on distinct_key where ((`test`.`t2`.`b2` = ``.`c2`)))))) or <`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), (`test`.`t2`.`b2` in on distinct_key where ((`test`.`t2`.`b2` = ``.`c2`))))))) and (`test`.`t3`.`c2` > '0')) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where `test`.`t2i`.`b1` = `test`.`t3`.`c1` and `test`.`t2i`.`b2` = `test`.`t3`.`c2` and (<`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%02' ), (`test`.`t2`.`b2` in on distinct_key where `test`.`t2`.`b2` = ``.`c2`)))) or <`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%03' ), (`test`.`t2`.`b2` in on distinct_key where `test`.`t2`.`b2` = ``.`c2`))))) and `test`.`t3`.`c2` > '0' select * from t1 where (a1, a2) in (select b1, b2 from t2 where b2 in (select c2 from t3 where c2 LIKE '%02') or @@ -375,7 +375,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t3a ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3` `t3c`) where ((`test`.`t2i`.`b1` = `test`.`t3c`.`c1`) and (`test`.`t2`.`b1` = `test`.`t1`.`a1`) and (`test`.`t2i`.`b2` = `test`.`t3c`.`c2`) and (`test`.`t2`.`b2` = `test`.`t1`.`a2`) and (<`test`.`t2`.`b2`,`test`.`t1`.`a1`>((`test`.`t2`.`b2`,(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and ((`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))))) or <`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), (`test`.`t2`.`b2` in on distinct_key where ((`test`.`t2`.`b2` = ``.`c2`))))))) and (`test`.`t3c`.`c2` > '0')) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3` `t3c`) where `test`.`t2i`.`b1` = `test`.`t3c`.`c1` and `test`.`t2`.`b1` = `test`.`t1`.`a1` and `test`.`t2i`.`b2` = `test`.`t3c`.`c2` and `test`.`t2`.`b2` = `test`.`t1`.`a2` and (<`test`.`t2`.`b2`,`test`.`t1`.`a1`>((`test`.`t2`.`b2`,(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where `test`.`t3a`.`c1` = `test`.`t1`.`a1` and (`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))) or <`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where `test`.`t3b`.`c2` like '%03' ), (`test`.`t2`.`b2` in on distinct_key where `test`.`t2`.`b2` = ``.`c2`))))) and `test`.`t3c`.`c2` > '0' select * from t1 where (a1, a2) in (select b1, b2 from t2 where b2 in (select c2 from t3 t3a where c1 = a1) or @@ -413,7 +413,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 7 UNION t2i ref it2i1,it2i2,it2i3 # # # 2 100.00 # NULL UNION RESULT ALL NULL # # # NULL NULL # Warnings: -Note 1003 (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (<`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), (`test`.`t2`.`b2` in on distinct_key where ((`test`.`t2`.`b2` = ``.`c2`)))))) or <`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), (`test`.`t2`.`b2` in on distinct_key where ((`test`.`t2`.`b2` = ``.`c2`))))))) and (`test`.`t3`.`c2` > '0'))) union (select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where ((`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t3i`.`c1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` = `test`.`t2i`.`b1`) and (`test`.`t1i`.`a2` = `test`.`t2i`.`b2`) and (`test`.`t3i`.`c2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b1` > '0') and (`test`.`t2i`.`b2` > '0'))) +Note 1003 (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where `test`.`t2i`.`b1` = `test`.`t3`.`c1` and `test`.`t2i`.`b2` = `test`.`t3`.`c2` and (<`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%02' ), (`test`.`t2`.`b2` in on distinct_key where `test`.`t2`.`b2` = ``.`c2`)))) or <`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%03' ), (`test`.`t2`.`b2` in on distinct_key where `test`.`t2`.`b2` = ``.`c2`))))) and `test`.`t3`.`c2` > '0') union (select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where `test`.`t1i`.`a1` = `test`.`t2i`.`b1` and `test`.`t3i`.`c1` = `test`.`t2i`.`b1` and `test`.`t2i`.`b1` = `test`.`t2i`.`b1` and `test`.`t1i`.`a2` = `test`.`t2i`.`b2` and `test`.`t3i`.`c2` = `test`.`t2i`.`b2` and `test`.`t2i`.`b2` = `test`.`t2i`.`b2` and `test`.`t2i`.`b1` > '0' and `test`.`t2i`.`b2` > '0') (select * from t1 where (a1, a2) in (select b1, b2 from t2 where b2 in (select c2 from t3 where c2 LIKE '%02') or @@ -443,7 +443,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and ((`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and ((`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and ((`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and ((`test`.`t1`.`a2`) = `test`.`t2`.`b2`))))) and (`test`.`t3`.`c2` > '0')) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2i` join `test`.`t3`) where `test`.`t2i`.`b1` = `test`.`t3`.`c1` and `test`.`t2i`.`b2` = `test`.`t3`.`c2` and <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where `test`.`t1`.`a1` > '0' and (`test`.`t1`.`a1`) = `test`.`t1`.`a1` and (`test`.`t1`.`a2`) = `test`.`t1`.`a2` union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where `test`.`t2`.`b1` < '9' and (`test`.`t1`.`a1`) = `test`.`t2`.`b1` and (`test`.`t1`.`a2`) = `test`.`t2`.`b2`))) and `test`.`t3`.`c2` > '0' select * from t1 where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where b1 < '9') and (a1, a2) in (select c1, c2 from t3 @@ -467,7 +467,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t2i` join `test`.`t3`) join `test`.`t3` where ((`test`.`t3`.`c1` = `test`.`t1`.`a1`) and (`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and ((`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and ((`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and ((`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and ((`test`.`t1`.`a2`) = `test`.`t2`.`b2`))))) and (`test`.`t3`.`c2` > '0')) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t2i` join `test`.`t3`) join `test`.`t3` where `test`.`t3`.`c1` = `test`.`t1`.`a1` and `test`.`t2i`.`b1` = `test`.`t3`.`c1` and `test`.`t2i`.`b2` = `test`.`t3`.`c2` and <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where `test`.`t1`.`a1` > '0' and (`test`.`t1`.`a1`) = `test`.`t1`.`a1` and (`test`.`t1`.`a2`) = `test`.`t1`.`a2` union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where `test`.`t2`.`b1` < '9' and (`test`.`t1`.`a1`) = `test`.`t2`.`b1` and (`test`.`t1`.`a2`) = `test`.`t2`.`b2`))) and `test`.`t3`.`c2` > '0' select * from t1, t3 where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where b1 < '9') and (c1, c2) in (select c1, c2 from t3 @@ -489,7 +489,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <`test`.`t3`.`c1`>((`test`.`t3`.`c1`,(select `test`.`t1`.`a1` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and ((`test`.`t3`.`c1`) = `test`.`t1`.`a1`)) union select `test`.`t2`.`b1` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and ((`test`.`t3`.`c1`) = `test`.`t2`.`b1`))))) +Note 1003 select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <`test`.`t3`.`c1`>((`test`.`t3`.`c1`,(select `test`.`t1`.`a1` from `test`.`t1` where `test`.`t1`.`a1` > '0' and (`test`.`t3`.`c1`) = `test`.`t1`.`a1` union select `test`.`t2`.`b1` from `test`.`t2` where `test`.`t2`.`b1` < '9' and (`test`.`t3`.`c1`) = `test`.`t2`.`b1`))) select * from t3 where c1 in (select a1 from t1 where a1 > '0' UNION select b1 from t2 where b1 < '9'); c1 c2 @@ -513,14 +513,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a2' of SELECT #6 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3` `t3c`) where ((`test`.`t2i`.`b1` = `test`.`t1`.`a1`) and (`test`.`t3c`.`c1` = `test`.`t1`.`a1`) and (`test`.`t2`.`b1` = `test`.`t1`.`a1`) and (`test`.`t2i`.`b2` = `test`.`t1`.`a2`) and (`test`.`t3c`.`c2` = `test`.`t1`.`a2`) and (`test`.`t2`.`b2` = `test`.`t1`.`a2`) and (<`test`.`t2`.`b2`,`test`.`t1`.`a1`>((`test`.`t2`.`b2`,(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and ((`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))))) or <`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), (`test`.`t2`.`b2` in on distinct_key where ((`test`.`t2`.`b2` = ``.`c2`)))))))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3` `t3c`) where `test`.`t2i`.`b1` = `test`.`t1`.`a1` and `test`.`t3c`.`c1` = `test`.`t1`.`a1` and `test`.`t2`.`b1` = `test`.`t1`.`a1` and `test`.`t2i`.`b2` = `test`.`t1`.`a2` and `test`.`t3c`.`c2` = `test`.`t1`.`a2` and `test`.`t2`.`b2` = `test`.`t1`.`a2` and (<`test`.`t2`.`b2`,`test`.`t1`.`a1`>((`test`.`t2`.`b2`,(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where `test`.`t3a`.`c1` = `test`.`t1`.`a1` and (`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))) or <`test`.`t2`.`b2`>((`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where `test`.`t3b`.`c2` like '%03' ), (`test`.`t2`.`b2` in on distinct_key where `test`.`t2`.`b2` = ``.`c2`))))) explain extended select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(select '1 - 01','2 - 01' having ((((`test`.`t1`.`a1`) = '1 - 01') or isnull('1 - 01')) and (((`test`.`t1`.`a2`) = '2 - 01') or isnull('2 - 01')) and ('1 - 01') and ('2 - 01'))))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(select '1 - 01','2 - 01' having ((`test`.`t1`.`a1`) = '1 - 01' or '1 - 01' is null) and ((`test`.`t1`.`a2`) = '2 - 01' or '2 - 01' is null) and '1 - 01' is null and '2 - 01' is null))) select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01'); a1 a2 1 - 01 2 - 01 @@ -530,7 +530,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(select '1 - 01','2 - 01' having ((((`test`.`t1`.`a1`) = '1 - 01') or isnull('1 - 01')) and (((`test`.`t1`.`a2`) = '2 - 01') or isnull('2 - 01')) and ('1 - 01') and ('2 - 01'))))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(select '1 - 01','2 - 01' having ((`test`.`t1`.`a1`) = '1 - 01' or '1 - 01' is null) and ((`test`.`t1`.`a2`) = '2 - 01' or '2 - 01' is null) and '1 - 01' is null and '2 - 01' is null))) select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01' from dual); a1 a2 1 - 01 2 - 01 @@ -562,7 +562,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using temporary; Using filesort 2 DEPENDENT SUBQUERY columns unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where; Full scan on NULL key Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` group by <`test`.`t1`.`a1`>((`test`.`t1`.`a1`,(((`test`.`t1`.`a1`) in columns on PRIMARY where trigcond(((`test`.`t1`.`a1`) = `test`.`columns`.`col`)))))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` group by <`test`.`t1`.`a1`>((`test`.`t1`.`a1`,(((`test`.`t1`.`a1`) in columns on PRIMARY where trigcond((`test`.`t1`.`a1`) = `test`.`columns`.`col`))))) select * from t1 group by (a1 in (select col from columns)); a1 a2 1 - 00 2 - 00 @@ -623,7 +623,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: -Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` semi join (`test`.`t2_16`) where ((`test`.`t2_16`.`b1` = `test`.`t1_16`.`a1`) and (`test`.`t1_16`.`a1` > '0')) +Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` semi join (`test`.`t2_16`) where `test`.`t2_16`.`b1` = `test`.`t1_16`.`a1` and `test`.`t1_16`.`a1` > '0' select left(a1,7), left(a2,7) from t1_16 where a1 in (select b1 from t2_16 where b1 > '0'); @@ -637,7 +637,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: -Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` semi join (`test`.`t2_16`) where ((`test`.`t2_16`.`b1` = `test`.`t1_16`.`a1`) and (`test`.`t2_16`.`b2` = `test`.`t1_16`.`a2`) and (`test`.`t1_16`.`a1` > '0')) +Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` semi join (`test`.`t2_16`) where `test`.`t2_16`.`b1` = `test`.`t1_16`.`a1` and `test`.`t2_16`.`b2` = `test`.`t1_16`.`a2` and `test`.`t1_16`.`a1` > '0' select left(a1,7), left(a2,7) from t1_16 where (a1,a2) in (select b1, b2 from t2_16 where b1 > '0'); @@ -652,7 +652,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 19 func 1 100.00 Using where 2 MATERIALIZED t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` semi join (`test`.`t2_16`) where ((`test`.`t2_16`.`b1` > '0') and (`test`.`t1_16`.`a1` = substr(`test`.`t2_16`.`b1`,1,16))) +Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` semi join (`test`.`t2_16`) where `test`.`t2_16`.`b1` > '0' and `test`.`t1_16`.`a1` = substr(`test`.`t2_16`.`b1`,1,16) select left(a1,7), left(a2,7) from t1_16 where a1 in (select substring(b1,1,16) from t2_16 where b1 > '0'); @@ -666,7 +666,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where 2 DEPENDENT SUBQUERY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: -Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <`test`.`t1_16`.`a1`>((`test`.`t1_16`.`a1`,(select group_concat(`test`.`t2_16`.`b1` separator ',') from `test`.`t2_16` group by `test`.`t2_16`.`b2` having ((`test`.`t1_16`.`a1`) = (group_concat(`test`.`t2_16`.`b1` separator ',')))))) +Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <`test`.`t1_16`.`a1`>((`test`.`t1_16`.`a1`,(select group_concat(`test`.`t2_16`.`b1` separator ',') from `test`.`t2_16` group by `test`.`t2_16`.`b2` having (`test`.`t1_16`.`a1`) = (group_concat(`test`.`t2_16`.`b1` separator ','))))) select left(a1,7), left(a2,7) from t1_16 where a1 in (select group_concat(b1) from t2_16 group by b2); @@ -682,7 +682,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 260 test.t1_16.a1 1 100.00 Using where 2 MATERIALIZED t2_16 ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: -Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from (select group_concat(`test`.`t2_16`.`b1` separator ',') from `test`.`t2_16` group by `test`.`t2_16`.`b2`) join `test`.`t1_16` where (`test`.`t1_16`.`a1` = ``.`group_concat(b1)`) +Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from (select group_concat(`test`.`t2_16`.`b1` separator ',') from `test`.`t2_16` group by `test`.`t2_16`.`b2`) join `test`.`t1_16` where `test`.`t1_16`.`a1` = ``.`group_concat(b1)` select left(a1,7), left(a2,7) from t1_16 where a1 in (select group_concat(b1) from t2_16 group by b2); @@ -704,7 +704,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) 1 PRIMARY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; End temporary; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t2_16` join `test`.`t2` join `test`.`t1_16`) where ((`test`.`t2`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2_16`.`b1` = `test`.`t1_16`.`a1`) and (`test`.`t2_16`.`b2` = `test`.`t1_16`.`a2`) and (`test`.`t2`.`b2` = substr(`test`.`t1_16`.`a2`,1,6)) and (`test`.`t3`.`c2` > '0') and (concat(`test`.`t1`.`a1`,'x') = left(`test`.`t1_16`.`a1`,8))) +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t2_16` join `test`.`t2` join `test`.`t1_16`) where `test`.`t2`.`b1` = `test`.`t3`.`c1` and `test`.`t2_16`.`b1` = `test`.`t1_16`.`a1` and `test`.`t2_16`.`b2` = `test`.`t1_16`.`a2` and `test`.`t2`.`b2` = substr(`test`.`t1_16`.`a2`,1,6) and `test`.`t3`.`c2` > '0' and concat(`test`.`t1`.`a1`,'x') = left(`test`.`t1_16`.`a1`,8) drop table t1_16, t2_16, t3_16; set @blob_len = 512; set @suffix_len = @blob_len - @prefix_len; @@ -738,7 +738,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: -Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` semi join (`test`.`t2_512`) where ((`test`.`t2_512`.`b1` = `test`.`t1_512`.`a1`) and (`test`.`t1_512`.`a1` > '0')) +Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` semi join (`test`.`t2_512`) where `test`.`t2_512`.`b1` = `test`.`t1_512`.`a1` and `test`.`t1_512`.`a1` > '0' select left(a1,7), left(a2,7) from t1_512 where a1 in (select b1 from t2_512 where b1 > '0'); @@ -752,7 +752,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: -Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` semi join (`test`.`t2_512`) where ((`test`.`t2_512`.`b1` = `test`.`t1_512`.`a1`) and (`test`.`t2_512`.`b2` = `test`.`t1_512`.`a2`) and (`test`.`t1_512`.`a1` > '0')) +Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` semi join (`test`.`t2_512`) where `test`.`t2_512`.`b1` = `test`.`t1_512`.`a1` and `test`.`t2_512`.`b2` = `test`.`t1_512`.`a2` and `test`.`t1_512`.`a1` > '0' select left(a1,7), left(a2,7) from t1_512 where (a1,a2) in (select b1, b2 from t2_512 where b1 > '0'); @@ -767,7 +767,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 516 func 1 100.00 Using where 2 MATERIALIZED t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` semi join (`test`.`t2_512`) where ((`test`.`t2_512`.`b1` > '0') and (`test`.`t1_512`.`a1` = substr(`test`.`t2_512`.`b1`,1,512))) +Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` semi join (`test`.`t2_512`) where `test`.`t2_512`.`b1` > '0' and `test`.`t1_512`.`a1` = substr(`test`.`t2_512`.`b1`,1,512) select left(a1,7), left(a2,7) from t1_512 where a1 in (select substring(b1,1,512) from t2_512 where b1 > '0'); @@ -782,7 +782,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 260 test.t1_512.a1 1 100.00 Using where 2 MATERIALIZED t2_512 ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: -Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from (select group_concat(`test`.`t2_512`.`b1` separator ',') from `test`.`t2_512` group by `test`.`t2_512`.`b2`) join `test`.`t1_512` where (`test`.`t1_512`.`a1` = ``.`group_concat(b1)`) +Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from (select group_concat(`test`.`t2_512`.`b1` separator ',') from `test`.`t2_512` group by `test`.`t2_512`.`b2`) join `test`.`t1_512` where `test`.`t1_512`.`a1` = ``.`group_concat(b1)` select left(a1,7), left(a2,7) from t1_512 where a1 in (select group_concat(b1) from t2_512 group by b2); @@ -800,7 +800,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 260 test.t1_512.a1 1 100.00 Using where 2 MATERIALIZED t2_512 ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: -Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from (select group_concat(`test`.`t2_512`.`b1` separator ',') from `test`.`t2_512` group by `test`.`t2_512`.`b2`) join `test`.`t1_512` where (`test`.`t1_512`.`a1` = ``.`group_concat(b1)`) +Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from (select group_concat(`test`.`t2_512`.`b1` separator ',') from `test`.`t2_512` group by `test`.`t2_512`.`b2`) join `test`.`t1_512` where `test`.`t1_512`.`a1` = ``.`group_concat(b1)` select left(a1,7), left(a2,7) from t1_512 where a1 in (select group_concat(b1) from t2_512 group by b2); @@ -842,7 +842,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: -Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` semi join (`test`.`t2_1024`) where ((`test`.`t2_1024`.`b1` = `test`.`t1_1024`.`a1`) and (`test`.`t1_1024`.`a1` > '0')) +Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` semi join (`test`.`t2_1024`) where `test`.`t2_1024`.`b1` = `test`.`t1_1024`.`a1` and `test`.`t1_1024`.`a1` > '0' select left(a1,7), left(a2,7) from t1_1024 where a1 in (select b1 from t2_1024 where b1 > '0'); @@ -856,7 +856,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: -Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` semi join (`test`.`t2_1024`) where ((`test`.`t2_1024`.`b1` = `test`.`t1_1024`.`a1`) and (`test`.`t2_1024`.`b2` = `test`.`t1_1024`.`a2`) and (`test`.`t1_1024`.`a1` > '0')) +Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` semi join (`test`.`t2_1024`) where `test`.`t2_1024`.`b1` = `test`.`t1_1024`.`a1` and `test`.`t2_1024`.`b2` = `test`.`t1_1024`.`a2` and `test`.`t1_1024`.`a1` > '0' select left(a1,7), left(a2,7) from t1_1024 where (a1,a2) in (select b1, b2 from t2_1024 where b1 > '0'); @@ -870,7 +870,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 1 PRIMARY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: -Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` semi join (`test`.`t2_1024`) where ((`test`.`t2_1024`.`b1` > '0') and (`test`.`t1_1024`.`a1` = substr(`test`.`t2_1024`.`b1`,1,1024))) +Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` semi join (`test`.`t2_1024`) where `test`.`t2_1024`.`b1` > '0' and `test`.`t1_1024`.`a1` = substr(`test`.`t2_1024`.`b1`,1,1024) select left(a1,7), left(a2,7) from t1_1024 where a1 in (select substring(b1,1,1024) from t2_1024 where b1 > '0'); @@ -885,7 +885,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 260 test.t1_1024.a1 1 100.00 Using where 2 MATERIALIZED t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: -Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from (select group_concat(`test`.`t2_1024`.`b1` separator ',') from `test`.`t2_1024` group by `test`.`t2_1024`.`b2`) join `test`.`t1_1024` where (`test`.`t1_1024`.`a1` = ``.`group_concat(b1)`) +Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from (select group_concat(`test`.`t2_1024`.`b1` separator ',') from `test`.`t2_1024` group by `test`.`t2_1024`.`b2`) join `test`.`t1_1024` where `test`.`t1_1024`.`a1` = ``.`group_concat(b1)` select left(a1,7), left(a2,7) from t1_1024 where a1 in (select group_concat(b1) from t2_1024 group by b2); @@ -903,7 +903,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 260 test.t1_1024.a1 1 100.00 Using where 2 MATERIALIZED t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: -Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from (select group_concat(`test`.`t2_1024`.`b1` separator ',') from `test`.`t2_1024` group by `test`.`t2_1024`.`b2`) join `test`.`t1_1024` where (`test`.`t1_1024`.`a1` = ``.`group_concat(b1)`) +Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from (select group_concat(`test`.`t2_1024`.`b1` separator ',') from `test`.`t2_1024` group by `test`.`t2_1024`.`b2`) join `test`.`t1_1024` where `test`.`t1_1024`.`a1` = ``.`group_concat(b1)` select left(a1,7), left(a2,7) from t1_1024 where a1 in (select group_concat(b1) from t2_1024 group by b2); @@ -945,7 +945,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: -Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` semi join (`test`.`t2_1025`) where ((`test`.`t2_1025`.`b1` = `test`.`t1_1025`.`a1`) and (`test`.`t1_1025`.`a1` > '0')) +Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` semi join (`test`.`t2_1025`) where `test`.`t2_1025`.`b1` = `test`.`t1_1025`.`a1` and `test`.`t1_1025`.`a1` > '0' select left(a1,7), left(a2,7) from t1_1025 where a1 in (select b1 from t2_1025 where b1 > '0'); @@ -959,7 +959,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: -Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` semi join (`test`.`t2_1025`) where ((`test`.`t2_1025`.`b1` = `test`.`t1_1025`.`a1`) and (`test`.`t2_1025`.`b2` = `test`.`t1_1025`.`a2`) and (`test`.`t1_1025`.`a1` > '0')) +Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` semi join (`test`.`t2_1025`) where `test`.`t2_1025`.`b1` = `test`.`t1_1025`.`a1` and `test`.`t2_1025`.`b2` = `test`.`t1_1025`.`a2` and `test`.`t1_1025`.`a1` > '0' select left(a1,7), left(a2,7) from t1_1025 where (a1,a2) in (select b1, b2 from t2_1025 where b1 > '0'); @@ -973,7 +973,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 1 PRIMARY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: -Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` semi join (`test`.`t2_1025`) where ((`test`.`t2_1025`.`b1` > '0') and (`test`.`t1_1025`.`a1` = substr(`test`.`t2_1025`.`b1`,1,1025))) +Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` semi join (`test`.`t2_1025`) where `test`.`t2_1025`.`b1` > '0' and `test`.`t1_1025`.`a1` = substr(`test`.`t2_1025`.`b1`,1,1025) select left(a1,7), left(a2,7) from t1_1025 where a1 in (select substring(b1,1,1025) from t2_1025 where b1 > '0'); @@ -988,7 +988,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 260 test.t1_1025.a1 1 100.00 Using where 2 MATERIALIZED t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: -Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from (select group_concat(`test`.`t2_1025`.`b1` separator ',') from `test`.`t2_1025` group by `test`.`t2_1025`.`b2`) join `test`.`t1_1025` where (`test`.`t1_1025`.`a1` = ``.`group_concat(b1)`) +Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from (select group_concat(`test`.`t2_1025`.`b1` separator ',') from `test`.`t2_1025` group by `test`.`t2_1025`.`b2`) join `test`.`t1_1025` where `test`.`t1_1025`.`a1` = ``.`group_concat(b1)` select left(a1,7), left(a2,7) from t1_1025 where a1 in (select group_concat(b1) from t2_1025 group by b2); @@ -1006,7 +1006,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 260 test.t1_1025.a1 1 100.00 Using where 2 MATERIALIZED t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: -Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from (select group_concat(`test`.`t2_1025`.`b1` separator ',') from `test`.`t2_1025` group by `test`.`t2_1025`.`b2`) join `test`.`t1_1025` where (`test`.`t1_1025`.`a1` = ``.`group_concat(b1)`) +Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from (select group_concat(`test`.`t2_1025`.`b1` separator ',') from `test`.`t2_1025` group by `test`.`t2_1025`.`b2`) join `test`.`t1_1025` where `test`.`t1_1025`.`a1` = ``.`group_concat(b1)` select left(a1,7), left(a2,7) from t1_1025 where a1 in (select group_concat(b1) from t2_1025 group by b2); @@ -1055,7 +1055,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1bb ALL NULL NULL NULL NULL 3 100.00 1 PRIMARY t2bb ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: -Note 1003 select conv(`test`.`t1bb`.`a1`,10,2) AS `bin(a1)`,`test`.`t1bb`.`a2` AS `a2` from `test`.`t1bb` semi join (`test`.`t2bb`) where ((`test`.`t2bb`.`b1` = `test`.`t1bb`.`a1`) and (`test`.`t2bb`.`b2` = `test`.`t1bb`.`a2`)) +Note 1003 select conv(`test`.`t1bb`.`a1`,10,2) AS `bin(a1)`,`test`.`t1bb`.`a2` AS `a2` from `test`.`t1bb` semi join (`test`.`t2bb`) where `test`.`t2bb`.`b1` = `test`.`t1bb`.`a1` and `test`.`t2bb`.`b2` = `test`.`t1bb`.`a2` select bin(a1), a2 from t1bb where (a1, a2) in (select b1, b2 from t2bb); @@ -1104,7 +1104,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 7 100.00 Using where; Using join buffer (flat, BNL join) 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t1`.`a` = `test`.`t2`.`c`) and (`test`.`t2`.`d` >= 20)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t1`.`a` = `test`.`t2`.`c` and `test`.`t2`.`d` >= 20 select a from t1 where a in (select c from t2 where d >= 20); a 2 @@ -1119,7 +1119,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 100.00 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`d` >= 20)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`d` >= 20 select a from t1 where a in (select c from t2 where d >= 20); a 2 @@ -1134,7 +1134,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 100.00 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 7 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`d` >= 20)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`d` >= 20 select a from t1 where a in (select c from t2 where d >= 20); a 2 @@ -1147,7 +1147,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using index 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 7 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <`test`.`t1`.`a`>((`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t2`.`c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), (`test`.`t1`.`a` in on distinct_key where ((`test`.`t1`.`a` = ``.`c`)))))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <`test`.`t1`.`a`>((`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t2`.`c` from `test`.`t2` where `test`.`t2`.`d` >= 20 ), (`test`.`t1`.`a` in on distinct_key where `test`.`t1`.`a` = ``.`c`)))) select a from t1 group by a having a in (select c from t2 where d >= 20); a 2 @@ -1159,7 +1159,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using index 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 7 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <`test`.`t1`.`a`>((`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t2`.`c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), (`test`.`t1`.`a` in on distinct_key where ((`test`.`t1`.`a` = ``.`c`)))))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <`test`.`t1`.`a`>((`test`.`t1`.`a`,`test`.`t1`.`a` in ( (select `test`.`t2`.`c` from `test`.`t2` where `test`.`t2`.`d` >= 20 ), (`test`.`t1`.`a` in on distinct_key where `test`.`t1`.`a` = ``.`c`)))) select a from t1 group by a having a in (select c from t2 where d >= 20); a 2 @@ -1174,7 +1174,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1 Note 1981 Aggregate function 'max()' of SELECT #3 belongs to SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <`test`.`t1`.`a`,`test`.`t1`.`b`,max(`test`.`t1`.`b`),max(`test`.`t1`.`b`)>((`test`.`t1`.`a`,(select `test`.`t2`.`c` from `test`.`t2` where ((<`test`.`t2`.`d`,`test`.`t1`.`b`,max(`test`.`t1`.`b`),max(`test`.`t1`.`b`)>((`test`.`t2`.`d`,(select `test`.`t3`.`e` from `test`.`t3` where (max(`test`.`t1`.`b`) = `test`.`t3`.`e`) having ((`test`.`t2`.`d`) >= (`test`.`t3`.`e`)))))) and ((`test`.`t1`.`a`) = `test`.`t2`.`c`))))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <`test`.`t1`.`a`,`test`.`t1`.`b`,max(`test`.`t1`.`b`),max(`test`.`t1`.`b`)>((`test`.`t1`.`a`,(select `test`.`t2`.`c` from `test`.`t2` where (<`test`.`t2`.`d`,`test`.`t1`.`b`,max(`test`.`t1`.`b`),max(`test`.`t1`.`b`)>((`test`.`t2`.`d`,(select `test`.`t3`.`e` from `test`.`t3` where max(`test`.`t1`.`b`) = `test`.`t3`.`e` having (`test`.`t2`.`d`) >= (`test`.`t3`.`e`))))) and (`test`.`t1`.`a`) = `test`.`t2`.`c`))) select a from t1 group by a having a in (select c from t2 where d >= some(select e from t3 where max(b)=e)); a @@ -1189,7 +1189,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t1`.`a` = `test`.`t2`.`c`) and (<`test`.`t2`.`d`,`test`.`t1`.`b`>((`test`.`t2`.`d`,(select `test`.`t3`.`e` from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and ((`test`.`t2`.`d`) >= `test`.`t3`.`e`))))))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t1`.`a` = `test`.`t2`.`c` and (<`test`.`t2`.`d`,`test`.`t1`.`b`>((`test`.`t2`.`d`,(select `test`.`t3`.`e` from `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`e` and (`test`.`t2`.`d`) >= `test`.`t3`.`e`)))) select a from t1 where a in (select c from t2 where d >= some(select e from t3 where b=e)); a @@ -1963,7 +1963,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from (select max(`test`.`t2`.`c`) from `test`.`t2`) join `test`.`t1` where ((`test`.`t1`.`b` = 7) and (`test`.`t1`.`a` = ``.`MAX(c)`) and ((isnull(``.`MAX(c)`)) or (``.`MAX(c)` = 7))) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from (select max(`test`.`t2`.`c`) from `test`.`t2`) join `test`.`t1` where `test`.`t1`.`b` = 7 and `test`.`t1`.`a` = ``.`MAX(c)` and ((``.`MAX(c)` is null) or ``.`MAX(c)` = 7) SELECT * FROM t1 WHERE a IN (SELECT MAX(c) FROM t2) AND b=7 AND (a IS NULL OR a=b); a b @@ -2208,7 +2208,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 eq_ref db db 764 information_schema.schemata.SCHEMA_NAME 1 100.00 Using where; Using index 2 MATERIALIZED schemata ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 select `test`.`t1`.`db` AS `db` from `test`.`t1` semi join (`information_schema`.`schemata`) where (`test`.`t1`.`db` = `information_schema`.`schemata`.`SCHEMA_NAME`) order by `test`.`t1`.`db` desc +Note 1003 select `test`.`t1`.`db` AS `db` from `test`.`t1` semi join (`information_schema`.`schemata`) where `test`.`t1`.`db` = `information_schema`.`schemata`.`SCHEMA_NAME` order by `test`.`t1`.`db` desc drop table t1; drop database mysqltest1; drop database mysqltest2; diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result index 414815f02b7..b88497dbd9b 100644 --- a/mysql-test/r/system_mysql_db.result +++ b/mysql-test/r/system_mysql_db.result @@ -151,7 +151,7 @@ tables_priv CREATE TABLE `tables_priv` ( `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', `Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '', `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`), @@ -165,7 +165,7 @@ columns_priv CREATE TABLE `columns_priv` ( `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', `Column_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges' @@ -179,7 +179,7 @@ procs_priv CREATE TABLE `procs_priv` ( `Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL, `Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '', `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`), KEY `Grantor` (`Grantor`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges' @@ -212,7 +212,7 @@ proc CREATE TABLE `proc` ( `returns` longblob NOT NULL, `body` longblob NOT NULL, `definer` char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '', `comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, @@ -232,7 +232,7 @@ event CREATE TABLE `event` ( `execute_at` datetime DEFAULT NULL, `interval_value` int(11) DEFAULT NULL, `interval_field` enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `last_executed` datetime DEFAULT NULL, `starts` datetime DEFAULT NULL, @@ -252,7 +252,7 @@ event CREATE TABLE `event` ( show create table general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -262,7 +262,7 @@ general_log CREATE TABLE `general_log` ( show create table slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `query_time` time(6) NOT NULL, `lock_time` time(6) NOT NULL, diff --git a/mysql-test/r/system_mysql_db_fix40123.result b/mysql-test/r/system_mysql_db_fix40123.result index 414815f02b7..b88497dbd9b 100644 --- a/mysql-test/r/system_mysql_db_fix40123.result +++ b/mysql-test/r/system_mysql_db_fix40123.result @@ -151,7 +151,7 @@ tables_priv CREATE TABLE `tables_priv` ( `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', `Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '', `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`), @@ -165,7 +165,7 @@ columns_priv CREATE TABLE `columns_priv` ( `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', `Column_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges' @@ -179,7 +179,7 @@ procs_priv CREATE TABLE `procs_priv` ( `Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL, `Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '', `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`), KEY `Grantor` (`Grantor`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges' @@ -212,7 +212,7 @@ proc CREATE TABLE `proc` ( `returns` longblob NOT NULL, `body` longblob NOT NULL, `definer` char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '', `comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, @@ -232,7 +232,7 @@ event CREATE TABLE `event` ( `execute_at` datetime DEFAULT NULL, `interval_value` int(11) DEFAULT NULL, `interval_field` enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `last_executed` datetime DEFAULT NULL, `starts` datetime DEFAULT NULL, @@ -252,7 +252,7 @@ event CREATE TABLE `event` ( show create table general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -262,7 +262,7 @@ general_log CREATE TABLE `general_log` ( show create table slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `query_time` time(6) NOT NULL, `lock_time` time(6) NOT NULL, diff --git a/mysql-test/r/system_mysql_db_fix50030.result b/mysql-test/r/system_mysql_db_fix50030.result index ed86a35c910..14905ab81a0 100644 --- a/mysql-test/r/system_mysql_db_fix50030.result +++ b/mysql-test/r/system_mysql_db_fix50030.result @@ -151,7 +151,7 @@ tables_priv CREATE TABLE `tables_priv` ( `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', `Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '', `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`), @@ -165,7 +165,7 @@ columns_priv CREATE TABLE `columns_priv` ( `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', `Column_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges' @@ -179,7 +179,7 @@ procs_priv CREATE TABLE `procs_priv` ( `Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL, `Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '', `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`), KEY `Grantor` (`Grantor`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges' @@ -212,7 +212,7 @@ proc CREATE TABLE `proc` ( `returns` longblob NOT NULL, `body` longblob NOT NULL, `definer` char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '', `comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, @@ -232,7 +232,7 @@ event CREATE TABLE `event` ( `execute_at` datetime DEFAULT NULL, `interval_value` int(11) DEFAULT NULL, `interval_field` enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `last_executed` datetime DEFAULT NULL, `starts` datetime DEFAULT NULL, @@ -252,7 +252,7 @@ event CREATE TABLE `event` ( show create table general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -262,7 +262,7 @@ general_log CREATE TABLE `general_log` ( show create table slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `query_time` time(6) NOT NULL, `lock_time` time(6) NOT NULL, diff --git a/mysql-test/r/system_mysql_db_fix50117.result b/mysql-test/r/system_mysql_db_fix50117.result index 414815f02b7..b88497dbd9b 100644 --- a/mysql-test/r/system_mysql_db_fix50117.result +++ b/mysql-test/r/system_mysql_db_fix50117.result @@ -151,7 +151,7 @@ tables_priv CREATE TABLE `tables_priv` ( `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', `Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '', `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`), @@ -165,7 +165,7 @@ columns_priv CREATE TABLE `columns_priv` ( `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', `Column_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges' @@ -179,7 +179,7 @@ procs_priv CREATE TABLE `procs_priv` ( `Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL, `Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '', `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`), KEY `Grantor` (`Grantor`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges' @@ -212,7 +212,7 @@ proc CREATE TABLE `proc` ( `returns` longblob NOT NULL, `body` longblob NOT NULL, `definer` char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '', `comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, @@ -232,7 +232,7 @@ event CREATE TABLE `event` ( `execute_at` datetime DEFAULT NULL, `interval_value` int(11) DEFAULT NULL, `interval_field` enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `last_executed` datetime DEFAULT NULL, `starts` datetime DEFAULT NULL, @@ -252,7 +252,7 @@ event CREATE TABLE `event` ( show create table general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -262,7 +262,7 @@ general_log CREATE TABLE `general_log` ( show create table slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `query_time` time(6) NOT NULL, `lock_time` time(6) NOT NULL, diff --git a/mysql-test/r/table_elim.result b/mysql-test/r/table_elim.result index 3e0cc480aec..a7b0842d14f 100644 --- a/mysql-test/r/table_elim.result +++ b/mysql-test/r/table_elim.result @@ -62,7 +62,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t0 ALL NULL NULL NULL NULL 4 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: -Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t0` left join (`test`.`t1`) on((`test`.`t1`.`a` = `test`.`t0`.`a`)) where 1 +Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t0` left join (`test`.`t1`) on(`test`.`t1`.`a` = `test`.`t0`.`a`) where 1 # Elimination with aggregate functions explain select count(*) from t1 left join t2 on t2.a=t1.a; id select_type table type possible_keys key key_len ref rows Extra @@ -126,7 +126,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY f range PRIMARY PRIMARY 4 NULL 4 100.00 Using where; Using index Warnings: Note 1276 Field or reference 'test.a2.id' of SELECT #3 was resolved in SELECT #2 -Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` where (`f`.`id` in (1,2,3,4)) +Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` where `f`.`id` in (1,2,3,4) This should use facts and a1 tables: explain extended select id from v1 where attr1 between 12 and 14; id select_type table type possible_keys key key_len ref rows filtered Extra @@ -134,7 +134,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY f eq_ref PRIMARY PRIMARY 4 test.a1.id 1 100.00 Using index Warnings: Note 1276 Field or reference 'test.a2.id' of SELECT #3 was resolved in SELECT #2 -Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t1` `a1` where ((`f`.`id` = `a1`.`id`) and (`a1`.`attr1` between 12 and 14)) +Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t1` `a1` where `f`.`id` = `a1`.`id` and `a1`.`attr1` between 12 and 14 This should use facts, a2 and its subquery: explain extended select id from v1 where attr2 between 12 and 14; id select_type table type possible_keys key key_len ref rows filtered Extra @@ -143,7 +143,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t2 ref PRIMARY PRIMARY 4 test.a2.id 2 100.00 Using index Warnings: Note 1276 Field or reference 'test.a2.id' of SELECT #3 was resolved in SELECT #2 -Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t2` `a2` where ((`f`.`id` = `a2`.`id`) and (`a2`.`attr2` between 12 and 14) and (`a2`.`fromdate` = (select max(`test`.`t2`.`fromdate`) from `test`.`t2` where (`test`.`t2`.`id` = `a2`.`id`)))) +Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t2` `a2` where `f`.`id` = `a2`.`id` and `a2`.`attr2` between 12 and 14 and `a2`.`fromdate` = (select max(`test`.`t2`.`fromdate`) from `test`.`t2` where `test`.`t2`.`id` = `a2`.`id`) This should use one table: explain select id from v2 where id=2; id select_type table type possible_keys key key_len ref rows Extra @@ -154,7 +154,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY f range PRIMARY PRIMARY 4 NULL 4 100.00 Using where; Using index Warnings: Note 1276 Field or reference 'test.f.id' of SELECT #3 was resolved in SELECT #2 -Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` where (`f`.`id` in (1,2,3,4)) +Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` where `f`.`id` in (1,2,3,4) This should use facts and a1 tables: explain extended select id from v2 where attr1 between 12 and 14; id select_type table type possible_keys key key_len ref rows filtered Extra @@ -162,7 +162,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY f eq_ref PRIMARY PRIMARY 4 test.a1.id 1 100.00 Using index Warnings: Note 1276 Field or reference 'test.f.id' of SELECT #3 was resolved in SELECT #2 -Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t1` `a1` where ((`f`.`id` = `a1`.`id`) and (`a1`.`attr1` between 12 and 14)) +Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t1` `a1` where `f`.`id` = `a1`.`id` and `a1`.`attr1` between 12 and 14 This should use facts, a2 and its subquery: explain extended select id from v2 where attr2 between 12 and 14; id select_type table type possible_keys key key_len ref rows filtered Extra @@ -171,7 +171,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t2 ref PRIMARY PRIMARY 4 test.f.id 2 100.00 Using index Warnings: Note 1276 Field or reference 'test.f.id' of SELECT #3 was resolved in SELECT #2 -Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t2` `a2` where ((`f`.`id` = `a2`.`id`) and (`a2`.`attr2` between 12 and 14) and (`a2`.`fromdate` = (select max(`test`.`t2`.`fromdate`) from `test`.`t2` where (`test`.`t2`.`id` = `f`.`id`)))) +Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t2` `a2` where `f`.`id` = `a2`.`id` and `a2`.`attr2` between 12 and 14 and `a2`.`fromdate` = (select max(`test`.`t2`.`fromdate`) from `test`.`t2` where `test`.`t2`.`id` = `f`.`id`) drop view v1, v2; drop table t0, t1, t2; create table t1 (a int); @@ -654,7 +654,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index NULL b 5 NULL 2 100.00 Using where; Using index 2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 Warnings: -Note 1003 select `test`.`t2`.`b` AS `b` from `test`.`t2` where <`test`.`t2`.`b`>((`test`.`t2`.`b`,(select sum(1) from dual where 1 having ((`test`.`t2`.`b`) = (sum(1)))))) +Note 1003 select `test`.`t2`.`b` AS `b` from `test`.`t2` where <`test`.`t2`.`b`>((`test`.`t2`.`b`,(select sum(1) from dual where 1 having (`test`.`t2`.`b`) = (sum(1))))) DROP TABLE t1,t2; # # MDEV-4840: Wrong result (missing rows) on LEFT JOIN with InnoDB tables diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result index 81358db0dd6..b833f4f9768 100644 --- a/mysql-test/r/temp_table.result +++ b/mysql-test/r/temp_table.result @@ -538,5 +538,13 @@ UNLOCK TABLES; ALTER TABLE t1 RENAME t2, LOCK SHARED; ALTER TABLE t2 RENAME t1, LOCK EXCLUSIVE; DROP TABLE t1; +# +# MDEV-10792: Assertion `thd->mdl_context.is_lock_owner +# (MDL_key::TABLE, table->db, table->table_name, MDL_SHARED)' +# failed in mysql_rm_table_no_locks +# +CREATE TEMPORARY TABLE t1 (i INT); +DROP TABLE nonexisting_table, t1; +ERROR 42S02: Unknown table 'temp_db.nonexisting_table' # Cleanup DROP DATABASE temp_db; diff --git a/mysql-test/r/truncate_coverage.result b/mysql-test/r/truncate_coverage.result index 95e649912e5..078de1ef3ab 100644 --- a/mysql-test/r/truncate_coverage.result +++ b/mysql-test/r/truncate_coverage.result @@ -6,48 +6,6 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (c1 INT); INSERT INTO t1 VALUES (1); connect con1, localhost, root,,; -HANDLER t1 OPEN; -connection default; -LOCK TABLE t1 WRITE; -SET DEBUG_SYNC='mdl_upgrade_lock SIGNAL waiting'; -TRUNCATE TABLE t1; -connect con2, localhost, root,,; -SET DEBUG_SYNC='now WAIT_FOR waiting'; -KILL QUERY @id; -disconnect con2; -connection default; -ERROR 70100: Query execution was interrupted -UNLOCK TABLES; -connection con1; -# Release shared metadata lock by closing HANDLER. -HANDLER t1 CLOSE; -disconnect con1; -connection default; -DROP TABLE t1; -SET DEBUG_SYNC='RESET'; -CREATE TABLE t1 (c1 INT); -INSERT INTO t1 VALUES (1); -connect con1, localhost, root,,; -HANDLER t1 OPEN; -connection default; -LOCK TABLE t1 WRITE; -SET DEBUG_SYNC='mdl_upgrade_lock SIGNAL waiting'; -TRUNCATE TABLE t1; -connect con2, localhost, root,,; -SET DEBUG_SYNC='now WAIT_FOR waiting'; -disconnect con2; -connection con1; -HANDLER t1 CLOSE; -disconnect con1; -connection default; -ERROR 42S02: Table 'test.t1' doesn't exist -UNLOCK TABLES; -DROP TABLE t1; -ERROR 42S02: Unknown table 'test.t1' -SET DEBUG_SYNC='RESET'; -CREATE TABLE t1 (c1 INT); -INSERT INTO t1 VALUES (1); -connect con1, localhost, root,,; START TRANSACTION; INSERT INTO t1 VALUES (2); connection default; diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index 819fe5306ab..dae9094f463 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -42,13 +42,13 @@ Note 1246 Converting column 'a' from VARCHAR to TEXT SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` mediumtext DEFAULT "hello" + `a` mediumtext DEFAULT 'hello' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 (a blob default "hello"); SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` blob DEFAULT "hello" + `a` blob DEFAULT 'hello' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1,t2; create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr)); diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index d2587d7199e..b28cf54f53a 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -550,12 +550,12 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a BETWEEN '2001-01-01 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2001-01-01') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2001-01-01' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a IN ('2001-01-01','2001-01-02'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2001-01-01') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2001-01-01' DROP TABLE t1; # # MDEV-8699 Wrong result for SELECT..WHERE HEX(date_column)!='323030312D30312D3031' AND date_column='2001-01-01x' @@ -587,7 +587,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Truncated incorrect date value: '2001-01-01x' -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2001-01-01') and ((hex(DATE'2001-01-01')) <> concat('xx',rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2001-01-01' and (hex(DATE'2001-01-01')) <> concat('xx',rand()) DROP TABLE t1; CREATE TABLE t1 (a DATE); INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02'); @@ -606,14 +606,14 @@ SELECT * FROM t1 WHERE LENGTH(a)=11+RAND() AND a=' 2001-01-01'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2001-01-01') and ((length(DATE'2001-01-01')) = (11 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2001-01-01' and (length(DATE'2001-01-01')) = 11 + rand() EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=11+RAND() AND a=' garbage '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Incorrect datetime value: ' garbage ' -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'0000-00-00') and ((length(DATE'0000-00-00')) = (11 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'0000-00-00' and (length(DATE'0000-00-00')) = 11 + rand() DROP TABLE t1; CREATE TABLE t1 (a DATE); INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-01'); @@ -632,7 +632,7 @@ SELECT * FROM t1 WHERE LENGTH(a)=8+RAND() AND a='20010101'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2001-01-01') and ((length(DATE'2001-01-01')) = (8 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2001-01-01' and (length(DATE'2001-01-01')) = 8 + rand() DROP TABLE t1; # # MDEV-8706 Wrong result for SELECT..WHERE time_column=TIMESTAMP'2015-08-30 00:00:00' AND time_column='00:00:00' @@ -655,13 +655,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2015-08-30') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2015-08-30' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2015-08-30') and ((length(DATE'2015-08-30')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2015-08-30' and (length(DATE'2015-08-30')) = 30 + rand() DROP TABLE t1; CREATE TABLE t1 (a DATE); INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31'); @@ -680,13 +680,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'24:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2015-08-31') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2015-08-31' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'24:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2015-08-31') and ((length(DATE'2015-08-31')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2015-08-31' and (length(DATE'2015-08-31')) = 30 + rand() DROP TABLE t1; # In this example '00:00:00' is not recognized as TIME'00:00:00' # and is treated as DATE'0000-00-00'. @@ -706,13 +706,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'0000-00-00') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'0000-00-00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'0000-00-00') and ((length(DATE'0000-00-00')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'0000-00-00' and (length(DATE'0000-00-00')) = 30 + rand() DROP TABLE t1; CREATE TABLE t1 (a DATE); INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31'); @@ -731,13 +731,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2015-08-30 00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00') and ((length(DATE'2015-08-30')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00' and (length(DATE'2015-08-30')) = 30 + rand() DROP TABLE t1; CREATE TABLE t1 (a DATE); INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31'); @@ -754,13 +754,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00.1'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00.1') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00.1' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2015-08-30 00:00:00.1'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00.1') and ((length(DATE'2015-08-30')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00.1' and (length(DATE'2015-08-30')) = 30 + rand() DROP TABLE t1; CREATE TABLE t1 (a DATE); INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31'); @@ -779,13 +779,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='2015-08-30 00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2015-08-30') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2015-08-30' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='2015-08-30 00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2015-08-30') and ((length(DATE'2015-08-30')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2015-08-30' and (length(DATE'2015-08-30')) = 30 + rand() DROP TABLE t1; SET timestamp=DEFAULT; # @@ -797,7 +797,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=DATE'2001-01-01' AND COALESC id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = DATE'2001-01-01') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = DATE'2001-01-01' DROP TABLE t1; # # MDEV-8658 DATE(zerofill_column) and DATE(COALESCE(zerofill_column)) return different results diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index 41696aa2d7d..8588ad185ed 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -544,7 +544,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY x1 ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary; End temporary Warnings: Note 1276 Field or reference 'test.t1.cur_date' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`cur_date` AS `cur_date` from `test`.`t1` semi join (`test`.`t1` `x1`) where ((`test`.`x1`.`id` = `test`.`t1`.`id`) and (`test`.`t1`.`cur_date` = 0)) +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`cur_date` AS `cur_date` from `test`.`t1` semi join (`test`.`t1` `x1`) where `test`.`x1`.`id` = `test`.`t1`.`id` and `test`.`t1`.`cur_date` = 0 select * from t1 where id in (select id from t1 as x1 where (t1.cur_date is null)); id cur_date @@ -556,7 +556,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY x1 ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary; End temporary Warnings: Note 1276 Field or reference 'test.t2.cur_date' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t2`.`id` AS `id`,`test`.`t2`.`cur_date` AS `cur_date` from `test`.`t2` semi join (`test`.`t2` `x1`) where ((`test`.`x1`.`id` = `test`.`t2`.`id`) and (`test`.`t2`.`cur_date` = 0)) +Note 1003 select `test`.`t2`.`id` AS `id`,`test`.`t2`.`cur_date` AS `cur_date` from `test`.`t2` semi join (`test`.`t2` `x1`) where `test`.`x1`.`id` = `test`.`t2`.`id` and `test`.`t2`.`cur_date` = 0 select * from t2 where id in (select id from t2 as x1 where (t2.cur_date is null)); id cur_date @@ -747,7 +747,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 FORCE INDEX(attime) WHERE AtTime = '2010-02-22 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ref AtTime AtTime 6 const 1 100.00 Warnings: -Note 1003 select `test`.`t1`.`Id` AS `Id`,`test`.`t1`.`AtTime` AS `AtTime` from `test`.`t1` FORCE INDEX (`attime`) where (`test`.`t1`.`AtTime` = TIMESTAMP'2010-02-22 18:40:07') +Note 1003 select `test`.`t1`.`Id` AS `Id`,`test`.`t1`.`AtTime` AS `AtTime` from `test`.`t1` FORCE INDEX (`attime`) where `test`.`t1`.`AtTime` = TIMESTAMP'2010-02-22 18:40:07' DROP TABLE t1; SET NAMES latin1; # @@ -977,14 +977,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)!=30+RAND() AND a='2001-01-01 00:00:00x'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and ((length(TIMESTAMP'2001-01-01 00:00:00')) <> (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' and (length(TIMESTAMP'2001-01-01 00:00:00')) <> 30 + rand() DROP TABLE t1; CREATE TABLE t1 (a DATETIME);; INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01'); @@ -1000,20 +1000,20 @@ SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=' 2001-01-01 00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=19+RAND() AND a=' 2001-01-01 00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and ((length(TIMESTAMP'2001-01-01 00:00:00')) = (19 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' and (length(TIMESTAMP'2001-01-01 00:00:00')) = 19 + rand() EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=' garbage '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Incorrect datetime value: ' garbage ' -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'0000-00-00 00:00:00') and ((length(TIMESTAMP'0000-00-00 00:00:00')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'0000-00-00 00:00:00' and (length(TIMESTAMP'0000-00-00 00:00:00')) = 30 + rand() DROP TABLE t1; CREATE TABLE t1 (a DATETIME);; INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01'); @@ -1032,13 +1032,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000') and ((length(TIMESTAMP'2001-01-01 00:00:00')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000' and (length(TIMESTAMP'2001-01-01 00:00:00')) = 30 + rand() DROP TABLE t1; CREATE TABLE t1 (a DATETIME(6));; INSERT INTO t1 VALUES ('2001-01-01 00:00:00.000000'),('2001-01-01 00:00:01.000000'); @@ -1057,13 +1057,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=26 AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=40+RAND() AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000') and ((length(TIMESTAMP'2001-01-01 00:00:00.000000')) = (40 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000' and (length(TIMESTAMP'2001-01-01 00:00:00.000000')) = 40 + rand() DROP TABLE t1; SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30'); CREATE TABLE t1 (a DATETIME);; @@ -1083,13 +1083,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIME'00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=40+RAND() AND a=TIME'00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and ((length(TIMESTAMP'2001-01-01 00:00:00')) = (40 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' and (length(TIMESTAMP'2001-01-01 00:00:00')) = 40 + rand() DROP TABLE t1; # # MDEV-8795 Equal expression propagation does not work for temporal literals @@ -1100,7 +1100,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=TIMESTAMP'2001-01-01 00:00:0 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = TIMESTAMP'2001-01-01 00:00:00') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = TIMESTAMP'2001-01-01 00:00:00' DROP TABLE t1; # # MDEV-8875 Wrong metadata for MAX(CAST(time_column AS DATETIME)) diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result index 021f1803f01..0f72a244fd2 100644 --- a/mysql-test/r/type_decimal.result +++ b/mysql-test/r/type_decimal.result @@ -1013,6 +1013,9 @@ SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME DATA_TYPE COLUMN_TYPE a decimal decimal(10,2)/*old*/ DROP TABLE t1dec102; +select cast('-0.0' as decimal(5,1)) < 0; +cast('-0.0' as decimal(5,1)) < 0 +0 # # End of 5.5 tests # diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result index 7d0e5a39d91..db03e61fcdd 100644 --- a/mysql-test/r/type_enum.result +++ b/mysql-test/r/type_enum.result @@ -2104,7 +2104,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'a ') and (hex(`test`.`t1`.`a`) = '61')) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a ' and hex(`test`.`t1`.`a`) = '61' DROP TABLE t1; CREATE TABLE t1 (a ENUM('a','a ') CHARACTER SET BINARY); INSERT INTO t1 VALUES ('a'),('a '); @@ -2124,7 +2124,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index eab55b2272d..58dba89745d 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -556,13 +556,13 @@ SELECT * FROM t1 WHERE LENGTH(a)!=6 AND a=100e0; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 100e0) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 100e0 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=100e0; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 100e0) and ((length(100)) <> rand())) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 100e0 and (length(100)) <> rand() DROP TABLE t1; CREATE TABLE t1 (a DOUBLE(10,1)); INSERT INTO t1 VALUES (1.1),(1.2),(1.3); @@ -582,7 +582,7 @@ SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=1.10e0; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1.10e0) and ((length(1.1)) <> rand())) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1.10e0 and (length(1.1)) <> rand() DROP TABLE t1; CREATE TABLE t1 (a DOUBLE(10,2)); INSERT INTO t1 VALUES (1.1),(1.2),(1.3); @@ -602,7 +602,7 @@ SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=1.10e0; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1.10e0) and ((length(1.10)) <> rand())) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1.10e0 and (length(1.10)) <> rand() DROP TABLE t1; CREATE TABLE t1 (a DOUBLE(10,3)); INSERT INTO t1 VALUES (1.1),(1.2),(1.3); @@ -622,7 +622,7 @@ SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=1.10e0; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1.10e0) and ((length(1.100)) <> rand())) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1.10e0 and (length(1.100)) <> rand() DROP TABLE t1; # # MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010 @@ -633,7 +633,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010e0 AND a>=2010e0; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010e0) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010e0 DROP TABLE t1; # # End of 10.1 tests diff --git a/mysql-test/r/type_int.result b/mysql-test/r/type_int.result index 530a4134f4a..39e2e91ecc7 100644 --- a/mysql-test/r/type_int.result +++ b/mysql-test/r/type_int.result @@ -10,7 +10,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND a>=2010; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 DROP TABLE t1; # # MDEV-8369 Unexpected impossible WHERE for a condition on a ZEROFILL field @@ -31,7 +31,7 @@ SELECT * FROM t1 WHERE a=128 AND hex(a)='80'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 128) and (hex(`test`.`t1`.`a`) = '80')) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 128 and hex(`test`.`t1`.`a`) = '80' DROP TABLE t1; # # End of 10.1 tests diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index 1c1bb43b915..bc45d6d2789 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -1387,7 +1387,7 @@ Warning 1264 Out of range value for column 'c1' at row 1 insert into t1 values( 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 * 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999); -ERROR 22003: DECIMAL value is out of range in '(99999999999999999999999999999999999999999999999999999999999999999 * 99999999999999999999999999999999999999999999999999999999999999999)' +ERROR 22003: DECIMAL value is out of range in '99999999999999999999999999999999999999999999999999999999999999999 * 99999999999999999999999999999999999999999999999999999999999999999' insert into t1 values(1e100); Warnings: Warning 1264 Out of range value for column 'c1' at row 1 @@ -2086,7 +2086,7 @@ SELECT * FROM t1 WHERE LENGTH(a)!=rand() AND a=1.10; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1.10) and ((length(1.1)) <> rand())) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1.10 and (length(1.1)) <> rand() DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(10,2)); INSERT INTO t1 VALUES (1.1),(1.2),(1.3); @@ -2106,7 +2106,7 @@ SELECT * FROM t1 WHERE LENGTH(a)!=rand() AND a=1.10; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1.10) and ((length(1.10)) <> rand())) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1.10 and (length(1.10)) <> rand() DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(10,3)); INSERT INTO t1 VALUES (1.1),(1.2),(1.3); @@ -2126,7 +2126,7 @@ SELECT * FROM t1 WHERE LENGTH(a)!=rand() AND a=1.10; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1.10) and ((length(1.100)) <> rand())) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1.10 and (length(1.100)) <> rand() DROP TABLE t1; # # MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010 @@ -2137,7 +2137,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010.0 AND a>=2010.0; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010.0) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010.0 DROP TABLE t1; # # MDEV-8635 Redundant warnings on WHERE decimal_column='ax' diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result index 43409cf60e7..a1416b13e1c 100644 --- a/mysql-test/r/type_ranges.result +++ b/mysql-test/r/type_ranges.result @@ -54,7 +54,7 @@ ushort smallint(5) unsigned zerofill NULL NO MUL 00000 # umedium mediumint(8) unsigned NULL NO MUL 0 # ulong int(11) unsigned NULL NO MUL 0 # ulonglong bigint(13) unsigned NULL NO MUL 0 # -time_stamp timestamp NULL NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP # +time_stamp timestamp NULL NO current_timestamp() on update current_timestamp() # date_field date NULL YES NULL # time_field time NULL YES NULL # date_time datetime NULL YES NULL # @@ -83,10 +83,10 @@ t1 1 options 2 flags A NULL NULL NULL BTREE CREATE UNIQUE INDEX test on t1 ( auto ) ; CREATE INDEX test2 on t1 ( ulonglong,ulong) ; Warnings: -Note 1831 Duplicate index 'test2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `test2`. This is deprecated and will be disallowed in a future release CREATE INDEX test3 on t1 ( medium ) ; Warnings: -Note 1831 Duplicate index 'test3' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `test3`. This is deprecated and will be disallowed in a future release DROP INDEX test ON t1; insert into t1 values (10, 1,1,1,1,1,1,1,1,1,1,1,1,1,NULL,0,0,0,1,1,1,1,'one','one'); insert into t1 values (NULL,2,2,2,2,2,2,2,2,2,2,2,2,2,NULL,NULL,NULL,NULL,NULL,NULL,2,2,'two','two,one'); @@ -226,7 +226,7 @@ ushort smallint(5) unsigned zerofill NULL NO 00000 # umedium mediumint(8) unsigned NULL NO MUL 0 # ulong int(11) unsigned NULL NO MUL 0 # ulonglong bigint(13) unsigned NULL NO MUL 0 # -time_stamp timestamp NULL NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP # +time_stamp timestamp NULL NO current_timestamp() on update current_timestamp() # date_field char(10) latin1_swedish_ci YES NULL # time_field time NULL YES NULL # date_time datetime NULL YES NULL # @@ -252,7 +252,7 @@ ushort smallint(5) unsigned zerofill NULL NO 00000 # umedium mediumint(8) unsigned NULL NO 0 # ulong int(11) unsigned NULL NO 0 # ulonglong bigint(13) unsigned NULL NO 0 # -time_stamp timestamp NULL NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP # +time_stamp timestamp NULL NO current_timestamp() on update current_timestamp() # date_field char(10) latin1_swedish_ci YES NULL # time_field time NULL YES NULL # date_time datetime NULL YES NULL # @@ -305,7 +305,7 @@ const int(1) NULL NO NULL # drop table t1,t2,t3; create table t1 ( myfield INT NOT NULL, UNIQUE INDEX (myfield), unique (myfield), index(myfield)); Warnings: -Note 1831 Duplicate index 'myfield_2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `myfield_2`. This is deprecated and will be disallowed in a future release drop table t1; create table t1 ( id integer unsigned not null primary key ); create table t2 ( id integer unsigned not null primary key ); diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result index 586c6345e00..9d3a6e3bcb4 100644 --- a/mysql-test/r/type_set.result +++ b/mysql-test/r/type_set.result @@ -285,7 +285,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'a ') and (hex(`test`.`t1`.`a`) = '61')) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a ' and hex(`test`.`t1`.`a`) = '61' DROP TABLE t1; CREATE TABLE t1 (a SET('a','a ') CHARACTER SET BINARY); INSERT INTO t1 VALUES ('a'),('a '); @@ -305,7 +305,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE diff --git a/mysql-test/r/type_temporal_mysql56.result b/mysql-test/r/type_temporal_mysql56.result index b0c81844781..cdc951dac14 100644 --- a/mysql-test/r/type_temporal_mysql56.result +++ b/mysql-test/r/type_temporal_mysql56.result @@ -63,7 +63,7 @@ SET TIME_ZONE='+00:00'; SHOW CREATE TABLE mysql56timestamp; Table Create Table mysql56timestamp CREATE TABLE `mysql56timestamp` ( - `ts0` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `ts0` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `ts1` timestamp(1) NOT NULL DEFAULT '0000-00-00 00:00:00.0', `ts2` timestamp(2) NOT NULL DEFAULT '0000-00-00 00:00:00.00', `ts3` timestamp(3) NOT NULL DEFAULT '0000-00-00 00:00:00.000', diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result index e4525f34ab4..ce1cb424a6c 100644 --- a/mysql-test/r/type_time.result +++ b/mysql-test/r/type_time.result @@ -417,14 +417,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Truncated incorrect time value: '00:00:00x' -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00x'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Truncated incorrect time value: '00:00:00x' -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and ((length(TIME'00:00:00')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' and (length(TIME'00:00:00')) = 30 + rand() DROP TABLE t1; # Trailing fractional digits in string literals CREATE TABLE t1 (a TIME); @@ -441,13 +441,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='00:00:00.000000'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00.000000'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and ((length(TIME'00:00:00')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' and (length(TIME'00:00:00')) = 30 + rand() DROP TABLE t1; # Trailing fractional digits in temporal literals CREATE TABLE t1 (a TIME); @@ -464,13 +464,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'00:00:00.000000'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00.000000') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00.000000' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'00:00:00.000000'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00.000000') and ((length(TIME'00:00:00')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00.000000' and (length(TIME'00:00:00')) = 30 + rand() DROP TABLE t1; # Trailing fractional digits in temporal literals, same precision CREATE TABLE t1 (a TIME(6)); @@ -490,7 +490,7 @@ SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'00:00:00.000000'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00.000000') and ((length(TIME'00:00:00.000000')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00.000000' and (length(TIME'00:00:00.000000')) = 30 + rand() DROP TABLE t1; # Leading spaces in string literals CREATE TABLE t1 (a TIME); @@ -507,13 +507,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=' 00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=' 00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and ((length(TIME'00:00:00')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' and (length(TIME'00:00:00')) = 30 + rand() DROP TABLE t1; # Numeric format in string literals CREATE TABLE t1 (a TIME); @@ -530,13 +530,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='000000'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='000000'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and ((length(TIME'00:00:00')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' and (length(TIME'00:00:00')) = 30 + rand() DROP TABLE t1; # # MDEV-8766 Wrong result for SELECT..WHERE LENGTH(time_column)=8 AND time_column=TIMESTAMP'2001-01-01 10:20:31' @@ -559,13 +559,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31') and ((length(TIME'10:20:31')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31' and (length(TIME'10:20:31')) = 30 + rand() DROP TABLE t1; # TIMESTAMP literal with a bigger scale and fractional second truncation # Ok to propagate with precision truncation @@ -583,13 +583,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.123'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31.123000') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123000' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31.123'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.123000') and ((length(TIME'10:20:31')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123000' and (length(TIME'10:20:31')) = 30 + rand() DROP TABLE t1; # TIMESTAMP literal with a bigger scale and no fractional second truncation # Ok to propagate @@ -609,13 +609,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.000'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31.000'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31') and ((length(TIME'10:20:31')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31' and (length(TIME'10:20:31')) = 30 + rand() DROP TABLE t1; # TIMESTAMP literal with a smaller scale # Ok to propagate @@ -638,7 +638,7 @@ SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31.1 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.123000') and ((length(TIME'10:20:31.123000')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123000' and (length(TIME'10:20:31.123000')) = 30 + rand() DROP TABLE t1; # TIME literal with a bigger scale and fractional second truncation # Ok to propagate with precision truncation @@ -656,13 +656,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.123'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31.123') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'10:20:31.123'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.123') and ((length(TIME'10:20:31')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123' and (length(TIME'10:20:31')) = 30 + rand() DROP TABLE t1; # TIME literal with a bigger scale and no fractional second truncation # Ok to propagate @@ -682,13 +682,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.000'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31.000') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.000' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'10:20:31.000'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.000') and ((length(TIME'10:20:31')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.000' and (length(TIME'10:20:31')) = 30 + rand() DROP TABLE t1; # TIME literal with a smaller scale # Ok to propagate @@ -711,7 +711,7 @@ SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'10:20:31.123'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.123') and ((length(TIME'10:20:31.123000')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123' and (length(TIME'10:20:31.123000')) = 30 + rand() DROP TABLE t1; # TIME-alike string literal with a bigger scale and fractional second truncation # Ok to propagate with precision truncation @@ -729,13 +729,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.123'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31.123000') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123000' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='10:20:31.123'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.123000') and ((length(TIME'10:20:31')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123000' and (length(TIME'10:20:31')) = 30 + rand() DROP TABLE t1; # TIME-alike string literal with a bigger scale and no fractional second truncation # Ok to propagate @@ -755,13 +755,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.000'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='10:20:31.000'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31') and ((length(TIME'10:20:31')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31' and (length(TIME'10:20:31')) = 30 + rand() DROP TABLE t1; # TIME-alike string literal with a smaller scale # Ok to propagate @@ -784,7 +784,7 @@ SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='10:20:31.123'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.123000') and ((length(TIME'10:20:31.123000')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123000' and (length(TIME'10:20:31.123000')) = 30 + rand() DROP TABLE t1; SET timestamp=DEFAULT; SET @@old_mode=zero_date_time_cast; @@ -815,13 +815,13 @@ SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=8; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:30') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:30' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=30+RAND(); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:30') and ((length(TIME'10:20:30')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:30' and (length(TIME'10:20:30')) = 30 + rand() # Old mode, TIMESTAMP literal, zon-zero YYYYMMDD, no propagation SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30'; a @@ -834,13 +834,13 @@ SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30' AND LENGTH(a)=8; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'0000-00-01 10:20:30') and (length(`test`.`t1`.`a`) = 8)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'0000-00-01 10:20:30' and length(`test`.`t1`.`a`) = 8 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30' AND LENGTH(a)=30+RAND(); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'0000-00-01 10:20:30') and (length(`test`.`t1`.`a`) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'0000-00-01 10:20:30' and length(`test`.`t1`.`a`) = 30 + rand() # Old mode, TIMESTAMP-alike string literal, zero YYYYMMDD, Ok to propagate SELECT * FROM t1 WHERE a='0000-00-00 10:20:30'; a @@ -853,13 +853,13 @@ SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=8; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:30') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:30' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=30+RAND(); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:30') and ((length(TIME'10:20:30')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:30' and (length(TIME'10:20:30')) = 30 + rand() # Old mode, TIMESTAMP-alike literal, zon-zero YYYYMMDD, no propagation SELECT * FROM t1 WHERE a='0000-00-01 10:20:30'; a @@ -872,13 +872,13 @@ SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '0000-00-01 10:20:30') and (length(`test`.`t1`.`a`) = 8)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '0000-00-01 10:20:30' and length(`test`.`t1`.`a`) = 8 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=30+RAND(); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '0000-00-01 10:20:30') and (length(`test`.`t1`.`a`) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '0000-00-01 10:20:30' and length(`test`.`t1`.`a`) = 30 + rand() DROP TABLE t1; SET @@old_mode=DEFAULT; # @@ -904,7 +904,7 @@ SELECT * FROM t1 WHERE a>=TIMESTAMP'2015-08-30 00:00:00' AND a='00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' DROP TABLE t1; SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30'); CREATE TABLE t1 (a TIME); @@ -917,19 +917,19 @@ SELECT * FROM t1 WHERE DATE(a)<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and (timestamp('2015-08-08',(TIME'00:00:00' + rand())) <= TIMESTAMP'2015-08-30 00:00:00.1')) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' and timestamp('2015-08-08',TIME'00:00:00' + rand()) <= TIMESTAMP'2015-08-30 00:00:00.1' EXPLAIN EXTENDED SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00.1'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00.100000') and (timestamp('2015-08-08',(TIME'00:00:00' + rand())) <= TIMESTAMP'2015-08-30 00:00:00.1')) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00.100000' and timestamp('2015-08-08',TIME'00:00:00' + rand()) <= TIMESTAMP'2015-08-30 00:00:00.1' DROP TABLE t1; SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30'); CREATE TABLE t1 (a TIME); @@ -942,19 +942,19 @@ SELECT * FROM t1 WHERE DATE(a)<=DATE'2015-08-30' AND a='00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=DATE'2015-08-30' AND a='00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and (timestamp('2015-08-08',(TIME'00:00:00' + rand())) <= DATE'2015-08-30')) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' and timestamp('2015-08-08',TIME'00:00:00' + rand()) <= DATE'2015-08-30' EXPLAIN EXTENDED SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=DATE'2015-08-30' AND a='00:00:00.1'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00.100000') and (timestamp('2015-08-08',(TIME'00:00:00' + rand())) <= DATE'2015-08-30')) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00.100000' and timestamp('2015-08-08',TIME'00:00:00' + rand()) <= DATE'2015-08-30' DROP TABLE t1; SET timestamp=DEFAULT; # @@ -966,7 +966,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:01' AND COALESCE( id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = TIME'00:00:01') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = TIME'00:00:01' DROP TABLE t1; # # MDEV-8793 Wrong result set for SELECT ... WHERE COALESCE(time_column)=TIME('00:00:00') AND COALESCE(time_column)=DATE('2015-09-11') @@ -989,7 +989,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE('2015-0 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = 00:00:00) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = 00:00:00 # TIME cast + DATE literal SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE'2015-09-11'; a @@ -999,7 +999,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE'2015-09 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = 00:00:00) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = 00:00:00 # TIME literal + DATE cast SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE('2015-09-11'); a @@ -1009,7 +1009,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE('2015-09- id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = TIME'00:00:00') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = TIME'00:00:00' # TIME literal + DATE literal SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE'2015-09-11'; a @@ -1019,7 +1019,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE'2015-09-1 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = TIME'00:00:00') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = TIME'00:00:00' # TIME-alike string literal + DATE cast SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE('2015-09-11'); a @@ -1029,7 +1029,7 @@ SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE('2015-09-11') id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = '00:00:00') and (coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '00:00:00' and coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00 # TIME-alike string literal + DATE literal SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE'2015-09-11'; a @@ -1039,7 +1039,7 @@ SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE'2015-09-11'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = '00:00:00') and (coalesce(`test`.`t1`.`a`) = DATE'2015-09-11')) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '00:00:00' and coalesce(`test`.`t1`.`a`) = DATE'2015-09-11' # TIME-alike integer literal + DATE cast SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE('2015-09-11'); a @@ -1049,7 +1049,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE('2015-09-11'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = 0) and (coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = 0 and coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00 # TIME-alike integer literal + DATE literal SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE'2015-09-11'; a @@ -1059,7 +1059,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE'2015-09-11'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = 0) and (coalesce(`test`.`t1`.`a`) = DATE'2015-09-11')) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = 0 and coalesce(`test`.`t1`.`a`) = DATE'2015-09-11' # DATE cast + TIME cast SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME('00:00:00'); a @@ -1069,7 +1069,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME('00:0 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00 # DATE cast + TIME literal SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME'00:00:00'; a @@ -1079,7 +1079,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME'00:00 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00 # DATE cast + TIME-alike string literal SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)='00:00:00'; a @@ -1089,7 +1089,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)='00:00:00' id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00) and (coalesce(`test`.`t1`.`a`) = '00:00:00')) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00 and coalesce(`test`.`t1`.`a`) = '00:00:00' # DATE cast + TIME-alike integer literal SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=0; a @@ -1099,7 +1099,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=0; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00) and (coalesce(`test`.`t1`.`a`) = 0)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00 and coalesce(`test`.`t1`.`a`) = 0 # DATE literal + TIME cast SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME('00:00:00'); a @@ -1109,7 +1109,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME('00:00: id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = DATE'2015-09-11') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = DATE'2015-09-11' # DATE literal + TIME literal SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME'00:00:00'; a @@ -1119,7 +1119,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME'00:00:0 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = DATE'2015-09-11') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = DATE'2015-09-11' # DATE literal + TIME-alike string literal SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)='00:00:00'; a @@ -1129,7 +1129,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)='00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = DATE'2015-09-11') and (coalesce(`test`.`t1`.`a`) = '00:00:00')) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = DATE'2015-09-11' and coalesce(`test`.`t1`.`a`) = '00:00:00' # DATE literal + TIME-alike integer literal SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=0; a @@ -1139,7 +1139,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=0; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = DATE'2015-09-11') and (coalesce(`test`.`t1`.`a`) = 0)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = DATE'2015-09-11' and coalesce(`test`.`t1`.`a`) = 0 DROP TABLE t1; SET timestamp=DEFAULT; # diff --git a/mysql-test/r/type_time_6065.result b/mysql-test/r/type_time_6065.result index a61c658d50e..341fc9fe98e 100644 --- a/mysql-test/r/type_time_6065.result +++ b/mysql-test/r/type_time_6065.result @@ -12,7 +12,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key` SELECT * FROM t1 ignore INDEX (col_time_key) STRAIGHT_JOIN @@ -33,7 +33,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key` SELECT * FROM t1 ignore INDEX (col_time_key) STRAIGHT_JOIN @@ -54,7 +54,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where 1 SIMPLE t2 ref col_datetime_key col_datetime_key 6 test.t1.col_time_key 1 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key` SELECT * FROM t1 ignore INDEX (col_time_key) STRAIGHT_JOIN @@ -75,7 +75,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where 1 SIMPLE t2 ref col_datetime_key col_datetime_key 6 test.t1.col_time_key 1 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key` SELECT * FROM t1 ignore INDEX (col_time_key) STRAIGHT_JOIN @@ -96,7 +96,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key` SELECT * FROM t1 force INDEX (col_time_key) STRAIGHT_JOIN @@ -117,7 +117,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key` SELECT * FROM t1 force INDEX (col_time_key) STRAIGHT_JOIN @@ -138,7 +138,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using where; Using index 1 SIMPLE t2 ref col_datetime_key col_datetime_key 6 test.t1.col_time_key 1 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key` SELECT * FROM t1 force INDEX (col_time_key) STRAIGHT_JOIN @@ -159,7 +159,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using where; Using index 1 SIMPLE t2 ref col_datetime_key col_datetime_key 6 test.t1.col_time_key 1 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key` SELECT * FROM t1 force INDEX (col_time_key) STRAIGHT_JOIN @@ -180,7 +180,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key` SELECT * FROM t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN @@ -201,7 +201,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key` SELECT * FROM t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN @@ -222,7 +222,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where 1 SIMPLE t1 ref col_time_key col_time_key 4 test.t2.col_datetime_key 2 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key` SELECT * FROM t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN @@ -243,7 +243,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where 1 SIMPLE t1 ref col_time_key col_time_key 4 test.t2.col_datetime_key 2 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key` SELECT * FROM t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN @@ -264,7 +264,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key` SELECT * FROM t2 force INDEX (col_datetime_key) STRAIGHT_JOIN @@ -285,7 +285,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key` SELECT * FROM t2 force INDEX (col_datetime_key) STRAIGHT_JOIN @@ -306,7 +306,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using where; Using index 1 SIMPLE t1 ref col_time_key col_time_key 4 test.t2.col_datetime_key 2 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key` SELECT * FROM t2 force INDEX (col_datetime_key) STRAIGHT_JOIN @@ -327,7 +327,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using where; Using index 1 SIMPLE t1 ref col_time_key col_time_key 4 test.t2.col_datetime_key 2 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key` SELECT * FROM t2 force INDEX (col_datetime_key) STRAIGHT_JOIN @@ -348,7 +348,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key` SELECT * FROM t1 ignore INDEX (col_time_key) STRAIGHT_JOIN @@ -379,7 +379,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key` SELECT * FROM t1 ignore INDEX (col_time_key) STRAIGHT_JOIN @@ -410,7 +410,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key` SELECT * FROM t1 ignore INDEX (col_time_key) STRAIGHT_JOIN @@ -441,7 +441,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key` SELECT * FROM t1 ignore INDEX (col_time_key) STRAIGHT_JOIN @@ -472,7 +472,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key` SELECT * FROM t1 force INDEX (col_time_key) STRAIGHT_JOIN @@ -503,7 +503,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key` SELECT * FROM t1 force INDEX (col_time_key) STRAIGHT_JOIN @@ -534,7 +534,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index 1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key` SELECT * FROM t1 force INDEX (col_time_key) STRAIGHT_JOIN @@ -565,7 +565,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index 1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key` SELECT * FROM t1 force INDEX (col_time_key) STRAIGHT_JOIN @@ -596,7 +596,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key` SELECT * FROM t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN @@ -627,7 +627,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key` SELECT * FROM t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN @@ -658,7 +658,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key` SELECT * FROM t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN @@ -689,7 +689,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key` SELECT * FROM t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN @@ -720,7 +720,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key` SELECT * FROM t2 force INDEX (col_datetime_key) STRAIGHT_JOIN @@ -751,7 +751,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key` SELECT * FROM t2 force INDEX (col_datetime_key) STRAIGHT_JOIN @@ -782,7 +782,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key` SELECT * FROM t2 force INDEX (col_datetime_key) STRAIGHT_JOIN @@ -813,7 +813,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key` SELECT * FROM t2 force INDEX (col_datetime_key) STRAIGHT_JOIN @@ -844,7 +844,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key` SELECT * FROM t1 ignore INDEX (col_time_key) STRAIGHT_JOIN @@ -870,7 +870,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key` SELECT * FROM t1 ignore INDEX (col_time_key) STRAIGHT_JOIN @@ -896,7 +896,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key` SELECT * FROM t1 ignore INDEX (col_time_key) STRAIGHT_JOIN @@ -922,7 +922,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key` SELECT * FROM t1 ignore INDEX (col_time_key) STRAIGHT_JOIN @@ -948,7 +948,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key` SELECT * FROM t1 force INDEX (col_time_key) STRAIGHT_JOIN @@ -974,7 +974,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key` SELECT * FROM t1 force INDEX (col_time_key) STRAIGHT_JOIN @@ -1000,7 +1000,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index 1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key` SELECT * FROM t1 force INDEX (col_time_key) STRAIGHT_JOIN @@ -1026,7 +1026,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index 1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key` SELECT * FROM t1 force INDEX (col_time_key) STRAIGHT_JOIN @@ -1052,7 +1052,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key` SELECT * FROM t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN @@ -1078,7 +1078,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key` SELECT * FROM t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN @@ -1104,7 +1104,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key` SELECT * FROM t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN @@ -1130,7 +1130,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key` SELECT * FROM t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN @@ -1156,7 +1156,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key` SELECT * FROM t2 force INDEX (col_datetime_key) STRAIGHT_JOIN @@ -1182,7 +1182,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key` SELECT * FROM t2 force INDEX (col_datetime_key) STRAIGHT_JOIN @@ -1208,7 +1208,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key` SELECT * FROM t2 force INDEX (col_datetime_key) STRAIGHT_JOIN @@ -1234,7 +1234,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key` SELECT * FROM t2 force INDEX (col_datetime_key) STRAIGHT_JOIN @@ -1260,7 +1260,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key` SELECT * FROM t1 ignore INDEX (col_time_key) STRAIGHT_JOIN @@ -1291,7 +1291,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key` SELECT * FROM t1 ignore INDEX (col_time_key) STRAIGHT_JOIN @@ -1322,7 +1322,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key` SELECT * FROM t1 ignore INDEX (col_time_key) STRAIGHT_JOIN @@ -1353,7 +1353,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key` SELECT * FROM t1 ignore INDEX (col_time_key) STRAIGHT_JOIN @@ -1384,7 +1384,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key` SELECT * FROM t1 force INDEX (col_time_key) STRAIGHT_JOIN @@ -1415,7 +1415,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key` SELECT * FROM t1 force INDEX (col_time_key) STRAIGHT_JOIN @@ -1446,7 +1446,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index 1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key` SELECT * FROM t1 force INDEX (col_time_key) STRAIGHT_JOIN @@ -1477,7 +1477,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index 1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key` SELECT * FROM t1 force INDEX (col_time_key) STRAIGHT_JOIN @@ -1508,7 +1508,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key` SELECT * FROM t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN @@ -1539,7 +1539,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key` SELECT * FROM t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN @@ -1570,7 +1570,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key` SELECT * FROM t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN @@ -1601,7 +1601,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key` SELECT * FROM t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN @@ -1632,7 +1632,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key` SELECT * FROM t2 force INDEX (col_datetime_key) STRAIGHT_JOIN @@ -1663,7 +1663,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key` SELECT * FROM t2 force INDEX (col_datetime_key) STRAIGHT_JOIN @@ -1694,7 +1694,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key` SELECT * FROM t2 force INDEX (col_datetime_key) STRAIGHT_JOIN @@ -1725,7 +1725,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key` SELECT * FROM t2 force INDEX (col_datetime_key) STRAIGHT_JOIN @@ -1756,7 +1756,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key` SELECT * FROM t1 ignore INDEX (col_time_key) STRAIGHT_JOIN @@ -1782,7 +1782,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key` SELECT * FROM t1 ignore INDEX (col_time_key) STRAIGHT_JOIN @@ -1808,7 +1808,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key` SELECT * FROM t1 ignore INDEX (col_time_key) STRAIGHT_JOIN @@ -1834,7 +1834,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key` SELECT * FROM t1 ignore INDEX (col_time_key) STRAIGHT_JOIN @@ -1860,7 +1860,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key` SELECT * FROM t1 force INDEX (col_time_key) STRAIGHT_JOIN @@ -1886,7 +1886,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key` SELECT * FROM t1 force INDEX (col_time_key) STRAIGHT_JOIN @@ -1912,7 +1912,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index 1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key` SELECT * FROM t1 force INDEX (col_time_key) STRAIGHT_JOIN @@ -1938,7 +1938,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index 1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key` SELECT * FROM t1 force INDEX (col_time_key) STRAIGHT_JOIN @@ -1964,7 +1964,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key` SELECT * FROM t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN @@ -1990,7 +1990,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key` SELECT * FROM t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN @@ -2016,7 +2016,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key` SELECT * FROM t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN @@ -2042,7 +2042,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key` SELECT * FROM t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN @@ -2068,7 +2068,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key` SELECT * FROM t2 force INDEX (col_datetime_key) STRAIGHT_JOIN @@ -2094,7 +2094,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key` SELECT * FROM t2 force INDEX (col_datetime_key) STRAIGHT_JOIN @@ -2120,7 +2120,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key` SELECT * FROM t2 force INDEX (col_datetime_key) STRAIGHT_JOIN @@ -2146,7 +2146,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: -Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`) +Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key` SELECT * FROM t2 force INDEX (col_datetime_key) STRAIGHT_JOIN @@ -2198,7 +2198,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 system col_datetime_key NULL NULL NULL 1 100.00 1 SIMPLE t3 index col_time_key col_time_key 4 NULL 20 100.00 Using where; Using index Warnings: -Note 1003 select 1 AS `col_int_nokey`,'2001-11-04 19:07:55' AS `col_datetime_key`,'k' AS `col_varchar_key`,`test`.`t3`.`col_time_key` AS `col_time_key` from `test`.`t3` FORCE INDEX (`col_time_key`) where (`test`.`t3`.`col_time_key` > '2001-11-04 19:07:55') +Note 1003 select 1 AS `col_int_nokey`,'2001-11-04 19:07:55' AS `col_datetime_key`,'k' AS `col_varchar_key`,`test`.`t3`.`col_time_key` AS `col_time_key` from `test`.`t3` FORCE INDEX (`col_time_key`) where `test`.`t3`.`col_time_key` > '2001-11-04 19:07:55' SELECT * FROM t2 STRAIGHT_JOIN t3 FORCE INDEX (col_time_key) ON t3.col_time_key > t2.col_datetime_key; col_int_nokey col_datetime_key col_varchar_key col_time_key @@ -2228,7 +2228,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 system col_datetime_key NULL NULL NULL 1 100.00 1 SIMPLE t3 ALL NULL NULL NULL NULL 20 100.00 Using where Warnings: -Note 1003 select 1 AS `col_int_nokey`,'2001-11-04 19:07:55' AS `col_datetime_key`,'k' AS `col_varchar_key`,`test`.`t3`.`col_time_key` AS `col_time_key` from `test`.`t3` IGNORE INDEX (`col_time_key`) where (`test`.`t3`.`col_time_key` > '2001-11-04 19:07:55') +Note 1003 select 1 AS `col_int_nokey`,'2001-11-04 19:07:55' AS `col_datetime_key`,'k' AS `col_varchar_key`,`test`.`t3`.`col_time_key` AS `col_time_key` from `test`.`t3` IGNORE INDEX (`col_time_key`) where `test`.`t3`.`col_time_key` > '2001-11-04 19:07:55' SELECT * FROM t2 STRAIGHT_JOIN t3 IGNORE INDEX (col_time_key) ON t3.col_time_key > t2.col_datetime_key; col_int_nokey col_datetime_key col_varchar_key col_time_key @@ -2271,7 +2271,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY outr2 index col_time_key col_time_key 4 NULL 20 100.00 Using where; Using index; Using join buffer (flat, BNL join) 2 MATERIALIZED innr ref col_int_key col_int_key 4 const 2 100.00 Using where Warnings: -Note 1003 select 1 AS `col_int_nokey` from `test`.`t3` `outr2` semi join (`test`.`t1` `innr`) where ((`test`.`innr`.`col_int_key` = 1) and (`test`.`innr`.`pk` >= `test`.`innr`.`col_int_nokey`) and (`test`.`outr2`.`col_time_key` > '2001-11-04 19:07:55')) +Note 1003 select 1 AS `col_int_nokey` from `test`.`t3` `outr2` semi join (`test`.`t1` `innr`) where `test`.`innr`.`col_int_key` = 1 and `test`.`innr`.`pk` >= `test`.`innr`.`col_int_nokey` and `test`.`outr2`.`col_time_key` > '2001-11-04 19:07:55' SELECT outr.col_int_nokey FROM t2 as outr STRAIGHT_JOIN t3 AS outr2 diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result index 69c9f68811d..93180218fe4 100644 --- a/mysql-test/r/type_timestamp.result +++ b/mysql-test/r/type_timestamp.result @@ -195,13 +195,13 @@ t1 t2 t3 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `t1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `t1` timestamp NOT NULL DEFAULT current_timestamp(), `t2` datetime DEFAULT NULL, `t3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp NO CURRENT_TIMESTAMP +t1 timestamp NO current_timestamp() t2 datetime YES NULL t3 timestamp NO 0000-00-00 00:00:00 drop table t1; @@ -222,12 +222,12 @@ t1 t2 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `t1` timestamp NOT NULL DEFAULT '2003-01-01 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `t1` timestamp NOT NULL DEFAULT '2003-01-01 00:00:00' ON UPDATE current_timestamp(), `t2` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp NO 2003-01-01 00:00:00 on update CURRENT_TIMESTAMP +t1 timestamp NO 2003-01-01 00:00:00 on update current_timestamp() t2 datetime YES NULL drop table t1; create table t1 (t1 timestamp not null default now() on update now(), t2 datetime); @@ -247,12 +247,12 @@ t1 t2 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `t1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `t2` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +t1 timestamp NO current_timestamp() on update current_timestamp() t2 datetime YES NULL drop table t1; create table t1 (t1 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, t2 datetime, t3 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'); @@ -272,13 +272,13 @@ t1 t2 t3 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `t1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `t2` datetime DEFAULT NULL, `t3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +t1 timestamp NO current_timestamp() on update current_timestamp() t2 datetime YES NULL t3 timestamp NO 0000-00-00 00:00:00 drop table t1; @@ -299,12 +299,12 @@ t1 t2 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `t1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `t2` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +t1 timestamp NO current_timestamp() on update current_timestamp() t2 datetime YES NULL truncate table t1; insert into t1 values ('2004-04-01 00:00:00', '2004-04-01 00:00:00'); @@ -369,7 +369,7 @@ create table t1 (a timestamp null default current_timestamp on update current_ti show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (NULL, NULL); @@ -710,12 +710,12 @@ CREATE TABLE t2 AS SELECT * from t1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP + `ts` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP + `ts` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1,t2; SET sql_mode=DEFAULT; @@ -731,13 +731,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `vc` varchar(10) NOT NULL DEFAULT 'test', - `ts` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP + `ts` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `vc` varchar(10) NOT NULL DEFAULT 'test', - `ts` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP + `ts` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1,t2; End of 10.0 tests @@ -833,14 +833,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)!=30+RAND() AND a='2001-01-01 00:00:00x'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and ((length(TIMESTAMP'2001-01-01 00:00:00')) <> (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' and (length(TIMESTAMP'2001-01-01 00:00:00')) <> 30 + rand() DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP);; INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01'); @@ -856,20 +856,20 @@ SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=' 2001-01-01 00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=19+RAND() AND a=' 2001-01-01 00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and ((length(TIMESTAMP'2001-01-01 00:00:00')) = (19 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' and (length(TIMESTAMP'2001-01-01 00:00:00')) = 19 + rand() EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=' garbage '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Incorrect datetime value: ' garbage ' -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'0000-00-00 00:00:00') and ((length(TIMESTAMP'0000-00-00 00:00:00')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'0000-00-00 00:00:00' and (length(TIMESTAMP'0000-00-00 00:00:00')) = 30 + rand() DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP);; INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01'); @@ -888,13 +888,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000') and ((length(TIMESTAMP'2001-01-01 00:00:00')) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000' and (length(TIMESTAMP'2001-01-01 00:00:00')) = 30 + rand() DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP(6));; INSERT INTO t1 VALUES ('2001-01-01 00:00:00.000000'),('2001-01-01 00:00:01.000000'); @@ -913,13 +913,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=26 AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=40+RAND() AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000') and ((length(TIMESTAMP'2001-01-01 00:00:00.000000')) = (40 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000' and (length(TIMESTAMP'2001-01-01 00:00:00.000000')) = 40 + rand() DROP TABLE t1; SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30'); CREATE TABLE t1 (a TIMESTAMP);; @@ -939,13 +939,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIME'00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=40+RAND() AND a=TIME'00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and ((length(TIMESTAMP'2001-01-01 00:00:00')) = (40 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' and (length(TIMESTAMP'2001-01-01 00:00:00')) = 40 + rand() DROP TABLE t1; # # End of 10.1 tests diff --git a/mysql-test/r/type_timestamp_hires.result b/mysql-test/r/type_timestamp_hires.result index ccad5c8f8a1..fc1bd83e04f 100644 --- a/mysql-test/r/type_timestamp_hires.result +++ b/mysql-test/r/type_timestamp_hires.result @@ -64,15 +64,15 @@ a show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(4) NOT NULL DEFAULT CURRENT_TIMESTAMP(4) ON UPDATE CURRENT_TIMESTAMP(4) + `a` timestamp(4) NOT NULL DEFAULT current_timestamp(4) ON UPDATE current_timestamp(4) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -a timestamp(4) NO CURRENT_TIMESTAMP(4) on update CURRENT_TIMESTAMP +a timestamp(4) NO current_timestamp(4) on update current_timestamp(4) select table_name, column_name, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, datetime_precision, character_set_name, collation_name, column_type, column_key, extra from information_schema.columns where table_name='t1'; table_name t1 column_name a -column_default CURRENT_TIMESTAMP(4) +column_default current_timestamp(4) is_nullable NO data_type timestamp character_maximum_length NULL @@ -84,7 +84,7 @@ character_set_name NULL collation_name NULL column_type timestamp(4) column_key -extra on update CURRENT_TIMESTAMP +extra on update current_timestamp(4) select a, a+interval 9876543 microsecond from t1; a a+interval 9876543 microsecond 2010-12-11 01:02:03.4567 2010-12-11 01:02:13.333243 @@ -109,12 +109,12 @@ create table t3 like t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` timestamp(4) NOT NULL DEFAULT CURRENT_TIMESTAMP(4) ON UPDATE CURRENT_TIMESTAMP(4) + `a` timestamp(4) NOT NULL DEFAULT current_timestamp(4) ON UPDATE current_timestamp(4) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show create table t3; Table Create Table t3 CREATE TABLE `t3` ( - `a` timestamp(4) NOT NULL DEFAULT CURRENT_TIMESTAMP(4) ON UPDATE CURRENT_TIMESTAMP(4) + `a` timestamp(4) NOT NULL DEFAULT current_timestamp(4) ON UPDATE current_timestamp(4) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t2, t3; insert t1 values ('2010-12-13 14:15:16.222222'); @@ -130,7 +130,7 @@ create table t3 select max(a), min(a), sum(a), avg(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` timestamp(4) NOT NULL DEFAULT CURRENT_TIMESTAMP(4) ON UPDATE CURRENT_TIMESTAMP(4), + `a` timestamp(4) NOT NULL DEFAULT current_timestamp(4) ON UPDATE current_timestamp(4), `a+0` decimal(25,4) NOT NULL, `a-1` decimal(25,4) NOT NULL, `a*1` decimal(25,4) NOT NULL, @@ -276,13 +276,13 @@ create or replace table t1 (a timestamp(5) default current_timestamp); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(5) NOT NULL DEFAULT CURRENT_TIMESTAMP(5) + `a` timestamp(5) NOT NULL DEFAULT current_timestamp(5) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 create or replace table t1 (a timestamp(5) default current_timestamp()); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(5) NOT NULL DEFAULT CURRENT_TIMESTAMP(5) + `a` timestamp(5) NOT NULL DEFAULT current_timestamp(5) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 create or replace table t1 (a timestamp(5) default current_timestamp(2)); show create table t1; @@ -298,25 +298,25 @@ create or replace table t1 (a timestamp(5) default current_timestamp(5)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(5) NOT NULL DEFAULT CURRENT_TIMESTAMP(5) + `a` timestamp(5) NOT NULL DEFAULT current_timestamp(5) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 create or replace table t1 (a timestamp(5) default current_timestamp(6)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(5) NOT NULL DEFAULT CURRENT_TIMESTAMP(5) + `a` timestamp(5) NOT NULL DEFAULT current_timestamp(5) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 create or replace table t1 (a timestamp(5) on update current_timestamp); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE CURRENT_TIMESTAMP(5) + `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE current_timestamp(5) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 create or replace table t1 (a timestamp(5) on update current_timestamp()); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE CURRENT_TIMESTAMP(5) + `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE current_timestamp(5) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 create or replace table t1 (a timestamp(5) on update current_timestamp(3)); ERROR HY000: Invalid ON UPDATE clause for 'a' column @@ -324,12 +324,12 @@ create or replace table t1 (a timestamp(5) on update current_timestamp(5)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE CURRENT_TIMESTAMP(5) + `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE current_timestamp(5) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 create or replace table t1 (a timestamp(5) on update current_timestamp(6)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE CURRENT_TIMESTAMP(5) + `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE current_timestamp(5) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; diff --git a/mysql-test/r/type_uint.result b/mysql-test/r/type_uint.result index 10aa2f2f393..c970f2ff896 100644 --- a/mysql-test/r/type_uint.result +++ b/mysql-test/r/type_uint.result @@ -14,6 +14,25 @@ this 0 4294967295 drop table t1; +create table t1 (a bigint unsigned, b mediumint unsigned); +insert t1 values (1,2),(0xffffffffffffffff,0xffffff); +select coalesce(a,b), coalesce(b,a) from t1; +coalesce(a,b) coalesce(b,a) +1 2 +18446744073709551615 16777215 +create table t2 as select a from t1 union select b from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` bigint(20) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t2; +a +1 +18446744073709551615 +2 +16777215 +drop table t1, t2; # # Start of 10.0 tests # diff --git a/mysql-test/r/type_year.result b/mysql-test/r/type_year.result index 5d4aa24c9c6..93672abce44 100644 --- a/mysql-test/r/type_year.result +++ b/mysql-test/r/type_year.result @@ -410,7 +410,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND a>=2010; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 SELECT * FROM t1 WHERE a=2010 AND a>=10; a 2010 @@ -418,7 +418,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND a>=10; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 SELECT * FROM t1 WHERE a=10 AND a>=2010; a 2010 @@ -426,7 +426,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND a>=2010; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 SELECT * FROM t1 WHERE a=10 AND a>=10; a 2010 @@ -434,7 +434,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND a>=10; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 DROP TABLE t1; # # End of 10.1 tests diff --git a/mysql-test/r/udf.result b/mysql-test/r/udf.result index dc9806bb7d1..98aa2b50fc6 100644 --- a/mysql-test/r/udf.result +++ b/mysql-test/r/udf.result @@ -440,7 +440,7 @@ EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE f1=1 + myfunc_double(1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select 1 AS `1` from `test`.`t1` where (`test`.`t1`.`f1` = ((1 + myfunc_double(1 AS `1`)))) +Note 1003 select 1 AS `1` from `test`.`t1` where `test`.`t1`.`f1` = (1 + myfunc_double(1 AS `1`)) DROP FUNCTION myfunc_double; DROP TABLE t1; # @@ -457,7 +457,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) DEFAULT METAPHON(a) + `b` varchar(10) DEFAULT metaphon(`a` AS `a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('Hello'); SELECT * FROM t1; diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index a692af93b37..adaaf084a3d 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -1674,7 +1674,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 UNION t1 ALL NULL NULL NULL NULL 2 100.00 NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Using filesort Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by (`a` + 12) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by `a` + 12 # Should not crash SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY a + 12; a @@ -1713,7 +1713,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Using filesort 3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'a' of SELECT #3 was resolved in SELECT #-1 -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by <`a`>((select `a` from `test`.`t2` where (`test`.`t2`.`b` = 12))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by <`a`>((select `a` from `test`.`t2` where `test`.`t2`.`b` = 12)) # Should not crash SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY (SELECT a FROM t2 WHERE b = 12); diff --git a/mysql-test/r/upgrade.result b/mysql-test/r/upgrade.result index 74b888e49c5..887a53887fe 100644 --- a/mysql-test/r/upgrade.result +++ b/mysql-test/r/upgrade.result @@ -110,7 +110,7 @@ Database (%a-b-c%) a-b-c show create view `a-b-c`.v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `a`.`f1` AS `f1` from (`a-b-c`.`t1` `a` join `information_schema`.`tables` `b`) where (convert(`a`.`f1` using utf8) = `b`.`TABLE_NAME`) utf8 utf8_general_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `a`.`f1` AS `f1` from (`a-b-c`.`t1` `a` join `information_schema`.`tables` `b`) where convert(`a`.`f1` using utf8) = `b`.`TABLE_NAME` utf8 utf8_general_ci select * from `a-b-c`.v1; f1 drop database `a-b-c`; diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index 6c2a331d66b..d6762e5a1c5 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -77,7 +77,7 @@ explain extended select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select (@t1:=((@t2:=1) + (@t3:=4))) AS `@t1:=(@t2:=1)+@t3:=4`,(@`t1`) AS `@t1`,(@`t2`) AS `@t2`,(@`t3`) AS `@t3` +Note 1003 select @t1:=(@t2:=1) + (@t3:=4) AS `@t1:=(@t2:=1)+@t3:=4`,@`t1` AS `@t1`,@`t2` AS `@t2`,@`t3` AS `@t3` select @t5; @t5 1.23456 @@ -1801,3 +1801,23 @@ select * from information_schema.session_variables where variable_name='sql_mode VARIABLE_NAME VARIABLE_VALUE SQL_MODE ANSI_QUOTES End of 5.5 tests +explain extended select @@VERsion from dual where rand() > @@verSION; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select @@VERsion AS "@@VERsion" from DUAL where rand() > @@version +explain extended select @@SESsion.SQL_mode from dual where rand() > @@sesSION.sql_MODE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select @@SESsion.SQL_mode AS "@@SESsion.SQL_mode" from DUAL where rand() > @@sql_mode +explain extended select @@GLObal.COLLATION_connection from dual where rand() > @@gloBAL.collation_CONNECTION; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select @@GLObal.COLLATION_connection AS "@@GLObal.COLLATION_connection" from DUAL where rand() > @@global.collation_connection +explain extended select @@FOObar.KEY_BUFfer_size from dual where rand() > @@fooBAR.key_bufFER_SIZE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select @@FOObar.KEY_BUFfer_size AS "@@FOObar.KEY_BUFfer_size" from DUAL where rand() > @@fooBAR.key_buffer_size diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index f615b10c59c..78cb251ad11 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -40,10 +40,10 @@ c 11 show create table v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`b` + 1 AS `c` from `t1` latin1 latin1_swedish_ci show create view v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`b` + 1 AS `c` from `t1` latin1 latin1_swedish_ci show create view t1; ERROR HY000: 'test.t1' is not VIEW drop table t1; @@ -59,11 +59,11 @@ explain extended select c from v1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Warnings: -Note 1003 select (`test`.`t1`.`b` + 1) AS `c` from `test`.`t1` +Note 1003 select `test`.`t1`.`b` + 1 AS `c` from `test`.`t1` create algorithm=temptable view v2 (c) as select b+1 from t1; show create view v2; View Create View character_set_client collation_connection -v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci +v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`b` + 1 AS `c` from `t1` latin1 latin1_swedish_ci select c from v2; c 3 @@ -93,7 +93,7 @@ explain extended select c from v3; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Warnings: -Note 1003 select ((`test`.`t1`.`b` + 1) + 1) AS `c` from `test`.`t1` +Note 1003 select `test`.`t1`.`b` + 1 + 1 AS `c` from `test`.`t1` create algorithm=temptable view v4 (c) as select c+1 from v2; select c from v4; c @@ -122,7 +122,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY ALL NULL NULL NULL NULL 5 100.00 3 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 Warnings: -Note 1003 select (`v2`.`c` + 1) AS `c` from `test`.`v2` +Note 1003 select `v2`.`c` + 1 AS `c` from `test`.`v2` create algorithm=temptable view v6 (c) as select c+1 from v1; select c from v6; c @@ -392,7 +392,7 @@ explain extended select * from v1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`b` AS `c` from `test`.`t1` where (`test`.`t1`.`a` < 3) +Note 1003 select `test`.`t1`.`b` AS `c` from `test`.`t1` where `test`.`t1`.`a` < 3 update v1 set c=c+1; select * from t1; a b @@ -793,7 +793,7 @@ a b 1 1 show create view v3; View Create View character_set_client collation_connection -v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `v1`.`col1` AS `a`,`v2`.`col1` AS `b` from (`v1` join `v2`) where (`v1`.`col1` = `v2`.`col1`) latin1 latin1_swedish_ci +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `v1`.`col1` AS `a`,`v2`.`col1` AS `b` from (`v1` join `v2`) where `v1`.`col1` = `v2`.`col1` latin1 latin1_swedish_ci drop view v3, v2, v1; drop table t2, t1; create function `f``1` () returns int return 5; @@ -817,10 +817,10 @@ create table t2 (col1 char collate latin1_german2_ci); create view v2 as select col1 collate latin1_german1_ci from t2; show create view v2; View Create View character_set_client collation_connection -v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t2`.`col1` collate latin1_german1_ci) AS `col1 collate latin1_german1_ci` from `t2` latin1 latin1_swedish_ci +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t2`.`col1` collate latin1_german1_ci AS `col1 collate latin1_german1_ci` from `t2` latin1 latin1_swedish_ci show create view v2; View Create View character_set_client collation_connection -v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t2`.`col1` collate latin1_german1_ci) AS `col1 collate latin1_german1_ci` from `t2` latin1 latin1_swedish_ci +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t2`.`col1` collate latin1_german1_ci AS `col1 collate latin1_german1_ci` from `t2` latin1 latin1_swedish_ci drop view v2; drop table t2; create table t1 (a int); @@ -1447,7 +1447,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`t1` left join `test`.`t2` on((`test`.`t2`.`a` = `test`.`t3`.`a`))) on((`test`.`t1`.`a` = `test`.`t3`.`a`)) where 1 +Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`t1` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`t3`.`a`)) on(`test`.`t1`.`a` = `test`.`t3`.`a`) where 1 create view v1 (a) as select a from t1; create view v2 (a) as select a from t2; create view v4 (a,b) as select v1.a as a, v2.a as b from v1 left join v2 on (v1.a=v2.a); @@ -1462,7 +1462,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`t1` left join (`test`.`t2`) on((`test`.`t2`.`a` = `test`.`t3`.`a`))) on((`test`.`t1`.`a` = `test`.`t3`.`a`)) where 1 +Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`t1` left join (`test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`)) on(`test`.`t1`.`a` = `test`.`t3`.`a`) where 1 prepare stmt1 from "select * from t3 left join v4 on (t3.a = v4.a);"; execute stmt1; a a b @@ -1920,24 +1920,24 @@ create table t2 (b timestamp default now()); create view v1 as select a,b,t1.a < now() from t1,t2 where t1.a < now(); SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t2`.`b` AS `b`,(`t1`.`a` < now()) AS `t1.a < now()` from (`t1` join `t2`) where (`t1`.`a` < now()) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t2`.`b` AS `b`,`t1`.`a` < current_timestamp() AS `t1.a < now()` from (`t1` join `t2`) where `t1`.`a` < current_timestamp() latin1 latin1_swedish_ci drop view v1; drop table t1, t2; CREATE TABLE t1 ( a varchar(50) ); CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = CURRENT_USER(); SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` = current_user()) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where `t1`.`a` = current_user() latin1 latin1_swedish_ci DROP VIEW v1; CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = VERSION(); SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` = version()) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where `t1`.`a` = version() latin1 latin1_swedish_ci DROP VIEW v1; CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = DATABASE(); SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` = database()) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where `t1`.`a` = database() latin1 latin1_swedish_ci DROP VIEW v1; DROP TABLE t1; CREATE TABLE t1 (col1 time); @@ -2712,7 +2712,7 @@ SELECT id, date(d) + INTERVAL TIME_TO_SEC(d) SECOND AS t, COUNT(*) FROM t1 GROUP BY id, t; SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`id` AS `id`,(cast(`t1`.`d` as date) + interval time_to_sec(`t1`.`d`) second) AS `t`,count(0) AS `COUNT(*)` from `t1` group by `t1`.`id`,(cast(`t1`.`d` as date) + interval time_to_sec(`t1`.`d`) second) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`id` AS `id`,cast(`t1`.`d` as date) + interval time_to_sec(`t1`.`d`) second AS `t`,count(0) AS `COUNT(*)` from `t1` group by `t1`.`id`,cast(`t1`.`d` as date) + interval time_to_sec(`t1`.`d`) second latin1 latin1_swedish_ci SELECT * FROM v1; id t COUNT(*) DROP VIEW v1; @@ -2741,7 +2741,7 @@ SELECT (year(test_date)-year(DOB)) AS Age FROM t1 HAVING Age < 75; SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (year(`t1`.`test_date`) - year(`t1`.`DOB`)) AS `Age` from `t1` having (`Age` < 75) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select year(`t1`.`test_date`) - year(`t1`.`DOB`) AS `Age` from `t1` having `Age` < 75 latin1 latin1_swedish_ci SELECT (year(test_date)-year(DOB)) AS Age FROM t1 HAVING Age < 75; Age 43 @@ -2948,7 +2948,7 @@ create table t1 (f1 datetime); create view v1 as select * from t1 where f1 between now() and now() + interval 1 minute; show create view v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` where (`t1`.`f1` between now() and (now() + interval 1 minute)) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` where `t1`.`f1` between current_timestamp() and current_timestamp() + interval 1 minute latin1 latin1_swedish_ci drop view v1; drop table t1; DROP TABLE IF EXISTS t1; @@ -3025,7 +3025,7 @@ SHOW WARNINGS; Level Code Message SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`pk` AS `pk` from (`t1` join `t2` on(((`t2`.`fk` = `t1`.`pk`) and (`t2`.`ver` = (select max(`t`.`ver`) from `t2` `t` where (`t`.`org` = `t2`.`org`)))))) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`pk` AS `pk` from (`t1` join `t2` on(`t2`.`fk` = `t1`.`pk` and `t2`.`ver` = (select max(`t`.`ver`) from `t2` `t` where `t`.`org` = `t2`.`org`))) latin1 latin1_swedish_ci DROP VIEW v1; DROP TABLE t1, t2; DROP FUNCTION IF EXISTS f1; @@ -3089,7 +3089,7 @@ DROP TABLE t1; CREATE VIEW v AS SELECT !0 * 5 AS x FROM DUAL; SHOW CREATE VIEW v; View Create View character_set_client collation_connection -v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select ((not(0)) * 5) AS `x` latin1 latin1_swedish_ci +v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select !0 * 5 AS `x` latin1 latin1_swedish_ci SELECT !0 * 5 AS x FROM DUAL; x 5 @@ -3323,7 +3323,7 @@ a IS NOT FALSE int(1) NO 0 old_isnotfalse int(1) NO 0 show create view view_24532_b; View Create View character_set_client collation_connection -view_24532_b CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_24532_b` AS select (`table_24532`.`a` is true) AS `a IS TRUE`,if(ifnull(`table_24532`.`a`,0),1,0) AS `old_istrue`,(`table_24532`.`a` is not true) AS `a IS NOT TRUE`,if(ifnull(`table_24532`.`a`,0),0,1) AS `old_isnottrue`,(`table_24532`.`a` is false) AS `a IS FALSE`,if(ifnull(`table_24532`.`a`,1),0,1) AS `old_isfalse`,(`table_24532`.`a` is not false) AS `a IS NOT FALSE`,if(ifnull(`table_24532`.`a`,1),1,0) AS `old_isnotfalse` from `table_24532` latin1 latin1_swedish_ci +view_24532_b CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_24532_b` AS select `table_24532`.`a` is true AS `a IS TRUE`,if(ifnull(`table_24532`.`a`,0),1,0) AS `old_istrue`,`table_24532`.`a` is not true AS `a IS NOT TRUE`,if(ifnull(`table_24532`.`a`,0),0,1) AS `old_isnottrue`,`table_24532`.`a` is false AS `a IS FALSE`,if(ifnull(`table_24532`.`a`,1),0,1) AS `old_isfalse`,`table_24532`.`a` is not false AS `a IS NOT FALSE`,if(ifnull(`table_24532`.`a`,1),1,0) AS `old_isnotfalse` from `table_24532` latin1 latin1_swedish_ci insert into table_24532 values (0, 0, 0, 0); select * from view_24532_b; a IS TRUE old_istrue a IS NOT TRUE old_isnottrue a IS FALSE old_isfalse a IS NOT FALSE old_isnotfalse @@ -3860,7 +3860,7 @@ CREATE TABLE t1 (c INT); CREATE VIEW v1 (view_column) AS SELECT c AS alias FROM t1 HAVING alias; SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`c` AS `view_column` from `t1` having (`view_column` <> 0) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`c` AS `view_column` from `t1` having `view_column` <> 0 latin1 latin1_swedish_ci SELECT * FROM v1; view_column @@ -4258,7 +4258,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 16 100.00 Using where 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`pk` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 8)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`pk` = `test`.`t1`.`a` and `test`.`t1`.`a` > 8 FLUSH STATUS; SELECT t1.a,t2.c FROM t1,t2 WHERE t2.pk = t1.a AND t2.pk > 8; a c @@ -4282,7 +4282,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 16 100.00 Using where 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`pk` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 8)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`pk` = `test`.`t1`.`a` and `test`.`t1`.`a` > 8 FLUSH STATUS; SELECT t1.a,v.c FROM t1,v WHERE v.pk = t1.a AND v.pk > 8; a c @@ -4341,7 +4341,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where (((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 3)) or ((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t1`.`b` >= 4))) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`a` < 3 or `test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t1`.`b` >= 4 create view v1 as select * from t2; select * from t1,v1 where v1.c=t1.a and v1.c < 3 or v1.c=t1.b and v1.c >=4; a b c @@ -4355,7 +4355,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where (((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 3)) or ((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t1`.`b` >= 4))) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`a` < 3 or `test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t1`.`b` >= 4 create view v2 as select * from v1; select * from t1,v2 where v2.c=t1.a and v2.c < 3 or v2.c=t1.b and v2.c >=4; a b c @@ -4369,7 +4369,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where (((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 3)) or ((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t1`.`b` >= 4))) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`a` < 3 or `test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t1`.`b` >= 4 create view v3 as select * from t1; select * from v3,v2 where v2.c=v3.a and v2.c < 3 or v2.c=v3.b and v2.c >=4; a b c @@ -4383,7 +4383,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where (((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 3)) or ((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t1`.`b` >= 4))) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`a` < 3 or `test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t1`.`b` >= 4 drop view v1,v2,v3; drop table t1,t2; # @@ -4406,7 +4406,7 @@ SELECT * FROM v1 WHERE a > -1 OR a > 6 AND a = 3; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 7 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > -1) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > -1 SELECT * FROM v1 WHERE a > -1 OR a AND a = 0; a 2 @@ -4421,7 +4421,7 @@ SELECT * FROM v1 WHERE a > -1 OR a AND a = 0; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 7 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > -1) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > -1 CREATE VIEW v2 AS SELECT * FROM v1; SELECT * FROM v2 WHERE a > -1 OR a AND a = 0; a @@ -4437,7 +4437,7 @@ SELECT * FROM v2 WHERE a > -1 OR a AND a = 0; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 7 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > -1) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > -1 DROP VIEW v1,v2; DROP TABLE t1; CREATE TABLE t1 (a varchar(10), KEY (a)) ; @@ -4463,13 +4463,13 @@ SELECT * FROM v1 WHERE a > 'JJ' OR a <> 0 AND a = 'VV'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range a a 13 NULL 4 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` > 'JJ') or ((`test`.`t1`.`a` = 'VV') and (`test`.`t1`.`a` <> 0))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 'JJ' or `test`.`t1`.`a` = 'VV' and `test`.`t1`.`a` <> 0 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > 'JJ' OR a <> 0 AND a = 'VV'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range a a 13 NULL 4 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` > 'JJ') or ((`test`.`t1`.`a` = 'VV') and (`test`.`t1`.`a` <> 0))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 'JJ' or `test`.`t1`.`a` = 'VV' and `test`.`t1`.`a` <> 0 # t1 and v1 should return the same result set SELECT * FROM v1 WHERE a > 'JJ' OR a AND a = 'VV'; a @@ -4489,13 +4489,13 @@ SELECT * FROM v1 WHERE a > 'JJ' OR a AND a = 'VV'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range a a 13 NULL 4 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` > 'JJ') or ((`test`.`t1`.`a` = 'VV') and (`test`.`t1`.`a` <> 0))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 'JJ' or `test`.`t1`.`a` = 'VV' and `test`.`t1`.`a` <> 0 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > 'JJ' OR a AND a = 'VV'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range a a 13 NULL 4 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` > 'JJ') or ((`test`.`t1`.`a` = 'VV') and (`test`.`t1`.`a` <> 0))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 'JJ' or `test`.`t1`.`a` = 'VV' and `test`.`t1`.`a` <> 0 DROP VIEW v1; DROP TABLE t1; # @@ -4564,7 +4564,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1` left join `test`.`t2` on((`test`.`t2`.`a` = `test`.`t1`.`a`)) where ((`test`.`t1`.`b` = 1) or ((`test`.`t1`.`a` = 'a') and (length(`test`.`t1`.`a`) >= `test`.`t1`.`b`))) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`t1`.`a`) where `test`.`t1`.`b` = 1 or `test`.`t1`.`a` = 'a' and length(`test`.`t1`.`a`) >= `test`.`t1`.`b` DROP VIEW v1; DROP TABLE t1,t2; # Bug#798625: duplicate of the previous one, but without crash @@ -4671,7 +4671,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where (not(<10,`test`.`t1`.`a`>((10,(select NULL from `test`.`t4` where ((`test`.`t4`.`a` >= `test`.`t1`.`a`) and trigcond((((10) = NULL) or (isnull(NULL))))) having trigcond((NULL))))))) +Note 1003 select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where !<10,`test`.`t1`.`a`>((10,(select NULL from `test`.`t4` where `test`.`t4`.`a` >= `test`.`t1`.`a` and trigcond((10) = NULL or (NULL is null)) having trigcond(NULL is null)))) SELECT * FROM t1, t2 WHERE t2.a NOT IN (SELECT t3.b FROM t3 RIGHT JOIN t4 ON (t4.a = t3.a) WHERE t4.a >= t1.a); @@ -4687,7 +4687,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'v1.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where (not(<10,`test`.`t1`.`a`>((10,(select NULL from `test`.`t4` where ((`test`.`t4`.`a` >= `test`.`t1`.`a`) and trigcond((((10) = NULL) or (isnull(NULL))))) having trigcond((NULL))))))) +Note 1003 select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where !<10,`test`.`t1`.`a`>((10,(select NULL from `test`.`t4` where `test`.`t4`.`a` >= `test`.`t1`.`a` and trigcond((10) = NULL or (NULL is null)) having trigcond(NULL is null)))) SELECT * FROM v1, t2 WHERE t2.a NOT IN (SELECT t3.b FROM t3 RIGHT JOIN t4 ON (t4.a = t3.a) WHERE t4.a >= v1.a); @@ -4718,7 +4718,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: Note 1276 Field or reference 'test.t4.b' of SELECT #2 was resolved in SELECT #1 -Note 1003 select 0 AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t4` where (`test`.`t4`.`c` <= <`test`.`t4`.`b`>((select 0 from dual where (7 > `test`.`t4`.`b`)))) +Note 1003 select 0 AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t4` where `test`.`t4`.`c` <= <`test`.`t4`.`b`>((select 0 from dual where 7 > `test`.`t4`.`b`)) SELECT * FROM t3 , t4 WHERE t4.c <= (SELECT t2.e FROM t2 LEFT JOIN t1 ON ( t1.a = t2.d ) WHERE t2.b > t4.b); @@ -4735,7 +4735,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: Note 1276 Field or reference 'v4.b' of SELECT #2 was resolved in SELECT #1 -Note 1003 select 0 AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t4` where (`test`.`t4`.`c` <= <`test`.`t4`.`b`>((select 0 from dual where (7 > `test`.`t4`.`b`)))) +Note 1003 select 0 AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t4` where `test`.`t4`.`c` <= <`test`.`t4`.`b`>((select 0 from dual where 7 > `test`.`t4`.`b`)) SELECT * FROM t3, v4 WHERE v4.c <= (SELECT t2.e FROM t2 LEFT JOIN t1 ON ( t1.a = t2.d ) WHERE t2.b > v4.b); @@ -4792,21 +4792,24 @@ DROP TABLE t1, t2; # Bug#48315 Metadata lock is not taken for merged views that # use an INFORMATION_SCHEMA table # -DROP TABLE IF EXISTS t1; DROP VIEW IF EXISTS v1; DROP PROCEDURE IF EXISTS p1; connect con2, localhost, root; connect con3, localhost, root; connection default; CREATE VIEW v1 AS SELECT schema_name FROM information_schema.schemata; -CREATE TABLE t1 (str VARCHAR(50)); -CREATE PROCEDURE p1() INSERT INTO t1 SELECT * FROM v1; +CREATE PROCEDURE p1() SELECT COUNT(*), GET_LOCK('blocker', 100) FROM v1; # CALL p1() so the view is merged. CALL p1(); +SELECT RELEASE_LOCK('blocker'); +RELEASE_LOCK('blocker') +1 connection con3; -LOCK TABLE t1 READ; +SELECT GET_LOCK('blocker', 100); +GET_LOCK('blocker', 100) +1 connection default; -# Try to CALL p1() again, this time it should block for t1. +# Try to CALL p1() again, this time it should block on "blocker". # Sending: CALL p1(); connection con2; @@ -4815,14 +4818,18 @@ connection con2; DROP VIEW v1; connection con3; # Now allow CALL p1() to complete -UNLOCK TABLES; +SELECT RELEASE_LOCK('blocker'); +RELEASE_LOCK('blocker') +1 connection default; # Reaping: CALL p1() +SELECT RELEASE_LOCK('blocker'); +RELEASE_LOCK('blocker') +1 connection con2; # Reaping: DROP VIEW v1 connection default; DROP PROCEDURE p1; -DROP TABLE t1; disconnect con2; disconnect con3; # @@ -5496,15 +5503,15 @@ create table t1 (a int, b int); create algorithm=temptable view v2 (c) as select b+1 from t1; show create view v2; View Create View character_set_client collation_connection -v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci +v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`b` + 1 AS `c` from `t1` latin1 latin1_swedish_ci alter algorithm=undefined view v2 (c) as select b+1 from t1; show create view v2; View Create View character_set_client collation_connection -v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`b` + 1 AS `c` from `t1` latin1 latin1_swedish_ci alter algorithm=merge view v2 (c) as select b+1 from t1; show create view v2; View Create View character_set_client collation_connection -v2 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci +v2 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`b` + 1 AS `c` from `t1` latin1 latin1_swedish_ci drop view v2; drop table t1; # @@ -5594,7 +5601,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 6 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2 -Note 1003 select `test`.`t1`.`a` AS `a`,(select max(`test`.`t2`.`b`) from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) AS `c` from `test`.`t1` +Note 1003 select `test`.`t1`.`a` AS `a`,(select max(`test`.`t2`.`b`) from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) AS `c` from `test`.`t1` select * from v1; a c 1 2 @@ -5611,7 +5618,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 6 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2 -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t1`.`a` AS `a`,(select max(`test`.`t2`.`b`) from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) AS `c` from `test`.`t2` join `test`.`t1` where (`test`.`t1`.`a` = `test`.`t2`.`a`) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t1`.`a` AS `a`,(select max(`test`.`t2`.`b`) from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) AS `c` from `test`.`t2` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t2`.`a` select * from t2, v1 where t2.a=v1.a; a b a c 1 2 1 2 @@ -5630,7 +5637,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 6 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2 -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`a` AS `a`,(select max(`test`.`t2`.`b`) from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) AS `c` from `test`.`t1` join `test`.`t1` where (`test`.`t1`.`a` = `test`.`t1`.`a`) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`a` AS `a`,(select max(`test`.`t2`.`b`) from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) AS `c` from `test`.`t1` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t1`.`a` select * from t1, v1 where t1.a=v1.a; a b a c 1 2 1 2 @@ -5649,7 +5656,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 6 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2 -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`a` AS `a`,(select max(`test`.`t2`.`b`) from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) AS `c` from `test`.`t1` join `test`.`t1` where (`test`.`t1`.`b` = (select max(`test`.`t2`.`b`) from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`a` AS `a`,(select max(`test`.`t2`.`b`) from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) AS `c` from `test`.`t1` join `test`.`t1` where `test`.`t1`.`b` = (select max(`test`.`t2`.`b`) from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) select * from t1, v1 where t1.b=v1.c; a b a c 1 2 1 2 @@ -5667,7 +5674,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 6 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2 -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`a` AS `a`,(select max(`test`.`t2`.`b`) from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) AS `c` from `test`.`t2` join `test`.`t1` join `test`.`t1` where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`a` = `test`.`t2`.`a`)) +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`a` AS `a`,(select max(`test`.`t2`.`b`) from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) AS `c` from `test`.`t2` join `test`.`t1` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`a` = `test`.`t2`.`a` select * from t2, t1, v1 where t1.a=t2.a and t1.a=v1.a; a b a b a c 1 2 1 2 1 2 @@ -6241,7 +6248,7 @@ INSERT INTO t3 VALUES (1),(8); CREATE VIEW v1 AS SELECT * FROM t1 LEFT JOIN ( SELECT t2.* FROM t2 INNER JOIN t3 ON ( k = j ) ) AS alias1 ON ( i = j ); show create view v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i`,`alias1`.`j` AS `j` from (`test`.`t1` left join (select `test`.`t2`.`j` AS `j` from (`test`.`t2` join `test`.`t3` on((`test`.`t3`.`k` = `test`.`t2`.`j`)))) `alias1` on((`test`.`t1`.`i` = `alias1`.`j`))) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i`,`alias1`.`j` AS `j` from (`test`.`t1` left join (select `test`.`t2`.`j` AS `j` from (`test`.`t2` join `test`.`t3` on(`test`.`t3`.`k` = `test`.`t2`.`j`))) `alias1` on(`test`.`t1`.`i` = `alias1`.`j`)) latin1 latin1_swedish_ci SELECT * FROM t1 LEFT JOIN ( SELECT t2.* FROM t2 INNER JOIN t3 ON ( k = j ) ) AS alias1 ON ( i = j ); i j 3 NULL @@ -6278,5 +6285,19 @@ a DROP VIEW v1; DROP TABLE t1; # +# MDEV-10724:Assertion `vcol_table == 0 || vcol_table == table' +# failed in fill_record(THD*, TABLE*, List&, List&, +# bool, bool) +# +CREATE TABLE t1 (f1 INT); +CREATE TABLE t2 (f2 INT); +CREATE TABLE t3 (f3 INT); +CREATE ALGORITHM = MERGE VIEW v AS SELECT f1, f3 FROM t1, +( SELECT f3 FROM t2, t3 ) AS sq; +INSERT INTO v (f1, f3) VALUES (1,1), (2,2); +ERROR HY000: Can not modify more than one base table through a join view 'test.v' +drop view v; +drop tables t1,t2,t3; +# # End of 10.2 tests # diff --git a/mysql-test/r/view_alias.result b/mysql-test/r/view_alias.result index e07b40dba13..f3ae7aef3a6 100644 --- a/mysql-test/r/view_alias.result +++ b/mysql-test/r/view_alias.result @@ -90,7 +90,7 @@ CREATE TABLE t2 LIKE t1; # Test alias in subquery CREATE VIEW v1 AS SELECT a FROM t1 WHERE EXISTS (SELECT 1 FROM t2 AS b WHERE b.a = 0); DROP VIEW v1; -CREATE VIEW v1 AS select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(select 1 from `test`.`t2` `b` where (`b`.`a` = 0)); +CREATE VIEW v1 AS select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(select 1 from `test`.`t2` `b` where `b`.`a` = 0); DROP VIEW v1; # Test column alias in subquery CREATE VIEW v1 AS SELECT a FROM t1 WHERE EXISTS (SELECT a AS alias FROM t1 GROUP BY alias); diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result index 948e88a1804..04ad19c5ddc 100644 --- a/mysql-test/r/view_grant.result +++ b/mysql-test/r/view_grant.result @@ -132,7 +132,7 @@ grant select on mysqltest.v5 to mysqltest_1@localhost; connection user1; show create view mysqltest.v5; View Create View character_set_client collation_connection -v5 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v5` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci +v5 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v5` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci explain select c from mysqltest.v1; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v1; @@ -147,7 +147,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found show create view mysqltest.v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci explain select c from mysqltest.v2; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v2; @@ -170,24 +170,24 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found show create view mysqltest.v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci explain select c from mysqltest.v2; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY system NULL NULL NULL NULL 0 const row not found 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table show create view mysqltest.v2; View Create View character_set_client collation_connection -v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v2` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci +v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v2` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci explain select c from mysqltest.v3; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v3; View Create View character_set_client collation_connection -v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v3` AS select (`mysqltest`.`t2`.`a` + 1) AS `c`,(`mysqltest`.`t2`.`b` + 1) AS `d` from `mysqltest`.`t2` latin1 latin1_swedish_ci +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v3` AS select `mysqltest`.`t2`.`a` + 1 AS `c`,`mysqltest`.`t2`.`b` + 1 AS `d` from `mysqltest`.`t2` latin1 latin1_swedish_ci explain select c from mysqltest.v4; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v4; View Create View character_set_client collation_connection -v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v4` AS select (`mysqltest`.`t2`.`a` + 1) AS `c`,(`mysqltest`.`t2`.`b` + 1) AS `d` from `mysqltest`.`t2` latin1 latin1_swedish_ci +v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v4` AS select `mysqltest`.`t2`.`a` + 1 AS `c`,`mysqltest`.`t2`.`b` + 1 AS `d` from `mysqltest`.`t2` latin1 latin1_swedish_ci connection root; revoke all privileges on mysqltest.* from mysqltest_1@localhost; drop user mysqltest_1@localhost; diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result index 746ce5a2e59..c8c55b91016 100644 --- a/mysql-test/r/win.result +++ b/mysql-test/r/win.result @@ -1497,7 +1497,7 @@ EXPLAIN { "query_block": { "select_id": 1, - "having_condition": "(MX in (3,5,7))", + "having_condition": "MX in (3,5,7)", "filesort": { "sort_key": "t1.b", "window_functions_computation": { @@ -2275,7 +2275,7 @@ rows between 1 preceding and 2 following) as CNT from t1; show create view v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`pk` AS `pk`,`t1`.`c` AS `c`,(`t1`.`c` / count(0) over ( partition by `t1`.`c` order by `t1`.`pk` rows between 1 preceding and 2 following )) AS `CNT` from `t1` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`pk` AS `pk`,`t1`.`c` AS `c`,`t1`.`c` / count(0) over ( partition by `t1`.`c` order by `t1`.`pk` rows between 1 preceding and 2 following ) AS `CNT` from `t1` latin1 latin1_swedish_ci select * from v1; pk c CNT 1 1 0.3333 @@ -2305,7 +2305,7 @@ create view v2 as select pk, c, c/count(*) over w1 as CNT from t1 window w1 as (partition by c order by pk rows between 1 preceding and 2 following); show create view v2; View Create View character_set_client collation_connection -v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`pk` AS `pk`,`t1`.`c` AS `c`,(`t1`.`c` / count(0) over ( partition by `t1`.`c` order by `t1`.`pk` rows between 1 preceding and 2 following )) AS `CNT` from `t1` latin1 latin1_swedish_ci +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`pk` AS `pk`,`t1`.`c` AS `c`,`t1`.`c` / count(0) over ( partition by `t1`.`c` order by `t1`.`pk` rows between 1 preceding and 2 following ) AS `CNT` from `t1` latin1 latin1_swedish_ci select * from v2; pk c CNT 1 1 0.3333 @@ -2335,7 +2335,7 @@ create view v3 as select pk, c, c/count(*) over w1 as CNT from t1 window w1 as (partition by c order by pk rows unbounded preceding); show create view v3; View Create View character_set_client collation_connection -v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`pk` AS `pk`,`t1`.`c` AS `c`,(`t1`.`c` / count(0) over ( partition by `t1`.`c` order by `t1`.`pk` rows between unbounded preceding and current row )) AS `CNT` from `t1` latin1 latin1_swedish_ci +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`pk` AS `pk`,`t1`.`c` AS `c`,`t1`.`c` / count(0) over ( partition by `t1`.`c` order by `t1`.`pk` rows between unbounded preceding and current row ) AS `CNT` from `t1` latin1 latin1_swedish_ci select * from v3; pk c CNT 1 1 1.0000 @@ -2367,7 +2367,7 @@ range between 3 preceding and current row) as CNT from t1; show create view v4; View Create View character_set_client collation_connection -v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`pk` AS `pk`,`t1`.`c` AS `c`,(`t1`.`c` / count(0) over ( partition by `t1`.`c` order by `t1`.`pk` range between 3 preceding and current row )) AS `CNT` from `t1` latin1 latin1_swedish_ci +v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`pk` AS `pk`,`t1`.`c` AS `c`,`t1`.`c` / count(0) over ( partition by `t1`.`c` order by `t1`.`pk` range between 3 preceding and current row ) AS `CNT` from `t1` latin1 latin1_swedish_ci select * from v4; pk c CNT 1 1 1.0000 diff --git a/mysql-test/r/xtradb_mrr.result b/mysql-test/r/xtradb_mrr.result index c238d0530af..db90ada8053 100644 --- a/mysql-test/r/xtradb_mrr.result +++ b/mysql-test/r/xtradb_mrr.result @@ -313,7 +313,7 @@ from t1 A, t1 B, t1 C; explain select count(length(a) + length(filler)) from t2 force index (a) where a>='a-1000-a' and a <'a-1001-a'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 9 NULL 99 Using index condition; Rowid-ordered scan +1 SIMPLE t2 range a a 9 NULL 100 Using index condition; Rowid-ordered scan select count(length(a) + length(filler)) from t2 force index (a) where a>='a-1000-a' and a <'a-1001-a'; count(length(a) + length(filler)) 100 diff --git a/mysql-test/std_data/keys2.txt b/mysql-test/std_data/keys2.txt index aa1600b894d..5b98fbeebd2 100644 --- a/mysql-test/std_data/keys2.txt +++ b/mysql-test/std_data/keys2.txt @@ -4,3 +4,4 @@ 4;205379930183490D3BECA139BDF4DB5B 5;E2D944D5D837A1DCB22FF7FD397892EE 6;BAFE99B0BB87F2CD33A6AF26A11F6BD1 +19;678D6B0063824BACCE33224B385104B35F30FF5749F0EBC030A0955DBC7FAC34 diff --git a/mysql-test/std_data/ldml/Index.xml b/mysql-test/std_data/ldml/Index.xml index 55e754c7009..0435b2ab689 100644 --- a/mysql-test/std_data/ldml/Index.xml +++ b/mysql-test/std_data/ldml/Index.xml @@ -1167,6 +1167,45 @@ + + + + C

\u010D

\u010C + H

ch

ChCH + R

\u0159

\u0158 + S

\u0161

\u0160 + Z

\u017E

\u017D +
+
+ + + + + C

\u010D

\u010C + H

ch

ChCH + R

\u0159

\u0158 + S

\u0161

\u0160 + Z

\u017E

\u017D +
+
+ + + + + + C

\u010D

\u010C + H

ch

ChCH + R

\u0159

\u0158 + S

\u0161

\u0160 + Z

\u017E

\u017D +
+
+ diff --git a/mysql-test/std_data/loaddata/mdev-11343.txt b/mysql-test/std_data/loaddata/mdev-11343.txt new file mode 100644 index 00000000000..dded1215ffa --- /dev/null +++ b/mysql-test/std_data/loaddata/mdev-11343.txt @@ -0,0 +1,12 @@ +\ä +\äx +x\ä +x\äx +\ê™  +\ê™ x +x\ê™  +x\ê™ x +\😎 +\😎x +x\😎 +x\😎x diff --git a/mysql-test/suite.pm b/mysql-test/suite.pm index cc735638be9..f501e610e53 100644 --- a/mysql-test/suite.pm +++ b/mysql-test/suite.pm @@ -9,9 +9,10 @@ sub skip_combinations { # disable innodb/xtradb combinatons for configurations that were not built push @combinations, 'innodb_plugin' unless $ENV{HA_INNODB_SO}; - # if something is compiled in, it's xtradb. innodb is MODULE_ONLY: - push @combinations, 'xtradb' unless $::mysqld_variables{'innodb'} eq "ON"; - push @combinations, 'innodb'; + push @combinations, qw(xtradb innodb) unless $::mysqld_variables{'innodb'} eq "ON"; + + # unconditionally, for now in 10.2. Later it could check for xtradb I_S plugins + push @combinations, 'xtradb'; # XtraDB is RECOMPILE_FOR_EMBEDDED, ha_xtradb.so cannot work with embedded server push @combinations, 'xtradb_plugin' if not $ENV{HA_XTRADB_SO} diff --git a/mysql-test/suite/archive/partition_archive.result b/mysql-test/suite/archive/partition_archive.result index c4cccc03a04..1ed979f2c92 100644 --- a/mysql-test/suite/archive/partition_archive.result +++ b/mysql-test/suite/archive/partition_archive.result @@ -84,7 +84,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) */ + PARTITION BY HASH (a) drop table t1; CREATE TABLE t1(id MEDIUMINT NOT NULL AUTO_INCREMENT, f1 VARCHAR(25), @@ -109,7 +109,7 @@ t1 CREATE TABLE `t1` ( `f1` varchar(25) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=ARCHIVE AUTO_INCREMENT=101 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (id) + PARTITION BY RANGE (id) SUBPARTITION BY HASH (id) SUBPARTITIONS 2 (PARTITION pa1 VALUES LESS THAN (10) ENGINE = ARCHIVE, @@ -122,7 +122,7 @@ SUBPARTITIONS 2 PARTITION pa8 VALUES LESS THAN (80) ENGINE = ARCHIVE, PARTITION pa9 VALUES LESS THAN (90) ENGINE = ARCHIVE, PARTITION pa10 VALUES LESS THAN (100) ENGINE = ARCHIVE, - PARTITION pa11 VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE) */ + PARTITION pa11 VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE) select count(*) from t1; count(*) 100 @@ -138,8 +138,8 @@ t1 CREATE TABLE `t1` ( `fld1` int(11) NOT NULL, PRIMARY KEY (`fld1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (fld1) -PARTITIONS 5 */ + PARTITION BY HASH (fld1) +PARTITIONS 5 ALTER TABLE t1 ENGINE= ARCHIVE; ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options") #After the patch, the ENGINE is correctly displayed as MyISAM @@ -149,8 +149,8 @@ t1 CREATE TABLE `t1` ( `fld1` int(11) NOT NULL, PRIMARY KEY (`fld1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (fld1) -PARTITIONS 5 */ + PARTITION BY HASH (fld1) +PARTITIONS 5 #Cleanup. DROP TABLE t1; create database mysqltest1; diff --git a/mysql-test/suite/binlog/r/binlog_index.result b/mysql-test/suite/binlog/r/binlog_index.result index 8cdca861737..bb5d9ff74f1 100644 --- a/mysql-test/suite/binlog/r/binlog_index.result +++ b/mysql-test/suite/binlog/r/binlog_index.result @@ -1,9 +1,9 @@ call mtr.add_suppression('Attempting backtrace'); -call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to process registered files that would be purged.'); -call mtr.add_suppression('MSYQL_BIN_LOG::open failed to sync the index file'); +call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to process registered files that would be purged.'); +call mtr.add_suppression('MYSQL_BIN_LOG::open failed to sync the index file'); call mtr.add_suppression('Turning logging off for the whole duration of the MySQL server process.'); call mtr.add_suppression('Could not open .*'); -call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to clean registers before purging logs.'); +call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to clean registers before purging logs.'); flush tables; RESET MASTER; flush logs; diff --git a/mysql-test/suite/binlog/r/binlog_killed_simulate.result b/mysql-test/suite/binlog/r/binlog_killed_simulate.result index b2c9a6f212f..25b00bf8761 100644 --- a/mysql-test/suite/binlog/r/binlog_killed_simulate.result +++ b/mysql-test/suite/binlog/r/binlog_killed_simulate.result @@ -1,16 +1,10 @@ -drop table if exists t1,t2; create table t1 (a int) engine=MyISAM; insert into t1 set a=1; reset master; update t1 set a=2 /* will be "killed" after work has been done */; -select -(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog")) -is not null; -(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog")) -is not null -1 -select 1 /* must return 1 as query completed before got killed*/; -1 +set @a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"); +select @a like '%#%error_code=0%' /* must return 1 as query completed before got killed*/; +@a like '%#%error_code=0%' 1 create table t2 (a int, b int) ENGINE=MyISAM; reset master; @@ -22,14 +16,9 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=# master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t2` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, `b`) ;file_id=# master-bin.000001 # Query # # COMMIT -select -(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog")) -is not null; -(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog")) -is not null -1 -select 0 /* must return 0 to mean the killed query is in */; -0 +set @a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"); +select @a like '%#%error_code=0%' /* must return 0 to mean the killed query is in */; +@a like '%#%error_code=0%' 0 drop table t1,t2; end of the tests diff --git a/mysql-test/suite/binlog/r/binlog_row_annotate.result b/mysql-test/suite/binlog/r/binlog_row_annotate.result index ffd8c530a44..3da1d9877f4 100644 --- a/mysql-test/suite/binlog/r/binlog_row_annotate.result +++ b/mysql-test/suite/binlog/r/binlog_row_annotate.result @@ -1,3 +1,37 @@ +set @old_binlog_checksum=@@binlog_checksum; +set global binlog_checksum=NONE; +set sql_mode=""; +SET timestamp=1000000000; +RESET MASTER; +CREATE DATABASE test1; +CREATE TABLE test1.t1(a int); +CREATE DATABASE test2; +CREATE TABLE test2.t2(a int); +CREATE VIEW test2.v2 AS SELECT * FROM test2.t2; +CREATE DATABASE test3; +CREATE TABLE test3.t3(a int); +CREATE DATABASE xtest1; +CREATE TABLE xtest1.xt1(a int); +CREATE DATABASE xtest2; +CREATE TABLE xtest2.xt2(a int); +INSERT INTO test1.t1 VALUES (1), (2), (3); +SET SESSION binlog_annotate_row_events = ON; +INSERT INTO test2.t2 VALUES (1), (2), (3); +INSERT INTO test3.t3 VALUES (1), (2), (3); +DELETE test1.t1, test2.t2 +FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3 +WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3.a; +INSERT INTO xtest1.xt1 VALUES (1), (2), (3); +INSERT INTO test2.v2 VALUES (1), (2), (3); +DELETE xtest1.xt1, test2.t2 +FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3 +WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3.a; +INSERT INTO xtest1.xt1 VALUES (1), (2), (3); +INSERT INTO xtest2.xt2 VALUES (1), (2), (3); +DELETE xtest1.xt1, xtest2.xt2 +FROM xtest1.xt1 INNER JOIN xtest2.xt2 INNER JOIN test3.t3 +WHERE xtest1.xt1.a=xtest2.xt2.a AND xtest2.xt2.a=test3.t3.a; +FLUSH LOGS; ##################################################################################### # The following Annotate_rows events should appear below: # - INSERT INTO test2.t2 VALUES (1), (2), (3) @@ -6,58 +40,50 @@ # - INSERT INTO test2.t2 VALUES (1), (2), (3) # - DELETE xtest1.xt1, test2.t2 FROM <...> ##################################################################################### -show binlog events in 'master-bin.000001' from ; +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Gtid_list 1 # [] -master-bin.000001 # Binlog_checkpoint 1 # master-bin.000001 -master-bin.000001 # Gtid 1 # GTID 0-1-1 -master-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test1 -master-bin.000001 # Gtid 1 # GTID 0-1-2 -master-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test2 -master-bin.000001 # Gtid 1 # GTID 0-1-3 -master-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test3 -master-bin.000001 # Gtid 1 # GTID 0-1-4 -master-bin.000001 # Query 1 # CREATE DATABASE test1 -master-bin.000001 # Gtid 1 # GTID 0-1-5 -master-bin.000001 # Query 1 # CREATE DATABASE test2 -master-bin.000001 # Gtid 1 # GTID 0-1-6 -master-bin.000001 # Query 1 # CREATE DATABASE test3 -master-bin.000001 # Gtid 1 # BEGIN GTID 0-1-7 -master-bin.000001 # Table_map 1 # table_id: # (test1.t1) -master-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # COMMIT -master-bin.000001 # Gtid 1 # BEGIN GTID 0-1-8 -master-bin.000001 # Annotate_rows 1 # INSERT INTO test2.t2 VALUES (1), (2), (3) -master-bin.000001 # Table_map 1 # table_id: # (test2.t2) -master-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # COMMIT -master-bin.000001 # Gtid 1 # BEGIN GTID 0-1-9 -master-bin.000001 # Annotate_rows 1 # INSERT INTO test3.t3 VALUES (1), (2), (3) -master-bin.000001 # Table_map 1 # table_id: # (test3.t3) -master-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # COMMIT -master-bin.000001 # Gtid 1 # BEGIN GTID 0-1-10 -master-bin.000001 # Annotate_rows 1 # DELETE test1.t1, test2.t2 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # CREATE DATABASE test1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # CREATE DATABASE test2 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # CREATE DATABASE test3 +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test1.t1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # INSERT INTO test2.t2 VALUES (1), (2), (3) +master-bin.000001 # Table_map # # table_id: # (test2.t2) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # INSERT INTO test3.t3 VALUES (1), (2), (3) +master-bin.000001 # Table_map # # table_id: # (test3.t3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # DELETE test1.t1, test2.t2 FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3 WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3.a -master-bin.000001 # Table_map 1 # table_id: # (test1.t1) -master-bin.000001 # Table_map 1 # table_id: # (test2.t2) -master-bin.000001 # Delete_rows_v1 1 # table_id: # -master-bin.000001 # Delete_rows_v1 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # COMMIT -master-bin.000001 # Gtid 1 # BEGIN GTID 0-1-11 -master-bin.000001 # Annotate_rows 1 # INSERT INTO test2.v2 VALUES (1), (2), (3) -master-bin.000001 # Table_map 1 # table_id: # (test2.t2) -master-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # COMMIT -master-bin.000001 # Gtid 1 # BEGIN GTID 0-1-12 -master-bin.000001 # Annotate_rows 1 # DELETE xtest1.xt1, test2.t2 +master-bin.000001 # Table_map # # table_id: # (test1.t1) +master-bin.000001 # Table_map # # table_id: # (test2.t2) +master-bin.000001 # Delete_rows_v1 # # table_id: # +master-bin.000001 # Delete_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # INSERT INTO test2.v2 VALUES (1), (2), (3) +master-bin.000001 # Table_map # # table_id: # (test2.t2) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # DELETE xtest1.xt1, test2.t2 FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3 WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3.a -master-bin.000001 # Table_map 1 # table_id: # (test2.t2) -master-bin.000001 # Delete_rows_v1 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # COMMIT -master-bin.000001 # Rotate 1 # master-bin.000002;pos=4 +master-bin.000001 # Table_map # # table_id: # (test2.t2) +master-bin.000001 # Delete_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Rotate # # master-bin.000002;pos=POS # ##################################################################################### # mysqlbinlog @@ -96,7 +122,7 @@ SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/ SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; -DROP DATABASE IF EXISTS test1 +CREATE DATABASE test1 /*!*/; # at # #010909 4:46:40 server id # end_log_pos # GTID 0-1-2 ddl @@ -104,7 +130,7 @@ DROP DATABASE IF EXISTS test1 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP DATABASE IF EXISTS test2 +CREATE DATABASE test2 /*!*/; # at # #010909 4:46:40 server id # end_log_pos # GTID 0-1-3 ddl @@ -112,35 +138,11 @@ DROP DATABASE IF EXISTS test2 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP DATABASE IF EXISTS test3 -/*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-4 ddl -/*!100001 SET @@session.gtid_seq_no=4*//*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=1000000000/*!*/; -CREATE DATABASE test1 -/*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-5 ddl -/*!100001 SET @@session.gtid_seq_no=5*//*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=1000000000/*!*/; -CREATE DATABASE test2 -/*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-6 ddl -/*!100001 SET @@session.gtid_seq_no=6*//*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=1000000000/*!*/; CREATE DATABASE test3 /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-7 -/*!100001 SET @@session.gtid_seq_no=7*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-4 +/*!100001 SET @@session.gtid_seq_no=4*//*!*/; BEGIN /*!*/; # at # @@ -162,8 +164,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-8 -/*!100001 SET @@session.gtid_seq_no=8*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-5 +/*!100001 SET @@session.gtid_seq_no=5*//*!*/; BEGIN /*!*/; # at # @@ -188,8 +190,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-9 -/*!100001 SET @@session.gtid_seq_no=9*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-6 +/*!100001 SET @@session.gtid_seq_no=6*//*!*/; BEGIN /*!*/; # at # @@ -214,8 +216,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-10 -/*!100001 SET @@session.gtid_seq_no=10*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-7 +/*!100001 SET @@session.gtid_seq_no=7*//*!*/; BEGIN /*!*/; # at # @@ -255,8 +257,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-11 -/*!100001 SET @@session.gtid_seq_no=11*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-8 +/*!100001 SET @@session.gtid_seq_no=8*//*!*/; BEGIN /*!*/; # at # @@ -281,8 +283,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-12 -/*!100001 SET @@session.gtid_seq_no=12*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-9 +/*!100001 SET @@session.gtid_seq_no=9*//*!*/; BEGIN /*!*/; # at # @@ -349,7 +351,7 @@ SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/ SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; -DROP DATABASE IF EXISTS test1 +CREATE DATABASE test1 /*!*/; # at # #010909 4:46:40 server id # end_log_pos # GTID 0-1-2 ddl @@ -360,24 +362,8 @@ DROP DATABASE IF EXISTS test1 /*!100001 SET @@session.gtid_seq_no=3*//*!*/; # at # # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-4 ddl +#010909 4:46:40 server id # end_log_pos # GTID 0-1-4 /*!100001 SET @@session.gtid_seq_no=4*//*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=1000000000/*!*/; -CREATE DATABASE test1 -/*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-5 ddl -/*!100001 SET @@session.gtid_seq_no=5*//*!*/; -# at # -# at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-6 ddl -/*!100001 SET @@session.gtid_seq_no=6*//*!*/; -# at # -# at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-7 -/*!100001 SET @@session.gtid_seq_no=7*//*!*/; BEGIN /*!*/; # at # @@ -399,8 +385,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-8 -/*!100001 SET @@session.gtid_seq_no=8*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-5 +/*!100001 SET @@session.gtid_seq_no=5*//*!*/; BEGIN /*!*/; # at # @@ -412,8 +398,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-9 -/*!100001 SET @@session.gtid_seq_no=9*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-6 +/*!100001 SET @@session.gtid_seq_no=6*//*!*/; BEGIN /*!*/; # at # @@ -425,8 +411,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-10 -/*!100001 SET @@session.gtid_seq_no=10*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-7 +/*!100001 SET @@session.gtid_seq_no=7*//*!*/; BEGIN /*!*/; # at # @@ -456,8 +442,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-11 -/*!100001 SET @@session.gtid_seq_no=11*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-8 +/*!100001 SET @@session.gtid_seq_no=8*//*!*/; BEGIN /*!*/; # at # @@ -469,8 +455,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-12 -/*!100001 SET @@session.gtid_seq_no=12*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-9 +/*!100001 SET @@session.gtid_seq_no=9*//*!*/; BEGIN /*!*/; # at # @@ -521,7 +507,7 @@ SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/ SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; -DROP DATABASE IF EXISTS test1 +CREATE DATABASE test1 /*!*/; # at # #010909 4:46:40 server id # end_log_pos # GTID 0-1-2 ddl @@ -529,7 +515,7 @@ DROP DATABASE IF EXISTS test1 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP DATABASE IF EXISTS test2 +CREATE DATABASE test2 /*!*/; # at # #010909 4:46:40 server id # end_log_pos # GTID 0-1-3 ddl @@ -537,35 +523,11 @@ DROP DATABASE IF EXISTS test2 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP DATABASE IF EXISTS test3 -/*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-4 ddl -/*!100001 SET @@session.gtid_seq_no=4*//*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=1000000000/*!*/; -CREATE DATABASE test1 -/*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-5 ddl -/*!100001 SET @@session.gtid_seq_no=5*//*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=1000000000/*!*/; -CREATE DATABASE test2 -/*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-6 ddl -/*!100001 SET @@session.gtid_seq_no=6*//*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=1000000000/*!*/; CREATE DATABASE test3 /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-7 -/*!100001 SET @@session.gtid_seq_no=7*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-4 +/*!100001 SET @@session.gtid_seq_no=4*//*!*/; BEGIN /*!*/; # at # @@ -587,8 +549,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-8 -/*!100001 SET @@session.gtid_seq_no=8*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-5 +/*!100001 SET @@session.gtid_seq_no=5*//*!*/; BEGIN /*!*/; # at # @@ -611,8 +573,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-9 -/*!100001 SET @@session.gtid_seq_no=9*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-6 +/*!100001 SET @@session.gtid_seq_no=6*//*!*/; BEGIN /*!*/; # at # @@ -635,8 +597,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-10 -/*!100001 SET @@session.gtid_seq_no=10*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-7 +/*!100001 SET @@session.gtid_seq_no=7*//*!*/; BEGIN /*!*/; # at # @@ -672,8 +634,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-11 -/*!100001 SET @@session.gtid_seq_no=11*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-8 +/*!100001 SET @@session.gtid_seq_no=8*//*!*/; BEGIN /*!*/; # at # @@ -696,8 +658,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-12 -/*!100001 SET @@session.gtid_seq_no=12*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-9 +/*!100001 SET @@session.gtid_seq_no=9*//*!*/; BEGIN /*!*/; # at # @@ -764,7 +726,7 @@ SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/ SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; -DROP DATABASE IF EXISTS test1 +CREATE DATABASE test1 /*!*/; # at # #010909 4:46:40 server id # end_log_pos # GTID 0-1-2 ddl @@ -772,7 +734,7 @@ DROP DATABASE IF EXISTS test1 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP DATABASE IF EXISTS test2 +CREATE DATABASE test2 /*!*/; # at # #010909 4:46:40 server id # end_log_pos # GTID 0-1-3 ddl @@ -780,35 +742,11 @@ DROP DATABASE IF EXISTS test2 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP DATABASE IF EXISTS test3 -/*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-4 ddl -/*!100001 SET @@session.gtid_seq_no=4*//*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=1000000000/*!*/; -CREATE DATABASE test1 -/*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-5 ddl -/*!100001 SET @@session.gtid_seq_no=5*//*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=1000000000/*!*/; -CREATE DATABASE test2 -/*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-6 ddl -/*!100001 SET @@session.gtid_seq_no=6*//*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=1000000000/*!*/; CREATE DATABASE test3 /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-7 -/*!100001 SET @@session.gtid_seq_no=7*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-4 +/*!100001 SET @@session.gtid_seq_no=4*//*!*/; BEGIN /*!*/; # at # @@ -830,8 +768,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-8 -/*!100001 SET @@session.gtid_seq_no=8*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-5 +/*!100001 SET @@session.gtid_seq_no=5*//*!*/; BEGIN /*!*/; # at # @@ -856,8 +794,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-9 -/*!100001 SET @@session.gtid_seq_no=9*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-6 +/*!100001 SET @@session.gtid_seq_no=6*//*!*/; BEGIN /*!*/; # at # @@ -882,8 +820,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-10 -/*!100001 SET @@session.gtid_seq_no=10*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-7 +/*!100001 SET @@session.gtid_seq_no=7*//*!*/; BEGIN /*!*/; # at # @@ -923,8 +861,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-11 -/*!100001 SET @@session.gtid_seq_no=11*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-8 +/*!100001 SET @@session.gtid_seq_no=8*//*!*/; BEGIN /*!*/; # at # @@ -949,8 +887,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-12 -/*!100001 SET @@session.gtid_seq_no=12*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-9 +/*!100001 SET @@session.gtid_seq_no=9*//*!*/; BEGIN /*!*/; # at # @@ -1017,7 +955,7 @@ SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/ SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; -DROP DATABASE IF EXISTS test1 +CREATE DATABASE test1 /*!*/; # at # #010909 4:46:40 server id # end_log_pos # GTID 0-1-2 ddl @@ -1028,24 +966,8 @@ DROP DATABASE IF EXISTS test1 /*!100001 SET @@session.gtid_seq_no=3*//*!*/; # at # # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-4 ddl +#010909 4:46:40 server id # end_log_pos # GTID 0-1-4 /*!100001 SET @@session.gtid_seq_no=4*//*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=1000000000/*!*/; -CREATE DATABASE test1 -/*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-5 ddl -/*!100001 SET @@session.gtid_seq_no=5*//*!*/; -# at # -# at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-6 ddl -/*!100001 SET @@session.gtid_seq_no=6*//*!*/; -# at # -# at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-7 -/*!100001 SET @@session.gtid_seq_no=7*//*!*/; BEGIN /*!*/; # at # @@ -1067,8 +989,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-8 -/*!100001 SET @@session.gtid_seq_no=8*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-5 +/*!100001 SET @@session.gtid_seq_no=5*//*!*/; BEGIN /*!*/; # at # @@ -1080,8 +1002,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-9 -/*!100001 SET @@session.gtid_seq_no=9*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-6 +/*!100001 SET @@session.gtid_seq_no=6*//*!*/; BEGIN /*!*/; # at # @@ -1093,8 +1015,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-10 -/*!100001 SET @@session.gtid_seq_no=10*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-7 +/*!100001 SET @@session.gtid_seq_no=7*//*!*/; BEGIN /*!*/; # at # @@ -1124,8 +1046,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-11 -/*!100001 SET @@session.gtid_seq_no=11*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-8 +/*!100001 SET @@session.gtid_seq_no=8*//*!*/; BEGIN /*!*/; # at # @@ -1137,8 +1059,8 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-12 -/*!100001 SET @@session.gtid_seq_no=12*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-9 +/*!100001 SET @@session.gtid_seq_no=9*//*!*/; BEGIN /*!*/; # at # @@ -1189,7 +1111,7 @@ SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/ SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; -DROP DATABASE IF EXISTS test1 +CREATE DATABASE test1 /*!*/; # at # #010909 4:46:40 server id # end_log_pos # GTID 0-1-2 ddl @@ -1197,7 +1119,7 @@ DROP DATABASE IF EXISTS test1 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP DATABASE IF EXISTS test2 +CREATE DATABASE test2 /*!*/; # at # #010909 4:46:40 server id # end_log_pos # GTID 0-1-3 ddl @@ -1205,35 +1127,11 @@ DROP DATABASE IF EXISTS test2 # at # #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP DATABASE IF EXISTS test3 -/*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-4 ddl -/*!100001 SET @@session.gtid_seq_no=4*//*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=1000000000/*!*/; -CREATE DATABASE test1 -/*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-5 ddl -/*!100001 SET @@session.gtid_seq_no=5*//*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=1000000000/*!*/; -CREATE DATABASE test2 -/*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-6 ddl -/*!100001 SET @@session.gtid_seq_no=6*//*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=1000000000/*!*/; CREATE DATABASE test3 /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-7 -/*!100001 SET @@session.gtid_seq_no=7*//*!*/; +#010909 4:46:40 server id # end_log_pos # GTID 0-1-4 +/*!100001 SET @@session.gtid_seq_no=4*//*!*/; BEGIN /*!*/; # at # @@ -1255,6 +1153,88 @@ SET TIMESTAMP=1000000000/*!*/; COMMIT /*!*/; # at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-5 +/*!100001 SET @@session.gtid_seq_no=5*//*!*/; +BEGIN +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number # +# at # +#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F +### INSERT INTO `test2`.`t2` +### SET +### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +### INSERT INTO `test2`.`t2` +### SET +### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +### INSERT INTO `test2`.`t2` +### SET +### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-6 +/*!100001 SET @@session.gtid_seq_no=6*//*!*/; +BEGIN +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Table_map: `test3`.`t3` mapped to number # +# at # +#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F +### INSERT INTO `test3`.`t3` +### SET +### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +### INSERT INTO `test3`.`t3` +### SET +### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +### INSERT INTO `test3`.`t3` +### SET +### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-7 +/*!100001 SET @@session.gtid_seq_no=7*//*!*/; +BEGIN +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number # +# at # +#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number # +# at # +# at # +#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # +#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F +### DELETE FROM `test1`.`t1` +### WHERE +### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +### DELETE FROM `test1`.`t1` +### WHERE +### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +### DELETE FROM `test1`.`t1` +### WHERE +### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +### DELETE FROM `test2`.`t2` +### WHERE +### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +### DELETE FROM `test2`.`t2` +### WHERE +### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +### DELETE FROM `test2`.`t2` +### WHERE +### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # #010909 4:46:40 server id # end_log_pos # GTID 0-1-8 /*!100001 SET @@session.gtid_seq_no=8*//*!*/; BEGIN @@ -1283,88 +1263,6 @@ COMMIT BEGIN /*!*/; # at # -#010909 4:46:40 server id # end_log_pos # Table_map: `test3`.`t3` mapped to number # -# at # -#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO `test3`.`t3` -### SET -### @1=1 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO `test3`.`t3` -### SET -### @1=2 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO `test3`.`t3` -### SET -### @1=3 /* INT meta=0 nullable=1 is_null=0 */ -# at # -#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=1000000000/*!*/; -COMMIT -/*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-10 -/*!100001 SET @@session.gtid_seq_no=10*//*!*/; -BEGIN -/*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number # -# at # -#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number # -# at # -# at # -#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # -#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM `test1`.`t1` -### WHERE -### @1=1 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM `test1`.`t1` -### WHERE -### @1=2 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM `test1`.`t1` -### WHERE -### @1=3 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM `test2`.`t2` -### WHERE -### @1=1 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM `test2`.`t2` -### WHERE -### @1=2 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM `test2`.`t2` -### WHERE -### @1=3 /* INT meta=0 nullable=1 is_null=0 */ -# at # -#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=1000000000/*!*/; -COMMIT -/*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-11 -/*!100001 SET @@session.gtid_seq_no=11*//*!*/; -BEGIN -/*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number # -# at # -#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO `test2`.`t2` -### SET -### @1=1 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO `test2`.`t2` -### SET -### @1=2 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO `test2`.`t2` -### SET -### @1=3 /* INT meta=0 nullable=1 is_null=0 */ -# at # -#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=1000000000/*!*/; -COMMIT -/*!*/; -# at # -#010909 4:46:40 server id # end_log_pos # GTID 0-1-12 -/*!100001 SET @@session.gtid_seq_no=12*//*!*/; -BEGIN -/*!*/; -# at # #010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number # # at # #010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F @@ -1389,3 +1287,9 @@ DELIMITER ; ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; +set global binlog_checksum=@old_binlog_checksum; +DROP DATABASE test1; +DROP DATABASE test2; +DROP DATABASE test3; +DROP DATABASE xtest1; +DROP DATABASE xtest2; diff --git a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result index 6a8e18ae5bf..9a2fbfb9d6e 100644 --- a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result +++ b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result @@ -34,3 +34,188 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; drop table t2; +# +# Start of 10.2 tests +# +# +# MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions +# +SET TIMESTAMP=UNIX_TIMESTAMP('1970-01-01 06:46:40'); +FLUSH LOGS; +SET NAMES utf8; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8); +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (''ä(i1)'')'; +EXECUTE IMMEDIATE CONVERT('INSERT INTO t1 VALUES (''ä(i2)'')' USING ucs2); +SET @stmt=CONVERT('INSERT INTO t1 VALUES (''ä(i3)'')' USING ucs2); +EXECUTE IMMEDIATE @stmt; +PREPARE stmt FROM 'INSERT INTO t1 VALUES (''ä(p1)'')'; +EXECUTE stmt; +PREPARE stmt FROM CONVERT('INSERT INTO t1 VALUES (''ä(p2)'')' USING ucs2); +EXECUTE stmt; +SET @stmt=CONVERT('INSERT INTO t1 VALUES (''ä(p3)'')' USING ucs2); +PREPARE stmt FROM @stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +SELECT * FROM t1; +a +ä(i1) +ä(i2) +ä(i3) +ä(p1) +ä(p2) +ä(p3) +DROP TABLE t1; +FLUSH LOGS; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +DELIMITER /*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Start: binlog v 4, server v #.##.## created 700101 6:46:40 +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Gtid list [#-#-#] +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Binlog checkpoint master-bin.000002 +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Binlog checkpoint master-bin.000003 +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# ddl +/*!100101 SET @@session.skip_parallel_replication=0*//*!*/; +/*!100001 SET @@session.gtid_domain_id=#*//*!*/; +/*!100001 SET @@session.server_id=#*//*!*/; +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +use `test`/*!*/; +SET TIMESTAMP=XXX/*!*/; +SET @@session.pseudo_thread_id=#/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.sql_mode=1342177280/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +/*!\C utf8 *//*!*/; +SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8) +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +BEGIN +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F +### INSERT INTO `test`.`t1` +### SET +### @1='ä(i1)' /* VARSTRING(30) meta=30 nullable=1 is_null=0 */ +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=XXX/*!*/; +COMMIT +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +BEGIN +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F +### INSERT INTO `test`.`t1` +### SET +### @1='ä(i2)' /* VARSTRING(30) meta=30 nullable=1 is_null=0 */ +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=XXX/*!*/; +COMMIT +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +BEGIN +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F +### INSERT INTO `test`.`t1` +### SET +### @1='ä(i3)' /* VARSTRING(30) meta=30 nullable=1 is_null=0 */ +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=XXX/*!*/; +COMMIT +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +BEGIN +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F +### INSERT INTO `test`.`t1` +### SET +### @1='ä(p1)' /* VARSTRING(30) meta=30 nullable=1 is_null=0 */ +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=XXX/*!*/; +COMMIT +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +BEGIN +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F +### INSERT INTO `test`.`t1` +### SET +### @1='ä(p2)' /* VARSTRING(30) meta=30 nullable=1 is_null=0 */ +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=XXX/*!*/; +COMMIT +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +BEGIN +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F +### INSERT INTO `test`.`t1` +### SET +### @1='ä(p3)' /* VARSTRING(30) meta=30 nullable=1 is_null=0 */ +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=XXX/*!*/; +COMMIT +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# ddl +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=XXX/*!*/; +DROP TABLE `t1` /* generated by server */ +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Rotate to master-bin.000004 pos: 4 +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; +SET TIMESTAMP=DEFAULT; +# +# End of 10.2 tests +# diff --git a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result index a3bcf6cd79d..e8ecdb7b976 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result +++ b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result @@ -39,3 +39,176 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; drop table t2; +# +# Start of 10.2 tests +# +# +# MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions +# +SET TIMESTAMP=UNIX_TIMESTAMP('1970-01-01 06:46:40'); +FLUSH LOGS; +SET NAMES utf8; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8); +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (''ä(i1)'')'; +EXECUTE IMMEDIATE CONVERT('INSERT INTO t1 VALUES (''ä(i2)'')' USING ucs2); +SET @stmt=CONVERT('INSERT INTO t1 VALUES (''ä(i3)'')' USING ucs2); +EXECUTE IMMEDIATE @stmt; +PREPARE stmt FROM 'INSERT INTO t1 VALUES (''ä(p1)'')'; +EXECUTE stmt; +PREPARE stmt FROM CONVERT('INSERT INTO t1 VALUES (''ä(p2)'')' USING ucs2); +EXECUTE stmt; +SET @stmt=CONVERT('INSERT INTO t1 VALUES (''ä(p3)'')' USING ucs2); +PREPARE stmt FROM @stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +SELECT * FROM t1; +a +ä(i1) +ä(i2) +ä(i3) +ä(p1) +ä(p2) +ä(p3) +DROP TABLE t1; +FLUSH LOGS; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +DELIMITER /*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Start: binlog v 4, server v #.##.## created 700101 6:46:40 +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Gtid list [#-#-#] +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Binlog checkpoint master-bin.000002 +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Binlog checkpoint master-bin.000003 +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# ddl +/*!100101 SET @@session.skip_parallel_replication=0*//*!*/; +/*!100001 SET @@session.gtid_domain_id=#*//*!*/; +/*!100001 SET @@session.server_id=#*//*!*/; +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +use `test`/*!*/; +SET TIMESTAMP=XXX/*!*/; +SET @@session.pseudo_thread_id=#/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.sql_mode=1342177280/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +/*!\C utf8 *//*!*/; +SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8) +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +BEGIN +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=XXX/*!*/; +INSERT INTO t1 VALUES ('ä(i1)') +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=XXX/*!*/; +COMMIT +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +BEGIN +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=XXX/*!*/; +INSERT INTO t1 VALUES ('ä(i2)') +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=XXX/*!*/; +COMMIT +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +BEGIN +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=XXX/*!*/; +INSERT INTO t1 VALUES ('ä(i3)') +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=XXX/*!*/; +COMMIT +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +BEGIN +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=XXX/*!*/; +INSERT INTO t1 VALUES ('ä(p1)') +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=XXX/*!*/; +COMMIT +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +BEGIN +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=XXX/*!*/; +INSERT INTO t1 VALUES ('ä(p2)') +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=XXX/*!*/; +COMMIT +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +BEGIN +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=XXX/*!*/; +INSERT INTO t1 VALUES ('ä(p3)') +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=XXX/*!*/; +COMMIT +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# ddl +/*!100001 SET @@session.gtid_seq_no=#*//*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=XXX/*!*/; +DROP TABLE `t1` /* generated by server */ +/*!*/; +# at # +#700101 6:46:40 server id # end_log_pos # CRC32 XXX Rotate to master-bin.000004 pos: 4 +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; +SET TIMESTAMP=DEFAULT; +# +# End of 10.2 tests +# diff --git a/mysql-test/suite/binlog/r/binlog_stm_ps.result b/mysql-test/suite/binlog/r/binlog_stm_ps.result index 61aaa934315..0b7491e4364 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_ps.result +++ b/mysql-test/suite/binlog/r/binlog_stm_ps.result @@ -27,3 +27,161 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; insert into t1 select 100 limit 100 master-bin.000001 # Query # # COMMIT drop table t1; +# +# MDEV-10709 Expressions as parameters to Dynamic SQL +# +FLUSH LOGS; +SET TIMESTAMP=UNIX_TIMESTAMP('2001-01-02 10:20:30.123456'); +CREATE TABLE t1 (a DECIMAL(30,8)); +PREPARE stmt FROM 'INSERT INTO t1 VALUES (?)'; +EXECUTE stmt USING 10; +EXECUTE stmt USING 11e0; +EXECUTE stmt USING 12.1; +EXECUTE stmt USING '13'; +EXECUTE stmt USING CURRENT_DATE; +EXECUTE stmt USING MAKETIME(10,20,30); +EXECUTE stmt USING CURRENT_TIME; +EXECUTE stmt USING CURRENT_TIME(3); +EXECUTE stmt USING CURRENT_TIME(6); +EXECUTE stmt USING CURRENT_TIMESTAMP; +EXECUTE stmt USING CURRENT_TIMESTAMP(3); +EXECUTE stmt USING CURRENT_TIMESTAMP(6); +SELECT * FROM t1; +a +10.00000000 +11.00000000 +12.10000000 +13.00000000 +20010102.00000000 +102030.00000000 +102030.00000000 +102030.12300000 +102030.12345600 +20010102102030.00000000 +20010102102030.12300000 +20010102102030.12345600 +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Binlog_checkpoint # # master-bin.000002 +master-bin.000002 # Gtid # # GTID #-#-# +master-bin.000002 # Query # # use `test`; CREATE TABLE t1 (a DECIMAL(30,8)) +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (10) +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (11) +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (12.1) +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES ('13') +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (DATE'2001-01-02') +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (TIME'10:20:30') +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (TIME'10:20:30') +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (TIME'10:20:30.123') +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (TIME'10:20:30.123456') +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (TIMESTAMP'2001-01-02 10:20:30') +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (TIMESTAMP'2001-01-02 10:20:30.123') +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (TIMESTAMP'2001-01-02 10:20:30.123456') +master-bin.000002 # Query # # COMMIT +DROP TABLE t1; +SET TIMESTAMP=DEFAULT; +# +# MDEV-10585 EXECUTE IMMEDIATE statement +# +FLUSH LOGS; +CREATE TABLE t1 (a INT); +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (101)'; +SET @a=102; +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' USING @a; +SET @a=103; +SET @stmt='INSERT INTO t1 VALUES (?)'; +EXECUTE IMMEDIATE @stmt USING @a; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000003 # Binlog_checkpoint # # master-bin.000003 +master-bin.000003 # Gtid # # GTID #-#-# +master-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT) +master-bin.000003 # Gtid # # BEGIN GTID #-#-# +master-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (101) +master-bin.000003 # Query # # COMMIT +master-bin.000003 # Gtid # # BEGIN GTID #-#-# +master-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (102) +master-bin.000003 # Query # # COMMIT +master-bin.000003 # Gtid # # BEGIN GTID #-#-# +master-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (103) +master-bin.000003 # Query # # COMMIT +DROP TABLE t1; +# +# MDEV-11360 Dynamic SQL: DEFAULT as a bind parameter +# +FLUSH LOGS; +CREATE TABLE t1 (a INT DEFAULT 10); +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (Default)'; +# The output of this query in 'Note' is a syntactically incorrect query. +# But as it's never logged, it's ok. It should be human readable only. +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT ?' USING Default; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select default AS `?` +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' USING Default; +CREATE PROCEDURE p1 () +BEGIN +INSERT INTO t1 VALUES (Default); +# EXPLAIN should not be logged +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT ?' USING Default; +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' USING Default; +END; +$$ +CALL p1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +DROP PROCEDURE p1; +DROP TABLE t1; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000004 # Binlog_checkpoint # # master-bin.000004 +master-bin.000004 # Gtid # # GTID #-#-# +master-bin.000004 # Query # # use `test`; CREATE TABLE t1 (a INT DEFAULT 10) +master-bin.000004 # Gtid # # BEGIN GTID #-#-# +master-bin.000004 # Query # # use `test`; INSERT INTO t1 VALUES (Default) +master-bin.000004 # Query # # COMMIT +master-bin.000004 # Gtid # # BEGIN GTID #-#-# +master-bin.000004 # Query # # use `test`; INSERT INTO t1 VALUES (DEFAULT) +master-bin.000004 # Query # # COMMIT +master-bin.000004 # Gtid # # GTID #-#-# +master-bin.000004 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() +BEGIN +INSERT INTO t1 VALUES (Default); +# EXPLAIN should not be logged +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT ?' USING Default; +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' USING Default; +END +master-bin.000004 # Gtid # # BEGIN GTID #-#-# +master-bin.000004 # Query # # use `test`; INSERT INTO t1 VALUES (Default) +master-bin.000004 # Query # # COMMIT +master-bin.000004 # Gtid # # BEGIN GTID #-#-# +master-bin.000004 # Query # # use `test`; INSERT INTO t1 VALUES (DEFAULT) +master-bin.000004 # Query # # COMMIT +master-bin.000004 # Gtid # # GTID #-#-# +master-bin.000004 # Query # # use `test`; DROP PROCEDURE p1 +master-bin.000004 # Gtid # # GTID #-#-# +master-bin.000004 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ diff --git a/mysql-test/suite/binlog/r/binlog_variables_log_bin.result b/mysql-test/suite/binlog/r/binlog_variables_log_bin.result index 215e14f97df..d05a28847b4 100644 --- a/mysql-test/suite/binlog/r/binlog_variables_log_bin.result +++ b/mysql-test/suite/binlog/r/binlog_variables_log_bin.result @@ -3,6 +3,10 @@ Variable_name log_bin Value ON Variable_name log_bin_basename Value MYSQLTEST_VARDIR/mysqld.1/data/other +Variable_name log_bin_compress +Value OFF +Variable_name log_bin_compress_min_len +Value 256 Variable_name log_bin_index Value MYSQLTEST_VARDIR/mysqld.1/data/mysqld-bin.index Variable_name log_bin_trust_function_creators diff --git a/mysql-test/suite/binlog/r/binlog_variables_log_bin_index.result b/mysql-test/suite/binlog/r/binlog_variables_log_bin_index.result index fb7324ced34..09f2feae9c2 100644 --- a/mysql-test/suite/binlog/r/binlog_variables_log_bin_index.result +++ b/mysql-test/suite/binlog/r/binlog_variables_log_bin_index.result @@ -3,6 +3,10 @@ Variable_name log_bin Value ON Variable_name log_bin_basename Value MYSQLTEST_VARDIR/mysqld.1/data/other +Variable_name log_bin_compress +Value OFF +Variable_name log_bin_compress_min_len +Value 256 Variable_name log_bin_index Value MYSQLTEST_VARDIR/tmp/something.index Variable_name log_bin_trust_function_creators diff --git a/mysql-test/suite/binlog/t/binlog_incident.test b/mysql-test/suite/binlog/t/binlog_incident.test index 1c526ca5980..c4270a074f0 100644 --- a/mysql-test/suite/binlog/t/binlog_incident.test +++ b/mysql-test/suite/binlog/t/binlog_incident.test @@ -1,29 +1 @@ -# The purpose of this test is to provide a reference for how the -# incident log event is represented in the output from the mysqlbinlog -# program. - -source include/have_log_bin.inc; -source include/have_debug.inc; -source include/binlog_start_pos.inc; - -let $MYSQLD_DATADIR= `select @@datadir`; -RESET MASTER; - -CREATE TABLE t1 (a INT); - -INSERT INTO t1 VALUES (1),(2),(3); -SELECT * FROM t1; - -# This will generate an incident log event and store it in the binary -# log before the replace statement. -REPLACE INTO t1 VALUES (4); - -DROP TABLE t1; -FLUSH LOGS; - -exec $MYSQL_BINLOG --start-position=$binlog_start_pos $MYSQLD_DATADIR/master-bin.000001 >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql; ---disable_query_log -eval SELECT cont LIKE '%RELOAD DATABASE; # Shall generate syntax error%' AS `Contain RELOAD DATABASE` FROM (SELECT load_file('$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql') AS cont) AS tbl; ---enable_query_log - -remove_file $MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql; +--source extra/binlog_tests/binlog_incident.inc diff --git a/mysql-test/suite/binlog/t/binlog_index.test b/mysql-test/suite/binlog/t/binlog_index.test index 26f3595db2b..1837c683bba 100644 --- a/mysql-test/suite/binlog/t/binlog_index.test +++ b/mysql-test/suite/binlog/t/binlog_index.test @@ -1,272 +1 @@ -# -# testing of purging of binary log files bug#18199/Bug#18453 -# -source include/have_log_bin.inc; -source include/not_embedded.inc; -# Don't test this under valgrind, memory leaks will occur ---source include/not_valgrind.inc -source include/have_debug.inc; -# Avoid CrashReporter popup on Mac ---source include/not_crashrep.inc -call mtr.add_suppression('Attempting backtrace'); -call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to process registered files that would be purged.'); -call mtr.add_suppression('MSYQL_BIN_LOG::open failed to sync the index file'); -call mtr.add_suppression('Turning logging off for the whole duration of the MySQL server process.'); -call mtr.add_suppression('Could not open .*'); -call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to clean registers before purging logs.'); -flush tables; - -let $old=`select @@debug`; - -RESET MASTER; - -let $MYSQLD_DATADIR= `select @@datadir`; -let $INDEX=$MYSQLD_DATADIR/master-bin.index; - -# -# testing purge binary logs TO -# - -flush logs; -flush logs; -flush logs; - -source include/show_binary_logs.inc; -remove_file $MYSQLD_DATADIR/master-bin.000001; -flush tables; - -# there must be a warning with file names -replace_regex /\.[\\\/]master/master/; ---source include/wait_for_binlog_checkpoint.inc -purge binary logs TO 'master-bin.000004'; - ---echo *** must show a list starting from the 'TO' argument of PURGE *** -source include/show_binary_logs.inc; - -# -# testing purge binary logs BEFORE -# - -reset master; - -flush logs; -flush logs; -flush logs; -remove_file $MYSQLD_DATADIR/master-bin.000001; - ---echo *** must be a warning master-bin.000001 was not found *** -let $date=`select NOW() + INTERVAL 1 MINUTE`; ---disable_query_log -replace_regex /\.[\\\/]master/master/; ---source include/wait_for_binlog_checkpoint.inc -eval purge binary logs BEFORE '$date'; ---enable_query_log - ---echo *** must show one record, of the active binlog, left in the index file after PURGE *** -source include/show_binary_logs.inc; - -# -# testing a fatal error -# Turning a binlog file into a directory must be a portable setup -# - -reset master; - -flush logs; -flush logs; -flush logs; - -remove_file $MYSQLD_DATADIR/master-bin.000001; -mkdir $MYSQLD_DATADIR/master-bin.000001; - ---source include/wait_for_binlog_checkpoint.inc ---error ER_BINLOG_PURGE_FATAL_ERR -purge binary logs TO 'master-bin.000002'; -replace_regex /\.[\\\/]master/master/; -show warnings; -rmdir $MYSQLD_DATADIR/master-bin.000001; ---disable_warnings -reset master; ---enable_warnings - ---echo # crash_purge_before_update_index -flush logs; - ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -SET SESSION debug_dbug="+d,crash_purge_before_update_index"; ---source include/wait_for_binlog_checkpoint.inc ---error 2013 -purge binary logs TO 'master-bin.000002'; - ---enable_reconnect ---source include/wait_until_connected_again.inc - -file_exists $MYSQLD_DATADIR/master-bin.000001; -file_exists $MYSQLD_DATADIR/master-bin.000002; -file_exists $MYSQLD_DATADIR/master-bin.000003; ---chmod 0644 $INDEX --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- eval SET @index=LOAD_FILE('$index') --- replace_regex /\.[\\\/]master/master/ -SELECT @index; - ---echo # crash_purge_non_critical_after_update_index -flush logs; - ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -SET SESSION debug_dbug="+d,crash_purge_non_critical_after_update_index"; ---source include/wait_for_binlog_checkpoint.inc ---error 2013 -purge binary logs TO 'master-bin.000004'; - ---enable_reconnect ---source include/wait_until_connected_again.inc - ---error 1 -file_exists $MYSQLD_DATADIR/master-bin.000001; ---error 1 -file_exists $MYSQLD_DATADIR/master-bin.000002; ---error 1 -file_exists $MYSQLD_DATADIR/master-bin.000003; ---chmod 0644 $INDEX --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- eval SET @index=LOAD_FILE('$index') --- replace_regex /\.[\\\/]master/master/ -SELECT @index; - ---echo # crash_purge_critical_after_update_index -flush logs; - ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -SET SESSION debug_dbug="+d,crash_purge_critical_after_update_index"; ---source include/wait_for_binlog_checkpoint.inc ---error 2013 -purge binary logs TO 'master-bin.000006'; - ---enable_reconnect ---source include/wait_until_connected_again.inc - ---error 1 -file_exists $MYSQLD_DATADIR/master-bin.000004; ---error 1 -file_exists $MYSQLD_DATADIR/master-bin.000005; -file_exists $MYSQLD_DATADIR/master-bin.000006; -file_exists $MYSQLD_DATADIR/master-bin.000007; ---error 1 -file_exists $MYSQLD_DATADIR/master-bin.000008; ---chmod 0644 $INDEX --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- eval SET @index=LOAD_FILE('$index') --- replace_regex /\.[\\\/]master/master/ -SELECT @index; - ---echo # crash_create_non_critical_before_update_index ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -SET SESSION debug_dbug="+d,crash_create_non_critical_before_update_index"; ---error 2013 -flush logs; - ---enable_reconnect ---source include/wait_until_connected_again.inc - -file_exists $MYSQLD_DATADIR/master-bin.000008; ---error 1 -file_exists $MYSQLD_DATADIR/master-bin.000009; ---chmod 0644 $INDEX --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- eval SET @index=LOAD_FILE('$index') --- replace_regex /\.[\\\/]master/master/ -SELECT @index; - ---echo # crash_create_critical_before_update_index ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -SET SESSION debug_dbug="+d,crash_create_critical_before_update_index"; ---error 2013 -flush logs; - ---enable_reconnect ---source include/wait_until_connected_again.inc - -file_exists $MYSQLD_DATADIR/master-bin.000009; ---error 1 -file_exists $MYSQLD_DATADIR/master-bin.000010; ---error 1 -file_exists $MYSQLD_DATADIR/master-bin.000011; ---chmod 0644 $INDEX --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- eval SET @index=LOAD_FILE('$index') --- replace_regex /\.[\\\/]master/master/ -SELECT @index; - ---echo # crash_create_after_update_index ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -SET SESSION debug_dbug="+d,crash_create_after_update_index"; ---error 2013 -flush logs; - ---enable_reconnect ---source include/wait_until_connected_again.inc - -file_exists $MYSQLD_DATADIR/master-bin.000010; -file_exists $MYSQLD_DATADIR/master-bin.000011; ---chmod 0644 $INDEX --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- eval SET @index=LOAD_FILE('$index') --- replace_regex /\.[\\\/]master/master/ -SELECT @index; - ---echo # ---echo # This should put the server in unsafe state and stop ---echo # accepting any command. If we inject a fault at this ---echo # point and continue the execution the server crashes. ---echo # - ---chmod 0644 $INDEX --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- eval SET @index=LOAD_FILE('$index') --- replace_regex /\.[\\\/]master/master/ -SELECT @index; - ---echo # fault_injection_registering_index -SET SESSION debug_dbug="+d,fault_injection_registering_index"; --- replace_regex /\.[\\\/]master/master/ --- error ER_CANT_OPEN_FILE -flush logs; - ---chmod 0644 $INDEX --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- eval SET @index=LOAD_FILE('$index') --- replace_regex /\.[\\\/]master/master/ -SELECT @index; - ---source include/restart_mysqld.inc - ---chmod 0644 $INDEX --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- eval SET @index=LOAD_FILE('$index') --- replace_regex /\.[\\\/]master/master/ -SELECT @index; - ---echo # fault_injection_updating_index -SET SESSION debug_dbug="+d,fault_injection_updating_index"; --- replace_regex /\.[\\\/]master/master/ --- error ER_CANT_OPEN_FILE -flush logs; - ---chmod 0644 $INDEX --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- eval SET @index=LOAD_FILE('$index') --- replace_regex /\.[\\\/]master/master/ -SELECT @index; - ---source include/restart_mysqld.inc - ---chmod 0644 $INDEX --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- eval SET @index=LOAD_FILE('$index') --- replace_regex /\.[\\\/]master/master/ -SELECT @index; - -eval SET SESSION debug_dbug="$old"; - ---echo End of tests +--source extra/binlog_tests/binlog_index.inc diff --git a/mysql-test/suite/binlog/t/binlog_ioerr.test b/mysql-test/suite/binlog/t/binlog_ioerr.test index f23fadfc1b4..3155e14e6b0 100644 --- a/mysql-test/suite/binlog/t/binlog_ioerr.test +++ b/mysql-test/suite/binlog/t/binlog_ioerr.test @@ -1,30 +1 @@ -source include/have_debug.inc; -source include/have_innodb.inc; -source include/have_log_bin.inc; -source include/have_binlog_format_mixed_or_statement.inc; - -CALL mtr.add_suppression("Error writing file 'master-bin'"); - -RESET MASTER; - -CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb; -INSERT INTO t1 VALUES(0); -SET SESSION debug_dbug='+d,fail_binlog_write_1'; ---error ER_ERROR_ON_WRITE -INSERT INTO t1 VALUES(1); ---error ER_ERROR_ON_WRITE -INSERT INTO t1 VALUES(2); -SET SESSION debug_dbug=''; -INSERT INTO t1 VALUES(3); -SELECT * FROM t1; - -# Actually the output from this currently shows a bug. -# The injected IO error leaves partially written transactions in the binlog in -# the form of stray "BEGIN" events. -# These should disappear from the output if binlog error handling is improved -# (see MySQL Bug#37148 and WL#1790). ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/ ---replace_column 1 BINLOG 2 POS 5 ENDPOS -SHOW BINLOG EVENTS; - -DROP TABLE t1; +--source extra/binlog_tests/binlog_ioerr.inc diff --git a/mysql-test/suite/binlog/t/binlog_killed_simulate.test b/mysql-test/suite/binlog/t/binlog_killed_simulate.test index e1a1c9de3b2..20f517210b7 100644 --- a/mysql-test/suite/binlog/t/binlog_killed_simulate.test +++ b/mysql-test/suite/binlog/t/binlog_killed_simulate.test @@ -6,10 +6,6 @@ # Query_log_event::error_code # ---disable_warnings -drop table if exists t1,t2; ---enable_warnings - # # Checking that killing upon successful row-loop does not affect binlogging # @@ -21,20 +17,16 @@ reset master; update t1 set a=2 /* will be "killed" after work has been done */; # a proof the query is binlogged with no error -let $MYSQLD_DATADIR= `select @@datadir`; ---exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog +let datadir= `select @@datadir`; +--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_start_pos $datadir/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval select -(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog")) -is not null; +eval set @a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"); --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -let $error_code= `select @a like "%#%error_code=0%" /* must return 1 */`; -eval select $error_code /* must return 1 as query completed before got killed*/; +select @a like '%#%error_code=0%' /* must return 1 as query completed before got killed*/; # cleanup for the sub-case remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog; - # # Checking that killing inside of row-loop for LOAD DATA into # non-transactional table affects binlogging @@ -46,21 +38,17 @@ reset master; load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */; # a proof the query is binlogged with an error ---let $binlog_load_data= query_get_value(SHOW BINLOG EVENTS, Pos, 5) ---let $binlog_end= query_get_value(SHOW BINLOG EVENTS, Pos, 6) +--let binlog_load_data= query_get_value(SHOW BINLOG EVENTS, Pos, 5) +--let binlog_end= query_get_value(SHOW BINLOG EVENTS, Pos, 6) source include/show_binlog_events.inc; - --mkdir $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571 ---exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571 --force-if-open --start-position=$binlog_load_data --stop-position=$binlog_end $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog +--exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571 --force-if-open --start-position=$binlog_load_data --stop-position=$binlog_end $datadir/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval select -(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog")) -is not null; +eval set @a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"); --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -let $error_code= `select @a like "%#%error_code=0%" /* must return 0*/`; -eval select $error_code /* must return 0 to mean the killed query is in */; +select @a like '%#%error_code=0%' /* must return 0 to mean the killed query is in */; # cleanup for the sub-case remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog; diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932.test index 2a210bea0e0..58c4befa8d6 100644 --- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932.test +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932.test @@ -1,26 +1 @@ -# disabled in embedded until tools running is fixed with embedded ---source include/not_embedded.inc - --- source include/have_binlog_format_mixed_or_statement.inc --- source include/have_cp932.inc --- source include/have_log_bin.inc - -RESET MASTER; - -# Bug#16217 (mysql client did not know how not switch its internal charset) -create table t3 (f text character set utf8); -create table t4 (f text character set cp932); ---exec $MYSQL --default-character-set=utf8 test -e "insert into t3 values(_utf8'ソ')" ---exec $MYSQL --default-character-set=cp932 test -e "insert into t4 values(_cp932'ƒ\');" -flush logs; -rename table t3 to t03, t4 to t04; -let $MYSQLD_DATADIR= `select @@datadir`; ---exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 | $MYSQL --default-character-set=utf8 -# original and recovered data must be equal -select HEX(f) from t03; -select HEX(f) from t3; -select HEX(f) from t04; -select HEX(f) from t4; - -drop table t3, t4, t03, t04; ---echo End of 5.0 tests +--source extra/binlog_tests/binlog_mysqlbinlog-cp932.inc diff --git a/mysql-test/suite/binlog/t/binlog_row_annotate.test b/mysql-test/suite/binlog/t/binlog_row_annotate.test index 3221f8e012d..569391e68ce 100644 --- a/mysql-test/suite/binlog/t/binlog_row_annotate.test +++ b/mysql-test/suite/binlog/t/binlog_row_annotate.test @@ -1,193 +1 @@ -############################################################################### -# WL47: Store in binlog text of statements that caused RBR events -# new event: ANNOTATE_ROWS_EVENT -# new master option: --binlog-annotate-row-events -# new mysqlbinlog option: --skip-annotate-row-events -# -# Intended to test that: -# *** If the --binlog-annotate-row-events option is switched on on master -# then Annotate_rows events: -# - are generated; -# - are genrated only once for "multi-table-maps" rbr queries; -# - are not generated when the corresponding queries are filtered away; -# - are generated when the corresponding queries are filtered away partialy -# (e.g. in case of multi-delete). -# *** Annotate_rows events are printed by mysqlbinlog started without -# --skip-annotate-row-events options both in remote and local cases. -# *** Annotate_rows events are not printed by mysqlbinlog started with -# --skip-annotate-row-events options both in remote and local cases. -############################################################################### - ---source include/have_log_bin.inc ---source include/have_binlog_format_row.inc ---source include/binlog_start_pos.inc - ---disable_query_log - -set sql_mode=""; -set global binlog_checksum=NONE; - -# Fix timestamp to avoid varying results -SET timestamp=1000000000; - -# Delete all existing binary logs -RESET MASTER; - ---disable_warnings -DROP DATABASE IF EXISTS test1; -DROP DATABASE IF EXISTS test2; -DROP DATABASE IF EXISTS test3; -DROP DATABASE IF EXISTS xtest1; -DROP DATABASE IF EXISTS xtest2; ---enable_warnings - -CREATE DATABASE test1; -CREATE TABLE test1.t1(a int); - -CREATE DATABASE test2; -CREATE TABLE test2.t2(a int); -CREATE VIEW test2.v2 AS SELECT * FROM test2.t2; - -CREATE DATABASE test3; -CREATE TABLE test3.t3(a int); - -CREATE DATABASE xtest1; -CREATE TABLE xtest1.xt1(a int); - -CREATE DATABASE xtest2; -CREATE TABLE xtest2.xt2(a int); - -# By default SESSION binlog_annotate_row_events = OFF - -INSERT INTO test1.t1 VALUES (1), (2), (3); - -SET SESSION binlog_annotate_row_events = ON; - -INSERT INTO test2.t2 VALUES (1), (2), (3); -INSERT INTO test3.t3 VALUES (1), (2), (3); - -# This query generates two Table maps but the Annotate -# event should appear only once before the first Table map -DELETE test1.t1, test2.t2 - FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3 - WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3.a; - -# This event should be filtered out together with Annotate event -INSERT INTO xtest1.xt1 VALUES (1), (2), (3); - -# This event should pass the filter -INSERT INTO test2.v2 VALUES (1), (2), (3); - -# This event should pass the filter only for test2.t2 part -DELETE xtest1.xt1, test2.t2 - FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3 - WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3.a; - -# These events should be filtered out together with Annotate events -INSERT INTO xtest1.xt1 VALUES (1), (2), (3); -INSERT INTO xtest2.xt2 VALUES (1), (2), (3); -DELETE xtest1.xt1, xtest2.xt2 - FROM xtest1.xt1 INNER JOIN xtest2.xt2 INNER JOIN test3.t3 - WHERE xtest1.xt1.a=xtest2.xt2.a AND xtest2.xt2.a=test3.t3.a; - -FLUSH LOGS; ---enable_query_log - ---echo ##################################################################################### ---echo # The following Annotate_rows events should appear below: ---echo # - INSERT INTO test2.t2 VALUES (1), (2), (3) ---echo # - INSERT INTO test3.t3 VALUES (1), (2), (3) ---echo # - DELETE test1.t1, test2.t2 FROM <...> ---echo # - INSERT INTO test2.t2 VALUES (1), (2), (3) ---echo # - DELETE xtest1.xt1, test2.t2 FROM <...> ---echo ##################################################################################### - -let $start_pos= `select @binlog_start_pos`; ---replace_column 2 # 5 # ---replace_result $start_pos ---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// ---eval show binlog events in 'master-bin.000001' from $start_pos - ---echo # ---echo ##################################################################################### ---echo # mysqlbinlog ---echo # The following Annotates should appear in this output: ---echo # - INSERT INTO test2.t2 VALUES (1), (2), (3) ---echo # - INSERT INTO test3.t3 VALUES (1), (2), (3) ---echo # - DELETE test1.t1, test2.t2 FROM <...> (with two subsequent Table maps) ---echo # - INSERT INTO test2.t2 VALUES (1), (2), (3) ---echo # - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map) ---echo ##################################################################################### - -let $MYSQLD_DATADIR= `select @@datadir`; ---replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ ---exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001 - ---echo # ---echo ##################################################################################### ---echo # mysqlbinlog --database=test1 ---echo # The following Annotate should appear in this output: ---echo # - DELETE test1.t1, test2.t2 FROM <...> ---echo ##################################################################################### - -let $MYSQLD_DATADIR= `select @@datadir`; ---replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ ---exec $MYSQL_BINLOG --base64-output=decode-rows --database=test1 -v -v $MYSQLD_DATADIR/master-bin.000001 - ---echo # ---echo ##################################################################################### ---echo # mysqlbinlog --skip-annotate-row-events ---echo # No Annotates should appear in this output ---echo ##################################################################################### - -let $MYSQLD_DATADIR= `select @@datadir`; ---replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ ---exec $MYSQL_BINLOG --base64-output=decode-rows --skip-annotate-row-events -v -v $MYSQLD_DATADIR/master-bin.000001 - ---echo # ---echo ##################################################################################### ---echo # mysqlbinlog --read-from-remote-server ---echo # The following Annotates should appear in this output: ---echo # - INSERT INTO test2.t2 VALUES (1), (2), (3) ---echo # - INSERT INTO test3.t3 VALUES (1), (2), (3) ---echo # - DELETE test1.t1, test2.t2 FROM <...> (with two subsequent Table maps) ---echo # - INSERT INTO test2.t2 VALUES (1), (2), (3) ---echo # - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map) ---echo ##################################################################################### - -let $MYSQLD_DATADIR= `select @@datadir`; ---replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ ---exec $MYSQL_BINLOG --base64-output=decode-rows -v -v --read-from-remote-server --user=root --host=localhost --port=$MASTER_MYPORT master-bin.000001 - ---echo # ---echo ##################################################################################### ---echo # mysqlbinlog --read-from-remote-server --database=test1 ---echo # The following Annotate should appear in this output: ---echo # - DELETE test1.t1, test2.t2 FROM <...> ---echo ##################################################################################### - -let $MYSQLD_DATADIR= `select @@datadir`; ---replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ ---exec $MYSQL_BINLOG --base64-output=decode-rows --database=test1 -v -v --read-from-remote-server --user=root --host=localhost --port=$MASTER_MYPORT master-bin.000001 - ---echo # ---echo ##################################################################################### ---echo # mysqlbinlog --read-from-remote-server --skip-annotate-row-events ---echo # No Annotates should appear in this output ---echo ##################################################################################### - -let $MYSQLD_DATADIR= `select @@datadir`; ---replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ ---exec $MYSQL_BINLOG --base64-output=decode-rows --skip-annotate-row-events -v -v --read-from-remote-server --user=root --host=localhost --port=$MASTER_MYPORT master-bin.000001 - -# Clean-up - ---disable_query_log -set global binlog_checksum=default; -DROP DATABASE test1; -DROP DATABASE test2; -DROP DATABASE test3; -DROP DATABASE xtest1; -DROP DATABASE xtest2; ---enable_query_log - +--source extra/binlog_tests/binlog_row_annotate.inc diff --git a/mysql-test/suite/binlog/t/binlog_stm_ps.test b/mysql-test/suite/binlog/t/binlog_stm_ps.test index e86db980b00..e6e54985f6f 100644 --- a/mysql-test/suite/binlog/t/binlog_stm_ps.test +++ b/mysql-test/suite/binlog/t/binlog_stm_ps.test @@ -28,3 +28,74 @@ prepare s from "insert into t1 select 100 limit ?"; set @a=100; execute s using @a; source include/show_binlog_events.inc; drop table t1; + +--echo # +--echo # MDEV-10709 Expressions as parameters to Dynamic SQL +--echo # + +FLUSH LOGS; +SET TIMESTAMP=UNIX_TIMESTAMP('2001-01-02 10:20:30.123456'); +CREATE TABLE t1 (a DECIMAL(30,8)); +PREPARE stmt FROM 'INSERT INTO t1 VALUES (?)'; +EXECUTE stmt USING 10; +EXECUTE stmt USING 11e0; +EXECUTE stmt USING 12.1; +EXECUTE stmt USING '13'; +EXECUTE stmt USING CURRENT_DATE; +EXECUTE stmt USING MAKETIME(10,20,30); +EXECUTE stmt USING CURRENT_TIME; +EXECUTE stmt USING CURRENT_TIME(3); +EXECUTE stmt USING CURRENT_TIME(6); +EXECUTE stmt USING CURRENT_TIMESTAMP; +EXECUTE stmt USING CURRENT_TIMESTAMP(3); +EXECUTE stmt USING CURRENT_TIMESTAMP(6); +SELECT * FROM t1; +--let $binlog_file = LAST +source include/show_binlog_events.inc; +DROP TABLE t1; +SET TIMESTAMP=DEFAULT; + +--echo # +--echo # MDEV-10585 EXECUTE IMMEDIATE statement +--echo # + +FLUSH LOGS; +CREATE TABLE t1 (a INT); +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (101)'; +SET @a=102; +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' USING @a; +SET @a=103; +SET @stmt='INSERT INTO t1 VALUES (?)'; +EXECUTE IMMEDIATE @stmt USING @a; +--let $binlog_file = LAST +source include/show_binlog_events.inc; +DROP TABLE t1; + +--echo # +--echo # MDEV-11360 Dynamic SQL: DEFAULT as a bind parameter +--echo # + +FLUSH LOGS; +CREATE TABLE t1 (a INT DEFAULT 10); +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (Default)'; +--echo # The output of this query in 'Note' is a syntactically incorrect query. +--echo # But as it's never logged, it's ok. It should be human readable only. +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT ?' USING Default; +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' USING Default; + +DELIMITER $$; +CREATE PROCEDURE p1 () +BEGIN + INSERT INTO t1 VALUES (Default); + # EXPLAIN should not be logged + EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT ?' USING Default; + EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' USING Default; +END; +$$ +DELIMITER ;$$ +CALL p1; +DROP PROCEDURE p1; +DROP TABLE t1; + +--let $binlog_file = LAST +source include/show_binlog_events.inc; diff --git a/mysql-test/suite/binlog/t/binlog_write_error.test b/mysql-test/suite/binlog/t/binlog_write_error.test index 78f55c1bb0d..05f8eff6c3a 100644 --- a/mysql-test/suite/binlog/t/binlog_write_error.test +++ b/mysql-test/suite/binlog/t/binlog_write_error.test @@ -1,102 +1 @@ -# -# === Name === -# -# binlog_write_error.test -# -# === Description === -# -# This test case check if the error of writing binlog file is properly -# reported and handled when executing statements. -# -# === Related Bugs === -# -# BUG#37148 -# - -source include/have_log_bin.inc; -source include/have_debug.inc; -source include/have_binlog_format_mixed_or_statement.inc; - ---echo # ---echo # Initialization ---echo # - -disable_warnings; -DROP TABLE IF EXISTS t1, t2; -DROP FUNCTION IF EXISTS f1; -DROP FUNCTION IF EXISTS f2; -DROP PROCEDURE IF EXISTS p1; -DROP PROCEDURE IF EXISTS p2; -DROP TRIGGER IF EXISTS tr1; -DROP TRIGGER IF EXISTS tr2; -DROP VIEW IF EXISTS v1, v2; -enable_warnings; - ---echo # ---echo # Test injecting binlog write error when executing queries ---echo # - -let $query= CREATE TABLE t1 (a INT); -source include/binlog_inject_error.inc; - -INSERT INTO t1 VALUES (1),(2),(3); - -let $query= INSERT INTO t1 VALUES (4),(5),(6); -source include/binlog_inject_error.inc; - -let $query= UPDATE t1 set a=a+1; -source include/binlog_inject_error.inc; - -let $query= DELETE FROM t1; -source include/binlog_inject_error.inc; - -let $query= CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t1 VALUES (new.a + 100); -source include/binlog_inject_error.inc; - -let $query= DROP TRIGGER tr1; -source include/binlog_inject_error.inc; - -let $query= ALTER TABLE t1 ADD (b INT); -source include/binlog_inject_error.inc; - -let $query= CREATE VIEW v1 AS SELECT a FROM t1; -source include/binlog_inject_error.inc; - -let $query= DROP VIEW v1; -source include/binlog_inject_error.inc; - -let $query= CREATE PROCEDURE p1(OUT rows INT) SELECT count(*) INTO rows FROM t1; -source include/binlog_inject_error.inc; - -let $query= DROP PROCEDURE p1; -source include/binlog_inject_error.inc; - -let $query= DROP TABLE t1; -source include/binlog_inject_error.inc; - -let $query= CREATE FUNCTION f1() RETURNS INT return 1; -source include/binlog_inject_error.inc; - -let $query= DROP FUNCTION f1; -source include/binlog_inject_error.inc; - -let $query= CREATE USER user1; -source include/binlog_inject_error.inc; - -let $query= REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1; -source include/binlog_inject_error.inc; - -let $query= DROP USER user1; -source include/binlog_inject_error.inc; - ---echo # ---echo # Cleanup ---echo # - -disable_warnings; -DROP TABLE IF EXISTS t1, t2; -DROP FUNCTION IF EXISTS f1; -DROP PROCEDURE IF EXISTS p1; -DROP TRIGGER IF EXISTS tr1; -DROP VIEW IF EXISTS v1, v2; -enable_warnings; +--source extra/binlog_tests/binlog_write_error.inc diff --git a/mysql-test/suite/binlog/t/binlog_xa_recover.test b/mysql-test/suite/binlog/t/binlog_xa_recover.test index 903044ca5bd..0e0b80433ff 100644 --- a/mysql-test/suite/binlog/t/binlog_xa_recover.test +++ b/mysql-test/suite/binlog/t/binlog_xa_recover.test @@ -1,275 +1 @@ ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/have_binlog_format_row.inc -# Valgrind does not work well with test that crashes the server ---source include/not_valgrind.inc - -# (We do not need to restore these settings, as we crash the server). -SET GLOBAL max_binlog_size= 4096; -SET GLOBAL innodb_flush_log_at_trx_commit= 1; -RESET MASTER; - -CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb; -# Insert some data to force a couple binlog rotations (3), so we get some -# normal binlog checkpoints before starting the test. -INSERT INTO t1 VALUES (100, REPEAT("x", 4100)); -# Wait for the master-bin.000002 binlog checkpoint to appear. ---let $wait_for_all= 0 ---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000002" ---let $field= Info ---let $condition= = "master-bin.000002" ---source include/wait_show_condition.inc -INSERT INTO t1 VALUES (101, REPEAT("x", 4100)); ---let $wait_for_all= 0 ---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000003" ---let $field= Info ---let $condition= = "master-bin.000003" ---source include/wait_show_condition.inc -INSERT INTO t1 VALUES (102, REPEAT("x", 4100)); ---let $wait_for_all= 0 ---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004" ---let $field= Info ---let $condition= = "master-bin.000004" ---source include/wait_show_condition.inc - -# Now start a bunch of transactions that span multiple binlog -# files. Leave then in the state prepared-but-not-committed in the engine -# and crash the server. Check that crash recovery is able to recover all -# of them. -# -# We use debug_sync to get all the transactions into the prepared state before -# we commit any of them. This is because the prepare step flushes the InnoDB -# redo log - including any commits made before, so recovery would become -# unnecessary, decreasing the value of this test. -# -# We arrange to have con1 with a prepared transaction in master-bin.000004, -# con2 and con3 with a prepared transaction in master-bin.000005, and a new -# empty master-bin.000006. So the latest binlog checkpoint should be -# master-bin.000006. - -connect(con1,localhost,root,,); -# First wait after prepare and before write to binlog. -SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con1_wait WAIT_FOR con1_cont"; -# Then complete InnoDB commit in memory (but not commit checkpoint / write to -# disk), and hang until crash, leaving a transaction to be XA recovered. -SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR _ever"; -send INSERT INTO t1 VALUES (1, REPEAT("x", 4100)); - -connection default; -SET DEBUG_SYNC= "now WAIT_FOR con1_wait"; - -connect(con2,localhost,root,,); -SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con2_wait WAIT_FOR con2_cont"; -SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con2_ready WAIT_FOR _ever"; -send INSERT INTO t1 VALUES (2, NULL); - -connection default; -SET DEBUG_SYNC= "now WAIT_FOR con2_wait"; - -connect(con3,localhost,root,,); -SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con3_wait WAIT_FOR con3_cont"; -SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con3_ready WAIT_FOR _ever"; -send INSERT INTO t1 VALUES (3, REPEAT("x", 4100)); - -connection default; -SET DEBUG_SYNC= "now WAIT_FOR con3_wait"; - -connect(con4,localhost,root,,); -SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con4_wait WAIT_FOR con4_cont"; -SET SESSION debug_dbug="+d,crash_commit_after_log"; -send INSERT INTO t1 VALUES (4, NULL); - -connection default; -SET DEBUG_SYNC= "now WAIT_FOR con4_wait"; - -SET DEBUG_SYNC= "now SIGNAL con1_cont"; -SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; -SET DEBUG_SYNC= "now SIGNAL con2_cont"; -SET DEBUG_SYNC= "now WAIT_FOR con2_ready"; -SET DEBUG_SYNC= "now SIGNAL con3_cont"; -SET DEBUG_SYNC= "now WAIT_FOR con3_ready"; - -# Check that everything is committed in binary log. ---source include/show_binary_logs.inc ---let $binlog_file= master-bin.000003 ---let $binlog_start= 4 ---source include/show_binlog_events.inc ---let $binlog_file= master-bin.000004 ---source include/show_binlog_events.inc ---let $binlog_file= master-bin.000005 ---source include/show_binlog_events.inc ---let $binlog_file= master-bin.000006 ---source include/show_binlog_events.inc - - -# Check that server will not purge too much. -PURGE BINARY LOGS TO "master-bin.000006"; ---source include/show_binary_logs.inc - -# Now crash the server with one more transaction in prepared state. ---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -wait-binlog_xa_recover.test -EOF ---error 0,2006,2013 -SET DEBUG_SYNC= "now SIGNAL con4_cont"; -connection con4; ---error 2006,2013 -reap; - ---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart-group_commit_binlog_pos.test -EOF - -connection default; ---enable_reconnect ---source include/wait_until_connected_again.inc - -# Check that all transactions are recovered. -SELECT a FROM t1 ORDER BY a; - ---echo Test that with multiple binlog checkpoints, recovery starts from the last one. -SET GLOBAL max_binlog_size= 4096; -SET GLOBAL innodb_flush_log_at_trx_commit= 1; -RESET MASTER; - -# Rotate to binlog master-bin.000003 while delaying binlog checkpoints. -# So we get multiple binlog checkpoints in master-bin.000003. -# Then complete the checkpoints, crash, and check that we only scan -# the necessary binlog file (ie. that we use the _last_ checkpoint). - -connect(con10,localhost,root,,); -SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con10_ready WAIT_FOR con10_cont"; -send INSERT INTO t1 VALUES (10, REPEAT("x", 4100)); - -connection default; -SET DEBUG_SYNC= "now WAIT_FOR con10_ready"; - -connect(con11,localhost,root,,); -SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con11_ready WAIT_FOR con11_cont"; -send INSERT INTO t1 VALUES (11, REPEAT("x", 4100)); - -connection default; -SET DEBUG_SYNC= "now WAIT_FOR con11_ready"; - -connect(con12,localhost,root,,); -SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con12_ready WAIT_FOR con12_cont"; -send INSERT INTO t1 VALUES (12, REPEAT("x", 4100)); - -connection default; -SET DEBUG_SYNC= "now WAIT_FOR con12_ready"; -INSERT INTO t1 VALUES (13, NULL); - ---source include/show_binary_logs.inc ---let $binlog_file= master-bin.000004 ---let $binlog_start= 4 ---source include/show_binlog_events.inc - -SET DEBUG_SYNC= "now SIGNAL con10_cont"; -connection con10; -reap; -connection default; - -# We need to sync the test case with the background processing of the -# commit checkpoint, otherwise we get nondeterministic results. -SET @old_dbug= @@global.DEBUG_DBUG; -SET GLOBAL debug_dbug="+d,binlog_background_checkpoint_processed"; - -SET DEBUG_SYNC= "now SIGNAL con12_cont"; -connection con12; -reap; -connection default; -SET DEBUG_SYNC= "now WAIT_FOR binlog_background_checkpoint_processed"; -SET GLOBAL debug_dbug= @old_dbug; - -SET DEBUG_SYNC= "now SIGNAL con11_cont"; -connection con11; -reap; - -connection default; -# Wait for the last (master-bin.000004) binlog checkpoint to appear. ---let $wait_for_all= 0 ---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004" ---let $field= Info ---let $condition= = "master-bin.000004" ---source include/wait_show_condition.inc - ---echo Checking that master-bin.000004 is the last binlog checkpoint ---source include/show_binlog_events.inc - ---echo Now crash the server -# It is not too easy to test XA recovery, as it runs early during server -# startup, before any connections can be made. -# What we do is set a DBUG error insert which will crash if XA recovery -# starts from any other binlog than master-bin.000004 (check the file -# binlog_xa_recover-master.opt). Then we will fail here if XA recovery -# would start from the wrong place. ---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -wait-binlog_xa_recover.test -EOF -SET SESSION debug_dbug="+d,crash_commit_after_log"; ---error 2006,2013 -INSERT INTO t1 VALUES (14, NULL); - ---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart-group_commit_binlog_pos.test -EOF - -connection default; ---enable_reconnect ---source include/wait_until_connected_again.inc - -# Check that all transactions are recovered. -SELECT a FROM t1 ORDER BY a; - - ---echo *** Check that recovery works if we crashed early during rotate, before ---echo *** binlog checkpoint event could be written. - -SET GLOBAL max_binlog_size= 4096; -SET GLOBAL innodb_flush_log_at_trx_commit= 1; -RESET MASTER; - -# We need some initial data to reach binlog master-bin.000004. Otherwise -# crash recovery fails due to the error insert used for previous test. -INSERT INTO t1 VALUES (21, REPEAT("x", 4100)); -INSERT INTO t1 VALUES (22, REPEAT("x", 4100)); -# Wait for the master-bin.000003 binlog checkpoint to appear. ---let $wait_for_all= 0 ---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000003" ---let $field= Info ---let $condition= = "master-bin.000003" ---source include/wait_show_condition.inc -INSERT INTO t1 VALUES (23, REPEAT("x", 4100)); -# Wait for the last (master-bin.000004) binlog checkpoint to appear. ---let $wait_for_all= 0 ---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004" ---let $field= Info ---let $condition= = "master-bin.000004" ---source include/wait_show_condition.inc - ---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -wait-binlog_xa_recover.test -EOF -SET SESSION debug_dbug="+d,crash_before_write_checkpoint_event"; ---error 2006,2013 -INSERT INTO t1 VALUES (24, REPEAT("x", 4100)); - ---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart-group_commit_binlog_pos.test -EOF - ---enable_reconnect ---source include/wait_until_connected_again.inc - -# Check that all transactions are recovered. -SELECT a FROM t1 ORDER BY a; - ---source include/show_binary_logs.inc ---let $binlog_file= master-bin.000004 ---let $binlog_start= 4 ---source include/show_binlog_events.inc - -# Cleanup -connection default; -DROP TABLE t1; +--source extra/binlog_tests/binlog_xa_recover.inc diff --git a/mysql-test/suite/binlog_encryption/binlog_incident.combinations b/mysql-test/suite/binlog_encryption/binlog_incident.combinations new file mode 100644 index 00000000000..2269ed4a7a1 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/binlog_incident.combinations @@ -0,0 +1,8 @@ +[stmt] +binlog-format=statement + +[mix] +binlog-format=mixed + +[row] +binlog-format=row diff --git a/mysql-test/suite/binlog_encryption/binlog_incident.result b/mysql-test/suite/binlog_encryption/binlog_incident.result new file mode 100644 index 00000000000..7a555743723 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/binlog_incident.result @@ -0,0 +1,13 @@ +RESET MASTER; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +SELECT * FROM t1; +a +1 +2 +3 +REPLACE INTO t1 VALUES (4); +DROP TABLE t1; +FLUSH LOGS; +Contain RELOAD DATABASE +1 diff --git a/mysql-test/suite/binlog_encryption/binlog_incident.test b/mysql-test/suite/binlog_encryption/binlog_incident.test new file mode 100644 index 00000000000..d37ed3d552d --- /dev/null +++ b/mysql-test/suite/binlog_encryption/binlog_incident.test @@ -0,0 +1,2 @@ +--let $use_remote_mysqlbinlog= 1 +--source extra/binlog_tests/binlog_incident.inc diff --git a/mysql-test/suite/binlog_encryption/binlog_index.result b/mysql-test/suite/binlog_encryption/binlog_index.result new file mode 100644 index 00000000000..bb5d9ff74f1 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/binlog_index.result @@ -0,0 +1,187 @@ +call mtr.add_suppression('Attempting backtrace'); +call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to process registered files that would be purged.'); +call mtr.add_suppression('MYSQL_BIN_LOG::open failed to sync the index file'); +call mtr.add_suppression('Turning logging off for the whole duration of the MySQL server process.'); +call mtr.add_suppression('Could not open .*'); +call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to clean registers before purging logs.'); +flush tables; +RESET MASTER; +flush logs; +flush logs; +flush logs; +show binary logs; +Log_name File_size +master-bin.000001 # +master-bin.000002 # +master-bin.000003 # +master-bin.000004 # +flush tables; +purge binary logs TO 'master-bin.000004'; +Warnings: +Warning 1612 Being purged log master-bin.000001 was not found +*** must show a list starting from the 'TO' argument of PURGE *** +show binary logs; +Log_name File_size +master-bin.000004 # +reset master; +flush logs; +flush logs; +flush logs; +*** must be a warning master-bin.000001 was not found *** +Warnings: +Warning 1612 Being purged log master-bin.000001 was not found +*** must show one record, of the active binlog, left in the index file after PURGE *** +show binary logs; +Log_name File_size +master-bin.000004 # +reset master; +flush logs; +flush logs; +flush logs; +purge binary logs TO 'master-bin.000002'; +ERROR HY000: Fatal error during log purge +show warnings; +Level Code Message +Warning 1377 a problem with deleting master-bin.000001; consider examining correspondence of your binlog index file to the actual binlog files +Error 1377 Fatal error during log purge +reset master; +# crash_purge_before_update_index +flush logs; +SET SESSION debug_dbug="+d,crash_purge_before_update_index"; +purge binary logs TO 'master-bin.000002'; +ERROR HY000: Lost connection to MySQL server during query +SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index'); +SELECT @index; +@index +master-bin.000001 +master-bin.000002 +master-bin.000003 + +# crash_purge_non_critical_after_update_index +flush logs; +SET SESSION debug_dbug="+d,crash_purge_non_critical_after_update_index"; +purge binary logs TO 'master-bin.000004'; +ERROR HY000: Lost connection to MySQL server during query +SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index'); +SELECT @index; +@index +master-bin.000004 +master-bin.000005 + +# crash_purge_critical_after_update_index +flush logs; +SET SESSION debug_dbug="+d,crash_purge_critical_after_update_index"; +purge binary logs TO 'master-bin.000006'; +ERROR HY000: Lost connection to MySQL server during query +SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index'); +SELECT @index; +@index +master-bin.000006 +master-bin.000007 + +# crash_create_non_critical_before_update_index +SET SESSION debug_dbug="+d,crash_create_non_critical_before_update_index"; +flush logs; +ERROR HY000: Lost connection to MySQL server during query +SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index'); +SELECT @index; +@index +master-bin.000006 +master-bin.000007 +master-bin.000008 + +# crash_create_critical_before_update_index +SET SESSION debug_dbug="+d,crash_create_critical_before_update_index"; +flush logs; +ERROR HY000: Lost connection to MySQL server during query +SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index'); +SELECT @index; +@index +master-bin.000006 +master-bin.000007 +master-bin.000008 +master-bin.000009 + +# crash_create_after_update_index +SET SESSION debug_dbug="+d,crash_create_after_update_index"; +flush logs; +ERROR HY000: Lost connection to MySQL server during query +SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index'); +SELECT @index; +@index +master-bin.000006 +master-bin.000007 +master-bin.000008 +master-bin.000009 +master-bin.000010 +master-bin.000011 + +# +# This should put the server in unsafe state and stop +# accepting any command. If we inject a fault at this +# point and continue the execution the server crashes. +# +SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index'); +SELECT @index; +@index +master-bin.000006 +master-bin.000007 +master-bin.000008 +master-bin.000009 +master-bin.000010 +master-bin.000011 + +# fault_injection_registering_index +SET SESSION debug_dbug="+d,fault_injection_registering_index"; +flush logs; +ERROR HY000: Can't open file: 'master-bin.000012' (errno: 1 "Operation not permitted") +SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index'); +SELECT @index; +@index +master-bin.000006 +master-bin.000007 +master-bin.000008 +master-bin.000009 +master-bin.000010 +master-bin.000011 + +SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index'); +SELECT @index; +@index +master-bin.000006 +master-bin.000007 +master-bin.000008 +master-bin.000009 +master-bin.000010 +master-bin.000011 +master-bin.000012 + +# fault_injection_updating_index +SET SESSION debug_dbug="+d,fault_injection_updating_index"; +flush logs; +ERROR HY000: Can't open file: 'master-bin.000013' (errno: 1 "Operation not permitted") +SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index'); +SELECT @index; +@index +master-bin.000006 +master-bin.000007 +master-bin.000008 +master-bin.000009 +master-bin.000010 +master-bin.000011 +master-bin.000012 + +SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index'); +SELECT @index; +@index +master-bin.000006 +master-bin.000007 +master-bin.000008 +master-bin.000009 +master-bin.000010 +master-bin.000011 +master-bin.000012 +master-bin.000013 + +SET SESSION debug_dbug=""; +End of tests diff --git a/mysql-test/suite/binlog_encryption/binlog_index.test b/mysql-test/suite/binlog_encryption/binlog_index.test new file mode 100644 index 00000000000..1837c683bba --- /dev/null +++ b/mysql-test/suite/binlog_encryption/binlog_index.test @@ -0,0 +1 @@ +--source extra/binlog_tests/binlog_index.inc diff --git a/mysql-test/suite/binlog_encryption/binlog_ioerr.result b/mysql-test/suite/binlog_encryption/binlog_ioerr.result new file mode 100644 index 00000000000..6b3120b6d89 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/binlog_ioerr.result @@ -0,0 +1,32 @@ +CALL mtr.add_suppression("Error writing file 'master-bin'"); +RESET MASTER; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb; +INSERT INTO t1 VALUES(0); +SET SESSION debug_dbug='+d,fail_binlog_write_1'; +INSERT INTO t1 VALUES(1); +ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device") +INSERT INTO t1 VALUES(2); +ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device") +SET SESSION debug_dbug=''; +INSERT INTO t1 VALUES(3); +SELECT * FROM t1; +a +0 +3 +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +BINLOG POS Format_desc 1 ENDPOS Server ver: #, Binlog ver: # +BINLOG POS Start_encryption 1 ENDPOS +BINLOG POS Gtid_list 1 ENDPOS [] +BINLOG POS Binlog_checkpoint 1 ENDPOS master-bin.000001 +BINLOG POS Gtid 1 ENDPOS GTID 0-1-1 +BINLOG POS Query 1 ENDPOS use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb +BINLOG POS Gtid 1 ENDPOS BEGIN GTID 0-1-2 +BINLOG POS Query 1 ENDPOS use `test`; INSERT INTO t1 VALUES(0) +BINLOG POS Xid 1 ENDPOS COMMIT /* XID */ +BINLOG POS Gtid 1 ENDPOS BEGIN GTID 0-1-3 +BINLOG POS Gtid 1 ENDPOS BEGIN GTID 0-1-4 +BINLOG POS Gtid 1 ENDPOS BEGIN GTID 0-1-5 +BINLOG POS Query 1 ENDPOS use `test`; INSERT INTO t1 VALUES(3) +BINLOG POS Xid 1 ENDPOS COMMIT /* XID */ +DROP TABLE t1; diff --git a/mysql-test/suite/binlog_encryption/binlog_ioerr.test b/mysql-test/suite/binlog_encryption/binlog_ioerr.test new file mode 100644 index 00000000000..3155e14e6b0 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/binlog_ioerr.test @@ -0,0 +1 @@ +--source extra/binlog_tests/binlog_ioerr.inc diff --git a/mysql-test/suite/binlog_encryption/binlog_mysqlbinlog-cp932-master.opt b/mysql-test/suite/binlog_encryption/binlog_mysqlbinlog-cp932-master.opt new file mode 100644 index 00000000000..bb0cda4519a --- /dev/null +++ b/mysql-test/suite/binlog_encryption/binlog_mysqlbinlog-cp932-master.opt @@ -0,0 +1 @@ +--max-binlog-size=8192 diff --git a/mysql-test/suite/binlog_encryption/binlog_mysqlbinlog-cp932.result b/mysql-test/suite/binlog_encryption/binlog_mysqlbinlog-cp932.result new file mode 100644 index 00000000000..cbf6159516a --- /dev/null +++ b/mysql-test/suite/binlog_encryption/binlog_mysqlbinlog-cp932.result @@ -0,0 +1,19 @@ +RESET MASTER; +create table t3 (f text character set utf8); +create table t4 (f text character set cp932); +flush logs; +rename table t3 to t03, t4 to t04; +select HEX(f) from t03; +HEX(f) +E382BD +select HEX(f) from t3; +HEX(f) +E382BD +select HEX(f) from t04; +HEX(f) +835C +select HEX(f) from t4; +HEX(f) +835C +drop table t3, t4, t03, t04; +End of 5.0 tests diff --git a/mysql-test/suite/binlog_encryption/binlog_mysqlbinlog-cp932.test b/mysql-test/suite/binlog_encryption/binlog_mysqlbinlog-cp932.test new file mode 100644 index 00000000000..3af0015a486 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/binlog_mysqlbinlog-cp932.test @@ -0,0 +1,2 @@ +--let $use_remote_mysqlbinlog= 1 +--source extra/binlog_tests/binlog_mysqlbinlog-cp932.inc diff --git a/mysql-test/suite/binlog_encryption/binlog_row_annotate-master.opt b/mysql-test/suite/binlog_encryption/binlog_row_annotate-master.opt new file mode 100644 index 00000000000..344a4ffc014 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/binlog_row_annotate-master.opt @@ -0,0 +1 @@ +--timezone=GMT-3 --binlog-do-db=test1 --binlog-do-db=test2 --binlog-do-db=test3 --binlog-checksum=NONE diff --git a/mysql-test/suite/binlog_encryption/binlog_row_annotate.result b/mysql-test/suite/binlog_encryption/binlog_row_annotate.result new file mode 100644 index 00000000000..f4cfc86619d --- /dev/null +++ b/mysql-test/suite/binlog_encryption/binlog_row_annotate.result @@ -0,0 +1,692 @@ +set @old_binlog_checksum=@@binlog_checksum; +set global binlog_checksum=NONE; +set sql_mode=""; +SET timestamp=1000000000; +RESET MASTER; +CREATE DATABASE test1; +CREATE TABLE test1.t1(a int); +CREATE DATABASE test2; +CREATE TABLE test2.t2(a int); +CREATE VIEW test2.v2 AS SELECT * FROM test2.t2; +CREATE DATABASE test3; +CREATE TABLE test3.t3(a int); +CREATE DATABASE xtest1; +CREATE TABLE xtest1.xt1(a int); +CREATE DATABASE xtest2; +CREATE TABLE xtest2.xt2(a int); +INSERT INTO test1.t1 VALUES (1), (2), (3); +SET SESSION binlog_annotate_row_events = ON; +INSERT INTO test2.t2 VALUES (1), (2), (3); +INSERT INTO test3.t3 VALUES (1), (2), (3); +DELETE test1.t1, test2.t2 +FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3 +WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3.a; +INSERT INTO xtest1.xt1 VALUES (1), (2), (3); +INSERT INTO test2.v2 VALUES (1), (2), (3); +DELETE xtest1.xt1, test2.t2 +FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3 +WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3.a; +INSERT INTO xtest1.xt1 VALUES (1), (2), (3); +INSERT INTO xtest2.xt2 VALUES (1), (2), (3); +DELETE xtest1.xt1, xtest2.xt2 +FROM xtest1.xt1 INNER JOIN xtest2.xt2 INNER JOIN test3.t3 +WHERE xtest1.xt1.a=xtest2.xt2.a AND xtest2.xt2.a=test3.t3.a; +FLUSH LOGS; +##################################################################################### +# The following Annotate_rows events should appear below: +# - INSERT INTO test2.t2 VALUES (1), (2), (3) +# - INSERT INTO test3.t3 VALUES (1), (2), (3) +# - DELETE test1.t1, test2.t2 FROM <...> +# - INSERT INTO test2.t2 VALUES (1), (2), (3) +# - DELETE xtest1.xt1, test2.t2 FROM <...> +##################################################################################### +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Binlog_checkpoint # # master-bin.000001 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # CREATE DATABASE test1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # CREATE DATABASE test2 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # CREATE DATABASE test3 +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test1.t1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # INSERT INTO test2.t2 VALUES (1), (2), (3) +master-bin.000001 # Table_map # # table_id: # (test2.t2) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # INSERT INTO test3.t3 VALUES (1), (2), (3) +master-bin.000001 # Table_map # # table_id: # (test3.t3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # DELETE test1.t1, test2.t2 +FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3 +WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3.a +master-bin.000001 # Table_map # # table_id: # (test1.t1) +master-bin.000001 # Table_map # # table_id: # (test2.t2) +master-bin.000001 # Delete_rows_v1 # # table_id: # +master-bin.000001 # Delete_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # INSERT INTO test2.v2 VALUES (1), (2), (3) +master-bin.000001 # Table_map # # table_id: # (test2.t2) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # DELETE xtest1.xt1, test2.t2 +FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3 +WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3.a +master-bin.000001 # Table_map # # table_id: # (test2.t2) +master-bin.000001 # Delete_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Rotate # # master-bin.000002;pos=POS +# +##################################################################################### +# mysqlbinlog --read-from-remote-server +# The following Annotates should appear in this output: +# - INSERT INTO test2.t2 VALUES (1), (2), (3) +# - INSERT INTO test3.t3 VALUES (1), (2), (3) +# - DELETE test1.t1, test2.t2 FROM <...> (with two subsequent Table maps) +# - INSERT INTO test2.t2 VALUES (1), (2), (3) +# - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map) +##################################################################################### +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +DELIMITER /*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup +ROLLBACK/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Gtid list [] +# at # +#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001 +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-1 ddl +/*!100101 SET @@session.skip_parallel_replication=0*//*!*/; +/*!100001 SET @@session.gtid_domain_id=0*//*!*/; +/*!100001 SET @@session.server_id=1*//*!*/; +/*!100001 SET @@session.gtid_seq_no=1*//*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +SET @@session.pseudo_thread_id=#/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; +CREATE DATABASE test1 +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-2 ddl +/*!100001 SET @@session.gtid_seq_no=2*//*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +CREATE DATABASE test2 +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-3 ddl +/*!100001 SET @@session.gtid_seq_no=3*//*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +CREATE DATABASE test3 +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-4 +/*!100001 SET @@session.gtid_seq_no=4*//*!*/; +BEGIN +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number # +# at # +#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F +### INSERT INTO `test1`.`t1` +### SET +### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +### INSERT INTO `test1`.`t1` +### SET +### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +### INSERT INTO `test1`.`t1` +### SET +### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-5 +/*!100001 SET @@session.gtid_seq_no=5*//*!*/; +BEGIN +/*!*/; +# at # +# at # +#010909 4:46:40 server id # end_log_pos # Annotate_rows: +#Q> INSERT INTO test2.t2 VALUES (1), (2), (3) +#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number # +# at # +#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F +### INSERT INTO `test2`.`t2` +### SET +### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +### INSERT INTO `test2`.`t2` +### SET +### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +### INSERT INTO `test2`.`t2` +### SET +### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-6 +/*!100001 SET @@session.gtid_seq_no=6*//*!*/; +BEGIN +/*!*/; +# at # +# at # +#010909 4:46:40 server id # end_log_pos # Annotate_rows: +#Q> INSERT INTO test3.t3 VALUES (1), (2), (3) +#010909 4:46:40 server id # end_log_pos # Table_map: `test3`.`t3` mapped to number # +# at # +#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F +### INSERT INTO `test3`.`t3` +### SET +### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +### INSERT INTO `test3`.`t3` +### SET +### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +### INSERT INTO `test3`.`t3` +### SET +### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-7 +/*!100001 SET @@session.gtid_seq_no=7*//*!*/; +BEGIN +/*!*/; +# at # +# at # +#010909 4:46:40 server id # end_log_pos # Annotate_rows: +#Q> DELETE test1.t1, test2.t2 +#Q> FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3 +#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3 +#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number # +# at # +#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number # +# at # +# at # +#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # +#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F +### DELETE FROM `test1`.`t1` +### WHERE +### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +### DELETE FROM `test1`.`t1` +### WHERE +### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +### DELETE FROM `test1`.`t1` +### WHERE +### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +### DELETE FROM `test2`.`t2` +### WHERE +### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +### DELETE FROM `test2`.`t2` +### WHERE +### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +### DELETE FROM `test2`.`t2` +### WHERE +### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-8 +/*!100001 SET @@session.gtid_seq_no=8*//*!*/; +BEGIN +/*!*/; +# at # +# at # +#010909 4:46:40 server id # end_log_pos # Annotate_rows: +#Q> INSERT INTO test2.v2 VALUES (1), (2), (3) +#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number # +# at # +#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F +### INSERT INTO `test2`.`t2` +### SET +### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +### INSERT INTO `test2`.`t2` +### SET +### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +### INSERT INTO `test2`.`t2` +### SET +### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-9 +/*!100001 SET @@session.gtid_seq_no=9*//*!*/; +BEGIN +/*!*/; +# at # +# at # +#010909 4:46:40 server id # end_log_pos # Annotate_rows: +#Q> DELETE xtest1.xt1, test2.t2 +#Q> FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3 +#Q> WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3 +#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number # +# at # +#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F +### DELETE FROM `test2`.`t2` +### WHERE +### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +### DELETE FROM `test2`.`t2` +### WHERE +### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +### DELETE FROM `test2`.`t2` +### WHERE +### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Rotate to master-bin.000002 pos: 4 +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; +# +##################################################################################### +# mysqlbinlog --read-from-remote-server --database=test1 +# The following Annotate should appear in this output: +# - DELETE test1.t1, test2.t2 FROM <...> +##################################################################################### +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +DELIMITER /*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup +ROLLBACK/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Gtid list [] +# at # +#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001 +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-1 ddl +/*!100101 SET @@session.skip_parallel_replication=0*//*!*/; +/*!100001 SET @@session.gtid_domain_id=0*//*!*/; +/*!100001 SET @@session.server_id=1*//*!*/; +/*!100001 SET @@session.gtid_seq_no=1*//*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +SET @@session.pseudo_thread_id=#/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; +CREATE DATABASE test1 +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-2 ddl +/*!100001 SET @@session.gtid_seq_no=2*//*!*/; +# at # +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-3 ddl +/*!100001 SET @@session.gtid_seq_no=3*//*!*/; +# at # +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-4 +/*!100001 SET @@session.gtid_seq_no=4*//*!*/; +BEGIN +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number # +# at # +#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F +### INSERT INTO `test1`.`t1` +### SET +### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +### INSERT INTO `test1`.`t1` +### SET +### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +### INSERT INTO `test1`.`t1` +### SET +### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-5 +/*!100001 SET @@session.gtid_seq_no=5*//*!*/; +BEGIN +/*!*/; +# at # +# at # +# at # +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-6 +/*!100001 SET @@session.gtid_seq_no=6*//*!*/; +BEGIN +/*!*/; +# at # +# at # +# at # +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-7 +/*!100001 SET @@session.gtid_seq_no=7*//*!*/; +BEGIN +/*!*/; +# at # +# at # +#010909 4:46:40 server id # end_log_pos # Annotate_rows: +#Q> DELETE test1.t1, test2.t2 +#Q> FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3 +#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3 +#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number # +# at # +# at # +# at # +#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # +### DELETE FROM `test1`.`t1` +### WHERE +### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +### DELETE FROM `test1`.`t1` +### WHERE +### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +### DELETE FROM `test1`.`t1` +### WHERE +### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +'/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-8 +/*!100001 SET @@session.gtid_seq_no=8*//*!*/; +BEGIN +/*!*/; +# at # +# at # +# at # +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-9 +/*!100001 SET @@session.gtid_seq_no=9*//*!*/; +BEGIN +/*!*/; +# at # +# at # +# at # +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Rotate to master-bin.000002 pos: 4 +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; +# +##################################################################################### +# mysqlbinlog --read-from-remote-server --skip-annotate-row-events +# No Annotates should appear in this output +##################################################################################### +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +DELIMITER /*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup +ROLLBACK/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Gtid list [] +# at # +#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001 +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-1 ddl +/*!100101 SET @@session.skip_parallel_replication=0*//*!*/; +/*!100001 SET @@session.gtid_domain_id=0*//*!*/; +/*!100001 SET @@session.server_id=1*//*!*/; +/*!100001 SET @@session.gtid_seq_no=1*//*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +SET @@session.pseudo_thread_id=#/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; +CREATE DATABASE test1 +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-2 ddl +/*!100001 SET @@session.gtid_seq_no=2*//*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +CREATE DATABASE test2 +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-3 ddl +/*!100001 SET @@session.gtid_seq_no=3*//*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +CREATE DATABASE test3 +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-4 +/*!100001 SET @@session.gtid_seq_no=4*//*!*/; +BEGIN +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number # +# at # +#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F +### INSERT INTO `test1`.`t1` +### SET +### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +### INSERT INTO `test1`.`t1` +### SET +### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +### INSERT INTO `test1`.`t1` +### SET +### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-5 +/*!100001 SET @@session.gtid_seq_no=5*//*!*/; +BEGIN +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number # +# at # +#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F +### INSERT INTO `test2`.`t2` +### SET +### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +### INSERT INTO `test2`.`t2` +### SET +### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +### INSERT INTO `test2`.`t2` +### SET +### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-6 +/*!100001 SET @@session.gtid_seq_no=6*//*!*/; +BEGIN +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Table_map: `test3`.`t3` mapped to number # +# at # +#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F +### INSERT INTO `test3`.`t3` +### SET +### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +### INSERT INTO `test3`.`t3` +### SET +### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +### INSERT INTO `test3`.`t3` +### SET +### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-7 +/*!100001 SET @@session.gtid_seq_no=7*//*!*/; +BEGIN +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number # +# at # +#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number # +# at # +# at # +#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # +#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F +### DELETE FROM `test1`.`t1` +### WHERE +### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +### DELETE FROM `test1`.`t1` +### WHERE +### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +### DELETE FROM `test1`.`t1` +### WHERE +### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +### DELETE FROM `test2`.`t2` +### WHERE +### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +### DELETE FROM `test2`.`t2` +### WHERE +### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +### DELETE FROM `test2`.`t2` +### WHERE +### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-8 +/*!100001 SET @@session.gtid_seq_no=8*//*!*/; +BEGIN +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number # +# at # +#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F +### INSERT INTO `test2`.`t2` +### SET +### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +### INSERT INTO `test2`.`t2` +### SET +### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +### INSERT INTO `test2`.`t2` +### SET +### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # GTID 0-1-9 +/*!100001 SET @@session.gtid_seq_no=9*//*!*/; +BEGIN +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number # +# at # +#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F +### DELETE FROM `test2`.`t2` +### WHERE +### @1=3 /* INT meta=0 nullable=1 is_null=0 */ +### DELETE FROM `test2`.`t2` +### WHERE +### @1=2 /* INT meta=0 nullable=1 is_null=0 */ +### DELETE FROM `test2`.`t2` +### WHERE +### @1=1 /* INT meta=0 nullable=1 is_null=0 */ +# at # +#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id # end_log_pos # Rotate to master-bin.000002 pos: 4 +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; +set global binlog_checksum=@old_binlog_checksum; +DROP DATABASE test1; +DROP DATABASE test2; +DROP DATABASE test3; +DROP DATABASE xtest1; +DROP DATABASE xtest2; diff --git a/mysql-test/suite/binlog_encryption/binlog_row_annotate.test b/mysql-test/suite/binlog_encryption/binlog_row_annotate.test new file mode 100644 index 00000000000..40aa0dbc6e3 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/binlog_row_annotate.test @@ -0,0 +1,2 @@ +--let $use_remote_mysqlbinlog= 1 +--source extra/binlog_tests/binlog_row_annotate.inc diff --git a/mysql-test/suite/binlog_encryption/binlog_write_error.result b/mysql-test/suite/binlog_encryption/binlog_write_error.result new file mode 100644 index 00000000000..28cffb3a8e5 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/binlog_write_error.result @@ -0,0 +1,108 @@ +# +# Initialization +# +DROP TABLE IF EXISTS t1, t2; +DROP FUNCTION IF EXISTS f1; +DROP FUNCTION IF EXISTS f2; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p2; +DROP TRIGGER IF EXISTS tr1; +DROP TRIGGER IF EXISTS tr2; +DROP VIEW IF EXISTS v1, v2; +# +# Test injecting binlog write error when executing queries +# +SET GLOBAL debug_dbug='d,injecting_fault_writing'; +CREATE TABLE t1 (a INT); +CREATE TABLE t1 (a INT); +ERROR HY000: Error writing file 'master-bin' ((errno: #) +SET GLOBAL debug_dbug=''; +INSERT INTO t1 VALUES (1),(2),(3); +SET GLOBAL debug_dbug='d,injecting_fault_writing'; +INSERT INTO t1 VALUES (4),(5),(6); +INSERT INTO t1 VALUES (4),(5),(6); +ERROR HY000: Error writing file 'master-bin' ((errno: #) +SET GLOBAL debug_dbug=''; +SET GLOBAL debug_dbug='d,injecting_fault_writing'; +UPDATE t1 set a=a+1; +UPDATE t1 set a=a+1; +ERROR HY000: Error writing file 'master-bin' ((errno: #) +SET GLOBAL debug_dbug=''; +SET GLOBAL debug_dbug='d,injecting_fault_writing'; +DELETE FROM t1; +DELETE FROM t1; +ERROR HY000: Error writing file 'master-bin' ((errno: #) +SET GLOBAL debug_dbug=''; +SET GLOBAL debug_dbug='d,injecting_fault_writing'; +CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t1 VALUES (new.a + 100); +CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t1 VALUES (new.a + 100); +ERROR HY000: Error writing file 'master-bin' ((errno: #) +SET GLOBAL debug_dbug=''; +SET GLOBAL debug_dbug='d,injecting_fault_writing'; +DROP TRIGGER tr1; +DROP TRIGGER tr1; +ERROR HY000: Error writing file 'master-bin' ((errno: #) +SET GLOBAL debug_dbug=''; +SET GLOBAL debug_dbug='d,injecting_fault_writing'; +ALTER TABLE t1 ADD (b INT); +ALTER TABLE t1 ADD (b INT); +ERROR HY000: Error writing file 'master-bin' ((errno: #) +SET GLOBAL debug_dbug=''; +SET GLOBAL debug_dbug='d,injecting_fault_writing'; +CREATE VIEW v1 AS SELECT a FROM t1; +CREATE VIEW v1 AS SELECT a FROM t1; +ERROR HY000: Error writing file 'master-bin' ((errno: #) +SET GLOBAL debug_dbug=''; +SET GLOBAL debug_dbug='d,injecting_fault_writing'; +DROP VIEW v1; +DROP VIEW v1; +ERROR HY000: Error writing file 'master-bin' ((errno: #) +SET GLOBAL debug_dbug=''; +SET GLOBAL debug_dbug='d,injecting_fault_writing'; +CREATE PROCEDURE p1(OUT rows INT) SELECT count(*) INTO rows FROM t1; +CREATE PROCEDURE p1(OUT rows INT) SELECT count(*) INTO rows FROM t1; +ERROR HY000: Error writing file 'master-bin' ((errno: #) +SET GLOBAL debug_dbug=''; +SET GLOBAL debug_dbug='d,injecting_fault_writing'; +DROP PROCEDURE p1; +DROP PROCEDURE p1; +ERROR HY000: Error writing file 'master-bin' ((errno: #) +SET GLOBAL debug_dbug=''; +SET GLOBAL debug_dbug='d,injecting_fault_writing'; +DROP TABLE t1; +DROP TABLE t1; +ERROR HY000: Error writing file 'master-bin' ((errno: #) +SET GLOBAL debug_dbug=''; +SET GLOBAL debug_dbug='d,injecting_fault_writing'; +CREATE FUNCTION f1() RETURNS INT return 1; +CREATE FUNCTION f1() RETURNS INT return 1; +ERROR HY000: Error writing file 'master-bin' ((errno: #) +SET GLOBAL debug_dbug=''; +SET GLOBAL debug_dbug='d,injecting_fault_writing'; +DROP FUNCTION f1; +DROP FUNCTION f1; +ERROR HY000: Error writing file 'master-bin' ((errno: #) +SET GLOBAL debug_dbug=''; +SET GLOBAL debug_dbug='d,injecting_fault_writing'; +CREATE USER user1; +CREATE USER user1; +ERROR HY000: Error writing file 'master-bin' ((errno: #) +SET GLOBAL debug_dbug=''; +SET GLOBAL debug_dbug='d,injecting_fault_writing'; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1; +ERROR HY000: Error writing file 'master-bin' ((errno: #) +SET GLOBAL debug_dbug=''; +SET GLOBAL debug_dbug='d,injecting_fault_writing'; +DROP USER user1; +DROP USER user1; +ERROR HY000: Error writing file 'master-bin' ((errno: #) +SET GLOBAL debug_dbug=''; +# +# Cleanup +# +DROP TABLE IF EXISTS t1, t2; +DROP FUNCTION IF EXISTS f1; +DROP PROCEDURE IF EXISTS p1; +DROP TRIGGER IF EXISTS tr1; +DROP VIEW IF EXISTS v1, v2; diff --git a/mysql-test/suite/binlog_encryption/binlog_write_error.test b/mysql-test/suite/binlog_encryption/binlog_write_error.test new file mode 100644 index 00000000000..05f8eff6c3a --- /dev/null +++ b/mysql-test/suite/binlog_encryption/binlog_write_error.test @@ -0,0 +1 @@ +--source extra/binlog_tests/binlog_write_error.inc diff --git a/mysql-test/suite/binlog_encryption/binlog_xa_recover-master.opt b/mysql-test/suite/binlog_encryption/binlog_xa_recover-master.opt new file mode 100644 index 00000000000..3c44f9fad10 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/binlog_xa_recover-master.opt @@ -0,0 +1 @@ +--skip-stack-trace --skip-core-file --loose-debug-dbug=+d,xa_recover_expect_master_bin_000004 diff --git a/mysql-test/suite/binlog_encryption/binlog_xa_recover.result b/mysql-test/suite/binlog_encryption/binlog_xa_recover.result new file mode 100644 index 00000000000..6719d891ee2 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/binlog_xa_recover.result @@ -0,0 +1,240 @@ +SET GLOBAL max_binlog_size= 4096; +SET GLOBAL innodb_flush_log_at_trx_commit= 1; +RESET MASTER; +CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb; +INSERT INTO t1 VALUES (100, REPEAT("x", 4100)); +INSERT INTO t1 VALUES (101, REPEAT("x", 4100)); +INSERT INTO t1 VALUES (102, REPEAT("x", 4100)); +connect con1,localhost,root,,; +SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con1_wait WAIT_FOR con1_cont"; +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR _ever"; +INSERT INTO t1 VALUES (1, REPEAT("x", 4100)); +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con1_wait"; +connect con2,localhost,root,,; +SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con2_wait WAIT_FOR con2_cont"; +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con2_ready WAIT_FOR _ever"; +INSERT INTO t1 VALUES (2, NULL); +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con2_wait"; +connect con3,localhost,root,,; +SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con3_wait WAIT_FOR con3_cont"; +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con3_ready WAIT_FOR _ever"; +INSERT INTO t1 VALUES (3, REPEAT("x", 4100)); +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con3_wait"; +connect con4,localhost,root,,; +SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con4_wait WAIT_FOR con4_cont"; +SET SESSION debug_dbug="+d,crash_commit_after_log"; +INSERT INTO t1 VALUES (4, NULL); +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con4_wait"; +SET DEBUG_SYNC= "now SIGNAL con1_cont"; +SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; +SET DEBUG_SYNC= "now SIGNAL con2_cont"; +SET DEBUG_SYNC= "now WAIT_FOR con2_ready"; +SET DEBUG_SYNC= "now SIGNAL con3_cont"; +SET DEBUG_SYNC= "now WAIT_FOR con3_ready"; +show binary logs; +Log_name File_size +master-bin.000001 # +master-bin.000002 # +master-bin.000003 # +master-bin.000004 # +master-bin.000005 # +master-bin.000006 # +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +master-bin.000003 # Start_encryption # # +master-bin.000003 # Gtid_list # # [#-#-#] +master-bin.000003 # Binlog_checkpoint # # master-bin.000002 +master-bin.000003 # Binlog_checkpoint # # master-bin.000003 +master-bin.000003 # Gtid # # BEGIN GTID #-#-# +master-bin.000003 # Table_map # # table_id: # (test.t1) +master-bin.000003 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000003 # Xid # # COMMIT /* XID */ +master-bin.000003 # Rotate # # master-bin.000004;pos=POS +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000004 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +master-bin.000004 # Start_encryption # # +master-bin.000004 # Gtid_list # # [#-#-#] +master-bin.000004 # Binlog_checkpoint # # master-bin.000003 +master-bin.000004 # Binlog_checkpoint # # master-bin.000004 +master-bin.000004 # Gtid # # BEGIN GTID #-#-# +master-bin.000004 # Table_map # # table_id: # (test.t1) +master-bin.000004 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000004 # Xid # # COMMIT /* XID */ +master-bin.000004 # Rotate # # master-bin.000005;pos=POS +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000005 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +master-bin.000005 # Start_encryption # # +master-bin.000005 # Gtid_list # # [#-#-#] +master-bin.000005 # Binlog_checkpoint # # master-bin.000004 +master-bin.000005 # Gtid # # BEGIN GTID #-#-# +master-bin.000005 # Table_map # # table_id: # (test.t1) +master-bin.000005 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000005 # Xid # # COMMIT /* XID */ +master-bin.000005 # Gtid # # BEGIN GTID #-#-# +master-bin.000005 # Table_map # # table_id: # (test.t1) +master-bin.000005 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000005 # Xid # # COMMIT /* XID */ +master-bin.000005 # Rotate # # master-bin.000006;pos=POS +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000006 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +master-bin.000006 # Start_encryption # # +master-bin.000006 # Gtid_list # # [#-#-#] +master-bin.000006 # Binlog_checkpoint # # master-bin.000004 +PURGE BINARY LOGS TO "master-bin.000006"; +show binary logs; +Log_name File_size +master-bin.000004 # +master-bin.000005 # +master-bin.000006 # +SET DEBUG_SYNC= "now SIGNAL con4_cont"; +connection con4; +Got one of the listed errors +connection default; +SELECT a FROM t1 ORDER BY a; +a +1 +2 +3 +4 +100 +101 +102 +Test that with multiple binlog checkpoints, recovery starts from the last one. +SET GLOBAL max_binlog_size= 4096; +SET GLOBAL innodb_flush_log_at_trx_commit= 1; +RESET MASTER; +connect con10,localhost,root,,; +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con10_ready WAIT_FOR con10_cont"; +INSERT INTO t1 VALUES (10, REPEAT("x", 4100)); +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con10_ready"; +connect con11,localhost,root,,; +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con11_ready WAIT_FOR con11_cont"; +INSERT INTO t1 VALUES (11, REPEAT("x", 4100)); +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con11_ready"; +connect con12,localhost,root,,; +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con12_ready WAIT_FOR con12_cont"; +INSERT INTO t1 VALUES (12, REPEAT("x", 4100)); +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con12_ready"; +INSERT INTO t1 VALUES (13, NULL); +show binary logs; +Log_name File_size +master-bin.000001 # +master-bin.000002 # +master-bin.000003 # +master-bin.000004 # +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000004 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +master-bin.000004 # Start_encryption # # +master-bin.000004 # Gtid_list # # [#-#-#] +master-bin.000004 # Binlog_checkpoint # # master-bin.000001 +master-bin.000004 # Gtid # # BEGIN GTID #-#-# +master-bin.000004 # Table_map # # table_id: # (test.t1) +master-bin.000004 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000004 # Xid # # COMMIT /* XID */ +SET DEBUG_SYNC= "now SIGNAL con10_cont"; +connection con10; +connection default; +SET @old_dbug= @@global.DEBUG_DBUG; +SET GLOBAL debug_dbug="+d,binlog_background_checkpoint_processed"; +SET DEBUG_SYNC= "now SIGNAL con12_cont"; +connection con12; +connection default; +SET DEBUG_SYNC= "now WAIT_FOR binlog_background_checkpoint_processed"; +SET GLOBAL debug_dbug= @old_dbug; +SET DEBUG_SYNC= "now SIGNAL con11_cont"; +connection con11; +connection default; +Checking that master-bin.000004 is the last binlog checkpoint +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000004 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +master-bin.000004 # Start_encryption # # +master-bin.000004 # Gtid_list # # [#-#-#] +master-bin.000004 # Binlog_checkpoint # # master-bin.000001 +master-bin.000004 # Gtid # # BEGIN GTID #-#-# +master-bin.000004 # Table_map # # table_id: # (test.t1) +master-bin.000004 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000004 # Xid # # COMMIT /* XID */ +master-bin.000004 # Binlog_checkpoint # # master-bin.000002 +master-bin.000004 # Binlog_checkpoint # # master-bin.000004 +Now crash the server +SET SESSION debug_dbug="+d,crash_commit_after_log"; +INSERT INTO t1 VALUES (14, NULL); +Got one of the listed errors +connection default; +SELECT a FROM t1 ORDER BY a; +a +1 +2 +3 +4 +10 +11 +12 +13 +14 +100 +101 +102 +*** Check that recovery works if we crashed early during rotate, before +*** binlog checkpoint event could be written. +SET GLOBAL max_binlog_size= 4096; +SET GLOBAL innodb_flush_log_at_trx_commit= 1; +RESET MASTER; +INSERT INTO t1 VALUES (21, REPEAT("x", 4100)); +INSERT INTO t1 VALUES (22, REPEAT("x", 4100)); +INSERT INTO t1 VALUES (23, REPEAT("x", 4100)); +SET SESSION debug_dbug="+d,crash_before_write_checkpoint_event"; +INSERT INTO t1 VALUES (24, REPEAT("x", 4100)); +Got one of the listed errors +SELECT a FROM t1 ORDER BY a; +a +1 +2 +3 +4 +10 +11 +12 +13 +14 +21 +22 +23 +24 +100 +101 +102 +show binary logs; +Log_name File_size +master-bin.000001 # +master-bin.000002 # +master-bin.000003 # +master-bin.000004 # +master-bin.000005 # +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000004 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +master-bin.000004 # Start_encryption # # +master-bin.000004 # Gtid_list # # [#-#-#] +master-bin.000004 # Binlog_checkpoint # # master-bin.000003 +master-bin.000004 # Binlog_checkpoint # # master-bin.000004 +master-bin.000004 # Gtid # # BEGIN GTID #-#-# +master-bin.000004 # Table_map # # table_id: # (test.t1) +master-bin.000004 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000004 # Xid # # COMMIT /* XID */ +master-bin.000004 # Rotate # # master-bin.000005;pos=POS +connection default; +DROP TABLE t1; diff --git a/mysql-test/suite/binlog_encryption/binlog_xa_recover.test b/mysql-test/suite/binlog_encryption/binlog_xa_recover.test new file mode 100644 index 00000000000..0e0b80433ff --- /dev/null +++ b/mysql-test/suite/binlog_encryption/binlog_xa_recover.test @@ -0,0 +1 @@ +--source extra/binlog_tests/binlog_xa_recover.inc diff --git a/mysql-test/suite/binlog_encryption/disabled.def b/mysql-test/suite/binlog_encryption/disabled.def new file mode 100644 index 00000000000..b7a26a8343f --- /dev/null +++ b/mysql-test/suite/binlog_encryption/disabled.def @@ -0,0 +1,2 @@ +encrypted_master_lost_key : MDEV-11323 - unspecified behavior for IO thread +rpl_checksum_cache : MDEV-11486 - sporadic failure in IO thread diff --git a/mysql-test/suite/binlog_encryption/encrypted_master.result b/mysql-test/suite/binlog_encryption/encrypted_master.result new file mode 100644 index 00000000000..65dd12ccba3 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/encrypted_master.result @@ -0,0 +1,626 @@ +################# +# Initialization +################# +include/rpl_init.inc [topology=1->2] +connection server_2; +include/stop_slave_sql.inc +connection server_1; +SET @binlog_annotate_row_events.save= @@global.binlog_annotate_row_events; +SET @binlog_checksum.save= @@global.binlog_checksum; +SET @master_verify_checksum.save= @@global.master_verify_checksum; +SET @binlog_row_image.save= @@global.binlog_row_image; +#################################################### +# Test 1: simple binlog, no checksum, no annotation +#################################################### +connection server_1; +SET binlog_annotate_row_events= 0; +SET GLOBAL binlog_annotate_row_events= 0; +SET GLOBAL binlog_checksum= NONE; +SET GLOBAL master_verify_checksum= 0; +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +CREATE DATABASE database_name_to_encrypt; +USE database_name_to_encrypt; +CREATE USER user_name_to_encrypt; +GRANT ALL ON database_name_to_encrypt.* TO user_name_to_encrypt; +SET PASSWORD FOR user_name_to_encrypt = PASSWORD('password_to_encrypt'); +CREATE TABLE innodb_table_name_to_encrypt ( +int_column_name_to_encrypt INT PRIMARY KEY, +timestamp_column_name_to_encrypt TIMESTAMP(6) NULL, +blob_column_name_to_encrypt BLOB, +virt_column_name_to_encrypt INT AS (int_column_name_to_encrypt % 10) VIRTUAL, +pers_column_name_to_encrypt INT AS (int_column_name_to_encrypt) PERSISTENT, +INDEX `index_name_to_encrypt`(`timestamp_column_name_to_encrypt`) +) ENGINE=InnoDB +PARTITION BY RANGE (int_column_name_to_encrypt) +SUBPARTITION BY KEY (int_column_name_to_encrypt) +SUBPARTITIONS 2 ( +PARTITION partition0_name_to_encrypt VALUES LESS THAN (100), +PARTITION partition1_name_to_encrypt VALUES LESS THAN (MAXVALUE) +) +; +CREATE TABLE myisam_table_name_to_encrypt ( +int_column_name_to_encrypt INT AUTO_INCREMENT PRIMARY KEY, +char_column_name_to_encrypt VARCHAR(255), +datetime_column_name_to_encrypt DATETIME, +text_column_name_to_encrypt TEXT +) ENGINE=MyISAM; +CREATE TABLE aria_table_name_to_encrypt ( +int_column_name_to_encrypt INT AUTO_INCREMENT PRIMARY KEY, +varchar_column_name_to_encrypt VARCHAR(1024), +enum_column_name_to_encrypt ENUM( +'enum_value1_to_encrypt', +'enum_value2_to_encrypt' + ), +timestamp_column_name_to_encrypt TIMESTAMP(6) NULL, +blob_column_name_to_encrypt BLOB +) ENGINE=Aria; +CREATE TRIGGER trigger_name_to_encrypt +AFTER INSERT ON myisam_table_name_to_encrypt FOR EACH ROW +INSERT INTO aria_table_name_to_encrypt (varchar_column_name_to_encrypt) +VALUES (NEW.char_column_name_to_encrypt); +CREATE DEFINER=user_name_to_encrypt VIEW view_name_to_encrypt +AS SELECT * FROM innodb_table_name_to_encrypt; +CREATE FUNCTION func_name_to_encrypt (func_parameter_to_encrypt INT) +RETURNS VARCHAR(64) +RETURN 'func_result_to_encrypt'; +CREATE PROCEDURE proc_name_to_encrypt ( +IN proc_in_parameter_to_encrypt CHAR(32), +OUT proc_out_parameter_to_encrypt INT +) +BEGIN +DECLARE procvar_name_to_encrypt CHAR(64) DEFAULT 'procvar_val_to_encrypt'; +DECLARE cursor_name_to_encrypt CURSOR FOR +SELECT virt_column_name_to_encrypt FROM innodb_table_name_to_encrypt; +DECLARE EXIT HANDLER FOR NOT FOUND +BEGIN +SET @stmt_var_to_encrypt = CONCAT( +"SELECT + IF (RAND()>0.5,'enum_value2_to_encrypt','enum_value1_to_encrypt') + FROM innodb_table_name_to_encrypt + INTO OUTFILE '", proc_in_parameter_to_encrypt, "'"); +PREPARE stmt_to_encrypt FROM @stmt_var_to_encrypt; +EXECUTE stmt_to_encrypt; +DEALLOCATE PREPARE stmt_to_encrypt; +END; +OPEN cursor_name_to_encrypt; +proc_label_to_encrypt: LOOP +FETCH cursor_name_to_encrypt INTO procvar_name_to_encrypt; +END LOOP; +CLOSE cursor_name_to_encrypt; +END $$ +CREATE SERVER server_name_to_encrypt +FOREIGN DATA WRAPPER mysql +OPTIONS (HOST 'host_name_to_encrypt'); +connect con1,localhost,user_name_to_encrypt,password_to_encrypt,database_name_to_encrypt; +CREATE TEMPORARY TABLE tmp_table_name_to_encrypt ( +float_column_name_to_encrypt FLOAT, +binary_column_name_to_encrypt BINARY(64) +); +disconnect con1; +connection server_1; +CREATE INDEX index_name_to_encrypt +ON myisam_table_name_to_encrypt (datetime_column_name_to_encrypt); +ALTER DATABASE database_name_to_encrypt CHARACTER SET utf8; +ALTER TABLE innodb_table_name_to_encrypt +MODIFY timestamp_column_name_to_encrypt TIMESTAMP NOT NULL +DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +; +ALTER ALGORITHM=MERGE VIEW view_name_to_encrypt +AS SELECT * FROM innodb_table_name_to_encrypt; +RENAME TABLE innodb_table_name_to_encrypt TO new_table_name_to_encrypt; +ALTER TABLE new_table_name_to_encrypt RENAME TO innodb_table_name_to_encrypt; +set @user_var1_to_encrypt= 'dyncol1_val_to_encrypt'; +set @user_var2_to_encrypt= 'dyncol2_name_to_encrypt'; +INSERT INTO view_name_to_encrypt VALUES +(1, NOW(6), COLUMN_CREATE('dyncol1_name_to_encrypt',@user_var1_to_encrypt), NULL, NULL), +(2, NOW(6), COLUMN_CREATE(@user_var2_to_encrypt,'dyncol2_val_to_encrypt'), NULL, NULL) +; +BEGIN NOT ATOMIC +DECLARE counter_name_to_encrypt INT DEFAULT 0; +START TRANSACTION; +WHILE counter_name_to_encrypt<12 DO +SELECT COUNT(*) INTO @cnt FROM innodb_table_name_to_encrypt; +INSERT INTO innodb_table_name_to_encrypt +SELECT int_column_name_to_encrypt+@cnt, NOW(6), blob_column_name_to_encrypt, NULL, NULL +FROM innodb_table_name_to_encrypt +ORDER BY int_column_name_to_encrypt; +SET counter_name_to_encrypt = counter_name_to_encrypt+1; +END WHILE; +COMMIT; +END +$$ +INSERT INTO myisam_table_name_to_encrypt +SELECT NULL, 'char_literal_to_encrypt', NULL, 'text_to_encrypt'; +INSERT INTO myisam_table_name_to_encrypt (char_column_name_to_encrypt) +SELECT char_column_name_to_encrypt FROM myisam_table_name_to_encrypt; +INSERT INTO myisam_table_name_to_encrypt (char_column_name_to_encrypt) +SELECT char_column_name_to_encrypt FROM myisam_table_name_to_encrypt; +INSERT INTO myisam_table_name_to_encrypt (char_column_name_to_encrypt) +SELECT char_column_name_to_encrypt FROM myisam_table_name_to_encrypt; +CALL proc_name_to_encrypt('file_name_to_encrypt',@useless_var_to_encrypt); +TRUNCATE TABLE aria_table_name_to_encrypt; +LOAD DATA INFILE 'file_name_to_encrypt' INTO TABLE aria_table_name_to_encrypt +(enum_column_name_to_encrypt); +LOAD DATA LOCAL INFILE '/database_name_to_encrypt/file_name_to_encrypt' +INTO TABLE aria_table_name_to_encrypt (enum_column_name_to_encrypt); +UPDATE view_name_to_encrypt SET blob_column_name_to_encrypt = +COLUMN_CREATE('dyncol1_name_to_encrypt',func_name_to_encrypt(0)) +; +DELETE FROM aria_table_name_to_encrypt ORDER BY int_column_name_to_encrypt LIMIT 10; +ANALYZE TABLE myisam_table_name_to_encrypt; +CHECK TABLE aria_table_name_to_encrypt; +CHECKSUM TABLE innodb_table_name_to_encrypt, myisam_table_name_to_encrypt; +RENAME USER user_name_to_encrypt to new_user_name_to_encrypt; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM new_user_name_to_encrypt; +DROP DATABASE database_name_to_encrypt; +DROP USER new_user_name_to_encrypt; +DROP SERVER server_name_to_encrypt; +#################################################### +# Test 2: binlog with checksum, no annotated events +#################################################### +connection server_1; +SET binlog_annotate_row_events= 0; +SET GLOBAL binlog_annotate_row_events= 0; +SET GLOBAL binlog_checksum= CRC32; +SET GLOBAL master_verify_checksum= 1; +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +CREATE DATABASE database_name_to_encrypt; +USE database_name_to_encrypt; +CREATE USER user_name_to_encrypt; +GRANT ALL ON database_name_to_encrypt.* TO user_name_to_encrypt; +SET PASSWORD FOR user_name_to_encrypt = PASSWORD('password_to_encrypt'); +CREATE TABLE innodb_table_name_to_encrypt ( +int_column_name_to_encrypt INT PRIMARY KEY, +timestamp_column_name_to_encrypt TIMESTAMP(6) NULL, +blob_column_name_to_encrypt BLOB, +virt_column_name_to_encrypt INT AS (int_column_name_to_encrypt % 10) VIRTUAL, +pers_column_name_to_encrypt INT AS (int_column_name_to_encrypt) PERSISTENT, +INDEX `index_name_to_encrypt`(`timestamp_column_name_to_encrypt`) +) ENGINE=InnoDB +PARTITION BY RANGE (int_column_name_to_encrypt) +SUBPARTITION BY KEY (int_column_name_to_encrypt) +SUBPARTITIONS 2 ( +PARTITION partition0_name_to_encrypt VALUES LESS THAN (100), +PARTITION partition1_name_to_encrypt VALUES LESS THAN (MAXVALUE) +) +; +CREATE TABLE myisam_table_name_to_encrypt ( +int_column_name_to_encrypt INT AUTO_INCREMENT PRIMARY KEY, +char_column_name_to_encrypt VARCHAR(255), +datetime_column_name_to_encrypt DATETIME, +text_column_name_to_encrypt TEXT +) ENGINE=MyISAM; +CREATE TABLE aria_table_name_to_encrypt ( +int_column_name_to_encrypt INT AUTO_INCREMENT PRIMARY KEY, +varchar_column_name_to_encrypt VARCHAR(1024), +enum_column_name_to_encrypt ENUM( +'enum_value1_to_encrypt', +'enum_value2_to_encrypt' + ), +timestamp_column_name_to_encrypt TIMESTAMP(6) NULL, +blob_column_name_to_encrypt BLOB +) ENGINE=Aria; +CREATE TRIGGER trigger_name_to_encrypt +AFTER INSERT ON myisam_table_name_to_encrypt FOR EACH ROW +INSERT INTO aria_table_name_to_encrypt (varchar_column_name_to_encrypt) +VALUES (NEW.char_column_name_to_encrypt); +CREATE DEFINER=user_name_to_encrypt VIEW view_name_to_encrypt +AS SELECT * FROM innodb_table_name_to_encrypt; +CREATE FUNCTION func_name_to_encrypt (func_parameter_to_encrypt INT) +RETURNS VARCHAR(64) +RETURN 'func_result_to_encrypt'; +CREATE PROCEDURE proc_name_to_encrypt ( +IN proc_in_parameter_to_encrypt CHAR(32), +OUT proc_out_parameter_to_encrypt INT +) +BEGIN +DECLARE procvar_name_to_encrypt CHAR(64) DEFAULT 'procvar_val_to_encrypt'; +DECLARE cursor_name_to_encrypt CURSOR FOR +SELECT virt_column_name_to_encrypt FROM innodb_table_name_to_encrypt; +DECLARE EXIT HANDLER FOR NOT FOUND +BEGIN +SET @stmt_var_to_encrypt = CONCAT( +"SELECT + IF (RAND()>0.5,'enum_value2_to_encrypt','enum_value1_to_encrypt') + FROM innodb_table_name_to_encrypt + INTO OUTFILE '", proc_in_parameter_to_encrypt, "'"); +PREPARE stmt_to_encrypt FROM @stmt_var_to_encrypt; +EXECUTE stmt_to_encrypt; +DEALLOCATE PREPARE stmt_to_encrypt; +END; +OPEN cursor_name_to_encrypt; +proc_label_to_encrypt: LOOP +FETCH cursor_name_to_encrypt INTO procvar_name_to_encrypt; +END LOOP; +CLOSE cursor_name_to_encrypt; +END $$ +CREATE SERVER server_name_to_encrypt +FOREIGN DATA WRAPPER mysql +OPTIONS (HOST 'host_name_to_encrypt'); +connect con1,localhost,user_name_to_encrypt,password_to_encrypt,database_name_to_encrypt; +CREATE TEMPORARY TABLE tmp_table_name_to_encrypt ( +float_column_name_to_encrypt FLOAT, +binary_column_name_to_encrypt BINARY(64) +); +disconnect con1; +connection server_1; +CREATE INDEX index_name_to_encrypt +ON myisam_table_name_to_encrypt (datetime_column_name_to_encrypt); +ALTER DATABASE database_name_to_encrypt CHARACTER SET utf8; +ALTER TABLE innodb_table_name_to_encrypt +MODIFY timestamp_column_name_to_encrypt TIMESTAMP NOT NULL +DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +; +ALTER ALGORITHM=MERGE VIEW view_name_to_encrypt +AS SELECT * FROM innodb_table_name_to_encrypt; +RENAME TABLE innodb_table_name_to_encrypt TO new_table_name_to_encrypt; +ALTER TABLE new_table_name_to_encrypt RENAME TO innodb_table_name_to_encrypt; +set @user_var1_to_encrypt= 'dyncol1_val_to_encrypt'; +set @user_var2_to_encrypt= 'dyncol2_name_to_encrypt'; +INSERT INTO view_name_to_encrypt VALUES +(1, NOW(6), COLUMN_CREATE('dyncol1_name_to_encrypt',@user_var1_to_encrypt), NULL, NULL), +(2, NOW(6), COLUMN_CREATE(@user_var2_to_encrypt,'dyncol2_val_to_encrypt'), NULL, NULL) +; +BEGIN NOT ATOMIC +DECLARE counter_name_to_encrypt INT DEFAULT 0; +START TRANSACTION; +WHILE counter_name_to_encrypt<12 DO +SELECT COUNT(*) INTO @cnt FROM innodb_table_name_to_encrypt; +INSERT INTO innodb_table_name_to_encrypt +SELECT int_column_name_to_encrypt+@cnt, NOW(6), blob_column_name_to_encrypt, NULL, NULL +FROM innodb_table_name_to_encrypt +ORDER BY int_column_name_to_encrypt; +SET counter_name_to_encrypt = counter_name_to_encrypt+1; +END WHILE; +COMMIT; +END +$$ +INSERT INTO myisam_table_name_to_encrypt +SELECT NULL, 'char_literal_to_encrypt', NULL, 'text_to_encrypt'; +INSERT INTO myisam_table_name_to_encrypt (char_column_name_to_encrypt) +SELECT char_column_name_to_encrypt FROM myisam_table_name_to_encrypt; +INSERT INTO myisam_table_name_to_encrypt (char_column_name_to_encrypt) +SELECT char_column_name_to_encrypt FROM myisam_table_name_to_encrypt; +INSERT INTO myisam_table_name_to_encrypt (char_column_name_to_encrypt) +SELECT char_column_name_to_encrypt FROM myisam_table_name_to_encrypt; +CALL proc_name_to_encrypt('file_name_to_encrypt',@useless_var_to_encrypt); +TRUNCATE TABLE aria_table_name_to_encrypt; +LOAD DATA INFILE 'file_name_to_encrypt' INTO TABLE aria_table_name_to_encrypt +(enum_column_name_to_encrypt); +LOAD DATA LOCAL INFILE '/database_name_to_encrypt/file_name_to_encrypt' +INTO TABLE aria_table_name_to_encrypt (enum_column_name_to_encrypt); +UPDATE view_name_to_encrypt SET blob_column_name_to_encrypt = +COLUMN_CREATE('dyncol1_name_to_encrypt',func_name_to_encrypt(0)) +; +DELETE FROM aria_table_name_to_encrypt ORDER BY int_column_name_to_encrypt LIMIT 10; +ANALYZE TABLE myisam_table_name_to_encrypt; +CHECK TABLE aria_table_name_to_encrypt; +CHECKSUM TABLE innodb_table_name_to_encrypt, myisam_table_name_to_encrypt; +RENAME USER user_name_to_encrypt to new_user_name_to_encrypt; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM new_user_name_to_encrypt; +DROP DATABASE database_name_to_encrypt; +DROP USER new_user_name_to_encrypt; +DROP SERVER server_name_to_encrypt; +#################################################### +# Test 3: binlog with checksum and annotated events +#################################################### +connection server_1; +SET binlog_annotate_row_events= 1; +SET GLOBAL binlog_annotate_row_events= 1; +SET GLOBAL binlog_checksum= CRC32; +SET GLOBAL master_verify_checksum= 1; +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +CREATE DATABASE database_name_to_encrypt; +USE database_name_to_encrypt; +CREATE USER user_name_to_encrypt; +GRANT ALL ON database_name_to_encrypt.* TO user_name_to_encrypt; +SET PASSWORD FOR user_name_to_encrypt = PASSWORD('password_to_encrypt'); +CREATE TABLE innodb_table_name_to_encrypt ( +int_column_name_to_encrypt INT PRIMARY KEY, +timestamp_column_name_to_encrypt TIMESTAMP(6) NULL, +blob_column_name_to_encrypt BLOB, +virt_column_name_to_encrypt INT AS (int_column_name_to_encrypt % 10) VIRTUAL, +pers_column_name_to_encrypt INT AS (int_column_name_to_encrypt) PERSISTENT, +INDEX `index_name_to_encrypt`(`timestamp_column_name_to_encrypt`) +) ENGINE=InnoDB +PARTITION BY RANGE (int_column_name_to_encrypt) +SUBPARTITION BY KEY (int_column_name_to_encrypt) +SUBPARTITIONS 2 ( +PARTITION partition0_name_to_encrypt VALUES LESS THAN (100), +PARTITION partition1_name_to_encrypt VALUES LESS THAN (MAXVALUE) +) +; +CREATE TABLE myisam_table_name_to_encrypt ( +int_column_name_to_encrypt INT AUTO_INCREMENT PRIMARY KEY, +char_column_name_to_encrypt VARCHAR(255), +datetime_column_name_to_encrypt DATETIME, +text_column_name_to_encrypt TEXT +) ENGINE=MyISAM; +CREATE TABLE aria_table_name_to_encrypt ( +int_column_name_to_encrypt INT AUTO_INCREMENT PRIMARY KEY, +varchar_column_name_to_encrypt VARCHAR(1024), +enum_column_name_to_encrypt ENUM( +'enum_value1_to_encrypt', +'enum_value2_to_encrypt' + ), +timestamp_column_name_to_encrypt TIMESTAMP(6) NULL, +blob_column_name_to_encrypt BLOB +) ENGINE=Aria; +CREATE TRIGGER trigger_name_to_encrypt +AFTER INSERT ON myisam_table_name_to_encrypt FOR EACH ROW +INSERT INTO aria_table_name_to_encrypt (varchar_column_name_to_encrypt) +VALUES (NEW.char_column_name_to_encrypt); +CREATE DEFINER=user_name_to_encrypt VIEW view_name_to_encrypt +AS SELECT * FROM innodb_table_name_to_encrypt; +CREATE FUNCTION func_name_to_encrypt (func_parameter_to_encrypt INT) +RETURNS VARCHAR(64) +RETURN 'func_result_to_encrypt'; +CREATE PROCEDURE proc_name_to_encrypt ( +IN proc_in_parameter_to_encrypt CHAR(32), +OUT proc_out_parameter_to_encrypt INT +) +BEGIN +DECLARE procvar_name_to_encrypt CHAR(64) DEFAULT 'procvar_val_to_encrypt'; +DECLARE cursor_name_to_encrypt CURSOR FOR +SELECT virt_column_name_to_encrypt FROM innodb_table_name_to_encrypt; +DECLARE EXIT HANDLER FOR NOT FOUND +BEGIN +SET @stmt_var_to_encrypt = CONCAT( +"SELECT + IF (RAND()>0.5,'enum_value2_to_encrypt','enum_value1_to_encrypt') + FROM innodb_table_name_to_encrypt + INTO OUTFILE '", proc_in_parameter_to_encrypt, "'"); +PREPARE stmt_to_encrypt FROM @stmt_var_to_encrypt; +EXECUTE stmt_to_encrypt; +DEALLOCATE PREPARE stmt_to_encrypt; +END; +OPEN cursor_name_to_encrypt; +proc_label_to_encrypt: LOOP +FETCH cursor_name_to_encrypt INTO procvar_name_to_encrypt; +END LOOP; +CLOSE cursor_name_to_encrypt; +END $$ +CREATE SERVER server_name_to_encrypt +FOREIGN DATA WRAPPER mysql +OPTIONS (HOST 'host_name_to_encrypt'); +connect con1,localhost,user_name_to_encrypt,password_to_encrypt,database_name_to_encrypt; +CREATE TEMPORARY TABLE tmp_table_name_to_encrypt ( +float_column_name_to_encrypt FLOAT, +binary_column_name_to_encrypt BINARY(64) +); +disconnect con1; +connection server_1; +CREATE INDEX index_name_to_encrypt +ON myisam_table_name_to_encrypt (datetime_column_name_to_encrypt); +ALTER DATABASE database_name_to_encrypt CHARACTER SET utf8; +ALTER TABLE innodb_table_name_to_encrypt +MODIFY timestamp_column_name_to_encrypt TIMESTAMP NOT NULL +DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +; +ALTER ALGORITHM=MERGE VIEW view_name_to_encrypt +AS SELECT * FROM innodb_table_name_to_encrypt; +RENAME TABLE innodb_table_name_to_encrypt TO new_table_name_to_encrypt; +ALTER TABLE new_table_name_to_encrypt RENAME TO innodb_table_name_to_encrypt; +set @user_var1_to_encrypt= 'dyncol1_val_to_encrypt'; +set @user_var2_to_encrypt= 'dyncol2_name_to_encrypt'; +INSERT INTO view_name_to_encrypt VALUES +(1, NOW(6), COLUMN_CREATE('dyncol1_name_to_encrypt',@user_var1_to_encrypt), NULL, NULL), +(2, NOW(6), COLUMN_CREATE(@user_var2_to_encrypt,'dyncol2_val_to_encrypt'), NULL, NULL) +; +BEGIN NOT ATOMIC +DECLARE counter_name_to_encrypt INT DEFAULT 0; +START TRANSACTION; +WHILE counter_name_to_encrypt<12 DO +SELECT COUNT(*) INTO @cnt FROM innodb_table_name_to_encrypt; +INSERT INTO innodb_table_name_to_encrypt +SELECT int_column_name_to_encrypt+@cnt, NOW(6), blob_column_name_to_encrypt, NULL, NULL +FROM innodb_table_name_to_encrypt +ORDER BY int_column_name_to_encrypt; +SET counter_name_to_encrypt = counter_name_to_encrypt+1; +END WHILE; +COMMIT; +END +$$ +INSERT INTO myisam_table_name_to_encrypt +SELECT NULL, 'char_literal_to_encrypt', NULL, 'text_to_encrypt'; +INSERT INTO myisam_table_name_to_encrypt (char_column_name_to_encrypt) +SELECT char_column_name_to_encrypt FROM myisam_table_name_to_encrypt; +INSERT INTO myisam_table_name_to_encrypt (char_column_name_to_encrypt) +SELECT char_column_name_to_encrypt FROM myisam_table_name_to_encrypt; +INSERT INTO myisam_table_name_to_encrypt (char_column_name_to_encrypt) +SELECT char_column_name_to_encrypt FROM myisam_table_name_to_encrypt; +CALL proc_name_to_encrypt('file_name_to_encrypt',@useless_var_to_encrypt); +TRUNCATE TABLE aria_table_name_to_encrypt; +LOAD DATA INFILE 'file_name_to_encrypt' INTO TABLE aria_table_name_to_encrypt +(enum_column_name_to_encrypt); +LOAD DATA LOCAL INFILE '/database_name_to_encrypt/file_name_to_encrypt' +INTO TABLE aria_table_name_to_encrypt (enum_column_name_to_encrypt); +UPDATE view_name_to_encrypt SET blob_column_name_to_encrypt = +COLUMN_CREATE('dyncol1_name_to_encrypt',func_name_to_encrypt(0)) +; +DELETE FROM aria_table_name_to_encrypt ORDER BY int_column_name_to_encrypt LIMIT 10; +ANALYZE TABLE myisam_table_name_to_encrypt; +CHECK TABLE aria_table_name_to_encrypt; +CHECKSUM TABLE innodb_table_name_to_encrypt, myisam_table_name_to_encrypt; +RENAME USER user_name_to_encrypt to new_user_name_to_encrypt; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM new_user_name_to_encrypt; +DROP DATABASE database_name_to_encrypt; +DROP USER new_user_name_to_encrypt; +DROP SERVER server_name_to_encrypt; +#################################################### +# Test 4: binlog with annotated events and binlog_row_image=minimal +#################################################### +connection server_1; +SET binlog_annotate_row_events= 1; +SET GLOBAL binlog_annotate_row_events= 1; +SET GLOBAL binlog_checksum= NONE; +SET GLOBAL master_verify_checksum= 0; +SET GLOBAL binlog_row_image= MINIMAL; +SET binlog_row_image= MINIMAL; +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +CREATE DATABASE database_name_to_encrypt; +USE database_name_to_encrypt; +CREATE USER user_name_to_encrypt; +GRANT ALL ON database_name_to_encrypt.* TO user_name_to_encrypt; +SET PASSWORD FOR user_name_to_encrypt = PASSWORD('password_to_encrypt'); +CREATE TABLE innodb_table_name_to_encrypt ( +int_column_name_to_encrypt INT PRIMARY KEY, +timestamp_column_name_to_encrypt TIMESTAMP(6) NULL, +blob_column_name_to_encrypt BLOB, +virt_column_name_to_encrypt INT AS (int_column_name_to_encrypt % 10) VIRTUAL, +pers_column_name_to_encrypt INT AS (int_column_name_to_encrypt) PERSISTENT, +INDEX `index_name_to_encrypt`(`timestamp_column_name_to_encrypt`) +) ENGINE=InnoDB +PARTITION BY RANGE (int_column_name_to_encrypt) +SUBPARTITION BY KEY (int_column_name_to_encrypt) +SUBPARTITIONS 2 ( +PARTITION partition0_name_to_encrypt VALUES LESS THAN (100), +PARTITION partition1_name_to_encrypt VALUES LESS THAN (MAXVALUE) +) +; +CREATE TABLE myisam_table_name_to_encrypt ( +int_column_name_to_encrypt INT AUTO_INCREMENT PRIMARY KEY, +char_column_name_to_encrypt VARCHAR(255), +datetime_column_name_to_encrypt DATETIME, +text_column_name_to_encrypt TEXT +) ENGINE=MyISAM; +CREATE TABLE aria_table_name_to_encrypt ( +int_column_name_to_encrypt INT AUTO_INCREMENT PRIMARY KEY, +varchar_column_name_to_encrypt VARCHAR(1024), +enum_column_name_to_encrypt ENUM( +'enum_value1_to_encrypt', +'enum_value2_to_encrypt' + ), +timestamp_column_name_to_encrypt TIMESTAMP(6) NULL, +blob_column_name_to_encrypt BLOB +) ENGINE=Aria; +CREATE TRIGGER trigger_name_to_encrypt +AFTER INSERT ON myisam_table_name_to_encrypt FOR EACH ROW +INSERT INTO aria_table_name_to_encrypt (varchar_column_name_to_encrypt) +VALUES (NEW.char_column_name_to_encrypt); +CREATE DEFINER=user_name_to_encrypt VIEW view_name_to_encrypt +AS SELECT * FROM innodb_table_name_to_encrypt; +CREATE FUNCTION func_name_to_encrypt (func_parameter_to_encrypt INT) +RETURNS VARCHAR(64) +RETURN 'func_result_to_encrypt'; +CREATE PROCEDURE proc_name_to_encrypt ( +IN proc_in_parameter_to_encrypt CHAR(32), +OUT proc_out_parameter_to_encrypt INT +) +BEGIN +DECLARE procvar_name_to_encrypt CHAR(64) DEFAULT 'procvar_val_to_encrypt'; +DECLARE cursor_name_to_encrypt CURSOR FOR +SELECT virt_column_name_to_encrypt FROM innodb_table_name_to_encrypt; +DECLARE EXIT HANDLER FOR NOT FOUND +BEGIN +SET @stmt_var_to_encrypt = CONCAT( +"SELECT + IF (RAND()>0.5,'enum_value2_to_encrypt','enum_value1_to_encrypt') + FROM innodb_table_name_to_encrypt + INTO OUTFILE '", proc_in_parameter_to_encrypt, "'"); +PREPARE stmt_to_encrypt FROM @stmt_var_to_encrypt; +EXECUTE stmt_to_encrypt; +DEALLOCATE PREPARE stmt_to_encrypt; +END; +OPEN cursor_name_to_encrypt; +proc_label_to_encrypt: LOOP +FETCH cursor_name_to_encrypt INTO procvar_name_to_encrypt; +END LOOP; +CLOSE cursor_name_to_encrypt; +END $$ +CREATE SERVER server_name_to_encrypt +FOREIGN DATA WRAPPER mysql +OPTIONS (HOST 'host_name_to_encrypt'); +connect con1,localhost,user_name_to_encrypt,password_to_encrypt,database_name_to_encrypt; +CREATE TEMPORARY TABLE tmp_table_name_to_encrypt ( +float_column_name_to_encrypt FLOAT, +binary_column_name_to_encrypt BINARY(64) +); +disconnect con1; +connection server_1; +CREATE INDEX index_name_to_encrypt +ON myisam_table_name_to_encrypt (datetime_column_name_to_encrypt); +ALTER DATABASE database_name_to_encrypt CHARACTER SET utf8; +ALTER TABLE innodb_table_name_to_encrypt +MODIFY timestamp_column_name_to_encrypt TIMESTAMP NOT NULL +DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +; +ALTER ALGORITHM=MERGE VIEW view_name_to_encrypt +AS SELECT * FROM innodb_table_name_to_encrypt; +RENAME TABLE innodb_table_name_to_encrypt TO new_table_name_to_encrypt; +ALTER TABLE new_table_name_to_encrypt RENAME TO innodb_table_name_to_encrypt; +set @user_var1_to_encrypt= 'dyncol1_val_to_encrypt'; +set @user_var2_to_encrypt= 'dyncol2_name_to_encrypt'; +INSERT INTO view_name_to_encrypt VALUES +(1, NOW(6), COLUMN_CREATE('dyncol1_name_to_encrypt',@user_var1_to_encrypt), NULL, NULL), +(2, NOW(6), COLUMN_CREATE(@user_var2_to_encrypt,'dyncol2_val_to_encrypt'), NULL, NULL) +; +BEGIN NOT ATOMIC +DECLARE counter_name_to_encrypt INT DEFAULT 0; +START TRANSACTION; +WHILE counter_name_to_encrypt<12 DO +SELECT COUNT(*) INTO @cnt FROM innodb_table_name_to_encrypt; +INSERT INTO innodb_table_name_to_encrypt +SELECT int_column_name_to_encrypt+@cnt, NOW(6), blob_column_name_to_encrypt, NULL, NULL +FROM innodb_table_name_to_encrypt +ORDER BY int_column_name_to_encrypt; +SET counter_name_to_encrypt = counter_name_to_encrypt+1; +END WHILE; +COMMIT; +END +$$ +INSERT INTO myisam_table_name_to_encrypt +SELECT NULL, 'char_literal_to_encrypt', NULL, 'text_to_encrypt'; +INSERT INTO myisam_table_name_to_encrypt (char_column_name_to_encrypt) +SELECT char_column_name_to_encrypt FROM myisam_table_name_to_encrypt; +INSERT INTO myisam_table_name_to_encrypt (char_column_name_to_encrypt) +SELECT char_column_name_to_encrypt FROM myisam_table_name_to_encrypt; +INSERT INTO myisam_table_name_to_encrypt (char_column_name_to_encrypt) +SELECT char_column_name_to_encrypt FROM myisam_table_name_to_encrypt; +CALL proc_name_to_encrypt('file_name_to_encrypt',@useless_var_to_encrypt); +TRUNCATE TABLE aria_table_name_to_encrypt; +LOAD DATA INFILE 'file_name_to_encrypt' INTO TABLE aria_table_name_to_encrypt +(enum_column_name_to_encrypt); +LOAD DATA LOCAL INFILE '/database_name_to_encrypt/file_name_to_encrypt' +INTO TABLE aria_table_name_to_encrypt (enum_column_name_to_encrypt); +UPDATE view_name_to_encrypt SET blob_column_name_to_encrypt = +COLUMN_CREATE('dyncol1_name_to_encrypt',func_name_to_encrypt(0)) +; +DELETE FROM aria_table_name_to_encrypt ORDER BY int_column_name_to_encrypt LIMIT 10; +ANALYZE TABLE myisam_table_name_to_encrypt; +CHECK TABLE aria_table_name_to_encrypt; +CHECKSUM TABLE innodb_table_name_to_encrypt, myisam_table_name_to_encrypt; +RENAME USER user_name_to_encrypt to new_user_name_to_encrypt; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM new_user_name_to_encrypt; +DROP DATABASE database_name_to_encrypt; +DROP USER new_user_name_to_encrypt; +DROP SERVER server_name_to_encrypt; +############################# +# Final checks for the master +############################# +NOT FOUND /_to_encrypt/ in master-bin.0* +NOT FOUND /COMMIT/ in master-bin.0* +NOT FOUND /TIMESTAMP/ in master-bin.0* +include/save_master_pos.inc +############################# +# Final checks for the slave +############################# +connection server_2; +include/sync_io_with_master.inc +FOUND /_to_encrypt/ in slave-relay-bin.0* +FOUND /COMMIT/ in slave-relay-bin.0* +FOUND /TIMESTAMP/ in slave-relay-bin.0* +include/start_slave.inc +include/sync_slave_sql_with_io.inc +FOUND /_to_encrypt/ in slave-bin.0* +FOUND /COMMIT/ in slave-bin.0* +FOUND /TIMESTAMP/ in slave-bin.0* +########## +# Cleanup +########## +connection server_1; +SET GLOBAL binlog_annotate_row_events= @binlog_annotate_row_events.save; +SET GLOBAL binlog_checksum= @binlog_checksum.save; +SET GLOBAL master_verify_checksum= @master_verify_checksum.save; +SET GLOBAL binlog_row_image= @binlog_row_image.save; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/encrypted_master.test b/mysql-test/suite/binlog_encryption/encrypted_master.test new file mode 100644 index 00000000000..5eb0345342d --- /dev/null +++ b/mysql-test/suite/binlog_encryption/encrypted_master.test @@ -0,0 +1,183 @@ +# +# The test checks that basic DDL and DML events are encrypted +# in the binary log on master. +# The test is to be run with all binlog formats +# (combinations for rpl_init.inc take care of that). +# +# +# The test runs with the encrypted master and non-encrypted slave. +# It generates a sequence of events on master, and checks that +# - all events are encrypted on master; +# - slave is able to replicate from the master; +# - relay logs and binary logs are not encrypted on slave. +# +# The same exercise is repeated +# - without annotated binlog events and without binlog checksums; +# - with binlog checksums; +# - with annotated events and binlog checksums; +# - with annotated events, default checksums and minimal binlog row image +# + +--source encryption_algorithms.inc +--source include/have_innodb.inc +--enable_connect_log + +--echo ################# +--echo # Initialization +--echo ################# + +--disable_connect_log +--let $rpl_topology= 1->2 +--source include/rpl_init.inc +--enable_connect_log + +# We stop SQL thread because we want to have +# all relay logs at the end of the test flow + +--connection server_2 +--disable_connect_log +--source include/stop_slave_sql.inc +--enable_connect_log + +--connection server_1 + +SET @binlog_annotate_row_events.save= @@global.binlog_annotate_row_events; +SET @binlog_checksum.save= @@global.binlog_checksum; +SET @master_verify_checksum.save= @@global.master_verify_checksum; +SET @binlog_row_image.save= @@global.binlog_row_image; + +--echo #################################################### +--echo # Test 1: simple binlog, no checksum, no annotation +--echo #################################################### + +--connection server_1 + +SET binlog_annotate_row_events= 0; +SET GLOBAL binlog_annotate_row_events= 0; +SET GLOBAL binlog_checksum= NONE; +SET GLOBAL master_verify_checksum= 0; + +--source testdata.inc + +--echo #################################################### +--echo # Test 2: binlog with checksum, no annotated events +--echo #################################################### + +--connection server_1 + +SET binlog_annotate_row_events= 0; +SET GLOBAL binlog_annotate_row_events= 0; +SET GLOBAL binlog_checksum= CRC32; +SET GLOBAL master_verify_checksum= 1; + +--source testdata.inc + +--echo #################################################### +--echo # Test 3: binlog with checksum and annotated events +--echo #################################################### + +--connection server_1 + +SET binlog_annotate_row_events= 1; +SET GLOBAL binlog_annotate_row_events= 1; +SET GLOBAL binlog_checksum= CRC32; +SET GLOBAL master_verify_checksum= 1; + +--source testdata.inc + +--echo #################################################### +--echo # Test 4: binlog with annotated events and binlog_row_image=minimal +--echo #################################################### + +--connection server_1 + +SET binlog_annotate_row_events= 1; +SET GLOBAL binlog_annotate_row_events= 1; +SET GLOBAL binlog_checksum= NONE; +SET GLOBAL master_verify_checksum= 0; +SET GLOBAL binlog_row_image= MINIMAL; +SET binlog_row_image= MINIMAL; + +--source testdata.inc + +--echo ############################# +--echo # Final checks for the master +--echo ############################# + +--let $master_datadir= `SELECT @@datadir` + +--let SEARCH_FILE= $master_datadir/master-bin.0* +--let SEARCH_PATTERN= _to_encrypt +--source include/search_pattern_in_file.inc + +--let SEARCH_FILE= $master_datadir/master-bin.0* +--let SEARCH_PATTERN= COMMIT +--source include/search_pattern_in_file.inc + +--let SEARCH_FILE= $master_datadir/master-bin.0* +--let SEARCH_PATTERN= TIMESTAMP +--source include/search_pattern_in_file.inc + +--disable_connect_log +--source include/save_master_pos.inc +--enable_connect_log + +--echo ############################# +--echo # Final checks for the slave +--echo ############################# + +# Wait for the IO thread to write everything to relay logs + +--connection server_2 + +--let $slave_datadir= `SELECT @@datadir` + +--disable_connect_log +--source include/sync_io_with_master.inc + +# Check that relay logs are unencrypted + +--let SEARCH_FILE= $slave_datadir/slave-relay-bin.0* +--let SEARCH_PATTERN= _to_encrypt +--source include/search_pattern_in_file.inc + +--let SEARCH_FILE= $slave_datadir/slave-relay-bin.0* +--let SEARCH_PATTERN= COMMIT +--source include/search_pattern_in_file.inc + +--let SEARCH_FILE= $slave_datadir/slave-relay-bin.0* +--let SEARCH_PATTERN= TIMESTAMP +--source include/search_pattern_in_file.inc + + +# Re-enable SQL thread, let it catch up with IO thread +# and check slave binary logs + +--source include/start_slave.inc +--source include/sync_slave_sql_with_io.inc +--enable_connect_log + +--let SEARCH_FILE= $slave_datadir/slave-bin.0* +--let SEARCH_PATTERN= _to_encrypt +--source include/search_pattern_in_file.inc + +--let SEARCH_FILE= $slave_datadir/slave-bin.0* +--let SEARCH_PATTERN= COMMIT +--source include/search_pattern_in_file.inc + +--let SEARCH_FILE= $slave_datadir/slave-bin.0* +--let SEARCH_PATTERN= TIMESTAMP +--source include/search_pattern_in_file.inc + +--echo ########## +--echo # Cleanup +--echo ########## + +--connection server_1 +SET GLOBAL binlog_annotate_row_events= @binlog_annotate_row_events.save; +SET GLOBAL binlog_checksum= @binlog_checksum.save; +SET GLOBAL master_verify_checksum= @master_verify_checksum.save; +SET GLOBAL binlog_row_image= @binlog_row_image.save; + +--disable_connect_log +--source include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/encrypted_master_lost_key.result b/mysql-test/suite/binlog_encryption/encrypted_master_lost_key.result new file mode 100644 index 00000000000..5c934af15e4 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/encrypted_master_lost_key.result @@ -0,0 +1,111 @@ +################# +# Initialization +################# +include/rpl_init.inc [topology=1->2] +connection server_2; +include/stop_slave.inc +##################################################### +# Pre-test 1: Initial key value +##################################################### +connection server_1; +CREATE TABLE table1_to_encrypt ( +pk INT AUTO_INCREMENT PRIMARY KEY, +ts TIMESTAMP NULL, +b BLOB +) ENGINE=MyISAM; +INSERT INTO table1_to_encrypt VALUES (NULL,NOW(),'data_to_encrypt'); +INSERT INTO table1_to_encrypt SELECT NULL,NOW(),b FROM table1_to_encrypt; +SET binlog_format=ROW; +INSERT INTO table1_to_encrypt SELECT NULL,NOW(),b FROM table1_to_encrypt; +INSERT INTO table1_to_encrypt SELECT NULL,NOW(),b FROM table1_to_encrypt; +NOT FOUND /table1_to_encrypt/ in master-bin.0* +####################################################### +# Pre-test 2: restart master with a different key value +####################################################### +connection default; +connection server_1; +CREATE TABLE table2_to_encrypt ( +pk INT AUTO_INCREMENT PRIMARY KEY, +ts TIMESTAMP NULL, +b BLOB +) ENGINE=MyISAM; +INSERT INTO table2_to_encrypt VALUES (NULL,NOW(),'data_to_encrypt'); +INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt; +SET binlog_format=ROW; +INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt; +INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt; +NOT FOUND /table2_to_encrypt/ in master-bin.0* +##################################################### +# Pre-test 3: restart master again with the right key +##################################################### +connection default; +connection server_1; +CREATE TABLE table3_to_encrypt ( +pk INT AUTO_INCREMENT PRIMARY KEY, +ts TIMESTAMP NULL, +b BLOB +) ENGINE=MyISAM; +INSERT INTO table3_to_encrypt VALUES (NULL,NOW(),'data_to_encrypt'); +INSERT INTO table3_to_encrypt SELECT NULL,NOW(),b FROM table3_to_encrypt; +INSERT INTO table3_to_encrypt SELECT NULL,NOW(),b FROM table3_to_encrypt; +FLUSH BINARY LOGS; +INSERT INTO table3_to_encrypt SELECT NULL,NOW(),b FROM table3_to_encrypt; +##################################################### +# Test 1: Check that if master has an encrypted +# binary log which it cannot decrypt, it +# still feeds events to the slave, and SQL +# thread produces an expected error upon +# receiving these unreadable events . +# This behavior is confirmed in MDEV-11323 +##################################################### +connection server_2; +START SLAVE IO_THREAD; +include/wait_for_slave_io_to_start.inc +START SLAVE SQL_THREAD; +include/wait_for_slave_sql_error.inc [errno=1594] +SHOW TABLES; +Tables_in_test +table1_to_encrypt +SELECT COUNT(*) FROM table1_to_encrypt; +COUNT(*) +8 +##################################################### +# Test 2: check that replication works if it starts +# from a good binary log +##################################################### +connection server_2; +include/stop_slave.inc +RESET SLAVE ALL; +DROP DATABASE test; +CREATE DATABASE test; +USE test; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=, MASTER_USER='root', MASTER_LOG_FILE='master-bin.000003'; +include/start_slave.inc +SHOW TABLES; +Tables_in_test +table3_to_encrypt +##################################################### +# Test 3: check that replication works if we purge +# master logs up to the good one +##################################################### +connection server_2; +connection server_1; +PURGE BINARY LOGS TO 'master-bin.000003'; +connection server_2; +include/stop_slave.inc +RESET SLAVE ALL; +DROP DATABASE test; +CREATE DATABASE test; +USE test; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=, MASTER_USER='root'; +include/start_slave.inc +SHOW TABLES; +Tables_in_test +table3_to_encrypt +########## +# Cleanup +########## +connection server_1; +DROP TABLE table1_to_encrypt, table2_to_encrypt, table3_to_encrypt; +connection server_2; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/encrypted_master_lost_key.test b/mysql-test/suite/binlog_encryption/encrypted_master_lost_key.test new file mode 100644 index 00000000000..7e5fd7859f0 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/encrypted_master_lost_key.test @@ -0,0 +1,205 @@ +# +# The test checks effects and workarounds for the situation when +# the key used to encrypt previous binary logs on master has been lost, +# and master runs with a different one. +# +# The test starts with encrypted binlogs on master. +# It stops replication, generates a few statement and row events +# on the master, then restarts the server with encrypted binlog, +# but with a different value for key 1. +# +# Then it resumes replication and checks what happens when the master +# feed the encrypted logs to the slave (slave SQL thread should +# produce and error). +# +# Then the test resets the slave, configures it to start from a "good" +# master binlog log, for which the master has a key, starts replication +# and checks that it works. +# +# Then it resets the slave again, purges binary logs on master up +# to the "good" one, starts replication and checks that it works. +# + +--source include/have_binlog_format_mixed.inc + +--echo ################# +--echo # Initialization +--echo ################# + +--let $rpl_topology= 1->2 +--source include/rpl_init.inc + +--enable_connect_log + +# We stop replication because we want it to happen after the switch + +--connection server_2 +--disable_connect_log +--source include/stop_slave.inc +--enable_connect_log + +--echo ##################################################### +--echo # Pre-test 1: Initial key value +--echo ##################################################### + +--connection server_1 + +CREATE TABLE table1_to_encrypt ( + pk INT AUTO_INCREMENT PRIMARY KEY, + ts TIMESTAMP NULL, + b BLOB +) ENGINE=MyISAM; + +INSERT INTO table1_to_encrypt VALUES (NULL,NOW(),'data_to_encrypt'); +INSERT INTO table1_to_encrypt SELECT NULL,NOW(),b FROM table1_to_encrypt; +SET binlog_format=ROW; +INSERT INTO table1_to_encrypt SELECT NULL,NOW(),b FROM table1_to_encrypt; +INSERT INTO table1_to_encrypt SELECT NULL,NOW(),b FROM table1_to_encrypt; + +# Make sure that binary logs are encrypted + +--let SEARCH_FILE= master-bin.0* +--let SEARCH_PATTERN= table1_to_encrypt +--source include/search_pattern_in_file.inc + +--echo ####################################################### +--echo # Pre-test 2: restart master with a different key value +--echo ####################################################### + +--write_file $MYSQL_TMP_DIR/master_lose_key.key +1;00000AAAAAAAAAAAAAAAAAAAAAA00000 +EOF + +--let $rpl_server_parameters= --file-key-management-filename=$MYSQL_TMP_DIR/master_lose_key.key + +--let $rpl_server_number= 1 +--source restart_server.inc + +CREATE TABLE table2_to_encrypt ( + pk INT AUTO_INCREMENT PRIMARY KEY, + ts TIMESTAMP NULL, + b BLOB +) ENGINE=MyISAM; + +INSERT INTO table2_to_encrypt VALUES (NULL,NOW(),'data_to_encrypt'); +INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt; +SET binlog_format=ROW; +INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt; +INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt; + +# Make sure that binary logs are encrypted + +--let SEARCH_FILE= master-bin.0* +--let SEARCH_PATTERN= table2_to_encrypt +--source include/search_pattern_in_file.inc + +--echo ##################################################### +--echo # Pre-test 3: restart master again with the right key +--echo ##################################################### + +--let $rpl_server_parameters= +--let $rpl_server_number= 1 +--source restart_server.inc + +--let $good_master_binlog= query_get_value(SHOW MASTER STATUS,File,1) + +CREATE TABLE table3_to_encrypt ( + pk INT AUTO_INCREMENT PRIMARY KEY, + ts TIMESTAMP NULL, + b BLOB +) ENGINE=MyISAM; + +INSERT INTO table3_to_encrypt VALUES (NULL,NOW(),'data_to_encrypt'); +INSERT INTO table3_to_encrypt SELECT NULL,NOW(),b FROM table3_to_encrypt; +INSERT INTO table3_to_encrypt SELECT NULL,NOW(),b FROM table3_to_encrypt; +FLUSH BINARY LOGS; +INSERT INTO table3_to_encrypt SELECT NULL,NOW(),b FROM table3_to_encrypt; + +--save_master_pos + +--echo ##################################################### +--echo # Test 1: Check that if master has an encrypted +--echo # binary log which it cannot decrypt, it +--echo # still feeds events to the slave, and SQL +--echo # thread produces an expected error upon +--echo # receiving these unreadable events . +--echo # This behavior is confirmed in MDEV-11323 +--echo ##################################################### +--connection server_2 + +--disable_connect_log +START SLAVE IO_THREAD; +--source include/wait_for_slave_io_to_start.inc + +START SLAVE SQL_THREAD; +--let $slave_sql_errno= 1594 +--source include/wait_for_slave_sql_error.inc +--enable_connect_log + +# Here we should see only table1_to_encrypt and its contents, +# because it was logged with the initial key +--sorted_result +SHOW TABLES; +SELECT COUNT(*) FROM table1_to_encrypt; + +--echo ##################################################### +--echo # Test 2: check that replication works if it starts +--echo # from a good binary log +--echo ##################################################### +--connection server_2 + +--disable_connect_log +--source include/stop_slave.inc +RESET SLAVE ALL; +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--replace_result $SERVER_MYPORT_1 +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SERVER_MYPORT_1, MASTER_USER='root', MASTER_LOG_FILE='$good_master_binlog'; +--source include/start_slave.inc +--enable_connect_log +--sync_with_master + +--sorted_result +SHOW TABLES; + +--echo ##################################################### +--echo # Test 3: check that replication works if we purge +--echo # master logs up to the good one +--echo ##################################################### +--connection server_2 + +--connection server_1 +eval PURGE BINARY LOGS TO '$good_master_binlog'; + +--connection server_2 +--disable_connect_log +--source include/stop_slave.inc +RESET SLAVE ALL; +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--replace_result $SERVER_MYPORT_1 +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SERVER_MYPORT_1, MASTER_USER='root'; +--source include/start_slave.inc +--enable_connect_log +--sync_with_master + +--sorted_result +SHOW TABLES; + +--echo ########## +--echo # Cleanup +--echo ########## + +--connection server_1 + +DROP TABLE table1_to_encrypt, table2_to_encrypt, table3_to_encrypt; + +--save_master_pos + +--connection server_2 +--sync_with_master + +--disable_connect_log +--source include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.cnf b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.cnf new file mode 100644 index 00000000000..73c9ad655bf --- /dev/null +++ b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.cnf @@ -0,0 +1,5 @@ +!include my.cnf + +[mysqld.1] +encrypt-binlog=0 +skip-file-key-management diff --git a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.result b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.result new file mode 100644 index 00000000000..d632c565ad2 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.result @@ -0,0 +1,84 @@ +################# +# Initialization +################# +include/rpl_init.inc [topology=1->2] +connection server_2; +include/stop_slave.inc +##################################################### +# Part 1: unencrypted master +##################################################### +connection server_1; +call mtr.add_suppression("Got fatal error 1236 from master when reading data from binary log: 'Could not decrypt binlog: encryption key error;"); +CREATE TABLE table1_no_encryption ( +pk INT AUTO_INCREMENT PRIMARY KEY, +ts TIMESTAMP NULL, +b BLOB +) ENGINE=MyISAM; +INSERT INTO table1_no_encryption VALUES (NULL,NOW(),'data_no_encryption'); +INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption; +FLUSH BINARY LOGS; +SET binlog_format=ROW; +INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption; +INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption; +NOT FOUND /table1_no_encryption/ in master-bin.0* +##################################################### +# Part 2: restart master, now with binlog encryption +##################################################### +connection default; +connection server_1; +CREATE TABLE table2_to_encrypt ( +pk INT AUTO_INCREMENT PRIMARY KEY, +ts TIMESTAMP NULL, +b BLOB +) ENGINE=MyISAM; +INSERT INTO table2_to_encrypt VALUES (NULL,NOW(),'data_to_encrypt'); +INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt; +FLUSH BINARY LOGS; +SET binlog_format=ROW; +INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt; +INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt; +NOT FOUND /table2_to_encrypt/ in master-bin.0* +##################################################### +# Part 3: restart master again without encryption +##################################################### +connection default; +connection server_1; +CREATE TABLE table3_no_encryption ( +pk INT AUTO_INCREMENT PRIMARY KEY, +ts TIMESTAMP NULL, +b BLOB +) ENGINE=MyISAM; +INSERT INTO table3_no_encryption VALUES (NULL,NOW(),'data_no_encryption'); +INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption; +INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption; +##################################################### +# Check: resume replication and check how it goes +##################################################### +connection server_2; +start slave; +connection server_1; +connection server_2; +include/wait_for_slave_io_error.inc [errno=1236] +SHOW TABLES; +Tables_in_test +table1_no_encryption +include/stop_slave.inc +reset slave; +########## +# Cleanup +########## +connection server_1; +reset master; +SELECT COUNT(*) FROM table1_no_encryption; +COUNT(*) +8 +SELECT COUNT(*) FROM table2_to_encrypt; +COUNT(*) +8 +SELECT COUNT(*) FROM table3_no_encryption; +COUNT(*) +4 +DROP TABLE table1_no_encryption, table2_to_encrypt, table3_no_encryption; +connection server_2; +include/start_slave.inc +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.test b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.test new file mode 100644 index 00000000000..91231f89307 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.test @@ -0,0 +1,151 @@ +# +# TODO: write here what the test checks after MDEV-11288 is fixed +# +# The test starts with unencrypted master. +# It stops replication, generates a few statement and row events +# on the master, then restarts the server with encrypted binlog, +# generates some more events and restarts it back without encryption +# (no encryption plugin). +# Then it resumes replication and checks what happens when the server +# tries to feed the binary logs (included the encrypted ones) +# to the slave. +# + +--source include/have_binlog_format_mixed.inc + +--echo ################# +--echo # Initialization +--echo ################# + +--let $rpl_topology= 1->2 +--source include/rpl_init.inc + +--enable_connect_log + +# We stop replication because we want it to happen after the switch + +--connection server_2 +--disable_connect_log +--source include/stop_slave.inc +--enable_connect_log + +--echo ##################################################### +--echo # Part 1: unencrypted master +--echo ##################################################### + +--connection server_1 + +call mtr.add_suppression("Got fatal error 1236 from master when reading data from binary log: 'Could not decrypt binlog: encryption key error;"); + +CREATE TABLE table1_no_encryption ( + pk INT AUTO_INCREMENT PRIMARY KEY, + ts TIMESTAMP NULL, + b BLOB +) ENGINE=MyISAM; + +INSERT INTO table1_no_encryption VALUES (NULL,NOW(),'data_no_encryption'); +INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption; +FLUSH BINARY LOGS; +SET binlog_format=ROW; +INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption; +INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption; + +# Make sure that binary logs are not encrypted + +--let SEARCH_FILE= master-bin.0* +--let SEARCH_PATTERN= table1_no_encryption +--source include/search_pattern_in_file.inc + +# We are storing the position now, because up to this point the slave +# should be able to synchronize with master +--save_master_pos + +--echo ##################################################### +--echo # Part 2: restart master, now with binlog encryption +--echo ##################################################### + +--let $rpl_server_parameters= --encrypt-binlog=1 --plugin-load-add=$FILE_KEY_MANAGEMENT_SO --file-key-management --loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt + +--let $rpl_server_number= 1 +--source restart_server.inc + +CREATE TABLE table2_to_encrypt ( + pk INT AUTO_INCREMENT PRIMARY KEY, + ts TIMESTAMP NULL, + b BLOB +) ENGINE=MyISAM; + +INSERT INTO table2_to_encrypt VALUES (NULL,NOW(),'data_to_encrypt'); +INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt; +FLUSH BINARY LOGS; +SET binlog_format=ROW; +INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt; +INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt; + +# Make sure that binary logs are encrypted + +--let SEARCH_FILE= master-bin.0* +--let SEARCH_PATTERN= table2_to_encrypt +--source include/search_pattern_in_file.inc + +--echo ##################################################### +--echo # Part 3: restart master again without encryption +--echo ##################################################### + +--let $rpl_server_parameters= --encrypt-binlog=0 +--let $rpl_server_number= 1 +--source restart_server.inc + +CREATE TABLE table3_no_encryption ( + pk INT AUTO_INCREMENT PRIMARY KEY, + ts TIMESTAMP NULL, + b BLOB +) ENGINE=MyISAM; + +INSERT INTO table3_no_encryption VALUES (NULL,NOW(),'data_no_encryption'); +INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption; +INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption; + +--echo ##################################################### +--echo # Check: resume replication and check how it goes +--echo ##################################################### + +--connection server_2 +start slave; +# The slave should be able to synchronize with master up to +# the previously saved position (when the log was still unencrypted) +--sync_with_master + +--connection server_1 +# Now save the current position and make slave to try to syncrhonize. +# It shouldn't work, the slave IO thread is expected to abort with an error +--save_master_pos + +--connection server_2 +--let slave_io_errno=1236 +--source include/wait_for_slave_io_error.inc + +--sorted_result +SHOW TABLES; + +--disable_connect_log +--source include/stop_slave.inc +--enable_connect_log +reset slave; + +--echo ########## +--echo # Cleanup +--echo ########## + +--connection server_1 +reset master; + +SELECT COUNT(*) FROM table1_no_encryption; +SELECT COUNT(*) FROM table2_to_encrypt; +SELECT COUNT(*) FROM table3_no_encryption; +DROP TABLE table1_no_encryption, table2_to_encrypt, table3_no_encryption; + +--connection server_2 +--disable_connect_log +--source include/start_slave.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/encrypted_slave.cnf b/mysql-test/suite/binlog_encryption/encrypted_slave.cnf new file mode 100644 index 00000000000..fac94db71df --- /dev/null +++ b/mysql-test/suite/binlog_encryption/encrypted_slave.cnf @@ -0,0 +1,12 @@ +!include my.cnf + +[mysqld.1] +encrypt-binlog=0 + +[mysqld.2] +#log-slave-updates +encrypt-binlog +plugin-load-add= @ENV.FILE_KEY_MANAGEMENT_SO +file-key-management +loose-file-key-management-filename= @ENV.MYSQL_TEST_DIR/std_data/keys.txt +binlog_checksum=NONE diff --git a/mysql-test/suite/binlog_encryption/encrypted_slave.result b/mysql-test/suite/binlog_encryption/encrypted_slave.result new file mode 100644 index 00000000000..00096a61a5b --- /dev/null +++ b/mysql-test/suite/binlog_encryption/encrypted_slave.result @@ -0,0 +1,176 @@ +################# +# Initialization +################# +include/rpl_init.inc [topology=1->2] +connection server_2; +include/stop_slave_sql.inc +################# +# Test flow +################# +connection server_1; +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +CREATE DATABASE database_name_to_encrypt; +USE database_name_to_encrypt; +CREATE USER user_name_to_encrypt; +GRANT ALL ON database_name_to_encrypt.* TO user_name_to_encrypt; +SET PASSWORD FOR user_name_to_encrypt = PASSWORD('password_to_encrypt'); +CREATE TABLE innodb_table_name_to_encrypt ( +int_column_name_to_encrypt INT PRIMARY KEY, +timestamp_column_name_to_encrypt TIMESTAMP(6) NULL, +blob_column_name_to_encrypt BLOB, +virt_column_name_to_encrypt INT AS (int_column_name_to_encrypt % 10) VIRTUAL, +pers_column_name_to_encrypt INT AS (int_column_name_to_encrypt) PERSISTENT, +INDEX `index_name_to_encrypt`(`timestamp_column_name_to_encrypt`) +) ENGINE=InnoDB +PARTITION BY RANGE (int_column_name_to_encrypt) +SUBPARTITION BY KEY (int_column_name_to_encrypt) +SUBPARTITIONS 2 ( +PARTITION partition0_name_to_encrypt VALUES LESS THAN (100), +PARTITION partition1_name_to_encrypt VALUES LESS THAN (MAXVALUE) +) +; +CREATE TABLE myisam_table_name_to_encrypt ( +int_column_name_to_encrypt INT AUTO_INCREMENT PRIMARY KEY, +char_column_name_to_encrypt VARCHAR(255), +datetime_column_name_to_encrypt DATETIME, +text_column_name_to_encrypt TEXT +) ENGINE=MyISAM; +CREATE TABLE aria_table_name_to_encrypt ( +int_column_name_to_encrypt INT AUTO_INCREMENT PRIMARY KEY, +varchar_column_name_to_encrypt VARCHAR(1024), +enum_column_name_to_encrypt ENUM( +'enum_value1_to_encrypt', +'enum_value2_to_encrypt' + ), +timestamp_column_name_to_encrypt TIMESTAMP(6) NULL, +blob_column_name_to_encrypt BLOB +) ENGINE=Aria; +CREATE TRIGGER trigger_name_to_encrypt +AFTER INSERT ON myisam_table_name_to_encrypt FOR EACH ROW +INSERT INTO aria_table_name_to_encrypt (varchar_column_name_to_encrypt) +VALUES (NEW.char_column_name_to_encrypt); +CREATE DEFINER=user_name_to_encrypt VIEW view_name_to_encrypt +AS SELECT * FROM innodb_table_name_to_encrypt; +CREATE FUNCTION func_name_to_encrypt (func_parameter_to_encrypt INT) +RETURNS VARCHAR(64) +RETURN 'func_result_to_encrypt'; +CREATE PROCEDURE proc_name_to_encrypt ( +IN proc_in_parameter_to_encrypt CHAR(32), +OUT proc_out_parameter_to_encrypt INT +) +BEGIN +DECLARE procvar_name_to_encrypt CHAR(64) DEFAULT 'procvar_val_to_encrypt'; +DECLARE cursor_name_to_encrypt CURSOR FOR +SELECT virt_column_name_to_encrypt FROM innodb_table_name_to_encrypt; +DECLARE EXIT HANDLER FOR NOT FOUND +BEGIN +SET @stmt_var_to_encrypt = CONCAT( +"SELECT + IF (RAND()>0.5,'enum_value2_to_encrypt','enum_value1_to_encrypt') + FROM innodb_table_name_to_encrypt + INTO OUTFILE '", proc_in_parameter_to_encrypt, "'"); +PREPARE stmt_to_encrypt FROM @stmt_var_to_encrypt; +EXECUTE stmt_to_encrypt; +DEALLOCATE PREPARE stmt_to_encrypt; +END; +OPEN cursor_name_to_encrypt; +proc_label_to_encrypt: LOOP +FETCH cursor_name_to_encrypt INTO procvar_name_to_encrypt; +END LOOP; +CLOSE cursor_name_to_encrypt; +END $$ +CREATE SERVER server_name_to_encrypt +FOREIGN DATA WRAPPER mysql +OPTIONS (HOST 'host_name_to_encrypt'); +connect con1,localhost,user_name_to_encrypt,password_to_encrypt,database_name_to_encrypt; +CREATE TEMPORARY TABLE tmp_table_name_to_encrypt ( +float_column_name_to_encrypt FLOAT, +binary_column_name_to_encrypt BINARY(64) +); +disconnect con1; +connection server_1; +CREATE INDEX index_name_to_encrypt +ON myisam_table_name_to_encrypt (datetime_column_name_to_encrypt); +ALTER DATABASE database_name_to_encrypt CHARACTER SET utf8; +ALTER TABLE innodb_table_name_to_encrypt +MODIFY timestamp_column_name_to_encrypt TIMESTAMP NOT NULL +DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +; +ALTER ALGORITHM=MERGE VIEW view_name_to_encrypt +AS SELECT * FROM innodb_table_name_to_encrypt; +RENAME TABLE innodb_table_name_to_encrypt TO new_table_name_to_encrypt; +ALTER TABLE new_table_name_to_encrypt RENAME TO innodb_table_name_to_encrypt; +set @user_var1_to_encrypt= 'dyncol1_val_to_encrypt'; +set @user_var2_to_encrypt= 'dyncol2_name_to_encrypt'; +INSERT INTO view_name_to_encrypt VALUES +(1, NOW(6), COLUMN_CREATE('dyncol1_name_to_encrypt',@user_var1_to_encrypt), NULL, NULL), +(2, NOW(6), COLUMN_CREATE(@user_var2_to_encrypt,'dyncol2_val_to_encrypt'), NULL, NULL) +; +BEGIN NOT ATOMIC +DECLARE counter_name_to_encrypt INT DEFAULT 0; +START TRANSACTION; +WHILE counter_name_to_encrypt<12 DO +SELECT COUNT(*) INTO @cnt FROM innodb_table_name_to_encrypt; +INSERT INTO innodb_table_name_to_encrypt +SELECT int_column_name_to_encrypt+@cnt, NOW(6), blob_column_name_to_encrypt, NULL, NULL +FROM innodb_table_name_to_encrypt +ORDER BY int_column_name_to_encrypt; +SET counter_name_to_encrypt = counter_name_to_encrypt+1; +END WHILE; +COMMIT; +END +$$ +INSERT INTO myisam_table_name_to_encrypt +SELECT NULL, 'char_literal_to_encrypt', NULL, 'text_to_encrypt'; +INSERT INTO myisam_table_name_to_encrypt (char_column_name_to_encrypt) +SELECT char_column_name_to_encrypt FROM myisam_table_name_to_encrypt; +INSERT INTO myisam_table_name_to_encrypt (char_column_name_to_encrypt) +SELECT char_column_name_to_encrypt FROM myisam_table_name_to_encrypt; +INSERT INTO myisam_table_name_to_encrypt (char_column_name_to_encrypt) +SELECT char_column_name_to_encrypt FROM myisam_table_name_to_encrypt; +CALL proc_name_to_encrypt('file_name_to_encrypt',@useless_var_to_encrypt); +TRUNCATE TABLE aria_table_name_to_encrypt; +LOAD DATA INFILE 'file_name_to_encrypt' INTO TABLE aria_table_name_to_encrypt +(enum_column_name_to_encrypt); +LOAD DATA LOCAL INFILE '/database_name_to_encrypt/file_name_to_encrypt' +INTO TABLE aria_table_name_to_encrypt (enum_column_name_to_encrypt); +UPDATE view_name_to_encrypt SET blob_column_name_to_encrypt = +COLUMN_CREATE('dyncol1_name_to_encrypt',func_name_to_encrypt(0)) +; +DELETE FROM aria_table_name_to_encrypt ORDER BY int_column_name_to_encrypt LIMIT 10; +ANALYZE TABLE myisam_table_name_to_encrypt; +CHECK TABLE aria_table_name_to_encrypt; +CHECKSUM TABLE innodb_table_name_to_encrypt, myisam_table_name_to_encrypt; +RENAME USER user_name_to_encrypt to new_user_name_to_encrypt; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM new_user_name_to_encrypt; +DROP DATABASE database_name_to_encrypt; +DROP USER new_user_name_to_encrypt; +DROP SERVER server_name_to_encrypt; +################# +# Master binlog checks +################# +FOUND /_to_encrypt/ in master-bin.0* +FOUND /COMMIT/ in master-bin.0* +FOUND /TIMESTAMP/ in master-bin.0* +include/save_master_pos.inc +################# +# Relay log checks +################# +connection server_2; +include/sync_io_with_master.inc +NOT FOUND /_to_encrypt/ in slave-relay-bin.0* +NOT FOUND /COMMIT/ in slave-relay-bin.0* +NOT FOUND /TIMESTAMP/ in slave-relay-bin.0* +################# +# Slave binlog checks +################# +include/start_slave.inc +include/sync_slave_sql_with_io.inc +include/sync_io_with_master.inc +NOT FOUND /_to_encrypt/ in slave-bin.0* +NOT FOUND /COMMIT/ in slave-bin.0* +NOT FOUND /TIMESTAMP/ in slave-bin.0* +########## +# Cleanup +########## +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/encrypted_slave.test b/mysql-test/suite/binlog_encryption/encrypted_slave.test new file mode 100644 index 00000000000..a69e78cd940 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/encrypted_slave.test @@ -0,0 +1,117 @@ +# +# The test checks that basic DDL and DML events are encrypted +# in the relay and binary logs on slave. +# The test is to be run with all binlog formats +# (combinations for rpl_init.inc take care of that). +# +# The test runs with the non-encrypted master and encrypted slave. +# It generates a sequence of events on master and checks that +# relay logs and binary logs are encrypted on slave. +# + +--source encryption_algorithms.inc +--source include/have_innodb.inc + +--echo ################# +--echo # Initialization +--echo ################# + +--let $rpl_topology= 1->2 +--source include/rpl_init.inc + +--enable_connect_log +--connection server_2 + +# We stop SQL thread because we want to have +# all relay logs at the end of the test flow + +--disable_connect_log +--source include/stop_slave_sql.inc +--enable_connect_log + +--echo ################# +--echo # Test flow +--echo ################# + +--connection server_1 +--source testdata.inc + +--echo ################# +--echo # Master binlog checks +--echo ################# + +--let $master_datadir= `SELECT @@datadir` + +--let SEARCH_FILE= $master_datadir/master-bin.0* +--let SEARCH_PATTERN= _to_encrypt +--source include/search_pattern_in_file.inc + +--let SEARCH_FILE= $master_datadir/master-bin.0* +--let SEARCH_PATTERN= COMMIT +--source include/search_pattern_in_file.inc + +--let SEARCH_FILE= $master_datadir/master-bin.0* +--let SEARCH_PATTERN= TIMESTAMP +--source include/search_pattern_in_file.inc + +--disable_connect_log +--source include/save_master_pos.inc +--enable_connect_log + +--echo ################# +--echo # Relay log checks +--echo ################# + +--connection server_2 +--disable_connect_log +--source include/sync_io_with_master.inc +--enable_connect_log + +--let $slave_datadir= `SELECT @@datadir` + +--let SEARCH_FILE= $slave_datadir/slave-relay-bin.0* +--let SEARCH_PATTERN= _to_encrypt +--source include/search_pattern_in_file.inc + +--let SEARCH_FILE= $slave_datadir/slave-relay-bin.0* +--let SEARCH_PATTERN= COMMIT +--source include/search_pattern_in_file.inc + +--let SEARCH_FILE= $slave_datadir/slave-relay-bin.0* +--let SEARCH_PATTERN= TIMESTAMP +--source include/search_pattern_in_file.inc + +--echo ################# +--echo # Slave binlog checks +--echo ################# + +# Re-enable SQL thread, let it catch up with IO thread +# and check slave binary logs + +--disable_connect_log +--source include/start_slave.inc +--source include/sync_slave_sql_with_io.inc +--enable_connect_log + +--disable_connect_log +--source include/sync_io_with_master.inc +--enable_connect_log + +--let SEARCH_FILE= $slave_datadir/slave-bin.0* +--let SEARCH_PATTERN= _to_encrypt +--source include/search_pattern_in_file.inc + +--let SEARCH_FILE= $slave_datadir/slave-bin.0* +--let SEARCH_PATTERN= COMMIT +--source include/search_pattern_in_file.inc + +--let SEARCH_FILE= $slave_datadir/slave-bin.0* +--let SEARCH_PATTERN= TIMESTAMP +--source include/search_pattern_in_file.inc + +--echo ########## +--echo # Cleanup +--echo ########## + +--disable_connect_log +--source include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/encryption_algorithms.combinations b/mysql-test/suite/binlog_encryption/encryption_algorithms.combinations new file mode 100644 index 00000000000..6bda5a6b35e --- /dev/null +++ b/mysql-test/suite/binlog_encryption/encryption_algorithms.combinations @@ -0,0 +1,5 @@ +[ctr] +loose-file-key-management-encryption-algorithm=aes_ctr + +[cbc] +loose-file-key-management-encryption-algorithm=aes_cbc diff --git a/mysql-test/suite/binlog_encryption/encryption_algorithms.inc b/mysql-test/suite/binlog_encryption/encryption_algorithms.inc new file mode 100644 index 00000000000..ca559622b26 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/encryption_algorithms.inc @@ -0,0 +1,2 @@ +# Empty include file just to enable encryption algorithm combinations +# for those tests which need them diff --git a/mysql-test/suite/binlog_encryption/encryption_combo.cnf b/mysql-test/suite/binlog_encryption/encryption_combo.cnf new file mode 100644 index 00000000000..bc4ecbcb47a --- /dev/null +++ b/mysql-test/suite/binlog_encryption/encryption_combo.cnf @@ -0,0 +1,5 @@ +!include my.cnf + +[mysqld.1] +encrypt-binlog=0 + diff --git a/mysql-test/suite/binlog_encryption/encryption_combo.result b/mysql-test/suite/binlog_encryption/encryption_combo.result new file mode 100644 index 00000000000..d921c73440d --- /dev/null +++ b/mysql-test/suite/binlog_encryption/encryption_combo.result @@ -0,0 +1,78 @@ +################# +# Initialization +################# +include/rpl_init.inc [topology=1->2] +connection server_2; +include/stop_slave.inc +##################################################### +# Part 1: unencrypted master +##################################################### +connection server_1; +CREATE TABLE table1_no_encryption ( +pk INT AUTO_INCREMENT PRIMARY KEY, +ts TIMESTAMP NULL, +b BLOB +) ENGINE=MyISAM; +INSERT INTO table1_no_encryption VALUES (NULL,NOW(),'data_no_encryption'); +INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption; +FLUSH BINARY LOGS; +SET binlog_format=ROW; +INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption; +INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption; +FOUND /table1_no_encryption/ in master-bin.0* +##################################################### +# Part 2: restart master, now with binlog encryption +##################################################### +connection default; +connection server_1; +CREATE TABLE table2_to_encrypt ( +pk INT AUTO_INCREMENT PRIMARY KEY, +ts TIMESTAMP NULL, +b BLOB +) ENGINE=MyISAM; +INSERT INTO table2_to_encrypt VALUES (NULL,NOW(),'data_to_encrypt'); +INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt; +FLUSH BINARY LOGS; +SET binlog_format=ROW; +INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt; +INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt; +NOT FOUND /table2_to_encrypt/ in master-bin.0* +##################################################### +# Part 3: restart master again without encryption +##################################################### +connection default; +connection server_1; +CREATE TABLE table3_no_encryption ( +pk INT AUTO_INCREMENT PRIMARY KEY, +ts TIMESTAMP NULL, +b BLOB +) ENGINE=MyISAM; +INSERT INTO table3_no_encryption VALUES (NULL,NOW(),'data_no_encryption'); +INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption; +INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption; +##################################################### +# Check: resume replication and check that it works +##################################################### +connection server_2; +include/start_slave.inc +SHOW TABLES; +Tables_in_test +table1_no_encryption +table2_to_encrypt +table3_no_encryption +########## +# Cleanup +########## +connection server_1; +SELECT COUNT(*) FROM table1_no_encryption; +COUNT(*) +8 +SELECT COUNT(*) FROM table2_to_encrypt; +COUNT(*) +8 +SELECT COUNT(*) FROM table3_no_encryption; +COUNT(*) +4 +DROP TABLE table1_no_encryption, table2_to_encrypt, table3_no_encryption; +connection server_2; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/encryption_combo.test b/mysql-test/suite/binlog_encryption/encryption_combo.test new file mode 100644 index 00000000000..a5cf117d4a8 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/encryption_combo.test @@ -0,0 +1,136 @@ +# +# The test checks that master with decryption capabilities can switch +# between encrypted and unencrypted logs (with server restart), +# and can feed the mix of encrypted/unencrypted logs to a slave. +# +# The test starts with unencrypted master. +# It stops replication, generates a few statement and row events +# on the master, then restarts the server with encrypted binlog, +# generates some more events and restarts it back with unencrypted binlog. +# Then it resumes replication and checks that all events +# are replicated successfully. +# + +--source include/have_binlog_format_mixed.inc + +--echo ################# +--echo # Initialization +--echo ################# + +--let $rpl_topology= 1->2 +--source include/rpl_init.inc + +--enable_connect_log + +# We stop replication because we want it to happen after the switch + +--connection server_2 +--disable_connect_log +--source include/stop_slave.inc +--enable_connect_log + +--echo ##################################################### +--echo # Part 1: unencrypted master +--echo ##################################################### + +--connection server_1 + +CREATE TABLE table1_no_encryption ( + pk INT AUTO_INCREMENT PRIMARY KEY, + ts TIMESTAMP NULL, + b BLOB +) ENGINE=MyISAM; + +INSERT INTO table1_no_encryption VALUES (NULL,NOW(),'data_no_encryption'); +INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption; +FLUSH BINARY LOGS; +SET binlog_format=ROW; +INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption; +INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption; + +# Make sure that binary logs are not encrypted + +--let $master_datadir= `SELECT @@datadir` + +--let SEARCH_FILE= $master_datadir/master-bin.0* +--let SEARCH_PATTERN= table1_no_encryption +--source include/search_pattern_in_file.inc + +--echo ##################################################### +--echo # Part 2: restart master, now with binlog encryption +--echo ##################################################### + +--let $rpl_server_parameters= --encrypt-binlog=1 +--let $rpl_server_number= 1 +--source restart_server.inc + +CREATE TABLE table2_to_encrypt ( + pk INT AUTO_INCREMENT PRIMARY KEY, + ts TIMESTAMP NULL, + b BLOB +) ENGINE=MyISAM; + +INSERT INTO table2_to_encrypt VALUES (NULL,NOW(),'data_to_encrypt'); +INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt; +FLUSH BINARY LOGS; +SET binlog_format=ROW; +INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt; +INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt; + +# Make sure that binary logs are encrypted + +--let SEARCH_FILE= $master_datadir/master-bin.0* +--let SEARCH_PATTERN= table2_to_encrypt +--source include/search_pattern_in_file.inc + +--echo ##################################################### +--echo # Part 3: restart master again without encryption +--echo ##################################################### + +--let $rpl_server_parameters= --encrypt-binlog=0 +--let $rpl_server_number= 1 +--source restart_server.inc + +CREATE TABLE table3_no_encryption ( + pk INT AUTO_INCREMENT PRIMARY KEY, + ts TIMESTAMP NULL, + b BLOB +) ENGINE=MyISAM; + +INSERT INTO table3_no_encryption VALUES (NULL,NOW(),'data_no_encryption'); +INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption; +INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption; + +--save_master_pos + +--echo ##################################################### +--echo # Check: resume replication and check that it works +--echo ##################################################### +--connection server_2 + +--disable_connect_log +--source include/start_slave.inc +--enable_connect_log +--sync_with_master + +--sorted_result +SHOW TABLES; + +--echo ########## +--echo # Cleanup +--echo ########## + +--connection server_1 + +SELECT COUNT(*) FROM table1_no_encryption; +SELECT COUNT(*) FROM table2_to_encrypt; +SELECT COUNT(*) FROM table3_no_encryption; +DROP TABLE table1_no_encryption, table2_to_encrypt, table3_no_encryption; + +--save_master_pos + +--connection server_2 +--sync_with_master + +--disable_connect_log +--source include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/multisource.cnf b/mysql-test/suite/binlog_encryption/multisource.cnf new file mode 100644 index 00000000000..52db51d9086 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/multisource.cnf @@ -0,0 +1,17 @@ +!include my.cnf + +[mysqld.1] +log-bin=master-bin + +[mysqld.2] +log-bin=master-bin + +[mysqld.3] +innodb +log-bin=slave-bin +server-id=3 +log-warnings=2 + +[ENV] +SERVER_MYPORT_3= @mysqld.3.port +SERVER_MYSOCK_3= @mysqld.3.socket diff --git a/mysql-test/suite/binlog_encryption/multisource.result b/mysql-test/suite/binlog_encryption/multisource.result new file mode 100644 index 00000000000..d99a377f0c5 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/multisource.result @@ -0,0 +1,228 @@ +connect slave,127.0.0.1,root,,,$SERVER_MYPORT_3; +change master 'abc' to relay_log_file=''; +ERROR HY000: Failed initializing relay log position: Could not find target log during relay log initialization +change master 'abc2' to master_host=''; +ERROR HY000: Incorrect arguments to MASTER_HOST +change master 'master1' to +master_port=MYPORT_1, +master_host='127.0.0.1', +master_user='root'; +start slave 'master1'; +set default_master_connection = 'master1'; +include/wait_for_slave_to_start.inc +connect master1,127.0.0.1,root,,,$SERVER_MYPORT_1; +connection slave; +# +# Checking SHOW SLAVE 'master1' STATUS +# +Master_Port = 'MYPORT_1' +Relay_Log_File = 'mysqld-relay-bin-master1.000002' +Slave_IO_Running = 'Yes' +Slave_SQL_Running = 'Yes' +Last_Errno = '0' +Last_SQL_Errno = '0' +# +# Checking SHOW SLAVE STATUS +# +Master_Port = 'MYPORT_1' +Relay_Log_File = 'mysqld-relay-bin-master1.000002' +Slave_IO_Running = 'Yes' +Slave_SQL_Running = 'Yes' +Last_Errno = '0' +Last_SQL_Errno = '0' +# +# Checking SHOW ALL SLAVES STATUS +# +Connection_name = 'master1' +Master_Port = 'MYPORT_1' +Relay_Log_File = 'mysqld-relay-bin-master1.000002' +Slave_IO_Running = 'Yes' +Slave_SQL_Running = 'Yes' +Last_Errno = '0' +Last_SQL_Errno = '0' +Slave_heartbeat_period = '60.000' +# +connection master1; +drop database if exists db1; +create database db1; +use db1; +create table t1 (i int auto_increment, f1 varchar(16), primary key pk (i,f1)) engine=MyISAM; +insert into t1 (f1) values ('one'),('two'); +connection slave; +select * from db1.t1; +i f1 +1 one +2 two +# List of relay log files in the datadir +mysqld-relay-bin-master1.000001 +mysqld-relay-bin-master1.000002 +mysqld-relay-bin-master1.index +include/show_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +mysqld-relay-bin-master1.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +mysqld-relay-bin-master1.000001 # Rotate # # mysqld-relay-bin-master1.000002;pos=4 +include/show_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +mysqld-relay-bin-master1.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +mysqld-relay-bin-master1.000002 # Rotate # # master-bin.000001;pos=POS +mysqld-relay-bin-master1.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +mysqld-relay-bin-master1.000002 # Gtid_list # # [] +mysqld-relay-bin-master1.000002 # Binlog_checkpoint # # master-bin.000001 +mysqld-relay-bin-master1.000002 # Gtid # # GTID #-#-# +mysqld-relay-bin-master1.000002 # Query # # drop database if exists db1 +mysqld-relay-bin-master1.000002 # Gtid # # GTID #-#-# +mysqld-relay-bin-master1.000002 # Query # # create database db1 +mysqld-relay-bin-master1.000002 # Gtid # # GTID #-#-# +mysqld-relay-bin-master1.000002 # Query # # use `db1`; create table t1 (i int auto_increment, f1 varchar(16), primary key pk (i,f1)) engine=MyISAM +mysqld-relay-bin-master1.000002 # Gtid # # BEGIN GTID #-#-# +mysqld-relay-bin-master1.000002 # Intvar # # INSERT_ID=1 +mysqld-relay-bin-master1.000002 # Query # # use `db1`; insert into t1 (f1) values ('one'),('two') +mysqld-relay-bin-master1.000002 # Query # # COMMIT +change master 'master1' to +master_port=MYPORT_2, +master_host='127.0.0.1', +master_user='root'; +ERROR HY000: This operation cannot be performed as you have a running slave 'master1'; run STOP SLAVE 'master1' first +change master to +master_port=MYPORT_2, +master_host='127.0.0.1', +master_user='root'; +ERROR HY000: This operation cannot be performed as you have a running slave 'master1'; run STOP SLAVE 'master1' first +change master 'master2' to +master_port=MYPORT_1, +master_host='127.0.0.1', +master_user='root'; +ERROR HY000: Connection 'master2' conflicts with existing connection 'master1' +set default_master_connection = ''; +change master to +master_port=MYPORT_2, +master_host='127.0.0.1', +master_user='root'; +start slave; +include/wait_for_slave_to_start.inc +# +# Checking SHOW ALL SLAVES STATUS +# +Connection_name = '' +Connection_name = 'master1' +Master_Port = 'MYPORT_2' +Master_Port = 'MYPORT_1' +Relay_Log_File = 'mysqld-relay-bin.000002' +Relay_Log_File = 'mysqld-relay-bin-master1.000002' +Slave_IO_Running = 'Yes' +Slave_IO_Running = 'Yes' +Slave_SQL_Running = 'Yes' +Slave_SQL_Running = 'Yes' +Last_Errno = '0' +Last_Errno = '0' +Last_SQL_Errno = '0' +Last_SQL_Errno = '0' +Slave_heartbeat_period = '60.000' +Slave_heartbeat_period = '60.000' +# +connection master1; +insert into t1 (f1) values ('three'); +connect master2,127.0.0.1,root,,,$SERVER_MYPORT_2; +drop database if exists db2; +create database db2; +use db2; +create table t1 (pk int auto_increment primary key, f1 int) engine=InnoDB; +begin; +insert into t1 (f1) values (1),(2); +connection slave; +connection master2; +connection slave; +select * from db1.t1; +i f1 +1 one +2 two +3 three +select * from db2.t1; +pk f1 +connection master2; +commit; +connection slave; +select * from db2.t1; +pk f1 +1 1 +2 2 +connection master1; +flush logs; +connection slave; +connection master1; +purge binary logs to 'master-bin.000002'; +show binary logs; +Log_name File_size +master-bin.000002 filesize +insert into t1 (f1) values ('four'); +create table db1.t3 (f1 int) engine=InnoDB; +connection slave; +# +# Checking SHOW ALL SLAVES STATUS +# +Connection_name = '' +Connection_name = 'master1' +Master_Port = 'MYPORT_2' +Master_Port = 'MYPORT_1' +Relay_Log_File = 'mysqld-relay-bin.000002' +Relay_Log_File = 'mysqld-relay-bin-master1.000004' +Slave_IO_Running = 'Yes' +Slave_IO_Running = 'Yes' +Slave_SQL_Running = 'Yes' +Slave_SQL_Running = 'Yes' +Last_Errno = '0' +Last_Errno = '0' +Last_SQL_Errno = '0' +Last_SQL_Errno = '0' +Slave_heartbeat_period = '60.000' +Slave_heartbeat_period = '60.000' +# +select * from db1.t1; +i f1 +1 one +2 two +3 three +4 four +include/show_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +mysqld-relay-bin.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +mysqld-relay-bin.000001 # Rotate # # mysqld-relay-bin.000002;pos=4 +include/show_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +mysqld-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +mysqld-relay-bin.000002 # Rotate # # master-bin.000001;pos=POS +mysqld-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +mysqld-relay-bin.000002 # Gtid_list # # [] +mysqld-relay-bin.000002 # Binlog_checkpoint # # master-bin.000001 +mysqld-relay-bin.000002 # Gtid # # GTID #-#-# +mysqld-relay-bin.000002 # Query # # drop database if exists db2 +mysqld-relay-bin.000002 # Gtid # # GTID #-#-# +mysqld-relay-bin.000002 # Query # # create database db2 +mysqld-relay-bin.000002 # Gtid # # GTID #-#-# +mysqld-relay-bin.000002 # Query # # use `db2`; create table t1 (pk int auto_increment primary key, f1 int) engine=InnoDB +mysqld-relay-bin.000002 # Gtid # # BEGIN GTID #-#-# +mysqld-relay-bin.000002 # Intvar # # INSERT_ID=1 +mysqld-relay-bin.000002 # Query # # use `db2`; insert into t1 (f1) values (1),(2) +mysqld-relay-bin.000002 # Xid # # COMMIT /* XID */ +disconnect slave; +connect slave,127.0.0.1,root,,,$SERVER_MYPORT_3; +stop slave io_thread; +show status like 'Slave_running'; +Variable_name Value +Slave_running OFF +set default_master_connection = 'master1'; +show status like 'Slave_running'; +Variable_name Value +Slave_running ON +drop database db1; +drop database db2; +include/reset_master_slave.inc +disconnect slave; +connection master1; +drop database db1; +include/reset_master_slave.inc +disconnect master1; +connection master2; +drop database db2; +include/reset_master_slave.inc +disconnect master2; diff --git a/mysql-test/suite/binlog_encryption/multisource.test b/mysql-test/suite/binlog_encryption/multisource.test new file mode 100644 index 00000000000..fc58fe81803 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/multisource.test @@ -0,0 +1 @@ +--source extra/rpl_tests/multisource.inc diff --git a/mysql-test/suite/binlog_encryption/my.cnf b/mysql-test/suite/binlog_encryption/my.cnf new file mode 100644 index 00000000000..d787ebe1d4c --- /dev/null +++ b/mysql-test/suite/binlog_encryption/my.cnf @@ -0,0 +1,27 @@ +!include include/default_mysqld.cnf +!include include/default_client.cnf + +[mysqld.1] +innodb +plugin-load-add= @ENV.FILE_KEY_MANAGEMENT_SO +loose-file-key-management-filename= @ENV.MYSQLTEST_VARDIR/std_data/keys.txt +encrypt-binlog +log-basename= master + +[mysqld.2] +#!use-slave-opt +innodb +log-slave-updates +log-basename= slave + +[ENV] + +# We will adopt tests with master-slave setup as well as rpl_init setup, +# so need both sets of variables +MASTER_MYPORT= @mysqld.1.port +SERVER_MYPORT_1= @mysqld.1.port +SERVER_MYSOCK_1= @mysqld.1.socket + +SLAVE_MYPORT= @mysqld.2.port +SERVER_MYPORT_2= @mysqld.2.port +SERVER_MYSOCK_2= @mysqld.2.socket diff --git a/mysql-test/suite/binlog_encryption/mysqlbinlog.result b/mysql-test/suite/binlog_encryption/mysqlbinlog.result new file mode 100644 index 00000000000..71758f7d6e7 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/mysqlbinlog.result @@ -0,0 +1,6 @@ +RESET MASTER; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +REPLACE INTO t1 VALUES (4); +DROP TABLE t1; +FLUSH LOGS; diff --git a/mysql-test/suite/binlog_encryption/mysqlbinlog.test b/mysql-test/suite/binlog_encryption/mysqlbinlog.test new file mode 100644 index 00000000000..b80388aaa45 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/mysqlbinlog.test @@ -0,0 +1,21 @@ +source include/have_log_bin.inc; +source include/have_debug.inc; + +let datadir=`select @@datadir`; +RESET MASTER; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +REPLACE INTO t1 VALUES (4); +DROP TABLE t1; +FLUSH LOGS; + +let filename= master-bin.000001; +let local=$datadir/$filename; +let remote=--read-from-remote-server --protocol=tcp --host=127.0.0.1 --port=$MASTER_MYPORT -uroot $filename; +let outfile=$MYSQLTEST_VARDIR/tmp/binlog_enc.sql; +--error 1 +exec $MYSQL_BINLOG $local > $outfile; +exec $MYSQL_BINLOG $local --force-read >> $outfile; +exec $MYSQL_BINLOG $remote >> $outfile; +remove_file $outfile; + diff --git a/mysql-test/suite/binlog_encryption/restart_server.inc b/mysql-test/suite/binlog_encryption/restart_server.inc new file mode 100644 index 00000000000..6cd0788cf43 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/restart_server.inc @@ -0,0 +1,35 @@ +# +# We can not use the common include/restart_mysqld.inc or include/rpl_restart_server.inc, +# because they have hardcoded connection names (master, master1) +# which are not initiated by rpl_init.inc. +# This is the relevant and simplified part of the same set of scripts. +# +# ==== Usage ==== +# +# --let $rpl_server_number= N +# Number to identify the server that needs to reconnect. +# 1 is the master server, 2 the slave server +# [--let $rpl_server_parameters= --flag1 --flag2 ...] +# --source restart_server.inc +# + +--let $_cur_con= $CURRENT_CONNECTION + +--connection default +--enable_reconnect + +--connection $_cur_con +--enable_reconnect +--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect + +shutdown_server 10; + +--source include/wait_until_disconnected.inc + +--let $_rpl_start_server_command= restart +if ($rpl_server_parameters) +{ + --let $_rpl_start_server_command= restart:$rpl_server_parameters +} +--exec echo "$_rpl_start_server_command" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect +--source include/wait_until_connected_again.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_binlog_errors.cnf b/mysql-test/suite/binlog_encryption/rpl_binlog_errors.cnf new file mode 100644 index 00000000000..2d3db66ebb5 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_binlog_errors.cnf @@ -0,0 +1,7 @@ +!include my.cnf + +[mysqld.1] +max_binlog_size=4096 + +[mysqld.2] +skip-slave-start diff --git a/mysql-test/suite/binlog_encryption/rpl_binlog_errors.result b/mysql-test/suite/binlog_encryption/rpl_binlog_errors.result new file mode 100644 index 00000000000..a54b84227e5 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_binlog_errors.result @@ -0,0 +1,280 @@ +include/master-slave.inc +[connection master] +####################################################################### +####################### PART 1: MASTER TESTS ########################## +####################################################################### +connection slave; +include/stop_slave.inc +connection master; +call mtr.add_suppression("Can't generate a unique log-filename"); +call mtr.add_suppression("Writing one row to the row-based binary log failed.*"); +call mtr.add_suppression("Error writing file .*"); +SET @old_debug= @@global.debug; +SELECT repeat('x',8192) INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data'; +SELECT repeat('x',10) INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug_46166-2.data'; +RESET MASTER; +###################### TEST #1 +FLUSH LOGS; +# assert: must show two binlogs +show binary logs; +Log_name File_size +master-bin.000001 # +master-bin.000002 # +###################### TEST #2 +RESET MASTER; +SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +FLUSH LOGS; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +# assert: must show one binlog +show binary logs; +Log_name File_size +master-bin.000001 # +SET GLOBAL debug_dbug=@old_debug; +RESET MASTER; +###################### TEST #3 +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a VARCHAR(16384)) Engine=InnoDB; +CREATE TABLE t4 (a VARCHAR(16384)); +INSERT INTO t1 VALUES (1); +RESET MASTER; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; +# assert: must show two binlog +show binary logs; +Log_name File_size +master-bin.000001 # +master-bin.000002 # +SET GLOBAL debug_dbug=@old_debug; +DELETE FROM t2; +RESET MASTER; +###################### TEST #4 +SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +# assert: must show one entry +SELECT count(*) FROM t2; +count(*) +1 +SET GLOBAL debug_dbug=@old_debug; +DELETE FROM t2; +RESET MASTER; +###################### TEST #5 +SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166-2.data' INTO TABLE t2; +# assert: must show one entry +SELECT count(*) FROM t2; +count(*) +1 +SET GLOBAL debug_dbug=@old_debug; +DELETE FROM t2; +RESET MASTER; +###################### TEST #6 +SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET AUTOCOMMIT=0; +INSERT INTO t2 VALUES ('muse'); +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; +INSERT INTO t2 VALUES ('muse'); +COMMIT; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +# assert: must show three entries +SELECT count(*) FROM t2; +count(*) +3 +SET AUTOCOMMIT= 1; +SET GLOBAL debug_dbug=@old_debug; +DELETE FROM t2; +RESET MASTER; +###################### TEST #7 +SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SELECT count(*) FROM t4; +count(*) +0 +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t4; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +# assert: must show 1 entry +SELECT count(*) FROM t4; +count(*) +1 +### check that the incident event is written to the current log +SET GLOBAL debug_dbug=@old_debug; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Incident # # #1 (LOST_EVENTS) +DELETE FROM t4; +RESET MASTER; +###################### TEST #8 +SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +# must show 0 entries +SELECT count(*) FROM t4; +count(*) +0 +SELECT count(*) FROM t2; +count(*) +0 +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t4; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'); +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +# INFO: Count(*) Before Offending DELETEs +# assert: must show 1 entry +SELECT count(*) FROM t4; +count(*) +1 +# assert: must show 4 entries +SELECT count(*) FROM t2; +count(*) +4 +DELETE FROM t4; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +DELETE FROM t2; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +# INFO: Count(*) After Offending DELETEs +# assert: must show zero entries +SELECT count(*) FROM t4; +count(*) +0 +SELECT count(*) FROM t2; +count(*) +0 +SET GLOBAL debug_dbug=@old_debug; +###################### TEST #9 +SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET SQL_LOG_BIN=0; +INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd'); +INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh'); +# assert: must show four entries +SELECT count(*) FROM t2; +count(*) +4 +SELECT count(*) FROM t4; +count(*) +4 +DELETE FROM t2; +DELETE FROM t4; +# assert: must show zero entries +SELECT count(*) FROM t2; +count(*) +0 +SELECT count(*) FROM t4; +count(*) +0 +SET SQL_LOG_BIN=1; +SET GLOBAL debug_dbug=@old_debug; +###################### TEST #10 +call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file."); +call mtr.add_suppression("Could not open .*"); +RESET MASTER; +SHOW WARNINGS; +Level Code Message +SET GLOBAL debug_dbug="+d,fault_injection_registering_index"; +FLUSH LOGS; +ERROR HY000: Can't open file: 'master-bin.000002' (errno: 1 "Operation not permitted") +SET GLOBAL debug_dbug="-d,fault_injection_registering_index"; +SHOW BINARY LOGS; +ERROR HY000: You are not using binary logging +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; +###################### TEST #11 +include/rpl_restart_server.inc [server_number=1] +SET GLOBAL debug_dbug="+d,fault_injection_openning_index"; +FLUSH LOGS; +ERROR HY000: Can't open file: 'master-bin.index' (errno: 1 "Operation not permitted") +SET GLOBAL debug_dbug="-d,fault_injection_openning_index"; +RESET MASTER; +ERROR HY000: Binlog closed, cannot RESET MASTER +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; +include/rpl_restart_server.inc [server_number=1] +###################### TEST #12 +SET GLOBAL debug_dbug="+d,fault_injection_new_file_rotate_event"; +FLUSH LOGS; +ERROR HY000: Can't open file: 'master-bin' (errno: 2 "No such file or directory") +SET GLOBAL debug_dbug="-d,fault_injection_new_file_rotate_event"; +RESET MASTER; +ERROR HY000: Binlog closed, cannot RESET MASTER +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; +include/rpl_restart_server.inc [server_number=1] +DROP TABLE t1, t2, t4; +RESET MASTER; +connection slave; +include/start_slave.inc +connection master; +####################################################################### +####################### PART 2: SLAVE TESTS ########################### +####################################################################### +include/rpl_reset.inc +connection slave; +call mtr.add_suppression("Slave I/O: Relay log write failure: could not queue event from master.*"); +call mtr.add_suppression("Error writing file .*"); +call mtr.add_suppression("Could not open .*"); +call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file."); +call mtr.add_suppression("Can't generate a unique log-filename .*"); +###################### TEST #13 +SET @old_debug=@@global.debug; +include/stop_slave.inc +SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +START SLAVE io_thread; +include/wait_for_slave_io_error.inc [errno=1595] +Last_IO_Error = 'Relay log write failure: could not queue event from master' +SET GLOBAL debug_dbug="-d,error_unique_log_filename"; +SET GLOBAL debug_dbug=@old_debug; +include/rpl_restart_server.inc [server_number=2] +###################### TEST #14 +SET @old_debug=@@global.debug; +include/stop_slave.inc +SET GLOBAL debug_dbug="+d,fault_injection_new_file_rotate_event"; +START SLAVE io_thread; +include/wait_for_slave_io_error.inc [errno=1595] +Last_IO_Error = 'Relay log write failure: could not queue event from master' +SET GLOBAL debug_dbug="-d,fault_injection_new_file_rotate_event"; +SET GLOBAL debug_dbug=@old_debug; +include/rpl_restart_server.inc [server_number=2] +###################### TEST #15 +SET @old_debug=@@global.debug; +include/stop_slave.inc +SET GLOBAL debug_dbug="+d,fault_injection_registering_index"; +START SLAVE io_thread; +include/wait_for_slave_io_error.inc [errno=1595] +Last_IO_Error = 'Relay log write failure: could not queue event from master' +SET GLOBAL debug_dbug="-d,fault_injection_registering_index"; +SET GLOBAL debug_dbug=@old_debug; +include/rpl_restart_server.inc [server_number=2] +###################### TEST #16 +SET @old_debug=@@global.debug; +include/stop_slave.inc +SET GLOBAL debug_dbug="+d,fault_injection_openning_index"; +START SLAVE io_thread; +include/wait_for_slave_io_error.inc [errno=1595] +Last_IO_Error = 'Relay log write failure: could not queue event from master' +SET GLOBAL debug_dbug="-d,fault_injection_openning_index"; +SET GLOBAL debug_dbug=@old_debug; +include/rpl_restart_server.inc [server_number=2] +include/stop_slave_sql.inc +Warnings: +Note 1255 Slave already has been stopped +RESET SLAVE; +RESET MASTER; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_binlog_errors.test b/mysql-test/suite/binlog_encryption/rpl_binlog_errors.test new file mode 100644 index 00000000000..a4611f515c4 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_binlog_errors.test @@ -0,0 +1,2 @@ +--let $binlog_limit= 5,1 +--source extra/rpl_tests/rpl_binlog_errors.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_cant_read_event_incident.result b/mysql-test/suite/binlog_encryption/rpl_cant_read_event_incident.result new file mode 100644 index 00000000000..5aff978538f --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_cant_read_event_incident.result @@ -0,0 +1,26 @@ +include/master-slave.inc +[connection master] +connection slave; +include/stop_slave.inc +connection master; +call mtr.add_suppression("Error in Log_event::read_log_event()"); +include/rpl_stop_server.inc [server_number=1] +include/rpl_start_server.inc [server_number=1] +show binlog events; +ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error +connection slave; +call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log"); +reset slave; +start slave; +include/wait_for_slave_param.inc [Last_IO_Errno] +Last_IO_Errno = '1236' +Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'binlog truncated in the middle of event; consider out of disk space on master; the first event '.' at XXX, the last event read from 'master-bin.000001' at XXX, the last byte read from 'master-bin.000001' at XXX.'' +connection master; +reset master; +connection slave; +stop slave; +reset slave; +drop table if exists t; +reset master; +End of the tests +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_cant_read_event_incident.test b/mysql-test/suite/binlog_encryption/rpl_cant_read_event_incident.test new file mode 100644 index 00000000000..6d222cba115 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_cant_read_event_incident.test @@ -0,0 +1 @@ +--source extra/rpl_tests/rpl_cant_read_event_incident.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_checksum.cnf b/mysql-test/suite/binlog_encryption/rpl_checksum.cnf new file mode 100644 index 00000000000..9d7ada8c656 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_checksum.cnf @@ -0,0 +1,10 @@ +!include my.cnf + +[mysqld.1] +binlog-checksum=CRC32 + +[mysqld.2] +binlog-checksum=CRC32 +plugin-load-add= @ENV.FILE_KEY_MANAGEMENT_SO +loose-file-key-management-filename=@ENV.MYSQLTEST_VARDIR/std_data/keys.txt +encrypt-binlog diff --git a/mysql-test/suite/binlog_encryption/rpl_checksum.result b/mysql-test/suite/binlog_encryption/rpl_checksum.result new file mode 100644 index 00000000000..418536c3558 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_checksum.result @@ -0,0 +1,196 @@ +include/master-slave.inc +[connection master] +call mtr.add_suppression('Slave can not handle replication events with the checksum that master is configured to log'); +call mtr.add_suppression('Replication event checksum verification failed'); +call mtr.add_suppression('Relay log write failure: could not queue event from master'); +call mtr.add_suppression('Master is configured to log replication events with checksum, but will not send such events to slaves that cannot process them'); +connection master; +set @master_save_binlog_checksum= @@global.binlog_checksum; +set @save_master_verify_checksum = @@global.master_verify_checksum; +select @@global.binlog_checksum as 'must be CRC32 because of the command line option'; +must be CRC32 because of the command line option +CRC32 +select @@session.binlog_checksum as 'no session var'; +ERROR HY000: Variable 'binlog_checksum' is a GLOBAL variable +select @@global.master_verify_checksum as 'must be zero because of default'; +must be zero because of default +0 +select @@session.master_verify_checksum as 'no session var'; +ERROR HY000: Variable 'master_verify_checksum' is a GLOBAL variable +connection slave; +set @slave_save_binlog_checksum= @@global.binlog_checksum; +set @save_slave_sql_verify_checksum = @@global.slave_sql_verify_checksum; +select @@global.slave_sql_verify_checksum as 'must be one because of default'; +must be one because of default +1 +select @@session.slave_sql_verify_checksum as 'no session var'; +ERROR HY000: Variable 'slave_sql_verify_checksum' is a GLOBAL variable +connection master; +show binary logs; +Log_name File_size +master-bin.000001 # +set @@global.binlog_checksum = NONE; +select @@global.binlog_checksum; +@@global.binlog_checksum +NONE +*** must be rotations seen *** +show binary logs; +Log_name File_size +master-bin.000001 # +master-bin.000002 # +set @@global.binlog_checksum = default; +select @@global.binlog_checksum; +@@global.binlog_checksum +CRC32 +set @@global.binlog_checksum = CRC32; +select @@global.binlog_checksum; +@@global.binlog_checksum +CRC32 +set @@global.binlog_checksum = CRC32; +set @@global.master_verify_checksum = 0; +set @@global.master_verify_checksum = default; +set @@global.binlog_checksum = ADLER32; +ERROR 42000: Variable 'binlog_checksum' can't be set to the value of 'ADLER32' +set @@global.master_verify_checksum = 2; +ERROR 42000: Variable 'master_verify_checksum' can't be set to the value of '2' +connection slave; +set @@global.slave_sql_verify_checksum = 0; +set @@global.slave_sql_verify_checksum = default; +set @@global.slave_sql_verify_checksum = 2; +ERROR 42000: Variable 'slave_sql_verify_checksum' can't be set to the value of '2' +connection master; +set @@global.binlog_checksum = NONE; +create table t1 (a int); +flush logs; +flush logs; +flush logs; +connection slave; +flush logs; +flush logs; +flush logs; +select count(*) as zero from t1; +zero +0 +include/stop_slave.inc +connection master; +set @@global.binlog_checksum = CRC32; +insert into t1 values (1) /* will not be applied on slave due to simulation */; +connection slave; +set @@global.debug_dbug='d,simulate_slave_unaware_checksum'; +start slave; +include/wait_for_slave_io_error.inc [errno=1236] +Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log; the first event 'master-bin.000009' at 411, the last event read from 'master-bin.000010' at 4, the last byte read from 'master-bin.000010' at 256.'' +select count(*) as zero from t1; +zero +0 +set @@global.debug_dbug=''; +connection slave; +include/start_slave.inc +connection master; +set @@global.master_verify_checksum = 1; +set @@session.debug_dbug='d,simulate_checksum_test_failure'; +show binlog events; +ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error +set @@session.debug_dbug=''; +set @@global.master_verify_checksum = default; +connection slave; +connection slave; +include/stop_slave.inc +connection master; +create table t2 (a int); +connection slave; +set @@global.debug_dbug='d,simulate_checksum_test_failure'; +start slave io_thread; +include/wait_for_slave_io_error.inc [errno=1595,1913] +set @@global.debug_dbug=''; +start slave io_thread; +include/wait_for_slave_param.inc [Read_Master_Log_Pos] +set @@global.slave_sql_verify_checksum = 1; +set @@global.debug_dbug='d,simulate_checksum_test_failure'; +start slave sql_thread; +include/wait_for_slave_sql_error.inc [errno=1593] +Last_SQL_Error = 'Error initializing relay log position: I/O error reading event at position 4' +set @@global.debug_dbug=''; +include/start_slave.inc +connection master; +connection slave; +select count(*) as 'must be zero' from t2; +must be zero +0 +connection slave; +stop slave; +reset slave; +set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE"); +flush logs; +connection master; +set @@global.binlog_checksum= CRC32; +reset master; +flush logs; +create table t3 (a int, b char(5)); +connection slave; +include/start_slave.inc +connection master; +connection slave; +select count(*) as 'must be zero' from t3; +must be zero +0 +include/stop_slave.inc +change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root'; +connection master; +flush logs; +reset master; +insert into t3 value (1, @@global.binlog_checksum); +connection slave; +include/start_slave.inc +flush logs; +connection master; +connection slave; +select count(*) as 'must be one' from t3; +must be one +1 +connection master; +set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE"); +insert into t3 value (1, @@global.binlog_checksum); +connection slave; +connection master; +drop table t1, t2, t3; +set @@global.binlog_checksum = @master_save_binlog_checksum; +set @@global.master_verify_checksum = @save_master_verify_checksum; +connection slave; +*** Bug#59123 / MDEV-5799: INCIDENT_EVENT checksum written to error log as garbage characters *** +connection master; +CREATE TABLE t4 (a INT PRIMARY KEY); +INSERT INTO t4 VALUES (1); +SET sql_log_bin=0; +CALL mtr.add_suppression("\\[ERROR\\] Can't generate a unique log-filename"); +SET sql_log_bin=1; +SET @old_dbug= @@GLOBAL.debug_dbug; +SET debug_dbug= '+d,binlog_inject_new_name_error'; +FLUSH LOGS; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +SET debug_dbug= @old_dbug; +INSERT INTO t4 VALUES (2); +connection slave; +include/wait_for_slave_sql_error.inc [errno=1590] +Last_SQL_Error = 'The incident LOST_EVENTS occurred on the master. Message: error writing to the binary log' +FOUND /Slave SQL: The incident LOST_EVENTS occurred on the master\. Message: error writing to the binary log, Internal MariaDB error code: 1590/ in mysqld.2.err +SELECT * FROM t4 ORDER BY a; +a +1 +STOP SLAVE IO_THREAD; +SET sql_slave_skip_counter= 1; +include/start_slave.inc +connection master; +connection slave; +SELECT * FROM t4 ORDER BY a; +a +1 +2 +connection slave; +set @@global.binlog_checksum = @slave_save_binlog_checksum; +set @@global.slave_sql_verify_checksum = @save_slave_sql_verify_checksum; +End of tests +connection master; +DROP TABLE t4; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_checksum.test b/mysql-test/suite/binlog_encryption/rpl_checksum.test new file mode 100644 index 00000000000..8e006b1b6a0 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_checksum.test @@ -0,0 +1 @@ +--source extra/rpl_tests/rpl_checksum.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_checksum_cache.result b/mysql-test/suite/binlog_encryption/rpl_checksum_cache.result new file mode 100644 index 00000000000..9508e94e7f2 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_checksum_cache.result @@ -0,0 +1,119 @@ +include/master-slave.inc +[connection master] +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. Statement: insert into t2 set data=repeat.*'a', @act_size.*"); +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. Statement: insert into t1 values.* NAME_CONST.*'n',.*, @data .*"); +set @save_binlog_cache_size = @@global.binlog_cache_size; +set @save_binlog_checksum = @@global.binlog_checksum; +set @save_master_verify_checksum = @@global.master_verify_checksum; +set @@global.binlog_cache_size = 4096; +set @@global.binlog_checksum = CRC32; +set @@global.master_verify_checksum = 1; +include/stop_slave.inc +include/start_slave.inc +flush status; +show status like "binlog_cache_use"; +Variable_name Value +Binlog_cache_use 0 +show status like "binlog_cache_disk_use"; +Variable_name Value +Binlog_cache_disk_use 0 +drop table if exists t1; +create table t1 (a int PRIMARY KEY, b CHAR(32)) engine=innodb; +create procedure test.p_init (n int, size int) +begin +while n > 0 do +select round(RAND() * size) into @act_size; +set @data = repeat('a', @act_size); +insert into t1 values(n, @data ); +set n= n-1; +end while; +end| +begin; +call test.p_init(4000, 32); +commit; +show status like "binlog_cache_use"; +Variable_name Value +Binlog_cache_use 1 +*** binlog_cache_disk_use must be non-zero *** +show status like "binlog_cache_disk_use"; +Variable_name Value +Binlog_cache_disk_use 1 +include/diff_tables.inc [master:test.t1, slave:test.t1] +begin; +delete from t1; +commit; +flush status; +create table t2(a int auto_increment primary key, data VARCHAR(12288)) ENGINE=Innodb; +show status like "binlog_cache_use"; +Variable_name Value +Binlog_cache_use 1 +*** binlog_cache_disk_use must be non-zero *** +show status like "binlog_cache_disk_use"; +Variable_name Value +Binlog_cache_disk_use 1 +include/diff_tables.inc [master:test.t2, slave:test.t2] +begin; +delete from t2; +commit; +flush status; +create table t3(a int auto_increment primary key, data VARCHAR(8192)) engine=innodb; +show status like "binlog_cache_use"; +Variable_name Value +Binlog_cache_use 1 +*** binlog_cache_disk_use must be non-zero *** +show status like "binlog_cache_disk_use"; +Variable_name Value +Binlog_cache_disk_use 1 +include/diff_tables.inc [master:test.t3, slave:test.t3] +begin; +delete from t3; +commit; +flush status; +create procedure test.p1 (n int) +begin +while n > 0 do +case (select (round(rand()*100) % 3) + 1) +when 1 then +select round(RAND() * 32) into @act_size; +set @data = repeat('a', @act_size); +insert into t1 values(n, @data); +when 2 then +begin +select round(8192 + RAND() * 4096) into @act_size; +insert into t2 set data=repeat('a', @act_size); +end; +when 3 then +begin +select round(3686.4000 + RAND() * 819.2000) into @act_size; +insert into t3 set data= repeat('a', @act_size); +end; +end case; +set n= n-1; +end while; +end| +set autocommit= 0; +begin; +call test.p1(1000); +commit; +show status like "binlog_cache_use"; +Variable_name Value +Binlog_cache_use 1 +*** binlog_cache_disk_use must be non-zero *** +show status like "binlog_cache_disk_use"; +Variable_name Value +Binlog_cache_disk_use 1 +include/diff_tables.inc [master:test.t1, slave:test.t1] +include/diff_tables.inc [master:test.t2, slave:test.t2] +include/diff_tables.inc [master:test.t3, slave:test.t3] +begin; +delete from t1; +delete from t2; +delete from t3; +commit; +drop table t1, t2, t3; +set @@global.binlog_cache_size = @save_binlog_cache_size; +set @@global.binlog_checksum = @save_binlog_checksum; +set @@global.master_verify_checksum = @save_master_verify_checksum; +drop procedure test.p_init; +drop procedure test.p1; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_checksum_cache.test b/mysql-test/suite/binlog_encryption/rpl_checksum_cache.test new file mode 100644 index 00000000000..56c3e1e1cb5 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_checksum_cache.test @@ -0,0 +1 @@ +--source extra/rpl_tests/rpl_checksum_cache.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_corruption.cnf b/mysql-test/suite/binlog_encryption/rpl_corruption.cnf new file mode 100644 index 00000000000..7f7d0eeb8ea --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_corruption.cnf @@ -0,0 +1,9 @@ +!include my.cnf + +[mysqld.1] +binlog-checksum=CRC32 +master-verify-checksum=1 + +[mysqld.2] +binlog-checksum=CRC32 +slave-sql-verify-checksum=1 diff --git a/mysql-test/suite/binlog_encryption/rpl_corruption.result b/mysql-test/suite/binlog_encryption/rpl_corruption.result new file mode 100644 index 00000000000..14a67b3a3a5 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_corruption.result @@ -0,0 +1,63 @@ +include/master-slave.inc +[connection master] +call mtr.add_suppression('Found invalid event in binary log'); +call mtr.add_suppression('Slave I/O: Relay log write failure: could not queue event from master'); +call mtr.add_suppression('event read from binlog did not pass crc check'); +call mtr.add_suppression('Replication event checksum verification failed'); +call mtr.add_suppression('Event crc check failed! Most likely there is event corruption'); +call mtr.add_suppression('Slave SQL: Error initializing relay log position: I/O error reading event at position .*, error.* 1593'); +SET @old_master_verify_checksum = @@master_verify_checksum; +# 1. Creating test table/data and set corruption position for testing +connection master; +* insert/update/delete rows in table t1 * +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c VARCHAR(100)); +include/stop_slave.inc +# 2. Corruption in master binlog and SHOW BINLOG EVENTS +SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char"; +SHOW BINLOG EVENTS; +ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error +SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char"; +# 3. Master read a corrupted event from binlog and send the error to slave +SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set"; +connection slave; +START SLAVE IO_THREAD; +include/wait_for_slave_io_error.inc [errno=1236] +connection master; +SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; +# 4. Master read a corrupted event from binlog and send it to slave +connection master; +SET GLOBAL master_verify_checksum=0; +SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set"; +connection slave; +START SLAVE IO_THREAD; +include/wait_for_slave_io_error.inc [errno=1595,1913] +connection master; +SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; +SET GLOBAL debug_dbug= ""; +SET GLOBAL master_verify_checksum=1; +# 5. Slave. Corruption in network +connection slave; +SET GLOBAL debug_dbug="+d,corrupt_queue_event"; +START SLAVE IO_THREAD; +include/wait_for_slave_io_error.inc [errno=1595,1913] +SET GLOBAL debug_dbug="-d,corrupt_queue_event"; +# 6. Slave. Corruption in relay log +SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char"; +START SLAVE SQL_THREAD; +include/wait_for_slave_sql_error.inc [errno=1593] +SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char"; +SET GLOBAL debug_dbug= ""; +# 7. Seek diff for tables on master and slave +connection slave; +include/start_slave.inc +connection master; +connection slave; +include/diff_tables.inc [master:test.t1, slave:test.t1] +# 8. Clean up +connection master; +SET GLOBAL debug_dbug= ""; +SET GLOBAL master_verify_checksum = @old_master_verify_checksum; +DROP TABLE t1; +connection slave; +SET GLOBAL debug_dbug= ""; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_corruption.test b/mysql-test/suite/binlog_encryption/rpl_corruption.test new file mode 100644 index 00000000000..310b0cef8e8 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_corruption.test @@ -0,0 +1 @@ +--source extra/rpl_tests/rpl_corruption.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_gtid_basic.cnf b/mysql-test/suite/binlog_encryption/rpl_gtid_basic.cnf new file mode 100644 index 00000000000..ae47ef7a1fc --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_gtid_basic.cnf @@ -0,0 +1,24 @@ +!include my.cnf + +[mysqld.1] +log-slave-updates + +[mysqld.2] +init-rpl-role= slave +master-retry-count= 10 +skip-slave-start + +[mysqld.3] +log-slave-updates +innodb + +[mysqld.4] +log-slave-updates +innodb + +[ENV] +SERVER_MYPORT_3= @mysqld.3.port +SERVER_MYSOCK_3= @mysqld.3.socket + +SERVER_MYPORT_4= @mysqld.4.port +SERVER_MYSOCK_4= @mysqld.4.socket diff --git a/mysql-test/suite/binlog_encryption/rpl_gtid_basic.result b/mysql-test/suite/binlog_encryption/rpl_gtid_basic.result new file mode 100644 index 00000000000..dd946ec3107 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_gtid_basic.result @@ -0,0 +1,558 @@ +include/rpl_init.inc [topology=1->2->3->4] +connection server_1; +*** GTID position should be empty here *** +SELECT BINLOG_GTID_POS('',); +BINLOG_GTID_POS('',) + +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM; +CREATE TABLE t2 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, "m1"); +INSERT INTO t1 VALUES (2, "m2"), (3, "m3"), (4, "m4"); +INSERT INTO t2 VALUES (1, "i1"); +BEGIN; +INSERT INTO t2 VALUES (2, "i2"), (3, "i3"); +INSERT INTO t2 VALUES (4, "i4"); +COMMIT; +*** GTID position should be non-empty here *** +SELECT BINLOG_GTID_POS('',); +BINLOG_GTID_POS('',) + +connection server_2; +*** GTID position should be the same as on server_1 *** +SELECT BINLOG_GTID_POS('',); +BINLOG_GTID_POS('',) + +SELECT * FROM t1 ORDER BY a; +a b +1 m1 +2 m2 +3 m3 +4 m4 +SELECT * FROM t2 ORDER BY a; +a b +1 i1 +2 i2 +3 i3 +4 i4 +connection server_3; +SELECT * FROM t1 ORDER BY a; +a b +1 m1 +2 m2 +3 m3 +4 m4 +SELECT * FROM t2 ORDER BY a; +a b +1 i1 +2 i2 +3 i3 +4 i4 +connection server_4; +SELECT * FROM t1 ORDER BY a; +a b +1 m1 +2 m2 +3 m3 +4 m4 +SELECT * FROM t2 ORDER BY a; +a b +1 i1 +2 i2 +3 i3 +4 i4 +*** Now take out D, let it fall behind a bit, and then test re-attaching it to A *** +connection server_4; +include/stop_slave.inc +connection server_1; +INSERT INTO t1 VALUES (5, "m1a"); +INSERT INTO t2 VALUES (5, "i1a"); +connection server_4; +CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT, +MASTER_USE_GTID=CURRENT_POS; +include/start_slave.inc +SELECT * FROM t1 ORDER BY a; +a b +1 m1 +2 m2 +3 m3 +4 m4 +5 m1a +SELECT * FROM t2 ORDER BY a; +a b +1 i1 +2 i2 +3 i3 +4 i4 +5 i1a +*** Now move B to D (C is still replicating from B) *** +connection server_2; +include/stop_slave.inc +CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_4, +MASTER_USE_GTID=CURRENT_POS; +include/start_slave.inc +connection server_4; +UPDATE t2 SET b="j1a" WHERE a=5; +connection server_2; +SELECT * FROM t1 ORDER BY a; +a b +1 m1 +2 m2 +3 m3 +4 m4 +5 m1a +SELECT * FROM t2 ORDER BY a; +a b +1 i1 +2 i2 +3 i3 +4 i4 +5 j1a +*** Now move C to D, after letting it fall a little behind *** +connection server_3; +include/stop_slave.inc +connection server_1; +INSERT INTO t2 VALUES (6, "i6b"); +INSERT INTO t2 VALUES (7, "i7b"); +include/save_master_gtid.inc +connection server_3; +CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_4, +MASTER_USE_GTID=CURRENT_POS; +include/start_slave.inc +include/sync_with_master_gtid.inc +SELECT * FROM t2 ORDER BY a; +a b +1 i1 +2 i2 +3 i3 +4 i4 +5 j1a +6 i6b +7 i7b +*** Now change everything back to what it was, to make rpl_end.inc happy +connection server_2; +include/sync_with_master_gtid.inc +include/stop_slave.inc +CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_MYPORT; +include/start_slave.inc +include/wait_for_slave_to_start.inc +connection server_3; +include/stop_slave.inc +CHANGE MASTER TO master_host = '127.0.0.1', master_port = SLAVE_MYPORT; +include/start_slave.inc +include/sync_with_master_gtid.inc +connection server_4; +include/stop_slave.inc +CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_3; +include/start_slave.inc +connection server_1; +DROP TABLE t1,t2; +include/save_master_gtid.inc +*** A few more checks for BINLOG_GTID_POS function *** +SELECT BINLOG_GTID_POS(); +ERROR 42000: Incorrect parameter count in the call to native function 'BINLOG_GTID_POS' +SELECT BINLOG_GTID_POS('a'); +ERROR 42000: Incorrect parameter count in the call to native function 'BINLOG_GTID_POS' +SELECT BINLOG_GTID_POS('a',1,NULL); +ERROR 42000: Incorrect parameter count in the call to native function 'BINLOG_GTID_POS' +SELECT BINLOG_GTID_POS(1,'a'); +BINLOG_GTID_POS(1,'a') +NULL +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'a' +SELECT BINLOG_GTID_POS(NULL,NULL); +BINLOG_GTID_POS(NULL,NULL) +NULL +SELECT BINLOG_GTID_POS('',1); +BINLOG_GTID_POS('',1) + +SELECT BINLOG_GTID_POS('a',1); +BINLOG_GTID_POS('a',1) +NULL +SELECT BINLOG_GTID_POS('master-bin.000001',-1); +BINLOG_GTID_POS('master-bin.000001',-1) +NULL +SELECT BINLOG_GTID_POS('master-bin.000001',0); +BINLOG_GTID_POS('master-bin.000001',0) + +SELECT BINLOG_GTID_POS('master-bin.000001',18446744073709551615); +BINLOG_GTID_POS('master-bin.000001',18446744073709551615) +NULL +SELECT BINLOG_GTID_POS('master-bin.000001',18446744073709551616); +BINLOG_GTID_POS('master-bin.000001',18446744073709551616) +NULL +Warnings: +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +*** Some tests of @@GLOBAL.gtid_binlog_state *** +connection server_2; +include/sync_with_master_gtid.inc +include/stop_slave.inc +connection server_1; +SET @old_state= @@GLOBAL.gtid_binlog_state; +SET GLOBAL gtid_binlog_state = ''; +ERROR HY000: This operation is not allowed if any GTID has been logged to the binary log. Run RESET MASTER first to erase the log +RESET MASTER; +SET GLOBAL gtid_binlog_state = ''; +FLUSH LOGS; +show binary logs; +Log_name File_size +master-bin.000001 # +master-bin.000002 # +SET GLOBAL gtid_binlog_state = '0-1-10,1-2-20,0-3-30'; +show binary logs; +Log_name File_size +master-bin.000001 # +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +master-bin.000001 # Start_encryption # # +master-bin.000001 # Gtid_list # # [#-#-#] +master-bin.000001 # Binlog_checkpoint # # master-bin.000001 +SET GLOBAL gtid_binlog_state = @old_state; +ERROR HY000: This operation is not allowed if any GTID has been logged to the binary log. Run RESET MASTER first to erase the log +RESET MASTER; +SET GLOBAL gtid_binlog_state = @old_state; +CREATE TABLE t1 (a INT PRIMARY KEY); +SET gtid_seq_no=100; +INSERT INTO t1 VALUES (1); +include/save_master_gtid.inc +connection server_2; +include/start_slave.inc +include/sync_with_master_gtid.inc +SELECT * FROM t1; +a +1 +Gtid_IO_Pos = '0-1-100' +*** Test @@LAST_GTID and MASTER_GTID_WAIT() *** +connection server_1; +DROP TABLE t1; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +connection server_2; +include/stop_slave.inc +connect m1,127.0.0.1,root,,test,$SERVER_MYPORT_1,; +SELECT @@last_gtid; +@@last_gtid + +SET gtid_seq_no=110; +SELECT @@last_gtid; +@@last_gtid + +BEGIN; +SELECT @@last_gtid; +@@last_gtid + +INSERT INTO t1 VALUES (2); +SELECT @@last_gtid; +@@last_gtid + +COMMIT; +SELECT @@last_gtid; +@@last_gtid +0-1-110 +connect s1,127.0.0.1,root,,test,$SERVER_MYPORT_2,; +SET @pos= '0-1-110'; +SELECT master_gtid_wait(NULL); +master_gtid_wait(NULL) +NULL +SELECT master_gtid_wait('', NULL); +master_gtid_wait('', NULL) +0 +SHOW STATUS LIKE 'Master_gtid_wait_count'; +Variable_name Value +Master_gtid_wait_count 1 +SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; +Variable_name Value +Master_gtid_wait_timeouts 0 +SHOW STATUS LIKE 'Master_gtid_wait_time'; +Variable_name Value +Master_gtid_wait_time 0 +SELECT master_gtid_wait(@pos, 0.5); +master_gtid_wait(@pos, 0.5) +-1 +SELECT * FROM t1 ORDER BY a; +a +SELECT master_gtid_wait(@pos); +connection server_2; +include/start_slave.inc +connection s1; +master_gtid_wait(@pos) +0 +SELECT * FROM t1 ORDER BY a; +a +2 +include/stop_slave.inc +connection server_1; +SET gtid_domain_id= 1; +INSERT INTO t1 VALUES (3); +connection s1; +SET @pos= 'POS'; +SELECT master_gtid_wait(@pos, 0); +master_gtid_wait(@pos, 0) +-1 +SELECT * FROM t1 WHERE a >= 3; +a +SELECT master_gtid_wait(@pos, -1); +connection server_2; +include/start_slave.inc +connection s1; +master_gtid_wait(@pos, -1) +0 +SELECT * FROM t1 WHERE a >= 3; +a +3 +SELECT master_gtid_wait('1-1-1', 0); +master_gtid_wait('1-1-1', 0) +0 +connection s1; +SELECT master_gtid_wait('2-1-1,1-1-4,0-1-110'); +connect s2,127.0.0.1,root,,test,$SERVER_MYPORT_2,; +SELECT master_gtid_wait('0-1-1000', 0.5); +connect s3,127.0.0.1,root,,test,$SERVER_MYPORT_2,; +SELECT master_gtid_wait('0-1-2000'); +connect s4,127.0.0.1,root,,test,$SERVER_MYPORT_2,; +SELECT master_gtid_wait('2-1-10'); +connect s5,127.0.0.1,root,,test,$SERVER_MYPORT_2,; +SELECT master_gtid_wait('2-1-6', 1); +connect s6,127.0.0.1,root,,test,$SERVER_MYPORT_2,; +SELECT master_gtid_wait('2-1-5'); +connect s7,127.0.0.1,root,,test,$SERVER_MYPORT_2,; +SELECT master_gtid_wait('2-1-10'); +connect s8,127.0.0.1,root,,test,$SERVER_MYPORT_2,; +SELECT master_gtid_wait('2-1-5,1-1-4,0-1-110'); +connect s9,127.0.0.1,root,,test,$SERVER_MYPORT_2,; +SELECT master_gtid_wait('2-1-2'); +connection server_2; +SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; +Variable_name Value +Master_gtid_wait_timeouts 0 +SHOW STATUS LIKE 'Master_gtid_wait_count'; +Variable_name Value +Master_gtid_wait_count 3 +SELECT master_gtid_wait('1-1-1'); +master_gtid_wait('1-1-1') +0 +SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; +Variable_name Value +Master_gtid_wait_timeouts 0 +SHOW STATUS LIKE 'Master_gtid_wait_count'; +Variable_name Value +Master_gtid_wait_count 4 +SET @a= MASTER_GTID_WAIT_TIME; +SELECT IF(@a <= 100*1000*1000, "OK", CONCAT("Error: wait time ", @a, " is larger than expected")) +AS Master_gtid_wait_time_as_expected; +Master_gtid_wait_time_as_expected +OK +connect s10,127.0.0.1,root,,test,$SERVER_MYPORT_2,; +SELECT master_gtid_wait('0-1-109'); +connection server_2; +SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; +Variable_name Value +Master_gtid_wait_timeouts 0 +SHOW STATUS LIKE 'Master_gtid_wait_count'; +Variable_name Value +Master_gtid_wait_count 4 +SELECT master_gtid_wait('2-1-2', 0.5); +master_gtid_wait('2-1-2', 0.5) +-1 +SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; +Variable_name Value +Master_gtid_wait_timeouts 1 +SHOW STATUS LIKE 'Master_gtid_wait_count'; +Variable_name Value +Master_gtid_wait_count 5 +SET @a= MASTER_GTID_WAIT_TIME; +SELECT IF(@a BETWEEN 0.4*1000*1000 AND 100*1000*1000, "OK", CONCAT("Error: wait time ", @a, " not as expected")) AS Master_gtid_wait_time_as_expected; +Master_gtid_wait_time_as_expected +OK +KILL QUERY KILL_ID; +connection s3; +ERROR 70100: Query execution was interrupted +connection server_1; +SET gtid_domain_id=2; +SET gtid_seq_no=2; +INSERT INTO t1 VALUES (4); +connection s9; +master_gtid_wait('2-1-2') +0 +connection server_2; +KILL CONNECTION KILL_ID; +connection s6; +Got one of the listed errors +connection server_1; +SET gtid_domain_id=1; +SET gtid_seq_no=4; +INSERT INTO t1 VALUES (5); +SET gtid_domain_id=2; +SET gtid_seq_no=5; +INSERT INTO t1 VALUES (6); +connection s8; +master_gtid_wait('2-1-5,1-1-4,0-1-110') +0 +connection s1; +master_gtid_wait('2-1-1,1-1-4,0-1-110') +0 +connection s2; +master_gtid_wait('0-1-1000', 0.5) +-1 +connection s5; +master_gtid_wait('2-1-6', 1) +-1 +connection s10; +master_gtid_wait('0-1-109') +0 +connection server_1; +SET gtid_domain_id=2; +SET gtid_seq_no=10; +INSERT INTO t1 VALUES (7); +connection s4; +master_gtid_wait('2-1-10') +0 +connection s7; +master_gtid_wait('2-1-10') +0 +*** Test gtid_slave_pos when used with GTID *** +connection server_2; +include/stop_slave.inc +connection server_1; +SET gtid_domain_id=2; +SET gtid_seq_no=1000; +INSERT INTO t1 VALUES (10); +INSERT INTO t1 VALUES (11); +connection server_2; +SET sql_slave_skip_counter= 1; +include/start_slave.inc +SELECT * FROM t1 WHERE a >= 10 ORDER BY a; +a +11 +SELECT IF(LOCATE("2-1-1001", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1001 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; +status +Ok +include/stop_slave.inc +connection server_1; +SET gtid_domain_id=2; +SET gtid_seq_no=1010; +INSERT INTO t1 VALUES (12); +INSERT INTO t1 VALUES (13); +connection server_2; +SET sql_slave_skip_counter= 2; +include/start_slave.inc +SELECT * FROM t1 WHERE a >= 10 ORDER BY a; +a +11 +13 +SELECT IF(LOCATE("2-1-1011", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1011 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; +status +Ok +include/stop_slave.inc +connection server_1; +SET gtid_domain_id=2; +SET gtid_seq_no=1020; +INSERT INTO t1 VALUES (14); +INSERT INTO t1 VALUES (15); +INSERT INTO t1 VALUES (16); +connection server_2; +SET sql_slave_skip_counter= 3; +include/start_slave.inc +SELECT * FROM t1 WHERE a >= 10 ORDER BY a; +a +11 +13 +15 +16 +SELECT IF(LOCATE("2-1-1022", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1022 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; +status +Ok +include/stop_slave.inc +connection server_1; +SET gtid_domain_id=2; +SET gtid_seq_no=1030; +INSERT INTO t1 VALUES (17); +INSERT INTO t1 VALUES (18); +INSERT INTO t1 VALUES (19); +connection server_2; +SET sql_slave_skip_counter= 5; +include/start_slave.inc +SELECT * FROM t1 WHERE a >= 10 ORDER BY a; +a +11 +13 +15 +16 +19 +SELECT IF(LOCATE("2-1-1032", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1032 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; +status +Ok +include/stop_slave.inc +connection server_1; +SET gtid_domain_id=3; +SET gtid_seq_no=100; +CREATE TABLE t2 (a INT PRIMARY KEY); +DROP TABLE t2; +SET gtid_domain_id=2; +SET gtid_seq_no=1040; +INSERT INTO t1 VALUES (20); +connection server_2; +SET @saved_mode= @@GLOBAL.slave_ddl_exec_mode; +SET GLOBAL slave_ddl_exec_mode=STRICT; +SET sql_slave_skip_counter=1; +START SLAVE UNTIL master_gtid_pos="3-1-100"; +include/sync_with_master_gtid.inc +include/wait_for_slave_to_stop.inc +SELECT * FROM t2; +ERROR 42S02: Table 'test.t2' doesn't exist +SELECT IF(LOCATE("3-1-100", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-100 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; +status +Ok +SET sql_log_bin=0; +CALL mtr.add_suppression("Slave: Unknown table 'test\\.t2' Error_code: 1051"); +SET sql_log_bin=1; +START SLAVE; +include/wait_for_slave_sql_error.inc [errno=1051] +SELECT IF(LOCATE("3-1-100", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-100 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; +status +Ok +STOP SLAVE IO_THREAD; +SET sql_slave_skip_counter=2; +include/start_slave.inc +SELECT * FROM t1 WHERE a >= 20 ORDER BY a; +a +20 +SELECT IF(LOCATE("3-1-101", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-101 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; +status +Ok +SELECT IF(LOCATE("2-1-1040", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1040 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; +status +Ok +SET GLOBAL slave_ddl_exec_mode= @saved_mode; +*** Test GTID-connecting to a master with out-of-order sequence numbers in the binlog. *** +connection server_1; +SET gtid_domain_id= @@GLOBAL.gtid_domain_id; +INSERT INTO t1 VALUES (31); +connection server_2; +SET gtid_domain_id= @@GLOBAL.gtid_domain_id; +INSERT INTO t1 VALUES (32); +connection server_1; +INSERT INTO t1 VALUES (33); +connection server_2; +connection server_3; +include/stop_slave.inc +connection server_1; +INSERT INTO t1 VALUES (34); +connection server_2; +connection server_3; +include/start_slave.inc +SELECT * FROM t1 WHERE a >= 30 ORDER BY a; +a +31 +32 +33 +34 +connection server_4; +SELECT * FROM t1 WHERE a >= 30 ORDER BY a; +a +31 +32 +33 +34 +connection server_1; +DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_gtid_basic.test b/mysql-test/suite/binlog_encryption/rpl_gtid_basic.test new file mode 100644 index 00000000000..70be6fbff1f --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_gtid_basic.test @@ -0,0 +1 @@ +--source extra/rpl_tests/rpl_gtid_basic.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_incident.cnf b/mysql-test/suite/binlog_encryption/rpl_incident.cnf new file mode 100644 index 00000000000..7294976f6e2 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_incident.cnf @@ -0,0 +1,7 @@ +!include my.cnf + +[mysqld.1] +binlog_checksum=NONE + +[mysqld.2] +binlog_checksum=NONE diff --git a/mysql-test/suite/binlog_encryption/rpl_incident.result b/mysql-test/suite/binlog_encryption/rpl_incident.result new file mode 100644 index 00000000000..8fb4aa907cc --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_incident.result @@ -0,0 +1,49 @@ +include/master-slave.inc +[connection master] +SET @old_binlog_checksum=@@binlog_checksum; +SET GLOBAL BINLOG_CHECKSUM=none; +connection slave; +SET @old_binlog_checksum=@@binlog_checksum; +SET GLOBAL BINLOG_CHECKSUM=none; +connection master; +**** On Master **** +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +SELECT * FROM t1; +a +1 +2 +3 +SET GLOBAL debug_dbug= '+d,incident_database_resync_on_replace,*'; +REPLACE INTO t1 VALUES (4); +SELECT * FROM t1; +a +1 +2 +3 +4 +connection slave; +call mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occurred on the master.* 1590"); +include/wait_for_slave_sql_error.inc [errno=1590] +Last_SQL_Error = 'The incident LOST_EVENTS occurred on the master. Message: ' +**** On Slave **** +SELECT * FROM t1; +a +1 +2 +3 +SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; +START SLAVE; +SELECT * FROM t1; +a +1 +2 +3 +4 +include/check_slave_is_running.inc +connection master; +SET GLOBAL BINLOG_CHECKSUM=@old_binlog_checksum; +DROP TABLE t1; +connection slave; +SET GLOBAL BINLOG_CHECKSUM=@old_binlog_checksum; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_incident.test b/mysql-test/suite/binlog_encryption/rpl_incident.test new file mode 100644 index 00000000000..9be855e1a8b --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_incident.test @@ -0,0 +1 @@ +--source extra/rpl_tests/rpl_incident.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_init_slave_errors.result b/mysql-test/suite/binlog_encryption/rpl_init_slave_errors.result new file mode 100644 index 00000000000..91742814b4c --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_init_slave_errors.result @@ -0,0 +1,22 @@ +include/master-slave.inc +[connection master] +connection slave; +stop slave; +reset slave; +connection slave; +SET GLOBAL debug_dbug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; +start slave; +include/wait_for_slave_sql_error.inc [errno=1593] +Last_SQL_Error = 'Failed during slave thread initialization' +call mtr.add_suppression("Failed during slave.* thread initialization"); +SET GLOBAL debug_dbug= ""; +connection slave; +reset slave; +SET GLOBAL init_slave= "garbage"; +start slave; +include/wait_for_slave_sql_error.inc [errno=1064] +Last_SQL_Error = 'Slave SQL thread aborted. Can't execute init_slave query' +SET GLOBAL init_slave= ""; +include/stop_slave_io.inc +RESET SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_init_slave_errors.test b/mysql-test/suite/binlog_encryption/rpl_init_slave_errors.test new file mode 100644 index 00000000000..6f515b9390a --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_init_slave_errors.test @@ -0,0 +1 @@ +--source extra/rpl_tests/rpl_init_slave_errors.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_loaddata_local.result b/mysql-test/suite/binlog_encryption/rpl_loaddata_local.result new file mode 100644 index 00000000000..f0d24df2cb2 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_loaddata_local.result @@ -0,0 +1,134 @@ +include/master-slave.inc +[connection master] +create table t1(a int); +select * into outfile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; +truncate table t1; +load data local infile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1; +connection slave; +select a,count(*) from t1 group by a; +a count(*) +1 10000 +connection master; +drop table t1; +connection slave; +connection master; +create table t1(a int); +insert into t1 values (1), (2), (2), (3); +select * into outfile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; +drop table t1; +create table t1(a int primary key); +load data local infile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1; +Warnings: +Warning 1062 Duplicate entry '2' for key 'PRIMARY' +SELECT * FROM t1 ORDER BY a; +a +1 +2 +3 +connection slave; +SELECT * FROM t1 ORDER BY a; +a +1 +2 +3 +connection master; +drop table t1; +connection slave; +==== Bug22504 Initialize ==== +connection master; +SET sql_mode='ignore_space'; +CREATE TABLE t1(a int); +insert into t1 values (1), (2), (3), (4); +select * into outfile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; +truncate table t1; +load data local infile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1; +SELECT * FROM t1 ORDER BY a; +a +1 +2 +3 +4 +connection slave; +SELECT * FROM t1 ORDER BY a; +a +1 +2 +3 +4 +==== Clean up ==== +connection master; +DROP TABLE t1; +connection slave; + +Bug #43746: +"return wrong query string when parse 'load data infile' sql statement" + +connection master; +SELECT @@SESSION.sql_mode INTO @old_mode; +SET sql_mode='ignore_space'; +CREATE TABLE t1(a int); +INSERT INTO t1 VALUES (1), (2), (3), (4); +SELECT * INTO OUTFILE 'MYSQLD_DATADIR/bug43746.sql' FROM t1; +TRUNCATE TABLE t1; +LOAD DATA LOCAL INFILE 'MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1; +LOAD/* look mum, with comments in weird places! */DATA/* oh hai */LOCAL INFILE 'MYSQLD_DATADIR/bug43746.sql'/* we are */INTO/* from the internets */TABLE t1; +LOAD DATA/*!10000 LOCAL */INFILE 'MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1; +LOAD DATA LOCAL INFILE 'MYSQLD_DATADIR/bug43746.sql' /*!10000 INTO */ TABLE t1; +LOAD DATA LOCAL INFILE 'MYSQLD_DATADIR/bug43746.sql' /*!10000 INTO TABLE */ t1; +LOAD DATA /*!10000 LOCAL INFILE 'MYSQLD_DATADIR/bug43746.sql' INTO TABLE */ t1; +LOAD DATA/*!10000 LOCAL */INFILE 'MYSQLD_DATADIR/bug43746.sql'/*!10000 INTO*/TABLE t1; +LOAD DATA/*!10000 LOCAL */INFILE 'MYSQLD_DATADIR/bug43746.sql'/* empty */INTO TABLE t1; +LOAD DATA/*!10000 LOCAL */INFILE 'MYSQLD_DATADIR/bug43746.sql' INTO/* empty */TABLE t1; +LOAD/*!999999 special comments that do not expand */DATA/*!999999 code from the future */LOCAL INFILE 'MYSQLD_DATADIR/bug43746.sql'/*!999999 have flux capacitor */INTO/*!999999 will travel */TABLE t1; +SET sql_mode='PIPES_AS_CONCAT,ANSI_QUOTES,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER'; +LOAD DATA LOCAL INFILE 'MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1; +connection slave; + +Bug #59267: +"LOAD DATA LOCAL INFILE not executed on slave with SBR" + +connection master; +SELECT * INTO OUTFILE 'MYSQLD_DATADIR/bug59267.sql' FROM t1; +TRUNCATE TABLE t1; +LOAD DATA LOCAL INFILE 'MYSQLD_DATADIR/bug59267.sql' INTO TABLE t1; +SELECT 'Master', COUNT(*) FROM t1; +Master COUNT(*) +Master 44 +connection slave; +SELECT 'Slave', COUNT(*) FROM t1; +Slave COUNT(*) +Slave 44 +connection master; +DROP TABLE t1; +SET SESSION sql_mode=@old_mode; +connection slave; +connection master; + +Bug #60580/#11902767: +"statement improperly replicated crashes slave sql thread" + +connection master; +CREATE TABLE t1(f1 INT, f2 INT); +CREATE TABLE t2(f1 INT, f2 TIMESTAMP); +INSERT INTO t2 VALUES(1, '2011-03-22 21:01:28'); +INSERT INTO t2 VALUES(2, '2011-03-21 21:01:28'); +INSERT INTO t2 VALUES(3, '2011-03-20 21:01:28'); +CREATE TABLE t3 AS SELECT * FROM t2; +CREATE VIEW v1 AS SELECT * FROM t2 +WHERE f1 IN (SELECT f1 FROM t3 WHERE (t3.f2 IS NULL)); +SELECT 1 INTO OUTFILE 'MYSQLD_DATADIR/bug60580.csv' FROM DUAL; +LOAD DATA LOCAL INFILE 'MYSQLD_DATADIR/bug60580.csv' INTO TABLE t1 (@f1) SET f2 = (SELECT f1 FROM v1 WHERE f1=@f1); +SELECT * FROM t1; +f1 f2 +NULL NULL +connection slave; +SELECT * FROM t1; +f1 f2 +NULL NULL +connection master; +DROP VIEW v1; +DROP TABLE t1, t2, t3; +connection slave; +connection master; +include/rpl_end.inc +# End of 5.1 tests diff --git a/mysql-test/suite/binlog_encryption/rpl_loaddata_local.test b/mysql-test/suite/binlog_encryption/rpl_loaddata_local.test new file mode 100644 index 00000000000..8d90afaed27 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_loaddata_local.test @@ -0,0 +1 @@ +--source extra/rpl_tests/rpl_loaddata_local.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_loadfile.result b/mysql-test/suite/binlog_encryption/rpl_loadfile.result new file mode 100644 index 00000000000..19a11e99250 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_loadfile.result @@ -0,0 +1,254 @@ +include/master-slave.inc +[connection master] +connection master; +DROP PROCEDURE IF EXISTS test.p1; +DROP TABLE IF EXISTS test.t1; +CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a)); +INSERT INTO test.t1 VALUES(1,'test'); +UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=1; +create procedure test.p1() +begin +INSERT INTO test.t1 VALUES(2,'test'); +UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=2; +end| +CALL test.p1(); +SELECT * FROM test.t1 ORDER BY blob_column; +a blob_column +1 abase +abased +abasement +abasements +abases +abash +abashed +abashes +abashing +abasing +abate +abated +abatement +abatements +abater +abates +abating +Abba +abbe +abbey +abbeys +abbot +abbots +Abbott +abbreviate +abbreviated +abbreviates +abbreviating +abbreviation +abbreviations +Abby +abdomen +abdomens +abdominal +abduct +abducted +abduction +abductions +abductor +abductors +abducts +Abe +abed +Abel +Abelian +Abelson +Aberdeen +Abernathy +aberrant +aberration + +2 abase +abased +abasement +abasements +abases +abash +abashed +abashes +abashing +abasing +abate +abated +abatement +abatements +abater +abates +abating +Abba +abbe +abbey +abbeys +abbot +abbots +Abbott +abbreviate +abbreviated +abbreviates +abbreviating +abbreviation +abbreviations +Abby +abdomen +abdomens +abdominal +abduct +abducted +abduction +abductions +abductor +abductors +abducts +Abe +abed +Abel +Abelian +Abelson +Aberdeen +Abernathy +aberrant +aberration + +connection slave; +connection slave; +SELECT * FROM test.t1 ORDER BY blob_column; +a blob_column +1 abase +abased +abasement +abasements +abases +abash +abashed +abashes +abashing +abasing +abate +abated +abatement +abatements +abater +abates +abating +Abba +abbe +abbey +abbeys +abbot +abbots +Abbott +abbreviate +abbreviated +abbreviates +abbreviating +abbreviation +abbreviations +Abby +abdomen +abdomens +abdominal +abduct +abducted +abduction +abductions +abductor +abductors +abducts +Abe +abed +Abel +Abelian +Abelson +Aberdeen +Abernathy +aberrant +aberration + +2 abase +abased +abasement +abasements +abases +abash +abashed +abashes +abashing +abasing +abate +abated +abatement +abatements +abater +abates +abating +Abba +abbe +abbey +abbeys +abbot +abbots +Abbott +abbreviate +abbreviated +abbreviates +abbreviating +abbreviation +abbreviations +Abby +abdomen +abdomens +abdominal +abduct +abducted +abduction +abductions +abductor +abductors +abducts +Abe +abed +Abel +Abelian +Abelson +Aberdeen +Abernathy +aberrant +aberration + +connection master; +DROP PROCEDURE IF EXISTS test.p1; +DROP TABLE test.t1; +connection slave; +include/rpl_reset.inc +connection master; +SELECT repeat('x',20) INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug_39701.data'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (t text); +CREATE PROCEDURE p(file varchar(4096)) +BEGIN +INSERT INTO t1 VALUES (LOAD_FILE(file)); +END| +connection slave; +include/stop_slave.inc +connection master; +CALL p('MYSQLTEST_VARDIR/tmp/bug_39701.data'); +connection slave; +include/start_slave.inc +connection master; +connection slave; +include/diff_tables.inc [master:t1, slave:t1] +connection master; +DROP TABLE t1; +DROP PROCEDURE p; +include/rpl_end.inc +# +# Check that the loaded data is encrypted in the master binlog +# +NOT FOUND /xxxxxxxxxxx/ in master-bin.0* diff --git a/mysql-test/suite/binlog_encryption/rpl_loadfile.test b/mysql-test/suite/binlog_encryption/rpl_loadfile.test new file mode 100644 index 00000000000..97886ca0f48 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_loadfile.test @@ -0,0 +1,11 @@ +--source extra/rpl_tests/rpl_loadfile.inc + +--let $datadir= `SELECT @@datadir` + +--echo # +--echo # Check that the loaded data is encrypted in the master binlog +--echo # + +--let SEARCH_FILE=$datadir/master-bin.0* +--let SEARCH_PATTERN= xxxxxxxxxxx +--source include/search_pattern_in_file.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_mixed_binlog_max_cache_size.result b/mysql-test/suite/binlog_encryption/rpl_mixed_binlog_max_cache_size.result new file mode 100644 index 00000000000..388c8e67b68 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_mixed_binlog_max_cache_size.result @@ -0,0 +1,210 @@ +include/master-slave.inc +[connection master] +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +SET GLOBAL max_binlog_cache_size = 4096; +SET GLOBAL binlog_cache_size = 4096; +SET GLOBAL max_binlog_stmt_cache_size = 4096; +SET GLOBAL binlog_stmt_cache_size = 4096; +disconnect master; +connect master,127.0.0.1,root,,test,$MASTER_MYPORT,; +CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb; +CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MyIsam; +CREATE TABLE t3(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb; +######################################################################################## +# 1 - SINGLE STATEMENT +######################################################################################## +connection master; +*** Single statement on transactional table *** +Got one of the listed errors +*** Single statement on non-transactional table *** +Got one of the listed errors +include/wait_for_slave_sql_error_and_skip.inc [errno=1590] +*** Single statement on both transactional and non-transactional tables. *** +Got one of the listed errors +include/wait_for_slave_sql_error_and_skip.inc [errno=1590] +include/diff_tables.inc [master:t1,slave:t1] +######################################################################################## +# 2 - BEGIN - IMPLICIT COMMIT by DDL +######################################################################################## +connection master; +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; +TRUNCATE TABLE t3; +set default_storage_engine=innodb; +BEGIN; +Got one of the listed errors +Got one of the listed errors +Got one of the listed errors +INSERT INTO t1 (a, data) VALUES (7, 's');; +INSERT INTO t2 (a, data) VALUES (8, 's');; +INSERT INTO t1 (a, data) VALUES (9, 's');; +ALTER TABLE t3 ADD COLUMN d int; +BEGIN; +Got one of the listed errors +Got one of the listed errors +INSERT INTO t1 (a, data) VALUES (19, 's');; +INSERT INTO t2 (a, data) VALUES (20, 's');; +INSERT INTO t1 (a, data) VALUES (21, 's');; +CREATE TABLE t4 SELECT * FROM t1; +BEGIN; +Got one of the listed errors +Got one of the listed errors +INSERT INTO t1 (a, data) VALUES (27, 's');; +INSERT INTO t2 (a, data) VALUES (28, 's');; +INSERT INTO t1 (a, data) VALUES (29, 's');; +CREATE TABLE t5 (a int); +connection slave; +include/diff_tables.inc [master:t1,slave:t1] +######################################################################################## +# 3 - BEGIN - COMMIT +######################################################################################## +connection master; +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; +TRUNCATE TABLE t3; +BEGIN; +Got one of the listed errors +Got one of the listed errors +Got one of the listed errors +COMMIT; +connection slave; +include/diff_tables.inc [master:t1,slave:t1] +######################################################################################## +# 4 - BEGIN - ROLLBACK +######################################################################################## +connection master; +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; +TRUNCATE TABLE t3; +BEGIN; +Got one of the listed errors +Got one of the listed errors +Got one of the listed errors +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +connection slave; +include/diff_tables.inc [master:t1,slave:t1] +######################################################################################## +# 5 - PROCEDURE +######################################################################################## +connection master; +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; +TRUNCATE TABLE t3; +CREATE PROCEDURE p1(pd VARCHAR(30000)) +BEGIN +INSERT INTO t1 (a, data) VALUES (1, pd); +INSERT INTO t1 (a, data) VALUES (2, pd); +INSERT INTO t1 (a, data) VALUES (3, pd); +INSERT INTO t1 (a, data) VALUES (4, pd); +INSERT INTO t1 (a, data) VALUES (5, 's'); +END// +TRUNCATE TABLE t1; +TRUNCATE TABLE t1; +BEGIN; +Got one of the listed errors +COMMIT; +TRUNCATE TABLE t1; +BEGIN; +Got one of the listed errors +ROLLBACK; +connection slave; +include/diff_tables.inc [master:t1,slave:t1] +######################################################################################## +# 6 - XID +######################################################################################## +connection master; +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; +TRUNCATE TABLE t3; +BEGIN; +Got one of the listed errors +Got one of the listed errors +Got one of the listed errors +INSERT INTO t1 (a, data) VALUES (7, 's');; +INSERT INTO t2 (a, data) VALUES (8, 's');; +INSERT INTO t1 (a, data) VALUES (9, 's');; +ROLLBACK TO sv; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +COMMIT; +connection slave; +include/diff_tables.inc [master:t1,slave:t1] +######################################################################################## +# 7 - NON-TRANS TABLE +######################################################################################## +connection master; +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; +TRUNCATE TABLE t3; +BEGIN; +Got one of the listed errors +Got one of the listed errors +Got one of the listed errors +INSERT INTO t1 (a, data) VALUES (8, 's');; +INSERT INTO t1 (a, data) VALUES (9, 's');; +INSERT INTO t2 (a, data) VALUES (10, 's');; +INSERT INTO t1 (a, data) VALUES (11, 's');; +COMMIT; +BEGIN; +Got one of the listed errors +COMMIT; +connection slave; +include/diff_tables.inc [master:t1,slave:t1] +######################################################################## +# 8 - Bug#55375(Regression Bug) Transaction bigger than +# max_binlog_cache_size crashes slave +######################################################################## +# [ On Slave ] +SET GLOBAL max_binlog_cache_size = 4096; +SET GLOBAL binlog_cache_size = 4096; +SET GLOBAL max_binlog_stmt_cache_size = 4096; +SET GLOBAL binlog_stmt_cache_size = 4096; +include/stop_slave.inc +include/start_slave.inc +CALL mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage.*"); +CALL mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_stmt_cache_size' bytes of storage.*"); +CALL mtr.add_suppression("Writing one row to the row-based binary log failed.*"); +CALL mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occurred on the master. Message: error writing to the binary log"); +connection master; +TRUNCATE t1; +connection slave; +connection master; +SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE; +SET GLOBAL binlog_cache_size= ORIGINAL_VALUE; +SET GLOBAL max_binlog_stmt_cache_size= ORIGINAL_VALUE; +SET GLOBAL binlog_stmt_cache_size= ORIGINAL_VALUE; +disconnect master; +connect master,127.0.0.1,root,,test,$MASTER_MYPORT,; +BEGIN; +Repeat statement 'INSERT INTO t1 VALUES($n, repeat("a", 32))' 128 times +COMMIT; +connection slave; +include/wait_for_slave_sql_error.inc [errno=1197] +SELECT count(*) FROM t1; +count(*) +0 +include/show_binlog_events.inc +SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE; +SET GLOBAL binlog_cache_size= ORIGINAL_VALUE; +SET GLOBAL max_binlog_stmt_cache_size= ORIGINAL_VALUE; +SET GLOBAL binlog_stmt_cache_size= ORIGINAL_VALUE; +include/stop_slave.inc +include/start_slave.inc +connection master; +connection slave; +SELECT count(*) FROM t1; +count(*) +128 +######################################################################################## +# CLEAN +######################################################################################## +connection master; +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +DROP TABLE IF EXISTS t4; +DROP TABLE t5; +DROP PROCEDURE p1; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_mixed_binlog_max_cache_size.test b/mysql-test/suite/binlog_encryption/rpl_mixed_binlog_max_cache_size.test new file mode 100644 index 00000000000..8fb7350b815 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_mixed_binlog_max_cache_size.test @@ -0,0 +1,7 @@ +--source include/master-slave.inc +--source include/not_embedded.inc +--source include/not_windows.inc +--source include/have_binlog_format_mixed.inc + +--source extra/rpl_tests/rpl_binlog_max_cache_size.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_packet.cnf b/mysql-test/suite/binlog_encryption/rpl_packet.cnf new file mode 100644 index 00000000000..0f01aec7437 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_packet.cnf @@ -0,0 +1,10 @@ +!include my.cnf + +[mysqld.1] +max_allowed_packet=1024 +net_buffer_length=1024 + +[mysqld.2] +max_allowed_packet=1024 +net_buffer_length=1024 +slave_max_allowed_packet=1024 diff --git a/mysql-test/suite/binlog_encryption/rpl_packet.result b/mysql-test/suite/binlog_encryption/rpl_packet.result new file mode 100644 index 00000000000..4a2a5d70d39 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_packet.result @@ -0,0 +1,83 @@ +include/master-slave.inc +[connection master] +call mtr.add_suppression("Slave I/O: Got a packet bigger than 'slave_max_allowed_packet' bytes, .*error.* 1153"); +call mtr.add_suppression("Log entry on master is longer than slave_max_allowed_packet"); +drop database if exists DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________; +create database DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________; +connection master; +SET @@global.max_allowed_packet=1024; +SET @@global.net_buffer_length=1024; +connection slave; +include/stop_slave.inc +include/start_slave.inc +disconnect master; +connect master,localhost,root,,DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________; +connection master; +select @@net_buffer_length, @@max_allowed_packet; +@@net_buffer_length @@max_allowed_packet +1024 1024 +create table `t1` (`f1` LONGTEXT) ENGINE=MyISAM; +INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1023'); +connection slave; +select count(*) from `DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________`.`t1` /* must be 1 */; +count(*) +1 +SHOW STATUS LIKE 'Slave_running'; +Variable_name Value +Slave_running ON +select * from information_schema.session_status where variable_name= 'SLAVE_RUNNING'; +VARIABLE_NAME VARIABLE_VALUE +SLAVE_RUNNING ON +connection master; +drop database DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________; +connection slave; +connection master; +SET @@global.max_allowed_packet=4096; +SET @@global.net_buffer_length=4096; +connection slave; +include/stop_slave.inc +include/start_slave.inc +disconnect master; +connect master, localhost, root; +connection master; +CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM; +connection slave; +connection master; +INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048'); +connection slave; +include/wait_for_slave_io_error.inc [errno=1153] +Last_IO_Error = 'Got a packet bigger than 'slave_max_allowed_packet' bytes' +include/stop_slave_sql.inc +include/rpl_reset.inc +connection master; +DROP TABLE t1; +connection slave; +connection master; +CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM; +connection slave; +connection master; +INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), REPEAT('b', @@global.max_allowed_packet)); +connection slave; +include/wait_for_slave_io_error.inc [errno=1153] +Last_IO_Error = 'Got a packet bigger than 'slave_max_allowed_packet' bytes' +STOP SLAVE; +RESET SLAVE; +connection master; +RESET MASTER; +SET @max_allowed_packet_0= @@session.max_allowed_packet; +SHOW BINLOG EVENTS; +SET @max_allowed_packet_1= @@session.max_allowed_packet; +SHOW BINLOG EVENTS; +SET @max_allowed_packet_2= @@session.max_allowed_packet; +==== clean up ==== +connection master; +DROP TABLE t1; +SET @@global.max_allowed_packet= 1024; +Warnings: +Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length' +SET @@global.net_buffer_length= 1024; +SET @@global.slave_max_allowed_packet= 1073741824; +connection slave; +DROP TABLE t1; +RESET SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_packet.test b/mysql-test/suite/binlog_encryption/rpl_packet.test new file mode 100644 index 00000000000..31357cb148e --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_packet.test @@ -0,0 +1 @@ +--source extra/rpl_tests/rpl_packet.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel.result b/mysql-test/suite/binlog_encryption/rpl_parallel.result new file mode 100644 index 00000000000..20f3facea27 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_parallel.result @@ -0,0 +1,1690 @@ +include/master-slave.inc +[connection master] +connection server_2; +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET GLOBAL slave_parallel_threads=10; +ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first +include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +SELECT IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; +IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) +OK +CHANGE MASTER TO master_use_gtid=slave_pos; +include/start_slave.inc +SELECT IF(COUNT(*) >= 10, "OK", CONCAT("Found too few system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; +IF(COUNT(*) >= 10, "OK", CONCAT("Found too few system user processes: ", COUNT(*))) +OK +include/stop_slave.inc +SELECT IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; +IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) +OK +include/start_slave.inc +SELECT IF(COUNT(*) >= 10, "OK", CONCAT("Found too few system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; +IF(COUNT(*) >= 10, "OK", CONCAT("Found too few system user processes: ", COUNT(*))) +OK +*** Test long-running query in domain 1 can run in parallel with short queries in domain 0 *** +connection server_1; +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (1); +connection server_2; +connect con_temp1,127.0.0.1,root,,test,$SERVER_MYPORT_2,; +LOCK TABLE t1 WRITE; +connection server_1; +SET gtid_domain_id=1; +INSERT INTO t1 VALUES (2); +SET gtid_domain_id=0; +INSERT INTO t2 VALUES (2); +INSERT INTO t2 VALUES (3); +BEGIN; +INSERT INTO t2 VALUES (4); +INSERT INTO t2 VALUES (5); +COMMIT; +INSERT INTO t2 VALUES (6); +connection server_2; +SELECT * FROM t2 ORDER by a; +a +1 +2 +3 +4 +5 +6 +connection con_temp1; +SELECT * FROM t1; +a +1 +UNLOCK TABLES; +connection server_2; +SELECT * FROM t1 ORDER BY a; +a +1 +2 +*** Test two transactions in different domains committed in opposite order on slave but in a single group commit. *** +connection server_2; +include/stop_slave.inc +connection server_1; +SET sql_log_bin=0; +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) +RETURNS INT DETERMINISTIC +BEGIN +RETURN x; +END +|| +SET sql_log_bin=1; +SET @old_format= @@SESSION.binlog_format; +SET binlog_format='statement'; +SET gtid_domain_id=1; +INSERT INTO t2 VALUES (foo(10, +'commit_before_enqueue SIGNAL ready1 WAIT_FOR cont1', +'commit_after_release_LOCK_prepare_ordered SIGNAL ready2')); +connection server_2; +FLUSH LOGS; +SET sql_log_bin=0; +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) +RETURNS INT DETERMINISTIC +BEGIN +IF d1 != '' THEN +SET debug_sync = d1; +END IF; +IF d2 != '' THEN +SET debug_sync = d2; +END IF; +RETURN x; +END +|| +SET sql_log_bin=1; +SET @old_format=@@GLOBAL.binlog_format; +SET GLOBAL binlog_format=statement; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +include/start_slave.inc +SET debug_sync='now WAIT_FOR ready1'; +connection server_1; +SET gtid_domain_id=2; +INSERT INTO t2 VALUES (foo(11, +'commit_before_enqueue SIGNAL ready3 WAIT_FOR cont3', +'commit_after_release_LOCK_prepare_ordered SIGNAL ready4 WAIT_FOR cont4')); +SET gtid_domain_id=0; +SELECT * FROM t2 WHERE a >= 10 ORDER BY a; +a +10 +11 +connection server_2; +SET debug_sync='now WAIT_FOR ready3'; +SET debug_sync='now SIGNAL cont3'; +SET debug_sync='now WAIT_FOR ready4'; +SET debug_sync='now SIGNAL cont1'; +SET debug_sync='now WAIT_FOR ready2'; +SET debug_sync='now SIGNAL cont4'; +SELECT * FROM t2 WHERE a >= 10 ORDER BY a; +a +10 +11 +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000002 # Binlog_checkpoint # # slave-bin.000002 +slave-bin.000002 # Gtid # # BEGIN GTID #-#-# cid=# +slave-bin.000002 # Query # # use `test`; INSERT INTO t2 VALUES (foo(11, +'commit_before_enqueue SIGNAL ready3 WAIT_FOR cont3', +'commit_after_release_LOCK_prepare_ordered SIGNAL ready4 WAIT_FOR cont4')) +slave-bin.000002 # Xid # # COMMIT /* XID */ +slave-bin.000002 # Gtid # # BEGIN GTID #-#-# cid=# +slave-bin.000002 # Query # # use `test`; INSERT INTO t2 VALUES (foo(10, +'commit_before_enqueue SIGNAL ready1 WAIT_FOR cont1', +'commit_after_release_LOCK_prepare_ordered SIGNAL ready2')) +slave-bin.000002 # Xid # # COMMIT /* XID */ +FLUSH LOGS; +connection server_2; +include/stop_slave.inc +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +SET debug_sync='RESET'; +include/start_slave.inc +*** Test that group-committed transactions on the master can replicate in parallel on the slave. *** +connection server_1; +SET debug_sync='RESET'; +FLUSH LOGS; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +INSERT INTO t3 VALUES (1,1), (3,3), (5,5), (7,7); +connection server_2; +connection con_temp1; +BEGIN; +INSERT INTO t3 VALUES (2,102); +connect con_temp2,127.0.0.1,root,,test,$SERVER_MYPORT_2,; +BEGIN; +INSERT INTO t3 VALUES (4,104); +connect con_temp3,127.0.0.1,root,,test,$SERVER_MYPORT_1,; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +SET binlog_format=statement; +INSERT INTO t3 VALUES (2, foo(12, +'commit_after_release_LOCK_prepare_ordered SIGNAL slave_queued1 WAIT_FOR slave_cont1', +'')); +connection server_1; +SET debug_sync='now WAIT_FOR master_queued1'; +connect con_temp4,127.0.0.1,root,,test,$SERVER_MYPORT_1,; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +SET binlog_format=statement; +INSERT INTO t3 VALUES (4, foo(14, +'commit_after_release_LOCK_prepare_ordered SIGNAL slave_queued2', +'')); +connection server_1; +SET debug_sync='now WAIT_FOR master_queued2'; +connect con_temp5,127.0.0.1,root,,test,$SERVER_MYPORT_1,; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +SET binlog_format=statement; +INSERT INTO t3 VALUES (6, foo(16, +'group_commit_waiting_for_prior SIGNAL slave_queued3', +'')); +connection server_1; +SET debug_sync='now WAIT_FOR master_queued3'; +SET debug_sync='now SIGNAL master_cont1'; +connection con_temp3; +connection con_temp4; +connection con_temp5; +SET debug_sync='RESET'; +connection server_1; +SELECT * FROM t3 ORDER BY a; +a b +1 1 +2 12 +3 3 +4 14 +5 5 +6 16 +7 7 +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Binlog_checkpoint # # master-bin.000001 +master-bin.000002 # Binlog_checkpoint # # master-bin.000002 +master-bin.000002 # Gtid # # GTID #-#-# +master-bin.000002 # Query # # use `test`; CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Query # # use `test`; INSERT INTO t3 VALUES (1,1), (3,3), (5,5), (7,7) +master-bin.000002 # Xid # # COMMIT /* XID */ +master-bin.000002 # Gtid # # BEGIN GTID #-#-# cid=# +master-bin.000002 # Query # # use `test`; INSERT INTO t3 VALUES (2, foo(12, +'commit_after_release_LOCK_prepare_ordered SIGNAL slave_queued1 WAIT_FOR slave_cont1', +'')) +master-bin.000002 # Xid # # COMMIT /* XID */ +master-bin.000002 # Gtid # # BEGIN GTID #-#-# cid=# +master-bin.000002 # Query # # use `test`; INSERT INTO t3 VALUES (4, foo(14, +'commit_after_release_LOCK_prepare_ordered SIGNAL slave_queued2', +'')) +master-bin.000002 # Xid # # COMMIT /* XID */ +master-bin.000002 # Gtid # # BEGIN GTID #-#-# cid=# +master-bin.000002 # Query # # use `test`; INSERT INTO t3 VALUES (6, foo(16, +'group_commit_waiting_for_prior SIGNAL slave_queued3', +'')) +master-bin.000002 # Xid # # COMMIT /* XID */ +connection server_2; +SET debug_sync='now WAIT_FOR slave_queued3'; +connection con_temp1; +ROLLBACK; +connection server_2; +SET debug_sync='now WAIT_FOR slave_queued1'; +connection con_temp2; +ROLLBACK; +connection server_2; +SET debug_sync='now WAIT_FOR slave_queued2'; +SET debug_sync='now SIGNAL slave_cont1'; +SELECT * FROM t3 ORDER BY a; +a b +1 1 +2 12 +3 3 +4 14 +5 5 +6 16 +7 7 +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000003 # Binlog_checkpoint # # slave-bin.000003 +slave-bin.000003 # Gtid # # GTID #-#-# +slave-bin.000003 # Query # # use `test`; CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB +slave-bin.000003 # Gtid # # BEGIN GTID #-#-# +slave-bin.000003 # Query # # use `test`; INSERT INTO t3 VALUES (1,1), (3,3), (5,5), (7,7) +slave-bin.000003 # Xid # # COMMIT /* XID */ +slave-bin.000003 # Gtid # # BEGIN GTID #-#-# cid=# +slave-bin.000003 # Query # # use `test`; INSERT INTO t3 VALUES (2, foo(12, +'commit_after_release_LOCK_prepare_ordered SIGNAL slave_queued1 WAIT_FOR slave_cont1', +'')) +slave-bin.000003 # Xid # # COMMIT /* XID */ +slave-bin.000003 # Gtid # # BEGIN GTID #-#-# cid=# +slave-bin.000003 # Query # # use `test`; INSERT INTO t3 VALUES (4, foo(14, +'commit_after_release_LOCK_prepare_ordered SIGNAL slave_queued2', +'')) +slave-bin.000003 # Xid # # COMMIT /* XID */ +slave-bin.000003 # Gtid # # BEGIN GTID #-#-# cid=# +slave-bin.000003 # Query # # use `test`; INSERT INTO t3 VALUES (6, foo(16, +'group_commit_waiting_for_prior SIGNAL slave_queued3', +'')) +slave-bin.000003 # Xid # # COMMIT /* XID */ +*** Test STOP SLAVE in parallel mode *** +connection server_2; +include/stop_slave.inc +SET debug_sync='RESET'; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +connection server_1; +SET binlog_direct_non_transactional_updates=0; +SET sql_log_bin=0; +CALL mtr.add_suppression("Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction"); +SET sql_log_bin=1; +BEGIN; +INSERT INTO t2 VALUES (20); +INSERT INTO t1 VALUES (20); +INSERT INTO t2 VALUES (21); +INSERT INTO t3 VALUES (20, 20); +COMMIT; +INSERT INTO t3 VALUES(21, 21); +INSERT INTO t3 VALUES(22, 22); +SET binlog_format=@old_format; +connection con_temp1; +BEGIN; +INSERT INTO t2 VALUES (21); +connection server_2; +START SLAVE; +connection con_temp2; +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,rpl_parallel_wait_for_done_trigger"; +STOP SLAVE; +connection con_temp1; +SET debug_sync='now WAIT_FOR wait_for_done_waiting'; +ROLLBACK; +connection con_temp2; +SET GLOBAL debug_dbug=@old_dbug; +SET debug_sync='RESET'; +connection server_2; +include/wait_for_slave_to_stop.inc +SELECT * FROM t1 WHERE a >= 20 ORDER BY a; +a +20 +SELECT * FROM t2 WHERE a >= 20 ORDER BY a; +a +20 +21 +SELECT * FROM t3 WHERE a >= 20 ORDER BY a; +a b +20 20 +include/start_slave.inc +SELECT * FROM t1 WHERE a >= 20 ORDER BY a; +a +20 +SELECT * FROM t2 WHERE a >= 20 ORDER BY a; +a +20 +21 +SELECT * FROM t3 WHERE a >= 20 ORDER BY a; +a b +20 20 +21 21 +22 22 +connection server_2; +include/stop_slave.inc +SET GLOBAL binlog_format=@old_format; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +include/start_slave.inc +*** Test killing slave threads at various wait points *** +*** 1. Test killing transaction waiting in commit for previous transaction to commit *** +connection con_temp3; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +SET binlog_format=statement; +INSERT INTO t3 VALUES (31, foo(31, +'commit_before_prepare_ordered WAIT_FOR t2_waiting', +'commit_after_prepare_ordered SIGNAL t1_ready WAIT_FOR t1_cont')); +connection server_1; +SET debug_sync='now WAIT_FOR master_queued1'; +connection con_temp4; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +SET binlog_format=statement; +BEGIN; +INSERT INTO t3 VALUES (32, foo(32, +'ha_write_row_end SIGNAL t2_query WAIT_FOR t2_cont', +'')); +INSERT INTO t3 VALUES (33, foo(33, +'group_commit_waiting_for_prior SIGNAL t2_waiting', +'group_commit_waiting_for_prior_killed SIGNAL t2_killed')); +COMMIT; +connection server_1; +SET debug_sync='now WAIT_FOR master_queued2'; +connection con_temp5; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +SET binlog_format=statement; +INSERT INTO t3 VALUES (34, foo(34, +'', +'')); +connection server_1; +SET debug_sync='now WAIT_FOR master_queued3'; +SET debug_sync='now SIGNAL master_cont1'; +connection con_temp3; +connection con_temp4; +connection con_temp5; +connection server_1; +SELECT * FROM t3 WHERE a >= 30 ORDER BY a; +a b +31 31 +32 32 +33 33 +34 34 +SET debug_sync='RESET'; +connection server_2; +SET sql_log_bin=0; +CALL mtr.add_suppression("Query execution was interrupted"); +CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); +CALL mtr.add_suppression("Slave: Connection was killed"); +SET sql_log_bin=1; +SET debug_sync='now WAIT_FOR t2_query'; +SET debug_sync='now SIGNAL t2_cont'; +SET debug_sync='now WAIT_FOR t1_ready'; +KILL THD_ID; +SET debug_sync='now WAIT_FOR t2_killed'; +SET debug_sync='now SIGNAL t1_cont'; +include/wait_for_slave_sql_error.inc [errno=1317,1927,1964] +STOP SLAVE IO_THREAD; +SELECT * FROM t3 WHERE a >= 30 ORDER BY a; +a b +31 31 +SET debug_sync='RESET'; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +SET sql_log_bin=0; +DROP FUNCTION foo; +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) +RETURNS INT DETERMINISTIC +BEGIN +RETURN x; +END +|| +SET sql_log_bin=1; +connection server_1; +INSERT INTO t3 VALUES (39,0); +connection server_2; +include/start_slave.inc +SELECT * FROM t3 WHERE a >= 30 ORDER BY a; +a b +31 31 +32 32 +33 33 +34 34 +39 0 +SET sql_log_bin=0; +DROP FUNCTION foo; +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) +RETURNS INT DETERMINISTIC +BEGIN +IF d1 != '' THEN +SET debug_sync = d1; +END IF; +IF d2 != '' THEN +SET debug_sync = d2; +END IF; +RETURN x; +END +|| +SET sql_log_bin=1; +connection server_2; +include/stop_slave.inc +SET GLOBAL binlog_format=@old_format; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +include/start_slave.inc +*** 2. Same as (1), but without restarting IO thread after kill of SQL threads *** +connection con_temp3; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +SET binlog_format=statement; +INSERT INTO t3 VALUES (41, foo(41, +'commit_before_prepare_ordered WAIT_FOR t2_waiting', +'commit_after_prepare_ordered SIGNAL t1_ready WAIT_FOR t1_cont')); +connection server_1; +SET debug_sync='now WAIT_FOR master_queued1'; +connection con_temp4; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +SET binlog_format=statement; +BEGIN; +INSERT INTO t3 VALUES (42, foo(42, +'ha_write_row_end SIGNAL t2_query WAIT_FOR t2_cont', +'')); +INSERT INTO t3 VALUES (43, foo(43, +'group_commit_waiting_for_prior SIGNAL t2_waiting', +'group_commit_waiting_for_prior_killed SIGNAL t2_killed')); +COMMIT; +connection server_1; +SET debug_sync='now WAIT_FOR master_queued2'; +connection con_temp5; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +SET binlog_format=statement; +INSERT INTO t3 VALUES (44, foo(44, +'', +'')); +connection server_1; +SET debug_sync='now WAIT_FOR master_queued3'; +SET debug_sync='now SIGNAL master_cont1'; +connection con_temp3; +connection con_temp4; +connection con_temp5; +connection server_1; +SELECT * FROM t3 WHERE a >= 40 ORDER BY a; +a b +41 41 +42 42 +43 43 +44 44 +SET debug_sync='RESET'; +connection server_2; +SET debug_sync='now WAIT_FOR t2_query'; +SET debug_sync='now SIGNAL t2_cont'; +SET debug_sync='now WAIT_FOR t1_ready'; +KILL THD_ID; +SET debug_sync='now WAIT_FOR t2_killed'; +SET debug_sync='now SIGNAL t1_cont'; +include/wait_for_slave_sql_error.inc [errno=1317,1927,1964] +SET debug_sync='RESET'; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +SET sql_log_bin=0; +DROP FUNCTION foo; +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) +RETURNS INT DETERMINISTIC +BEGIN +RETURN x; +END +|| +SET sql_log_bin=1; +connection server_1; +INSERT INTO t3 VALUES (49,0); +connection server_2; +START SLAVE SQL_THREAD; +SELECT * FROM t3 WHERE a >= 40 ORDER BY a; +a b +41 41 +42 42 +43 43 +44 44 +49 0 +SET sql_log_bin=0; +DROP FUNCTION foo; +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) +RETURNS INT DETERMINISTIC +BEGIN +IF d1 != '' THEN +SET debug_sync = d1; +END IF; +IF d2 != '' THEN +SET debug_sync = d2; +END IF; +RETURN x; +END +|| +SET sql_log_bin=1; +connection server_2; +include/stop_slave.inc +SET GLOBAL binlog_format=@old_format; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +include/start_slave.inc +*** 3. Same as (2), but not using gtid mode *** +connection server_2; +include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=no; +include/start_slave.inc +connection server_1; +connection con_temp3; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +SET binlog_format=statement; +INSERT INTO t3 VALUES (51, foo(51, +'commit_before_prepare_ordered WAIT_FOR t2_waiting', +'commit_after_prepare_ordered SIGNAL t1_ready WAIT_FOR t1_cont')); +connection server_1; +SET debug_sync='now WAIT_FOR master_queued1'; +connection con_temp4; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +SET binlog_format=statement; +BEGIN; +INSERT INTO t3 VALUES (52, foo(52, +'ha_write_row_end SIGNAL t2_query WAIT_FOR t2_cont', +'')); +INSERT INTO t3 VALUES (53, foo(53, +'group_commit_waiting_for_prior SIGNAL t2_waiting', +'group_commit_waiting_for_prior_killed SIGNAL t2_killed')); +COMMIT; +connection server_1; +SET debug_sync='now WAIT_FOR master_queued2'; +connection con_temp5; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +SET binlog_format=statement; +INSERT INTO t3 VALUES (54, foo(54, +'', +'')); +connection server_1; +SET debug_sync='now WAIT_FOR master_queued3'; +SET debug_sync='now SIGNAL master_cont1'; +connection con_temp3; +connection con_temp4; +connection con_temp5; +connection server_1; +SELECT * FROM t3 WHERE a >= 50 ORDER BY a; +a b +51 51 +52 52 +53 53 +54 54 +SET debug_sync='RESET'; +connection server_2; +SET debug_sync='now WAIT_FOR t2_query'; +SET debug_sync='now SIGNAL t2_cont'; +SET debug_sync='now WAIT_FOR t1_ready'; +KILL THD_ID; +SET debug_sync='now WAIT_FOR t2_killed'; +SET debug_sync='now SIGNAL t1_cont'; +include/wait_for_slave_sql_error.inc [errno=1317,1927,1964] +SELECT * FROM t3 WHERE a >= 50 ORDER BY a; +a b +51 51 +SET debug_sync='RESET'; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +SET sql_log_bin=0; +DROP FUNCTION foo; +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) +RETURNS INT DETERMINISTIC +BEGIN +RETURN x; +END +|| +SET sql_log_bin=1; +connection server_1; +INSERT INTO t3 VALUES (59,0); +connection server_2; +START SLAVE SQL_THREAD; +SELECT * FROM t3 WHERE a >= 50 ORDER BY a; +a b +51 51 +52 52 +53 53 +54 54 +59 0 +SET sql_log_bin=0; +DROP FUNCTION foo; +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) +RETURNS INT DETERMINISTIC +BEGIN +IF d1 != '' THEN +SET debug_sync = d1; +END IF; +IF d2 != '' THEN +SET debug_sync = d2; +END IF; +RETURN x; +END +|| +SET sql_log_bin=1; +include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=slave_pos; +include/start_slave.inc +connection server_2; +include/stop_slave.inc +SET GLOBAL binlog_format=@old_format; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=4; +include/start_slave.inc +*** 4. Test killing thread that is waiting to start transaction until previous transaction commits *** +connection server_1; +SET binlog_format=statement; +SET gtid_domain_id=2; +BEGIN; +INSERT INTO t3 VALUES (70, foo(70, +'rpl_parallel_start_waiting_for_prior SIGNAL t4_waiting', '')); +INSERT INTO t3 VALUES (60, foo(60, +'ha_write_row_end SIGNAL d2_query WAIT_FOR d2_cont2', +'rpl_parallel_end_of_group SIGNAL d2_done WAIT_FOR d2_cont')); +COMMIT; +SET gtid_domain_id=0; +connection server_2; +SET debug_sync='now WAIT_FOR d2_query'; +connection server_1; +SET gtid_domain_id=1; +BEGIN; +INSERT INTO t3 VALUES (61, foo(61, +'rpl_parallel_start_waiting_for_prior SIGNAL t3_waiting', +'rpl_parallel_start_waiting_for_prior_killed SIGNAL t3_killed')); +INSERT INTO t3 VALUES (62, foo(62, +'ha_write_row_end SIGNAL d1_query WAIT_FOR d1_cont2', +'rpl_parallel_end_of_group SIGNAL d1_done WAIT_FOR d1_cont')); +COMMIT; +SET gtid_domain_id=0; +connection server_2; +SET debug_sync='now WAIT_FOR d1_query'; +connection server_1; +SET gtid_domain_id=0; +INSERT INTO t3 VALUES (63, foo(63, +'ha_write_row_end SIGNAL d0_query WAIT_FOR d0_cont2', +'rpl_parallel_end_of_group SIGNAL d0_done WAIT_FOR d0_cont')); +connection server_2; +SET debug_sync='now WAIT_FOR d0_query'; +connection server_1; +SET gtid_domain_id=3; +BEGIN; +INSERT INTO t3 VALUES (68, foo(68, +'rpl_parallel_start_waiting_for_prior SIGNAL t2_waiting', '')); +INSERT INTO t3 VALUES (69, foo(69, +'ha_write_row_end SIGNAL d3_query WAIT_FOR d3_cont2', +'rpl_parallel_end_of_group SIGNAL d3_done WAIT_FOR d3_cont')); +COMMIT; +SET gtid_domain_id=0; +connection server_2; +SET debug_sync='now WAIT_FOR d3_query'; +SET debug_sync='now SIGNAL d2_cont2'; +SET debug_sync='now WAIT_FOR d2_done'; +SET debug_sync='now SIGNAL d1_cont2'; +SET debug_sync='now WAIT_FOR d1_done'; +SET debug_sync='now SIGNAL d0_cont2'; +SET debug_sync='now WAIT_FOR d0_done'; +SET debug_sync='now SIGNAL d3_cont2'; +SET debug_sync='now WAIT_FOR d3_done'; +connection con_temp3; +SET binlog_format=statement; +INSERT INTO t3 VALUES (64, foo(64, +'rpl_parallel_before_mark_start_commit SIGNAL t1_waiting WAIT_FOR t1_cont', '')); +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2 WAIT_FOR master_cont2'; +INSERT INTO t3 VALUES (65, foo(65, '', '')); +connection server_1; +SET debug_sync='now WAIT_FOR master_queued2'; +connection con_temp4; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +INSERT INTO t3 VALUES (66, foo(66, '', '')); +connection server_1; +SET debug_sync='now WAIT_FOR master_queued3'; +connection con_temp5; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued4'; +INSERT INTO t3 VALUES (67, foo(67, '', '')); +connection server_1; +SET debug_sync='now WAIT_FOR master_queued4'; +SET debug_sync='now SIGNAL master_cont2'; +connection con_temp3; +connection con_temp4; +connection con_temp5; +connection server_1; +SELECT * FROM t3 WHERE a >= 60 ORDER BY a; +a b +60 60 +61 61 +62 62 +63 63 +64 64 +65 65 +66 66 +67 67 +68 68 +69 69 +70 70 +SET debug_sync='RESET'; +connection server_2; +SET debug_sync='now SIGNAL d0_cont'; +SET debug_sync='now WAIT_FOR t1_waiting'; +SET debug_sync='now SIGNAL d3_cont'; +SET debug_sync='now WAIT_FOR t2_waiting'; +SET debug_sync='now SIGNAL d1_cont'; +SET debug_sync='now WAIT_FOR t3_waiting'; +SET debug_sync='now SIGNAL d2_cont'; +SET debug_sync='now WAIT_FOR t4_waiting'; +KILL THD_ID; +SET debug_sync='now WAIT_FOR t3_killed'; +SET debug_sync='now SIGNAL t1_cont'; +include/wait_for_slave_sql_error.inc [errno=1317,1927,1964] +STOP SLAVE IO_THREAD; +SELECT * FROM t3 WHERE a >= 60 AND a != 65 ORDER BY a; +a b +60 60 +61 61 +62 62 +63 63 +64 64 +68 68 +69 69 +70 70 +SET debug_sync='RESET'; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +SET sql_log_bin=0; +DROP FUNCTION foo; +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) +RETURNS INT DETERMINISTIC +BEGIN +RETURN x; +END +|| +SET sql_log_bin=1; +connection server_1; +UPDATE t3 SET b=b+1 WHERE a=60; +connection server_2; +include/start_slave.inc +SELECT * FROM t3 WHERE a >= 60 ORDER BY a; +a b +60 61 +61 61 +62 62 +63 63 +64 64 +65 65 +66 66 +67 67 +68 68 +69 69 +70 70 +SET sql_log_bin=0; +DROP FUNCTION foo; +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) +RETURNS INT DETERMINISTIC +BEGIN +IF d1 != '' THEN +SET debug_sync = d1; +END IF; +IF d2 != '' THEN +SET debug_sync = d2; +END IF; +RETURN x; +END +|| +SET sql_log_bin=1; +connection server_2; +include/stop_slave.inc +SET GLOBAL binlog_format=@old_format; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +include/start_slave.inc +*** 5. Test killing thread that is waiting for queue of max length to shorten *** +SET @old_max_queued= @@GLOBAL.slave_parallel_max_queued; +SET GLOBAL slave_parallel_max_queued=9000; +connection server_1; +SET binlog_format=statement; +INSERT INTO t3 VALUES (80, foo(0, +'ha_write_row_end SIGNAL query_waiting WAIT_FOR query_cont', '')); +connection server_2; +SET debug_sync='now WAIT_FOR query_waiting'; +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,rpl_parallel_wait_queue_max"; +connection server_1; +SELECT * FROM t3 WHERE a >= 80 ORDER BY a; +a b +80 0 +81 10000 +connection server_2; +SET debug_sync='now WAIT_FOR wait_queue_ready'; +KILL THD_ID; +SET debug_sync='now WAIT_FOR wait_queue_killed'; +SET debug_sync='now SIGNAL query_cont'; +include/wait_for_slave_sql_error.inc [errno=1317,1927,1964] +STOP SLAVE IO_THREAD; +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL slave_parallel_max_queued= @old_max_queued; +connection server_1; +INSERT INTO t3 VALUES (82,0); +SET binlog_format=@old_format; +connection server_2; +SET debug_sync='RESET'; +include/start_slave.inc +SELECT * FROM t3 WHERE a >= 80 ORDER BY a; +a b +80 0 +81 10000 +82 0 +connection server_2; +include/stop_slave.inc +SET GLOBAL binlog_format=@old_format; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +include/start_slave.inc +*** MDEV-5788 Incorrect free of rgi->deferred_events in parallel replication *** +connection server_2; +include/stop_slave.inc +SET GLOBAL replicate_ignore_table="test.t3"; +SET GLOBAL slave_parallel_threads=2; +include/start_slave.inc +connection server_1; +INSERT INTO t3 VALUES (100, rand()); +INSERT INTO t3 VALUES (101, rand()); +connection server_2; +connection server_1; +INSERT INTO t3 VALUES (102, rand()); +INSERT INTO t3 VALUES (103, rand()); +INSERT INTO t3 VALUES (104, rand()); +INSERT INTO t3 VALUES (105, rand()); +connection server_2; +include/stop_slave.inc +SET GLOBAL replicate_ignore_table=""; +include/start_slave.inc +connection server_1; +INSERT INTO t3 VALUES (106, rand()); +INSERT INTO t3 VALUES (107, rand()); +connection server_2; +SELECT * FROM t3 WHERE a >= 100 ORDER BY a; +a b +106 # +107 # +*** MDEV-5921: In parallel replication, an error is not correctly signalled to the next transaction *** +connection server_2; +include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +include/start_slave.inc +connection server_1; +INSERT INTO t3 VALUES (110, 1); +connection server_2; +SELECT * FROM t3 WHERE a >= 110 ORDER BY a; +a b +110 1 +SET sql_log_bin=0; +INSERT INTO t3 VALUES (111, 666); +SET sql_log_bin=1; +connection server_1; +connect con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +INSERT INTO t3 VALUES (111, 2); +connection server_1; +SET debug_sync='now WAIT_FOR master_queued1'; +connect con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +INSERT INTO t3 VALUES (112, 3); +connection server_1; +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; +connection con1; +connection con2; +SET debug_sync='RESET'; +connection server_2; +include/wait_for_slave_sql_error.inc [errno=1062] +include/wait_for_slave_sql_to_stop.inc +SELECT * FROM t3 WHERE a >= 110 ORDER BY a; +a b +110 1 +111 666 +SET sql_log_bin=0; +DELETE FROM t3 WHERE a=111 AND b=666; +SET sql_log_bin=1; +START SLAVE SQL_THREAD; +SELECT * FROM t3 WHERE a >= 110 ORDER BY a; +a b +110 1 +111 2 +112 3 +***MDEV-5914: Parallel replication deadlock due to InnoDB lock conflicts *** +connection server_2; +include/stop_slave.inc +connection server_1; +CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; +INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); +connection con1; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +UPDATE t4 SET b=NULL WHERE a=6; +connection server_1; +SET debug_sync='now WAIT_FOR master_queued1'; +connection con2; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +DELETE FROM t4 WHERE b <= 3; +connection server_1; +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; +connection con1; +connection con2; +SET debug_sync='RESET'; +connection server_2; +include/start_slave.inc +include/stop_slave.inc +SELECT * FROM t4 ORDER BY a; +a b +1 NULL +3 NULL +4 4 +5 NULL +6 NULL +connection server_1; +DELETE FROM t4; +INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); +connection con1; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +INSERT INTO t4 VALUES (7, NULL); +connection server_1; +SET debug_sync='now WAIT_FOR master_queued1'; +connection con2; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +DELETE FROM t4 WHERE b <= 3; +connection server_1; +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; +connection con1; +connection con2; +SET debug_sync='RESET'; +connection server_2; +include/start_slave.inc +include/stop_slave.inc +SELECT * FROM t4 ORDER BY a; +a b +1 NULL +3 NULL +4 4 +5 NULL +6 6 +7 NULL +connection server_1; +DELETE FROM t4; +INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); +connection con1; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +UPDATE t4 SET b=NULL WHERE a=6; +connection server_1; +SET debug_sync='now WAIT_FOR master_queued1'; +connection con2; +SET @old_format= @@SESSION.binlog_format; +SET binlog_format='statement'; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +DELETE FROM t4 WHERE b <= 1; +connection server_1; +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; +connection con1; +connection con2; +SET @old_format=@@GLOBAL.binlog_format; +SET debug_sync='RESET'; +connection server_2; +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,disable_thd_need_ordering_with"; +include/start_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SELECT * FROM t4 ORDER BY a; +a b +1 NULL +2 2 +3 NULL +4 4 +5 NULL +6 NULL +SET @last_gtid= 'GTID'; +SELECT IF(@@gtid_slave_pos LIKE CONCAT('%',@last_gtid,'%'), "GTID found ok", +CONCAT("GTID ", @last_gtid, " not found in gtid_slave_pos=", @@gtid_slave_pos)) +AS result; +result +GTID found ok +SELECT "ROW FOUND" AS `Is the row found?` + FROM mysql.gtid_slave_pos +WHERE CONCAT(domain_id, "-", server_id, "-", seq_no) = @last_gtid; +Is the row found? +ROW FOUND +*** MDEV-5938: Exec_master_log_pos not updated at log rotate in parallel replication *** +connection server_2; +include/stop_slave.inc +SET GLOBAL slave_parallel_threads=1; +SET DEBUG_SYNC= 'RESET'; +include/start_slave.inc +connection server_1; +CREATE TABLE t5 (a INT PRIMARY KEY, b INT); +INSERT INTO t5 VALUES (1,1); +INSERT INTO t5 VALUES (2,2), (3,8); +INSERT INTO t5 VALUES (4,16); +connection server_2; +test_check +OK +test_check +OK +connection server_1; +FLUSH LOGS; +connection server_2; +test_check +OK +test_check +OK +*** MDEV_6435: Incorrect error handling when query binlogged partially on master with "killed" error *** +connection server_1; +CREATE TABLE t6 (a INT) ENGINE=MyISAM; +CREATE TRIGGER tr AFTER INSERT ON t6 FOR EACH ROW SET @a = 1; +connection con1; +SET @old_format= @@binlog_format; +SET binlog_format= statement; +SET debug_sync='sp_head_execute_before_loop SIGNAL ready WAIT_FOR cont'; +INSERT INTO t6 VALUES (1), (2), (3); +connection server_1; +SET debug_sync='now WAIT_FOR ready'; +KILL QUERY CONID; +SET debug_sync='now SIGNAL cont'; +connection con1; +ERROR 70100: Query execution was interrupted +SET binlog_format= @old_format; +SET debug_sync='RESET'; +connection server_1; +SET debug_sync='RESET'; +connection server_2; +include/wait_for_slave_sql_error.inc [errno=1317] +STOP SLAVE IO_THREAD; +SET GLOBAL gtid_slave_pos= 'AFTER_ERROR_GTID_POS'; +include/start_slave.inc +connection server_1; +INSERT INTO t6 VALUES (4); +SELECT * FROM t6 ORDER BY a; +a +1 +4 +connection server_2; +SELECT * FROM t6 ORDER BY a; +a +4 +*** MDEV-6551: Some replication errors are ignored if slave_parallel_threads > 0 *** +connection server_1; +INSERT INTO t2 VALUES (31); +include/save_master_gtid.inc +connection server_2; +include/sync_with_master_gtid.inc +include/stop_slave.inc +SET GLOBAL slave_parallel_threads= 0; +include/start_slave.inc +SET sql_log_bin= 0; +INSERT INTO t2 VALUES (32); +SET sql_log_bin= 1; +connection server_1; +INSERT INTO t2 VALUES (32); +FLUSH LOGS; +INSERT INTO t2 VALUES (33); +INSERT INTO t2 VALUES (34); +SELECT * FROM t2 WHERE a >= 30 ORDER BY a; +a +31 +32 +33 +34 +include/save_master_gtid.inc +connection server_2; +include/wait_for_slave_sql_error.inc [errno=1062] +connection server_2; +include/stop_slave_io.inc +SET GLOBAL slave_parallel_threads=10; +START SLAVE; +include/wait_for_slave_sql_error.inc [errno=1062] +START SLAVE SQL_THREAD; +include/wait_for_slave_sql_error.inc [errno=1062] +SELECT * FROM t2 WHERE a >= 30 ORDER BY a; +a +31 +32 +SET sql_slave_skip_counter= 1; +ERROR HY000: When using parallel replication and GTID with multiple replication domains, @@sql_slave_skip_counter can not be used. Instead, setting @@gtid_slave_pos explicitly can be used to skip to after a given GTID position +include/stop_slave_io.inc +include/start_slave.inc +include/sync_with_master_gtid.inc +SELECT * FROM t2 WHERE a >= 30 ORDER BY a; +a +31 +32 +33 +34 +*** MDEV-6775: Wrong binlog order in parallel replication *** +connection server_1; +DELETE FROM t4; +INSERT INTO t4 VALUES (1,NULL), (3,NULL), (4,4), (5, NULL), (6, 6); +include/save_master_gtid.inc +connection server_2; +include/sync_with_master_gtid.inc +include/stop_slave.inc +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,inject_binlog_commit_before_get_LOCK_log"; +SET @old_format=@@GLOBAL.binlog_format; +SET GLOBAL binlog_format=ROW; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +connection con1; +SET @old_format= @@binlog_format; +SET binlog_format= statement; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +UPDATE t4 SET b=NULL WHERE a=6; +connection server_1; +SET debug_sync='now WAIT_FOR master_queued1'; +connection con2; +SET @old_format= @@binlog_format; +SET binlog_format= statement; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +DELETE FROM t4 WHERE b <= 3; +connection server_1; +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; +connection con1; +SET binlog_format= @old_format; +connection con2; +SET binlog_format= @old_format; +SET debug_sync='RESET'; +SELECT * FROM t4 ORDER BY a; +a b +1 NULL +3 NULL +4 4 +5 NULL +6 NULL +connection server_2; +include/start_slave.inc +SET debug_sync= 'now WAIT_FOR waiting'; +SELECT * FROM t4 ORDER BY a; +a b +1 NULL +3 NULL +4 4 +5 NULL +6 NULL +SET debug_sync= 'now SIGNAL cont'; +include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL binlog_format= @old_format; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +include/start_slave.inc +*** MDEV-7237: Parallel replication: incorrect relaylog position after stop/start the slave *** +connection server_1; +INSERT INTO t2 VALUES (40); +connection server_2; +include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=no; +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,rpl_parallel_scheduled_gtid_0_x_100"; +SET GLOBAL debug_dbug="+d,rpl_parallel_wait_for_done_trigger"; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +connection server_1; +INSERT INTO t2 VALUES (41); +INSERT INTO t2 VALUES (42); +SET @old_format= @@binlog_format; +SET binlog_format= statement; +DELETE FROM t2 WHERE a=40; +SET binlog_format= @old_format; +INSERT INTO t2 VALUES (43); +INSERT INTO t2 VALUES (44); +FLUSH LOGS; +INSERT INTO t2 VALUES (45); +SET gtid_seq_no=100; +INSERT INTO t2 VALUES (46); +connection con_temp2; +BEGIN; +SELECT * FROM t2 WHERE a=40 FOR UPDATE; +a +40 +connection server_2; +include/start_slave.inc +SET debug_sync= 'now WAIT_FOR scheduled_gtid_0_x_100'; +STOP SLAVE; +connection con_temp2; +SET debug_sync= 'now WAIT_FOR wait_for_done_waiting'; +ROLLBACK; +connection server_2; +include/wait_for_slave_sql_to_stop.inc +SELECT * FROM t2 WHERE a >= 40 ORDER BY a; +a +41 +42 +include/start_slave.inc +SELECT * FROM t2 WHERE a >= 40 ORDER BY a; +a +41 +42 +43 +44 +45 +46 +include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET DEBUG_SYNC= 'RESET'; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +include/start_slave.inc +*** MDEV-7326 Server deadlock in connection with parallel replication *** +connection server_2; +include/stop_slave.inc +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=3; +SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_xid"; +include/start_slave.inc +connection server_1; +SET @old_format= @@SESSION.binlog_format; +SET binlog_format= STATEMENT; +INSERT INTO t1 VALUES (foo(50, +"rpl_parallel_start_waiting_for_prior SIGNAL t3_ready", +"rpl_parallel_end_of_group SIGNAL prep_ready WAIT_FOR prep_cont")); +connection server_2; +SET DEBUG_SYNC= "now WAIT_FOR prep_ready"; +connection server_1; +INSERT INTO t2 VALUES (foo(50, +"rpl_parallel_simulate_temp_err_xid SIGNAL t1_ready1 WAIT_FOR t1_cont1", +"rpl_parallel_retry_after_unmark SIGNAL t1_ready2 WAIT_FOR t1_cont2")); +connection server_2; +SET DEBUG_SYNC= "now WAIT_FOR t1_ready1"; +connection server_1; +INSERT INTO t1 VALUES (foo(51, +"rpl_parallel_before_mark_start_commit SIGNAL t2_ready1 WAIT_FOR t2_cont1", +"rpl_parallel_after_mark_start_commit SIGNAL t2_ready2")); +connection server_2; +SET DEBUG_SYNC= "now WAIT_FOR t2_ready1"; +SET DEBUG_SYNC= "now SIGNAL t1_cont1"; +SET DEBUG_SYNC= "now WAIT_FOR t1_ready2"; +connection server_1; +INSERT INTO t1 VALUES (52); +SET BINLOG_FORMAT= @old_format; +SELECT * FROM t2 WHERE a>=50 ORDER BY a; +a +50 +SELECT * FROM t1 WHERE a>=50 ORDER BY a; +a +50 +51 +52 +connection server_2; +SET DEBUG_SYNC= "now SIGNAL prep_cont"; +SET DEBUG_SYNC= "now WAIT_FOR t3_ready"; +SET DEBUG_SYNC= "now SIGNAL t2_cont1"; +SET DEBUG_SYNC= "now WAIT_FOR t2_ready2"; +SET DEBUG_SYNC= "now SIGNAL t1_cont2"; +connection server_1; +connection server_2; +SELECT * FROM t2 WHERE a>=50 ORDER BY a; +a +50 +SELECT * FROM t1 WHERE a>=50 ORDER BY a; +a +50 +51 +52 +SET DEBUG_SYNC="reset"; +include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +include/start_slave.inc +*** MDEV-7326 Server deadlock in connection with parallel replication *** +connection server_2; +include/stop_slave.inc +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=3; +SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_xid"; +include/start_slave.inc +connection server_1; +SET @old_format= @@SESSION.binlog_format; +SET binlog_format= STATEMENT; +INSERT INTO t1 VALUES (foo(60, +"rpl_parallel_start_waiting_for_prior SIGNAL t3_ready", +"rpl_parallel_end_of_group SIGNAL prep_ready WAIT_FOR prep_cont")); +connection server_2; +SET DEBUG_SYNC= "now WAIT_FOR prep_ready"; +connection server_1; +INSERT INTO t2 VALUES (foo(60, +"rpl_parallel_simulate_temp_err_xid SIGNAL t1_ready1 WAIT_FOR t1_cont1", +"rpl_parallel_retry_after_unmark SIGNAL t1_ready2 WAIT_FOR t1_cont2")); +connection server_2; +SET DEBUG_SYNC= "now WAIT_FOR t1_ready1"; +connection con_temp3; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +SET binlog_format=statement; +INSERT INTO t1 VALUES (foo(61, +"rpl_parallel_before_mark_start_commit SIGNAL t2_ready1 WAIT_FOR t2_cont1", +"rpl_parallel_after_mark_start_commit SIGNAL t2_ready2")); +connection server_1; +SET debug_sync='now WAIT_FOR master_queued1'; +connection con_temp4; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +INSERT INTO t6 VALUES (62); +connection server_1; +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; +connection con_temp3; +connection con_temp4; +connection server_1; +SET debug_sync='RESET'; +SET BINLOG_FORMAT= @old_format; +SELECT * FROM t2 WHERE a>=60 ORDER BY a; +a +60 +SELECT * FROM t1 WHERE a>=60 ORDER BY a; +a +60 +61 +SELECT * FROM t6 WHERE a>=60 ORDER BY a; +a +62 +connection server_2; +SET DEBUG_SYNC= "now WAIT_FOR t2_ready1"; +SET DEBUG_SYNC= "now SIGNAL t1_cont1"; +SET DEBUG_SYNC= "now WAIT_FOR t1_ready2"; +connection server_2; +SET DEBUG_SYNC= "now SIGNAL prep_cont"; +SET DEBUG_SYNC= "now WAIT_FOR t3_ready"; +SET DEBUG_SYNC= "now SIGNAL t2_cont1"; +SET DEBUG_SYNC= "now WAIT_FOR t2_ready2"; +SET DEBUG_SYNC= "now SIGNAL t1_cont2"; +connection server_1; +connection server_2; +SELECT * FROM t2 WHERE a>=60 ORDER BY a; +a +60 +SELECT * FROM t1 WHERE a>=60 ORDER BY a; +a +60 +61 +SELECT * FROM t6 WHERE a>=60 ORDER BY a; +a +62 +SET DEBUG_SYNC="reset"; +include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +include/start_slave.inc +*** MDEV-7335: Potential parallel slave deadlock with specific binlog corruption *** +connection server_2; +include/stop_slave.inc +SET GLOBAL slave_parallel_threads=1; +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000"; +connection server_1; +INSERT INTO t2 VALUES (101); +INSERT INTO t2 VALUES (102); +INSERT INTO t2 VALUES (103); +INSERT INTO t2 VALUES (104); +INSERT INTO t2 VALUES (105); +SET gtid_seq_no=1000; +INSERT INTO t2 VALUES (106); +INSERT INTO t2 VALUES (107); +INSERT INTO t2 VALUES (108); +INSERT INTO t2 VALUES (109); +INSERT INTO t2 VALUES (110); +INSERT INTO t2 VALUES (111); +INSERT INTO t2 VALUES (112); +INSERT INTO t2 VALUES (113); +INSERT INTO t2 VALUES (114); +INSERT INTO t2 VALUES (115); +INSERT INTO t2 VALUES (116); +INSERT INTO t2 VALUES (117); +INSERT INTO t2 VALUES (118); +INSERT INTO t2 VALUES (119); +INSERT INTO t2 VALUES (120); +INSERT INTO t2 VALUES (121); +INSERT INTO t2 VALUES (122); +INSERT INTO t2 VALUES (123); +INSERT INTO t2 VALUES (124); +INSERT INTO t2 VALUES (125); +INSERT INTO t2 VALUES (126); +INSERT INTO t2 VALUES (127); +INSERT INTO t2 VALUES (128); +INSERT INTO t2 VALUES (129); +INSERT INTO t2 VALUES (130); +include/save_master_gtid.inc +connection server_2; +include/start_slave.inc +include/sync_with_master_gtid.inc +SELECT * FROM t2 WHERE a >= 100 ORDER BY a; +a +101 +102 +103 +104 +105 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL slave_parallel_threads=10; +include/start_slave.inc +*** MDEV-6676 - test syntax of @@slave_parallel_mode *** +connection server_2; +Parallel_Mode = 'conservative' +include/stop_slave.inc +SET GLOBAL slave_parallel_mode='aggressive'; +Parallel_Mode = 'aggressive' +SET GLOBAL slave_parallel_mode='conservative'; +Parallel_Mode = 'conservative' +*** MDEV-6676 - test that empty parallel_mode does not replicate in parallel *** +connection server_1; +INSERT INTO t2 VALUES (1040); +include/save_master_gtid.inc +connection server_2; +SET GLOBAL slave_parallel_mode='none'; +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,slave_crash_if_parallel_apply"; +include/start_slave.inc +include/sync_with_master_gtid.inc +SELECT * FROM t2 WHERE a >= 1040 ORDER BY a; +a +1040 +include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +*** MDEV-6676 - test disabling domain-based parallel replication *** +connection server_1; +SET gtid_domain_id = 1; +INSERT INTO t2 VALUES (1041); +INSERT INTO t2 VALUES (1042); +INSERT INTO t2 VALUES (1043); +INSERT INTO t2 VALUES (1044); +INSERT INTO t2 VALUES (1045); +INSERT INTO t2 VALUES (1046); +DELETE FROM t2 WHERE a >= 1041; +SET gtid_domain_id = 2; +INSERT INTO t2 VALUES (1041); +INSERT INTO t2 VALUES (1042); +INSERT INTO t2 VALUES (1043); +INSERT INTO t2 VALUES (1044); +INSERT INTO t2 VALUES (1045); +INSERT INTO t2 VALUES (1046); +SET gtid_domain_id = 0; +include/save_master_gtid.inc +connection server_2; +SET GLOBAL slave_parallel_mode=minimal; +include/start_slave.inc +include/sync_with_master_gtid.inc +SELECT * FROM t2 WHERE a >= 1040 ORDER BY a; +a +1040 +1041 +1042 +1043 +1044 +1045 +1046 +*** MDEV-7888: ANALYZE TABLE does wakeup_subsequent_commits(), causing wrong binlog order and parallel replication hang *** +connection server_2; +include/stop_slave.inc +SET GLOBAL slave_parallel_mode='conservative'; +SET GLOBAL slave_parallel_threads=10; +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug= '+d,inject_analyze_table_sleep'; +connection server_1; +SET @old_dbug= @@SESSION.debug_dbug; +SET SESSION debug_dbug="+d,binlog_force_commit_id"; +SET @commit_id= 10000; +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status OK +INSERT INTO t3 VALUES (120, 0); +SET @commit_id= 10001; +INSERT INTO t3 VALUES (121, 0); +SET SESSION debug_dbug=@old_dbug; +SELECT * FROM t3 WHERE a >= 120 ORDER BY a; +a b +120 0 +121 0 +include/save_master_gtid.inc +connection server_2; +include/start_slave.inc +include/sync_with_master_gtid.inc +SELECT * FROM t3 WHERE a >= 120 ORDER BY a; +a b +120 0 +121 0 +include/stop_slave.inc +SET GLOBAL debug_dbug= @old_dbug; +include/start_slave.inc +*** MDEV-7929: record_gtid() for non-transactional event group calls wakeup_subsequent_commits() too early, causing slave hang. *** +connection server_2; +include/stop_slave.inc +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug= '+d,inject_record_gtid_serverid_100_sleep'; +connection server_1; +SET @old_dbug= @@SESSION.debug_dbug; +SET SESSION debug_dbug="+d,binlog_force_commit_id"; +SET @old_server_id= @@SESSION.server_id; +SET SESSION server_id= 100; +SET @commit_id= 10010; +ALTER TABLE t1 COMMENT "Hulubulu!"; +SET SESSION server_id= @old_server_id; +INSERT INTO t3 VALUES (130, 0); +SET @commit_id= 10011; +INSERT INTO t3 VALUES (131, 0); +SET SESSION debug_dbug=@old_dbug; +SELECT * FROM t3 WHERE a >= 130 ORDER BY a; +a b +130 0 +131 0 +include/save_master_gtid.inc +connection server_2; +include/start_slave.inc +include/sync_with_master_gtid.inc +SELECT * FROM t3 WHERE a >= 130 ORDER BY a; +a b +130 0 +131 0 +include/stop_slave.inc +SET GLOBAL debug_dbug= @old_dbug; +include/start_slave.inc +*** MDEV-8031: Parallel replication stops on "connection killed" error (probably incorrectly handled deadlock kill) *** +connection server_1; +INSERT INTO t3 VALUES (201,0), (202,0); +include/save_master_gtid.inc +connection server_2; +include/sync_with_master_gtid.inc +include/stop_slave.inc +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug= '+d,inject_mdev8031'; +connection server_1; +SET @old_dbug= @@SESSION.debug_dbug; +SET SESSION debug_dbug="+d,binlog_force_commit_id"; +SET @commit_id= 10200; +INSERT INTO t3 VALUES (203, 1); +INSERT INTO t3 VALUES (204, 1); +INSERT INTO t3 VALUES (205, 1); +UPDATE t3 SET b=b+1 WHERE a=201; +UPDATE t3 SET b=b+1 WHERE a=201; +UPDATE t3 SET b=b+1 WHERE a=201; +UPDATE t3 SET b=b+1 WHERE a=202; +UPDATE t3 SET b=b+1 WHERE a=202; +UPDATE t3 SET b=b+1 WHERE a=202; +UPDATE t3 SET b=b+1 WHERE a=202; +UPDATE t3 SET b=b+1 WHERE a=203; +UPDATE t3 SET b=b+1 WHERE a=203; +UPDATE t3 SET b=b+1 WHERE a=204; +UPDATE t3 SET b=b+1 WHERE a=204; +UPDATE t3 SET b=b+1 WHERE a=204; +UPDATE t3 SET b=b+1 WHERE a=203; +UPDATE t3 SET b=b+1 WHERE a=205; +UPDATE t3 SET b=b+1 WHERE a=205; +SET SESSION debug_dbug=@old_dbug; +SELECT * FROM t3 WHERE a>=200 ORDER BY a; +a b +201 3 +202 4 +203 4 +204 4 +205 3 +include/save_master_gtid.inc +connection server_2; +include/start_slave.inc +include/sync_with_master_gtid.inc +SELECT * FROM t3 WHERE a>=200 ORDER BY a; +a b +201 3 +202 4 +203 4 +204 4 +205 3 +include/stop_slave.inc +SET GLOBAL debug_dbug= @old_dbug; +include/start_slave.inc +*** Check getting deadlock killed inside open_binlog() during retry. *** +connection server_2; +include/stop_slave.inc +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug= '+d,inject_retry_event_group_open_binlog_kill'; +SET @old_max= @@GLOBAL.max_relay_log_size; +SET GLOBAL max_relay_log_size= 4096; +connection server_1; +SET @old_dbug= @@SESSION.debug_dbug; +SET SESSION debug_dbug="+d,binlog_force_commit_id"; +SET @commit_id= 10210; +Omit long queries that cause relaylog rotations and transaction retries... +SET SESSION debug_dbug=@old_dbug; +SELECT * FROM t3 WHERE a>=200 ORDER BY a; +a b +201 6 +202 8 +203 7 +204 7 +205 5 +include/save_master_gtid.inc +connection server_2; +include/start_slave.inc +include/sync_with_master_gtid.inc +SELECT * FROM t3 WHERE a>=200 ORDER BY a; +a b +201 6 +202 8 +203 7 +204 7 +205 5 +include/stop_slave.inc +SET GLOBAL debug_dbug= @old_debg; +SET GLOBAL max_relay_log_size= @old_max; +include/start_slave.inc +*** MDEV-8725: Assertion on ROLLBACK statement in the binary log *** +connection server_1; +BEGIN; +INSERT INTO t2 VALUES (2000); +INSERT INTO t1 VALUES (2000); +INSERT INTO t2 VALUES (2001); +ROLLBACK; +SELECT * FROM t1 WHERE a>=2000 ORDER BY a; +a +2000 +SELECT * FROM t2 WHERE a>=2000 ORDER BY a; +a +include/save_master_gtid.inc +connection server_2; +include/sync_with_master_gtid.inc +SELECT * FROM t1 WHERE a>=2000 ORDER BY a; +a +2000 +SELECT * FROM t2 WHERE a>=2000 ORDER BY a; +a +connection server_2; +include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; +connection server_1; +DROP function foo; +DROP TABLE t1,t2,t3,t4,t5,t6; +SET DEBUG_SYNC= 'RESET'; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel.test b/mysql-test/suite/binlog_encryption/rpl_parallel.test new file mode 100644 index 00000000000..b7c4bb429a4 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_parallel.test @@ -0,0 +1 @@ +--source extra/rpl_tests/rpl_parallel.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_show_binlog_events_purge_logs.cnf b/mysql-test/suite/binlog_encryption/rpl_parallel_show_binlog_events_purge_logs.cnf new file mode 100644 index 00000000000..b8e22e97ae9 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_show_binlog_events_purge_logs.cnf @@ -0,0 +1,6 @@ +!include my.cnf + +[mysqld.2] +plugin-load-add= @ENV.FILE_KEY_MANAGEMENT_SO +loose-file-key-management-filename=@ENV.MYSQLTEST_VARDIR/std_data/keys.txt +encrypt-binlog diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_show_binlog_events_purge_logs.result b/mysql-test/suite/binlog_encryption/rpl_parallel_show_binlog_events_purge_logs.result new file mode 100644 index 00000000000..204db2bae9f --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_show_binlog_events_purge_logs.result @@ -0,0 +1,13 @@ +include/master-slave.inc +[connection master] +connection slave; +SET DEBUG_SYNC= 'after_show_binlog_events SIGNAL on_show_binlog_events WAIT_FOR end'; +SHOW BINLOG EVENTS; +connection slave1; +SET DEBUG_SYNC= 'now WAIT_FOR on_show_binlog_events'; +FLUSH LOGS; +SET DEBUG_SYNC= 'now SIGNAL end'; +connection slave; +SET DEBUG_SYNC= 'RESET'; +connection master; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_show_binlog_events_purge_logs.test b/mysql-test/suite/binlog_encryption/rpl_parallel_show_binlog_events_purge_logs.test new file mode 100644 index 00000000000..9e93b0b56e9 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_show_binlog_events_purge_logs.test @@ -0,0 +1 @@ +--source extra/rpl_tests/rpl_parallel_show_binlog_events_purge_logs.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_relayrotate-slave.opt b/mysql-test/suite/binlog_encryption/rpl_relayrotate-slave.opt new file mode 100644 index 00000000000..1665aec291d --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_relayrotate-slave.opt @@ -0,0 +1,5 @@ +--max_relay_log_size=16384 +--log-warnings +--plugin-load-add=$FILE_KEY_MANAGEMENT_SO +--loose-file-key-management-filename=$MYSQLTEST_VARDIR/std_data/keys.txt +--encrypt-binlog diff --git a/mysql-test/suite/binlog_encryption/rpl_relayrotate.result b/mysql-test/suite/binlog_encryption/rpl_relayrotate.result new file mode 100644 index 00000000000..142626e33e3 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_relayrotate.result @@ -0,0 +1,20 @@ +include/master-slave.inc +[connection master] +connection master; +connection slave; +connection slave; +stop slave; +connection master; +create table t1 (a int) engine=innodb; +connection slave; +reset slave; +start slave; +stop slave; +start slave; +select max(a) from t1; +max(a) +8000 +connection master; +drop table t1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_relayrotate.test b/mysql-test/suite/binlog_encryption/rpl_relayrotate.test new file mode 100644 index 00000000000..5e3bcdcd711 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_relayrotate.test @@ -0,0 +1 @@ +--source extra/rpl_tests/rpl_relayrotate.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_semi_sync.result b/mysql-test/suite/binlog_encryption/rpl_semi_sync.result new file mode 100644 index 00000000000..6d574681d73 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_semi_sync.result @@ -0,0 +1,488 @@ +include/master-slave.inc +[connection master] +connection master; +call mtr.add_suppression("Timeout waiting for reply of binlog"); +call mtr.add_suppression("Read semi-sync reply"); +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT."); +connection slave; +call mtr.add_suppression("Master server does not support semi-sync"); +call mtr.add_suppression("Semi-sync slave .* reply"); +call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); +connection master; +# +# Uninstall semi-sync plugins on master and slave +# +connection slave; +include/stop_slave.inc +reset slave; +set global rpl_semi_sync_master_enabled= 0; +set global rpl_semi_sync_slave_enabled= 0; +connection master; +reset master; +set global rpl_semi_sync_master_enabled= 0; +set global rpl_semi_sync_slave_enabled= 0; +# +# Main test of semi-sync replication start here +# +connection master; +set global rpl_semi_sync_master_timeout= 60000; +[ default state of semi-sync on master should be OFF ] +show variables like 'rpl_semi_sync_master_enabled'; +Variable_name Value +rpl_semi_sync_master_enabled OFF +[ enable semi-sync on master ] +set global rpl_semi_sync_master_enabled = 1; +show variables like 'rpl_semi_sync_master_enabled'; +Variable_name Value +rpl_semi_sync_master_enabled ON +[ status of semi-sync on master should be ON even without any semi-sync slaves ] +show status like 'Rpl_semi_sync_master_clients'; +Variable_name Value +Rpl_semi_sync_master_clients 0 +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 0 +# +# BUG#45672 Semisync repl: ActiveTranx:insert_tranx_node: transaction node allocation failed +# BUG#45673 Semisynch reports correct operation even if no slave is connected +# +[ status of semi-sync on master should be OFF ] +show status like 'Rpl_semi_sync_master_clients'; +Variable_name Value +Rpl_semi_sync_master_clients 0 +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status OFF +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 0 +reset master; +connection slave; +[ default state of semi-sync on slave should be OFF ] +show variables like 'rpl_semi_sync_slave_enabled'; +Variable_name Value +rpl_semi_sync_slave_enabled OFF +[ enable semi-sync on slave ] +set global rpl_semi_sync_slave_enabled = 1; +show variables like 'rpl_semi_sync_slave_enabled'; +Variable_name Value +rpl_semi_sync_slave_enabled ON +include/start_slave.inc +connection master; +[ initial master state after the semi-sync slave connected ] +show status like 'Rpl_semi_sync_master_clients'; +Variable_name Value +Rpl_semi_sync_master_clients 1 +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 0 +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 0 +create table t1(a int) engine = ENGINE_TYPE; +[ master state after CREATE TABLE statement ] +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 0 +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 1 +select CONNECTIONS_NORMAL_SLAVE - CONNECTIONS_NORMAL_SLAVE as 'Should be 0'; +Should be 0 +0 +[ insert records to table ] +insert t1 values (10); +insert t1 values (9); +insert t1 values (8); +insert t1 values (7); +insert t1 values (6); +insert t1 values (5); +insert t1 values (4); +insert t1 values (3); +insert t1 values (2); +insert t1 values (1); +[ master status after inserts ] +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 0 +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 11 +connection slave; +[ slave status after replicated inserts ] +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status ON +select count(distinct a) from t1; +count(distinct a) +10 +select min(a) from t1; +min(a) +1 +select max(a) from t1; +max(a) +10 + +# BUG#50157 +# semi-sync replication crashes when replicating a transaction which +# include 'CREATE TEMPORARY TABLE `MyISAM_t` SELECT * FROM `Innodb_t` ; +connection master; +SET SESSION AUTOCOMMIT= 0; +CREATE TABLE t2(c1 INT) ENGINE=innodb; +connection slave; +connection master; +BEGIN; + +# Even though it is in a transaction, this statement is binlogged into binlog +# file immediately. +CREATE TEMPORARY TABLE t3 SELECT c1 FROM t2 where 1=1; + +# These statements will not be binlogged until the transaction is committed +INSERT INTO t2 VALUES(11); +INSERT INTO t2 VALUES(22); +COMMIT; +DROP TABLE t2, t3; +SET SESSION AUTOCOMMIT= 1; +connection slave; +# +# Test semi-sync master will switch OFF after one transaction +# timeout waiting for slave reply. +# +connection slave; +include/stop_slave.inc +connection master; +set global rpl_semi_sync_master_timeout= 5000; +[ master status should be ON ] +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 0 +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 14 +show status like 'Rpl_semi_sync_master_clients'; +Variable_name Value +Rpl_semi_sync_master_clients 1 +[ semi-sync replication of these transactions will fail ] +insert into t1 values (500); +[ master status should be OFF ] +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status OFF +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 1 +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 14 +delete from t1 where a=10; +delete from t1 where a=9; +delete from t1 where a=8; +delete from t1 where a=7; +delete from t1 where a=6; +delete from t1 where a=5; +delete from t1 where a=4; +delete from t1 where a=3; +delete from t1 where a=2; +delete from t1 where a=1; +insert into t1 values (100); +[ master status should be OFF ] +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status OFF +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 12 +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 14 +# +# Test semi-sync status on master will be ON again when slave catches up +# +connection slave; +[ slave status should be OFF ] +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status OFF +include/start_slave.inc +[ slave status should be ON ] +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status ON +select count(distinct a) from t1; +count(distinct a) +2 +select min(a) from t1; +min(a) +100 +select max(a) from t1; +max(a) +500 +connection master; +[ master status should be ON again after slave catches up ] +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 12 +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 14 +show status like 'Rpl_semi_sync_master_clients'; +Variable_name Value +Rpl_semi_sync_master_clients 1 +# +# Test disable/enable master semi-sync on the fly. +# +drop table t1; +connection slave; +include/stop_slave.inc +# +# Flush status +# +connection master; +[ Semi-sync master status variables before FLUSH STATUS ] +SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 12 +SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 15 +FLUSH NO_WRITE_TO_BINLOG STATUS; +[ Semi-sync master status variables after FLUSH STATUS ] +SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 0 +SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 0 +connection master; +show master logs; +Log_name master-bin.000001 +File_size # +show variables like 'rpl_semi_sync_master_enabled'; +Variable_name Value +rpl_semi_sync_master_enabled ON +[ disable semi-sync on the fly ] +set global rpl_semi_sync_master_enabled=0; +show variables like 'rpl_semi_sync_master_enabled'; +Variable_name Value +rpl_semi_sync_master_enabled OFF +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status OFF +[ enable semi-sync on the fly ] +set global rpl_semi_sync_master_enabled=1; +show variables like 'rpl_semi_sync_master_enabled'; +Variable_name Value +rpl_semi_sync_master_enabled ON +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +# +# Test RESET MASTER/SLAVE +# +connection slave; +include/start_slave.inc +connection master; +create table t1 (a int) engine = ENGINE_TYPE; +drop table t1; +connection slave; +show status like 'Rpl_relay%'; +Variable_name Value +[ test reset master ] +connection master; +reset master; +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 0 +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 0 +connection slave; +include/stop_slave.inc +reset slave; +connection master; +kill query _tid; +connection slave; +include/start_slave.inc +connection master; +create table t1 (a int) engine = ENGINE_TYPE; +insert into t1 values (1); +insert into t1 values (2), (3); +connection slave; +select * from t1; +a +1 +2 +3 +connection master; +[ master semi-sync status should be ON ] +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 0 +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 3 +# +# Start semi-sync replication without SUPER privilege +# +connection slave; +include/stop_slave.inc +reset slave; +connection master; +reset master; +kill query _tid; +set sql_log_bin=0; +grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password'; +flush privileges; +set sql_log_bin=1; +connection slave; +grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password'; +flush privileges; +change master to master_user='rpl',master_password='rpl_password'; +include/start_slave.inc +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status ON +connection master; +[ master semi-sync should be ON ] +show status like 'Rpl_semi_sync_master_clients'; +Variable_name Value +Rpl_semi_sync_master_clients 1 +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 0 +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 0 +insert into t1 values (4); +insert into t1 values (5); +[ master semi-sync should be ON ] +show status like 'Rpl_semi_sync_master_clients'; +Variable_name Value +Rpl_semi_sync_master_clients 1 +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 0 +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 2 +# +# Test semi-sync slave connect to non-semi-sync master +# +connection slave; +include/stop_slave.inc +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status OFF +connection master; +kill query _tid; +[ Semi-sync status on master should be ON ] +show status like 'Rpl_semi_sync_master_clients'; +Variable_name Value +Rpl_semi_sync_master_clients 0 +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +set global rpl_semi_sync_master_enabled= 0; +connection slave; +SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; +Variable_name Value +rpl_semi_sync_slave_enabled ON +include/start_slave.inc +connection master; +insert into t1 values (8); +[ master semi-sync clients should be 1, status should be OFF ] +show status like 'Rpl_semi_sync_master_clients'; +Variable_name Value +Rpl_semi_sync_master_clients 1 +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status OFF +connection slave; +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status ON +connection slave; +include/stop_slave.inc +connection master; +set global rpl_semi_sync_master_enabled= 0; +connection slave; +SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; +Variable_name Value +rpl_semi_sync_slave_enabled ON +include/start_slave.inc +connection master; +insert into t1 values (10); +connection slave; +# +# Test non-semi-sync slave connect to semi-sync master +# +connection master; +set global rpl_semi_sync_master_timeout= 5000; +set global rpl_semi_sync_master_enabled= 1; +connection slave; +include/stop_slave.inc +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status OFF +[ uninstall semi-sync slave plugin ] +set global rpl_semi_sync_slave_enabled= 0; +[ reinstall semi-sync slave plugin and disable semi-sync ] +SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; +Variable_name Value +rpl_semi_sync_slave_enabled OFF +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status OFF +include/start_slave.inc +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status OFF +# +# Clean up +# +connection slave; +include/stop_slave.inc +set global rpl_semi_sync_slave_enabled= 0; +connection master; +set global rpl_semi_sync_master_enabled= 0; +connection slave; +change master to master_user='root',master_password=''; +include/start_slave.inc +connection master; +drop table t1; +connection slave; +connection master; +drop user rpl@127.0.0.1; +flush privileges; +set global rpl_semi_sync_master_timeout= default; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_semi_sync.test b/mysql-test/suite/binlog_encryption/rpl_semi_sync.test new file mode 100644 index 00000000000..d5f80619aeb --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_semi_sync.test @@ -0,0 +1 @@ +--source extra/rpl_tests/rpl_semi_sync.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_skip_replication.cnf b/mysql-test/suite/binlog_encryption/rpl_skip_replication.cnf new file mode 100644 index 00000000000..b8e22e97ae9 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_skip_replication.cnf @@ -0,0 +1,6 @@ +!include my.cnf + +[mysqld.2] +plugin-load-add= @ENV.FILE_KEY_MANAGEMENT_SO +loose-file-key-management-filename=@ENV.MYSQLTEST_VARDIR/std_data/keys.txt +encrypt-binlog diff --git a/mysql-test/suite/binlog_encryption/rpl_skip_replication.result b/mysql-test/suite/binlog_encryption/rpl_skip_replication.result new file mode 100644 index 00000000000..ded85f3edd5 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_skip_replication.result @@ -0,0 +1,312 @@ +include/master-slave.inc +[connection master] +connection slave; +CREATE USER 'nonsuperuser'@'127.0.0.1'; +GRANT ALTER,CREATE,DELETE,DROP,EVENT,INSERT,PROCESS,REPLICATION SLAVE, +SELECT,UPDATE ON *.* TO 'nonsuperuser'@'127.0.0.1'; +connect nonpriv, 127.0.0.1, nonsuperuser,, test, $SLAVE_MYPORT,; +connection nonpriv; +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation +disconnect nonpriv; +connection slave; +DROP USER'nonsuperuser'@'127.0.0.1'; +SELECT @@global.replicate_events_marked_for_skip; +@@global.replicate_events_marked_for_skip +REPLICATE +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; +ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first +SELECT @@global.replicate_events_marked_for_skip; +@@global.replicate_events_marked_for_skip +REPLICATE +STOP SLAVE; +SET SESSION replicate_events_marked_for_skip=FILTER_ON_MASTER; +ERROR HY000: Variable 'replicate_events_marked_for_skip' is a GLOBAL variable and should be set with SET GLOBAL +SELECT @@global.replicate_events_marked_for_skip; +@@global.replicate_events_marked_for_skip +REPLICATE +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; +SELECT @@global.replicate_events_marked_for_skip; +@@global.replicate_events_marked_for_skip +FILTER_ON_MASTER +START SLAVE; +connection master; +SELECT @@skip_replication; +@@skip_replication +0 +SET GLOBAL skip_replication=1; +ERROR HY000: Variable 'skip_replication' is a SESSION variable and can't be used with SET GLOBAL +SELECT @@skip_replication; +@@skip_replication +0 +CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=myisam; +CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=innodb; +INSERT INTO t1(a) VALUES (1); +INSERT INTO t2(a) VALUES (1); +SET skip_replication=1; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam; +INSERT INTO t1(a) VALUES (2); +INSERT INTO t2(a) VALUES (2); +FLUSH NO_WRITE_TO_BINLOG LOGS; +connection slave; +connection slave; +SHOW TABLES; +Tables_in_test +t1 +t2 +SELECT * FROM t1; +a b +1 NULL +SELECT * FROM t2; +a b +1 NULL +connection master; +DROP TABLE t3; +FLUSH NO_WRITE_TO_BINLOG LOGS; +connection slave; +connection slave; +STOP SLAVE; +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; +START SLAVE; +connection master; +SET skip_replication=1; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam; +INSERT INTO t1(a) VALUES (3); +INSERT INTO t2(a) VALUES (3); +FLUSH NO_WRITE_TO_BINLOG LOGS; +connection slave; +connection slave; +SHOW TABLES; +Tables_in_test +t1 +t2 +SELECT * FROM t1; +a b +1 NULL +SELECT * FROM t2; +a b +1 NULL +connection master; +DROP TABLE t3; +FLUSH NO_WRITE_TO_BINLOG LOGS; +connection slave; +connection slave; +STOP SLAVE; +SET GLOBAL replicate_events_marked_for_skip=REPLICATE; +START SLAVE; +connection master; +SET skip_replication=1; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam; +INSERT INTO t3(a) VALUES(2); +connection slave; +connection slave; +SELECT * FROM t3; +a b +2 NULL +connection master; +DROP TABLE t3; +TRUNCATE t1; +connection slave; +connection slave; +RESET MASTER; +connection master; +SET skip_replication=0; +INSERT INTO t1 VALUES (1,0); +SET skip_replication=1; +INSERT INTO t1 VALUES (2,0); +SET skip_replication=0; +INSERT INTO t1 VALUES (3,0); +connection slave; +connection slave; +SELECT * FROM t1 ORDER by a; +a b +1 0 +2 0 +3 0 +STOP SLAVE; +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; +connection master; +TRUNCATE t1; +SELECT * FROM t1 ORDER by a; +a b +1 0 +2 0 +3 0 +connection slave; +START SLAVE; +connection master; +connection slave; +connection slave; +SELECT * FROM t1 ORDER by a; +a b +1 0 +3 0 +connection master; +TRUNCATE t1; +connection slave; +connection slave; +STOP SLAVE; +SET GLOBAL sql_slave_skip_counter=6; +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; +START SLAVE; +connection master; +SET @old_binlog_format= @@binlog_format; +SET binlog_format= statement; +SET skip_replication=0; +INSERT INTO t1 VALUES (1,5); +SET skip_replication=1; +INSERT INTO t1 VALUES (2,5); +SET skip_replication=0; +INSERT INTO t1 VALUES (3,5); +INSERT INTO t1 VALUES (4,5); +SET binlog_format= @old_binlog_format; +connection slave; +connection slave; +SELECT * FROM t1; +a b +4 5 +connection slave; +include/stop_slave.inc +SET @old_slave_binlog_format= @@global.binlog_format; +SET GLOBAL binlog_format= row; +include/start_slave.inc +connection master; +TRUNCATE t1; +SET @old_binlog_format= @@binlog_format; +SET binlog_format= row; +BINLOG 'wlZOTw8BAAAA8QAAAPUAAAAAAAQANS41LjIxLU1hcmlhREItZGVidWctbG9nAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAA2QAEGggAAAAICAgCAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAA371saA=='; +BINLOG 'wlZOTxMBAAAAKgAAAGMBAAAAgCkAAAAAAAEABHRlc3QAAnQxAAIDAwAC +wlZOTxcBAAAAJgAAAIkBAAAAgCkAAAAAAAEAAv/8AQAAAAgAAAA='; +BINLOG 'wlZOTxMBAAAAKgAAADwCAAAAACkAAAAAAAEABHRlc3QAAnQxAAIDAwAC +wlZOTxcBAAAAJgAAAGICAAAAACkAAAAAAAEAAv/8AgAAAAgAAAA='; +SET binlog_format= @old_binlog_format; +SELECT * FROM t1 ORDER BY a; +a b +1 8 +2 8 +connection slave; +connection slave; +SELECT * FROM t1 ORDER by a; +a b +2 8 +include/stop_slave.inc +SET GLOBAL binlog_format= @old_slave_binlog_format; +include/start_slave.inc +connection master; +SET skip_replication=0; +BEGIN; +SET skip_replication=0; +ERROR HY000: Cannot modify @@session.skip_replication inside a transaction +SET skip_replication=1; +ERROR HY000: Cannot modify @@session.skip_replication inside a transaction +ROLLBACK; +SET skip_replication=1; +BEGIN; +SET skip_replication=0; +ERROR HY000: Cannot modify @@session.skip_replication inside a transaction +SET skip_replication=1; +ERROR HY000: Cannot modify @@session.skip_replication inside a transaction +COMMIT; +SET autocommit=0; +INSERT INTO t2(a) VALUES(100); +SET skip_replication=1; +ERROR HY000: Cannot modify @@session.skip_replication inside a transaction +ROLLBACK; +SET autocommit=1; +SET skip_replication=1; +CREATE FUNCTION foo (x INT) RETURNS INT BEGIN SET SESSION skip_replication=x; RETURN x; END| +CREATE PROCEDURE bar(x INT) BEGIN SET SESSION skip_replication=x; END| +CREATE FUNCTION baz (x INT) RETURNS INT BEGIN CALL bar(x); RETURN x; END| +SELECT foo(0); +ERROR HY000: Cannot modify @@session.skip_replication inside a stored function or trigger +SELECT baz(0); +ERROR HY000: Cannot modify @@session.skip_replication inside a stored function or trigger +SET @a= foo(1); +ERROR HY000: Cannot modify @@session.skip_replication inside a stored function or trigger +SET @a= baz(1); +ERROR HY000: Cannot modify @@session.skip_replication inside a stored function or trigger +UPDATE t2 SET b=foo(0); +ERROR HY000: Cannot modify @@session.skip_replication inside a stored function or trigger +UPDATE t2 SET b=baz(0); +ERROR HY000: Cannot modify @@session.skip_replication inside a stored function or trigger +INSERT INTO t1 VALUES (101, foo(1)); +ERROR HY000: Cannot modify @@session.skip_replication inside a stored function or trigger +INSERT INTO t1 VALUES (101, baz(0)); +ERROR HY000: Cannot modify @@session.skip_replication inside a stored function or trigger +SELECT @@skip_replication; +@@skip_replication +1 +CALL bar(0); +SELECT @@skip_replication; +@@skip_replication +0 +CALL bar(1); +SELECT @@skip_replication; +@@skip_replication +1 +DROP FUNCTION foo; +DROP PROCEDURE bar; +DROP FUNCTION baz; +connection master; +SET skip_replication= 0; +TRUNCATE t1; +connection slave; +connection slave; +STOP SLAVE; +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; +START SLAVE IO_THREAD; +connection master; +SET skip_replication= 1; +INSERT INTO t1(a) VALUES (1); +SET skip_replication= 0; +INSERT INTO t1(a) VALUES (2); +include/save_master_pos.inc +connection slave; +include/sync_io_with_master.inc +STOP SLAVE IO_THREAD; +SET GLOBAL replicate_events_marked_for_skip=REPLICATE; +START SLAVE; +connection master; +connection slave; +connection slave; +SELECT * FROM t1; +a b +2 NULL +connection master; +SET skip_replication= 0; +TRUNCATE t1; +connection slave; +connection slave; +STOP SLAVE; +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; +START SLAVE IO_THREAD; +connection master; +SET skip_replication= 1; +INSERT INTO t1(a) VALUES (1); +SET skip_replication= 0; +INSERT INTO t1(a) VALUES (2); +include/save_master_pos.inc +connection slave; +include/sync_io_with_master.inc +STOP SLAVE IO_THREAD; +SET GLOBAL replicate_events_marked_for_skip=REPLICATE; +START SLAVE; +connection master; +connection slave; +connection slave; +SELECT * FROM t1 ORDER BY a; +a b +1 NULL +2 NULL +connection master; +SET skip_replication=0; +DROP TABLE t1,t2; +connection slave; +STOP SLAVE; +SET GLOBAL replicate_events_marked_for_skip=REPLICATE; +START SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_skip_replication.test b/mysql-test/suite/binlog_encryption/rpl_skip_replication.test new file mode 100644 index 00000000000..e7b52f2fadb --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_skip_replication.test @@ -0,0 +1,2 @@ +--let $use_remote_mysqlbinlog= 1 +--source extra/rpl_tests/rpl_skip_replication.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_special_charset.opt b/mysql-test/suite/binlog_encryption/rpl_special_charset.opt new file mode 100644 index 00000000000..b071fb20845 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_special_charset.opt @@ -0,0 +1 @@ +--character-set-server=utf16 diff --git a/mysql-test/suite/binlog_encryption/rpl_special_charset.result b/mysql-test/suite/binlog_encryption/rpl_special_charset.result new file mode 100644 index 00000000000..218ced9b8ea --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_special_charset.result @@ -0,0 +1,10 @@ +include/master-slave.inc +[connection master] +call mtr.add_suppression("Cannot use utf16 as character_set_client"); +CREATE TABLE t1(i VARCHAR(20)); +INSERT INTO t1 VALUES (0xFFFF); +connection slave; +include/diff_tables.inc [master:t1, slave:t1] +connection master; +DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_special_charset.test b/mysql-test/suite/binlog_encryption/rpl_special_charset.test new file mode 100644 index 00000000000..6f196005711 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_special_charset.test @@ -0,0 +1 @@ +--source extra/rpl_tests/rpl_special_charset.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_sporadic_master-master.opt b/mysql-test/suite/binlog_encryption/rpl_sporadic_master-master.opt new file mode 100644 index 00000000000..5f038b69bb7 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_sporadic_master-master.opt @@ -0,0 +1 @@ +--debug-sporadic-binlog-dump-fail --debug-max-binlog-dump-events=2 diff --git a/mysql-test/suite/binlog_encryption/rpl_sporadic_master.result b/mysql-test/suite/binlog_encryption/rpl_sporadic_master.result new file mode 100644 index 00000000000..32ae63750a7 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_sporadic_master.result @@ -0,0 +1,28 @@ +include/master-slave.inc +[connection master] +create table t2(n int); +create table t1(n int not null auto_increment primary key); +insert into t1 values (NULL),(NULL); +truncate table t1; +insert into t1 values (4),(NULL); +connection slave; +include/stop_slave.inc +include/start_slave.inc +connection master; +insert into t1 values (NULL),(NULL); +flush logs; +truncate table t1; +insert into t1 values (10),(NULL),(NULL),(NULL),(NULL),(NULL); +connection slave; +select * from t1 ORDER BY n; +n +10 +11 +12 +13 +14 +15 +connection master; +drop table t1,t2; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_sporadic_master.test b/mysql-test/suite/binlog_encryption/rpl_sporadic_master.test new file mode 100644 index 00000000000..0a756982047 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_sporadic_master.test @@ -0,0 +1 @@ +--source extra/rpl_tests/rpl_sporadic_master.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_ssl.result b/mysql-test/suite/binlog_encryption/rpl_ssl.result new file mode 100644 index 00000000000..0b3a6cd0eca --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_ssl.result @@ -0,0 +1,55 @@ +include/master-slave.inc +[connection master] +connection master; +create user replssl@localhost; +grant replication slave on *.* to replssl@localhost require ssl; +create table t1 (t int auto_increment, KEY(t)); +connection slave; +stop slave; +change master to +master_user='replssl', +master_password='', +master_ssl=1, +master_ssl_ca ='MYSQL_TEST_DIR/std_data/cacert.pem', +master_ssl_cert='MYSQL_TEST_DIR/std_data/client-cert.pem', +master_ssl_key='MYSQL_TEST_DIR/std_data/client-key.pem'; +start slave; +connection master; +insert into t1 values(1); +connection slave; +select * from t1; +t +1 +Master_SSL_Allowed = 'Yes' +Master_SSL_CA_Path = '' +Master_SSL_CA_File = 'MYSQL_TEST_DIR/std_data/cacert.pem' +Master_SSL_Cert = 'MYSQL_TEST_DIR/std_data/client-cert.pem' +Master_SSL_Key = 'MYSQL_TEST_DIR/std_data/client-key.pem' +include/check_slave_is_running.inc +STOP SLAVE; +select * from t1; +t +1 +connection master; +insert into t1 values (NULL); +connection slave; +include/wait_for_slave_to_start.inc +Master_SSL_Allowed = 'Yes' +Master_SSL_CA_Path = '' +Master_SSL_CA_File = 'MYSQL_TEST_DIR/std_data/cacert.pem' +Master_SSL_Cert = 'MYSQL_TEST_DIR/std_data/client-cert.pem' +Master_SSL_Key = 'MYSQL_TEST_DIR/std_data/client-key.pem' +include/check_slave_is_running.inc +connection master; +drop user replssl@localhost; +drop table t1; +connection slave; +include/stop_slave.inc +CHANGE MASTER TO +master_user = 'root', +master_ssl = 0, +master_ssl_ca = '', +master_ssl_cert = '', +master_ssl_key = ''; +End of 5.0 tests +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_ssl.test b/mysql-test/suite/binlog_encryption/rpl_ssl.test new file mode 100644 index 00000000000..883b367e9f2 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_ssl.test @@ -0,0 +1 @@ +--source extra/rpl_tests/rpl_ssl.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_stm_relay_ign_space-slave.opt b/mysql-test/suite/binlog_encryption/rpl_stm_relay_ign_space-slave.opt new file mode 100644 index 00000000000..f780540aba8 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_stm_relay_ign_space-slave.opt @@ -0,0 +1 @@ +--relay-log-space-limit=8192 --relay-log-purge --max-relay-log-size=4096 diff --git a/mysql-test/suite/binlog_encryption/rpl_stm_relay_ign_space.result b/mysql-test/suite/binlog_encryption/rpl_stm_relay_ign_space.result new file mode 100644 index 00000000000..3113eec9e10 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_stm_relay_ign_space.result @@ -0,0 +1,6 @@ +include/master-slave.inc +[connection master] +include/assert.inc [Assert that relay log space is close to the limit] +include/diff_tables.inc [master:test.t1,slave:test.t1] +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_stm_relay_ign_space.test b/mysql-test/suite/binlog_encryption/rpl_stm_relay_ign_space.test new file mode 100644 index 00000000000..f72300ee2de --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_stm_relay_ign_space.test @@ -0,0 +1 @@ +--source extra/rpl_tests/rpl_stm_relay_ign_space.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_switch_stm_row_mixed.result b/mysql-test/suite/binlog_encryption/rpl_switch_stm_row_mixed.result new file mode 100644 index 00000000000..6c709945111 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_switch_stm_row_mixed.result @@ -0,0 +1,458 @@ +include/master-slave.inc +[connection master] +connection slave; +connection master; +drop database if exists mysqltest1; +create database mysqltest1; +use mysqltest1; +set @my_binlog_format= @@global.binlog_format; +set session binlog_format=mixed; +show session variables like "binlog_format%"; +Variable_name Value +binlog_format MIXED +set session binlog_format=statement; +show session variables like "binlog_format%"; +Variable_name Value +binlog_format STATEMENT +set session binlog_format=row; +show session variables like "binlog_format%"; +Variable_name Value +binlog_format ROW +set global binlog_format=DEFAULT; +show global variables like "binlog_format%"; +Variable_name Value +binlog_format STATEMENT +set global binlog_format=MIXED; +show global variables like "binlog_format%"; +Variable_name Value +binlog_format MIXED +set global binlog_format=STATEMENT; +show global variables like "binlog_format%"; +Variable_name Value +binlog_format STATEMENT +set global binlog_format=ROW; +show global variables like "binlog_format%"; +Variable_name Value +binlog_format ROW +show session variables like "binlog_format%"; +Variable_name Value +binlog_format ROW +select @@global.binlog_format, @@session.binlog_format; +@@global.binlog_format @@session.binlog_format +ROW ROW +CREATE TABLE t1 (a varchar(100)); +prepare stmt1 from 'insert into t1 select concat(UUID(),?)'; +set @string="emergency_1_"; +insert into t1 values("work_2_"); +execute stmt1 using @string; +deallocate prepare stmt1; +prepare stmt1 from 'insert into t1 select ?'; +insert into t1 values(concat(UUID(),"work_3_")); +execute stmt1 using @string; +deallocate prepare stmt1; +insert into t1 values(concat("for_4_",UUID())); +insert into t1 select "yesterday_5_"; +create temporary table tmp(a char(100)); +insert into tmp values("see_6_"); +set binlog_format=statement; +ERROR HY000: Cannot switch out of the row-based binary log format when the session has open temporary tables +insert into t1 select * from tmp; +drop temporary table tmp; +set binlog_format=statement; +show global variables like "binlog_format%"; +Variable_name Value +binlog_format ROW +show session variables like "binlog_format%"; +Variable_name Value +binlog_format STATEMENT +select @@global.binlog_format, @@session.binlog_format; +@@global.binlog_format @@session.binlog_format +ROW STATEMENT +set global binlog_format=statement; +show global variables like "binlog_format%"; +Variable_name Value +binlog_format STATEMENT +show session variables like "binlog_format%"; +Variable_name Value +binlog_format STATEMENT +select @@global.binlog_format, @@session.binlog_format; +@@global.binlog_format @@session.binlog_format +STATEMENT STATEMENT +prepare stmt1 from 'insert into t1 select ?'; +set @string="emergency_7_"; +insert into t1 values("work_8_"); +execute stmt1 using @string; +deallocate prepare stmt1; +prepare stmt1 from 'insert into t1 select ?'; +insert into t1 values("work_9_"); +execute stmt1 using @string; +deallocate prepare stmt1; +insert into t1 values("for_10_"); +insert into t1 select "yesterday_11_"; +set binlog_format=statement; +select @@global.binlog_format, @@session.binlog_format; +@@global.binlog_format @@session.binlog_format +STATEMENT STATEMENT +set global binlog_format=statement; +select @@global.binlog_format, @@session.binlog_format; +@@global.binlog_format @@session.binlog_format +STATEMENT STATEMENT +prepare stmt1 from 'insert into t1 select ?'; +set @string="emergency_12_"; +insert into t1 values("work_13_"); +execute stmt1 using @string; +deallocate prepare stmt1; +prepare stmt1 from 'insert into t1 select ?'; +insert into t1 values("work_14_"); +execute stmt1 using @string; +deallocate prepare stmt1; +insert into t1 values("for_15_"); +insert into t1 select "yesterday_16_"; +set global binlog_format=mixed; +select @@global.binlog_format, @@session.binlog_format; +@@global.binlog_format @@session.binlog_format +MIXED STATEMENT +set binlog_format=default; +select @@global.binlog_format, @@session.binlog_format; +@@global.binlog_format @@session.binlog_format +MIXED MIXED +prepare stmt1 from 'insert into t1 select concat(UUID(),?)'; +set @string="emergency_17_"; +insert into t1 values("work_18_"); +execute stmt1 using @string; +deallocate prepare stmt1; +prepare stmt1 from 'insert into t1 select ?'; +insert into t1 values(concat(UUID(),"work_19_")); +execute stmt1 using @string; +deallocate prepare stmt1; +insert into t1 values(concat("for_20_",UUID())); +insert into t1 select "yesterday_21_"; +prepare stmt1 from 'insert into t1 select ?'; +insert into t1 values(concat(UUID(),"work_22_")); +execute stmt1 using @string; +deallocate prepare stmt1; +insert into t1 values(concat("for_23_",UUID())); +insert into t1 select "yesterday_24_"; +create table t2 ENGINE=MyISAM select rpad(UUID(),100,' '); +create table t3 select 1 union select UUID(); +create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3); +create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3); +Warnings: +Warning 1292 Incorrect datetime value: '3' +insert into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4); +create procedure foo() +begin +insert into t1 values("work_25_"); +insert into t1 values(concat("for_26_",UUID())); +insert into t1 select "yesterday_27_"; +end| +create procedure foo2() +begin +insert into t1 values(concat("emergency_28_",UUID())); +insert into t1 values("work_29_"); +insert into t1 values(concat("for_30_",UUID())); +set session binlog_format=row; # accepted for stored procs +insert into t1 values("more work_31_"); +set session binlog_format=mixed; +end| +create function foo3() returns bigint unsigned +begin +set session binlog_format=row; # rejected for stored funcs +insert into t1 values("alarm"); +return 100; +end| +create procedure foo4(x varchar(100)) +begin +insert into t1 values(concat("work_250_",x)); +insert into t1 select "yesterday_270_"; +end| +call foo(); +call foo2(); +call foo4("hello"); +call foo4(UUID()); +call foo4("world"); +select foo3(); +ERROR HY000: Cannot change the binary logging format inside a stored function or trigger +select * from t1 where a="alarm"; +a +drop function foo3; +create function foo3() returns bigint unsigned +begin +insert into t1 values("foo3_32_"); +call foo(); +return 100; +end| +insert into t2 select foo3(); +prepare stmt1 from 'insert into t2 select foo3()'; +execute stmt1; +execute stmt1; +deallocate prepare stmt1; +create function foo4() returns bigint unsigned +begin +insert into t2 select foo3(); +return 100; +end| +select foo4(); +foo4() +100 +prepare stmt1 from 'select foo4()'; +execute stmt1; +foo4() +100 +execute stmt1; +foo4() +100 +deallocate prepare stmt1; +create function foo5() returns bigint unsigned +begin +insert into t2 select UUID(); +return 100; +end| +select foo5(); +foo5() +100 +prepare stmt1 from 'select foo5()'; +execute stmt1; +foo5() +100 +execute stmt1; +foo5() +100 +deallocate prepare stmt1; +create function foo6(x varchar(100)) returns bigint unsigned +begin +insert into t2 select x; +return 100; +end| +select foo6("foo6_1_"); +foo6("foo6_1_") +100 +select foo6(concat("foo6_2_",UUID())); +foo6(concat("foo6_2_",UUID())) +100 +prepare stmt1 from 'select foo6(concat("foo6_3_",UUID()))'; +execute stmt1; +foo6(concat("foo6_3_",UUID())) +100 +execute stmt1; +foo6(concat("foo6_3_",UUID())) +100 +deallocate prepare stmt1; +create view v1 as select uuid(); +create table t11 (data varchar(255)); +insert into t11 select * from v1; +insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11'); +prepare stmt1 from "insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')"; +execute stmt1; +execute stmt1; +deallocate prepare stmt1; +create trigger t11_bi before insert on t11 for each row +begin +set NEW.data = concat(NEW.data,UUID()); +end| +insert into t11 values("try_560_"); +insert delayed into t2 values("delay_1_"); +insert delayed into t2 values(concat("delay_2_",UUID())); +insert delayed into t2 values("delay_6_"); +insert delayed into t2 values(rand()); +set @a=2.345; +insert delayed into t2 values(@a); +connection slave; +connection master; +create table t20 select * from t1; +create table t21 select * from t2; +create table t22 select * from t3; +drop table t1,t2,t3; +create table t1 (a int primary key auto_increment, b varchar(100)); +create table t2 (a int primary key auto_increment, b varchar(100)); +create table t3 (b varchar(100)); +create function f (x varchar(100)) returns int deterministic +begin +insert into t1 values(null,x); +insert into t2 values(null,x); +return 1; +end| +select f("try_41_"); +f("try_41_") +1 +connection slave; +use mysqltest1; +insert into t2 values(2,null),(3,null),(4,null); +delete from t2 where a>=2; +connection master; +select f("try_42_"); +f("try_42_") +1 +connection slave; +insert into t2 values(3,null),(4,null); +delete from t2 where a>=3; +connection master; +prepare stmt1 from 'select f(?)'; +set @string="try_43_"; +insert into t1 values(null,"try_44_"); +execute stmt1 using @string; +f(?) +1 +deallocate prepare stmt1; +connection slave; +connection master; +create table t12 select * from t1; +drop table t1; +create table t1 (a int, b varchar(100), key(a)); +select f("try_45_"); +f("try_45_") +1 +create table t13 select * from t1; +drop table t1; +create table t1 (a int primary key auto_increment, b varchar(100)); +drop function f; +create table t14 (unique (a)) select * from t2; +truncate table t2; +create function f1 (x varchar(100)) returns int deterministic +begin +insert into t1 values(null,x); +return 1; +end| +create function f2 (x varchar(100)) returns int deterministic +begin +insert into t2 values(null,x); +return 1; +end| +select f1("try_46_"),f2("try_47_"); +f1("try_46_") f2("try_47_") +1 1 +connection slave; +insert into t2 values(2,null),(3,null),(4,null); +delete from t2 where a>=2; +connection master; +select f1("try_48_"),f2("try_49_"); +f1("try_48_") f2("try_49_") +1 1 +insert into t3 values(concat("try_50_",f1("try_51_"),f2("try_52_"))); +connection slave; +connection master; +drop function f2; +create function f2 (x varchar(100)) returns int deterministic +begin +declare y int; +insert into t1 values(null,x); +set y = (select count(*) from t2); +return y; +end| +select f1("try_53_"),f2("try_54_"); +f1("try_53_") f2("try_54_") +1 3 +connection slave; +connection master; +drop function f2; +create trigger t1_bi before insert on t1 for each row +begin +insert into t2 values(null,"try_55_"); +end| +insert into t1 values(null,"try_56_"); +alter table t1 modify a int, drop primary key; +insert into t1 values(null,"try_57_"); +connection slave; +connection master; +CREATE TEMPORARY TABLE t15 SELECT UUID(); +create table t16 like t15; +INSERT INTO t16 SELECT * FROM t15; +insert into t16 values("try_65_"); +drop table t15; +insert into t16 values("try_66_"); +connection slave; +connection master; +select count(*) from t1; +count(*) +7 +select count(*) from t2; +count(*) +5 +select count(*) from t3; +count(*) +1 +select count(*) from t4; +count(*) +29 +select count(*) from t5; +count(*) +58 +select count(*) from t11; +count(*) +8 +select count(*) from t20; +count(*) +66 +select count(*) from t21; +count(*) +19 +select count(*) from t22; +count(*) +2 +select count(*) from t12; +count(*) +4 +select count(*) from t13; +count(*) +1 +select count(*) from t14; +count(*) +4 +select count(*) from t16; +count(*) +3 +connection slave; +connection master; +DROP TABLE IF EXISTS t11; +SET SESSION BINLOG_FORMAT=STATEMENT; +CREATE TABLE t11 (song VARCHAR(255)); +LOCK TABLES t11 WRITE; +SET SESSION BINLOG_FORMAT=ROW; +INSERT INTO t11 VALUES('Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict'); +SET SESSION BINLOG_FORMAT=STATEMENT; +INSERT INTO t11 VALUES('Careful With That Axe, Eugene'); +UNLOCK TABLES; +SELECT * FROM t11; +song Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict +song Careful With That Axe, Eugene +connection slave; +USE mysqltest1; +SELECT * FROM t11; +song Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict +song Careful With That Axe, Eugene +connection master; +DROP TABLE IF EXISTS t12; +SET SESSION BINLOG_FORMAT=MIXED; +CREATE TABLE t12 (data LONG); +LOCK TABLES t12 WRITE; +INSERT INTO t12 VALUES(UUID()); +UNLOCK TABLES; +connection slave; +connection master; +CREATE FUNCTION my_user() +RETURNS CHAR(64) +BEGIN +DECLARE user CHAR(64); +SELECT USER() INTO user; +RETURN user; +END $$ +CREATE FUNCTION my_current_user() +RETURNS CHAR(64) +BEGIN +DECLARE user CHAR(64); +SELECT CURRENT_USER() INTO user; +RETURN user; +END $$ +DROP TABLE IF EXISTS t13; +CREATE TABLE t13 (data CHAR(64)); +INSERT INTO t13 VALUES (USER()); +INSERT INTO t13 VALUES (my_user()); +INSERT INTO t13 VALUES (CURRENT_USER()); +INSERT INTO t13 VALUES (my_current_user()); +connection slave; +connection master; +drop database mysqltest1; +connection slave; +connection master; +set global binlog_format =@my_binlog_format; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_switch_stm_row_mixed.test b/mysql-test/suite/binlog_encryption/rpl_switch_stm_row_mixed.test new file mode 100644 index 00000000000..cd826c6be1e --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_switch_stm_row_mixed.test @@ -0,0 +1 @@ +--source extra/rpl_tests/rpl_switch_stm_row_mixed.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_sync-master.opt b/mysql-test/suite/binlog_encryption/rpl_sync-master.opt new file mode 100644 index 00000000000..04b06bfa0f2 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_sync-master.opt @@ -0,0 +1,2 @@ +--default-storage-engine=MyISAM +--loose-innodb-file-per-table=0 diff --git a/mysql-test/suite/binlog_encryption/rpl_sync-slave.opt b/mysql-test/suite/binlog_encryption/rpl_sync-slave.opt new file mode 100644 index 00000000000..2e8be18dbd7 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_sync-slave.opt @@ -0,0 +1,2 @@ +--sync-relay-log-info=1 --relay-log-recovery=1 --loose-innodb_file_format_check=1 --default-storage-engine=MyISAM --loose-innodb-file-per-table=0 +--skip-core-file --skip-slave-start diff --git a/mysql-test/suite/binlog_encryption/rpl_sync.result b/mysql-test/suite/binlog_encryption/rpl_sync.result new file mode 100644 index 00000000000..1240c446164 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_sync.result @@ -0,0 +1,53 @@ +=====Configuring the enviroment=======; +include/master-slave.inc +[connection master] +call mtr.add_suppression('Attempting backtrace'); +call mtr.add_suppression("Recovery from master pos .* and file master-bin.000001"); +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +flush tables; +CREATE TABLE t1(a INT, PRIMARY KEY(a)) engine=innodb; +insert into t1(a) values(1); +insert into t1(a) values(2); +insert into t1(a) values(3); +=====Inserting data on the master but without the SQL Thread being running=======; +connection slave; +connection slave; +include/stop_slave_sql.inc +connection master; +insert into t1(a) values(4); +insert into t1(a) values(5); +insert into t1(a) values(6); +=====Removing relay log files and crashing/recoverying the slave=======; +connection slave; +include/stop_slave_io.inc +SET SESSION debug_dbug="d,crash_before_rotate_relaylog"; +FLUSH LOGS; +ERROR HY000: Lost connection to MySQL server during query +include/rpl_reconnect.inc +=====Dumping and comparing tables=======; +include/start_slave.inc +connection master; +connection slave; +include/diff_tables.inc [master:t1,slave:t1] +=====Corrupting the master.info=======; +connection slave; +include/stop_slave.inc +connection master; +FLUSH LOGS; +insert into t1(a) values(7); +insert into t1(a) values(8); +insert into t1(a) values(9); +connection slave; +SET SESSION debug_dbug="d,crash_before_rotate_relaylog"; +FLUSH LOGS; +ERROR HY000: Lost connection to MySQL server during query +include/rpl_reconnect.inc +=====Dumping and comparing tables=======; +include/start_slave.inc +connection master; +connection slave; +include/diff_tables.inc [master:t1,slave:t1] +=====Clean up=======; +connection master; +drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_sync.test b/mysql-test/suite/binlog_encryption/rpl_sync.test new file mode 100644 index 00000000000..189dd8220ef --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_sync.test @@ -0,0 +1 @@ +--source extra/rpl_tests/rpl_sync.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_temporal_format_default_to_default.cnf b/mysql-test/suite/binlog_encryption/rpl_temporal_format_default_to_default.cnf new file mode 100644 index 00000000000..b8e22e97ae9 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_temporal_format_default_to_default.cnf @@ -0,0 +1,6 @@ +!include my.cnf + +[mysqld.2] +plugin-load-add= @ENV.FILE_KEY_MANAGEMENT_SO +loose-file-key-management-filename=@ENV.MYSQLTEST_VARDIR/std_data/keys.txt +encrypt-binlog diff --git a/mysql-test/suite/binlog_encryption/rpl_temporal_format_default_to_default.result b/mysql-test/suite/binlog_encryption/rpl_temporal_format_default_to_default.result new file mode 100644 index 00000000000..d61255c00a3 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_temporal_format_default_to_default.result @@ -0,0 +1,91 @@ +include/master-slave.inc +[connection master] +connection master; +SELECT @@global.mysql56_temporal_format AS on_master; +on_master +1 +connection slave; +SELECT @@global.mysql56_temporal_format AS on_slave; +on_slave +1 +connection master; +CREATE TABLE t1 +( +c0 TIME(0), +c1 TIME(1), +c2 TIME(2), +c3 TIME(3), +c4 TIME(4), +c5 TIME(5), +c6 TIME(6) +); +CREATE TABLE t2 +( +c0 TIMESTAMP(0), +c1 TIMESTAMP(1), +c2 TIMESTAMP(2), +c3 TIMESTAMP(3), +c4 TIMESTAMP(4), +c5 TIMESTAMP(5), +c6 TIMESTAMP(6) +); +CREATE TABLE t3 +( +c0 DATETIME(0), +c1 DATETIME(1), +c2 DATETIME(2), +c3 DATETIME(3), +c4 DATETIME(4), +c5 DATETIME(5), +c6 DATETIME(6) +); +INSERT INTO t1 VALUES ('01:01:01','01:01:01.1','01:01:01.11','01:01:01.111','01:01:01.1111','01:01:01.11111','01:01:01.111111'); +INSERT INTO t2 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111'); +INSERT INTO t3 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111'); +SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME; +TABLE_NAME TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH +t1 1 34 34 +t2 1 41 41 +t3 1 48 48 +connection slave; +connection slave; +SELECT * FROM t1;; +c0 01:01:01 +c1 01:01:01.1 +c2 01:01:01.11 +c3 01:01:01.111 +c4 01:01:01.1111 +c5 01:01:01.11111 +c6 01:01:01.111111 +SELECT * FROM t2;; +c0 2001-01-01 01:01:01 +c1 2001-01-01 01:01:01.1 +c2 2001-01-01 01:01:01.11 +c3 2001-01-01 01:01:01.111 +c4 2001-01-01 01:01:01.1111 +c5 2001-01-01 01:01:01.11111 +c6 2001-01-01 01:01:01.111111 +SELECT * FROM t3;; +c0 2001-01-01 01:01:01 +c1 2001-01-01 01:01:01.1 +c2 2001-01-01 01:01:01.11 +c3 2001-01-01 01:01:01.111 +c4 2001-01-01 01:01:01.1111 +c5 2001-01-01 01:01:01.11111 +c6 2001-01-01 01:01:01.111111 +SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME; +TABLE_NAME TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH +t1 1 34 34 +t2 1 41 41 +t3 1 48 48 +connection master; +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +connection slave; +SET @@global.mysql56_temporal_format=DEFAULT; +connection master; +SET @@global.mysql56_temporal_format=DEFAULT; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_temporal_format_default_to_default.test b/mysql-test/suite/binlog_encryption/rpl_temporal_format_default_to_default.test new file mode 100644 index 00000000000..99a70e011c4 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_temporal_format_default_to_default.test @@ -0,0 +1 @@ +--source extra/rpl_tests/rpl_temporal_format_default_to_default.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_temporal_format_mariadb53_to_mysql56.cnf b/mysql-test/suite/binlog_encryption/rpl_temporal_format_mariadb53_to_mysql56.cnf new file mode 100644 index 00000000000..b8e22e97ae9 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_temporal_format_mariadb53_to_mysql56.cnf @@ -0,0 +1,6 @@ +!include my.cnf + +[mysqld.2] +plugin-load-add= @ENV.FILE_KEY_MANAGEMENT_SO +loose-file-key-management-filename=@ENV.MYSQLTEST_VARDIR/std_data/keys.txt +encrypt-binlog diff --git a/mysql-test/suite/binlog_encryption/rpl_temporal_format_mariadb53_to_mysql56.result b/mysql-test/suite/binlog_encryption/rpl_temporal_format_mariadb53_to_mysql56.result new file mode 100644 index 00000000000..5c518163cdd --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_temporal_format_mariadb53_to_mysql56.result @@ -0,0 +1,95 @@ +include/master-slave.inc +[connection master] +connection master; +SET @@global.mysql56_temporal_format=false;; +connection slave; +SET @@global.mysql56_temporal_format=true;; +connection master; +SELECT @@global.mysql56_temporal_format AS on_master; +on_master +0 +connection slave; +SELECT @@global.mysql56_temporal_format AS on_slave; +on_slave +1 +connection master; +CREATE TABLE t1 +( +c0 TIME(0), +c1 TIME(1), +c2 TIME(2), +c3 TIME(3), +c4 TIME(4), +c5 TIME(5), +c6 TIME(6) +); +CREATE TABLE t2 +( +c0 TIMESTAMP(0), +c1 TIMESTAMP(1), +c2 TIMESTAMP(2), +c3 TIMESTAMP(3), +c4 TIMESTAMP(4), +c5 TIMESTAMP(5), +c6 TIMESTAMP(6) +); +CREATE TABLE t3 +( +c0 DATETIME(0), +c1 DATETIME(1), +c2 DATETIME(2), +c3 DATETIME(3), +c4 DATETIME(4), +c5 DATETIME(5), +c6 DATETIME(6) +); +INSERT INTO t1 VALUES ('01:01:01','01:01:01.1','01:01:01.11','01:01:01.111','01:01:01.1111','01:01:01.11111','01:01:01.111111'); +INSERT INTO t2 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111'); +INSERT INTO t3 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111'); +SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME; +TABLE_NAME TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH +t1 1 33 33 +t2 1 41 41 +t3 1 50 50 +connection slave; +connection slave; +SELECT * FROM t1;; +c0 01:01:01 +c1 01:01:01.1 +c2 01:01:01.11 +c3 01:01:01.111 +c4 01:01:01.1111 +c5 01:01:01.11111 +c6 01:01:01.111111 +SELECT * FROM t2;; +c0 2001-01-01 01:01:01 +c1 2001-01-01 01:01:01.1 +c2 2001-01-01 01:01:01.11 +c3 2001-01-01 01:01:01.111 +c4 2001-01-01 01:01:01.1111 +c5 2001-01-01 01:01:01.11111 +c6 2001-01-01 01:01:01.111111 +SELECT * FROM t3;; +c0 2001-01-01 01:01:01 +c1 2001-01-01 01:01:01.1 +c2 2001-01-01 01:01:01.11 +c3 2001-01-01 01:01:01.111 +c4 2001-01-01 01:01:01.1111 +c5 2001-01-01 01:01:01.11111 +c6 2001-01-01 01:01:01.111111 +SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME; +TABLE_NAME TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH +t1 1 34 34 +t2 1 41 41 +t3 1 48 48 +connection master; +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +connection slave; +SET @@global.mysql56_temporal_format=DEFAULT; +connection master; +SET @@global.mysql56_temporal_format=DEFAULT; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_temporal_format_mariadb53_to_mysql56.test b/mysql-test/suite/binlog_encryption/rpl_temporal_format_mariadb53_to_mysql56.test new file mode 100644 index 00000000000..1df4a48f0a9 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_temporal_format_mariadb53_to_mysql56.test @@ -0,0 +1,6 @@ +-- source include/have_binlog_format_mixed_or_statement.inc + +--let $force_master_mysql56_temporal_format=false; +--let $force_slave_mysql56_temporal_format=true; + +--source extra/rpl_tests/rpl_temporal_format_default_to_default.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_temporal_format_mysql56_to_mariadb53.cnf b/mysql-test/suite/binlog_encryption/rpl_temporal_format_mysql56_to_mariadb53.cnf new file mode 100644 index 00000000000..b8e22e97ae9 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_temporal_format_mysql56_to_mariadb53.cnf @@ -0,0 +1,6 @@ +!include my.cnf + +[mysqld.2] +plugin-load-add= @ENV.FILE_KEY_MANAGEMENT_SO +loose-file-key-management-filename=@ENV.MYSQLTEST_VARDIR/std_data/keys.txt +encrypt-binlog diff --git a/mysql-test/suite/binlog_encryption/rpl_temporal_format_mysql56_to_mariadb53.result b/mysql-test/suite/binlog_encryption/rpl_temporal_format_mysql56_to_mariadb53.result new file mode 100644 index 00000000000..9d086d340f4 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_temporal_format_mysql56_to_mariadb53.result @@ -0,0 +1,95 @@ +include/master-slave.inc +[connection master] +connection master; +SET @@global.mysql56_temporal_format=true;; +connection slave; +SET @@global.mysql56_temporal_format=false;; +connection master; +SELECT @@global.mysql56_temporal_format AS on_master; +on_master +1 +connection slave; +SELECT @@global.mysql56_temporal_format AS on_slave; +on_slave +0 +connection master; +CREATE TABLE t1 +( +c0 TIME(0), +c1 TIME(1), +c2 TIME(2), +c3 TIME(3), +c4 TIME(4), +c5 TIME(5), +c6 TIME(6) +); +CREATE TABLE t2 +( +c0 TIMESTAMP(0), +c1 TIMESTAMP(1), +c2 TIMESTAMP(2), +c3 TIMESTAMP(3), +c4 TIMESTAMP(4), +c5 TIMESTAMP(5), +c6 TIMESTAMP(6) +); +CREATE TABLE t3 +( +c0 DATETIME(0), +c1 DATETIME(1), +c2 DATETIME(2), +c3 DATETIME(3), +c4 DATETIME(4), +c5 DATETIME(5), +c6 DATETIME(6) +); +INSERT INTO t1 VALUES ('01:01:01','01:01:01.1','01:01:01.11','01:01:01.111','01:01:01.1111','01:01:01.11111','01:01:01.111111'); +INSERT INTO t2 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111'); +INSERT INTO t3 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111'); +SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME; +TABLE_NAME TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH +t1 1 34 34 +t2 1 41 41 +t3 1 48 48 +connection slave; +connection slave; +SELECT * FROM t1;; +c0 01:01:01 +c1 01:01:01.1 +c2 01:01:01.11 +c3 01:01:01.111 +c4 01:01:01.1111 +c5 01:01:01.11111 +c6 01:01:01.111111 +SELECT * FROM t2;; +c0 2001-01-01 01:01:01 +c1 2001-01-01 01:01:01.1 +c2 2001-01-01 01:01:01.11 +c3 2001-01-01 01:01:01.111 +c4 2001-01-01 01:01:01.1111 +c5 2001-01-01 01:01:01.11111 +c6 2001-01-01 01:01:01.111111 +SELECT * FROM t3;; +c0 2001-01-01 01:01:01 +c1 2001-01-01 01:01:01.1 +c2 2001-01-01 01:01:01.11 +c3 2001-01-01 01:01:01.111 +c4 2001-01-01 01:01:01.1111 +c5 2001-01-01 01:01:01.11111 +c6 2001-01-01 01:01:01.111111 +SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME; +TABLE_NAME TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH +t1 1 33 33 +t2 1 41 41 +t3 1 50 50 +connection master; +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +connection slave; +SET @@global.mysql56_temporal_format=DEFAULT; +connection master; +SET @@global.mysql56_temporal_format=DEFAULT; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_temporal_format_mysql56_to_mariadb53.test b/mysql-test/suite/binlog_encryption/rpl_temporal_format_mysql56_to_mariadb53.test new file mode 100644 index 00000000000..f7436ed6fef --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_temporal_format_mysql56_to_mariadb53.test @@ -0,0 +1,4 @@ +--let $force_master_mysql56_temporal_format=true; +--let $force_slave_mysql56_temporal_format=false; + +--source extra/rpl_tests/rpl_temporal_format_default_to_default.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_typeconv.result b/mysql-test/suite/binlog_encryption/rpl_typeconv.result new file mode 100644 index 00000000000..988962ff6f0 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_typeconv.result @@ -0,0 +1,548 @@ +include/master-slave.inc +[connection master] +connection slave; +set @saved_slave_type_conversions = @@global.slave_type_conversions; +CREATE TABLE type_conversions ( +TestNo INT AUTO_INCREMENT PRIMARY KEY, +Source TEXT, +Target TEXT, +Flags TEXT, +On_Master TEXT, +On_Slave TEXT, +Expected TEXT, +Compare INT, +Error TEXT); +SELECT @@global.slave_type_conversions; +@@global.slave_type_conversions + +SET GLOBAL SLAVE_TYPE_CONVERSIONS=''; +SELECT @@global.slave_type_conversions; +@@global.slave_type_conversions + +SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY'; +SELECT @@global.slave_type_conversions; +@@global.slave_type_conversions +ALL_NON_LOSSY +SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY'; +SELECT @@global.slave_type_conversions; +@@global.slave_type_conversions +ALL_LOSSY +SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY'; +SELECT @@global.slave_type_conversions; +@@global.slave_type_conversions +ALL_LOSSY,ALL_NON_LOSSY +SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY,NONEXISTING_BIT'; +ERROR 42000: Variable 'slave_type_conversions' can't be set to the value of 'NONEXISTING_BIT' +SELECT @@global.slave_type_conversions; +@@global.slave_type_conversions +ALL_LOSSY,ALL_NON_LOSSY +connection slave; +SET GLOBAL SLAVE_TYPE_CONVERSIONS=''; +**** Running tests with @@SLAVE_TYPE_CONVERSIONS = '' **** +include/rpl_reset.inc +connection slave; +SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY'; +**** Running tests with @@SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY' **** +include/rpl_reset.inc +connection slave; +SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY'; +**** Running tests with @@SLAVE_TYPE_CONVERSIONS = 'ALL_LOSSY' **** +include/rpl_reset.inc +connection slave; +SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY'; +**** Running tests with @@SLAVE_TYPE_CONVERSIONS = 'ALL_LOSSY,ALL_NON_LOSSY' **** +include/rpl_reset.inc +connection slave; +**** Result of conversions **** +Source_Type Target_Type All_Type_Conversion_Flags Value_On_Slave +TINYBLOB TINYBLOB +TINYBLOB BLOB +TINYBLOB MEDIUMBLOB +TINYBLOB LONGBLOB +BLOB TINYBLOB +BLOB BLOB +BLOB MEDIUMBLOB +BLOB LONGBLOB +MEDIUMBLOB TINYBLOB +MEDIUMBLOB BLOB +MEDIUMBLOB MEDIUMBLOB +MEDIUMBLOB LONGBLOB +LONGBLOB TINYBLOB +LONGBLOB BLOB +LONGBLOB MEDIUMBLOB +LONGBLOB LONGBLOB +GEOMETRY BLOB +BLOB GEOMETRY +GEOMETRY GEOMETRY +BIT(1) BIT(1) +DATE DATE +ENUM('master',' ENUM('master',' +CHAR(10) ENUM('master',' +CHAR(10) SET('master','s +ENUM('master',' CHAR(10) +SET('master','s CHAR(10) +SET('master','s SET('master','s +SET('master','s SET('master','s +SET('0','1','2' SET('0','1','2' +SET('0','1','2' SET('0','1','2' +SET('0','1','2' SET('0','1','2' +SET('0','1','2' SET('0','1','2' +TINYINT TINYINT +TINYINT SMALLINT +TINYINT MEDIUMINT +TINYINT INT +TINYINT BIGINT +SMALLINT TINYINT +SMALLINT TINYINT +SMALLINT TINYINT UNSIGNE +SMALLINT SMALLINT +SMALLINT MEDIUMINT +SMALLINT INT +SMALLINT BIGINT +MEDIUMINT TINYINT +MEDIUMINT TINYINT +MEDIUMINT TINYINT UNSIGNE +MEDIUMINT SMALLINT +MEDIUMINT MEDIUMINT +MEDIUMINT INT +MEDIUMINT BIGINT +INT TINYINT +INT TINYINT +INT TINYINT UNSIGNE +INT SMALLINT +INT MEDIUMINT +INT INT +INT BIGINT +BIGINT TINYINT +BIGINT SMALLINT +BIGINT MEDIUMINT +BIGINT INT +BIGINT BIGINT +CHAR(20) CHAR(20) +CHAR(20) CHAR(30) +CHAR(20) CHAR(10) +CHAR(20) VARCHAR(20) +CHAR(20) VARCHAR(30) +CHAR(20) VARCHAR(10) +CHAR(20) TINYTEXT +CHAR(20) TEXT +CHAR(20) MEDIUMTEXT +CHAR(20) LONGTEXT +VARCHAR(20) VARCHAR(20) +VARCHAR(20) VARCHAR(30) +VARCHAR(20) VARCHAR(10) +VARCHAR(20) CHAR(30) +VARCHAR(20) CHAR(10) +VARCHAR(20) TINYTEXT +VARCHAR(20) TEXT +VARCHAR(20) MEDIUMTEXT +VARCHAR(20) LONGTEXT +VARCHAR(500) VARCHAR(500) +VARCHAR(500) VARCHAR(510) +VARCHAR(500) VARCHAR(255) +VARCHAR(500) TINYTEXT +VARCHAR(500) TEXT +VARCHAR(500) MEDIUMTEXT +VARCHAR(500) LONGTEXT +TINYTEXT VARCHAR(500) +TEXT VARCHAR(500) +MEDIUMTEXT VARCHAR(500) +LONGTEXT VARCHAR(500) +TINYTEXT CHAR(255) +TINYTEXT CHAR(250) +TEXT CHAR(255) +MEDIUMTEXT CHAR(255) +LONGTEXT CHAR(255) +TINYTEXT TINYTEXT +TINYTEXT TEXT +TEXT TINYTEXT +DECIMAL(10,5) DECIMAL(10,5) +DECIMAL(10,5) DECIMAL(10,6) +DECIMAL(10,5) DECIMAL(11,5) +DECIMAL(10,5) DECIMAL(11,6) +DECIMAL(10,5) DECIMAL(10,4) +DECIMAL(10,5) DECIMAL(9,5) +DECIMAL(10,5) DECIMAL(9,4) +FLOAT DECIMAL(10,5) +DOUBLE DECIMAL(10,5) +DECIMAL(10,5) FLOAT +DECIMAL(10,5) DOUBLE +FLOAT FLOAT +DOUBLE DOUBLE +FLOAT DOUBLE +DOUBLE FLOAT +BIT(5) BIT(5) +BIT(5) BIT(6) +BIT(6) BIT(5) +BIT(5) BIT(12) +BIT(12) BIT(5) +TINYBLOB TINYBLOB ALL_NON_LOSSY +TINYBLOB BLOB ALL_NON_LOSSY +TINYBLOB MEDIUMBLOB ALL_NON_LOSSY +TINYBLOB LONGBLOB ALL_NON_LOSSY +BLOB TINYBLOB ALL_NON_LOSSY +BLOB BLOB ALL_NON_LOSSY +BLOB MEDIUMBLOB ALL_NON_LOSSY +BLOB LONGBLOB ALL_NON_LOSSY +MEDIUMBLOB TINYBLOB ALL_NON_LOSSY +MEDIUMBLOB BLOB ALL_NON_LOSSY +MEDIUMBLOB MEDIUMBLOB ALL_NON_LOSSY +MEDIUMBLOB LONGBLOB ALL_NON_LOSSY +LONGBLOB TINYBLOB ALL_NON_LOSSY +LONGBLOB BLOB ALL_NON_LOSSY +LONGBLOB MEDIUMBLOB ALL_NON_LOSSY +LONGBLOB LONGBLOB ALL_NON_LOSSY +GEOMETRY BLOB ALL_NON_LOSSY +BLOB GEOMETRY ALL_NON_LOSSY +GEOMETRY GEOMETRY ALL_NON_LOSSY +BIT(1) BIT(1) ALL_NON_LOSSY +DATE DATE ALL_NON_LOSSY +ENUM('master',' ENUM('master',' ALL_NON_LOSSY +CHAR(10) ENUM('master',' ALL_NON_LOSSY +CHAR(10) SET('master','s ALL_NON_LOSSY +ENUM('master',' CHAR(10) ALL_NON_LOSSY +SET('master','s CHAR(10) ALL_NON_LOSSY +SET('master','s SET('master','s ALL_NON_LOSSY +SET('master','s SET('master','s ALL_NON_LOSSY +SET('0','1','2' SET('0','1','2' ALL_NON_LOSSY +SET('0','1','2' SET('0','1','2' ALL_NON_LOSSY +SET('0','1','2' SET('0','1','2' ALL_NON_LOSSY +SET('0','1','2' SET('0','1','2' ALL_NON_LOSSY +TINYINT TINYINT ALL_NON_LOSSY +TINYINT SMALLINT ALL_NON_LOSSY +TINYINT MEDIUMINT ALL_NON_LOSSY +TINYINT INT ALL_NON_LOSSY +TINYINT BIGINT ALL_NON_LOSSY +SMALLINT TINYINT ALL_NON_LOSSY +SMALLINT TINYINT ALL_NON_LOSSY +SMALLINT TINYINT UNSIGNE ALL_NON_LOSSY +SMALLINT SMALLINT ALL_NON_LOSSY +SMALLINT MEDIUMINT ALL_NON_LOSSY +SMALLINT INT ALL_NON_LOSSY +SMALLINT BIGINT ALL_NON_LOSSY +MEDIUMINT TINYINT ALL_NON_LOSSY +MEDIUMINT TINYINT ALL_NON_LOSSY +MEDIUMINT TINYINT UNSIGNE ALL_NON_LOSSY +MEDIUMINT SMALLINT ALL_NON_LOSSY +MEDIUMINT MEDIUMINT ALL_NON_LOSSY +MEDIUMINT INT ALL_NON_LOSSY +MEDIUMINT BIGINT ALL_NON_LOSSY +INT TINYINT ALL_NON_LOSSY +INT TINYINT ALL_NON_LOSSY +INT TINYINT UNSIGNE ALL_NON_LOSSY +INT SMALLINT ALL_NON_LOSSY +INT MEDIUMINT ALL_NON_LOSSY +INT INT ALL_NON_LOSSY +INT BIGINT ALL_NON_LOSSY +BIGINT TINYINT ALL_NON_LOSSY +BIGINT SMALLINT ALL_NON_LOSSY +BIGINT MEDIUMINT ALL_NON_LOSSY +BIGINT INT ALL_NON_LOSSY +BIGINT BIGINT ALL_NON_LOSSY +CHAR(20) CHAR(20) ALL_NON_LOSSY +CHAR(20) CHAR(30) ALL_NON_LOSSY +CHAR(20) CHAR(10) ALL_NON_LOSSY +CHAR(20) VARCHAR(20) ALL_NON_LOSSY +CHAR(20) VARCHAR(30) ALL_NON_LOSSY +CHAR(20) VARCHAR(10) ALL_NON_LOSSY +CHAR(20) TINYTEXT ALL_NON_LOSSY +CHAR(20) TEXT ALL_NON_LOSSY +CHAR(20) MEDIUMTEXT ALL_NON_LOSSY +CHAR(20) LONGTEXT ALL_NON_LOSSY +VARCHAR(20) VARCHAR(20) ALL_NON_LOSSY +VARCHAR(20) VARCHAR(30) ALL_NON_LOSSY +VARCHAR(20) VARCHAR(10) ALL_NON_LOSSY +VARCHAR(20) CHAR(30) ALL_NON_LOSSY +VARCHAR(20) CHAR(10) ALL_NON_LOSSY +VARCHAR(20) TINYTEXT ALL_NON_LOSSY +VARCHAR(20) TEXT ALL_NON_LOSSY +VARCHAR(20) MEDIUMTEXT ALL_NON_LOSSY +VARCHAR(20) LONGTEXT ALL_NON_LOSSY +VARCHAR(500) VARCHAR(500) ALL_NON_LOSSY +VARCHAR(500) VARCHAR(510) ALL_NON_LOSSY +VARCHAR(500) VARCHAR(255) ALL_NON_LOSSY +VARCHAR(500) TINYTEXT ALL_NON_LOSSY +VARCHAR(500) TEXT ALL_NON_LOSSY +VARCHAR(500) MEDIUMTEXT ALL_NON_LOSSY +VARCHAR(500) LONGTEXT ALL_NON_LOSSY +TINYTEXT VARCHAR(500) ALL_NON_LOSSY +TEXT VARCHAR(500) ALL_NON_LOSSY +MEDIUMTEXT VARCHAR(500) ALL_NON_LOSSY +LONGTEXT VARCHAR(500) ALL_NON_LOSSY +TINYTEXT CHAR(255) ALL_NON_LOSSY +TINYTEXT CHAR(250) ALL_NON_LOSSY +TEXT CHAR(255) ALL_NON_LOSSY +MEDIUMTEXT CHAR(255) ALL_NON_LOSSY +LONGTEXT CHAR(255) ALL_NON_LOSSY +TINYTEXT TINYTEXT ALL_NON_LOSSY +TINYTEXT TEXT ALL_NON_LOSSY +TEXT TINYTEXT ALL_NON_LOSSY +DECIMAL(10,5) DECIMAL(10,5) ALL_NON_LOSSY +DECIMAL(10,5) DECIMAL(10,6) ALL_NON_LOSSY +DECIMAL(10,5) DECIMAL(11,5) ALL_NON_LOSSY +DECIMAL(10,5) DECIMAL(11,6) ALL_NON_LOSSY +DECIMAL(10,5) DECIMAL(10,4) ALL_NON_LOSSY +DECIMAL(10,5) DECIMAL(9,5) ALL_NON_LOSSY +DECIMAL(10,5) DECIMAL(9,4) ALL_NON_LOSSY +FLOAT DECIMAL(10,5) ALL_NON_LOSSY +DOUBLE DECIMAL(10,5) ALL_NON_LOSSY +DECIMAL(10,5) FLOAT ALL_NON_LOSSY +DECIMAL(10,5) DOUBLE ALL_NON_LOSSY +FLOAT FLOAT ALL_NON_LOSSY +DOUBLE DOUBLE ALL_NON_LOSSY +FLOAT DOUBLE ALL_NON_LOSSY +DOUBLE FLOAT ALL_NON_LOSSY +BIT(5) BIT(5) ALL_NON_LOSSY +BIT(5) BIT(6) ALL_NON_LOSSY +BIT(6) BIT(5) ALL_NON_LOSSY +BIT(5) BIT(12) ALL_NON_LOSSY +BIT(12) BIT(5) ALL_NON_LOSSY +TINYBLOB TINYBLOB ALL_LOSSY +TINYBLOB BLOB ALL_LOSSY +TINYBLOB MEDIUMBLOB ALL_LOSSY +TINYBLOB LONGBLOB ALL_LOSSY +BLOB TINYBLOB ALL_LOSSY +BLOB BLOB ALL_LOSSY +BLOB MEDIUMBLOB ALL_LOSSY +BLOB LONGBLOB ALL_LOSSY +MEDIUMBLOB TINYBLOB ALL_LOSSY +MEDIUMBLOB BLOB ALL_LOSSY +MEDIUMBLOB MEDIUMBLOB ALL_LOSSY +MEDIUMBLOB LONGBLOB ALL_LOSSY +LONGBLOB TINYBLOB ALL_LOSSY +LONGBLOB BLOB ALL_LOSSY +LONGBLOB MEDIUMBLOB ALL_LOSSY +LONGBLOB LONGBLOB ALL_LOSSY +GEOMETRY BLOB ALL_LOSSY +BLOB GEOMETRY ALL_LOSSY +GEOMETRY GEOMETRY ALL_LOSSY +BIT(1) BIT(1) ALL_LOSSY +DATE DATE ALL_LOSSY +ENUM('master',' ENUM('master',' ALL_LOSSY +CHAR(10) ENUM('master',' ALL_LOSSY +CHAR(10) SET('master','s ALL_LOSSY +ENUM('master',' CHAR(10) ALL_LOSSY +SET('master','s CHAR(10) ALL_LOSSY +SET('master','s SET('master','s ALL_LOSSY +SET('master','s SET('master','s ALL_LOSSY +SET('0','1','2' SET('0','1','2' ALL_LOSSY +SET('0','1','2' SET('0','1','2' ALL_LOSSY +SET('0','1','2' SET('0','1','2' ALL_LOSSY +SET('0','1','2' SET('0','1','2' ALL_LOSSY +TINYINT TINYINT ALL_LOSSY +TINYINT SMALLINT ALL_LOSSY +TINYINT MEDIUMINT ALL_LOSSY +TINYINT INT ALL_LOSSY +TINYINT BIGINT ALL_LOSSY +SMALLINT TINYINT ALL_LOSSY +SMALLINT TINYINT ALL_LOSSY +SMALLINT TINYINT UNSIGNE ALL_LOSSY +SMALLINT SMALLINT ALL_LOSSY +SMALLINT MEDIUMINT ALL_LOSSY +SMALLINT INT ALL_LOSSY +SMALLINT BIGINT ALL_LOSSY +MEDIUMINT TINYINT ALL_LOSSY +MEDIUMINT TINYINT ALL_LOSSY +MEDIUMINT TINYINT UNSIGNE ALL_LOSSY +MEDIUMINT SMALLINT ALL_LOSSY +MEDIUMINT MEDIUMINT ALL_LOSSY +MEDIUMINT INT ALL_LOSSY +MEDIUMINT BIGINT ALL_LOSSY +INT TINYINT ALL_LOSSY +INT TINYINT ALL_LOSSY +INT TINYINT UNSIGNE ALL_LOSSY +INT SMALLINT ALL_LOSSY +INT MEDIUMINT ALL_LOSSY +INT INT ALL_LOSSY +INT BIGINT ALL_LOSSY +BIGINT TINYINT ALL_LOSSY +BIGINT SMALLINT ALL_LOSSY +BIGINT MEDIUMINT ALL_LOSSY +BIGINT INT ALL_LOSSY +BIGINT BIGINT ALL_LOSSY +CHAR(20) CHAR(20) ALL_LOSSY +CHAR(20) CHAR(30) ALL_LOSSY +CHAR(20) CHAR(10) ALL_LOSSY +CHAR(20) VARCHAR(20) ALL_LOSSY +CHAR(20) VARCHAR(30) ALL_LOSSY +CHAR(20) VARCHAR(10) ALL_LOSSY +CHAR(20) TINYTEXT ALL_LOSSY +CHAR(20) TEXT ALL_LOSSY +CHAR(20) MEDIUMTEXT ALL_LOSSY +CHAR(20) LONGTEXT ALL_LOSSY +VARCHAR(20) VARCHAR(20) ALL_LOSSY +VARCHAR(20) VARCHAR(30) ALL_LOSSY +VARCHAR(20) VARCHAR(10) ALL_LOSSY +VARCHAR(20) CHAR(30) ALL_LOSSY +VARCHAR(20) CHAR(10) ALL_LOSSY +VARCHAR(20) TINYTEXT ALL_LOSSY +VARCHAR(20) TEXT ALL_LOSSY +VARCHAR(20) MEDIUMTEXT ALL_LOSSY +VARCHAR(20) LONGTEXT ALL_LOSSY +VARCHAR(500) VARCHAR(500) ALL_LOSSY +VARCHAR(500) VARCHAR(510) ALL_LOSSY +VARCHAR(500) VARCHAR(255) ALL_LOSSY +VARCHAR(500) TINYTEXT ALL_LOSSY +VARCHAR(500) TEXT ALL_LOSSY +VARCHAR(500) MEDIUMTEXT ALL_LOSSY +VARCHAR(500) LONGTEXT ALL_LOSSY +TINYTEXT VARCHAR(500) ALL_LOSSY +TEXT VARCHAR(500) ALL_LOSSY +MEDIUMTEXT VARCHAR(500) ALL_LOSSY +LONGTEXT VARCHAR(500) ALL_LOSSY +TINYTEXT CHAR(255) ALL_LOSSY +TINYTEXT CHAR(250) ALL_LOSSY +TEXT CHAR(255) ALL_LOSSY +MEDIUMTEXT CHAR(255) ALL_LOSSY +LONGTEXT CHAR(255) ALL_LOSSY +TINYTEXT TINYTEXT ALL_LOSSY +TINYTEXT TEXT ALL_LOSSY +TEXT TINYTEXT ALL_LOSSY +DECIMAL(10,5) DECIMAL(10,5) ALL_LOSSY +DECIMAL(10,5) DECIMAL(10,6) ALL_LOSSY +DECIMAL(10,5) DECIMAL(11,5) ALL_LOSSY +DECIMAL(10,5) DECIMAL(11,6) ALL_LOSSY +DECIMAL(10,5) DECIMAL(10,4) ALL_LOSSY +DECIMAL(10,5) DECIMAL(9,5) ALL_LOSSY +DECIMAL(10,5) DECIMAL(9,4) ALL_LOSSY +FLOAT DECIMAL(10,5) ALL_LOSSY +DOUBLE DECIMAL(10,5) ALL_LOSSY +DECIMAL(10,5) FLOAT ALL_LOSSY +DECIMAL(10,5) DOUBLE ALL_LOSSY +FLOAT FLOAT ALL_LOSSY +DOUBLE DOUBLE ALL_LOSSY +FLOAT DOUBLE ALL_LOSSY +DOUBLE FLOAT ALL_LOSSY +BIT(5) BIT(5) ALL_LOSSY +BIT(5) BIT(6) ALL_LOSSY +BIT(6) BIT(5) ALL_LOSSY +BIT(5) BIT(12) ALL_LOSSY +BIT(12) BIT(5) ALL_LOSSY +TINYBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY +TINYBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY +TINYBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY +TINYBLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY +BLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY +BLOB BLOB ALL_LOSSY,ALL_NON_LOSSY +BLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY +BLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY +MEDIUMBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY +MEDIUMBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY +MEDIUMBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY +MEDIUMBLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY +LONGBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY +LONGBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY +LONGBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY +LONGBLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY +GEOMETRY BLOB ALL_LOSSY,ALL_NON_LOSSY +BLOB GEOMETRY ALL_LOSSY,ALL_NON_LOSSY +GEOMETRY GEOMETRY ALL_LOSSY,ALL_NON_LOSSY +BIT(1) BIT(1) ALL_LOSSY,ALL_NON_LOSSY +DATE DATE ALL_LOSSY,ALL_NON_LOSSY +ENUM('master',' ENUM('master',' ALL_LOSSY,ALL_NON_LOSSY +CHAR(10) ENUM('master',' ALL_LOSSY,ALL_NON_LOSSY +CHAR(10) SET('master','s ALL_LOSSY,ALL_NON_LOSSY +ENUM('master',' CHAR(10) ALL_LOSSY,ALL_NON_LOSSY +SET('master','s CHAR(10) ALL_LOSSY,ALL_NON_LOSSY +SET('master','s SET('master','s ALL_LOSSY,ALL_NON_LOSSY +SET('master','s SET('master','s ALL_LOSSY,ALL_NON_LOSSY +SET('0','1','2' SET('0','1','2' ALL_LOSSY,ALL_NON_LOSSY +SET('0','1','2' SET('0','1','2' ALL_LOSSY,ALL_NON_LOSSY +SET('0','1','2' SET('0','1','2' ALL_LOSSY,ALL_NON_LOSSY +SET('0','1','2' SET('0','1','2' ALL_LOSSY,ALL_NON_LOSSY +TINYINT TINYINT ALL_LOSSY,ALL_NON_LOSSY +TINYINT SMALLINT ALL_LOSSY,ALL_NON_LOSSY +TINYINT MEDIUMINT ALL_LOSSY,ALL_NON_LOSSY +TINYINT INT ALL_LOSSY,ALL_NON_LOSSY +TINYINT BIGINT ALL_LOSSY,ALL_NON_LOSSY +SMALLINT TINYINT ALL_LOSSY,ALL_NON_LOSSY +SMALLINT TINYINT ALL_LOSSY,ALL_NON_LOSSY +SMALLINT TINYINT UNSIGNE ALL_LOSSY,ALL_NON_LOSSY +SMALLINT SMALLINT ALL_LOSSY,ALL_NON_LOSSY +SMALLINT MEDIUMINT ALL_LOSSY,ALL_NON_LOSSY +SMALLINT INT ALL_LOSSY,ALL_NON_LOSSY +SMALLINT BIGINT ALL_LOSSY,ALL_NON_LOSSY +MEDIUMINT TINYINT ALL_LOSSY,ALL_NON_LOSSY +MEDIUMINT TINYINT ALL_LOSSY,ALL_NON_LOSSY +MEDIUMINT TINYINT UNSIGNE ALL_LOSSY,ALL_NON_LOSSY +MEDIUMINT SMALLINT ALL_LOSSY,ALL_NON_LOSSY +MEDIUMINT MEDIUMINT ALL_LOSSY,ALL_NON_LOSSY +MEDIUMINT INT ALL_LOSSY,ALL_NON_LOSSY +MEDIUMINT BIGINT ALL_LOSSY,ALL_NON_LOSSY +INT TINYINT ALL_LOSSY,ALL_NON_LOSSY +INT TINYINT ALL_LOSSY,ALL_NON_LOSSY +INT TINYINT UNSIGNE ALL_LOSSY,ALL_NON_LOSSY +INT SMALLINT ALL_LOSSY,ALL_NON_LOSSY +INT MEDIUMINT ALL_LOSSY,ALL_NON_LOSSY +INT INT ALL_LOSSY,ALL_NON_LOSSY +INT BIGINT ALL_LOSSY,ALL_NON_LOSSY +BIGINT TINYINT ALL_LOSSY,ALL_NON_LOSSY +BIGINT SMALLINT ALL_LOSSY,ALL_NON_LOSSY +BIGINT MEDIUMINT ALL_LOSSY,ALL_NON_LOSSY +BIGINT INT ALL_LOSSY,ALL_NON_LOSSY +BIGINT BIGINT ALL_LOSSY,ALL_NON_LOSSY +CHAR(20) CHAR(20) ALL_LOSSY,ALL_NON_LOSSY +CHAR(20) CHAR(30) ALL_LOSSY,ALL_NON_LOSSY +CHAR(20) CHAR(10) ALL_LOSSY,ALL_NON_LOSSY +CHAR(20) VARCHAR(20) ALL_LOSSY,ALL_NON_LOSSY +CHAR(20) VARCHAR(30) ALL_LOSSY,ALL_NON_LOSSY +CHAR(20) VARCHAR(10) ALL_LOSSY,ALL_NON_LOSSY +CHAR(20) TINYTEXT ALL_LOSSY,ALL_NON_LOSSY +CHAR(20) TEXT ALL_LOSSY,ALL_NON_LOSSY +CHAR(20) MEDIUMTEXT ALL_LOSSY,ALL_NON_LOSSY +CHAR(20) LONGTEXT ALL_LOSSY,ALL_NON_LOSSY +VARCHAR(20) VARCHAR(20) ALL_LOSSY,ALL_NON_LOSSY +VARCHAR(20) VARCHAR(30) ALL_LOSSY,ALL_NON_LOSSY +VARCHAR(20) VARCHAR(10) ALL_LOSSY,ALL_NON_LOSSY +VARCHAR(20) CHAR(30) ALL_LOSSY,ALL_NON_LOSSY +VARCHAR(20) CHAR(10) ALL_LOSSY,ALL_NON_LOSSY +VARCHAR(20) TINYTEXT ALL_LOSSY,ALL_NON_LOSSY +VARCHAR(20) TEXT ALL_LOSSY,ALL_NON_LOSSY +VARCHAR(20) MEDIUMTEXT ALL_LOSSY,ALL_NON_LOSSY +VARCHAR(20) LONGTEXT ALL_LOSSY,ALL_NON_LOSSY +VARCHAR(500) VARCHAR(500) ALL_LOSSY,ALL_NON_LOSSY +VARCHAR(500) VARCHAR(510) ALL_LOSSY,ALL_NON_LOSSY +VARCHAR(500) VARCHAR(255) ALL_LOSSY,ALL_NON_LOSSY +VARCHAR(500) TINYTEXT ALL_LOSSY,ALL_NON_LOSSY +VARCHAR(500) TEXT ALL_LOSSY,ALL_NON_LOSSY +VARCHAR(500) MEDIUMTEXT ALL_LOSSY,ALL_NON_LOSSY +VARCHAR(500) LONGTEXT ALL_LOSSY,ALL_NON_LOSSY +TINYTEXT VARCHAR(500) ALL_LOSSY,ALL_NON_LOSSY +TEXT VARCHAR(500) ALL_LOSSY,ALL_NON_LOSSY +MEDIUMTEXT VARCHAR(500) ALL_LOSSY,ALL_NON_LOSSY +LONGTEXT VARCHAR(500) ALL_LOSSY,ALL_NON_LOSSY +TINYTEXT CHAR(255) ALL_LOSSY,ALL_NON_LOSSY +TINYTEXT CHAR(250) ALL_LOSSY,ALL_NON_LOSSY +TEXT CHAR(255) ALL_LOSSY,ALL_NON_LOSSY +MEDIUMTEXT CHAR(255) ALL_LOSSY,ALL_NON_LOSSY +LONGTEXT CHAR(255) ALL_LOSSY,ALL_NON_LOSSY +TINYTEXT TINYTEXT ALL_LOSSY,ALL_NON_LOSSY +TINYTEXT TEXT ALL_LOSSY,ALL_NON_LOSSY +TEXT TINYTEXT ALL_LOSSY,ALL_NON_LOSSY +DECIMAL(10,5) DECIMAL(10,5) ALL_LOSSY,ALL_NON_LOSSY +DECIMAL(10,5) DECIMAL(10,6) ALL_LOSSY,ALL_NON_LOSSY +DECIMAL(10,5) DECIMAL(11,5) ALL_LOSSY,ALL_NON_LOSSY +DECIMAL(10,5) DECIMAL(11,6) ALL_LOSSY,ALL_NON_LOSSY +DECIMAL(10,5) DECIMAL(10,4) ALL_LOSSY,ALL_NON_LOSSY +DECIMAL(10,5) DECIMAL(9,5) ALL_LOSSY,ALL_NON_LOSSY +DECIMAL(10,5) DECIMAL(9,4) ALL_LOSSY,ALL_NON_LOSSY +FLOAT DECIMAL(10,5) ALL_LOSSY,ALL_NON_LOSSY +DOUBLE DECIMAL(10,5) ALL_LOSSY,ALL_NON_LOSSY +DECIMAL(10,5) FLOAT ALL_LOSSY,ALL_NON_LOSSY +DECIMAL(10,5) DOUBLE ALL_LOSSY,ALL_NON_LOSSY +FLOAT FLOAT ALL_LOSSY,ALL_NON_LOSSY +DOUBLE DOUBLE ALL_LOSSY,ALL_NON_LOSSY +FLOAT DOUBLE ALL_LOSSY,ALL_NON_LOSSY +DOUBLE FLOAT ALL_LOSSY,ALL_NON_LOSSY +BIT(5) BIT(5) ALL_LOSSY,ALL_NON_LOSSY +BIT(5) BIT(6) ALL_LOSSY,ALL_NON_LOSSY +BIT(6) BIT(5) ALL_LOSSY,ALL_NON_LOSSY +BIT(5) BIT(12) ALL_LOSSY,ALL_NON_LOSSY +BIT(12) BIT(5) ALL_LOSSY,ALL_NON_LOSSY +DROP TABLE type_conversions; +call mtr.add_suppression("Slave SQL.*Column 1 of table .test.t1. cannot be converted from type.* error.* 1677"); +connection master; +DROP TABLE t1; +connection slave; +set global slave_type_conversions = @saved_slave_type_conversions; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_typeconv.test b/mysql-test/suite/binlog_encryption/rpl_typeconv.test new file mode 100644 index 00000000000..4dbfc27d088 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/rpl_typeconv.test @@ -0,0 +1 @@ +--source extra/rpl_tests/rpl_typeconv.inc diff --git a/mysql-test/suite/binlog_encryption/suite.pm b/mysql-test/suite/binlog_encryption/suite.pm new file mode 100644 index 00000000000..f1d5e3aaea7 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/suite.pm @@ -0,0 +1,18 @@ +package My::Suite::BinlogEncryption; + +@ISA = qw(My::Suite); + +return "No file key management plugin" unless defined $ENV{FILE_KEY_MANAGEMENT_SO}; + +sub skip_combinations { + my @combinations; + + $skip{'encryption_algorithms.combinations'} = [ 'ctr' ] + unless $::mysqld_variables{'version-ssl-library'} =~ /OpenSSL (\S+)/ + and $1 ge "1.0.1"; + + %skip; +} + +bless { }; + diff --git a/mysql-test/suite/binlog_encryption/testdata.inc b/mysql-test/suite/binlog_encryption/testdata.inc new file mode 100644 index 00000000000..7f2b0505f44 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/testdata.inc @@ -0,0 +1,208 @@ +# +# This include file creates some basic events which should go to the binary log. +# What happens to the binary log depends on the test which calls the file, +# and should be checked from the test. +# +# Names are intentionally long and ugly, to make grepping more reliable. +# +# Some of events are considered unsafe for SBR (not necessarily correctly, +# but here isn't the place to check the logic), so we just suppress the warning. +# +# For those few queries which produce result sets (e.g. ANALYZE, CHECKSUM etc.), +# we don't care about the result, so it will not be printed to the output. + +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); + +# +# Some DDL +# + +CREATE DATABASE database_name_to_encrypt; +USE database_name_to_encrypt; + +CREATE USER user_name_to_encrypt; +GRANT ALL ON database_name_to_encrypt.* TO user_name_to_encrypt; +SET PASSWORD FOR user_name_to_encrypt = PASSWORD('password_to_encrypt'); + +CREATE TABLE innodb_table_name_to_encrypt ( + int_column_name_to_encrypt INT PRIMARY KEY, + timestamp_column_name_to_encrypt TIMESTAMP(6) NULL, + blob_column_name_to_encrypt BLOB, + virt_column_name_to_encrypt INT AS (int_column_name_to_encrypt % 10) VIRTUAL, + pers_column_name_to_encrypt INT AS (int_column_name_to_encrypt) PERSISTENT, + INDEX `index_name_to_encrypt`(`timestamp_column_name_to_encrypt`) +) ENGINE=InnoDB + PARTITION BY RANGE (int_column_name_to_encrypt) + SUBPARTITION BY KEY (int_column_name_to_encrypt) + SUBPARTITIONS 2 ( + PARTITION partition0_name_to_encrypt VALUES LESS THAN (100), + PARTITION partition1_name_to_encrypt VALUES LESS THAN (MAXVALUE) + ) +; + +CREATE TABLE myisam_table_name_to_encrypt ( + int_column_name_to_encrypt INT AUTO_INCREMENT PRIMARY KEY, + char_column_name_to_encrypt VARCHAR(255), + datetime_column_name_to_encrypt DATETIME, + text_column_name_to_encrypt TEXT +) ENGINE=MyISAM; + +CREATE TABLE aria_table_name_to_encrypt ( + int_column_name_to_encrypt INT AUTO_INCREMENT PRIMARY KEY, + varchar_column_name_to_encrypt VARCHAR(1024), + enum_column_name_to_encrypt ENUM( + 'enum_value1_to_encrypt', + 'enum_value2_to_encrypt' + ), + timestamp_column_name_to_encrypt TIMESTAMP(6) NULL, + blob_column_name_to_encrypt BLOB +) ENGINE=Aria; + +CREATE TRIGGER trigger_name_to_encrypt + AFTER INSERT ON myisam_table_name_to_encrypt FOR EACH ROW + INSERT INTO aria_table_name_to_encrypt (varchar_column_name_to_encrypt) + VALUES (NEW.char_column_name_to_encrypt); + +CREATE DEFINER=user_name_to_encrypt VIEW view_name_to_encrypt + AS SELECT * FROM innodb_table_name_to_encrypt; + +CREATE FUNCTION func_name_to_encrypt (func_parameter_to_encrypt INT) + RETURNS VARCHAR(64) + RETURN 'func_result_to_encrypt'; + +--delimiter $$ +CREATE PROCEDURE proc_name_to_encrypt ( + IN proc_in_parameter_to_encrypt CHAR(32), + OUT proc_out_parameter_to_encrypt INT +) +BEGIN + DECLARE procvar_name_to_encrypt CHAR(64) DEFAULT 'procvar_val_to_encrypt'; + DECLARE cursor_name_to_encrypt CURSOR FOR + SELECT virt_column_name_to_encrypt FROM innodb_table_name_to_encrypt; + DECLARE EXIT HANDLER FOR NOT FOUND + BEGIN + SET @stmt_var_to_encrypt = CONCAT( + "SELECT + IF (RAND()>0.5,'enum_value2_to_encrypt','enum_value1_to_encrypt') + FROM innodb_table_name_to_encrypt + INTO OUTFILE '", proc_in_parameter_to_encrypt, "'"); + PREPARE stmt_to_encrypt FROM @stmt_var_to_encrypt; + EXECUTE stmt_to_encrypt; + DEALLOCATE PREPARE stmt_to_encrypt; + END; + OPEN cursor_name_to_encrypt; + proc_label_to_encrypt: LOOP + FETCH cursor_name_to_encrypt INTO procvar_name_to_encrypt; + END LOOP; + CLOSE cursor_name_to_encrypt; +END $$ +--delimiter ; + +CREATE SERVER server_name_to_encrypt + FOREIGN DATA WRAPPER mysql + OPTIONS (HOST 'host_name_to_encrypt'); + +--let $_cur_con= $CURRENT_CONNECTION +--connect (con1,localhost,user_name_to_encrypt,password_to_encrypt,database_name_to_encrypt) +CREATE TEMPORARY TABLE tmp_table_name_to_encrypt ( + float_column_name_to_encrypt FLOAT, + binary_column_name_to_encrypt BINARY(64) +); +--disconnect con1 +--connection $_cur_con + +CREATE INDEX index_name_to_encrypt + ON myisam_table_name_to_encrypt (datetime_column_name_to_encrypt); + +ALTER DATABASE database_name_to_encrypt CHARACTER SET utf8; + +ALTER TABLE innodb_table_name_to_encrypt + MODIFY timestamp_column_name_to_encrypt TIMESTAMP NOT NULL + DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +; + +ALTER ALGORITHM=MERGE VIEW view_name_to_encrypt + AS SELECT * FROM innodb_table_name_to_encrypt; + +RENAME TABLE innodb_table_name_to_encrypt TO new_table_name_to_encrypt; +ALTER TABLE new_table_name_to_encrypt RENAME TO innodb_table_name_to_encrypt; + +# +# Some DML +# + +--disable_warnings + +set @user_var1_to_encrypt= 'dyncol1_val_to_encrypt'; +set @user_var2_to_encrypt= 'dyncol2_name_to_encrypt'; + +INSERT INTO view_name_to_encrypt VALUES + (1, NOW(6), COLUMN_CREATE('dyncol1_name_to_encrypt',@user_var1_to_encrypt), NULL, NULL), + (2, NOW(6), COLUMN_CREATE(@user_var2_to_encrypt,'dyncol2_val_to_encrypt'), NULL, NULL) +; +--delimiter $$ +BEGIN NOT ATOMIC + DECLARE counter_name_to_encrypt INT DEFAULT 0; + START TRANSACTION; + WHILE counter_name_to_encrypt<12 DO + SELECT COUNT(*) INTO @cnt FROM innodb_table_name_to_encrypt; + INSERT INTO innodb_table_name_to_encrypt + SELECT int_column_name_to_encrypt+@cnt, NOW(6), blob_column_name_to_encrypt, NULL, NULL + FROM innodb_table_name_to_encrypt + ORDER BY int_column_name_to_encrypt; + SET counter_name_to_encrypt = counter_name_to_encrypt+1; + END WHILE; + COMMIT; + END +$$ +--delimiter ; + +INSERT INTO myisam_table_name_to_encrypt + SELECT NULL, 'char_literal_to_encrypt', NULL, 'text_to_encrypt'; +INSERT INTO myisam_table_name_to_encrypt (char_column_name_to_encrypt) + SELECT char_column_name_to_encrypt FROM myisam_table_name_to_encrypt; +INSERT INTO myisam_table_name_to_encrypt (char_column_name_to_encrypt) + SELECT char_column_name_to_encrypt FROM myisam_table_name_to_encrypt; +INSERT INTO myisam_table_name_to_encrypt (char_column_name_to_encrypt) + SELECT char_column_name_to_encrypt FROM myisam_table_name_to_encrypt; + +CALL proc_name_to_encrypt('file_name_to_encrypt',@useless_var_to_encrypt); + +TRUNCATE TABLE aria_table_name_to_encrypt; + +LOAD DATA INFILE 'file_name_to_encrypt' INTO TABLE aria_table_name_to_encrypt + (enum_column_name_to_encrypt); + +--let datadir= `SELECT @@datadir` +--replace_result $datadir +eval LOAD DATA LOCAL INFILE '$datadir/database_name_to_encrypt/file_name_to_encrypt' + INTO TABLE aria_table_name_to_encrypt (enum_column_name_to_encrypt); +--remove_file $datadir/database_name_to_encrypt/file_name_to_encrypt + +UPDATE view_name_to_encrypt SET blob_column_name_to_encrypt = + COLUMN_CREATE('dyncol1_name_to_encrypt',func_name_to_encrypt(0)) +; + +DELETE FROM aria_table_name_to_encrypt ORDER BY int_column_name_to_encrypt LIMIT 10; + +--enable_warnings + +# +# Other statements +# + +--disable_result_log +ANALYZE TABLE myisam_table_name_to_encrypt; +CHECK TABLE aria_table_name_to_encrypt; +CHECKSUM TABLE innodb_table_name_to_encrypt, myisam_table_name_to_encrypt; +--enable_result_log +RENAME USER user_name_to_encrypt to new_user_name_to_encrypt; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM new_user_name_to_encrypt; + +# +# Cleanup +# + +DROP DATABASE database_name_to_encrypt; +DROP USER new_user_name_to_encrypt; +DROP SERVER server_name_to_encrypt; diff --git a/mysql-test/suite/binlog_encryption/testdata.opt b/mysql-test/suite/binlog_encryption/testdata.opt new file mode 100644 index 00000000000..b0c5b9c8188 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/testdata.opt @@ -0,0 +1 @@ +--partition diff --git a/mysql-test/suite/encryption/disabled.def b/mysql-test/suite/encryption/disabled.def index 26540e18f06..f8d7fb51865 100644 --- a/mysql-test/suite/encryption/disabled.def +++ b/mysql-test/suite/encryption/disabled.def @@ -13,4 +13,4 @@ innodb_scrub : MDEV-8139 innodb_scrub_compressed : MDEV-8139 innodb_scrub_background : MDEV-8139 -innodb_encryption_discard_import : MDEV-9099 +innochecksum: see buf_page_is_corrupted() diff --git a/mysql-test/suite/encryption/include/innodb-util.pl b/mysql-test/suite/encryption/include/innodb-util.pl new file mode 100644 index 00000000000..241545dac18 --- /dev/null +++ b/mysql-test/suite/encryption/include/innodb-util.pl @@ -0,0 +1,126 @@ +# +# Utility functions to copy files for WL#5522 +# +# All the tables must be in the same database, you can call it like so: +# ib_backup_tablespaces("test", "t1", "blah", ...). + +use File::Copy; +use File::Spec; + +sub ib_normalize_path { + my ($path) = @_; +} + +sub ib_backup_tablespace { + my ($db, $table) = @_; + my $datadir = $ENV{'MYSQLD_DATADIR'}; + my $cfg_file = sprintf("%s.cfg", $table); + my $ibd_file = sprintf("%s.ibd", $table); + my $tmpd = $ENV{'MYSQLTEST_VARDIR'} . "/tmp"; + + my @args = (File::Spec->catfile($datadir, $db, $ibd_file), + File::Spec->catfile($tmpd, $ibd_file)); + + copy(@args) or die "copy @args failed: $!"; + + my @args = (File::Spec->catfile($datadir, $db, $cfg_file), + File::Spec->catfile($tmpd, $cfg_file)); + + copy(@args) or die "copy @args failed: $!"; +} + +sub ib_cleanup { + my ($db, $table) = @_; + my $datadir = $ENV{'MYSQLD_DATADIR'}; + my $cfg_file = sprintf("%s.cfg", $table); + + print "unlink: $cfg_file\n"; + + # These may or may not exist + unlink(File::Spec->catfile($datadir, $db, $cfg_file)); +} + +sub ib_unlink_tablespace { + my ($db, $table) = @_; + my $datadir = $ENV{'MYSQLD_DATADIR'}; + my $ibd_file = sprintf("%s.ibd", $table); + + print "unlink: $ibd_file\n"; + # This may or may not exist + unlink(File::Spec->catfile($datadir, $db, $ibd_file)); + + ib_cleanup($db, $table); +} + +sub ib_backup_tablespaces { + my ($db, @tables) = @_; + + foreach my $table (@tables) { + print "backup: $table\n"; + ib_backup_tablespace($db, $table); + } +} + +sub ib_discard_tablespace { } + +sub ib_discard_tablespaces { } + +sub ib_restore_cfg_file { + my ($tmpd, $datadir, $db, $table) = @_; + my $cfg_file = sprintf("%s.cfg", $table); + + my @args = (File::Spec->catfile($tmpd, $cfg_file), + File::Spec->catfile($datadir, "$db", $cfg_file)); + + copy(@args) or die "copy @args failed: $!"; +} + +sub ib_restore_ibd_file { + my ($tmpd, $datadir, $db, $table) = @_; + my $ibd_file = sprintf("%s.ibd", $table); + + my @args = (File::Spec->catfile($tmpd, $ibd_file), + File::Spec->catfile($datadir, $db, $ibd_file)); + + copy(@args) or die "copy @args failed: $!"; +} + +sub ib_restore_tablespace { + my ($db, $table) = @_; + my $datadir = $ENV{'MYSQLD_DATADIR'}; + my $tmpd = $ENV{'MYSQLTEST_VARDIR'} . "/tmp"; + + ib_restore_cfg_file($tmpd, $datadir, $db, $table); + ib_restore_ibd_file($tmpd, $datadir, $db, $table); +} + +sub ib_restore_tablespaces { + my ($db, @tables) = @_; + + foreach my $table (@tables) { + print "restore: $table .ibd and .cfg files\n"; + ib_restore_tablespace($db, $table); + } +} + +sub ib_restore_cfg_files { + my ($db, @tables) = @_; + my $datadir = $ENV{'MYSQLD_DATADIR'}; + my $tmpd = $ENV{'MYSQLTEST_VARDIR'} . "/tmp"; + + foreach my $table (@tables) { + print "restore: $table .cfg file\n"; + ib_restore_cfg_file($tmpd, $datadir, $db, $table); + } +} + +sub ib_restore_ibd_files { + my ($db, @tables) = @_; + my $datadir = $ENV{'MYSQLD_DATADIR'}; + my $tmpd = $ENV{'MYSQLTEST_VARDIR'} . "/tmp"; + + foreach my $table (@tables) { + print "restore: $table .ibd file\n"; + ib_restore_ibd_file($tmpd, $datadir, $db, $table); + } +} diff --git a/mysql-test/suite/encryption/r/debug_key_management.result b/mysql-test/suite/encryption/r/debug_key_management.result index e185740aa25..8793e6ba363 100644 --- a/mysql-test/suite/encryption/r/debug_key_management.result +++ b/mysql-test/suite/encryption/r/debug_key_management.result @@ -9,13 +9,13 @@ innodb_encryption_threads 4 select space,name,current_key_version from information_schema.innodb_tablespaces_encryption order by space; space name current_key_version 0 NULL 1 -2 mysql/innodb_table_stats 1 -3 mysql/innodb_index_stats 1 +1 mysql/innodb_table_stats 1 +2 mysql/innodb_index_stats 1 set global debug_key_management_version=10; select space,name,current_key_version from information_schema.innodb_tablespaces_encryption order by space; space name current_key_version 0 NULL 10 -2 mysql/innodb_table_stats 10 -3 mysql/innodb_index_stats 10 +1 mysql/innodb_table_stats 10 +2 mysql/innodb_index_stats 10 set global innodb_encrypt_tables=OFF; set global debug_key_management_version=1; diff --git a/mysql-test/suite/encryption/r/encryption_force.result b/mysql-test/suite/encryption/r/encryption_force.result index de5f7da60a8..164a0067062 100644 --- a/mysql-test/suite/encryption/r/encryption_force.result +++ b/mysql-test/suite/encryption/r/encryption_force.result @@ -31,8 +31,8 @@ Table Create Table t4 CREATE TABLE `t4` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes -/*!50100 PARTITION BY HASH (a) -PARTITIONS 2 */ + PARTITION BY HASH (a) +PARTITIONS 2 alter table t1 encrypted=no; ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options") alter table t2 encrypted=yes; diff --git a/mysql-test/suite/encryption/r/filekeys_tooshort.result b/mysql-test/suite/encryption/r/filekeys_tooshort.result new file mode 100644 index 00000000000..efa66097563 --- /dev/null +++ b/mysql-test/suite/encryption/r/filekeys_tooshort.result @@ -0,0 +1,10 @@ +call mtr.add_suppression("Cannot decrypt .*tooshort.enc. Not encrypted"); +call mtr.add_suppression("Plugin 'file_key_management' init function returned error"); +call mtr.add_suppression("Plugin 'file_key_management' registration.*failed"); +FOUND /Cannot decrypt .*tooshort.enc. Not encrypted/ in mysqld.1.err +create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1; +ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options") +select plugin_status from information_schema.plugins +where plugin_name = 'file_key_management'; +plugin_status +# Test checks if opening an too short filekeys does not crash the server. diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change.result b/mysql-test/suite/encryption/r/innodb-bad-key-change.result index ef5b726d4cb..7c6a9d2ba83 100644 --- a/mysql-test/suite/encryption/r/innodb-bad-key-change.result +++ b/mysql-test/suite/encryption/r/innodb-bad-key-change.result @@ -39,12 +39,15 @@ SELECT * FROM t1; ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB SHOW WARNINGS; Level Code Message -Warning 192 Table test/t1 in tablespace # is encrypted but encryption service or used key_id is not available. Can't continue reading table. +Warning 192 Table test/t1 in tablespace is encrypted but encryption service or used key_id is not available. Can't continue reading table. Warning 192 Table test/t1 is encrypted but encryption service or used key_id 2 is not available. Can't continue reading table. Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB DROP TABLE t1; Warnings: -Warning 192 Table in tablespace # encrypted.However key management plugin or used key_id 1 is not found or used encryption algorithm or method does not match. Can't continue opening the table. +Warning 192 Table in tablespace encrypted.However key management plugin or used key_id 1 is not found or used encryption algorithm or method does not match. Can't continue opening the table. +SHOW WARNINGS; +Level Code Message +Warning 192 Table in tablespace encrypted.However key management plugin or used key_id 1 is not found or used encryption algorithm or method does not match. Can't continue opening the table. # Start server with keys.txt CREATE TABLE t2 (c VARCHAR(8), id int not null primary key, b int, key(b)) ENGINE=InnoDB ENCRYPTED=YES; INSERT INTO t2 VALUES ('foobar',1,2); @@ -54,7 +57,7 @@ SELECT * FROM t2; ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB SHOW WARNINGS; Level Code Message -Warning 192 is encrypted but encryption service or used key_id is not available. Can't continue reading table. +Warning 192 Table test/t2 in tablespace is encrypted but encryption service or used key_id is not available. Can't continue reading table. Warning 192 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table. Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB SELECT * FROM t2 where id = 1; diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change3.result b/mysql-test/suite/encryption/r/innodb-bad-key-change3.result index 70501986257..6f4a46b4c44 100644 --- a/mysql-test/suite/encryption/r/innodb-bad-key-change3.result +++ b/mysql-test/suite/encryption/r/innodb-bad-key-change3.result @@ -1,8 +1,6 @@ call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded."); call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue."); SET GLOBAL innodb_file_format = `Barracuda`; -Warnings: -Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html SET GLOBAL innodb_file_per_table = ON; set global innodb_compression_algorithm = 1; CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(255)) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=YES ENCRYPTION_KEY_ID=4; @@ -21,17 +19,12 @@ FLUSH TABLE t1 FOR EXPORT; t1.cfg t1.frm t1.ibd +backup: t1 UNLOCK TABLES; -# Tablespaces should be still encrypted -# t1 yes on expecting NOT FOUND -NOT FOUND /foobar/ in t1.ibd ALTER TABLE t1 DISCARD TABLESPACE; +restore: t1 .ibd and .cfg files SET GLOBAL innodb_file_format = `Barracuda`; -Warnings: -Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html SET GLOBAL innodb_file_per_table = ON; -# List after t1 DISCARD -t1.frm ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB SHOW CREATE TABLE t1; @@ -47,5 +40,3 @@ ERROR HY000: Tablespace has been discarded for table `t1` # t1 yes on expecting NOT FOUND NOT FOUND /foobar/ in t1.ibd DROP TABLE t1; -Warnings: -Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change4.result b/mysql-test/suite/encryption/r/innodb-bad-key-change4.result index 3ced393f38b..369a8c7989c 100644 --- a/mysql-test/suite/encryption/r/innodb-bad-key-change4.result +++ b/mysql-test/suite/encryption/r/innodb-bad-key-change4.result @@ -16,7 +16,7 @@ Warning 131 Using innodb_file_format is deprecated and the parameter may be remo SET GLOBAL innodb_file_per_table = ON; CHECK TABLE t1; Table Op Msg_type Msg_text -test.t1 check Warning Table test/t1 in tablespace 7 is encrypted but encryption service or used key_id is not available. Can't continue reading table. +test.t1 check Warning Table test/t1 in tablespace # is encrypted but encryption service or used key_id is not available. Can't continue reading table. test.t1 check Warning Table test/t1 is encrypted but encryption service or used key_id is not available. Can't continue checking table. test.t1 check error Corrupt SHOW WARNINGS; diff --git a/mysql-test/suite/encryption/r/innodb-discard-import-change.result b/mysql-test/suite/encryption/r/innodb-discard-import-change.result new file mode 100644 index 00000000000..2505780b70c --- /dev/null +++ b/mysql-test/suite/encryption/r/innodb-discard-import-change.result @@ -0,0 +1,105 @@ +call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded"); +SET GLOBAL innodb_file_format = `Barracuda`; +SET GLOBAL innodb_file_per_table = ON; +SET GLOBAL innodb_compression_algorithm = 1; +create table t1(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb encrypted=yes encryption_key_id=4; +create table t2(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb encrypted=yes encryption_key_id=1; +create table t3(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb page_compressed=yes; +create table t4(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb page_compressed=yes encrypted=yes encryption_key_id=4; +create table t5(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb; +insert into t1 values (NULL, 'verysecretmessage'); +insert into t1(b) select b from t1; +insert into t1(b) select b from t1; +insert into t1(b) select b from t1; +insert into t1(b) select b from t1; +insert into t1(b) select b from t1; +insert into t1(b) select b from t1; +insert into t1(b) select b from t1; +insert into t1(b) select b from t1; +insert into t2 select * from t1; +insert into t3 select * from t1; +insert into t4 select * from t1; +insert into t5 select * from t1; +FLUSH TABLE t1,t2,t3,t4,t5 FOR EXPORT; +backup: t1 +backup: t2 +backup: t3 +backup: t4 +backup: t5 +t1.cfg +t1.frm +t1.ibd +t2.cfg +t2.frm +t2.ibd +t3.cfg +t3.frm +t3.ibd +t4.cfg +t4.frm +t4.ibd +t5.cfg +t5.frm +t5.ibd +UNLOCK TABLES; +ALTER TABLE t1 DISCARD TABLESPACE; +ALTER TABLE t2 DISCARD TABLESPACE; +ALTER TABLE t3 DISCARD TABLESPACE; +ALTER TABLE t4 DISCARD TABLESPACE; +ALTER TABLE t5 DISCARD TABLESPACE; +DROP TABLE t1; +DROP TABLE t3; +DROP TABLE t4; +DROP TABLE t5; +create table t6(a int) engine=innodb; +create table t5(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb; +create table t3(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb page_compressed=yes; +create table t1(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb encrypted=yes encryption_key_id=4; +create table t4(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb page_compressed=yes encrypted=yes encryption_key_id=4; +ALTER TABLE t1 DISCARD TABLESPACE; +ALTER TABLE t3 DISCARD TABLESPACE; +ALTER TABLE t4 DISCARD TABLESPACE; +ALTER TABLE t5 DISCARD TABLESPACE; +restore: t1 .ibd and .cfg files +restore: t2 .ibd and .cfg files +restore: t3 .ibd and .cfg files +restore: t4 .ibd and .cfg files +restore: t5 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` bigint(20) NOT NULL AUTO_INCREMENT, + `b` char(200) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=504 DEFAULT CHARSET=latin1 `encrypted`=yes `encryption_key_id`=4 +SELECT COUNT(*) FROM t1; +COUNT(*) +256 +ALTER TABLE t2 IMPORT TABLESPACE; +SELECT COUNT(*) FROM t2; +COUNT(*) +256 +ALTER TABLE t3 IMPORT TABLESPACE; +SELECT COUNT(*) FROM t3; +COUNT(*) +256 +ALTER TABLE t4 IMPORT TABLESPACE; +SELECT COUNT(*) FROM t4; +COUNT(*) +256 +ALTER TABLE t5 IMPORT TABLESPACE; +SELECT COUNT(*) FROM t5; +COUNT(*) +256 +# t1 encrypted expecting NOT FOUND +NOT FOUND /verysecretmessage/ in t1.ibd +# t2 encrypted expecting NOT FOUND +NOT FOUND /verysecretmessage/ in t2.ibd +# t3 page compressed expecting NOT FOUND +NOT FOUND /verysecretmessage/ in t3.ibd +# t4 page compressed and encrypted expecting NOT FOUND +NOT FOUND /verysecretmessage/ in t4.ibd +# t5 normal expecting FOUND +FOUND /verysecretmessage/ in t5.ibd +DROP TABLE t1,t2,t3,t4,t5,t6; diff --git a/mysql-test/suite/encryption/r/innodb-discard-import.result b/mysql-test/suite/encryption/r/innodb-discard-import.result index edcacaf530a..06f4abab9f4 100644 --- a/mysql-test/suite/encryption/r/innodb-discard-import.result +++ b/mysql-test/suite/encryption/r/innodb-discard-import.result @@ -1,8 +1,6 @@ call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded."); call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue."); SET GLOBAL innodb_file_format = `Barracuda`; -Warnings: -Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_compression_algorithm = 1; create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=4; @@ -60,33 +58,32 @@ t3.ibd t4.cfg t4.frm t4.ibd +backup: t1 +backup: t2 +backup: t3 +backup: t4 +t1.cfg +t1.frm +t1.ibd +t2.cfg +t2.frm +t2.ibd +t3.cfg +t3.frm +t3.ibd +t4.cfg +t4.frm +t4.ibd UNLOCK TABLES; -# tables should be either encrypted and/or compressed -# t1 yes on expecting NOT FOUND -NOT FOUND /foobar/ in t1.ibd -# t2 yes on expecting NOT FOUND -NOT FOUND /barfoo/ in t2.ibd -# t3 yes on expecting NOT FOUND -NOT FOUND /tmpres/ in t3.ibd -# t4 yes on expecting NOT FOUND -NOT FOUND /mysql/ in t4.ibd ALTER TABLE t1 DISCARD TABLESPACE; ALTER TABLE t2 DISCARD TABLESPACE; ALTER TABLE t3 DISCARD TABLESPACE; ALTER TABLE t4 DISCARD TABLESPACE; -SET GLOBAL innodb_file_format = `Barracuda`; -Warnings: -Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html -SET GLOBAL innodb_file_per_table = ON; -SET GLOBAL innodb_compression_algorithm = 1; -# List after t1 DISCARD -t1.frm -t2.frm -t3.frm -t4.frm +restore: t1 .ibd and .cfg files +restore: t2 .ibd and .cfg files +restore: t3 .ibd and .cfg files +restore: t4 .ibd and .cfg files ALTER TABLE t1 IMPORT TABLESPACE; -Warnings: -Warning 1814 Tablespace has been discarded for table `t1` SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -97,8 +94,6 @@ SELECT COUNT(*) FROM t1; COUNT(*) 2000 ALTER TABLE t2 IMPORT TABLESPACE; -Warnings: -Warning 1814 Tablespace has been discarded for table `t2` SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -109,8 +104,6 @@ SELECT COUNT(*) FROM t2; COUNT(*) 2000 ALTER TABLE t3 IMPORT TABLESPACE; -Warnings: -Warning 1814 Tablespace has been discarded for table `t3` SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( @@ -121,8 +114,6 @@ SELECT COUNT(*) FROM t3; COUNT(*) 2000 ALTER TABLE t4 IMPORT TABLESPACE; -Warnings: -Warning 1814 Tablespace has been discarded for table `t4` SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( @@ -132,12 +123,6 @@ t4 CREATE TABLE `t4` ( SELECT COUNT(*) FROM t4; COUNT(*) 2000 -flush data to disk -SET GLOBAL innodb_file_format = `Barracuda`; -Warnings: -Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html -SET GLOBAL innodb_file_per_table = ON; -SET GLOBAL innodb_compression_algorithm = 1; # tables should be still either encrypted and/or compressed # t1 yes on expecting NOT FOUND NOT FOUND /foobar/ in t1.ibd @@ -149,5 +134,3 @@ NOT FOUND /tmpres/ in t3.ibd NOT FOUND /mysql/ in t4.ibd DROP PROCEDURE innodb_insert_proc; DROP TABLE t1,t2,t3,t4; -Warnings: -Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html diff --git a/mysql-test/suite/encryption/r/innodb-missing-key.result b/mysql-test/suite/encryption/r/innodb-missing-key.result new file mode 100644 index 00000000000..b59ec158273 --- /dev/null +++ b/mysql-test/suite/encryption/r/innodb-missing-key.result @@ -0,0 +1,54 @@ +call mtr.add_suppression("InnoDB: Block in space_id .* in file test/.* encrypted"); +call mtr.add_suppression("InnoDB: However key management plugin or used key_id .* is not found or used encryption algorithm or method does not match."); +call mtr.add_suppression("InnoDB: Marking tablespace as missing. You may drop this table or install correct key management plugin and key file."); + +# Start server with keys2.txt +CREATE TABLE t1(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=19; +CREATE TABLE t2(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=1; +CREATE TABLE t3(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=NO; +INSERT INTO t1(b) VALUES ('thisissecredmessage'); +INSERT INTO t1(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t1; +INSERT INTO t2 SELECT * FROM t1; +INSERT INTO t3 SELECT * FROM t1; + +# Restart server with keys3.txt +set global innodb_encryption_rotate_key_age = 1; +use test; +CREATE TABLE t4(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=1; +SELECT SLEEP(5); +SLEEP(5) +0 +SELECT COUNT(1) FROM t3; +COUNT(1) +2048 +SELECT COUNT(1) FROM t2; +COUNT(1) +2048 +SELECT COUNT(1) FROM t2,t1 where t2.a = t1.a; +ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB +SELECT COUNT(1) FROM t1 where b = 'ab'; +ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB +SELECT COUNT(1) FROM t1; +ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB + +# Start server with keys2.txt +SELECT COUNT(1) FROM t1; +COUNT(1) +2048 +SELECT COUNT(1) FROM t2; +COUNT(1) +2048 +SELECT COUNT(1) FROM t3; +COUNT(1) +2048 +DROP TABLE t1, t2, t3; diff --git a/mysql-test/suite/encryption/r/innodb_encryption_discard_import.result b/mysql-test/suite/encryption/r/innodb_encryption_discard_import.result index 5bb3b2bc41e..ae1fbdebcb3 100644 --- a/mysql-test/suite/encryption/r/innodb_encryption_discard_import.result +++ b/mysql-test/suite/encryption/r/innodb_encryption_discard_import.result @@ -1,8 +1,6 @@ call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded."); call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue."); SET GLOBAL innodb_file_format = `Barracuda`; -Warnings: -Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html SET GLOBAL innodb_file_per_table = ON; CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB encrypted=yes; CREATE TABLE t2 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB; @@ -31,8 +29,16 @@ NOT FOUND /foobar/ in t1.ibd NOT FOUND /temp/ in t2.ibd # t3 ... on expecting NOT FOUND NOT FOUND /barfoo/ in t3.ibd -FLUSH TABLE t1, t2, t3 FOR EXPORT; -# List before copying files +t1.frm +t1.ibd +t2.frm +t2.ibd +t3.frm +t3.ibd +FLUSH TABLES t1, t2, t3 FOR EXPORT; +backup: t1 +backup: t2 +backup: t3 t1.cfg t1.frm t1.ibd @@ -43,54 +49,21 @@ t3.cfg t3.frm t3.ibd UNLOCK TABLES; -# Restarting server -# Done restarting server -# List before t1 DISCARD -t1.frm -t1.ibd -t2.frm -t2.ibd -t3.frm -t3.ibd -SET GLOBAL innodb_file_format = `Barracuda`; -Warnings: -Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html -SET GLOBAL innodb_file_per_table = ON; ALTER TABLE t1 DISCARD TABLESPACE; ALTER TABLE t2 DISCARD TABLESPACE; ALTER TABLE t3 DISCARD TABLESPACE; -# List after t1 DISCARD -t1.frm -t2.frm -t3.frm -# Restarting server -# Done restarting server -SET GLOBAL innodb_file_format = `Barracuda`; -Warnings: -Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html -SET GLOBAL innodb_file_per_table = ON; -# Tablespaces should be still encrypted -# t1 yes on expecting NOT FOUND -NOT FOUND /foobar/ in t1.ibd -# t2 ... on expecting NOT FOUND -NOT FOUND /temp/ in t2.ibd -# t3 ... on expecting NOT FOUND -NOT FOUND /barfoo/ in t3.ibd +restore: t1 .ibd and .cfg files +restore: t2 .ibd and .cfg files +restore: t3 .ibd and .cfg files ALTER TABLE t1 IMPORT TABLESPACE; -Warnings: -Warning 1814 Tablespace has been discarded for table 't1' SELECT COUNT(1) FROM t1; COUNT(1) 10000 ALTER TABLE t2 IMPORT TABLESPACE; -Warnings: -Warning 1814 Tablespace has been discarded for table 't2' SELECT COUNT(1) FROM t2; COUNT(1) 10000 ALTER TABLE t3 IMPORT TABLESPACE; -Warnings: -Warning 1814 Tablespace has been discarded for table 't3' SELECT COUNT(1) FROM t3; COUNT(1) 10000 @@ -125,14 +98,6 @@ t3 CREATE TABLE `t3` ( `a` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED `encrypted`=yes -# Wait max 10 min for key encryption threads to encrypt all spaces -# Tablespaces should be encrypted after alter table -# t1 yes on expecting NOT FOUND -NOT FOUND /foobar/ in t1.ibd -# t2 ... on expecting NOT FOUND -NOT FOUND /temp/ in t2.ibd -# t3 ... on expecting NOT FOUND -NOT FOUND /barfoo/ in t3.ibd # Restarting server # Done restarting server # Verify that tables are still usable @@ -152,7 +117,8 @@ NOT FOUND /foobar/ in t1.ibd NOT FOUND /temp/ in t2.ibd # t3 ... on expecting NOT FOUND NOT FOUND /barfoo/ in t3.ibd +# Wait max 10 min for key encryption threads to encrypt all spaces +# Success! +# Restart mysqld --innodb_encrypt_tables=0 --innodb_encryption_threads=0 DROP PROCEDURE innodb_insert_proc; DROP TABLE t1, t2, t3; -Warnings: -Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html diff --git a/mysql-test/suite/encryption/r/innodb_lotoftables.result b/mysql-test/suite/encryption/r/innodb_lotoftables.result new file mode 100644 index 00000000000..34f2684253e --- /dev/null +++ b/mysql-test/suite/encryption/r/innodb_lotoftables.result @@ -0,0 +1,154 @@ +SET GLOBAL innodb_file_format = `Barracuda`; +SET GLOBAL innodb_file_per_table = ON; +SHOW VARIABLES LIKE 'innodb_encrypt%'; +Variable_name Value +innodb_encrypt_log OFF +innodb_encrypt_tables OFF +innodb_encryption_rotate_key_age 1 +innodb_encryption_rotation_iops 100 +innodb_encryption_threads 0 +create database innodb_encrypted_1; +use innodb_encrypted_1; +show status like 'innodb_pages0_read%'; +Variable_name Value +Innodb_pages0_read 3 +set autocommit=0; +set autocommit=1; +commit work; +show status like 'innodb_pages0_read%'; +Variable_name Value +Innodb_pages0_read 3 +# should be 100 +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE NAME LIKE 'innodb_encrypted%'; +COUNT(*) +100 +create database innodb_encrypted_2; +use innodb_encrypted_2; +show status like 'innodb_pages0_read%'; +Variable_name Value +Innodb_pages0_read 3 +set autocommit=0; +commit work; +set autocommit=1; +show status like 'innodb_pages0_read%'; +Variable_name Value +Innodb_pages0_read 3 +# should be 100 +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%'; +COUNT(*) +100 +# should be 100 +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%'; +COUNT(*) +100 +create database innodb_encrypted_3; +use innodb_encrypted_3; +show status like 'innodb_pages0_read%'; +Variable_name Value +Innodb_pages0_read 3 +set autocommit=0; +commit work; +set autocommit=1; +show status like 'innodb_pages0_read%'; +Variable_name Value +Innodb_pages0_read 3 +# should be 100 +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%'; +COUNT(*) +100 +# should be 200 +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%'; +COUNT(*) +200 +use test; +show status like 'innodb_pages0_read%'; +Variable_name Value +Innodb_pages0_read 3 +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%'; +COUNT(*) +100 +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%'; +COUNT(*) +200 +SET GLOBAL innodb_encrypt_tables = on; +SET GLOBAL innodb_encryption_threads=4; +# Wait until all encrypted tables have been encrypted +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%'; +COUNT(*) +200 +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%'; +COUNT(*) +100 +show status like 'innodb_pages0_read%'; +Variable_name Value +Innodb_pages0_read 3 +# Success! +# Restart mysqld --innodb_encrypt_tables=0 --innodb_encryption_threads=0 +# Restart Success! +show status like 'innodb_pages0_read%'; +Variable_name Value +Innodb_pages0_read 3 +show status like 'innodb_pages0_read%'; +Variable_name Value +Innodb_pages0_read 3 +use test; +show status like 'innodb_pages0_read%'; +Variable_name Value +Innodb_pages0_read 3 +use innodb_encrypted_1; +show status like 'innodb_pages0_read%'; +Variable_name Value +Innodb_pages0_read 3 +use innodb_encrypted_2; +show status like 'innodb_pages0_read%'; +Variable_name Value +Innodb_pages0_read 3 +use innodb_encrypted_3; +show status like 'innodb_pages0_read%'; +Variable_name Value +Innodb_pages0_read 3 +use innodb_encrypted_1; +show status like 'innodb_pages0_read%'; +Variable_name Value +Innodb_pages0_read 3 +show status like 'innodb_pages0_read%'; +Variable_name Value +Innodb_pages0_read 103 +use innodb_encrypted_2; +show status like 'innodb_pages0_read%'; +Variable_name Value +Innodb_pages0_read 103 +show status like 'innodb_pages0_read%'; +Variable_name Value +Innodb_pages0_read 203 +use innodb_encrypted_3; +show status like 'innodb_pages0_read%'; +Variable_name Value +Innodb_pages0_read 203 +show status like 'innodb_pages0_read%'; +Variable_name Value +Innodb_pages0_read 303 +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%'; +COUNT(*) +100 +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%'; +COUNT(*) +200 +SET GLOBAL innodb_encrypt_tables = off; +SET GLOBAL innodb_encryption_threads=4; +# Wait until all default encrypted tables have been decrypted +# should be 100 +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%'; +COUNT(*) +100 +# should be 200 +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%'; +COUNT(*) +200 +show status like 'innodb_pages0_read%'; +Variable_name Value +Innodb_pages0_read 303 +use test; +drop database innodb_encrypted_1; +drop database innodb_encrypted_2; +drop database innodb_encrypted_3; diff --git a/mysql-test/suite/encryption/t/filekeys-tooshort.enc b/mysql-test/suite/encryption/t/filekeys-tooshort.enc new file mode 100644 index 00000000000..9849236c7f4 --- /dev/null +++ b/mysql-test/suite/encryption/t/filekeys-tooshort.enc @@ -0,0 +1 @@ +Salted__ \ No newline at end of file diff --git a/mysql-test/suite/encryption/t/filekeys_badtest.inc b/mysql-test/suite/encryption/t/filekeys_badtest.inc index 7c0858af20a..1cdea0e1a53 100644 --- a/mysql-test/suite/encryption/t/filekeys_badtest.inc +++ b/mysql-test/suite/encryption/t/filekeys_badtest.inc @@ -1,5 +1,5 @@ -- source include/not_embedded.inc --- source include/have_xtradb.inc +-- source include/have_innodb.inc -- source filekeys_plugin.inc --eval call mtr.add_suppression("$SEARCH_PATTERN") diff --git a/mysql-test/suite/encryption/t/filekeys_goodtest.inc b/mysql-test/suite/encryption/t/filekeys_goodtest.inc index 146a570412c..12a79c13d2a 100644 --- a/mysql-test/suite/encryption/t/filekeys_goodtest.inc +++ b/mysql-test/suite/encryption/t/filekeys_goodtest.inc @@ -1,4 +1,4 @@ --- source include/have_xtradb.inc +-- source include/have_innodb.inc -- source filekeys_plugin.inc create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1; diff --git a/mysql-test/suite/encryption/t/filekeys_tooshort.opt b/mysql-test/suite/encryption/t/filekeys_tooshort.opt new file mode 100644 index 00000000000..8999becc78d --- /dev/null +++ b/mysql-test/suite/encryption/t/filekeys_tooshort.opt @@ -0,0 +1,3 @@ +--loose-file-key-management-filekey=secret +--loose-file-key-management-filename=$MTR_SUITE_DIR/t/filekeys-tooshort.enc + diff --git a/mysql-test/suite/encryption/t/filekeys_tooshort.test b/mysql-test/suite/encryption/t/filekeys_tooshort.test new file mode 100644 index 00000000000..b0e89675100 --- /dev/null +++ b/mysql-test/suite/encryption/t/filekeys_tooshort.test @@ -0,0 +1,4 @@ +let SEARCH_PATTERN=Cannot decrypt .*tooshort.enc. Not encrypted; +source filekeys_badtest.inc; + +--echo # Test checks if opening an too short filekeys does not crash the server. diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change.test b/mysql-test/suite/encryption/t/innodb-bad-key-change.test index 49e0fc8ee48..3bcce90b01a 100644 --- a/mysql-test/suite/encryption/t/innodb-bad-key-change.test +++ b/mysql-test/suite/encryption/t/innodb-bad-key-change.test @@ -56,13 +56,15 @@ SELECT * FROM t1; --error ER_GET_ERRMSG SELECT * FROM t1; ---replace_regex /tablespace [0-9]*/tablespace #/ +--replace_regex /tablespace [0-9]*/tablespace / SHOW WARNINGS; -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keysbad3.txt -- source include/restart_mysqld.inc ---replace_regex /tablespace [0-9]*/tablespace #/ +--replace_regex /tablespace [0-9]*/tablespace / DROP TABLE t1; +--replace_regex /tablespace [0-9]*/tablespace / +SHOW WARNINGS; # # MDEV-8591: Database page corruption on disk or a failed space, Assertion failure in file buf0buf.cc @@ -83,50 +85,50 @@ INSERT INTO t2 VALUES ('foobar',1,2); --error ER_GET_ERRMSG SELECT * FROM t2; ---replace_regex /.*tablespace [0-9]*// +--replace_regex /tablespace [0-9]*/tablespace / SHOW WARNINGS; --error ER_GET_ERRMSG SELECT * FROM t2 where id = 1; ---replace_regex /.*tablespace [0-9]*// +--replace_regex /tablespace [0-9]*/tablespace / SHOW WARNINGS; --error ER_GET_ERRMSG SELECT * FROM t2 where b = 1; ---replace_regex /.*tablespace [0-9]*// +--replace_regex /tablespace [0-9]*/tablespace / SHOW WARNINGS; --error ER_GET_ERRMSG INSERT INTO t2 VALUES ('tmp',3,3); ---replace_regex /.*tablespace [0-9]*// +--replace_regex /tablespace [0-9]*/tablespace / SHOW WARNINGS; --error ER_GET_ERRMSG DELETE FROM t2 where b = 3; ---replace_regex /.*tablespace [0-9]*// +--replace_regex /tablespace [0-9]*/tablespace / SHOW WARNINGS; --error ER_GET_ERRMSG DELETE FROM t2 where id = 3; ---replace_regex /.*tablespace [0-9]*// +--replace_regex /tablespace [0-9]*/tablespace / SHOW WARNINGS; --error ER_GET_ERRMSG UPDATE t2 set b = b +1; ---replace_regex /.*tablespace [0-9]*// +--replace_regex /tablespace [0-9]*/tablespace / SHOW WARNINGS; OPTIMIZE TABLE t2; ---replace_regex /.*tablespace [0-9]*// +--replace_regex /tablespace [0-9]*/tablespace / SHOW WARNINGS; --error ER_GET_ERRMSG ALTER TABLE t2 ADD COLUMN c INT; ---replace_regex /.*tablespace [0-9]*// +--replace_regex /tablespace [0-9]*/tablespace / SHOW WARNINGS; ANALYZE TABLE t2; ---replace_regex /.*tablespace [0-9]*// +--replace_regex /tablespace [0-9]*/tablespace / SHOW WARNINGS; --error ER_GET_ERRMSG TRUNCATE TABLE t2; ---replace_regex /.*tablespace [0-9]*// +--replace_regex /tablespace [0-9]*/tablespace / SHOW WARNINGS; --replace_regex /.*tablespace [0-9]*// --error ER_GET_ERRMSG DROP TABLE t2; ---replace_regex /.*tablespace [0-9]*// +--replace_regex /tablespace [0-9]*/tablespace / SHOW WARNINGS; --echo @@ -136,5 +138,5 @@ SHOW WARNINGS; --replace_regex /.*tablespace [0-9]*// DROP TABLE t2; ---replace_regex /.*tablespace [0-9]*// +--replace_regex /tablespace [0-9]*/tablespace / SHOW WARNINGS; diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change3.test b/mysql-test/suite/encryption/t/innodb-bad-key-change3.test index d0480a6b424..b3ebe1c4aa5 100644 --- a/mysql-test/suite/encryption/t/innodb-bad-key-change3.test +++ b/mysql-test/suite/encryption/t/innodb-bad-key-change3.test @@ -34,28 +34,26 @@ EOF --enable_reconnect --source include/wait_until_connected_again.inc +--disable_warnings SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_per_table = ON; set global innodb_compression_algorithm = 1; +--enable_warnings CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(255)) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=YES ENCRYPTION_KEY_ID=4; SHOW WARNINGS; SHOW CREATE TABLE t1; INSERT INTO t1 VALUES (1,'foobar'),(2,'barfoo'); +let MYSQLD_DATADIR =`SELECT @@datadir`; FLUSH TABLE t1 FOR EXPORT; --echo # List before copying files --list_files $MYSQLD_DATADIR/test ---copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_TMPDIR/t1.cfg ---copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_TMPDIR/t1.ibd +perl; +do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +ib_backup_tablespaces("test", "t1"); +EOF UNLOCK TABLES; ---sleep 5 ---echo # Tablespaces should be still encrypted ---let SEARCH_PATTERN=foobar ---echo # t1 yes on expecting NOT FOUND --- let SEARCH_FILE=$t1_IBD --- source include/search_pattern_in_file.inc - ALTER TABLE t1 DISCARD TABLESPACE; --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect @@ -67,17 +65,21 @@ ALTER TABLE t1 DISCARD TABLESPACE; 4;770A8A65DA156D24EE2A093277530144 EOF +perl; +do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +ib_discard_tablespaces("test", "t1"); +ib_restore_tablespaces("test", "t1"); +EOF + --exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --enable_reconnect --source include/wait_until_connected_again.inc --source include/restart_mysqld.inc +--disable_warnings SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_per_table = ON; ---echo # List after t1 DISCARD ---list_files $MYSQLD_DATADIR/test ---copy_file $MYSQLD_TMPDIR/t1.cfg $MYSQLD_DATADIR/test/t1.cfg ---copy_file $MYSQLD_TMPDIR/t1.ibd $MYSQLD_DATADIR/test/t1.ibd +--enable_warnings --error ER_GET_ERRMSG ALTER TABLE t1 IMPORT TABLESPACE; @@ -107,10 +109,12 @@ EOF DROP TABLE t1; # reset system +--disable_warnings --disable_query_log EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig; EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig; --enable_query_log +--enable_warnings --remove_file $MYSQLTEST_VARDIR/keys1.txt --remove_file $MYSQLTEST_VARDIR/keys2.txt diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change4.test b/mysql-test/suite/encryption/t/innodb-bad-key-change4.test index 96f9563fb3b..82da3bbcf70 100644 --- a/mysql-test/suite/encryption/t/innodb-bad-key-change4.test +++ b/mysql-test/suite/encryption/t/innodb-bad-key-change4.test @@ -59,6 +59,7 @@ EOF SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_per_table = ON; +--replace_regex /tablespace [0-9]*/tablespace #/ CHECK TABLE t1; SHOW WARNINGS; diff --git a/mysql-test/suite/encryption/t/innodb-discard-import-change.test b/mysql-test/suite/encryption/t/innodb-discard-import-change.test new file mode 100644 index 00000000000..a278a8fba29 --- /dev/null +++ b/mysql-test/suite/encryption/t/innodb-discard-import-change.test @@ -0,0 +1,131 @@ +-- source include/have_innodb.inc +-- source include/have_file_key_management_plugin.inc +# +# MDEV-11656: 'Data structure corruption' IMPORT TABLESPACE doesn't work for encrypted InnoDB tables if space_id changed +# + +call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded"); + +--disable_query_log +let $innodb_file_format_orig = `SELECT @@innodb_file_format`; +let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`; +let $innodb_compression_algo = `SELECT @@innodb_compression_algorithm`; +--enable_query_log + +--disable_warnings +SET GLOBAL innodb_file_format = `Barracuda`; +SET GLOBAL innodb_file_per_table = ON; +SET GLOBAL innodb_compression_algorithm = 1; +--enable_warnings + +create table t1(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb encrypted=yes encryption_key_id=4; +create table t2(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb encrypted=yes encryption_key_id=1; +create table t3(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb page_compressed=yes; +create table t4(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb page_compressed=yes encrypted=yes encryption_key_id=4; +create table t5(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb; + +insert into t1 values (NULL, 'verysecretmessage'); +insert into t1(b) select b from t1; +insert into t1(b) select b from t1; +insert into t1(b) select b from t1; +insert into t1(b) select b from t1; +insert into t1(b) select b from t1; +insert into t1(b) select b from t1; +insert into t1(b) select b from t1; +insert into t1(b) select b from t1; +insert into t2 select * from t1; +insert into t3 select * from t1; +insert into t4 select * from t1; +insert into t5 select * from t1; + +let MYSQLD_DATADIR =`SELECT @@datadir`; +FLUSH TABLE t1,t2,t3,t4,t5 FOR EXPORT; +perl; +do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +ib_backup_tablespaces("test", "t1","t2","t3","t4","t5"); +EOF +--list_files $MYSQLD_DATADIR/test +UNLOCK TABLES; + +ALTER TABLE t1 DISCARD TABLESPACE; +ALTER TABLE t2 DISCARD TABLESPACE; +ALTER TABLE t3 DISCARD TABLESPACE; +ALTER TABLE t4 DISCARD TABLESPACE; +ALTER TABLE t5 DISCARD TABLESPACE; + +# +# Now intentionally change space_id for t1,t3,t4,t5 +# +DROP TABLE t1; +DROP TABLE t3; +DROP TABLE t4; +DROP TABLE t5; + +create table t6(a int) engine=innodb; +create table t5(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb; +create table t3(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb page_compressed=yes; +create table t1(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb encrypted=yes encryption_key_id=4; +create table t4(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb page_compressed=yes encrypted=yes encryption_key_id=4; + +ALTER TABLE t1 DISCARD TABLESPACE; +ALTER TABLE t3 DISCARD TABLESPACE; +ALTER TABLE t4 DISCARD TABLESPACE; +ALTER TABLE t5 DISCARD TABLESPACE; + +perl; +do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +ib_discard_tablespaces("test", "t1","t2","t3","t4","t5"); +ib_restore_tablespaces("test", "t1","t2","t3","t4","t5"); +EOF + +ALTER TABLE t1 IMPORT TABLESPACE; +SHOW CREATE TABLE t1; +SELECT COUNT(*) FROM t1; +ALTER TABLE t2 IMPORT TABLESPACE; +SELECT COUNT(*) FROM t2; +ALTER TABLE t3 IMPORT TABLESPACE; +SELECT COUNT(*) FROM t3; +ALTER TABLE t4 IMPORT TABLESPACE; +SELECT COUNT(*) FROM t4; +ALTER TABLE t5 IMPORT TABLESPACE; +SELECT COUNT(*) FROM t5; + +# +# Verify +# +--let $MYSQLD_TMPDIR = `SELECT @@tmpdir` +--let $MYSQLD_DATADIR = `SELECT @@datadir` +--let SEARCH_RANGE = 10000000 +--let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd +--let t2_IBD = $MYSQLD_DATADIR/test/t2.ibd +--let t3_IBD = $MYSQLD_DATADIR/test/t3.ibd +--let t4_IBD = $MYSQLD_DATADIR/test/t4.ibd +--let t5_IBD = $MYSQLD_DATADIR/test/t5.ibd +--let SEARCH_PATTERN=verysecretmessage +--echo # t1 encrypted expecting NOT FOUND +-- let SEARCH_FILE=$t1_IBD +-- source include/search_pattern_in_file.inc +--echo # t2 encrypted expecting NOT FOUND +-- let SEARCH_FILE=$t2_IBD +-- source include/search_pattern_in_file.inc +--echo # t3 page compressed expecting NOT FOUND +-- let SEARCH_FILE=$t3_IBD +-- source include/search_pattern_in_file.inc +--echo # t4 page compressed and encrypted expecting NOT FOUND +-- let SEARCH_FILE=$t4_IBD +-- source include/search_pattern_in_file.inc +--echo # t5 normal expecting FOUND +-- let SEARCH_FILE=$t5_IBD +-- source include/search_pattern_in_file.inc + +DROP TABLE t1,t2,t3,t4,t5,t6; + +# reset system +--disable_warnings +--disable_query_log +EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig; +EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig; +EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algo; +--enable_query_log +--enable_warnings + diff --git a/mysql-test/suite/encryption/t/innodb-discard-import.test b/mysql-test/suite/encryption/t/innodb-discard-import.test index 3bcb8d39862..9feaacc41e5 100644 --- a/mysql-test/suite/encryption/t/innodb-discard-import.test +++ b/mysql-test/suite/encryption/t/innodb-discard-import.test @@ -19,9 +19,11 @@ let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`; let $innodb_compression_algo = `SELECT @@innodb_compression_algorithm`; --enable_query_log +--disable_warnings SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_compression_algorithm = 1; +--enable_warnings --let $MYSQLD_TMPDIR = `SELECT @@tmpdir` --let $MYSQLD_DATADIR = `SELECT @@datadir` @@ -66,58 +68,28 @@ select count(*) from t2; select count(*) from t3; select count(*) from t4; +let MYSQLD_DATADIR =`SELECT @@datadir`; FLUSH TABLE t1,t2,t3,t4 FOR EXPORT; --echo # List before copying files --list_files $MYSQLD_DATADIR/test ---copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_TMPDIR/t1.cfg ---copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_TMPDIR/t1.ibd ---copy_file $MYSQLD_DATADIR/test/t2.cfg $MYSQLD_TMPDIR/t2.cfg ---copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_TMPDIR/t2.ibd ---copy_file $MYSQLD_DATADIR/test/t3.cfg $MYSQLD_TMPDIR/t3.cfg ---copy_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_TMPDIR/t3.ibd ---copy_file $MYSQLD_DATADIR/test/t4.cfg $MYSQLD_TMPDIR/t4.cfg ---copy_file $MYSQLD_DATADIR/test/t4.ibd $MYSQLD_TMPDIR/t4.ibd -UNLOCK TABLES; +perl; +do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +ib_backup_tablespaces("test", "t1","t2","t3","t4"); +EOF +--list_files $MYSQLD_DATADIR/test ---echo # tables should be either encrypted and/or compressed ---let SEARCH_PATTERN=foobar ---echo # t1 yes on expecting NOT FOUND --- let SEARCH_FILE=$t1_IBD --- source include/search_pattern_in_file.inc ---let SEARCH_PATTERN=barfoo ---echo # t2 yes on expecting NOT FOUND --- let SEARCH_FILE=$t2_IBD --- source include/search_pattern_in_file.inc ---let SEARCH_PATTERN=tmpres ---echo # t3 yes on expecting NOT FOUND --- let SEARCH_FILE=$t3_IBD --- source include/search_pattern_in_file.inc ---let SEARCH_PATTERN=mysql ---echo # t4 yes on expecting NOT FOUND --- let SEARCH_FILE=$t4_IBD --- source include/search_pattern_in_file.inc +UNLOCK TABLES; ALTER TABLE t1 DISCARD TABLESPACE; ALTER TABLE t2 DISCARD TABLESPACE; ALTER TABLE t3 DISCARD TABLESPACE; ALTER TABLE t4 DISCARD TABLESPACE; ---source include/restart_mysqld.inc - -SET GLOBAL innodb_file_format = `Barracuda`; -SET GLOBAL innodb_file_per_table = ON; -SET GLOBAL innodb_compression_algorithm = 1; - ---echo # List after t1 DISCARD ---list_files $MYSQLD_DATADIR/test ---copy_file $MYSQLD_TMPDIR/t1.cfg $MYSQLD_DATADIR/test/t1.cfg ---copy_file $MYSQLD_TMPDIR/t1.ibd $MYSQLD_DATADIR/test/t1.ibd ---copy_file $MYSQLD_TMPDIR/t2.cfg $MYSQLD_DATADIR/test/t2.cfg ---copy_file $MYSQLD_TMPDIR/t2.ibd $MYSQLD_DATADIR/test/t2.ibd ---copy_file $MYSQLD_TMPDIR/t3.cfg $MYSQLD_DATADIR/test/t3.cfg ---copy_file $MYSQLD_TMPDIR/t3.ibd $MYSQLD_DATADIR/test/t3.ibd ---copy_file $MYSQLD_TMPDIR/t4.cfg $MYSQLD_DATADIR/test/t4.cfg ---copy_file $MYSQLD_TMPDIR/t4.ibd $MYSQLD_DATADIR/test/t4.ibd +perl; +do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +ib_discard_tablespaces("test", "t1","t2","t3","t4"); +ib_restore_tablespaces("test", "t1","t2","t3","t4"); +EOF ALTER TABLE t1 IMPORT TABLESPACE; SHOW CREATE TABLE t1; @@ -132,13 +104,6 @@ ALTER TABLE t4 IMPORT TABLESPACE; SHOW CREATE TABLE t4; SELECT COUNT(*) FROM t4; ---echo flush data to disk ---source include/restart_mysqld.inc - -SET GLOBAL innodb_file_format = `Barracuda`; -SET GLOBAL innodb_file_per_table = ON; -SET GLOBAL innodb_compression_algorithm = 1; - --echo # tables should be still either encrypted and/or compressed --let SEARCH_PATTERN=foobar --echo # t1 yes on expecting NOT FOUND @@ -161,8 +126,10 @@ DROP PROCEDURE innodb_insert_proc; DROP TABLE t1,t2,t3,t4; # reset system +--disable_warnings --disable_query_log EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig; EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig; EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algo; --enable_query_log +--enable_warnings diff --git a/mysql-test/suite/encryption/t/innodb-missing-key.opt b/mysql-test/suite/encryption/t/innodb-missing-key.opt new file mode 100644 index 00000000000..02691695cbd --- /dev/null +++ b/mysql-test/suite/encryption/t/innodb-missing-key.opt @@ -0,0 +1,5 @@ +--innodb-encrypt-tables +--innodb-encryption-rotate-key-age=15 +--innodb-encryption-threads=4 +--innodb-tablespaces-encryption + diff --git a/mysql-test/suite/encryption/t/innodb-missing-key.test b/mysql-test/suite/encryption/t/innodb-missing-key.test new file mode 100644 index 00000000000..8fcfb766117 --- /dev/null +++ b/mysql-test/suite/encryption/t/innodb-missing-key.test @@ -0,0 +1,68 @@ +--source include/have_innodb.inc +-- source include/have_file_key_management_plugin.inc +# embedded does not support restart +-- source include/not_embedded.inc +-- source include/not_valgrind.inc +# Avoid CrashReporter popup on Mac +-- source include/not_crashrep.inc + +# +# MDEV-11004: Unable to start (Segfault or os error 2) when encryption key missing +# +call mtr.add_suppression("InnoDB: Block in space_id .* in file test/.* encrypted"); +call mtr.add_suppression("InnoDB: However key management plugin or used key_id .* is not found or used encryption algorithm or method does not match."); +call mtr.add_suppression("InnoDB: Marking tablespace as missing. You may drop this table or install correct key management plugin and key file."); + +--echo +--echo # Start server with keys2.txt +-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt +-- source include/restart_mysqld.inc + +CREATE TABLE t1(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=19; +CREATE TABLE t2(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=1; +CREATE TABLE t3(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=NO; +INSERT INTO t1(b) VALUES ('thisissecredmessage'); +INSERT INTO t1(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t1; +INSERT INTO t2 SELECT * FROM t1; +INSERT INTO t3 SELECT * FROM t1; + +--echo +--echo # Restart server with keys3.txt +-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt +-- source include/restart_mysqld.inc + +set global innodb_encryption_rotate_key_age = 1; +use test; +CREATE TABLE t4(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=1; +SELECT SLEEP(5); +SELECT COUNT(1) FROM t3; +SELECT COUNT(1) FROM t2; +--error 1296 +SELECT COUNT(1) FROM t2,t1 where t2.a = t1.a; +--error 1296 +SELECT COUNT(1) FROM t1 where b = 'ab'; +--error 1296 +SELECT COUNT(1) FROM t1; + +--echo +--echo # Start server with keys2.txt +-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt +-- source include/restart_mysqld.inc + +SELECT COUNT(1) FROM t1; +SELECT COUNT(1) FROM t2; +SELECT COUNT(1) FROM t3; + +DROP TABLE t1, t2, t3; + + diff --git a/mysql-test/suite/encryption/t/innodb-page_encryption_compression.test b/mysql-test/suite/encryption/t/innodb-page_encryption_compression.test index 1d59c39d637..eb293e97693 100644 --- a/mysql-test/suite/encryption/t/innodb-page_encryption_compression.test +++ b/mysql-test/suite/encryption/t/innodb-page_encryption_compression.test @@ -1,6 +1,9 @@ -- source include/have_innodb.inc -- source include/not_embedded.inc -- source include/have_file_key_management_plugin.inc +-- source include/big_test.inc +# Test heavy not tested on valgrind +-- source include/not_valgrind.inc --disable_query_log let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`; diff --git a/mysql-test/suite/encryption/t/innodb_encryption_discard_import.test b/mysql-test/suite/encryption/t/innodb_encryption_discard_import.test index 0361fddecff..32ba5d306f4 100644 --- a/mysql-test/suite/encryption/t/innodb_encryption_discard_import.test +++ b/mysql-test/suite/encryption/t/innodb_encryption_discard_import.test @@ -2,13 +2,13 @@ -- source include/have_example_key_management_plugin.inc -- source include/not_valgrind.inc -- source include/not_embedded.inc --- source include/not_windows.inc call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded."); call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue."); ---let $MYSQLD_TMPDIR = `SELECT @@tmpdir` ---let $MYSQLD_DATADIR = `SELECT @@datadir` +let $MYSQLD_TMPDIR = `SELECT @@tmpdir`; +let $MYSQLD_DATADIR = `SELECT @@datadir`; + --let SEARCH_RANGE = 10000000 --let $id = `SELECT RAND()` --let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd @@ -20,8 +20,10 @@ let $innodb_file_format_orig = `SELECT @@innodb_file_format`; let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`; --enable_query_log +--disable_warnings SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_per_table = ON; +--enable_warnings CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB encrypted=yes; CREATE TABLE t2 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB; @@ -67,89 +69,25 @@ set autocommit=1; -- let SEARCH_FILE=$t3_IBD -- source include/search_pattern_in_file.inc -FLUSH TABLE t1, t2, t3 FOR EXPORT; - ---echo # List before copying files +let MYSQLD_DATADIR =`SELECT @@datadir`; +--list_files $MYSQLD_DATADIR/test +FLUSH TABLES t1, t2, t3 FOR EXPORT; +perl; +do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +ib_backup_tablespaces("test", "t1","t2","t3"); +EOF --list_files $MYSQLD_DATADIR/test ---disable_result_log ---error 0,1,2 ---remove_file $MYSQLD_TMPDIR/t1.cfg ---error 0,1,2 ---remove_file $MYSQLD_TMPDIR/t1.ibd ---error 0,1,2 ---remove_file $MYSQLD_TMPDIR/t2.cfg ---error 0,1,2 ---remove_file $MYSQLD_TMPDIR/t2.ibd ---error 0,1,2 ---remove_file $MYSQLD_TMPDIR/t3.cfg ---error 0,1,2 ---remove_file $MYSQLD_TMPDIR/t3.ibd ---enable_result_log ---copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_TMPDIR/t1$id.cfg ---copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_TMPDIR/t1$id.ibd ---copy_file $MYSQLD_DATADIR/test/t2.cfg $MYSQLD_TMPDIR/t2$id.cfg ---copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_TMPDIR/t2$id.ibd ---copy_file $MYSQLD_DATADIR/test/t3.cfg $MYSQLD_TMPDIR/t3$id.cfg ---copy_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_TMPDIR/t3$id.ibd UNLOCK TABLES; ---echo # Restarting server --- source include/restart_mysqld.inc ---echo # Done restarting server ---echo # List before t1 DISCARD ---list_files $MYSQLD_DATADIR/test - -SET GLOBAL innodb_file_format = `Barracuda`; -SET GLOBAL innodb_file_per_table = ON; - ALTER TABLE t1 DISCARD TABLESPACE; ALTER TABLE t2 DISCARD TABLESPACE; ALTER TABLE t3 DISCARD TABLESPACE; ---echo # List after t1 DISCARD ---list_files $MYSQLD_DATADIR/test ---disable_result_log ---error 0,1,2 ---remove_file $MYSQLD_DATADIR/test/t1.cfg ---error 0,1,2 ---remove_file $MYSQLD_DATADIR/test/t1.ibd ---error 0,1,2 ---remove_file $MYSQLD_DATADIR/test/t2.cfg ---error 0,1,2 ---remove_file $MYSQLD_DATADIR/test/t2.ibd ---error 0,1,2 ---remove_file $MYSQLD_DATADIR/test/t3.cfg ---error 0,1,2 ---remove_file $MYSQLD_DATADIR/test/t3.ibd ---enable_result_log ---echo # Restarting server --- source include/restart_mysqld.inc ---echo # Done restarting server - -SET GLOBAL innodb_file_format = `Barracuda`; -SET GLOBAL innodb_file_per_table = ON; - ---copy_file $MYSQLD_TMPDIR/t1$id.cfg $MYSQLD_DATADIR/test/t1.cfg ---copy_file $MYSQLD_TMPDIR/t1$id.ibd $MYSQLD_DATADIR/test/t1.ibd ---copy_file $MYSQLD_TMPDIR/t2$id.cfg $MYSQLD_DATADIR/test/t2.cfg ---copy_file $MYSQLD_TMPDIR/t2$id.ibd $MYSQLD_DATADIR/test/t2.ibd ---copy_file $MYSQLD_TMPDIR/t3$id.cfg $MYSQLD_DATADIR/test/t3.cfg ---copy_file $MYSQLD_TMPDIR/t3$id.ibd $MYSQLD_DATADIR/test/t3.ibd - ---sleep 5 ---echo # Tablespaces should be still encrypted ---let SEARCH_PATTERN=foobar ---echo # t1 yes on expecting NOT FOUND --- let SEARCH_FILE=$t1_IBD --- source include/search_pattern_in_file.inc ---let SEARCH_PATTERN=temp ---echo # t2 ... on expecting NOT FOUND --- let SEARCH_FILE=$t2_IBD --- source include/search_pattern_in_file.inc ---echo # t3 ... on expecting NOT FOUND ---let SEARCH_PATTERN=barfoo --- let SEARCH_FILE=$t3_IBD --- source include/search_pattern_in_file.inc +perl; +do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +ib_discard_tablespaces("test", "t1","t2","t3"); +ib_restore_tablespaces("test", "t1","t2","t3"); +EOF ALTER TABLE t1 IMPORT TABLESPACE; SELECT COUNT(1) FROM t1; @@ -180,26 +118,6 @@ SHOW CREATE TABLE t2; ALTER TABLE t3 ENGINE InnoDB; SHOW CREATE TABLE t3; ---echo # Wait max 10 min for key encryption threads to encrypt all spaces ---let $wait_timeout= 600 ---let $wait_condition=SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 ---source include/wait_condition.inc - ---sleep 5 ---echo # Tablespaces should be encrypted after alter table ---let SEARCH_PATTERN=foobar ---echo # t1 yes on expecting NOT FOUND --- let SEARCH_FILE=$t1_IBD --- source include/search_pattern_in_file.inc ---let SEARCH_PATTERN=temp ---echo # t2 ... on expecting NOT FOUND --- let SEARCH_FILE=$t2_IBD --- source include/search_pattern_in_file.inc ---echo # t3 ... on expecting NOT FOUND ---let SEARCH_PATTERN=barfoo --- let SEARCH_FILE=$t3_IBD --- source include/search_pattern_in_file.inc - --echo # Restarting server -- source include/restart_mysqld.inc --echo # Done restarting server @@ -224,12 +142,23 @@ SELECT COUNT(1) FROM t3; -- let SEARCH_FILE=$t3_IBD -- source include/search_pattern_in_file.inc +--echo # Wait max 10 min for key encryption threads to encrypt all spaces +--let $wait_timeout= 600 +--let $wait_condition=SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 +--source include/wait_condition.inc + +--echo # Success! +--echo # Restart mysqld --innodb_encrypt_tables=0 --innodb_encryption_threads=0 +-- let $restart_parameters=--innodb_encrypt_tables=0 --innodb_encryption_threads=0 +-- source include/restart_mysqld.inc DROP PROCEDURE innodb_insert_proc; DROP TABLE t1, t2, t3; # reset system +--disable_warnings --disable_query_log -EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig; -EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig; +eval SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig; +eval SET GLOBAL innodb_file_format = $innodb_file_format_orig; --enable_query_log +--enable_warnings diff --git a/mysql-test/suite/encryption/t/innodb_lotoftables.opt b/mysql-test/suite/encryption/t/innodb_lotoftables.opt new file mode 100644 index 00000000000..ffb5a2957f8 --- /dev/null +++ b/mysql-test/suite/encryption/t/innodb_lotoftables.opt @@ -0,0 +1,3 @@ +--innodb-tablespaces-encryption +--innodb-encrypt-tables=off +--innodb-encryption-threads=0 diff --git a/mysql-test/suite/encryption/t/innodb_lotoftables.test b/mysql-test/suite/encryption/t/innodb_lotoftables.test new file mode 100644 index 00000000000..cad3cb54326 --- /dev/null +++ b/mysql-test/suite/encryption/t/innodb_lotoftables.test @@ -0,0 +1,274 @@ +-- source include/have_innodb.inc +-- source include/have_example_key_management_plugin.inc +-- source include/big_test.inc + +# embedded does not support restart +-- source include/not_embedded.inc + +--disable_query_log +let $innodb_file_format_orig = `SELECT @@innodb_file_format`; +let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`; +let $innodb_encryption_threads_orig = `SELECT @@global.innodb_encryption_threads`; +--enable_query_log + +SET GLOBAL innodb_file_format = `Barracuda`; +SET GLOBAL innodb_file_per_table = ON; + +SHOW VARIABLES LIKE 'innodb_encrypt%'; + +# +# This will create 100 tables where that could be +# encrypted an unencrypt +# +create database innodb_encrypted_1; +use innodb_encrypted_1; +show status like 'innodb_pages0_read%'; +set autocommit=0; +let $tables = 100; + +--disable_query_log +while ($tables) +{ + eval create table t_$tables (a int not null primary key, b varchar(200)) engine=innodb; + commit; + let $rows = 100; + while($rows) + { + eval insert into t_$tables values ($rows, substring(MD5(RAND()), -64)); + dec $rows; + } + commit; + dec $tables; +} +--enable_query_log + +set autocommit=1; +commit work; +show status like 'innodb_pages0_read%'; +# +# Verify +# +--echo # should be 100 + +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE NAME LIKE 'innodb_encrypted%'; + +# +# This will create 100 tables that are encrypted always +# +create database innodb_encrypted_2; +use innodb_encrypted_2; +show status like 'innodb_pages0_read%'; +set autocommit=0; + +--disable_query_log +let $tables = 100; +while ($tables) +{ + eval create table t_$tables (a int not null primary key, b varchar(200)) engine=innodb encrypted=yes; + commit; + let $rows = 100; + while($rows) + { + eval insert into t_$tables values ($rows, substring(MD5(RAND()), -64)); + dec $rows; + } + commit; + dec $tables; +} +--enable_query_log + +commit work; +set autocommit=1; +show status like 'innodb_pages0_read%'; +# +# Verify +# +--echo # should be 100 +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%'; +--echo # should be 100 +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%'; + +# +# This will create 100 tables that are not encrypted +# +create database innodb_encrypted_3; +use innodb_encrypted_3; +show status like 'innodb_pages0_read%'; +set autocommit=0; + +--disable_query_log +let $tables = 100; +while ($tables) +{ + eval create table t_$tables (a int not null primary key, b varchar(200)) engine=innodb encrypted=no; + commit; + let $rows = 100; + while($rows) + { + eval insert into t_$tables values ($rows, substring(MD5(RAND()), -64)); + dec $rows; + } + commit; + dec $tables; +} +--enable_query_log + +commit work; +set autocommit=1; +show status like 'innodb_pages0_read%'; +# +# Verify +# +--echo # should be 100 +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%'; +--echo # should be 200 +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%'; + +use test; +show status like 'innodb_pages0_read%'; + +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%'; +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%'; + +SET GLOBAL innodb_encrypt_tables = on; +SET GLOBAL innodb_encryption_threads=4; + +--echo # Wait until all encrypted tables have been encrypted +let $cnt=600; +while ($cnt) +{ + let $success=`SELECT COUNT(*) = 100 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0`; + if ($success) + { + let $cnt=0; + } + if (!$success) + { + real_sleep 1; + dec $cnt; + } +} +if (!$success) +{ + SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; + SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0; + SHOW STATUS LIKE 'innodb_encryption%'; + -- die Timeout waiting for encryption threads +} + +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%'; +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%'; +show status like 'innodb_pages0_read%'; + +--echo # Success! +--echo # Restart mysqld --innodb_encrypt_tables=0 --innodb_encryption_threads=0 +-- let $restart_parameters=--innodb_encrypt_tables=0 --innodb_encryption_threads=0 +-- source include/restart_mysqld.inc + +--echo # Restart Success! +show status like 'innodb_pages0_read%'; + +show status like 'innodb_pages0_read%'; +use test; +show status like 'innodb_pages0_read%'; +use innodb_encrypted_1; +show status like 'innodb_pages0_read%'; +use innodb_encrypted_2; +show status like 'innodb_pages0_read%'; +use innodb_encrypted_3; +show status like 'innodb_pages0_read%'; + +use innodb_encrypted_1; +show status like 'innodb_pages0_read%'; +--disable_result_log +--disable_query_log +let $tables = 100; +while ($tables) +{ + eval select * from t_$tables; + dec $tables; +} +--enable_query_log +--enable_result_log + +show status like 'innodb_pages0_read%'; + +use innodb_encrypted_2; +show status like 'innodb_pages0_read%'; + +--disable_result_log +--disable_query_log +let $tables = 100; +while ($tables) +{ + eval select * from t_$tables; + dec $tables; +} +--enable_query_log +--enable_result_log + +show status like 'innodb_pages0_read%'; + +use innodb_encrypted_3; +show status like 'innodb_pages0_read%'; +--disable_result_log +--disable_query_log +let $tables = 100; +while ($tables) +{ + eval select * from t_$tables; + dec $tables; +} +--enable_query_log +--enable_result_log + +show status like 'innodb_pages0_read%'; + +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%'; +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%'; + +SET GLOBAL innodb_encrypt_tables = off; +SET GLOBAL innodb_encryption_threads=4; + +--echo # Wait until all default encrypted tables have been decrypted +let $cnt=600; +while ($cnt) +{ + let $success=`SELECT COUNT(*) = 100 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0`; + if ($success) + { + let $cnt=0; + } + if (!$success) + { + real_sleep 1; + dec $cnt; + } +} +if (!$success) +{ + SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0; + SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; + SHOW STATUS LIKE 'innodb_encryption%'; + -- die Timeout waiting for encryption threads +} + +--echo # should be 100 +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'innodb_encrypted%'; +--echo # should be 200 +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%'; +show status like 'innodb_pages0_read%'; + +# +# Cleanup +# +use test; +drop database innodb_encrypted_1; +drop database innodb_encrypted_2; +drop database innodb_encrypted_3; + +--disable_query_log +EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig; +EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig; +EVAL SET GLOBAL innodb_encryption_threads = $innodb_encryption_threads_orig; +--enable_query_log diff --git a/mysql-test/suite/encryption/t/tempfiles.test b/mysql-test/suite/encryption/t/tempfiles.test index 34dcbdf5963..065d775c182 100644 --- a/mysql-test/suite/encryption/t/tempfiles.test +++ b/mysql-test/suite/encryption/t/tempfiles.test @@ -7,9 +7,7 @@ source include/have_sequence.inc; # Row binlog format to fill binlog cache faster source include/have_binlog_format_row.inc; -# Nothing XtraDB specific in this test, it just needs *some* transactional -# engine. But there's no need to run it twice for InnoDB and XtraDB. -source include/have_xtradb.inc; +source include/have_innodb.inc; # # MyISAM messing around with IO_CACHE::file diff --git a/mysql-test/suite/engines/funcs/r/ix_index_non_string.result b/mysql-test/suite/engines/funcs/r/ix_index_non_string.result index 1811d926851..908327b1513 100644 --- a/mysql-test/suite/engines/funcs/r/ix_index_non_string.result +++ b/mysql-test/suite/engines/funcs/r/ix_index_non_string.result @@ -427,7 +427,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), KEY `i1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; diff --git a/mysql-test/suite/engines/funcs/r/ix_unique_non_string.result b/mysql-test/suite/engines/funcs/r/ix_unique_non_string.result index ee6fe0a2eeb..c9f1040c151 100644 --- a/mysql-test/suite/engines/funcs/r/ix_unique_non_string.result +++ b/mysql-test/suite/engines/funcs/r/ix_unique_non_string.result @@ -427,7 +427,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `i1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; diff --git a/mysql-test/suite/engines/funcs/r/ta_2part_column_to_pk.result b/mysql-test/suite/engines/funcs/r/ta_2part_column_to_pk.result index a4d134d9495..5513053491d 100644 --- a/mysql-test/suite/engines/funcs/r/ta_2part_column_to_pk.result +++ b/mysql-test/suite/engines/funcs/r/ta_2part_column_to_pk.result @@ -342,7 +342,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD PRIMARY KEY (c1,c2); @@ -352,7 +352,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`,`c2`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 diff --git a/mysql-test/suite/engines/funcs/r/ta_2part_diff_to_pk.result b/mysql-test/suite/engines/funcs/r/ta_2part_diff_to_pk.result index 59f476f3750..03651dcfde0 100644 --- a/mysql-test/suite/engines/funcs/r/ta_2part_diff_to_pk.result +++ b/mysql-test/suite/engines/funcs/r/ta_2part_diff_to_pk.result @@ -398,7 +398,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` bit(1) NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL @@ -410,7 +410,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` bit(1) NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, @@ -846,7 +846,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` tinyint(4) NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL @@ -858,7 +858,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` tinyint(4) NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, @@ -1294,7 +1294,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` smallint(6) NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL @@ -1306,7 +1306,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` smallint(6) NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, @@ -1742,7 +1742,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` mediumint(9) NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL @@ -1754,7 +1754,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` mediumint(9) NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, @@ -2190,7 +2190,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` int(11) NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL @@ -2202,7 +2202,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` int(11) NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, @@ -2638,7 +2638,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` int(11) NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL @@ -2650,7 +2650,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` int(11) NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, @@ -3086,7 +3086,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` bigint(20) NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL @@ -3098,7 +3098,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` bigint(20) NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, @@ -3534,7 +3534,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` double NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL @@ -3546,7 +3546,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` double NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, @@ -3982,7 +3982,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` double NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL @@ -3994,7 +3994,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` double NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, @@ -4430,7 +4430,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` float NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL @@ -4442,7 +4442,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` float NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, @@ -4878,7 +4878,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` decimal(10,0) NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL @@ -4890,7 +4890,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` decimal(10,0) NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, @@ -5326,7 +5326,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` decimal(10,0) NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL @@ -5338,7 +5338,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` decimal(10,0) NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, @@ -5774,7 +5774,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` date NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL @@ -5786,7 +5786,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` date NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, @@ -6222,7 +6222,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` time NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL @@ -6234,7 +6234,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` time NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, @@ -6279,7 +6279,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` bit(1) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -6291,7 +6291,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` bit(1) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, PRIMARY KEY (`c1`,`c2`) @@ -6307,7 +6307,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -6319,7 +6319,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, PRIMARY KEY (`c1`,`c2`) @@ -6335,7 +6335,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -6347,7 +6347,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, PRIMARY KEY (`c1`,`c2`) @@ -6363,7 +6363,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -6375,7 +6375,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, PRIMARY KEY (`c1`,`c2`) @@ -6391,7 +6391,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -6403,7 +6403,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, PRIMARY KEY (`c1`,`c2`) @@ -6419,7 +6419,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -6431,7 +6431,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, PRIMARY KEY (`c1`,`c2`) @@ -6447,7 +6447,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -6459,7 +6459,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, PRIMARY KEY (`c1`,`c2`) @@ -6475,7 +6475,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` double NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -6487,7 +6487,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` double NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, PRIMARY KEY (`c1`,`c2`) @@ -6503,7 +6503,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` double NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -6515,7 +6515,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` double NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, PRIMARY KEY (`c1`,`c2`) @@ -6531,7 +6531,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` float NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -6543,7 +6543,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` float NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, PRIMARY KEY (`c1`,`c2`) @@ -6559,7 +6559,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` decimal(10,0) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -6571,7 +6571,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` decimal(10,0) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, PRIMARY KEY (`c1`,`c2`) @@ -6587,7 +6587,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` decimal(10,0) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -6599,7 +6599,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` decimal(10,0) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, PRIMARY KEY (`c1`,`c2`) @@ -6615,7 +6615,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` date NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -6627,7 +6627,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` date NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, PRIMARY KEY (`c1`,`c2`) @@ -6643,7 +6643,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` time NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -6655,7 +6655,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` time NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, PRIMARY KEY (`c1`,`c2`) @@ -6670,7 +6670,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL @@ -6682,7 +6682,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, @@ -6699,7 +6699,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` year(4) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -6711,7 +6711,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` year(4) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, PRIMARY KEY (`c1`,`c2`) @@ -7118,7 +7118,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` year(4) NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL @@ -7130,7 +7130,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` year(4) NOT NULL, `c3` int(11) DEFAULT NULL, `c4` varchar(10) NOT NULL, diff --git a/mysql-test/suite/engines/funcs/r/ta_3part_column_to_pk.result b/mysql-test/suite/engines/funcs/r/ta_3part_column_to_pk.result index ed477738ae3..ee57ab00455 100644 --- a/mysql-test/suite/engines/funcs/r/ta_3part_column_to_pk.result +++ b/mysql-test/suite/engines/funcs/r/ta_3part_column_to_pk.result @@ -370,7 +370,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -381,7 +381,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`,`c2`,`c3`) diff --git a/mysql-test/suite/engines/funcs/r/ta_add_column.result b/mysql-test/suite/engines/funcs/r/ta_add_column.result index 2dcbc272464..0600180ee0c 100644 --- a/mysql-test/suite/engines/funcs/r/ta_add_column.result +++ b/mysql-test/suite/engines/funcs/r/ta_add_column.result @@ -842,7 +842,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 BIT NOT NULL; SHOW TABLES; @@ -851,7 +851,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` bit(1) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -1898,7 +1898,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 TINYINT NOT NULL; SHOW TABLES; @@ -1907,7 +1907,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` tinyint(4) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2954,7 +2954,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 SMALLINT NOT NULL; SHOW TABLES; @@ -2963,7 +2963,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` smallint(6) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -4010,7 +4010,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 MEDIUMINT NOT NULL; SHOW TABLES; @@ -4019,7 +4019,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` mediumint(9) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -5066,7 +5066,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 INT NOT NULL; SHOW TABLES; @@ -5075,7 +5075,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` int(11) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -6122,7 +6122,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 INTEGER NOT NULL; SHOW TABLES; @@ -6131,7 +6131,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` int(11) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -7178,7 +7178,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 BIGINT NOT NULL; SHOW TABLES; @@ -7187,7 +7187,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` bigint(20) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -8234,7 +8234,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 REAL NOT NULL; SHOW TABLES; @@ -8243,7 +8243,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` double NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -9290,7 +9290,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 DOUBLE NOT NULL; SHOW TABLES; @@ -9299,7 +9299,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` double NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -10346,7 +10346,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 FLOAT NOT NULL; SHOW TABLES; @@ -10355,7 +10355,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` float NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -11402,7 +11402,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 DECIMAL NOT NULL; SHOW TABLES; @@ -11411,7 +11411,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` decimal(10,0) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -12458,7 +12458,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 NUMERIC NOT NULL; SHOW TABLES; @@ -12467,7 +12467,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` decimal(10,0) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -13514,7 +13514,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 DATE NOT NULL; SHOW TABLES; @@ -13523,7 +13523,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` date NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -14570,7 +14570,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 TIME NOT NULL; SHOW TABLES; @@ -14579,7 +14579,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` time NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -15328,7 +15328,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` bit(1) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -15350,7 +15350,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -15372,7 +15372,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -15394,7 +15394,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -15416,7 +15416,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -15438,7 +15438,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -15460,7 +15460,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -15482,7 +15482,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` double NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -15504,7 +15504,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` double NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -15526,7 +15526,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` float NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -15548,7 +15548,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` decimal(10,0) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -15570,7 +15570,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` decimal(10,0) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -15592,7 +15592,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` date NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -15614,7 +15614,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` time NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -15626,7 +15626,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 TIMESTAMP NOT NULL; SHOW TABLES; @@ -15635,7 +15635,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -15658,7 +15658,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` year(4) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -15680,7 +15680,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` tinyblob NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -15702,7 +15702,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` blob NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -15724,7 +15724,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` mediumblob NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -15746,7 +15746,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` longblob NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -15768,7 +15768,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` tinytext NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -15790,7 +15790,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` text NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -15812,7 +15812,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` mediumtext NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -15834,7 +15834,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` longtext NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -16682,7 +16682,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 YEAR NOT NULL; SHOW TABLES; @@ -16691,7 +16691,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` year(4) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -17738,7 +17738,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 TINYBLOB NOT NULL; SHOW TABLES; @@ -17747,7 +17747,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` tinyblob NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -18794,7 +18794,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 BLOB NOT NULL; SHOW TABLES; @@ -18803,7 +18803,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` blob NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -19850,7 +19850,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 MEDIUMBLOB NOT NULL; SHOW TABLES; @@ -19859,7 +19859,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` mediumblob NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -20906,7 +20906,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 LONGBLOB NOT NULL; SHOW TABLES; @@ -20915,7 +20915,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` longblob NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -21962,7 +21962,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 TINYTEXT NOT NULL; SHOW TABLES; @@ -21971,7 +21971,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` tinytext NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -23018,7 +23018,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 TEXT NOT NULL; SHOW TABLES; @@ -23027,7 +23027,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` text NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -24074,7 +24074,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 MEDIUMTEXT NOT NULL; SHOW TABLES; @@ -24083,7 +24083,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` mediumtext NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -25130,7 +25130,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 LONGTEXT NOT NULL; SHOW TABLES; @@ -25139,7 +25139,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` longtext NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; diff --git a/mysql-test/suite/engines/funcs/r/ta_add_column2.result b/mysql-test/suite/engines/funcs/r/ta_add_column2.result index 1a1d074af21..cf376f736fb 100644 --- a/mysql-test/suite/engines/funcs/r/ta_add_column2.result +++ b/mysql-test/suite/engines/funcs/r/ta_add_column2.result @@ -2568,7 +2568,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` char(15) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -2590,7 +2590,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(15) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -2612,7 +2612,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` binary(15) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -2634,7 +2634,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(15) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; diff --git a/mysql-test/suite/engines/funcs/r/ta_add_column_first.result b/mysql-test/suite/engines/funcs/r/ta_add_column_first.result index 1fd73d3507d..6007bbe4de6 100644 --- a/mysql-test/suite/engines/funcs/r/ta_add_column_first.result +++ b/mysql-test/suite/engines/funcs/r/ta_add_column_first.result @@ -842,7 +842,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 BIT NOT NULL FIRST; SHOW TABLES; @@ -852,7 +852,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c2` bit(1) NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -1898,7 +1898,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 TINYINT NOT NULL FIRST; SHOW TABLES; @@ -1908,7 +1908,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c2` tinyint(4) NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -2954,7 +2954,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 SMALLINT NOT NULL FIRST; SHOW TABLES; @@ -2964,7 +2964,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c2` smallint(6) NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -4010,7 +4010,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 MEDIUMINT NOT NULL FIRST; SHOW TABLES; @@ -4020,7 +4020,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c2` mediumint(9) NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -5066,7 +5066,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 INT NOT NULL FIRST; SHOW TABLES; @@ -5076,7 +5076,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c2` int(11) NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -6122,7 +6122,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 INTEGER NOT NULL FIRST; SHOW TABLES; @@ -6132,7 +6132,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c2` int(11) NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -7178,7 +7178,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 BIGINT NOT NULL FIRST; SHOW TABLES; @@ -7188,7 +7188,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c2` bigint(20) NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -8234,7 +8234,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 REAL NOT NULL FIRST; SHOW TABLES; @@ -8244,7 +8244,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c2` double NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -9290,7 +9290,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 DOUBLE NOT NULL FIRST; SHOW TABLES; @@ -9300,7 +9300,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c2` double NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -10346,7 +10346,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 FLOAT NOT NULL FIRST; SHOW TABLES; @@ -10356,7 +10356,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c2` float NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -11402,7 +11402,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 DECIMAL NOT NULL FIRST; SHOW TABLES; @@ -11412,7 +11412,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c2` decimal(10,0) NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -12458,7 +12458,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 NUMERIC NOT NULL FIRST; SHOW TABLES; @@ -12468,7 +12468,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c2` decimal(10,0) NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -13514,7 +13514,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 DATE NOT NULL FIRST; SHOW TABLES; @@ -13524,7 +13524,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c2` date NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -14570,7 +14570,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 TIME NOT NULL FIRST; SHOW TABLES; @@ -14580,7 +14580,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c2` time NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -15626,7 +15626,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 YEAR NOT NULL FIRST; SHOW TABLES; @@ -15636,7 +15636,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c2` year(4) NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -16682,7 +16682,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 TINYBLOB NOT NULL FIRST; SHOW TABLES; @@ -16692,7 +16692,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c2` tinyblob NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -17738,7 +17738,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 BLOB NOT NULL FIRST; SHOW TABLES; @@ -17748,7 +17748,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c2` blob NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -18794,7 +18794,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 MEDIUMBLOB NOT NULL FIRST; SHOW TABLES; @@ -18804,7 +18804,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c2` mediumblob NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -19850,7 +19850,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 LONGBLOB NOT NULL FIRST; SHOW TABLES; @@ -19860,7 +19860,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c2` longblob NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -20906,7 +20906,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 TINYTEXT NOT NULL FIRST; SHOW TABLES; @@ -20916,7 +20916,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c2` tinytext NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -21962,7 +21962,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 TEXT NOT NULL FIRST; SHOW TABLES; @@ -21972,7 +21972,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c2` text NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -23018,7 +23018,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 MEDIUMTEXT NOT NULL FIRST; SHOW TABLES; @@ -23028,7 +23028,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c2` mediumtext NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -24074,7 +24074,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD c2 LONGTEXT NOT NULL FIRST; SHOW TABLES; @@ -24084,7 +24084,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c2` longtext NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; diff --git a/mysql-test/suite/engines/funcs/r/ta_add_column_first2.result b/mysql-test/suite/engines/funcs/r/ta_add_column_first2.result index 8c0871e4f77..5555215a5ec 100644 --- a/mysql-test/suite/engines/funcs/r/ta_add_column_first2.result +++ b/mysql-test/suite/engines/funcs/r/ta_add_column_first2.result @@ -2567,7 +2567,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c1` char(15) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2589,7 +2589,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c1` varchar(15) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2611,7 +2611,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c1` binary(15) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2633,7 +2633,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c1` varbinary(15) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; diff --git a/mysql-test/suite/engines/funcs/r/ta_add_column_middle.result b/mysql-test/suite/engines/funcs/r/ta_add_column_middle.result index 75deecf05b7..47c17aba9ab 100644 --- a/mysql-test/suite/engines/funcs/r/ta_add_column_middle.result +++ b/mysql-test/suite/engines/funcs/r/ta_add_column_middle.result @@ -1071,7 +1071,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -1083,7 +1083,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` bit(1) NOT NULL, `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) @@ -2415,7 +2415,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -2427,7 +2427,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` tinyint(4) NOT NULL, `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) @@ -3759,7 +3759,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -3771,7 +3771,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` smallint(6) NOT NULL, `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) @@ -5103,7 +5103,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -5115,7 +5115,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` mediumint(9) NOT NULL, `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) @@ -6447,7 +6447,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -6459,7 +6459,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` int(11) NOT NULL, `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) @@ -7791,7 +7791,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -7803,7 +7803,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` int(11) NOT NULL, `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) @@ -9135,7 +9135,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -9147,7 +9147,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` bigint(20) NOT NULL, `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) @@ -10479,7 +10479,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -10491,7 +10491,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` double NOT NULL, `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) @@ -11823,7 +11823,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -11835,7 +11835,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` double NOT NULL, `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) @@ -13167,7 +13167,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -13179,7 +13179,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` float NOT NULL, `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) @@ -14511,7 +14511,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -14523,7 +14523,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` decimal(10,0) NOT NULL, `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) @@ -15855,7 +15855,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -15867,7 +15867,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` decimal(10,0) NOT NULL, `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) @@ -17199,7 +17199,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -17211,7 +17211,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` date NOT NULL, `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) @@ -18543,7 +18543,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -18555,7 +18555,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` time NOT NULL, `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) @@ -19508,7 +19508,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` bit(1) NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` bit(1) NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -19536,7 +19536,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` tinyint(4) NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` tinyint(4) NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -19564,7 +19564,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` smallint(6) NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` smallint(6) NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -19592,7 +19592,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` mediumint(9) NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` mediumint(9) NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -19620,7 +19620,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` int(11) NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -19648,7 +19648,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` int(11) NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` int(11) NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -19676,7 +19676,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` bigint(20) NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` bigint(20) NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -19704,7 +19704,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` double NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` double NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -19732,7 +19732,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` double NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` double NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -19760,7 +19760,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` float NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` float NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -19788,7 +19788,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` decimal(10,0) NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` decimal(10,0) NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -19816,7 +19816,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` decimal(10,0) NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` decimal(10,0) NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -19844,7 +19844,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` date NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` date NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -19872,7 +19872,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` time NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` time NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -19887,7 +19887,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -19899,7 +19899,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) @@ -19928,7 +19928,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` year(4) NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` year(4) NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -19956,7 +19956,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` tinyblob NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` tinyblob NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -19984,7 +19984,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` blob NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` blob NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -20012,7 +20012,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` mediumblob NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` mediumblob NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -20040,7 +20040,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` longblob NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` longblob NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -20068,7 +20068,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` tinytext NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` tinytext NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -20096,7 +20096,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` text NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` text NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -20124,7 +20124,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` mediumtext NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` mediumtext NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -20152,7 +20152,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` longtext NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` longtext NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -21231,7 +21231,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -21243,7 +21243,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` year(4) NOT NULL, `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) @@ -22575,7 +22575,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -22587,7 +22587,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` tinyblob NOT NULL, `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) @@ -23919,7 +23919,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -23931,7 +23931,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` blob NOT NULL, `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) @@ -25263,7 +25263,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -25275,7 +25275,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` mediumblob NOT NULL, `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) @@ -26607,7 +26607,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -26619,7 +26619,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` longblob NOT NULL, `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) @@ -27951,7 +27951,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -27963,7 +27963,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` tinytext NOT NULL, `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) @@ -29295,7 +29295,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -29307,7 +29307,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` text NOT NULL, `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) @@ -30639,7 +30639,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -30651,7 +30651,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` mediumtext NOT NULL, `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) @@ -31983,7 +31983,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -31995,7 +31995,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c2` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c4` longtext NOT NULL, `c3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`c1`) diff --git a/mysql-test/suite/engines/funcs/r/ta_add_column_middle2.result b/mysql-test/suite/engines/funcs/r/ta_add_column_middle2.result index 5303ee0ce71..3b903781d91 100644 --- a/mysql-test/suite/engines/funcs/r/ta_add_column_middle2.result +++ b/mysql-test/suite/engines/funcs/r/ta_add_column_middle2.result @@ -3268,7 +3268,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` char(15) NOT NULL, `c2` int(11) NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` char(20) NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -3296,7 +3296,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(15) NOT NULL, `c2` int(11) NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` varchar(20) NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -3324,7 +3324,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` binary(15) NOT NULL, `c2` int(11) NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` binary(20) NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 @@ -3352,7 +3352,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(15) NOT NULL, `c2` int(11) NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c3` varbinary(20) NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 diff --git a/mysql-test/suite/engines/funcs/r/ta_add_string2.result b/mysql-test/suite/engines/funcs/r/ta_add_string2.result index 82c4f5ff75b..d17f66523f7 100644 --- a/mysql-test/suite/engines/funcs/r/ta_add_string2.result +++ b/mysql-test/suite/engines/funcs/r/ta_add_string2.result @@ -842,7 +842,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t5 ADD c2 CHAR(5) NOT NULL; SHOW TABLES; @@ -851,7 +851,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` char(5) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; @@ -1898,7 +1898,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t5 ADD c2 VARCHAR(5) NOT NULL; SHOW TABLES; @@ -1907,7 +1907,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` varchar(5) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; @@ -2954,7 +2954,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t5 ADD c2 BINARY(5) NOT NULL; SHOW TABLES; @@ -2963,7 +2963,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` binary(5) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; @@ -4010,7 +4010,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t5 ADD c2 VARBINARY(5) NOT NULL; SHOW TABLES; @@ -4019,7 +4019,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` varbinary(5) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; diff --git a/mysql-test/suite/engines/funcs/r/ta_add_string_first2.result b/mysql-test/suite/engines/funcs/r/ta_add_string_first2.result index 8b2ad0d98b9..6298df8d18d 100644 --- a/mysql-test/suite/engines/funcs/r/ta_add_string_first2.result +++ b/mysql-test/suite/engines/funcs/r/ta_add_string_first2.result @@ -842,7 +842,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t5 ADD c2 CHAR(5) NOT NULL FIRST; SHOW TABLES; @@ -852,7 +852,7 @@ SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( `c2` char(5) NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; @@ -1898,7 +1898,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t5 ADD c2 VARCHAR(5) NOT NULL FIRST; SHOW TABLES; @@ -1908,7 +1908,7 @@ SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( `c2` varchar(5) NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; @@ -2954,7 +2954,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t5 ADD c2 BINARY(5) NOT NULL FIRST; SHOW TABLES; @@ -2964,7 +2964,7 @@ SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( `c2` binary(5) NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; @@ -4010,7 +4010,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t5 ADD c2 VARBINARY(5) NOT NULL FIRST; SHOW TABLES; @@ -4020,7 +4020,7 @@ SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( `c2` varbinary(5) NOT NULL, - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; diff --git a/mysql-test/suite/engines/funcs/r/ta_add_string_middle2.result b/mysql-test/suite/engines/funcs/r/ta_add_string_middle2.result index 8a032e4108b..593090236fe 100644 --- a/mysql-test/suite/engines/funcs/r/ta_add_string_middle2.result +++ b/mysql-test/suite/engines/funcs/r/ta_add_string_middle2.result @@ -398,7 +398,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` int(11) NOT NULL, `c3` char(10) DEFAULT NULL, PRIMARY KEY (`c1`) @@ -410,7 +410,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` int(11) NOT NULL, `c4` char(5) DEFAULT NULL, `c3` char(10) DEFAULT NULL, @@ -846,7 +846,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` int(11) NOT NULL, `c3` char(10) NOT NULL, PRIMARY KEY (`c1`) @@ -858,7 +858,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` int(11) NOT NULL, `c4` char(5) NOT NULL, `c3` char(10) NOT NULL, @@ -1294,7 +1294,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` int(11) NOT NULL, `c3` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) @@ -1306,7 +1306,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` int(11) NOT NULL, `c4` varchar(5) DEFAULT NULL, `c3` varchar(10) DEFAULT NULL, @@ -1742,7 +1742,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` int(11) NOT NULL, `c3` varchar(10) NOT NULL, PRIMARY KEY (`c1`) @@ -1754,7 +1754,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` int(11) NOT NULL, `c4` varchar(5) NOT NULL, `c3` varchar(10) NOT NULL, @@ -2190,7 +2190,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` int(11) NOT NULL, `c3` binary(10) DEFAULT NULL, PRIMARY KEY (`c1`) @@ -2202,7 +2202,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` int(11) NOT NULL, `c4` binary(5) DEFAULT NULL, `c3` binary(10) DEFAULT NULL, @@ -2638,7 +2638,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` int(11) NOT NULL, `c3` binary(10) NOT NULL, PRIMARY KEY (`c1`) @@ -2650,7 +2650,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` int(11) NOT NULL, `c4` binary(5) NOT NULL, `c3` binary(10) NOT NULL, @@ -3086,7 +3086,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` int(11) NOT NULL, `c3` varbinary(10) DEFAULT NULL, PRIMARY KEY (`c1`) @@ -3098,7 +3098,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` int(11) NOT NULL, `c4` varbinary(5) DEFAULT NULL, `c3` varbinary(10) DEFAULT NULL, @@ -3534,7 +3534,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` int(11) NOT NULL, `c3` varbinary(10) NOT NULL, PRIMARY KEY (`c1`) @@ -3546,7 +3546,7 @@ t5 SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` int(11) NOT NULL, `c4` varbinary(5) NOT NULL, `c3` varbinary(10) NOT NULL, diff --git a/mysql-test/suite/engines/funcs/r/ta_add_unique_index.result b/mysql-test/suite/engines/funcs/r/ta_add_unique_index.result index 2a7f3684541..f963adbe673 100644 --- a/mysql-test/suite/engines/funcs/r/ta_add_unique_index.result +++ b/mysql-test/suite/engines/funcs/r/ta_add_unique_index.result @@ -314,7 +314,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD UNIQUE (c1); SHOW TABLES; @@ -323,7 +323,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `c1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -666,7 +666,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD UNIQUE KEY (c1); SHOW TABLES; @@ -675,7 +675,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `c1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -1018,7 +1018,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD UNIQUE INDEX (c1); SHOW TABLES; @@ -1027,7 +1027,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `c1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -1370,7 +1370,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD CONSTRAINT UNIQUE (c1); SHOW TABLES; @@ -1379,7 +1379,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `c1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -1722,7 +1722,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD CONSTRAINT UNIQUE KEY (c1); SHOW TABLES; @@ -1731,7 +1731,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `c1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2074,7 +2074,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD CONSTRAINT UNIQUE INDEX (c1); SHOW TABLES; @@ -2083,7 +2083,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `c1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2426,7 +2426,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD CONSTRAINT cst1 UNIQUE (c1); SHOW TABLES; @@ -2435,7 +2435,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `cst1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2778,7 +2778,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD CONSTRAINT cst1 UNIQUE KEY (c1); SHOW TABLES; @@ -2787,7 +2787,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `cst1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -3130,7 +3130,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD CONSTRAINT cst1 UNIQUE INDEX (c1); SHOW TABLES; @@ -3139,7 +3139,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `cst1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -3482,7 +3482,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD UNIQUE i1 (c1); SHOW TABLES; @@ -3491,7 +3491,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `i1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -3834,7 +3834,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD UNIQUE KEY i1 (c1); SHOW TABLES; @@ -3843,7 +3843,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `i1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -4186,7 +4186,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD UNIQUE INDEX i1 (c1); SHOW TABLES; @@ -4195,7 +4195,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `i1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -4538,7 +4538,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD CONSTRAINT UNIQUE i1 (c1); SHOW TABLES; @@ -4547,7 +4547,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `i1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -4890,7 +4890,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD CONSTRAINT UNIQUE KEY i1 (c1); SHOW TABLES; @@ -4899,7 +4899,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `i1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -5242,7 +5242,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD CONSTRAINT UNIQUE INDEX i1 (c1); SHOW TABLES; @@ -5251,7 +5251,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `i1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -5594,7 +5594,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD CONSTRAINT cst1 UNIQUE i1 (c1); SHOW TABLES; @@ -5603,7 +5603,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `i1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -5946,7 +5946,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD CONSTRAINT cst1 UNIQUE KEY i1 (c1); SHOW TABLES; @@ -5955,7 +5955,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `i1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -6298,7 +6298,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD CONSTRAINT cst1 UNIQUE INDEX i1 (c1); SHOW TABLES; @@ -6307,7 +6307,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `i1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; diff --git a/mysql-test/suite/engines/funcs/r/ta_column_to_index.result b/mysql-test/suite/engines/funcs/r/ta_column_to_index.result index 41dcf1f8549..88986855ec2 100644 --- a/mysql-test/suite/engines/funcs/r/ta_column_to_index.result +++ b/mysql-test/suite/engines/funcs/r/ta_column_to_index.result @@ -314,7 +314,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD KEY (c1); SHOW TABLES; @@ -323,7 +323,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), KEY `c1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -666,7 +666,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD KEY USING BTREE (c1); SHOW TABLES; @@ -675,7 +675,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), KEY `c1` (`c1`) USING BTREE ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -1018,7 +1018,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD KEY USING HASH (c1); SHOW TABLES; @@ -1027,7 +1027,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), KEY `c1` (`c1`) USING HASH ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -1370,7 +1370,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD INDEX (c1); SHOW TABLES; @@ -1379,7 +1379,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), KEY `c1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -1722,7 +1722,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD INDEX USING BTREE (c1); SHOW TABLES; @@ -1731,7 +1731,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), KEY `c1` (`c1`) USING BTREE ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2074,7 +2074,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD INDEX USING HASH (c1); SHOW TABLES; @@ -2083,7 +2083,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), KEY `c1` (`c1`) USING HASH ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2426,7 +2426,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD KEY i1 (c1); SHOW TABLES; @@ -2435,7 +2435,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), KEY `i1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2778,7 +2778,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD KEY i1 USING BTREE (c1); SHOW TABLES; @@ -2787,7 +2787,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), KEY `i1` (`c1`) USING BTREE ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -3130,7 +3130,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD KEY i1 USING HASH (c1); SHOW TABLES; @@ -3139,7 +3139,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), KEY `i1` (`c1`) USING HASH ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -3482,7 +3482,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD INDEX i1 (c1); SHOW TABLES; @@ -3491,7 +3491,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), KEY `i1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -3834,7 +3834,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD INDEX i1 USING BTREE (c1); SHOW TABLES; @@ -3843,7 +3843,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), KEY `i1` (`c1`) USING BTREE ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -4186,7 +4186,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD INDEX i1 USING HASH (c1); SHOW TABLES; @@ -4195,7 +4195,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), KEY `i1` (`c1`) USING HASH ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; diff --git a/mysql-test/suite/engines/funcs/r/ta_column_to_not_null.result b/mysql-test/suite/engines/funcs/r/ta_column_to_not_null.result index 6538ebe1102..af6f47bdf45 100644 --- a/mysql-test/suite/engines/funcs/r/ta_column_to_not_null.result +++ b/mysql-test/suite/engines/funcs/r/ta_column_to_not_null.result @@ -309,7 +309,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -813,7 +813,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; diff --git a/mysql-test/suite/engines/funcs/r/ta_column_to_null.result b/mysql-test/suite/engines/funcs/r/ta_column_to_null.result index 55f9d589185..04850bedf1b 100644 --- a/mysql-test/suite/engines/funcs/r/ta_column_to_null.result +++ b/mysql-test/suite/engines/funcs/r/ta_column_to_null.result @@ -300,7 +300,7 @@ t2 SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t2 MODIFY c1 TIMESTAMP NULL; SHOW TABLES; @@ -804,7 +804,7 @@ t2 SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t2 CHANGE c1 c1 TIMESTAMP NULL; SHOW TABLES; diff --git a/mysql-test/suite/engines/funcs/r/ta_column_to_pk.result b/mysql-test/suite/engines/funcs/r/ta_column_to_pk.result index ed3a17495f1..c76df99b424 100644 --- a/mysql-test/suite/engines/funcs/r/ta_column_to_pk.result +++ b/mysql-test/suite/engines/funcs/r/ta_column_to_pk.result @@ -314,7 +314,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 ADD PRIMARY KEY (c1); SHOW TABLES; @@ -323,7 +323,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; diff --git a/mysql-test/suite/engines/funcs/r/ta_drop_column.result b/mysql-test/suite/engines/funcs/r/ta_drop_column.result index eb5b118785b..b650da1fdf3 100644 --- a/mysql-test/suite/engines/funcs/r/ta_drop_column.result +++ b/mysql-test/suite/engines/funcs/r/ta_drop_column.result @@ -300,7 +300,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 DROP c2; @@ -309,7 +309,7 @@ ERROR 42000: You can't delete all columns with ALTER TABLE; use DROP TABLE inste SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -636,7 +636,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 DROP COLUMN c2; @@ -645,7 +645,7 @@ ERROR 42000: You can't delete all columns with ALTER TABLE; use DROP TABLE inste SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; diff --git a/mysql-test/suite/engines/funcs/r/ta_drop_index.result b/mysql-test/suite/engines/funcs/r/ta_drop_index.result index 9e1f268bf25..1dface5be50 100644 --- a/mysql-test/suite/engines/funcs/r/ta_drop_index.result +++ b/mysql-test/suite/engines/funcs/r/ta_drop_index.result @@ -314,7 +314,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), KEY `i1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 DROP KEY i1; @@ -324,7 +324,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -666,7 +666,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), KEY `i1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 DROP KEY i1; @@ -676,7 +676,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -1018,7 +1018,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), KEY `i1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 DROP KEY i1; @@ -1028,7 +1028,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -1370,7 +1370,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), KEY `i1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 DROP INDEX i1; @@ -1380,7 +1380,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -1722,7 +1722,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), KEY `i1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 DROP INDEX i1; @@ -1732,7 +1732,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; @@ -2074,7 +2074,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), KEY `i1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 DROP INDEX i1; @@ -2084,7 +2084,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; diff --git a/mysql-test/suite/engines/funcs/r/ta_drop_pk_number.result b/mysql-test/suite/engines/funcs/r/ta_drop_pk_number.result index 615c861d50d..554037236cc 100644 --- a/mysql-test/suite/engines/funcs/r/ta_drop_pk_number.result +++ b/mysql-test/suite/engines/funcs/r/ta_drop_pk_number.result @@ -314,7 +314,7 @@ t9 SHOW CREATE TABLE t9; Table Create Table t9 CREATE TABLE `t9` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t9 DROP PRIMARY KEY; @@ -324,7 +324,7 @@ t9 SHOW CREATE TABLE t9; Table Create Table t9 CREATE TABLE `t9` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t9; SHOW TABLES; diff --git a/mysql-test/suite/engines/funcs/r/ta_rename.result b/mysql-test/suite/engines/funcs/r/ta_rename.result index f9e78428f9e..f3d2a4aa514 100644 --- a/mysql-test/suite/engines/funcs/r/ta_rename.result +++ b/mysql-test/suite/engines/funcs/r/ta_rename.result @@ -356,7 +356,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 RENAME t2; @@ -368,7 +368,7 @@ ERROR 42S02: Unknown table 'test.t1' SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t2; @@ -756,7 +756,7 @@ t1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 RENAME TO t2; @@ -768,7 +768,7 @@ ERROR 42S02: Unknown table 'test.t1' SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c2` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t2; diff --git a/mysql-test/suite/engines/funcs/r/tc_column_key.result b/mysql-test/suite/engines/funcs/r/tc_column_key.result index 0751f981178..dd7b96787e2 100644 --- a/mysql-test/suite/engines/funcs/r/tc_column_key.result +++ b/mysql-test/suite/engines/funcs/r/tc_column_key.result @@ -227,7 +227,7 @@ t9 SHOW CREATE TABLE t9; Table Create Table t9 CREATE TABLE `t9` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t9; diff --git a/mysql-test/suite/engines/funcs/r/tc_column_not_null.result b/mysql-test/suite/engines/funcs/r/tc_column_not_null.result index 62a5f5e8d16..2faf94fa930 100644 --- a/mysql-test/suite/engines/funcs/r/tc_column_not_null.result +++ b/mysql-test/suite/engines/funcs/r/tc_column_not_null.result @@ -210,7 +210,7 @@ t2 SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t2; SHOW TABLES; diff --git a/mysql-test/suite/engines/funcs/r/tc_column_primary_key_number.result b/mysql-test/suite/engines/funcs/r/tc_column_primary_key_number.result index 91c2f4f8a7c..16337051d2d 100644 --- a/mysql-test/suite/engines/funcs/r/tc_column_primary_key_number.result +++ b/mysql-test/suite/engines/funcs/r/tc_column_primary_key_number.result @@ -227,7 +227,7 @@ t9 SHOW CREATE TABLE t9; Table Create Table t9 CREATE TABLE `t9` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t9; diff --git a/mysql-test/suite/engines/funcs/r/tc_column_unique_key.result b/mysql-test/suite/engines/funcs/r/tc_column_unique_key.result index e4892c7fb86..baba2510e5a 100644 --- a/mysql-test/suite/engines/funcs/r/tc_column_unique_key.result +++ b/mysql-test/suite/engines/funcs/r/tc_column_unique_key.result @@ -227,7 +227,7 @@ t9 SHOW CREATE TABLE t9; Table Create Table t9 CREATE TABLE `t9` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `c1` (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t9; diff --git a/mysql-test/suite/engines/funcs/r/tc_partition_analyze.result b/mysql-test/suite/engines/funcs/r/tc_partition_analyze.result index 4611766d5ca..852b300332b 100644 --- a/mysql-test/suite/engines/funcs/r/tc_partition_analyze.result +++ b/mysql-test/suite/engines/funcs/r/tc_partition_analyze.result @@ -24,13 +24,13 @@ t1 CREATE TABLE `t1` ( `c2` char(10) DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (c1) + PARTITION BY RANGE (c1) (PARTITION p0 VALUES LESS THAN (100) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (200) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (300) ENGINE = ENGINE, PARTITION p3 VALUES LESS THAN (400) ENGINE = ENGINE, PARTITION p4 VALUES LESS THAN (500) ENGINE = ENGINE, - PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) ALTER TABLE t1 ANALYZE PARTITION p1,p2; Table Op Msg_type Msg_text test.t1 analyze status OK @@ -48,13 +48,13 @@ t1 CREATE TABLE `t1` ( `c2` char(10) DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (c1) + PARTITION BY RANGE (c1) (PARTITION p0 VALUES LESS THAN (100) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (200) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (300) ENGINE = ENGINE, PARTITION p3 VALUES LESS THAN (400) ENGINE = ENGINE, PARTITION p4 VALUES LESS THAN (500) ENGINE = ENGINE, - PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test diff --git a/mysql-test/suite/engines/funcs/r/tc_partition_change_from_range_to_hash_key.result b/mysql-test/suite/engines/funcs/r/tc_partition_change_from_range_to_hash_key.result index bbaaeea8af7..805e4637928 100644 --- a/mysql-test/suite/engines/funcs/r/tc_partition_change_from_range_to_hash_key.result +++ b/mysql-test/suite/engines/funcs/r/tc_partition_change_from_range_to_hash_key.result @@ -34,8 +34,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 5 */ + PARTITION BY HASH (c1) +PARTITIONS 5 ALTER TABLE t1 COALESCE PARTITION 2; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -56,8 +56,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 3 */ + PARTITION BY HASH (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -97,8 +97,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 5 */ + PARTITION BY HASH (c1) +PARTITIONS 5 ALTER TABLE t1 COALESCE PARTITION 2; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -119,8 +119,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 3 */ + PARTITION BY HASH (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -160,8 +160,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 5 */ + PARTITION BY HASH (c1) +PARTITIONS 5 ALTER TABLE t1 COALESCE PARTITION 2; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -182,8 +182,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 3 */ + PARTITION BY HASH (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -223,8 +223,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 5 */ + PARTITION BY HASH (c1) +PARTITIONS 5 ALTER TABLE t1 COALESCE PARTITION 2; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -245,8 +245,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 3 */ + PARTITION BY HASH (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -286,8 +286,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 5 */ + PARTITION BY HASH (c1) +PARTITIONS 5 ALTER TABLE t1 COALESCE PARTITION 2; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -308,8 +308,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 3 */ + PARTITION BY HASH (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -349,8 +349,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 5 */ + PARTITION BY HASH (c1) +PARTITIONS 5 ALTER TABLE t1 COALESCE PARTITION 2; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -371,8 +371,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 3 */ + PARTITION BY HASH (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -412,8 +412,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 5 */ + PARTITION BY KEY (c1) +PARTITIONS 5 ALTER TABLE t1 COALESCE PARTITION 2; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -434,8 +434,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 3 */ + PARTITION BY KEY (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -475,8 +475,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 5 */ + PARTITION BY KEY (c1) +PARTITIONS 5 ALTER TABLE t1 COALESCE PARTITION 2; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -497,8 +497,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 3 */ + PARTITION BY KEY (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -538,8 +538,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 5 */ + PARTITION BY KEY (c1) +PARTITIONS 5 ALTER TABLE t1 COALESCE PARTITION 2; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -560,8 +560,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 3 */ + PARTITION BY KEY (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -601,8 +601,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 5 */ + PARTITION BY KEY (c1) +PARTITIONS 5 ALTER TABLE t1 COALESCE PARTITION 2; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -623,8 +623,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 3 */ + PARTITION BY KEY (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -664,8 +664,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 5 */ + PARTITION BY KEY (c1) +PARTITIONS 5 ALTER TABLE t1 COALESCE PARTITION 2; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -686,8 +686,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 3 */ + PARTITION BY KEY (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -727,8 +727,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 5 */ + PARTITION BY KEY (c1) +PARTITIONS 5 ALTER TABLE t1 COALESCE PARTITION 2; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -749,8 +749,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 3 */ + PARTITION BY KEY (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test diff --git a/mysql-test/suite/engines/funcs/r/tc_partition_check.result b/mysql-test/suite/engines/funcs/r/tc_partition_check.result index c03de001177..f2e10ec2a06 100644 --- a/mysql-test/suite/engines/funcs/r/tc_partition_check.result +++ b/mysql-test/suite/engines/funcs/r/tc_partition_check.result @@ -24,13 +24,13 @@ t1 CREATE TABLE `t1` ( `c2` char(10) DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (c1) + PARTITION BY RANGE (c1) (PARTITION p0 VALUES LESS THAN (100) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (200) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (300) ENGINE = ENGINE, PARTITION p3 VALUES LESS THAN (400) ENGINE = ENGINE, PARTITION p4 VALUES LESS THAN (500) ENGINE = ENGINE, - PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) ALTER TABLE t1 CHECK PARTITION p1,p2; Table Op Msg_type Msg_text test.t1 check status OK @@ -48,13 +48,13 @@ t1 CREATE TABLE `t1` ( `c2` char(10) DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (c1) + PARTITION BY RANGE (c1) (PARTITION p0 VALUES LESS THAN (100) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (200) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (300) ENGINE = ENGINE, PARTITION p3 VALUES LESS THAN (400) ENGINE = ENGINE, PARTITION p4 VALUES LESS THAN (500) ENGINE = ENGINE, - PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test diff --git a/mysql-test/suite/engines/funcs/r/tc_partition_hash.result b/mysql-test/suite/engines/funcs/r/tc_partition_hash.result index 72f32932bc0..8c29eb32d90 100644 --- a/mysql-test/suite/engines/funcs/r/tc_partition_hash.result +++ b/mysql-test/suite/engines/funcs/r/tc_partition_hash.result @@ -9,8 +9,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 1 */ + PARTITION BY HASH (c1) +PARTITIONS 1 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -24,8 +24,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 1 */ + PARTITION BY HASH (c1) +PARTITIONS 1 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -39,8 +39,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 1 */ + PARTITION BY HASH (c1) +PARTITIONS 1 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -54,8 +54,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 1 */ + PARTITION BY HASH (c1) +PARTITIONS 1 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -69,8 +69,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 1 */ + PARTITION BY HASH (c1) +PARTITIONS 1 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -84,8 +84,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 1 */ + PARTITION BY HASH (c1) +PARTITIONS 1 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -99,8 +99,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 1 */ + PARTITION BY HASH (c1) +PARTITIONS 1 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -114,8 +114,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 1 */ + PARTITION BY HASH (c1) +PARTITIONS 1 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -129,8 +129,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 1 */ + PARTITION BY HASH (c1) +PARTITIONS 1 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -144,8 +144,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 1 */ + PARTITION BY HASH (c1) +PARTITIONS 1 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -159,8 +159,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 1 */ + PARTITION BY HASH (c1) +PARTITIONS 1 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -174,8 +174,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 1 */ + PARTITION BY HASH (c1) +PARTITIONS 1 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -189,8 +189,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -204,8 +204,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -219,8 +219,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -234,8 +234,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -249,8 +249,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -264,8 +264,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -279,8 +279,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -294,8 +294,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -309,8 +309,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -324,8 +324,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -339,8 +339,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -354,8 +354,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -369,8 +369,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 3 */ + PARTITION BY HASH (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -384,8 +384,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 3 */ + PARTITION BY HASH (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -399,8 +399,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 3 */ + PARTITION BY HASH (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -414,8 +414,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 3 */ + PARTITION BY HASH (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -429,8 +429,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 3 */ + PARTITION BY HASH (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -444,8 +444,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 3 */ + PARTITION BY HASH (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -459,8 +459,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 3 */ + PARTITION BY HASH (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -474,8 +474,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 3 */ + PARTITION BY HASH (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -489,8 +489,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 3 */ + PARTITION BY HASH (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -504,8 +504,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 3 */ + PARTITION BY HASH (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -519,8 +519,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 3 */ + PARTITION BY HASH (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -534,8 +534,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 3 */ + PARTITION BY HASH (c1) +PARTITIONS 3 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -549,8 +549,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 4 */ + PARTITION BY HASH (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -564,8 +564,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 4 */ + PARTITION BY HASH (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -579,8 +579,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 4 */ + PARTITION BY HASH (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -594,8 +594,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 4 */ + PARTITION BY HASH (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -609,8 +609,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 4 */ + PARTITION BY HASH (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -624,8 +624,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 4 */ + PARTITION BY HASH (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -639,8 +639,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 4 */ + PARTITION BY HASH (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -654,8 +654,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 4 */ + PARTITION BY HASH (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -669,8 +669,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 4 */ + PARTITION BY HASH (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -684,8 +684,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 4 */ + PARTITION BY HASH (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -699,8 +699,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 4 */ + PARTITION BY HASH (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -714,8 +714,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 4 */ + PARTITION BY HASH (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -729,8 +729,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 5 */ + PARTITION BY HASH (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -744,8 +744,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 5 */ + PARTITION BY HASH (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -759,8 +759,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 5 */ + PARTITION BY HASH (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -774,8 +774,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 5 */ + PARTITION BY HASH (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -789,8 +789,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 5 */ + PARTITION BY HASH (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -804,8 +804,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 5 */ + PARTITION BY HASH (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -819,8 +819,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 5 */ + PARTITION BY HASH (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -834,8 +834,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 5 */ + PARTITION BY HASH (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -849,8 +849,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 5 */ + PARTITION BY HASH (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -864,8 +864,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 5 */ + PARTITION BY HASH (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -879,8 +879,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 5 */ + PARTITION BY HASH (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -894,8 +894,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 5 */ + PARTITION BY HASH (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -909,8 +909,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 10 */ + PARTITION BY HASH (c1) +PARTITIONS 10 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -924,8 +924,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 10 */ + PARTITION BY HASH (c1) +PARTITIONS 10 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -939,8 +939,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 10 */ + PARTITION BY HASH (c1) +PARTITIONS 10 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -954,8 +954,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 10 */ + PARTITION BY HASH (c1) +PARTITIONS 10 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -969,8 +969,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 10 */ + PARTITION BY HASH (c1) +PARTITIONS 10 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -984,8 +984,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 10 */ + PARTITION BY HASH (c1) +PARTITIONS 10 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -999,8 +999,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 10 */ + PARTITION BY HASH (c1) +PARTITIONS 10 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -1014,8 +1014,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 10 */ + PARTITION BY HASH (c1) +PARTITIONS 10 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -1029,8 +1029,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 10 */ + PARTITION BY HASH (c1) +PARTITIONS 10 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -1044,8 +1044,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 10 */ + PARTITION BY HASH (c1) +PARTITIONS 10 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -1059,8 +1059,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 10 */ + PARTITION BY HASH (c1) +PARTITIONS 10 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -1074,8 +1074,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 10 */ + PARTITION BY HASH (c1) +PARTITIONS 10 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -1089,8 +1089,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 50 */ + PARTITION BY HASH (c1) +PARTITIONS 50 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -1104,8 +1104,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 50 */ + PARTITION BY HASH (c1) +PARTITIONS 50 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -1119,8 +1119,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 50 */ + PARTITION BY HASH (c1) +PARTITIONS 50 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -1134,8 +1134,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 50 */ + PARTITION BY HASH (c1) +PARTITIONS 50 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -1149,8 +1149,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 50 */ + PARTITION BY HASH (c1) +PARTITIONS 50 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -1164,8 +1164,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 50 */ + PARTITION BY HASH (c1) +PARTITIONS 50 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -1179,8 +1179,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 50 */ + PARTITION BY HASH (c1) +PARTITIONS 50 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -1194,8 +1194,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 50 */ + PARTITION BY HASH (c1) +PARTITIONS 50 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -1209,8 +1209,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 50 */ + PARTITION BY HASH (c1) +PARTITIONS 50 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -1224,8 +1224,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 50 */ + PARTITION BY HASH (c1) +PARTITIONS 50 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -1239,8 +1239,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 50 */ + PARTITION BY HASH (c1) +PARTITIONS 50 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -1254,8 +1254,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 50 */ + PARTITION BY HASH (c1) +PARTITIONS 50 DROP TABLE t1; SHOW TABLES; Tables_in_test diff --git a/mysql-test/suite/engines/funcs/r/tc_partition_hash_date_function.result b/mysql-test/suite/engines/funcs/r/tc_partition_hash_date_function.result index ff154b8db6e..368ba8c0249 100644 --- a/mysql-test/suite/engines/funcs/r/tc_partition_hash_date_function.result +++ b/mysql-test/suite/engines/funcs/r/tc_partition_hash_date_function.result @@ -10,7 +10,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(c3)) */ + PARTITION BY HASH (YEAR(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -25,7 +25,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(c3)) */ + PARTITION BY HASH (YEAR(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -40,7 +40,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(c3)) */ + PARTITION BY HASH (YEAR(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -55,7 +55,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(c3)) */ + PARTITION BY HASH (YEAR(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -70,7 +70,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(c3)) */ + PARTITION BY HASH (YEAR(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -85,7 +85,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(c3)) */ + PARTITION BY HASH (YEAR(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -100,7 +100,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(c3)) */ + PARTITION BY HASH (YEAR(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -115,7 +115,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(c3)) */ + PARTITION BY HASH (YEAR(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -130,7 +130,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(c3)) */ + PARTITION BY HASH (YEAR(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -145,7 +145,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(c3)) */ + PARTITION BY HASH (YEAR(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -160,7 +160,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(c3)) */ + PARTITION BY HASH (YEAR(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -175,7 +175,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(c3)) */ + PARTITION BY HASH (YEAR(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -190,7 +190,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (MONTH(c3)) */ + PARTITION BY HASH (MONTH(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -205,7 +205,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (MONTH(c3)) */ + PARTITION BY HASH (MONTH(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -220,7 +220,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (MONTH(c3)) */ + PARTITION BY HASH (MONTH(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -235,7 +235,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (MONTH(c3)) */ + PARTITION BY HASH (MONTH(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -250,7 +250,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (MONTH(c3)) */ + PARTITION BY HASH (MONTH(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -265,7 +265,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (MONTH(c3)) */ + PARTITION BY HASH (MONTH(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -280,7 +280,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (MONTH(c3)) */ + PARTITION BY HASH (MONTH(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -295,7 +295,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (MONTH(c3)) */ + PARTITION BY HASH (MONTH(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -310,7 +310,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (MONTH(c3)) */ + PARTITION BY HASH (MONTH(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -325,7 +325,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (MONTH(c3)) */ + PARTITION BY HASH (MONTH(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -340,7 +340,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (MONTH(c3)) */ + PARTITION BY HASH (MONTH(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -355,7 +355,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (MONTH(c3)) */ + PARTITION BY HASH (MONTH(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -370,7 +370,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAY(c3)) */ + PARTITION BY HASH (DAY(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -385,7 +385,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAY(c3)) */ + PARTITION BY HASH (DAY(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -400,7 +400,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAY(c3)) */ + PARTITION BY HASH (DAY(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -415,7 +415,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAY(c3)) */ + PARTITION BY HASH (DAY(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -430,7 +430,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAY(c3)) */ + PARTITION BY HASH (DAY(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -445,7 +445,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAY(c3)) */ + PARTITION BY HASH (DAY(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -460,7 +460,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAY(c3)) */ + PARTITION BY HASH (DAY(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -475,7 +475,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAY(c3)) */ + PARTITION BY HASH (DAY(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -490,7 +490,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAY(c3)) */ + PARTITION BY HASH (DAY(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -505,7 +505,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAY(c3)) */ + PARTITION BY HASH (DAY(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -520,7 +520,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAY(c3)) */ + PARTITION BY HASH (DAY(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -535,7 +535,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAY(c3)) */ + PARTITION BY HASH (DAY(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -550,7 +550,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAYOFWEEK(c3)) */ + PARTITION BY HASH (DAYOFWEEK(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -565,7 +565,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAYOFWEEK(c3)) */ + PARTITION BY HASH (DAYOFWEEK(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -580,7 +580,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAYOFWEEK(c3)) */ + PARTITION BY HASH (DAYOFWEEK(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -595,7 +595,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAYOFWEEK(c3)) */ + PARTITION BY HASH (DAYOFWEEK(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -610,7 +610,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAYOFWEEK(c3)) */ + PARTITION BY HASH (DAYOFWEEK(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -625,7 +625,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAYOFWEEK(c3)) */ + PARTITION BY HASH (DAYOFWEEK(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -640,7 +640,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAYOFWEEK(c3)) */ + PARTITION BY HASH (DAYOFWEEK(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -655,7 +655,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAYOFWEEK(c3)) */ + PARTITION BY HASH (DAYOFWEEK(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -670,7 +670,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAYOFWEEK(c3)) */ + PARTITION BY HASH (DAYOFWEEK(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -685,7 +685,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAYOFWEEK(c3)) */ + PARTITION BY HASH (DAYOFWEEK(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -700,7 +700,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAYOFWEEK(c3)) */ + PARTITION BY HASH (DAYOFWEEK(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test @@ -715,7 +715,7 @@ t2 CREATE TABLE `t2` ( `c2` char(5) DEFAULT NULL, `c3` datetime DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAYOFWEEK(c3)) */ + PARTITION BY HASH (DAYOFWEEK(c3)) DROP TABLE t2; SHOW TABLES; Tables_in_test diff --git a/mysql-test/suite/engines/funcs/r/tc_partition_key.result b/mysql-test/suite/engines/funcs/r/tc_partition_key.result index 309ddfe2bd9..9ca335be0e2 100644 --- a/mysql-test/suite/engines/funcs/r/tc_partition_key.result +++ b/mysql-test/suite/engines/funcs/r/tc_partition_key.result @@ -9,8 +9,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -24,8 +24,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -39,8 +39,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -54,8 +54,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -69,8 +69,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -84,8 +84,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -99,8 +99,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -114,8 +114,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -129,8 +129,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -144,8 +144,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -159,8 +159,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -174,8 +174,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -189,8 +189,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 4 */ + PARTITION BY KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -204,8 +204,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 4 */ + PARTITION BY KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -219,8 +219,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 4 */ + PARTITION BY KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -234,8 +234,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 4 */ + PARTITION BY KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -249,8 +249,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 4 */ + PARTITION BY KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -264,8 +264,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 4 */ + PARTITION BY KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -279,8 +279,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 4 */ + PARTITION BY KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -294,8 +294,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 4 */ + PARTITION BY KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -309,8 +309,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 4 */ + PARTITION BY KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -324,8 +324,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 4 */ + PARTITION BY KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -339,8 +339,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 4 */ + PARTITION BY KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -354,8 +354,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 4 */ + PARTITION BY KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -369,8 +369,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 5 */ + PARTITION BY KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -384,8 +384,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 5 */ + PARTITION BY KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -399,8 +399,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 5 */ + PARTITION BY KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -414,8 +414,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 5 */ + PARTITION BY KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -429,8 +429,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 5 */ + PARTITION BY KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -444,8 +444,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 5 */ + PARTITION BY KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -459,8 +459,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 5 */ + PARTITION BY KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -474,8 +474,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 5 */ + PARTITION BY KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -489,8 +489,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 5 */ + PARTITION BY KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -504,8 +504,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 5 */ + PARTITION BY KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -519,8 +519,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 5 */ + PARTITION BY KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -534,8 +534,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 5 */ + PARTITION BY KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -549,8 +549,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 99 */ + PARTITION BY KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -564,8 +564,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 99 */ + PARTITION BY KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -579,8 +579,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 99 */ + PARTITION BY KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -594,8 +594,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 99 */ + PARTITION BY KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -609,8 +609,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 99 */ + PARTITION BY KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -624,8 +624,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 99 */ + PARTITION BY KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -639,8 +639,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 99 */ + PARTITION BY KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -654,8 +654,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 99 */ + PARTITION BY KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -669,8 +669,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 99 */ + PARTITION BY KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -684,8 +684,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 99 */ + PARTITION BY KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -699,8 +699,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 99 */ + PARTITION BY KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -714,8 +714,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 99 */ + PARTITION BY KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test diff --git a/mysql-test/suite/engines/funcs/r/tc_partition_linear_key.result b/mysql-test/suite/engines/funcs/r/tc_partition_linear_key.result index ae543da271c..0a560743832 100644 --- a/mysql-test/suite/engines/funcs/r/tc_partition_linear_key.result +++ b/mysql-test/suite/engines/funcs/r/tc_partition_linear_key.result @@ -9,8 +9,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -24,8 +24,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -39,8 +39,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -54,8 +54,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -69,8 +69,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -84,8 +84,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -99,8 +99,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -114,8 +114,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -129,8 +129,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -144,8 +144,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -159,8 +159,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -174,8 +174,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -189,8 +189,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 4 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -204,8 +204,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 4 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -219,8 +219,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 4 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -234,8 +234,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 4 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -249,8 +249,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 4 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -264,8 +264,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 4 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -279,8 +279,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 4 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -294,8 +294,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 4 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -309,8 +309,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 4 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -324,8 +324,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 4 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -339,8 +339,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 4 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -354,8 +354,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 4 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 4 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -369,8 +369,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 5 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -384,8 +384,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 5 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -399,8 +399,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 5 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -414,8 +414,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 5 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -429,8 +429,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 5 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -444,8 +444,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 5 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -459,8 +459,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 5 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -474,8 +474,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 5 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -489,8 +489,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 5 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -504,8 +504,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 5 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -519,8 +519,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 5 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -534,8 +534,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 5 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 5 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -549,8 +549,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 99 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -564,8 +564,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 99 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -579,8 +579,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 99 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -594,8 +594,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 99 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -609,8 +609,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 99 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -624,8 +624,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 99 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -639,8 +639,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 99 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -654,8 +654,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 99 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -669,8 +669,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 99 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -684,8 +684,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 99 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -699,8 +699,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 99 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -714,8 +714,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 99 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 99 DROP TABLE t1; SHOW TABLES; Tables_in_test diff --git a/mysql-test/suite/engines/funcs/r/tc_partition_optimize.result b/mysql-test/suite/engines/funcs/r/tc_partition_optimize.result index 78ad0ae8c7d..c30705c8194 100644 --- a/mysql-test/suite/engines/funcs/r/tc_partition_optimize.result +++ b/mysql-test/suite/engines/funcs/r/tc_partition_optimize.result @@ -24,13 +24,13 @@ t1 CREATE TABLE `t1` ( `c2` char(10) DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (c1) + PARTITION BY RANGE (c1) (PARTITION p0 VALUES LESS THAN (100) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (200) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (300) ENGINE = ENGINE, PARTITION p3 VALUES LESS THAN (400) ENGINE = ENGINE, PARTITION p4 VALUES LESS THAN (500) ENGINE = ENGINE, - PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) ALTER TABLE t1 OPTIMIZE PARTITION p1,p2; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -46,13 +46,13 @@ t1 CREATE TABLE `t1` ( `c2` char(10) DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (c1) + PARTITION BY RANGE (c1) (PARTITION p0 VALUES LESS THAN (100) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (200) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (300) ENGINE = ENGINE, PARTITION p3 VALUES LESS THAN (400) ENGINE = ENGINE, PARTITION p4 VALUES LESS THAN (500) ENGINE = ENGINE, - PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test diff --git a/mysql-test/suite/engines/funcs/r/tc_partition_rebuild.result b/mysql-test/suite/engines/funcs/r/tc_partition_rebuild.result index d2512532436..bef7ba0635d 100644 --- a/mysql-test/suite/engines/funcs/r/tc_partition_rebuild.result +++ b/mysql-test/suite/engines/funcs/r/tc_partition_rebuild.result @@ -24,13 +24,13 @@ t1 CREATE TABLE `t1` ( `c2` char(10) DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (c1) + PARTITION BY RANGE (c1) (PARTITION p0 VALUES LESS THAN (100) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (200) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (300) ENGINE = ENGINE, PARTITION p3 VALUES LESS THAN (400) ENGINE = ENGINE, PARTITION p4 VALUES LESS THAN (500) ENGINE = ENGINE, - PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) ALTER TABLE t1 REBUILD PARTITION p1,p2; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -46,13 +46,13 @@ t1 CREATE TABLE `t1` ( `c2` char(10) DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (c1) + PARTITION BY RANGE (c1) (PARTITION p0 VALUES LESS THAN (100) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (200) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (300) ENGINE = ENGINE, PARTITION p3 VALUES LESS THAN (400) ENGINE = ENGINE, PARTITION p4 VALUES LESS THAN (500) ENGINE = ENGINE, - PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test diff --git a/mysql-test/suite/engines/funcs/r/tc_partition_remove.result b/mysql-test/suite/engines/funcs/r/tc_partition_remove.result index ee91c5e358d..6e7831bd6c5 100644 --- a/mysql-test/suite/engines/funcs/r/tc_partition_remove.result +++ b/mysql-test/suite/engines/funcs/r/tc_partition_remove.result @@ -21,7 +21,7 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) */ + PARTITION BY HASH (c1) ALTER TABLE t1 REMOVE PARTITIONING; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -60,7 +60,7 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) */ + PARTITION BY HASH (c1) ALTER TABLE t1 REMOVE PARTITIONING; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -99,7 +99,7 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) */ + PARTITION BY HASH (c1) ALTER TABLE t1 REMOVE PARTITIONING; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -138,7 +138,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) */ + PARTITION BY HASH (c1) ALTER TABLE t1 REMOVE PARTITIONING; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -177,7 +177,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) */ + PARTITION BY HASH (c1) ALTER TABLE t1 REMOVE PARTITIONING; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -216,7 +216,7 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) DEFAULT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) */ + PARTITION BY HASH (c1) ALTER TABLE t1 REMOVE PARTITIONING; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -259,7 +259,7 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) */ + PARTITION BY HASH (c1) ALTER TABLE t1 REMOVE PARTITIONING; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -298,7 +298,7 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) */ + PARTITION BY HASH (c1) ALTER TABLE t1 REMOVE PARTITIONING; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -337,7 +337,7 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) */ + PARTITION BY HASH (c1) ALTER TABLE t1 REMOVE PARTITIONING; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -376,7 +376,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) */ + PARTITION BY HASH (c1) ALTER TABLE t1 REMOVE PARTITIONING; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -415,7 +415,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) */ + PARTITION BY HASH (c1) ALTER TABLE t1 REMOVE PARTITIONING; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -454,7 +454,7 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) */ + PARTITION BY HASH (c1) ALTER TABLE t1 REMOVE PARTITIONING; SELECT * FROM t1 ORDER BY c1; c1 c2 diff --git a/mysql-test/suite/engines/funcs/r/tc_partition_reorg_divide.result b/mysql-test/suite/engines/funcs/r/tc_partition_reorg_divide.result index a4c456d14bd..517c16083b3 100644 --- a/mysql-test/suite/engines/funcs/r/tc_partition_reorg_divide.result +++ b/mysql-test/suite/engines/funcs/r/tc_partition_reorg_divide.result @@ -44,12 +44,12 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE, PARTITION s1 VALUES LESS THAN (10) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (30) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) ALTER TABLE t1 DROP PARTITION s2; ERROR HY000: Error in list of partitions to DROP ALTER TABLE t1 DROP PARTITION s1; @@ -71,11 +71,11 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (30) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -125,12 +125,12 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE, PARTITION s1 VALUES LESS THAN (10) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (30) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) ALTER TABLE t1 DROP PARTITION s2; ERROR HY000: Error in list of partitions to DROP ALTER TABLE t1 DROP PARTITION s1; @@ -152,11 +152,11 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (30) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -206,12 +206,12 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE, PARTITION s1 VALUES LESS THAN (10) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (30) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) ALTER TABLE t1 DROP PARTITION s2; ERROR HY000: Error in list of partitions to DROP ALTER TABLE t1 DROP PARTITION s1; @@ -233,11 +233,11 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (30) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -287,12 +287,12 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE, PARTITION s1 VALUES LESS THAN (10) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (30) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) ALTER TABLE t1 DROP PARTITION s2; ERROR HY000: Error in list of partitions to DROP ALTER TABLE t1 DROP PARTITION s1; @@ -314,11 +314,11 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (30) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -368,12 +368,12 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE, PARTITION s1 VALUES LESS THAN (10) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (30) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) ALTER TABLE t1 DROP PARTITION s2; ERROR HY000: Error in list of partitions to DROP ALTER TABLE t1 DROP PARTITION s1; @@ -395,11 +395,11 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (30) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -449,12 +449,12 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE, PARTITION s1 VALUES LESS THAN (10) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (30) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) ALTER TABLE t1 DROP PARTITION s2; ERROR HY000: Error in list of partitions to DROP ALTER TABLE t1 DROP PARTITION s1; @@ -476,11 +476,11 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (30) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test diff --git a/mysql-test/suite/engines/funcs/r/tc_partition_reorg_hash_key.result b/mysql-test/suite/engines/funcs/r/tc_partition_reorg_hash_key.result index 3556bcf1e4f..18f07127cb3 100644 --- a/mysql-test/suite/engines/funcs/r/tc_partition_reorg_hash_key.result +++ b/mysql-test/suite/engines/funcs/r/tc_partition_reorg_hash_key.result @@ -19,8 +19,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 10 */ + PARTITION BY HASH (c1) +PARTITIONS 10 ALTER TABLE t1 ADD PARTITION PARTITIONS 10; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -41,8 +41,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 20 */ + PARTITION BY HASH (c1) +PARTITIONS 20 ALTER TABLE t1 COALESCE PARTITION 18; SHOW TABLES; Tables_in_test @@ -63,16 +63,16 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -97,8 +97,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 10 */ + PARTITION BY HASH (c1) +PARTITIONS 10 ALTER TABLE t1 ADD PARTITION PARTITIONS 10; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -119,8 +119,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 20 */ + PARTITION BY HASH (c1) +PARTITIONS 20 ALTER TABLE t1 COALESCE PARTITION 18; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -141,16 +141,16 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -175,8 +175,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 10 */ + PARTITION BY HASH (c1) +PARTITIONS 10 ALTER TABLE t1 ADD PARTITION PARTITIONS 10; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -197,8 +197,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 20 */ + PARTITION BY HASH (c1) +PARTITIONS 20 ALTER TABLE t1 COALESCE PARTITION 18; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -219,16 +219,16 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -253,8 +253,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 10 */ + PARTITION BY HASH (c1) +PARTITIONS 10 ALTER TABLE t1 ADD PARTITION PARTITIONS 10; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -275,8 +275,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 20 */ + PARTITION BY HASH (c1) +PARTITIONS 20 ALTER TABLE t1 COALESCE PARTITION 18; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -297,16 +297,16 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -331,8 +331,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 10 */ + PARTITION BY HASH (c1) +PARTITIONS 10 ALTER TABLE t1 ADD PARTITION PARTITIONS 10; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -353,8 +353,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 20 */ + PARTITION BY HASH (c1) +PARTITIONS 20 ALTER TABLE t1 COALESCE PARTITION 18; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -375,16 +375,16 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -409,8 +409,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 10 */ + PARTITION BY HASH (c1) +PARTITIONS 10 ALTER TABLE t1 ADD PARTITION PARTITIONS 10; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -431,8 +431,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 20 */ + PARTITION BY HASH (c1) +PARTITIONS 20 ALTER TABLE t1 COALESCE PARTITION 18; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -453,16 +453,16 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -487,8 +487,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 10 */ + PARTITION BY KEY (c1) +PARTITIONS 10 ALTER TABLE t1 ADD PARTITION PARTITIONS 10; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -509,8 +509,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 20 */ + PARTITION BY KEY (c1) +PARTITIONS 20 ALTER TABLE t1 COALESCE PARTITION 18; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -531,16 +531,16 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -565,8 +565,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 10 */ + PARTITION BY KEY (c1) +PARTITIONS 10 ALTER TABLE t1 ADD PARTITION PARTITIONS 10; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -587,8 +587,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 20 */ + PARTITION BY KEY (c1) +PARTITIONS 20 ALTER TABLE t1 COALESCE PARTITION 18; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -609,16 +609,16 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -643,8 +643,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 10 */ + PARTITION BY KEY (c1) +PARTITIONS 10 ALTER TABLE t1 ADD PARTITION PARTITIONS 10; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -665,8 +665,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 20 */ + PARTITION BY KEY (c1) +PARTITIONS 20 ALTER TABLE t1 COALESCE PARTITION 18; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -687,16 +687,16 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -721,8 +721,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 10 */ + PARTITION BY KEY (c1) +PARTITIONS 10 ALTER TABLE t1 ADD PARTITION PARTITIONS 10; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -743,8 +743,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 20 */ + PARTITION BY KEY (c1) +PARTITIONS 20 ALTER TABLE t1 COALESCE PARTITION 18; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -765,16 +765,16 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -799,8 +799,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 10 */ + PARTITION BY KEY (c1) +PARTITIONS 10 ALTER TABLE t1 ADD PARTITION PARTITIONS 10; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -821,8 +821,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 20 */ + PARTITION BY KEY (c1) +PARTITIONS 20 ALTER TABLE t1 COALESCE PARTITION 18; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -843,16 +843,16 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -877,8 +877,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 10 */ + PARTITION BY KEY (c1) +PARTITIONS 10 ALTER TABLE t1 ADD PARTITION PARTITIONS 10; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -899,8 +899,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 20 */ + PARTITION BY KEY (c1) +PARTITIONS 20 ALTER TABLE t1 COALESCE PARTITION 18; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -921,16 +921,16 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 2 */ + PARTITION BY KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -955,8 +955,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 10 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 10 ALTER TABLE t1 ADD PARTITION PARTITIONS 10; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -977,8 +977,8 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 20 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 20 ALTER TABLE t1 COALESCE PARTITION 18; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -999,16 +999,16 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -1033,8 +1033,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 10 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 10 ALTER TABLE t1 ADD PARTITION PARTITIONS 10; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -1055,8 +1055,8 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 20 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 20 ALTER TABLE t1 COALESCE PARTITION 18; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -1077,16 +1077,16 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -1111,8 +1111,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 10 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 10 ALTER TABLE t1 ADD PARTITION PARTITIONS 10; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -1133,8 +1133,8 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 20 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 20 ALTER TABLE t1 COALESCE PARTITION 18; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -1155,16 +1155,16 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -1189,8 +1189,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 10 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 10 ALTER TABLE t1 ADD PARTITION PARTITIONS 10; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -1211,8 +1211,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 20 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 20 ALTER TABLE t1 COALESCE PARTITION 18; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -1233,16 +1233,16 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -1267,8 +1267,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 10 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 10 ALTER TABLE t1 ADD PARTITION PARTITIONS 10; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -1289,8 +1289,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 20 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 20 ALTER TABLE t1 COALESCE PARTITION 18; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -1311,16 +1311,16 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -1345,8 +1345,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 10 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 10 ALTER TABLE t1 ADD PARTITION PARTITIONS 10; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -1367,8 +1367,8 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 20 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 20 ALTER TABLE t1 COALESCE PARTITION 18; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -1389,16 +1389,16 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LINEAR KEY (c1) -PARTITIONS 2 */ + PARTITION BY LINEAR KEY (c1) +PARTITIONS 2 DROP TABLE t1; SHOW TABLES; Tables_in_test diff --git a/mysql-test/suite/engines/funcs/r/tc_partition_reorg_merge.result b/mysql-test/suite/engines/funcs/r/tc_partition_reorg_merge.result index d7ffd0218cf..618b8dd2465 100644 --- a/mysql-test/suite/engines/funcs/r/tc_partition_reorg_merge.result +++ b/mysql-test/suite/engines/funcs/r/tc_partition_reorg_merge.result @@ -41,10 +41,10 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION p0 VALUES LESS THAN (10) ENGINE = ENGINE, PARTITION m0 VALUES LESS THAN (30) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) ALTER TABLE t1 DROP PARTITION m1; ERROR HY000: Error in list of partitions to DROP ALTER TABLE t1 DROP PARTITION m0; @@ -63,9 +63,9 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION p0 VALUES LESS THAN (10) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -112,10 +112,10 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION p0 VALUES LESS THAN (10) ENGINE = ENGINE, PARTITION m0 VALUES LESS THAN (30) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) ALTER TABLE t1 DROP PARTITION m1; ERROR HY000: Error in list of partitions to DROP ALTER TABLE t1 DROP PARTITION m0; @@ -134,9 +134,9 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION p0 VALUES LESS THAN (10) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -183,10 +183,10 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION p0 VALUES LESS THAN (10) ENGINE = ENGINE, PARTITION m0 VALUES LESS THAN (30) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) ALTER TABLE t1 DROP PARTITION m1; ERROR HY000: Error in list of partitions to DROP ALTER TABLE t1 DROP PARTITION m0; @@ -205,9 +205,9 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION p0 VALUES LESS THAN (10) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -254,10 +254,10 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION p0 VALUES LESS THAN (10) ENGINE = ENGINE, PARTITION m0 VALUES LESS THAN (30) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) ALTER TABLE t1 DROP PARTITION m1; ERROR HY000: Error in list of partitions to DROP ALTER TABLE t1 DROP PARTITION m0; @@ -276,9 +276,9 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION p0 VALUES LESS THAN (10) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -325,10 +325,10 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION p0 VALUES LESS THAN (10) ENGINE = ENGINE, PARTITION m0 VALUES LESS THAN (30) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) ALTER TABLE t1 DROP PARTITION m1; ERROR HY000: Error in list of partitions to DROP ALTER TABLE t1 DROP PARTITION m0; @@ -347,9 +347,9 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION p0 VALUES LESS THAN (10) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -396,10 +396,10 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION p0 VALUES LESS THAN (10) ENGINE = ENGINE, PARTITION m0 VALUES LESS THAN (30) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) ALTER TABLE t1 DROP PARTITION m1; ERROR HY000: Error in list of partitions to DROP ALTER TABLE t1 DROP PARTITION m0; @@ -418,9 +418,9 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL, `c2` char(5) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( c1) + PARTITION BY RANGE ( c1) (PARTITION p0 VALUES LESS THAN (10) ENGINE = ENGINE, - PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test diff --git a/mysql-test/suite/engines/funcs/r/tc_partition_repair.result b/mysql-test/suite/engines/funcs/r/tc_partition_repair.result index 254d527624a..98d9aa93740 100644 --- a/mysql-test/suite/engines/funcs/r/tc_partition_repair.result +++ b/mysql-test/suite/engines/funcs/r/tc_partition_repair.result @@ -24,13 +24,13 @@ t1 CREATE TABLE `t1` ( `c2` char(10) DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (c1) + PARTITION BY RANGE (c1) (PARTITION p0 VALUES LESS THAN (100) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (200) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (300) ENGINE = ENGINE, PARTITION p3 VALUES LESS THAN (400) ENGINE = ENGINE, PARTITION p4 VALUES LESS THAN (500) ENGINE = ENGINE, - PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) ALTER TABLE t1 REPAIR PARTITION p1,p2; SELECT * FROM t1 ORDER BY c1; c1 c2 @@ -46,13 +46,13 @@ t1 CREATE TABLE `t1` ( `c2` char(10) DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (c1) + PARTITION BY RANGE (c1) (PARTITION p0 VALUES LESS THAN (100) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (200) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (300) ENGINE = ENGINE, PARTITION p3 VALUES LESS THAN (400) ENGINE = ENGINE, PARTITION p4 VALUES LESS THAN (500) ENGINE = ENGINE, - PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test diff --git a/mysql-test/suite/engines/funcs/r/tc_partition_sub1.result b/mysql-test/suite/engines/funcs/r/tc_partition_sub1.result index a122f75b69a..6d1dc41a354 100644 --- a/mysql-test/suite/engines/funcs/r/tc_partition_sub1.result +++ b/mysql-test/suite/engines/funcs/r/tc_partition_sub1.result @@ -45,12 +45,12 @@ t1 CREATE TABLE `t1` ( `name` varchar(30) DEFAULT NULL, `purchased` date DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( YEAR(purchased)) + PARTITION BY RANGE ( YEAR(purchased)) SUBPARTITION BY HASH ( TO_DAYS(purchased)) SUBPARTITIONS 2 (PARTITION p0 VALUES LESS THAN (1990) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (2000) ENGINE = ENGINE, - PARTITION p2 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p2 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -100,12 +100,12 @@ t1 CREATE TABLE `t1` ( `name` varchar(30) DEFAULT NULL, `purchased` date DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( YEAR(purchased)) + PARTITION BY RANGE ( YEAR(purchased)) SUBPARTITION BY HASH ( TO_DAYS(purchased)) SUBPARTITIONS 2 (PARTITION p0 VALUES LESS THAN (1990) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (2000) ENGINE = ENGINE, - PARTITION p2 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p2 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -155,12 +155,12 @@ t1 CREATE TABLE `t1` ( `name` varchar(30) DEFAULT NULL, `purchased` date DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( YEAR(purchased)) + PARTITION BY RANGE ( YEAR(purchased)) SUBPARTITION BY HASH ( TO_DAYS(purchased)) SUBPARTITIONS 2 (PARTITION p0 VALUES LESS THAN (1990) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (2000) ENGINE = ENGINE, - PARTITION p2 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p2 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -210,12 +210,12 @@ t1 CREATE TABLE `t1` ( `name` varchar(30) DEFAULT NULL, `purchased` date DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( YEAR(purchased)) + PARTITION BY RANGE ( YEAR(purchased)) SUBPARTITION BY HASH ( TO_DAYS(purchased)) SUBPARTITIONS 2 (PARTITION p0 VALUES LESS THAN (1990) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (2000) ENGINE = ENGINE, - PARTITION p2 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p2 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -265,12 +265,12 @@ t1 CREATE TABLE `t1` ( `name` varchar(30) DEFAULT NULL, `purchased` date DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( YEAR(purchased)) + PARTITION BY RANGE ( YEAR(purchased)) SUBPARTITION BY HASH ( TO_DAYS(purchased)) SUBPARTITIONS 2 (PARTITION p0 VALUES LESS THAN (1990) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (2000) ENGINE = ENGINE, - PARTITION p2 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p2 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -320,12 +320,12 @@ t1 CREATE TABLE `t1` ( `name` varchar(30) DEFAULT NULL, `purchased` date DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( YEAR(purchased)) + PARTITION BY RANGE ( YEAR(purchased)) SUBPARTITION BY HASH ( TO_DAYS(purchased)) SUBPARTITIONS 2 (PARTITION p0 VALUES LESS THAN (1990) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (2000) ENGINE = ENGINE, - PARTITION p2 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p2 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test diff --git a/mysql-test/suite/engines/funcs/r/tc_partition_sub2.result b/mysql-test/suite/engines/funcs/r/tc_partition_sub2.result index bd1cd1b3b21..c6a0d9aac68 100644 --- a/mysql-test/suite/engines/funcs/r/tc_partition_sub2.result +++ b/mysql-test/suite/engines/funcs/r/tc_partition_sub2.result @@ -53,7 +53,7 @@ t1 CREATE TABLE `t1` ( `name` varchar(30) DEFAULT NULL, `purchased` date DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( YEAR(purchased)) + PARTITION BY RANGE ( YEAR(purchased)) SUBPARTITION BY HASH ( TO_DAYS(purchased)) (PARTITION p0 VALUES LESS THAN (1990) (SUBPARTITION s0 ENGINE = ENGINE, @@ -63,7 +63,7 @@ SUBPARTITION BY HASH ( TO_DAYS(purchased)) SUBPARTITION s3 ENGINE = ENGINE), PARTITION p2 VALUES LESS THAN MAXVALUE (SUBPARTITION s4 ENGINE = ENGINE, - SUBPARTITION s5 ENGINE = ENGINE)) */ + SUBPARTITION s5 ENGINE = ENGINE)) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -121,7 +121,7 @@ t1 CREATE TABLE `t1` ( `name` varchar(30) DEFAULT NULL, `purchased` date DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( YEAR(purchased)) + PARTITION BY RANGE ( YEAR(purchased)) SUBPARTITION BY HASH ( TO_DAYS(purchased)) (PARTITION p0 VALUES LESS THAN (1990) (SUBPARTITION s0 ENGINE = ENGINE, @@ -131,7 +131,7 @@ SUBPARTITION BY HASH ( TO_DAYS(purchased)) SUBPARTITION s3 ENGINE = ENGINE), PARTITION p2 VALUES LESS THAN MAXVALUE (SUBPARTITION s4 ENGINE = ENGINE, - SUBPARTITION s5 ENGINE = ENGINE)) */ + SUBPARTITION s5 ENGINE = ENGINE)) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -189,7 +189,7 @@ t1 CREATE TABLE `t1` ( `name` varchar(30) DEFAULT NULL, `purchased` date DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( YEAR(purchased)) + PARTITION BY RANGE ( YEAR(purchased)) SUBPARTITION BY HASH ( TO_DAYS(purchased)) (PARTITION p0 VALUES LESS THAN (1990) (SUBPARTITION s0 ENGINE = ENGINE, @@ -199,7 +199,7 @@ SUBPARTITION BY HASH ( TO_DAYS(purchased)) SUBPARTITION s3 ENGINE = ENGINE), PARTITION p2 VALUES LESS THAN MAXVALUE (SUBPARTITION s4 ENGINE = ENGINE, - SUBPARTITION s5 ENGINE = ENGINE)) */ + SUBPARTITION s5 ENGINE = ENGINE)) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -257,7 +257,7 @@ t1 CREATE TABLE `t1` ( `name` varchar(30) DEFAULT NULL, `purchased` date DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( YEAR(purchased)) + PARTITION BY RANGE ( YEAR(purchased)) SUBPARTITION BY HASH ( TO_DAYS(purchased)) (PARTITION p0 VALUES LESS THAN (1990) (SUBPARTITION s0 ENGINE = ENGINE, @@ -267,7 +267,7 @@ SUBPARTITION BY HASH ( TO_DAYS(purchased)) SUBPARTITION s3 ENGINE = ENGINE), PARTITION p2 VALUES LESS THAN MAXVALUE (SUBPARTITION s4 ENGINE = ENGINE, - SUBPARTITION s5 ENGINE = ENGINE)) */ + SUBPARTITION s5 ENGINE = ENGINE)) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -325,7 +325,7 @@ t1 CREATE TABLE `t1` ( `name` varchar(30) DEFAULT NULL, `purchased` date DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( YEAR(purchased)) + PARTITION BY RANGE ( YEAR(purchased)) SUBPARTITION BY HASH ( TO_DAYS(purchased)) (PARTITION p0 VALUES LESS THAN (1990) (SUBPARTITION s0 ENGINE = ENGINE, @@ -335,7 +335,7 @@ SUBPARTITION BY HASH ( TO_DAYS(purchased)) SUBPARTITION s3 ENGINE = ENGINE), PARTITION p2 VALUES LESS THAN MAXVALUE (SUBPARTITION s4 ENGINE = ENGINE, - SUBPARTITION s5 ENGINE = ENGINE)) */ + SUBPARTITION s5 ENGINE = ENGINE)) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -393,7 +393,7 @@ t1 CREATE TABLE `t1` ( `name` varchar(30) DEFAULT NULL, `purchased` date DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ( YEAR(purchased)) + PARTITION BY RANGE ( YEAR(purchased)) SUBPARTITION BY HASH ( TO_DAYS(purchased)) (PARTITION p0 VALUES LESS THAN (1990) (SUBPARTITION s0 ENGINE = ENGINE, @@ -403,7 +403,7 @@ SUBPARTITION BY HASH ( TO_DAYS(purchased)) SUBPARTITION s3 ENGINE = ENGINE), PARTITION p2 VALUES LESS THAN MAXVALUE (SUBPARTITION s4 ENGINE = ENGINE, - SUBPARTITION s5 ENGINE = ENGINE)) */ + SUBPARTITION s5 ENGINE = ENGINE)) DROP TABLE t1; SHOW TABLES; Tables_in_test diff --git a/mysql-test/suite/engines/funcs/r/tc_partition_value.result b/mysql-test/suite/engines/funcs/r/tc_partition_value.result index f8cf5804dc6..98a5f885e4b 100644 --- a/mysql-test/suite/engines/funcs/r/tc_partition_value.result +++ b/mysql-test/suite/engines/funcs/r/tc_partition_value.result @@ -15,13 +15,13 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) DEFAULT NULL, `c2` int(11) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (c1) + PARTITION BY RANGE (c1) (PARTITION p0 VALUES LESS THAN (1991) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (1995) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (1999) ENGINE = ENGINE, PARTITION p3 VALUES LESS THAN (2002) ENGINE = ENGINE, PARTITION p4 VALUES LESS THAN (2006) ENGINE = ENGINE, - PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -41,13 +41,13 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) DEFAULT NULL, `c2` int(11) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (c1) + PARTITION BY RANGE (c1) (PARTITION p0 VALUES LESS THAN (1991) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (1995) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (1999) ENGINE = ENGINE, PARTITION p3 VALUES LESS THAN (2002) ENGINE = ENGINE, PARTITION p4 VALUES LESS THAN (2006) ENGINE = ENGINE, - PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -67,13 +67,13 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (c1) + PARTITION BY RANGE (c1) (PARTITION p0 VALUES LESS THAN (1991) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (1995) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (1999) ENGINE = ENGINE, PARTITION p3 VALUES LESS THAN (2002) ENGINE = ENGINE, PARTITION p4 VALUES LESS THAN (2006) ENGINE = ENGINE, - PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -93,13 +93,13 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (c1) + PARTITION BY RANGE (c1) (PARTITION p0 VALUES LESS THAN (1991) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (1995) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (1999) ENGINE = ENGINE, PARTITION p3 VALUES LESS THAN (2002) ENGINE = ENGINE, PARTITION p4 VALUES LESS THAN (2006) ENGINE = ENGINE, - PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -119,13 +119,13 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) DEFAULT NULL, `c2` int(11) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (c1) + PARTITION BY RANGE (c1) (PARTITION p0 VALUES LESS THAN (1991) ENGINE = ENGINE, PARTITION p1 VALUES LESS THAN (1995) ENGINE = ENGINE, PARTITION p2 VALUES LESS THAN (1999) ENGINE = ENGINE, PARTITION p3 VALUES LESS THAN (2002) ENGINE = ENGINE, PARTITION p4 VALUES LESS THAN (2006) ENGINE = ENGINE, - PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) */ + PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test diff --git a/mysql-test/suite/engines/funcs/r/tc_partition_value_specific.result b/mysql-test/suite/engines/funcs/r/tc_partition_value_specific.result index d524486d7b7..71a38814fd8 100644 --- a/mysql-test/suite/engines/funcs/r/tc_partition_value_specific.result +++ b/mysql-test/suite/engines/funcs/r/tc_partition_value_specific.result @@ -13,11 +13,11 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) DEFAULT NULL, `c2` int(11) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (c1) + PARTITION BY LIST (c1) (PARTITION r0 VALUES IN (1,5,9,13,17,21) ENGINE = ENGINE, PARTITION r1 VALUES IN (2,6,10,14,18,22) ENGINE = ENGINE, PARTITION r2 VALUES IN (3,7,11,15,19,23) ENGINE = ENGINE, - PARTITION r3 VALUES IN (4,8,12,16,20,24) ENGINE = ENGINE) */ + PARTITION r3 VALUES IN (4,8,12,16,20,24) ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -35,11 +35,11 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) DEFAULT NULL, `c2` int(11) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (c1) + PARTITION BY LIST (c1) (PARTITION r0 VALUES IN (1,5,9,13,17,21) ENGINE = ENGINE, PARTITION r1 VALUES IN (2,6,10,14,18,22) ENGINE = ENGINE, PARTITION r2 VALUES IN (3,7,11,15,19,23) ENGINE = ENGINE, - PARTITION r3 VALUES IN (4,8,12,16,20,24) ENGINE = ENGINE) */ + PARTITION r3 VALUES IN (4,8,12,16,20,24) ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -57,11 +57,11 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (c1) + PARTITION BY LIST (c1) (PARTITION r0 VALUES IN (1,5,9,13,17,21) ENGINE = ENGINE, PARTITION r1 VALUES IN (2,6,10,14,18,22) ENGINE = ENGINE, PARTITION r2 VALUES IN (3,7,11,15,19,23) ENGINE = ENGINE, - PARTITION r3 VALUES IN (4,8,12,16,20,24) ENGINE = ENGINE) */ + PARTITION r3 VALUES IN (4,8,12,16,20,24) ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -79,11 +79,11 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (c1) + PARTITION BY LIST (c1) (PARTITION r0 VALUES IN (1,5,9,13,17,21) ENGINE = ENGINE, PARTITION r1 VALUES IN (2,6,10,14,18,22) ENGINE = ENGINE, PARTITION r2 VALUES IN (3,7,11,15,19,23) ENGINE = ENGINE, - PARTITION r3 VALUES IN (4,8,12,16,20,24) ENGINE = ENGINE) */ + PARTITION r3 VALUES IN (4,8,12,16,20,24) ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test @@ -101,11 +101,11 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) DEFAULT NULL, `c2` int(11) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (c1) + PARTITION BY LIST (c1) (PARTITION r0 VALUES IN (1,5,9,13,17,21) ENGINE = ENGINE, PARTITION r1 VALUES IN (2,6,10,14,18,22) ENGINE = ENGINE, PARTITION r2 VALUES IN (3,7,11,15,19,23) ENGINE = ENGINE, - PARTITION r3 VALUES IN (4,8,12,16,20,24) ENGINE = ENGINE) */ + PARTITION r3 VALUES IN (4,8,12,16,20,24) ENGINE = ENGINE) DROP TABLE t1; SHOW TABLES; Tables_in_test diff --git a/mysql-test/suite/engines/funcs/r/tc_temporary_column.result b/mysql-test/suite/engines/funcs/r/tc_temporary_column.result index 84eae4fc468..d2e5152070c 100644 --- a/mysql-test/suite/engines/funcs/r/tc_temporary_column.result +++ b/mysql-test/suite/engines/funcs/r/tc_temporary_column.result @@ -500,7 +500,7 @@ Tables_in_test SHOW CREATE TABLE t1; Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( - `c1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t1; SHOW TABLES; diff --git a/mysql-test/suite/engines/iuds/r/insert_decimal.result b/mysql-test/suite/engines/iuds/r/insert_decimal.result index eab8592c4ee..77e9901cbd5 100644 --- a/mysql-test/suite/engines/iuds/r/insert_decimal.result +++ b/mysql-test/suite/engines/iuds/r/insert_decimal.result @@ -1012,9 +1012,9 @@ ROUND(c1,c2) TRUNCATE(c1,c2) 1.133000 1.132000 DROP TABLE t5; CREATE TABLE t7(c1 DECIMAL(66,0)); -ERROR 42000: Too big precision 66 specified for 'c1'. Maximum is 65. +ERROR 42000: Too big precision 66 specified for 'c1'. Maximum is 65 CREATE TABLE t7(c1 DECIMAL(5,10)); -ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'c1'). +ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'c1') DROP TABLE t1,t2; CREATE TABLE t1(c1 FLOAT(10,5) UNSIGNED NOT NULL, c2 FLOAT(10,5) SIGNED NULL, c3 FLOAT, c4 INT, UNIQUE INDEX idx(c1,c2)); CREATE TABLE t2(c1 FLOAT(10,0) SIGNED NOT NULL, c2 FLOAT(10,0) UNSIGNED NULL, c3 FLOAT, c4 INT); @@ -1914,7 +1914,7 @@ ROUND(c1,c2) TRUNCATE(c1,c2) 1.133000 1.132000 DROP TABLE t5; CREATE TABLE t7(c1 FLOAT(5,10)); -ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'c1'). +ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'c1') DROP TABLE t1,t2; CREATE TABLE t1(c1 DOUBLE(10,5) UNSIGNED NOT NULL, c2 DOUBLE(10,5) SIGNED NULL, c3 DOUBLE, c4 INT, UNIQUE INDEX idx(c1,c2)); CREATE TABLE t2(c1 DOUBLE(10,0) SIGNED NOT NULL, c2 DOUBLE(10,0) UNSIGNED NULL, c3 DOUBLE, c4 INT); @@ -2843,5 +2843,5 @@ ROUND(c1,c2) TRUNCATE(c1,c2) 1.132000 1.132000 DROP TABLE t5; CREATE TABLE t7(c1 DOUBLE(5,10)); -ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'c1'). +ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'c1') DROP TABLE t1,t2; diff --git a/mysql-test/suite/engines/iuds/r/type_bit_iuds.result b/mysql-test/suite/engines/iuds/r/type_bit_iuds.result index b7a910f36e6..5051293e238 100644 --- a/mysql-test/suite/engines/iuds/r/type_bit_iuds.result +++ b/mysql-test/suite/engines/iuds/r/type_bit_iuds.result @@ -10239,11 +10239,11 @@ FFFFFFFFFFFFFFFF 1777777777777777777777 1111111111111111111111111111111111111111 FFFFFFFFFFFFFFFF 1777777777777777777777 1111111111111111111111111111111111111111111111111111111111111111 FFFFFFFFFFFFFFFF 610471403046014230061 1111111111111111111111111111111111111111111111111111111111111111 SELECT HEX(c1+0),HEX(c2+1),HEX(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT OCT(c1+0),OCT(c2+1),OCT(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT BIN(c1+0),BIN(c2+1),BIN(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT CONCAT(HEX(c1),HEX(c2),HEX(c3)) FROM t2; CONCAT(HEX(c1),HEX(c2),HEX(c3)) 000 @@ -21468,11 +21468,11 @@ FFFFFFFFFFFFFFFF 1777777777777777777777 1111111111111111111111111111111111111111 FFFFFFFFFFFFFFFF 1777777777777777777777 1111111111111111111111111111111111111111111111111111111111111111 FFFFFFFFFFFFFFFF 610471403046014230061 1111111111111111111111111111111111111111111111111111111111111111 SELECT HEX(c1+0),HEX(c2+1),HEX(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT OCT(c1+0),OCT(c2+1),OCT(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT BIN(c1+0),BIN(c2+1),BIN(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT CONCAT(HEX(c1),HEX(c2),HEX(c3)) FROM t2; CONCAT(HEX(c1),HEX(c2),HEX(c3)) 111 @@ -32709,11 +32709,11 @@ FFFFFFFFFFFFFFFF 1777777777777777777777 1111111111111111111111111111111111111111 FFFFFFFFFFFFFFFF 1777777777777777777777 1111111111111111111111111111111111111111111111111111111111111111 FFFFFFFFFFFFFFFF 610471403046014230061 1111111111111111111111111111111111111111111111111111111111111111 SELECT HEX(c1+0),HEX(c2+1),HEX(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT OCT(c1+0),OCT(c2+1),OCT(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT BIN(c1+0),BIN(c2+1),BIN(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT CONCAT(HEX(c1),HEX(c2),HEX(c3)) FROM t2; CONCAT(HEX(c1),HEX(c2),HEX(c3)) 222 @@ -43956,11 +43956,11 @@ FFFFFFFFFFFFFFFF 1777777777777777777777 1111111111111111111111111111111111111111 FFFFFFFFFFFFFFFF 1777777777777777777777 1111111111111111111111111111111111111111111111111111111111111111 FFFFFFFFFFFFFFFF 610471403046014230061 1111111111111111111111111111111111111111111111111111111111111111 SELECT HEX(c1+0),HEX(c2+1),HEX(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT OCT(c1+0),OCT(c2+1),OCT(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT BIN(c1+0),BIN(c2+1),BIN(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT CONCAT(HEX(c1),HEX(c2),HEX(c3)) FROM t2; CONCAT(HEX(c1),HEX(c2),HEX(c3)) 62273127622730316227313027 @@ -55215,11 +55215,11 @@ FFFFFFFFFFFFFFFF 1777777777777777777777 1111111111111111111111111111111111111111 FFFFFFFFFFFFFFFF 1777777777777777777777 1111111111111111111111111111111111111111111111111111111111111111 FFFFFFFFFFFFFFFF 610471403046014230061 1111111111111111111111111111111111111111111111111111111111111111 SELECT HEX(c1+0),HEX(c2+1),HEX(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT OCT(c1+0),OCT(c2+1),OCT(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT BIN(c1+0),BIN(c2+1),BIN(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT CONCAT(HEX(c1),HEX(c2),HEX(c3)) FROM t2; CONCAT(HEX(c1),HEX(c2),HEX(c3)) 62273127622730316227313027 @@ -56211,7 +56211,7 @@ SELECT 0 + (101010101010101010101010101010<<0); 0 + (101010101010101010101010101010<<0) 9223372036854775807 Warnings: -Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated. +Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated CREATE TABLE t1(c1 BIT(0)); CREATE TABLE t2(c1 BIT(0), c2 BIT(0), c3 BIT(0)); INSERT INTO t1 VALUES (b'101010101010101010101010101010'); @@ -57001,7 +57001,7 @@ SELECT 0 + (101010101010101010101010101010<<1); 0 + (101010101010101010101010101010<<1) 18446744073709551614 Warnings: -Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated. +Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated CREATE TABLE t1(c1 BIT(1)); CREATE TABLE t2(c1 BIT(1), c2 BIT(1), c3 BIT(1)); set @v1=1; @@ -57840,7 +57840,7 @@ SELECT 0 + (101010101010101010101010101010<<2); 0 + (101010101010101010101010101010<<2) 18446744073709551612 Warnings: -Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated. +Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated CREATE TABLE t1(c1 BIT(2)); CREATE TABLE t2(c1 BIT(2), c2 BIT(2), c3 BIT(2)); set @v1=2; @@ -58698,7 +58698,7 @@ SELECT 0 + (101010101010101010101010101010<<4); 0 + (101010101010101010101010101010<<4) 18446744073709551600 Warnings: -Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated. +Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated CREATE TABLE t1(c1 BIT(4)); CREATE TABLE t2(c1 BIT(4), c2 BIT(4), c3 BIT(4)); set @v1=4; @@ -59620,7 +59620,7 @@ SELECT 0 + (101010101010101010101010101010<<8); 0 + (101010101010101010101010101010<<8) 18446744073709551360 Warnings: -Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated. +Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated CREATE TABLE t1(c1 BIT(8)); CREATE TABLE t2(c1 BIT(8), c2 BIT(8), c3 BIT(8)); set @v1=8; @@ -60827,7 +60827,7 @@ SELECT 0 + (101010101010101010101010101010<<16); 0 + (101010101010101010101010101010<<16) 18446744073709486080 Warnings: -Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated. +Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated CREATE TABLE t1(c1 BIT(16)); CREATE TABLE t2(c1 BIT(16), c2 BIT(16), c3 BIT(16)); set @v1=16; @@ -62239,7 +62239,7 @@ SELECT 0 + (101010101010101010101010101010<<32); 0 + (101010101010101010101010101010<<32) 18446744069414584320 Warnings: -Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated. +Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated CREATE TABLE t1(c1 BIT(32)); CREATE TABLE t2(c1 BIT(32), c2 BIT(32), c3 BIT(32)); set @v1=32; @@ -64312,7 +64312,7 @@ SELECT 0 + (101010101010101010101010101010<<64); 0 + (101010101010101010101010101010<<64) 0 Warnings: -Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated. +Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated CREATE TABLE t1(c1 BIT(64)); CREATE TABLE t2(c1 BIT(64), c2 BIT(64), c3 BIT(64)); set @v1=64; @@ -66496,11 +66496,11 @@ FFFFFFFFFFFFFFFF 1777777777777777777777 1111111111111111111111111111111111111111 FFFFFFFFFFFFFFFF 1777777777777777777777 1111111111111111111111111111111111111111111111111111111111111111 FFFFFFFFFFFFFFFF 610471403046014230061 1111111111111111111111111111111111111111111111111111111111111111 SELECT HEX(c1+0),HEX(c2+1),HEX(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT OCT(c1+0),OCT(c2+1),OCT(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT BIN(c1+0),BIN(c2+1),BIN(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT CONCAT(HEX(c1),HEX(c2),HEX(c3)) FROM t2; CONCAT(HEX(c1),HEX(c2),HEX(c3)) 2AAAAAAA2AAAAAAA2AAAAAAA @@ -67489,7 +67489,7 @@ SELECT 0 + (1010101010101010101010101010101010101010101010101010101010101010<<0) 0 + (1010101010101010101010101010101010101010101010101010101010101010<<0) 9223372036854775807 Warnings: -Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated. +Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated CREATE TABLE t1(c1 BIT(0)); CREATE TABLE t2(c1 BIT(0), c2 BIT(0), c3 BIT(0)); INSERT INTO t1 VALUES (b'1010101010101010101010101010101010101010101010101010101010101010'); @@ -68276,7 +68276,7 @@ SELECT 0 + (1010101010101010101010101010101010101010101010101010101010101010<<1) 0 + (1010101010101010101010101010101010101010101010101010101010101010<<1) 18446744073709551614 Warnings: -Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated. +Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated CREATE TABLE t1(c1 BIT(1)); CREATE TABLE t2(c1 BIT(1), c2 BIT(1), c3 BIT(1)); set @v1=1; @@ -69112,7 +69112,7 @@ SELECT 0 + (1010101010101010101010101010101010101010101010101010101010101010<<2) 0 + (1010101010101010101010101010101010101010101010101010101010101010<<2) 18446744073709551612 Warnings: -Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated. +Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated CREATE TABLE t1(c1 BIT(2)); CREATE TABLE t2(c1 BIT(2), c2 BIT(2), c3 BIT(2)); set @v1=2; @@ -69967,7 +69967,7 @@ SELECT 0 + (1010101010101010101010101010101010101010101010101010101010101010<<4) 0 + (1010101010101010101010101010101010101010101010101010101010101010<<4) 18446744073709551600 Warnings: -Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated. +Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated CREATE TABLE t1(c1 BIT(4)); CREATE TABLE t2(c1 BIT(4), c2 BIT(4), c3 BIT(4)); set @v1=4; @@ -70886,7 +70886,7 @@ SELECT 0 + (1010101010101010101010101010101010101010101010101010101010101010<<8) 0 + (1010101010101010101010101010101010101010101010101010101010101010<<8) 18446744073709551360 Warnings: -Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated. +Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated CREATE TABLE t1(c1 BIT(8)); CREATE TABLE t2(c1 BIT(8), c2 BIT(8), c3 BIT(8)); set @v1=8; @@ -72090,7 +72090,7 @@ SELECT 0 + (1010101010101010101010101010101010101010101010101010101010101010<<16 0 + (1010101010101010101010101010101010101010101010101010101010101010<<16) 18446744073709486080 Warnings: -Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated. +Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated CREATE TABLE t1(c1 BIT(16)); CREATE TABLE t2(c1 BIT(16), c2 BIT(16), c3 BIT(16)); set @v1=16; @@ -73499,7 +73499,7 @@ SELECT 0 + (1010101010101010101010101010101010101010101010101010101010101010<<32 0 + (1010101010101010101010101010101010101010101010101010101010101010<<32) 18446744069414584320 Warnings: -Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated. +Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated CREATE TABLE t1(c1 BIT(32)); CREATE TABLE t2(c1 BIT(32), c2 BIT(32), c3 BIT(32)); set @v1=32; @@ -75575,7 +75575,7 @@ SELECT 0 + (1010101010101010101010101010101010101010101010101010101010101010<<64 0 + (1010101010101010101010101010101010101010101010101010101010101010<<64) 0 Warnings: -Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated. +Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated CREATE TABLE t1(c1 BIT(64)); CREATE TABLE t2(c1 BIT(64), c2 BIT(64), c3 BIT(64)); set @v1=64; @@ -77759,11 +77759,11 @@ FFFFFFFFFFFFFFFF 1777777777777777777777 1111111111111111111111111111111111111111 FFFFFFFFFFFFFFFF 1777777777777777777777 1111111111111111111111111111111111111111111111111111111111111111 FFFFFFFFFFFFFFFF 610471403046014230061 1111111111111111111111111111111111111111111111111111111111111111 SELECT HEX(c1+0),HEX(c2+1),HEX(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT OCT(c1+0),OCT(c2+1),OCT(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT BIN(c1+0),BIN(c2+1),BIN(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT CONCAT(HEX(c1),HEX(c2),HEX(c3)) FROM t2; CONCAT(HEX(c1),HEX(c2),HEX(c3)) 62273127622730316227313027 @@ -78752,7 +78752,7 @@ SELECT 0 + (10101010101010101010101010101010101010101010101010101010101010101<<0 0 + (10101010101010101010101010101010101010101010101010101010101010101<<0) 9223372036854775807 Warnings: -Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated. +Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated CREATE TABLE t1(c1 BIT(0)); CREATE TABLE t2(c1 BIT(0), c2 BIT(0), c3 BIT(0)); INSERT INTO t1 VALUES (b'10101010101010101010101010101010101010101010101010101010101010101'); @@ -79539,7 +79539,7 @@ SELECT 0 + (10101010101010101010101010101010101010101010101010101010101010101<<1 0 + (10101010101010101010101010101010101010101010101010101010101010101<<1) 18446744073709551614 Warnings: -Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated. +Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated CREATE TABLE t1(c1 BIT(1)); CREATE TABLE t2(c1 BIT(1), c2 BIT(1), c3 BIT(1)); set @v1=1; @@ -80375,7 +80375,7 @@ SELECT 0 + (10101010101010101010101010101010101010101010101010101010101010101<<2 0 + (10101010101010101010101010101010101010101010101010101010101010101<<2) 18446744073709551612 Warnings: -Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated. +Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated CREATE TABLE t1(c1 BIT(2)); CREATE TABLE t2(c1 BIT(2), c2 BIT(2), c3 BIT(2)); set @v1=2; @@ -81230,7 +81230,7 @@ SELECT 0 + (10101010101010101010101010101010101010101010101010101010101010101<<4 0 + (10101010101010101010101010101010101010101010101010101010101010101<<4) 18446744073709551600 Warnings: -Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated. +Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated CREATE TABLE t1(c1 BIT(4)); CREATE TABLE t2(c1 BIT(4), c2 BIT(4), c3 BIT(4)); set @v1=4; @@ -82149,7 +82149,7 @@ SELECT 0 + (10101010101010101010101010101010101010101010101010101010101010101<<8 0 + (10101010101010101010101010101010101010101010101010101010101010101<<8) 18446744073709551360 Warnings: -Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated. +Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated CREATE TABLE t1(c1 BIT(8)); CREATE TABLE t2(c1 BIT(8), c2 BIT(8), c3 BIT(8)); set @v1=8; @@ -83353,7 +83353,7 @@ SELECT 0 + (10101010101010101010101010101010101010101010101010101010101010101<<1 0 + (10101010101010101010101010101010101010101010101010101010101010101<<16) 18446744073709486080 Warnings: -Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated. +Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated CREATE TABLE t1(c1 BIT(16)); CREATE TABLE t2(c1 BIT(16), c2 BIT(16), c3 BIT(16)); set @v1=16; @@ -84762,7 +84762,7 @@ SELECT 0 + (10101010101010101010101010101010101010101010101010101010101010101<<3 0 + (10101010101010101010101010101010101010101010101010101010101010101<<32) 18446744069414584320 Warnings: -Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated. +Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated CREATE TABLE t1(c1 BIT(32)); CREATE TABLE t2(c1 BIT(32), c2 BIT(32), c3 BIT(32)); set @v1=32; @@ -86838,7 +86838,7 @@ SELECT 0 + (10101010101010101010101010101010101010101010101010101010101010101<<6 0 + (10101010101010101010101010101010101010101010101010101010101010101<<64) 0 Warnings: -Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated. +Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated CREATE TABLE t1(c1 BIT(64)); CREATE TABLE t2(c1 BIT(64), c2 BIT(64), c3 BIT(64)); set @v1=64; @@ -89028,11 +89028,11 @@ FFFFFFFFFFFFFFFF 1777777777777777777777 1111111111111111111111111111111111111111 FFFFFFFFFFFFFFFF 1777777777777777777777 1111111111111111111111111111111111111111111111111111111111111111 FFFFFFFFFFFFFFFF 610471403046014230061 1111111111111111111111111111111111111111111111111111111111111111 SELECT HEX(c1+0),HEX(c2+1),HEX(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT OCT(c1+0),OCT(c2+1),OCT(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT BIN(c1+0),BIN(c2+1),BIN(c3+2) FROM t2; -ERROR 22003: BIGINT UNSIGNED value is out of range in '(`test`.`t2`.`c2` + 1)' +ERROR 22003: BIGINT UNSIGNED value is out of range in '`test`.`t2`.`c2` + 1' SELECT CONCAT(HEX(c1),HEX(c2),HEX(c3)) FROM t2; CONCAT(HEX(c1),HEX(c2),HEX(c3)) 62273127622730316227313027 diff --git a/mysql-test/suite/federated/federated_maybe_16324629.result b/mysql-test/suite/federated/federated_maybe_16324629.result index 0417b5c0659..e16e4dd101d 100644 --- a/mysql-test/suite/federated/federated_maybe_16324629.result +++ b/mysql-test/suite/federated/federated_maybe_16324629.result @@ -13,7 +13,6 @@ insert into t1 values (3, 3), (7, 7); delete t1 from t1 where a = 3; select * from t1; a b -3 3 7 7 drop table t1; connection slave; diff --git a/mysql-test/suite/federated/federated_partition.result b/mysql-test/suite/federated/federated_partition.result index 8d0840a1d2d..8485328a166 100644 --- a/mysql-test/suite/federated/federated_partition.result +++ b/mysql-test/suite/federated/federated_partition.result @@ -21,9 +21,9 @@ t1 CREATE TABLE `t1` ( `s1` int(11) NOT NULL, PRIMARY KEY (`s1`) ) ENGINE=FEDERATED DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (s1) + PARTITION BY LIST (s1) (PARTITION p1 VALUES IN (1,3) CONNECTION = 'mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_1' ENGINE = FEDERATED, - PARTITION p2 VALUES IN (2,4) CONNECTION = 'mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_2' ENGINE = FEDERATED) */ + PARTITION p2 VALUES IN (2,4) CONNECTION = 'mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_2' ENGINE = FEDERATED) insert into t1 values (1), (2), (3), (4); select * from t1; s1 diff --git a/mysql-test/suite/funcs_1/r/innodb_func_view.result b/mysql-test/suite/funcs_1/r/innodb_func_view.result index 7be443ec658..04e689cc651 100644 --- a/mysql-test/suite/funcs_1/r/innodb_func_view.result +++ b/mysql-test/suite/funcs_1/r/innodb_func_view.result @@ -1544,7 +1544,7 @@ IS NOT NULL 2000 4 IS NOT NULL 2005 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_year`),'IS NULL','IS NOT NULL') AS `IF(my_year IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_year` is null,'IS NULL','IS NOT NULL') AS `IF(my_year IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1573,7 +1573,7 @@ IS NOT NULL 13:00:00 4 IS NOT NULL 10:00:00 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_time`),'IS NULL','IS NOT NULL') AS `IF(my_time IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_time` is null,'IS NULL','IS NOT NULL') AS `IF(my_time IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1602,7 +1602,7 @@ IS NOT NULL 2004-02-29 23:59:59 4 IS NOT NULL 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_timestamp`),'IS NULL','IS NOT NULL') AS `IF(my_timestamp IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_timestamp` is null,'IS NULL','IS NOT NULL') AS `IF(my_timestamp IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1631,7 +1631,7 @@ IS NOT NULL 2004-02-29 4 IS NOT NULL 2005-06-28 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_date`),'IS NULL','IS NOT NULL') AS `IF(my_date IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_date` is null,'IS NULL','IS NOT NULL') AS `IF(my_date IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1660,7 +1660,7 @@ IS NOT NULL 2004-02-29 23:59:59 4 IS NOT NULL 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_datetime`),'IS NULL','IS NOT NULL') AS `IF(my_datetime IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_datetime` is null,'IS NULL','IS NOT NULL') AS `IF(my_datetime IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1689,7 +1689,7 @@ IS NOT NULL 0 4 IS NOT NULL -1 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_double`),'IS NULL','IS NOT NULL') AS `IF(my_double IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_double` is null,'IS NULL','IS NOT NULL') AS `IF(my_double IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1718,7 +1718,7 @@ IS NOT NULL 0.000000000000000000000000000000 4 IS NOT NULL -1.000000000000000000000000000000 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_decimal`),'IS NULL','IS NOT NULL') AS `IF(my_decimal IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_decimal` is null,'IS NULL','IS NOT NULL') AS `IF(my_decimal IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1747,7 +1747,7 @@ IS NOT NULL 0 4 IS NOT NULL -1 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_bigint`),'IS NULL','IS NOT NULL') AS `IF(my_bigint IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_bigint` is null,'IS NULL','IS NOT NULL') AS `IF(my_bigint IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1776,7 +1776,7 @@ IS NOT NULL ---äÖüß@µ*$-- 4 IS NOT NULL -1 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_varbinary_1000`),'IS NULL','IS NOT NULL') AS `IF(my_varbinary_1000 IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varbinary_1000` is null,'IS NULL','IS NOT NULL') AS `IF(my_varbinary_1000 IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1805,7 +1805,7 @@ IS NOT NULL ---äÖüß@µ*$-- 4 IS NOT NULL -1 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_binary_30`),'IS NULL','IS NOT NULL') AS `IF(my_binary_30 IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_binary_30` is null,'IS NULL','IS NOT NULL') AS `IF(my_binary_30 IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1834,7 +1834,7 @@ IS NOT NULL ---äÖüß@µ*$-- 4 IS NOT NULL -1 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_varchar_1000`),'IS NULL','IS NOT NULL') AS `IF(my_varchar_1000 IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varchar_1000` is null,'IS NULL','IS NOT NULL') AS `IF(my_varchar_1000 IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1863,7 +1863,7 @@ IS NOT NULL ---äÖüß@µ*$-- 4 IS NOT NULL -1 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_char_30`),'IS NULL','IS NOT NULL') AS `IF(my_char_30 IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_char_30` is null,'IS NULL','IS NOT NULL') AS `IF(my_char_30 IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values diff --git a/mysql-test/suite/funcs_1/r/innodb_views.result b/mysql-test/suite/funcs_1/r/innodb_views.result index 93fe4dc6b5f..0ce0130e727 100644 --- a/mysql-test/suite/funcs_1/r/innodb_views.result +++ b/mysql-test/suite/funcs_1/r/innodb_views.result @@ -21556,7 +21556,7 @@ CREATE OR REPLACE VIEW test1.v27 AS SELECT f1, f2 FROM test1.t1 tab1 NATURAL JOIN test1.v26 tab2; SHOW CREATE VIEW test1.v27; View Create View character_set_client collation_connection -v27 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test1`.`v27` AS select `tab1`.`f1` AS `f1`,`tab1`.`f2` AS `f2` from (`test1`.`t1` `tab1` join `test1`.`v26` `tab2` on(((`tab1`.`f1` = `tab2`.`f1`) and (`tab1`.`f2` = `tab2`.`f2`)))) latin1 latin1_swedish_ci +v27 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test1`.`v27` AS select `tab1`.`f1` AS `f1`,`tab1`.`f2` AS `f2` from (`test1`.`t1` `tab1` join `test1`.`v26` `tab2` on(`tab1`.`f1` = `tab2`.`f1` and `tab1`.`f2` = `tab2`.`f2`)) latin1 latin1_swedish_ci SELECT CAST(f1 AS SIGNED INTEGER) AS f1, CAST(f2 AS CHAR) AS f2 FROM test1.v27; f1 f2 @@ -21572,7 +21572,7 @@ CREATE VIEW test1.v28 AS SELECT f1, f2 FROM test3.t1 tab1 NATURAL JOIN test1.v27 tab2; SHOW CREATE VIEW test1.v28; View Create View character_set_client collation_connection -v28 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test1`.`v28` AS select `tab1`.`f1` AS `f1`,`tab1`.`f2` AS `f2` from (`test3`.`t1` `tab1` join `test1`.`v27` `tab2` on(((`tab1`.`f1` = `tab2`.`f1`) and (`tab1`.`f2` = `tab2`.`f2`)))) latin1 latin1_swedish_ci +v28 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test1`.`v28` AS select `tab1`.`f1` AS `f1`,`tab1`.`f2` AS `f2` from (`test3`.`t1` `tab1` join `test1`.`v27` `tab2` on(`tab1`.`f1` = `tab2`.`f1` and `tab1`.`f2` = `tab2`.`f2`)) latin1 latin1_swedish_ci SELECT CAST(f1 AS SIGNED INTEGER) AS f1, CAST(f2 AS CHAR) AS f2 FROM test1.v28; f1 f2 diff --git a/mysql-test/suite/funcs_1/r/is_columns.result b/mysql-test/suite/funcs_1/r/is_columns.result index 4b028e1da3d..89f29ff4b38 100644 --- a/mysql-test/suite/funcs_1/r/is_columns.result +++ b/mysql-test/suite/funcs_1/r/is_columns.result @@ -45,7 +45,7 @@ CHARACTER_SET_NAME varchar(32) YES NULL COLLATION_NAME varchar(32) YES NULL COLUMN_TYPE longtext NO COLUMN_KEY varchar(3) NO -EXTRA varchar(27) NO +EXTRA varchar(30) NO PRIVILEGES varchar(80) NO COLUMN_COMMENT varchar(1024) NO SHOW CREATE TABLE information_schema.COLUMNS; @@ -68,7 +68,7 @@ COLUMNS CREATE TEMPORARY TABLE `COLUMNS` ( `COLLATION_NAME` varchar(32) DEFAULT NULL, `COLUMN_TYPE` longtext NOT NULL DEFAULT '', `COLUMN_KEY` varchar(3) NOT NULL DEFAULT '', - `EXTRA` varchar(27) NOT NULL DEFAULT '', + `EXTRA` varchar(30) NOT NULL DEFAULT '', `PRIVILEGES` varchar(80) NOT NULL DEFAULT '', `COLUMN_COMMENT` varchar(1024) NOT NULL DEFAULT '' ) DEFAULT CHARSET=utf8 @@ -91,7 +91,7 @@ CHARACTER_SET_NAME varchar(32) YES NULL COLLATION_NAME varchar(32) YES NULL COLUMN_TYPE longtext NO COLUMN_KEY varchar(3) NO -EXTRA varchar(27) NO +EXTRA varchar(30) NO PRIVILEGES varchar(80) NO COLUMN_COMMENT varchar(1024) NO SELECT table_catalog, table_schema, table_name, column_name diff --git a/mysql-test/suite/funcs_1/r/is_columns_innodb.result b/mysql-test/suite/funcs_1/r/is_columns_innodb.result index fd8989c7667..a005e39b0b4 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_innodb.result +++ b/mysql-test/suite/funcs_1/r/is_columns_innodb.result @@ -645,7 +645,7 @@ def test tb4 f217 42 NULL YES double NULL NULL 22 NULL NULL NULL NULL double uns def test tb4 f218 43 NULL YES date NULL NULL NULL NULL NULL NULL NULL date select,insert,update,references def test tb4 f219 44 NULL YES time NULL NULL NULL NULL 0 NULL NULL time select,insert,update,references def test tb4 f220 45 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select,insert,update,references -def test tb4 f221 46 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references +def test tb4 f221 46 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() select,insert,update,references def test tb4 f222 47 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) select,insert,update,references def test tb4 f223 48 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) select,insert,update,references def test tb4 f224 49 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) select,insert,update,references diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result index 0f35e66d6a6..04619a3e3c8 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is.result @@ -68,7 +68,7 @@ def information_schema COLUMNS COLUMN_NAME 4 NO varchar 64 192 NULL NULL NULL u def information_schema COLUMNS COLUMN_TYPE 16 NO longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext select def information_schema COLUMNS DATA_TYPE 8 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema COLUMNS DATETIME_PRECISION 13 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select -def information_schema COLUMNS EXTRA 18 NO varchar 27 81 NULL NULL NULL utf8 utf8_general_ci varchar(27) select +def information_schema COLUMNS EXTRA 18 NO varchar 30 90 NULL NULL NULL utf8 utf8_general_ci varchar(30) select def information_schema COLUMNS IS_NULLABLE 7 NO varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3) select def information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select def information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select @@ -128,7 +128,7 @@ def information_schema FILES ENGINE 10 NO varchar 64 192 NULL NULL NULL utf8 ut def information_schema FILES EXTENT_SIZE 16 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select def information_schema FILES EXTRA 38 NULL YES varchar 255 765 NULL NULL NULL utf8 utf8_general_ci varchar(255) select def information_schema FILES FILE_ID 1 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select -def information_schema FILES FILE_NAME 2 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select +def information_schema FILES FILE_NAME 2 NULL YES varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select def information_schema FILES FILE_TYPE 3 NO varchar 20 60 NULL NULL NULL utf8 utf8_general_ci varchar(20) select def information_schema FILES FREE_EXTENTS 14 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select def information_schema FILES FULLTEXT_KEYS 11 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select @@ -602,7 +602,7 @@ NULL information_schema COLUMNS DATETIME_PRECISION bigint NULL NULL NULL NULL bi 3.0000 information_schema COLUMNS COLLATION_NAME varchar 32 96 utf8 utf8_general_ci varchar(32) 1.0000 information_schema COLUMNS COLUMN_TYPE longtext 4294967295 4294967295 utf8 utf8_general_ci longtext 3.0000 information_schema COLUMNS COLUMN_KEY varchar 3 9 utf8 utf8_general_ci varchar(3) -3.0000 information_schema COLUMNS EXTRA varchar 27 81 utf8 utf8_general_ci varchar(27) +3.0000 information_schema COLUMNS EXTRA varchar 30 90 utf8 utf8_general_ci varchar(30) 3.0000 information_schema COLUMNS PRIVILEGES varchar 80 240 utf8 utf8_general_ci varchar(80) 3.0000 information_schema COLUMNS COLUMN_COMMENT varchar 1024 3072 utf8 utf8_general_ci varchar(1024) 3.0000 information_schema COLUMN_PRIVILEGES GRANTEE varchar 190 570 utf8 utf8_general_ci varchar(190) @@ -644,7 +644,7 @@ NULL information_schema EVENTS ORIGINATOR bigint NULL NULL NULL NULL bigint(10) 3.0000 information_schema EVENTS COLLATION_CONNECTION varchar 32 96 utf8 utf8_general_ci varchar(32) 3.0000 information_schema EVENTS DATABASE_COLLATION varchar 32 96 utf8 utf8_general_ci varchar(32) NULL information_schema FILES FILE_ID bigint NULL NULL NULL NULL bigint(4) -3.0000 information_schema FILES FILE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema FILES FILE_NAME varchar 512 1536 utf8 utf8_general_ci varchar(512) 3.0000 information_schema FILES FILE_TYPE varchar 20 60 utf8 utf8_general_ci varchar(20) 3.0000 information_schema FILES TABLESPACE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema FILES TABLE_CATALOG varchar 64 192 utf8 utf8_general_ci varchar(64) diff --git a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result index 69c5d79b541..bc7a693d617 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result @@ -68,7 +68,7 @@ def information_schema COLUMNS COLUMN_NAME 4 NO varchar 64 192 NULL NULL NULL u def information_schema COLUMNS COLUMN_TYPE 16 NO longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext def information_schema COLUMNS DATA_TYPE 8 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema COLUMNS DATETIME_PRECISION 13 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned -def information_schema COLUMNS EXTRA 18 NO varchar 27 81 NULL NULL NULL utf8 utf8_general_ci varchar(27) +def information_schema COLUMNS EXTRA 18 NO varchar 30 90 NULL NULL NULL utf8 utf8_general_ci varchar(30) def information_schema COLUMNS IS_NULLABLE 7 NO varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3) def information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned def information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned @@ -602,7 +602,7 @@ NULL information_schema COLUMNS DATETIME_PRECISION bigint NULL NULL NULL NULL bi 3.0000 information_schema COLUMNS COLLATION_NAME varchar 32 96 utf8 utf8_general_ci varchar(32) 1.0000 information_schema COLUMNS COLUMN_TYPE longtext 4294967295 4294967295 utf8 utf8_general_ci longtext 3.0000 information_schema COLUMNS COLUMN_KEY varchar 3 9 utf8 utf8_general_ci varchar(3) -3.0000 information_schema COLUMNS EXTRA varchar 27 81 utf8 utf8_general_ci varchar(27) +3.0000 information_schema COLUMNS EXTRA varchar 30 90 utf8 utf8_general_ci varchar(30) 3.0000 information_schema COLUMNS PRIVILEGES varchar 80 240 utf8 utf8_general_ci varchar(80) 3.0000 information_schema COLUMNS COLUMN_COMMENT varchar 1024 3072 utf8 utf8_general_ci varchar(1024) 3.0000 information_schema COLUMN_PRIVILEGES GRANTEE varchar 190 570 utf8 utf8_general_ci varchar(190) diff --git a/mysql-test/suite/funcs_1/r/is_columns_memory.result b/mysql-test/suite/funcs_1/r/is_columns_memory.result index 674abfaefab..fdb410fee7a 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_memory.result +++ b/mysql-test/suite/funcs_1/r/is_columns_memory.result @@ -620,7 +620,7 @@ def test tb4 f217 42 NULL YES double NULL NULL 22 NULL NULL NULL NULL double uns def test tb4 f218 43 NULL YES date NULL NULL NULL NULL NULL NULL NULL date select,insert,update,references def test tb4 f219 44 NULL YES time NULL NULL NULL NULL 0 NULL NULL time select,insert,update,references def test tb4 f220 45 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select,insert,update,references -def test tb4 f221 46 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references +def test tb4 f221 46 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() select,insert,update,references def test tb4 f222 47 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) select,insert,update,references def test tb4 f223 48 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) select,insert,update,references def test tb4 f224 49 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) select,insert,update,references diff --git a/mysql-test/suite/funcs_1/r/is_columns_myisam.result b/mysql-test/suite/funcs_1/r/is_columns_myisam.result index 6ce5f1bd8a0..823a3ffe214 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_myisam.result +++ b/mysql-test/suite/funcs_1/r/is_columns_myisam.result @@ -682,7 +682,7 @@ def test tb4 f217 42 NULL YES double NULL NULL 22 NULL NULL NULL NULL double uns def test tb4 f218 43 NULL YES date NULL NULL NULL NULL NULL NULL NULL date select,insert,update,references def test tb4 f219 44 NULL YES time NULL NULL NULL NULL 0 NULL NULL time select,insert,update,references def test tb4 f220 45 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select,insert,update,references -def test tb4 f221 46 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references +def test tb4 f221 46 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() select,insert,update,references def test tb4 f222 47 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) select,insert,update,references def test tb4 f223 48 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) select,insert,update,references def test tb4 f224 49 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) select,insert,update,references diff --git a/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result index d89459a88ac..3b9f33f2917 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result @@ -682,7 +682,7 @@ def test tb4 f217 42 NULL YES double NULL NULL 22 NULL NULL NULL NULL double uns def test tb4 f218 43 NULL YES date NULL NULL NULL NULL NULL NULL NULL date def test tb4 f219 44 NULL YES time NULL NULL NULL NULL 0 NULL NULL time def test tb4 f220 45 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime -def test tb4 f221 46 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP +def test tb4 f221 46 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() def test tb4 f222 47 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) def test tb4 f223 48 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) def test tb4 f224 49 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql.result b/mysql-test/suite/funcs_1/r/is_columns_mysql.result index 2821e1112e5..832460e085b 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result @@ -7,7 +7,7 @@ def mysql columns_priv Column_priv 7 NO set 31 93 NULL NULL NULL utf8 utf8_gene def mysql columns_priv Db 2 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI select,insert,update,references def mysql columns_priv Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references def mysql columns_priv Table_name 4 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI select,insert,update,references -def mysql columns_priv Timestamp 6 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references +def mysql columns_priv Timestamp 6 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() select,insert,update,references def mysql columns_priv User 3 NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI select,insert,update,references def mysql column_stats avg_frequency 8 NULL YES decimal NULL NULL 12 4 NULL NULL NULL decimal(12,4) select,insert,update,references def mysql column_stats avg_length 7 NULL YES decimal NULL NULL 12 4 NULL NULL NULL decimal(12,4) select,insert,update,references @@ -47,7 +47,7 @@ def mysql event body_utf8 22 NULL YES longblob 4294967295 4294967295 NULL NULL N def mysql event character_set_client 19 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) select,insert,update,references def mysql event collation_connection 20 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) select,insert,update,references def mysql event comment 16 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) select,insert,update,references -def mysql event created 8 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references +def mysql event created 8 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() select,insert,update,references def mysql event db 1 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI select,insert,update,references def mysql event db_collation 21 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) select,insert,update,references def mysql event definer 4 NO char 141 423 NULL NULL NULL utf8 utf8_bin char(141) select,insert,update,references @@ -70,7 +70,7 @@ def mysql func ret 2 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(1) sele def mysql func type 4 NULL NO enum 9 27 NULL NULL NULL utf8 utf8_general_ci enum('function','aggregate') select,insert,update,references def mysql general_log argument 6 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext select,insert,update,references def mysql general_log command_type 5 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references -def mysql general_log event_time 1 CURRENT_TIMESTAMP(6) NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) on update CURRENT_TIMESTAMP select,insert,update,references +def mysql general_log event_time 1 current_timestamp(6) NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) on update current_timestamp(6) select,insert,update,references def mysql general_log server_id 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned select,insert,update,references def mysql general_log thread_id 3 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select,insert,update,references def mysql general_log user_host 2 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext select,insert,update,references @@ -124,7 +124,7 @@ def mysql proc body_utf8 20 NULL YES longblob 4294967295 4294967295 NULL NULL NU def mysql proc character_set_client 17 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) select,insert,update,references def mysql proc collation_connection 18 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) select,insert,update,references def mysql proc comment 16 NULL NO text 65535 65535 NULL NULL NULL utf8 utf8_bin text select,insert,update,references -def mysql proc created 13 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references +def mysql proc created 13 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() select,insert,update,references def mysql proc db 1 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI select,insert,update,references def mysql proc db_collation 19 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) select,insert,update,references def mysql proc definer 12 NO char 141 423 NULL NULL NULL utf8 utf8_bin char(141) select,insert,update,references @@ -145,13 +145,13 @@ def mysql procs_priv Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60 def mysql procs_priv Proc_priv 7 NO set 27 81 NULL NULL NULL utf8 utf8_general_ci set('Execute','Alter Routine','Grant') select,insert,update,references def mysql procs_priv Routine_name 4 NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) PRI select,insert,update,references def mysql procs_priv Routine_type 5 NULL NO enum 9 27 NULL NULL NULL utf8 utf8_bin enum('FUNCTION','PROCEDURE') PRI select,insert,update,references -def mysql procs_priv Timestamp 8 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references +def mysql procs_priv Timestamp 8 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() select,insert,update,references def mysql procs_priv User 3 NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI select,insert,update,references def mysql proxies_priv Grantor 6 NO char 141 423 NULL NULL NULL utf8 utf8_bin char(141) MUL select,insert,update,references def mysql proxies_priv Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references def mysql proxies_priv Proxied_host 3 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references def mysql proxies_priv Proxied_user 4 NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI select,insert,update,references -def mysql proxies_priv Timestamp 7 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references +def mysql proxies_priv Timestamp 7 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() select,insert,update,references def mysql proxies_priv User 2 NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI select,insert,update,references def mysql proxies_priv With_grant 5 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(1) select,insert,update,references def mysql roles_mapping Admin_option 4 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references @@ -177,7 +177,7 @@ def mysql slow_log rows_examined 6 NULL NO int NULL NULL 10 0 NULL NULL NULL int def mysql slow_log rows_sent 5 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references def mysql slow_log server_id 10 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned select,insert,update,references def mysql slow_log sql_text 11 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext select,insert,update,references -def mysql slow_log start_time 1 CURRENT_TIMESTAMP(6) NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) on update CURRENT_TIMESTAMP select,insert,update,references +def mysql slow_log start_time 1 current_timestamp(6) NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) on update current_timestamp(6) select,insert,update,references def mysql slow_log thread_id 12 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select,insert,update,references def mysql slow_log user_host 2 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext select,insert,update,references def mysql tables_priv Column_priv 8 NO set 31 93 NULL NULL NULL utf8 utf8_general_ci set('Select','Insert','Update','References') select,insert,update,references @@ -186,7 +186,7 @@ def mysql tables_priv Grantor 5 NO char 141 423 NULL NULL NULL utf8 utf8_bin ch def mysql tables_priv Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references def mysql tables_priv Table_name 4 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI select,insert,update,references def mysql tables_priv Table_priv 7 NO set 98 294 NULL NULL NULL utf8 utf8_general_ci set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') select,insert,update,references -def mysql tables_priv Timestamp 6 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references +def mysql tables_priv Timestamp 6 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() select,insert,update,references def mysql tables_priv User 3 NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI select,insert,update,references def mysql table_stats cardinality 3 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select,insert,update,references def mysql table_stats db_name 1 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result index 006ed9d82f2..0a92e6edf24 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result @@ -7,7 +7,7 @@ def mysql columns_priv Column_priv 7 NO set 31 93 NULL NULL NULL utf8 utf8_gene def mysql columns_priv Db 2 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI def mysql columns_priv Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI def mysql columns_priv Table_name 4 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI -def mysql columns_priv Timestamp 6 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP +def mysql columns_priv Timestamp 6 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() def mysql columns_priv User 3 NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI def mysql column_stats avg_frequency 8 NULL YES decimal NULL NULL 12 4 NULL NULL NULL decimal(12,4) def mysql column_stats avg_length 7 NULL YES decimal NULL NULL 12 4 NULL NULL NULL decimal(12,4) @@ -47,7 +47,7 @@ def mysql event body_utf8 22 NULL YES longblob 4294967295 4294967295 NULL NULL N def mysql event character_set_client 19 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) def mysql event collation_connection 20 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) def mysql event comment 16 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) -def mysql event created 8 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP +def mysql event created 8 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() def mysql event db 1 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI def mysql event db_collation 21 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) def mysql event definer 4 NO char 141 423 NULL NULL NULL utf8 utf8_bin char(141) @@ -70,7 +70,7 @@ def mysql func ret 2 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(1) def mysql func type 4 NULL NO enum 9 27 NULL NULL NULL utf8 utf8_general_ci enum('function','aggregate') def mysql general_log argument 6 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext def mysql general_log command_type 5 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) -def mysql general_log event_time 1 CURRENT_TIMESTAMP(6) NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) on update CURRENT_TIMESTAMP +def mysql general_log event_time 1 current_timestamp(6) NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) on update current_timestamp(6) def mysql general_log server_id 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned def mysql general_log thread_id 3 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned def mysql general_log user_host 2 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext @@ -124,7 +124,7 @@ def mysql proc body_utf8 20 NULL YES longblob 4294967295 4294967295 NULL NULL NU def mysql proc character_set_client 17 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) def mysql proc collation_connection 18 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) def mysql proc comment 16 NULL NO text 65535 65535 NULL NULL NULL utf8 utf8_bin text -def mysql proc created 13 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP +def mysql proc created 13 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() def mysql proc db 1 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI def mysql proc db_collation 19 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) def mysql proc definer 12 NO char 141 423 NULL NULL NULL utf8 utf8_bin char(141) @@ -145,13 +145,13 @@ def mysql procs_priv Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60 def mysql procs_priv Proc_priv 7 NO set 27 81 NULL NULL NULL utf8 utf8_general_ci set('Execute','Alter Routine','Grant') def mysql procs_priv Routine_name 4 NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) PRI def mysql procs_priv Routine_type 5 NULL NO enum 9 27 NULL NULL NULL utf8 utf8_bin enum('FUNCTION','PROCEDURE') PRI -def mysql procs_priv Timestamp 8 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP +def mysql procs_priv Timestamp 8 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() def mysql procs_priv User 3 NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI def mysql proxies_priv Grantor 6 NO char 141 423 NULL NULL NULL utf8 utf8_bin char(141) MUL def mysql proxies_priv Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI def mysql proxies_priv Proxied_host 3 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI def mysql proxies_priv Proxied_user 4 NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI -def mysql proxies_priv Timestamp 7 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP +def mysql proxies_priv Timestamp 7 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() def mysql proxies_priv User 2 NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI def mysql proxies_priv With_grant 5 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(1) def mysql roles_mapping Admin_option 4 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') @@ -177,7 +177,7 @@ def mysql slow_log rows_examined 6 NULL NO int NULL NULL 10 0 NULL NULL NULL int def mysql slow_log rows_sent 5 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) def mysql slow_log server_id 10 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned def mysql slow_log sql_text 11 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext -def mysql slow_log start_time 1 CURRENT_TIMESTAMP(6) NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) on update CURRENT_TIMESTAMP +def mysql slow_log start_time 1 current_timestamp(6) NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) on update current_timestamp(6) def mysql slow_log thread_id 12 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned def mysql slow_log user_host 2 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext def mysql tables_priv Column_priv 8 NO set 31 93 NULL NULL NULL utf8 utf8_general_ci set('Select','Insert','Update','References') @@ -186,7 +186,7 @@ def mysql tables_priv Grantor 5 NO char 141 423 NULL NULL NULL utf8 utf8_bin ch def mysql tables_priv Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI def mysql tables_priv Table_name 4 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI def mysql tables_priv Table_priv 7 NO set 98 294 NULL NULL NULL utf8 utf8_general_ci set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') -def mysql tables_priv Timestamp 6 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP +def mysql tables_priv Timestamp 6 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() def mysql tables_priv User 3 NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI def mysql table_stats cardinality 3 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned def mysql table_stats db_name 1 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI diff --git a/mysql-test/suite/funcs_1/r/memory_func_view.result b/mysql-test/suite/funcs_1/r/memory_func_view.result index f7a02411502..765869a312d 100644 --- a/mysql-test/suite/funcs_1/r/memory_func_view.result +++ b/mysql-test/suite/funcs_1/r/memory_func_view.result @@ -1545,7 +1545,7 @@ IS NOT NULL 2000 4 IS NOT NULL 2005 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_year`),'IS NULL','IS NOT NULL') AS `IF(my_year IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_year` is null,'IS NULL','IS NOT NULL') AS `IF(my_year IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1574,7 +1574,7 @@ IS NOT NULL 13:00:00 4 IS NOT NULL 10:00:00 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_time`),'IS NULL','IS NOT NULL') AS `IF(my_time IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_time` is null,'IS NULL','IS NOT NULL') AS `IF(my_time IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1603,7 +1603,7 @@ IS NOT NULL 2004-02-29 23:59:59 4 IS NOT NULL 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_timestamp`),'IS NULL','IS NOT NULL') AS `IF(my_timestamp IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_timestamp` is null,'IS NULL','IS NOT NULL') AS `IF(my_timestamp IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1632,7 +1632,7 @@ IS NOT NULL 2004-02-29 4 IS NOT NULL 2005-06-28 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_date`),'IS NULL','IS NOT NULL') AS `IF(my_date IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_date` is null,'IS NULL','IS NOT NULL') AS `IF(my_date IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1661,7 +1661,7 @@ IS NOT NULL 2004-02-29 23:59:59 4 IS NOT NULL 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_datetime`),'IS NULL','IS NOT NULL') AS `IF(my_datetime IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_datetime` is null,'IS NULL','IS NOT NULL') AS `IF(my_datetime IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1690,7 +1690,7 @@ IS NOT NULL 0 4 IS NOT NULL -1 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_double`),'IS NULL','IS NOT NULL') AS `IF(my_double IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_double` is null,'IS NULL','IS NOT NULL') AS `IF(my_double IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1719,7 +1719,7 @@ IS NOT NULL 0.000000000000000000000000000000 4 IS NOT NULL -1.000000000000000000000000000000 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_decimal`),'IS NULL','IS NOT NULL') AS `IF(my_decimal IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_decimal` is null,'IS NULL','IS NOT NULL') AS `IF(my_decimal IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1748,7 +1748,7 @@ IS NOT NULL 0 4 IS NOT NULL -1 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_bigint`),'IS NULL','IS NOT NULL') AS `IF(my_bigint IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_bigint` is null,'IS NULL','IS NOT NULL') AS `IF(my_bigint IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1777,7 +1777,7 @@ IS NOT NULL ---äÖüß@µ*$-- 4 IS NOT NULL -1 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_varbinary_1000`),'IS NULL','IS NOT NULL') AS `IF(my_varbinary_1000 IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varbinary_1000` is null,'IS NULL','IS NOT NULL') AS `IF(my_varbinary_1000 IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1806,7 +1806,7 @@ IS NOT NULL ---äÖüß@µ*$-- 4 IS NOT NULL -1 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_binary_30`),'IS NULL','IS NOT NULL') AS `IF(my_binary_30 IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_binary_30` is null,'IS NULL','IS NOT NULL') AS `IF(my_binary_30 IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1835,7 +1835,7 @@ IS NOT NULL ---äÖüß@µ*$-- 4 IS NOT NULL -1 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_varchar_1000`),'IS NULL','IS NOT NULL') AS `IF(my_varchar_1000 IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varchar_1000` is null,'IS NULL','IS NOT NULL') AS `IF(my_varchar_1000 IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1864,7 +1864,7 @@ IS NOT NULL ---äÖüß@µ*$-- 4 IS NOT NULL -1 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_char_30`),'IS NULL','IS NOT NULL') AS `IF(my_char_30 IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_char_30` is null,'IS NULL','IS NOT NULL') AS `IF(my_char_30 IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values diff --git a/mysql-test/suite/funcs_1/r/memory_views.result b/mysql-test/suite/funcs_1/r/memory_views.result index 885e2a7dfe7..0ca6e8d94d8 100644 --- a/mysql-test/suite/funcs_1/r/memory_views.result +++ b/mysql-test/suite/funcs_1/r/memory_views.result @@ -21558,7 +21558,7 @@ CREATE OR REPLACE VIEW test1.v27 AS SELECT f1, f2 FROM test1.t1 tab1 NATURAL JOIN test1.v26 tab2; SHOW CREATE VIEW test1.v27; View Create View character_set_client collation_connection -v27 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test1`.`v27` AS select `tab1`.`f1` AS `f1`,`tab1`.`f2` AS `f2` from (`test1`.`t1` `tab1` join `test1`.`v26` `tab2` on(((`tab1`.`f1` = `tab2`.`f1`) and (`tab1`.`f2` = `tab2`.`f2`)))) latin1 latin1_swedish_ci +v27 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test1`.`v27` AS select `tab1`.`f1` AS `f1`,`tab1`.`f2` AS `f2` from (`test1`.`t1` `tab1` join `test1`.`v26` `tab2` on(`tab1`.`f1` = `tab2`.`f1` and `tab1`.`f2` = `tab2`.`f2`)) latin1 latin1_swedish_ci SELECT CAST(f1 AS SIGNED INTEGER) AS f1, CAST(f2 AS CHAR) AS f2 FROM test1.v27; f1 f2 @@ -21574,7 +21574,7 @@ CREATE VIEW test1.v28 AS SELECT f1, f2 FROM test3.t1 tab1 NATURAL JOIN test1.v27 tab2; SHOW CREATE VIEW test1.v28; View Create View character_set_client collation_connection -v28 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test1`.`v28` AS select `tab1`.`f1` AS `f1`,`tab1`.`f2` AS `f2` from (`test3`.`t1` `tab1` join `test1`.`v27` `tab2` on(((`tab1`.`f1` = `tab2`.`f1`) and (`tab1`.`f2` = `tab2`.`f2`)))) latin1 latin1_swedish_ci +v28 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test1`.`v28` AS select `tab1`.`f1` AS `f1`,`tab1`.`f2` AS `f2` from (`test3`.`t1` `tab1` join `test1`.`v27` `tab2` on(`tab1`.`f1` = `tab2`.`f1` and `tab1`.`f2` = `tab2`.`f2`)) latin1 latin1_swedish_ci SELECT CAST(f1 AS SIGNED INTEGER) AS f1, CAST(f2 AS CHAR) AS f2 FROM test1.v28; f1 f2 diff --git a/mysql-test/suite/funcs_1/r/myisam_func_view.result b/mysql-test/suite/funcs_1/r/myisam_func_view.result index f7a02411502..765869a312d 100644 --- a/mysql-test/suite/funcs_1/r/myisam_func_view.result +++ b/mysql-test/suite/funcs_1/r/myisam_func_view.result @@ -1545,7 +1545,7 @@ IS NOT NULL 2000 4 IS NOT NULL 2005 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_year`),'IS NULL','IS NOT NULL') AS `IF(my_year IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_year` is null,'IS NULL','IS NOT NULL') AS `IF(my_year IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1574,7 +1574,7 @@ IS NOT NULL 13:00:00 4 IS NOT NULL 10:00:00 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_time`),'IS NULL','IS NOT NULL') AS `IF(my_time IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_time` is null,'IS NULL','IS NOT NULL') AS `IF(my_time IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1603,7 +1603,7 @@ IS NOT NULL 2004-02-29 23:59:59 4 IS NOT NULL 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_timestamp`),'IS NULL','IS NOT NULL') AS `IF(my_timestamp IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_timestamp` is null,'IS NULL','IS NOT NULL') AS `IF(my_timestamp IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1632,7 +1632,7 @@ IS NOT NULL 2004-02-29 4 IS NOT NULL 2005-06-28 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_date`),'IS NULL','IS NOT NULL') AS `IF(my_date IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_date` is null,'IS NULL','IS NOT NULL') AS `IF(my_date IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1661,7 +1661,7 @@ IS NOT NULL 2004-02-29 23:59:59 4 IS NOT NULL 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_datetime`),'IS NULL','IS NOT NULL') AS `IF(my_datetime IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_datetime` is null,'IS NULL','IS NOT NULL') AS `IF(my_datetime IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1690,7 +1690,7 @@ IS NOT NULL 0 4 IS NOT NULL -1 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_double`),'IS NULL','IS NOT NULL') AS `IF(my_double IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_double` is null,'IS NULL','IS NOT NULL') AS `IF(my_double IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1719,7 +1719,7 @@ IS NOT NULL 0.000000000000000000000000000000 4 IS NOT NULL -1.000000000000000000000000000000 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_decimal`),'IS NULL','IS NOT NULL') AS `IF(my_decimal IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_decimal` is null,'IS NULL','IS NOT NULL') AS `IF(my_decimal IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1748,7 +1748,7 @@ IS NOT NULL 0 4 IS NOT NULL -1 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_bigint`),'IS NULL','IS NOT NULL') AS `IF(my_bigint IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_bigint` is null,'IS NULL','IS NOT NULL') AS `IF(my_bigint IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1777,7 +1777,7 @@ IS NOT NULL ---äÖüß@µ*$-- 4 IS NOT NULL -1 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_varbinary_1000`),'IS NULL','IS NOT NULL') AS `IF(my_varbinary_1000 IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varbinary_1000` is null,'IS NULL','IS NOT NULL') AS `IF(my_varbinary_1000 IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1806,7 +1806,7 @@ IS NOT NULL ---äÖüß@µ*$-- 4 IS NOT NULL -1 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_binary_30`),'IS NULL','IS NOT NULL') AS `IF(my_binary_30 IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_binary_30` is null,'IS NULL','IS NOT NULL') AS `IF(my_binary_30 IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1835,7 +1835,7 @@ IS NOT NULL ---äÖüß@µ*$-- 4 IS NOT NULL -1 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_varchar_1000`),'IS NULL','IS NOT NULL') AS `IF(my_varchar_1000 IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varchar_1000` is null,'IS NULL','IS NOT NULL') AS `IF(my_varchar_1000 IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values @@ -1864,7 +1864,7 @@ IS NOT NULL ---äÖüß@µ*$-- 4 IS NOT NULL -1 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_char_30`),'IS NULL','IS NOT NULL') AS `IF(my_char_30 IS NULL, 'IS NULL', +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_char_30` is null,'IS NULL','IS NOT NULL') AS `IF(my_char_30 IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values diff --git a/mysql-test/suite/funcs_1/r/myisam_views-big.result b/mysql-test/suite/funcs_1/r/myisam_views-big.result index 0fbbfab9c1f..b6537582055 100644 --- a/mysql-test/suite/funcs_1/r/myisam_views-big.result +++ b/mysql-test/suite/funcs_1/r/myisam_views-big.result @@ -23219,7 +23219,7 @@ CREATE OR REPLACE VIEW test1.v20 AS SELECT f1, f2 FROM test3.t1 tab1 NATURAL JOIN test1.v19 tab2; SHOW CREATE VIEW test1.v20; View Create View character_set_client collation_connection -v20 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test1`.`v20` AS select `tab1`.`f1` AS `f1`,`tab1`.`f2` AS `f2` from (`test3`.`t1` `tab1` join `test1`.`v19` `tab2` on(((`tab1`.`f1` = `tab2`.`f1`) and (`tab1`.`f2` = `tab2`.`f2`)))) latin1 latin1_swedish_ci +v20 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test1`.`v20` AS select `tab1`.`f1` AS `f1`,`tab1`.`f2` AS `f2` from (`test3`.`t1` `tab1` join `test1`.`v19` `tab2` on(`tab1`.`f1` = `tab2`.`f1` and `tab1`.`f2` = `tab2`.`f2`)) latin1 latin1_swedish_ci SELECT CAST(f1 AS SIGNED INTEGER) AS f1, CAST(f2 AS CHAR) AS f2 FROM test1.v20; f1 f2 @@ -23235,7 +23235,7 @@ CREATE VIEW test1.v21 AS SELECT f1, f2 FROM test3.t1 tab1 NATURAL JOIN test1.v20 tab2; SHOW CREATE VIEW test1.v21; View Create View character_set_client collation_connection -v21 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test1`.`v21` AS select `tab1`.`f1` AS `f1`,`tab1`.`f2` AS `f2` from (`test3`.`t1` `tab1` join `test1`.`v20` `tab2` on(((`tab1`.`f1` = `tab2`.`f1`) and (`tab1`.`f2` = `tab2`.`f2`)))) latin1 latin1_swedish_ci +v21 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test1`.`v21` AS select `tab1`.`f1` AS `f1`,`tab1`.`f2` AS `f2` from (`test3`.`t1` `tab1` join `test1`.`v20` `tab2` on(`tab1`.`f1` = `tab2`.`f1` and `tab1`.`f2` = `tab2`.`f2`)) latin1 latin1_swedish_ci SELECT CAST(f1 AS SIGNED INTEGER) AS f1, CAST(f2 AS CHAR) AS f2 FROM test1.v21; f1 f2 diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result index 3103056ce3f..7a27703a1ec 100644 --- a/mysql-test/suite/funcs_1/r/storedproc.result +++ b/mysql-test/suite/funcs_1/r/storedproc.result @@ -16316,7 +16316,7 @@ set f1 = (f1 / 2); set f1 = (f1 * 2); set f1 = (f1 - 10); set f1 = (f1 + 10); return f1; END// SELECT fn4(-9.22e+15); -ERROR 22003: BIGINT UNSIGNED value is out of range in '(f1@0 - 10)' +ERROR 22003: BIGINT UNSIGNED value is out of range in 'f1@0 - 10' DROP FUNCTION IF EXISTS fn5; CREATE FUNCTION fn5( f1 decimal) returns decimal BEGIN @@ -16797,7 +16797,7 @@ set f1 = (f1 / 2); set f1 = (f1 * 2); set f1 = (f1 - 10); set f1 = (f1 + 10); return f1; END// SELECT fn56(-8388601); -ERROR 22003: BIGINT UNSIGNED value is out of range in '(f1@0 - 10)' +ERROR 22003: BIGINT UNSIGNED value is out of range in 'f1@0 - 10' DROP FUNCTION IF EXISTS fn57; CREATE FUNCTION fn57( f1 numeric) returns numeric BEGIN @@ -17065,7 +17065,7 @@ set f1 = (f1 / 2); set f1 = (f1 * 2); set f1 = (f1 - 10); set f1 = (f1 + 10); return f1; END// SELECT fn84(-32601); -ERROR 22003: BIGINT UNSIGNED value is out of range in '(f1@0 - 10)' +ERROR 22003: BIGINT UNSIGNED value is out of range in 'f1@0 - 10' DROP FUNCTION IF EXISTS fn85; CREATE FUNCTION fn85( f1 tinyint) returns tinyint BEGIN @@ -17100,7 +17100,7 @@ set f1 = (f1 / 2); set f1 = (f1 * 2); set f1 = (f1 - 10); set f1 = (f1 + 10); return f1; END// SELECT fn88(-101); -ERROR 22003: BIGINT UNSIGNED value is out of range in '(f1@0 - 10)' +ERROR 22003: BIGINT UNSIGNED value is out of range in 'f1@0 - 10' DROP FUNCTION IF EXISTS fn89; CREATE FUNCTION fn89( f1 enum('1enum', '2enum')) returns enum('1enum', '2enum') BEGIN @@ -17319,7 +17319,7 @@ set f1 = (f1 / 2); set f1 = (f1 * 2); set f1 = (f1 - 10); set f1 = (f1 + 10); SELECT f1; END// CALL sp4(-9.22e+15); -ERROR 22003: BIGINT UNSIGNED value is out of range in '(f1@0 - 10)' +ERROR 22003: BIGINT UNSIGNED value is out of range in 'f1@0 - 10' DROP PROCEDURE IF EXISTS sp5; CREATE PROCEDURE sp5( f1 decimal) BEGIN @@ -17876,7 +17876,7 @@ set f1 = (f1 / 2); set f1 = (f1 * 2); set f1 = (f1 - 10); set f1 = (f1 + 10); SELECT f1; END// CALL sp56(-8388601); -ERROR 22003: BIGINT UNSIGNED value is out of range in '(f1@0 - 10)' +ERROR 22003: BIGINT UNSIGNED value is out of range in 'f1@0 - 10' DROP PROCEDURE IF EXISTS sp57; CREATE PROCEDURE sp57( f1 numeric) BEGIN @@ -18208,7 +18208,7 @@ set f1 = (f1 / 2); set f1 = (f1 * 2); set f1 = (f1 - 10); set f1 = (f1 + 10); SELECT f1; END// CALL sp84(-32601); -ERROR 22003: BIGINT UNSIGNED value is out of range in '(f1@0 - 10)' +ERROR 22003: BIGINT UNSIGNED value is out of range in 'f1@0 - 10' DROP PROCEDURE IF EXISTS sp85; CREATE PROCEDURE sp85( f1 tinyint) BEGIN @@ -18243,7 +18243,7 @@ set f1 = (f1 / 2); set f1 = (f1 * 2); set f1 = (f1 - 10); set f1 = (f1 + 10); SELECT f1; END// CALL sp88(-101); -ERROR 22003: BIGINT UNSIGNED value is out of range in '(f1@0 - 10)' +ERROR 22003: BIGINT UNSIGNED value is out of range in 'f1@0 - 10' DROP PROCEDURE IF EXISTS sp89; CREATE PROCEDURE sp89( f1 enum('1enum', '2enum')) BEGIN @@ -18570,7 +18570,7 @@ CALL sp4(-9.22e+18, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute04(); -ERROR 22003: BIGINT value is out of range in '(f1@0 * 2)' +ERROR 22003: BIGINT value is out of range in 'f1@0 * 2' DROP PROCEDURE spexecute04; DROP PROCEDURE sp4; DROP PROCEDURE IF EXISTS sp6; @@ -18683,7 +18683,7 @@ f7 f8 f9 -9220000000000000000 -9220000000000000000 NULL f10 f11 f12 -9220000000000000000 -9220000000000000000 NULL -ERROR 22003: BIGINT UNSIGNED value is out of range in '(f1@0 * 2)' +ERROR 22003: BIGINT UNSIGNED value is out of range in 'f1@0 * 2' DROP PROCEDURE spexecute07; DROP PROCEDURE sp07; DROP PROCEDURE IF EXISTS sp8; @@ -18734,7 +18734,7 @@ CALL sp8(1.84e+17, var1, var2, -9.22e+18, var3, var4, SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute08(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute08; DROP PROCEDURE sp8; DROP PROCEDURE IF EXISTS sp9; @@ -18785,7 +18785,7 @@ CALL sp9(-9.22e+15, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute09(); -ERROR 22003: BIGINT UNSIGNED value is out of range in '(f1@0 - 10)' +ERROR 22003: BIGINT UNSIGNED value is out of range in 'f1@0 - 10' DROP PROCEDURE spexecute09; DROP PROCEDURE sp9; DROP PROCEDURE IF EXISTS sp10; @@ -18828,7 +18828,7 @@ CALL sp10(-1.00e+09, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, - SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute10(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute10; DROP PROCEDURE sp10; DROP PROCEDURE IF EXISTS sp11; @@ -18860,7 +18860,7 @@ CALL sp11(--1.00e+09, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute11(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute11; DROP PROCEDURE sp11; DROP PROCEDURE IF EXISTS sp12; @@ -18892,7 +18892,7 @@ CALL sp12(99999999999, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute12(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute12; DROP PROCEDURE sp12; DROP PROCEDURE IF EXISTS sp13; @@ -18924,7 +18924,7 @@ CALL sp13(-1.00e+09, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, - SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute13(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute13; DROP PROCEDURE sp13; DROP PROCEDURE IF EXISTS sp14; @@ -18956,7 +18956,7 @@ CALL sp14(-1.00e+21, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, - SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute14(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute14; DROP PROCEDURE sp14; DROP PROCEDURE IF EXISTS sp15; @@ -18987,7 +18987,7 @@ CALL sp15(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute15(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute15; DROP PROCEDURE sp15; DROP PROCEDURE IF EXISTS sp16; @@ -19018,7 +19018,7 @@ CALL sp16(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute16(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute16; DROP PROCEDURE sp16; DROP PROCEDURE IF EXISTS sp17; @@ -19049,7 +19049,7 @@ CALL sp17(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute17(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute17; DROP PROCEDURE sp17; DROP PROCEDURE IF EXISTS sp18; @@ -19080,7 +19080,7 @@ CALL sp18(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute18(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute18; DROP PROCEDURE sp18; DROP PROCEDURE IF EXISTS sp19; @@ -19111,7 +19111,7 @@ CALL sp19(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute19(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute19; DROP PROCEDURE sp19; DROP PROCEDURE IF EXISTS sp20; @@ -19142,7 +19142,7 @@ CALL sp20(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute20(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute20; DROP PROCEDURE sp20; DROP PROCEDURE IF EXISTS sp21; @@ -19173,7 +19173,7 @@ CALL sp21(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute21(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute21; DROP PROCEDURE sp21; DROP PROCEDURE IF EXISTS sp22; @@ -19204,7 +19204,7 @@ CALL sp22(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute22(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute22; DROP PROCEDURE sp22; DROP PROCEDURE IF EXISTS sp23; @@ -19235,7 +19235,7 @@ CALL sp23(-999999999, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute23(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute23; DROP PROCEDURE sp23; DROP PROCEDURE IF EXISTS sp24; @@ -19266,7 +19266,7 @@ CALL sp24(1.1, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9.22e+ SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute24(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute24; DROP PROCEDURE sp24; DROP PROCEDURE IF EXISTS sp25; @@ -19297,7 +19297,7 @@ CALL sp25(-32701, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9.2 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute25(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute25; DROP PROCEDURE sp25; DROP PROCEDURE IF EXISTS sp26; @@ -19328,7 +19328,7 @@ CALL sp26( '1997-12-31', var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute26(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute26; DROP PROCEDURE sp26; DROP PROCEDURE IF EXISTS sp27; @@ -19359,7 +19359,7 @@ CALL sp27( '23:59:59.999999', var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute27(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute27; DROP PROCEDURE sp27; DROP PROCEDURE IF EXISTS sp28; @@ -19390,7 +19390,7 @@ CALL sp28('1997-12-31 23:59:59.999999', var1, var2, -9.22e+18, var3, var4, -9.22 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute28(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute28; DROP PROCEDURE sp28; DROP PROCEDURE IF EXISTS sp29; @@ -19421,7 +19421,7 @@ CALL sp29(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute29(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute29; DROP PROCEDURE sp29; DROP PROCEDURE IF EXISTS sp30; @@ -19452,7 +19452,7 @@ CALL sp30(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute30(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute30; DROP PROCEDURE sp30; DROP PROCEDURE IF EXISTS sp31; @@ -19483,7 +19483,7 @@ CALL sp31(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute31(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute31; DROP PROCEDURE sp31; DROP PROCEDURE IF EXISTS sp32; @@ -19514,7 +19514,7 @@ CALL sp32(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute32(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute32; DROP PROCEDURE sp32; DROP PROCEDURE IF EXISTS sp33; @@ -19545,7 +19545,7 @@ CALL sp33(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute33(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute33; DROP PROCEDURE sp33; DROP PROCEDURE IF EXISTS sp34; @@ -19576,7 +19576,7 @@ CALL sp34(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute34(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute34; DROP PROCEDURE sp34; DROP PROCEDURE IF EXISTS sp35; @@ -19607,7 +19607,7 @@ CALL sp35(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute35(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute35; DROP PROCEDURE sp35; DROP PROCEDURE IF EXISTS sp36; @@ -19638,7 +19638,7 @@ CALL sp36(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute36(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute36; DROP PROCEDURE sp36; DROP PROCEDURE IF EXISTS sp37; @@ -19669,7 +19669,7 @@ CALL sp37(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute37(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute37; DROP PROCEDURE sp37; DROP PROCEDURE IF EXISTS sp38; @@ -19700,7 +19700,7 @@ CALL sp38(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute38(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute38; DROP PROCEDURE sp38; DROP PROCEDURE IF EXISTS sp39; @@ -19731,7 +19731,7 @@ CALL sp39(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute39(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute39; DROP PROCEDURE sp39; DROP PROCEDURE IF EXISTS sp40; @@ -19762,7 +19762,7 @@ CALL sp40(1.1, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9.22e+ SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute40(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute40; DROP PROCEDURE sp40; DROP PROCEDURE IF EXISTS sp41; @@ -19793,7 +19793,7 @@ CALL sp41(1.1, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9.22e+ SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute41(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute41; DROP PROCEDURE sp41; DROP PROCEDURE IF EXISTS sp42; @@ -19824,7 +19824,7 @@ CALL sp42(1.1, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9.22e+ SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute42(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute42; DROP PROCEDURE sp42; DROP PROCEDURE IF EXISTS sp43; @@ -19855,7 +19855,7 @@ CALL sp43(-999999999, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute43(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute43; DROP PROCEDURE sp43; DROP PROCEDURE IF EXISTS sp44; @@ -19886,7 +19886,7 @@ CALL sp44(9999999999, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute44(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute44; DROP PROCEDURE sp44; DROP PROCEDURE IF EXISTS sp45; @@ -19917,7 +19917,7 @@ CALL sp45(-99999999, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, - SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute45(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute45; DROP PROCEDURE sp45; DROP PROCEDURE IF EXISTS sp46; @@ -19948,7 +19948,7 @@ CALL sp46(-999999999, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute46(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute46; DROP PROCEDURE sp46; DROP PROCEDURE IF EXISTS sp47; @@ -19979,7 +19979,7 @@ CALL sp47(9999999999, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute47(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute47; DROP PROCEDURE sp47; DROP PROCEDURE IF EXISTS sp48; @@ -20010,7 +20010,7 @@ CALL sp48(-99999999, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, - SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute48(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute48; DROP PROCEDURE sp48; DROP PROCEDURE IF EXISTS sp49; @@ -20041,7 +20041,7 @@ CALL sp49(-999999999, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute49(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute49; DROP PROCEDURE sp49; DROP PROCEDURE IF EXISTS sp50; @@ -20072,7 +20072,7 @@ CALL sp50(9999999999, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute50(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute50; DROP PROCEDURE sp50; DROP PROCEDURE IF EXISTS sp51; @@ -20103,7 +20103,7 @@ CALL sp51(-99999999, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, - SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute51(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute51; DROP PROCEDURE sp51; DROP PROCEDURE IF EXISTS sp52; @@ -20134,7 +20134,7 @@ CALL sp52(-1.00e+20, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, - SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute52(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute52; DROP PROCEDURE sp52; DROP PROCEDURE IF EXISTS sp53; @@ -20165,7 +20165,7 @@ CALL sp53(-1.00e+20, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, - SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute53(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute53; DROP PROCEDURE sp53; DROP PROCEDURE IF EXISTS sp54; @@ -20196,7 +20196,7 @@ CALL sp54(1.00e+20, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute54(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute54; DROP PROCEDURE sp54; DROP PROCEDURE IF EXISTS sp55; @@ -20227,7 +20227,7 @@ CALL sp55(-1.00e+20, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, - SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute55(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute55; DROP PROCEDURE sp55; DROP PROCEDURE IF EXISTS sp56; @@ -20564,7 +20564,7 @@ CALL sp65(999999999, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, - SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute65(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute65; DROP PROCEDURE sp65; DROP PROCEDURE IF EXISTS sp66; @@ -20595,7 +20595,7 @@ CALL sp66(1.00e+16, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute66(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute66; DROP PROCEDURE sp66; DROP PROCEDURE IF EXISTS sp67; @@ -20626,7 +20626,7 @@ CALL sp67(1.00e+16, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute67(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute67; DROP PROCEDURE sp67; DROP PROCEDURE IF EXISTS sp68; @@ -20657,7 +20657,7 @@ CALL sp68(-1.00e+21, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, - SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute68(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute68; DROP PROCEDURE sp68; DROP PROCEDURE IF EXISTS sp69; @@ -20688,7 +20688,7 @@ CALL sp69(-1.00e+20, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, - SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute69(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute69; DROP PROCEDURE sp69; DROP PROCEDURE IF EXISTS sp70; @@ -20719,7 +20719,7 @@ CALL sp70(1.00e+20, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute70(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute70; DROP PROCEDURE sp70; DROP PROCEDURE IF EXISTS sp71; @@ -20750,7 +20750,7 @@ CALL sp71(1.00e+20, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute71(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute71; DROP PROCEDURE sp71; DROP PROCEDURE IF EXISTS sp72; @@ -20781,7 +20781,7 @@ CALL sp72(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute72(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute72; DROP PROCEDURE sp72; DROP PROCEDURE IF EXISTS sp73; @@ -20812,7 +20812,7 @@ CALL sp73(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute73(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute73; DROP PROCEDURE sp73; DROP PROCEDURE IF EXISTS sp74; @@ -20843,7 +20843,7 @@ CALL sp74(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute74(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute74; DROP PROCEDURE sp74; DROP PROCEDURE IF EXISTS sp75; @@ -20874,7 +20874,7 @@ CALL sp75(-1.00e+09, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, - SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute75(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute75; DROP PROCEDURE sp75; DROP PROCEDURE IF EXISTS sp76; @@ -20905,7 +20905,7 @@ CALL sp76(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute76(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute76; DROP PROCEDURE sp76; DROP PROCEDURE IF EXISTS sp77; @@ -20936,7 +20936,7 @@ CALL sp77(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute77(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute77; DROP PROCEDURE sp77; DROP PROCEDURE IF EXISTS sp78; @@ -20967,7 +20967,7 @@ CALL sp78(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute78(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute78; DROP PROCEDURE sp78; DROP PROCEDURE IF EXISTS sp79; @@ -20998,7 +20998,7 @@ CALL sp79(1.00e+00, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute79(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute79; DROP PROCEDURE sp79; DROP PROCEDURE IF EXISTS sp80; @@ -21029,7 +21029,7 @@ CALL sp80(-2.15e+09, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, - SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute80(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute80; DROP PROCEDURE sp80; DROP PROCEDURE IF EXISTS sp81; @@ -21060,7 +21060,7 @@ CALL sp81(4.29e+09, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute81(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute81; DROP PROCEDURE sp81; DROP PROCEDURE IF EXISTS sp82; @@ -21091,7 +21091,7 @@ CALL sp82(4.29e+09, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute82(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute82; DROP PROCEDURE sp82; DROP PROCEDURE IF EXISTS sp83; @@ -21122,7 +21122,7 @@ CALL sp83(2.15e+08, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute83(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute83; DROP PROCEDURE sp83; DROP PROCEDURE IF EXISTS sp84; @@ -21153,7 +21153,7 @@ CALL sp84(-8388600, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute84(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute84; DROP PROCEDURE sp84; DROP PROCEDURE IF EXISTS sp85; @@ -21184,7 +21184,7 @@ CALL sp85(16777201, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute85(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute85; DROP PROCEDURE sp85; DROP PROCEDURE IF EXISTS sp86; @@ -21215,7 +21215,7 @@ CALL sp86(16777210, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute86(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute86; DROP PROCEDURE sp86; DROP PROCEDURE IF EXISTS sp87; @@ -21246,7 +21246,7 @@ CALL sp87(-8388601, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute87(); -ERROR 22003: BIGINT UNSIGNED value is out of range in '(f1@0 - 10)' +ERROR 22003: BIGINT UNSIGNED value is out of range in 'f1@0 - 10' DROP PROCEDURE spexecute87; DROP PROCEDURE sp87; DROP PROCEDURE IF EXISTS sp88; @@ -21277,7 +21277,7 @@ CALL sp88(99999999, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute88(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute88; DROP PROCEDURE sp88; DROP PROCEDURE IF EXISTS sp89; @@ -21308,7 +21308,7 @@ CALL sp89(99999999, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute89(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute89; DROP PROCEDURE sp89; DROP PROCEDURE IF EXISTS sp90; @@ -21339,7 +21339,7 @@ CALL sp90(1.00e+20, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute90(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute90; DROP PROCEDURE sp90; DROP PROCEDURE IF EXISTS sp91; @@ -21370,7 +21370,7 @@ CALL sp91(1.00e+20, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute91(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute91; DROP PROCEDURE sp91; DROP PROCEDURE IF EXISTS sp92; @@ -21401,7 +21401,7 @@ CALL sp92(-1.00e+20, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, - SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute92(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute92; DROP PROCEDURE sp92; DROP PROCEDURE IF EXISTS sp93; @@ -21432,7 +21432,7 @@ CALL sp93(1.00e+20, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute93(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute93; DROP PROCEDURE sp93; DROP PROCEDURE IF EXISTS sp94; @@ -21463,7 +21463,7 @@ CALL sp94(-32701, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9.2 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute94(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute94; DROP PROCEDURE sp94; DROP PROCEDURE IF EXISTS sp95; @@ -21494,7 +21494,7 @@ CALL sp95(65531, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9.22 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute95(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute95; DROP PROCEDURE sp95; DROP PROCEDURE IF EXISTS sp96; @@ -21525,7 +21525,7 @@ CALL sp96(65531, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9.22 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute96(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute96; DROP PROCEDURE sp96; DROP PROCEDURE IF EXISTS sp97; @@ -21556,7 +21556,7 @@ CALL sp97(-32601, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9.2 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute97(); -ERROR 22003: BIGINT UNSIGNED value is out of range in '(f1@0 - 10)' +ERROR 22003: BIGINT UNSIGNED value is out of range in 'f1@0 - 10' DROP PROCEDURE spexecute97; DROP PROCEDURE sp97; DROP PROCEDURE IF EXISTS sp98; @@ -21587,7 +21587,7 @@ CALL sp98(-115, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9.22e SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute98(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute98; DROP PROCEDURE sp98; DROP PROCEDURE IF EXISTS sp99; @@ -21618,7 +21618,7 @@ CALL sp99(251, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9.22e+ SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute99(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute99; DROP PROCEDURE sp99; DROP PROCEDURE IF EXISTS sp100; @@ -21649,7 +21649,7 @@ CALL sp100(201, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9.22e SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute100(); -ERROR 22003: BIGINT value is out of range in '(f5@4 * 2)' +ERROR 22003: BIGINT value is out of range in 'f5@4 * 2' DROP PROCEDURE spexecute100; DROP PROCEDURE sp100; DROP PROCEDURE IF EXISTS sp101; @@ -21680,7 +21680,7 @@ CALL sp101(-101, var1, var2, -9.22e+18, var3, var4, -9.22e+18, var5, var6, -9.22 SELECT var1, var2, var3, var4, var5, var6, var7, var8; END// CALL spexecute101(); -ERROR 22003: BIGINT UNSIGNED value is out of range in '(f1@0 - 10)' +ERROR 22003: BIGINT UNSIGNED value is out of range in 'f1@0 - 10' DROP PROCEDURE spexecute101; DROP PROCEDURE sp101; USE db_storedproc; diff --git a/mysql-test/suite/funcs_1/t/is_columns_is.test b/mysql-test/suite/funcs_1/t/is_columns_is.test index 29d387857c9..e1771dfa41e 100644 --- a/mysql-test/suite/funcs_1/t/is_columns_is.test +++ b/mysql-test/suite/funcs_1/t/is_columns_is.test @@ -16,7 +16,7 @@ # --source include/not_embedded.inc ---source include/have_xtradb.inc +--source include/have_innodb.inc let $my_where = WHERE table_schema = 'information_schema' AND table_name <> 'profiling' AND table_name not like 'innodb_%'; diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 5f8d9c6ddff..f2e4077016a 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -30,3 +30,14 @@ galera_gcs_fragment : Incorrect arguments to SET galera_flush_local : Fails sporadically galera_binlog_stmt_autoinc : TODO: investigate galera_concurrent_ctas : Test times out, investigate +MW-258 : MDEV-11229 +galera_as_master : MDEV-11229 +MW-44 : MDEV-11229 +galera_gcs_fc_limit : MDEV-11229 +galera_roles : MDEV-11229 +galera_lock_table : MDEV-11229 +MW-286 : TODO: investigate +galera_sst_xtrabackup-v2-options : TODO: Fix test case +galera_sst_xtrabackup-v2 : MDEV-11208 +galera_sst_xtrabackup-v2_encrypt_with_key : MDEV-11208 +mysql-wsrep#33 : TODO: investigate diff --git a/mysql-test/suite/galera/include/auto_increment_offset_restore.inc b/mysql-test/suite/galera/include/auto_increment_offset_restore.inc index 6218dfd6f2c..1248ed100ca 100644 --- a/mysql-test/suite/galera/include/auto_increment_offset_restore.inc +++ b/mysql-test/suite/galera/include/auto_increment_offset_restore.inc @@ -32,4 +32,10 @@ if ($node_3) --connection $node_3 --eval SET @@global.auto_increment_offset = $auto_increment_offset_node_3; } + +if ($node_4) +{ +--connection $node_4 +--eval SET @@global.auto_increment_offset = $auto_increment_offset_node_4; +} --enable_query_log diff --git a/mysql-test/suite/galera/include/auto_increment_offset_save.inc b/mysql-test/suite/galera/include/auto_increment_offset_save.inc index 3c4db3f381c..216c689ec8c 100644 --- a/mysql-test/suite/galera/include/auto_increment_offset_save.inc +++ b/mysql-test/suite/galera/include/auto_increment_offset_save.inc @@ -13,6 +13,8 @@ # Connection handle for 2nd node # $node_3 (optional) # Connection handle for 3rd node +# $node_4 (optional) +# Connection handle for 4th node if (!$node_1) { @@ -35,3 +37,9 @@ if ($node_3) let $auto_increment_offset_node_3 = `SELECT @@global.auto_increment_offset`; } +if ($node_4) +{ + --connection $node_4 + let $auto_increment_offset_node_4 = `SELECT @@global.auto_increment_offset`; +} + diff --git a/mysql-test/suite/galera/r/GAL-382.result b/mysql-test/suite/galera/r/GAL-382.result index 0c7365f3005..fb7c229bd56 100644 --- a/mysql-test/suite/galera/r/GAL-382.result +++ b/mysql-test/suite/galera/r/GAL-382.result @@ -1,3 +1,4 @@ +connection node_1; create table t1 (i int, j int, k int, primary key pk(i)) engine=innodb; insert into t1 values (1, 1, 1), (2, 2, 2), (3, 3, 3); create table t2 (i int, j int, k int, primary key pk(i, j, k), index idx(i, k, j)) engine=innodb; diff --git a/mysql-test/suite/galera/r/MW-252.result b/mysql-test/suite/galera/r/MW-252.result index c422edcb82a..795d3fff670 100644 --- a/mysql-test/suite/galera/r/MW-252.result +++ b/mysql-test/suite/galera/r/MW-252.result @@ -1,7 +1,10 @@ +connection node_1; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; FLUSH TABLES WITH READ LOCK; SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 2 1 +connection node_2; +connection node_1; UNLOCK TABLES; DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/MW-258.result b/mysql-test/suite/galera/r/MW-258.result index 1b4d4ae0de8..1c2a1744c98 100644 --- a/mysql-test/suite/galera/r/MW-258.result +++ b/mysql-test/suite/galera/r/MW-258.result @@ -1,3 +1,4 @@ +connection node_1; CREATE TABLE t1 (f1 INTEGER); LOCK TABLE t1 WRITE; value prior to RSU: @@ -7,12 +8,17 @@ wsrep_desync_count 0 SHOW VARIABLES LIKE 'wsrep_desync'; Variable_name Value wsrep_desync OFF +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1a; SET SESSION wsrep_sync_wait = 0; SET SESSION wsrep_osu_method = RSU; ALTER TABLE t1 ADD COLUMN f2 INTEGER;; +connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1b; SET SESSION wsrep_sync_wait = 0; SET SESSION wsrep_osu_method = RSU; ALTER TABLE t1 ADD COLUMN f3 INTEGER;; +connection node_1; value during RSU: SHOW STATUS LIKE 'wsrep_desync_count'; Variable_name Value @@ -21,6 +27,9 @@ SHOW VARIABLES LIKE 'wsrep_desync'; Variable_name Value wsrep_desync OFF UNLOCK TABLES; +connection node_1a; +connection node_1b; +connection node_1; value after RSU: SHOW STATUS LIKE 'wsrep_desync_count'; Variable_name Value diff --git a/mysql-test/suite/galera/r/MW-259.result b/mysql-test/suite/galera/r/MW-259.result index df76e959de5..5256a95c52c 100644 --- a/mysql-test/suite/galera/r/MW-259.result +++ b/mysql-test/suite/galera/r/MW-259.result @@ -1,3 +1,6 @@ +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1; CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; SET GLOBAL wsrep_desync=0; Warnings: @@ -5,8 +8,12 @@ Warning 1231 'wsrep_desync' is already OFF. SET wsrep_OSU_method=RSU; SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue'; ALTER TABLE t1 ADD COLUMN f2 INTEGER;; +connection node_1a; SET GLOBAL wsrep_desync=1;; +connection node_1b; SET DEBUG_SYNC= 'now SIGNAL continue'; DROP TABLE t1; SET GLOBAL wsrep_desync=0; +connection node_1; +connection node_1a; SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/suite/galera/r/MW-292.result b/mysql-test/suite/galera/r/MW-292.result index f038f880efa..5b9214ace2a 100644 --- a/mysql-test/suite/galera/r/MW-292.result +++ b/mysql-test/suite/galera/r/MW-292.result @@ -2,20 +2,28 @@ CREATE TABLE rand_table (f1 FLOAT); CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); INSERT INTO t1 VALUES (1, 'a'); INSERT INTO t1 VALUES (2, 'a'); +connection node_1; SET AUTOCOMMIT=ON; START TRANSACTION; UPDATE t1 SET f2 = 'b' WHERE f1 = 1; SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE; f1 f2 2 a +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_enter_sync'; +connection node_1; COMMIT;; +connection node_1a; SET SESSION wsrep_sync_wait = 0; SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 1; +connection node_2; UPDATE t1 SET f2 = 'c' WHERE f1 = 2; +connection node_1a; +connection node_1a; SET GLOBAL wsrep_provider_options = 'dbug='; SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_enter_sync'; +connection node_1; SELECT TIMEDIFF(SYSDATE(), NOW()) < 2; TIMEDIFF(SYSDATE(), NOW()) < 2 1 @@ -26,5 +34,6 @@ COUNT(DISTINCT f1) = 10 1 wsrep_local_replays 1 +connection node_2; DROP TABLE t1; DROP TABLE rand_table; diff --git a/mysql-test/suite/galera/r/MW-44.result b/mysql-test/suite/galera/r/MW-44.result index 28a6f1ac8dd..c007779bc79 100644 --- a/mysql-test/suite/galera/r/MW-44.result +++ b/mysql-test/suite/galera/r/MW-44.result @@ -1,5 +1,8 @@ +connection node_1; TRUNCATE TABLE mysql.general_log; +connection node_2; TRUNCATE TABLE mysql.general_log; +connection node_1; SET SESSION wsrep_osu_method=TOI; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; SET SESSION wsrep_osu_method=RSU; @@ -8,6 +11,7 @@ SET SESSION wsrep_osu_method=TOI; SELECT COUNT(*) = 2 FROM mysql.general_log WHERE argument LIKE 'CREATE%' OR argument LIKE 'ALTER%'; COUNT(*) = 2 1 +connection node_2; SELECT COUNT(*) = 0 FROM mysql.general_log WHERE argument NOT LIKE 'SELECT%'; COUNT(*) = 0 1 diff --git a/mysql-test/suite/galera/r/enforce_storage_engine2.result b/mysql-test/suite/galera/r/enforce_storage_engine2.result new file mode 100644 index 00000000000..128994ed221 --- /dev/null +++ b/mysql-test/suite/galera/r/enforce_storage_engine2.result @@ -0,0 +1,26 @@ +# +# MDEV-9312: storage engine not enforced during galera cluster +# replication +# +connection node_1; +CREATE TABLE t1(i INT) ENGINE=INNODB; +CREATE TABLE t2(i INT) ENGINE=MYISAM; +Warnings: +Note 1266 Using storage engine InnoDB for table 't2' +connection node_2; +SHOW TABLES; +Tables_in_test +t1 +t2 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `i` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +# End of tests diff --git a/mysql-test/suite/galera/r/galera#414.result b/mysql-test/suite/galera/r/galera#414.result index 029961f9463..c9fc39ddc21 100644 --- a/mysql-test/suite/galera/r/galera#414.result +++ b/mysql-test/suite/galera/r/galera#414.result @@ -1,5 +1,11 @@ +connection node_2; +connection node_1; SET SESSION wsrep_sync_wait = 0; SET SESSION wsrep_on = OFF; +connection node_2; +connection node_1; SET SESSION wsrep_on = ON; +connection node_1; CALL mtr.add_suppression("Failed to set packet size"); +connection node_2; CALL mtr.add_suppression("Failed to set packet size"); diff --git a/mysql-test/suite/galera/r/galera_as_slave_autoinc.result b/mysql-test/suite/galera/r/galera_as_slave_autoinc.result index b6314b862c2..ac01ea100a0 100644 --- a/mysql-test/suite/galera/r/galera_as_slave_autoinc.result +++ b/mysql-test/suite/galera/r/galera_as_slave_autoinc.result @@ -1,4 +1,7 @@ +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2; START SLAVE; +connection node_1; SET SESSION binlog_format='STATEMENT'; CREATE TABLE t1 ( i int(11) NOT NULL AUTO_INCREMENT, @@ -40,6 +43,7 @@ Variable_name Value auto_increment_increment 7 auto_increment_offset 5 wsrep_auto_increment_control ON +connection node_2; select * from t1; i c 1 dummy_text @@ -58,6 +62,7 @@ binlog_format ROW show variables like 'auto_increment_increment'; Variable_name Value auto_increment_increment 2 +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; select * from t1; i c 1 dummy_text @@ -76,7 +81,10 @@ binlog_format ROW show variables like 'auto_increment_increment'; Variable_name Value auto_increment_increment 2 +connection node_1; DROP TABLE t1; +connection node_2; STOP SLAVE; RESET SLAVE ALL; +connection node_1; RESET MASTER; diff --git a/mysql-test/suite/galera/r/galera_autoinc_sst_xtrabackup.result b/mysql-test/suite/galera/r/galera_autoinc_sst_xtrabackup.result index 228d7c6f041..d0fac1e3d14 100644 --- a/mysql-test/suite/galera/r/galera_autoinc_sst_xtrabackup.result +++ b/mysql-test/suite/galera/r/galera_autoinc_sst_xtrabackup.result @@ -1,3 +1,4 @@ +connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; CREATE PROCEDURE p1 () BEGIN @@ -9,12 +10,21 @@ COMMIT; END WHILE; END| CALL p1();; +connection node_2; CALL p1();; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2a; Killing server ... INSERT INTO t1 VALUES (DEFAULT); +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1a; INSERT INTO t1 VALUES (DEFAULT); +connection node_1; Got one of the listed errors +connection node_2; Got one of the listed errors +connection node_1a; +connection node_2a; count_equal 1 CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member 0"); @@ -24,6 +34,7 @@ VARIABLE_VALUE SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 2 1 +connection node_1a; SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE 2 diff --git a/mysql-test/suite/galera/r/galera_binlog_checksum.result b/mysql-test/suite/galera/r/galera_binlog_checksum.result index b0ea2293119..7303aa61122 100644 --- a/mysql-test/suite/galera/r/galera_binlog_checksum.result +++ b/mysql-test/suite/galera/r/galera_binlog_checksum.result @@ -11,3 +11,19 @@ SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; COUNT(*) = 1 1 DROP TABLE t1; +# +# MDEV-11149: wsrep_replicate_mysaim: DML fails when binlog checksum +# enabled +# +connection node_1; +SET @@global.wsrep_replicate_myisam=1; +CREATE TABLE t1 (i INT) ENGINE=MYISAM; +INSERT INTO t1 VALUES(1); +connection node_2; +SELECT * FROM t1; +i +1 +connection node_1; +DROP TABLE t1; +SET @@global.wsrep_replicate_myisam=0; +# End of tests. diff --git a/mysql-test/suite/galera/r/galera_binlog_event_max_size_max.result b/mysql-test/suite/galera/r/galera_binlog_event_max_size_max.result index 4156c0c70a7..46582ff5c4b 100644 --- a/mysql-test/suite/galera/r/galera_binlog_event_max_size_max.result +++ b/mysql-test/suite/galera/r/galera_binlog_event_max_size_max.result @@ -2,6 +2,7 @@ CREATE TABLE ten (f1 INTEGER); INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); CREATE TABLE t1 (f1 VARCHAR(1000)); INSERT INTO t1 SELECT REPEAT('x', 1000) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; +connection node_2; SELECT COUNT(*) = 10000 FROM t1; COUNT(*) = 10000 1 diff --git a/mysql-test/suite/galera/r/galera_forced_binlog_format.result b/mysql-test/suite/galera/r/galera_forced_binlog_format.result index 01f738f6109..86789a1b8e9 100644 --- a/mysql-test/suite/galera/r/galera_forced_binlog_format.result +++ b/mysql-test/suite/galera/r/galera_forced_binlog_format.result @@ -9,7 +9,7 @@ SET SESSION binlog_format = 'MIXED'; Warnings: Warning 1105 MariaDB Galera does not support binlog format: MIXED INSERT INTO t1 VALUES (2); -SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 249; +SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 256; Log_name Pos Event_type Server_id End_log_pos Info mysqld-bin.000001 Gtid_list 1 [] mysqld-bin.000001 Binlog_checkpoint 1 mysqld-bin.000001 diff --git a/mysql-test/suite/galera/r/galera_fulltext.result b/mysql-test/suite/galera/r/galera_fulltext.result index 84ae0a116a1..18e3bff40fc 100644 --- a/mysql-test/suite/galera/r/galera_fulltext.result +++ b/mysql-test/suite/galera/r/galera_fulltext.result @@ -1,24 +1,34 @@ CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +connection node_1; CREATE TABLE t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(100), FULLTEXT (f2)) ENGINE=InnoDB; +connection node_2; SELECT COUNT(*) = 13 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name LIKE 'test/%'; COUNT(*) = 13 1 +connection node_1; INSERT INTO t1 (f2) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3; +connection node_2; SELECT COUNT(f2) = 1000 FROM t1 WHERE MATCH(f2) AGAINST ('foobarbaz'); COUNT(f2) = 1000 1 UPDATE t1 SET f2 = 'abcdefjhk'; +connection node_1; SELECT COUNT(f2) = 1000 FROM t1 WHERE MATCH(f2) AGAINST ('abcdefjhk'); COUNT(f2) = 1000 1 +connection node_2; DROP TABLE t1; +connection node_1; CREATE TABLE t1 (f1 VARCHAR(100), FULLTEXT (f1)) ENGINE=InnoDB; +connection node_2; INSERT INTO t1 (f1) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3; +connection node_1; SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('foobarbaz'); COUNT(f1) = 1000 1 UPDATE t1 SET f1 = 'abcdefjhk'; +connection node_2; SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('abcdefjhk'); COUNT(f1) = 1000 1 diff --git a/mysql-test/suite/galera/r/galera_gcs_max_packet_size.result b/mysql-test/suite/galera/r/galera_gcs_max_packet_size.result index 606cb549def..ce74f3db433 100644 --- a/mysql-test/suite/galera/r/galera_gcs_max_packet_size.result +++ b/mysql-test/suite/galera/r/galera_gcs_max_packet_size.result @@ -4,6 +4,7 @@ CREATE TABLE t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=InnoDB; CREATE TABLE t2 (f1 VARCHAR(512) UNIQUE) ENGINE=InnoDB; INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; INSERT INTO t2 VALUES (REPEAT('x', 512)); +connection node_2; SELECT COUNT(*) = 10000 FROM t1; COUNT(*) = 10000 1 diff --git a/mysql-test/suite/galera/r/galera_ist_recv_bind.result b/mysql-test/suite/galera/r/galera_ist_recv_bind.result index de4e07fbe41..ffc751d8672 100644 --- a/mysql-test/suite/galera/r/galera_ist_recv_bind.result +++ b/mysql-test/suite/galera/r/galera_ist_recv_bind.result @@ -1,13 +1,21 @@ +connection node_1; SELECT @@wsrep_provider_options LIKE '%ist.recv_bind = 127.0.0.1%'; @@wsrep_provider_options LIKE '%ist.recv_bind = 127.0.0.1%' 1 +connection node_2; SELECT @@wsrep_provider_options LIKE '%ist.recv_bind = 127.0.0.1%'; @@wsrep_provider_options LIKE '%ist.recv_bind = 127.0.0.1%' 1 SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1'; +connection node_1; +connection node_2; SET SESSION wsrep_on = OFF; SET SESSION wsrep_on = ON; +connection node_1; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); +connection node_2; SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0'; +connection node_1; +connection node_2; DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_ist_restart_joiner.result b/mysql-test/suite/galera/r/galera_ist_restart_joiner.result index 01544843d2d..78fc5b2baf3 100644 --- a/mysql-test/suite/galera/r/galera_ist_restart_joiner.result +++ b/mysql-test/suite/galera/r/galera_ist_restart_joiner.result @@ -1,3 +1,5 @@ +connection node_1; +connection node_2; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); INSERT INTO t1 VALUES (1, 'a'), (2, 'a'), (3, 'a'), (4, 'a'), (5, 'a'),(6, 'a'); connection node_2; @@ -52,3 +54,5 @@ COUNT(*) = 0 1 connection node_1; DROP TABLE t1, t2, t3; +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera/r/galera_ist_rsync.result b/mysql-test/suite/galera/r/galera_ist_rsync.result index 0b25a299b24..e4eb9d821fa 100644 --- a/mysql-test/suite/galera/r/galera_ist_rsync.result +++ b/mysql-test/suite/galera/r/galera_ist_rsync.result @@ -1,4 +1,5 @@ Performing State Transfer on a server that has been temporarily disconnected +connection node_1; CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; @@ -8,6 +9,7 @@ INSERT INTO t1 VALUES ('node1_committed_before'); INSERT INTO t1 VALUES ('node1_committed_before'); INSERT INTO t1 VALUES ('node1_committed_before'); COMMIT; +connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES ('node2_committed_before'); @@ -18,6 +20,7 @@ INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Unloading wsrep provider ... SET GLOBAL wsrep_provider = 'none'; +connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES ('node1_committed_during'); @@ -32,6 +35,7 @@ INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +connect node_1a_galera_st_disconnect_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); @@ -39,6 +43,7 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +connection node_2; Loading wsrep provider ... SET AUTOCOMMIT=OFF; START TRANSACTION; @@ -48,6 +53,7 @@ INSERT INTO t1 VALUES ('node2_committed_after'); INSERT INTO t1 VALUES ('node2_committed_after'); INSERT INTO t1 VALUES ('node2_committed_after'); COMMIT; +connection node_1; INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); @@ -62,6 +68,7 @@ INSERT INTO t1 VALUES ('node1_committed_after'); INSERT INTO t1 VALUES ('node1_committed_after'); INSERT INTO t1 VALUES ('node1_committed_after'); COMMIT; +connection node_1a_galera_st_disconnect_slave; INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); @@ -76,6 +83,7 @@ COUNT(*) = 0 1 COMMIT; SET AUTOCOMMIT=ON; +connection node_1; SELECT COUNT(*) = 35 FROM t1; COUNT(*) = 35 1 @@ -86,6 +94,7 @@ DROP TABLE t1; COMMIT; SET AUTOCOMMIT=ON; Performing State Transfer on a server that has been shut down cleanly and restarted +connection node_1; CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; @@ -95,6 +104,7 @@ INSERT INTO t1 VALUES ('node1_committed_before'); INSERT INTO t1 VALUES ('node1_committed_before'); INSERT INTO t1 VALUES ('node1_committed_before'); COMMIT; +connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES ('node2_committed_before'); @@ -104,6 +114,7 @@ INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Shutting down server ... +connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES ('node1_committed_during'); @@ -118,6 +129,7 @@ INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); @@ -125,6 +137,7 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +connection node_2; Starting server ... SET AUTOCOMMIT=OFF; START TRANSACTION; @@ -134,6 +147,7 @@ INSERT INTO t1 VALUES ('node2_committed_after'); INSERT INTO t1 VALUES ('node2_committed_after'); INSERT INTO t1 VALUES ('node2_committed_after'); COMMIT; +connection node_1; INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); @@ -148,6 +162,7 @@ INSERT INTO t1 VALUES ('node1_committed_after'); INSERT INTO t1 VALUES ('node1_committed_after'); INSERT INTO t1 VALUES ('node1_committed_after'); COMMIT; +connection node_1a_galera_st_shutdown_slave; INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); @@ -162,6 +177,7 @@ COUNT(*) = 0 1 COMMIT; SET AUTOCOMMIT=ON; +connection node_1; SELECT COUNT(*) = 35 FROM t1; COUNT(*) = 35 1 @@ -172,6 +188,7 @@ DROP TABLE t1; COMMIT; SET AUTOCOMMIT=ON; Performing State Transfer on a server that has been killed and restarted +connection node_1; CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; @@ -181,6 +198,7 @@ INSERT INTO t1 VALUES ('node1_committed_before'); INSERT INTO t1 VALUES ('node1_committed_before'); INSERT INTO t1 VALUES ('node1_committed_before'); COMMIT; +connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES ('node2_committed_before'); @@ -190,6 +208,7 @@ INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Killing server ... +connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES ('node1_committed_during'); @@ -204,6 +223,7 @@ INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); @@ -211,6 +231,7 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +connection node_2; Performing --wsrep-recover ... Starting server ... Using --wsrep-start-position when starting mysqld ... @@ -222,6 +243,7 @@ INSERT INTO t1 VALUES ('node2_committed_after'); INSERT INTO t1 VALUES ('node2_committed_after'); INSERT INTO t1 VALUES ('node2_committed_after'); COMMIT; +connection node_1; INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); @@ -236,6 +258,7 @@ INSERT INTO t1 VALUES ('node1_committed_after'); INSERT INTO t1 VALUES ('node1_committed_after'); INSERT INTO t1 VALUES ('node1_committed_after'); COMMIT; +connection node_1a_galera_st_kill_slave; INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); @@ -250,6 +273,7 @@ COUNT(*) = 0 1 COMMIT; SET AUTOCOMMIT=ON; +connection node_1; SELECT COUNT(*) = 35 FROM t1; COUNT(*) = 35 1 @@ -261,6 +285,7 @@ COMMIT; SET AUTOCOMMIT=ON; Performing State Transfer on a server that has been killed and restarted while a DDL was in progress on it +connection node_1; CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; @@ -269,6 +294,7 @@ INSERT INTO t1 VALUES ('node1_committed_before'); INSERT INTO t1 VALUES ('node1_committed_before'); INSERT INTO t1 VALUES ('node1_committed_before'); INSERT INTO t1 VALUES ('node1_committed_before'); +connection node_2; START TRANSACTION; INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); @@ -277,9 +303,12 @@ INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; +connection node_1; ALTER TABLE t1 ADD COLUMN f2 INTEGER; +connection node_2; SET wsrep_sync_wait = 0; Killing server ... +connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 (f1) VALUES ('node1_committed_during'); @@ -294,6 +323,7 @@ INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); +connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); @@ -301,7 +331,9 @@ INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); +connection node_2; Performing --wsrep-recover ... +connection node_2; Starting server ... Using --wsrep-start-position when starting mysqld ... SET AUTOCOMMIT=OFF; @@ -312,6 +344,7 @@ INSERT INTO t1 (f1) VALUES ('node2_committed_after'); INSERT INTO t1 (f1) VALUES ('node2_committed_after'); INSERT INTO t1 (f1) VALUES ('node2_committed_after'); COMMIT; +connection node_1; INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); @@ -326,6 +359,7 @@ INSERT INTO t1 (f1) VALUES ('node1_committed_after'); INSERT INTO t1 (f1) VALUES ('node1_committed_after'); INSERT INTO t1 (f1) VALUES ('node1_committed_after'); COMMIT; +connection node_1a_galera_st_kill_slave_ddl; INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); @@ -343,6 +377,7 @@ COUNT(*) = 0 1 COMMIT; SET AUTOCOMMIT=ON; +connection node_1; SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; COUNT(*) = 2 1 diff --git a/mysql-test/suite/galera/r/galera_kill_ddl.result b/mysql-test/suite/galera/r/galera_kill_ddl.result index 9b15aaeb0af..aac316dffe3 100644 --- a/mysql-test/suite/galera/r/galera_kill_ddl.result +++ b/mysql-test/suite/galera/r/galera_kill_ddl.result @@ -11,7 +11,4 @@ SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1'; COUNT(*) = 2 1 connection node_1; -SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; -VARIABLE_VALUE = 2 -1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_kill_largechanges.result b/mysql-test/suite/galera/r/galera_kill_largechanges.result index a37056ad9b0..d04bd548949 100644 --- a/mysql-test/suite/galera/r/galera_kill_largechanges.result +++ b/mysql-test/suite/galera/r/galera_kill_largechanges.result @@ -1,14 +1,20 @@ +connection node_1; SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true'; CREATE TABLE ten (f1 INTEGER); INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); CREATE TABLE t1 (f1 VARCHAR(128)) ENGINE=InnoDB; +connection node_2; Killing server ... +connection node_1; INSERT INTO t1 SELECT REPEAT('a', 128) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6; +connection node_2; +connection node_2a; SELECT COUNT(*) = 1000000 FROM t1; COUNT(*) = 1000000 1 SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 2 1 +connection node_1; DROP TABLE t1; DROP TABLE ten; diff --git a/mysql-test/suite/galera/r/galera_many_columns.result b/mysql-test/suite/galera/r/galera_many_columns.result index 6fa574e47c2..71e58f80537 100644 --- a/mysql-test/suite/galera/r/galera_many_columns.result +++ b/mysql-test/suite/galera/r/galera_many_columns.result @@ -1,22 +1,29 @@ INSERT INTO t1 (f1) VALUES (DEFAULT); +connection node_2; SELECT f1 = 'ABC', f1017 = 'ABC' FROM t1; f1 = 'ABC' f1017 = 'ABC' 1 1 UPDATE t1 SET f1 = 'XYZ', f1017 = 'XYZ' ; +connection node_1; SELECT f1 = 'XYZ', f1017 = 'XYZ' FROM t1 WHERE f1 = 'XYZ' AND f1017 = 'XYZ'; f1 = 'XYZ' f1017 = 'XYZ' 1 1 +connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; UPDATE t1 SET f2 = 'KLM' WHERE f1 = 'XYZ' AND f1017 = 'XYZ'; +connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; UPDATE t1 SET f2 = 'CDE' WHERE f1 = 'XYZ' AND f1017 = 'XYZ'; COMMIT; +connection node_1; COMMIT; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ROLLBACK; +connection node_2; ROLLBACK; +connection node_1; START TRANSACTION; INSERT INTO t1 (f1, f1017) VALUES ('BCE','BCE'); INSERT INTO t1 (f1, f1017) VALUES ('CED','CED'); @@ -26,6 +33,7 @@ ROLLBACK; SELECT COUNT(*) = 1 FROM t1; COUNT(*) = 1 1 +connection node_2; SELECT COUNT(*) = 1 FROM t1; COUNT(*) = 1 1 diff --git a/mysql-test/suite/galera/r/galera_many_rows.result b/mysql-test/suite/galera/r/galera_many_rows.result index a34367d6e46..ab43b961458 100644 --- a/mysql-test/suite/galera/r/galera_many_rows.result +++ b/mysql-test/suite/galera/r/galera_many_rows.result @@ -1,9 +1,11 @@ +connection node_1; SET SESSION innodb_lock_wait_timeout=600; SET SESSION lock_wait_timeout=600; CREATE TABLE ten (f1 INTEGER); INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB; INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; +connection node_2; SET SESSION wsrep_sync_wait = 0; SET SESSION wsrep_sync_wait = 7; SET GLOBAL wsrep_provider_options = 'repl.causal_read_timeout=PT1H'; @@ -11,21 +13,27 @@ SELECT COUNT(*) = 100000 FROM t1; COUNT(*) = 100000 1 INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; +connection node_1; SELECT COUNT(*) = 200000 FROM t1; COUNT(*) = 200000 1 UPDATE t1 SET f2 = 1; +connection node_2; SELECT COUNT(*) = 200000 FROM t1 WHERE f2 = 1; COUNT(*) = 200000 1 +connection node_1; START TRANSACTION; SELECT COUNT(*) = 200000 FROM t1; COUNT(*) = 200000 1 UPDATE t1 SET f2 = 3; +connection node_2; START TRANSACTION; UPDATE t1 SET f2 = 4; +connection node_1; COMMIT; +connection node_2; COMMIT; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_many_tables_nopk.result b/mysql-test/suite/galera/r/galera_many_tables_nopk.result index 283905979ec..3e30b333250 100644 --- a/mysql-test/suite/galera/r/galera_many_tables_nopk.result +++ b/mysql-test/suite/galera/r/galera_many_tables_nopk.result @@ -1,16 +1,22 @@ +connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; COMMIT; +connection node_2; CREATE TABLE sum_table (f1 INTEGER); SELECT SUM(f1) = 900 FROM sum_table; SUM(f1) = 900 1 +connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; +connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; UPDATE t900 SET f1 = 3; +connection node_1; COMMIT; +connection node_2; COMMIT; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction DROP SCHEMA test; diff --git a/mysql-test/suite/galera/r/galera_many_tables_pk.result b/mysql-test/suite/galera/r/galera_many_tables_pk.result index d0aa1694e85..38cf19a8d8f 100644 --- a/mysql-test/suite/galera/r/galera_many_tables_pk.result +++ b/mysql-test/suite/galera/r/galera_many_tables_pk.result @@ -1,19 +1,27 @@ +connection node_1; +connection node_2; SELECT COUNT(*) = 900 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME LIKE 't%'; COUNT(*) = 900 1 +connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; COMMIT; +connection node_2; CREATE TABLE sum_table (f1 INTEGER); SELECT SUM(f1) = 900 FROM sum_table; SUM(f1) = 900 1 +connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; +connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; UPDATE t900 SET f1 = 3; +connection node_1; COMMIT; +connection node_2; COMMIT; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction DROP SCHEMA test; diff --git a/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result b/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result index 1f163f4366c..336f46fcd7e 100644 --- a/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result +++ b/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result @@ -1,10 +1,18 @@ +connection node_1; CREATE TABLE ten (f1 INTEGER); INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB; +connection node_2; SET GLOBAL wsrep_slave_threads = 4; +connection node_1; INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;; +connection node_1a; INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;; +connection node_2; INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;; +connection node_1; +connection node_1a; +connection node_2; SELECT COUNT(*) = 30000 FROM t1; COUNT(*) = 30000 1 @@ -14,5 +22,6 @@ COUNT(DISTINCT f1) = 30000 SELECT COUNT(*) = 5 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user'; COUNT(*) = 5 1 +connection default; DROP TABLE t1; DROP TABLE ten; diff --git a/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result b/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result index 05ce328228a..c8c07221cb1 100644 --- a/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result +++ b/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result @@ -1,7 +1,11 @@ +connection node_1; CREATE TABLE ten (f1 INTEGER); INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB; +connection node_2; SET GLOBAL wsrep_slave_threads = 4; +connection node_1; +connection node_2; SELECT COUNT(*) = 20000 FROM t1; COUNT(*) = 20000 1 @@ -11,5 +15,6 @@ COUNT(DISTINCT f1) = 20000 SELECT COUNT(*) = 4 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'committed%'; COUNT(*) = 4 1 +connection default; DROP TABLE t1; DROP TABLE ten; diff --git a/mysql-test/suite/galera/r/galera_pc_ignore_sb.result b/mysql-test/suite/galera/r/galera_pc_ignore_sb.result index e02ec0a3179..ee79d3c1f00 100644 --- a/mysql-test/suite/galera/r/galera_pc_ignore_sb.result +++ b/mysql-test/suite/galera/r/galera_pc_ignore_sb.result @@ -16,3 +16,5 @@ VARIABLE_VALUE = 'ON' 1 SET GLOBAL wsrep_cluster_address = ''; connection node_2; +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera/r/galera_restart_nochanges.result b/mysql-test/suite/galera/r/galera_restart_nochanges.result index 380a4812da1..b35ae50e2fb 100644 --- a/mysql-test/suite/galera/r/galera_restart_nochanges.result +++ b/mysql-test/suite/galera/r/galera_restart_nochanges.result @@ -4,6 +4,7 @@ connection node_1; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); connection node_2; +connection node_1; connection node_2a; SELECT COUNT(*) = 1 FROM t1; COUNT(*) = 1 @@ -12,3 +13,5 @@ SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_N VARIABLE_VALUE = 2 1 DROP TABLE t1; +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera/r/galera_roles.result b/mysql-test/suite/galera/r/galera_roles.result index f07cd81c03f..bef89acfc92 100644 --- a/mysql-test/suite/galera/r/galera_roles.result +++ b/mysql-test/suite/galera/r/galera_roles.result @@ -171,6 +171,7 @@ DROP DATABASE test1; # # On node_1 +connection node_1; CREATE USER foo@localhost; CREATE ROLE role1; CREATE ROLE role2 WITH ADMIN CURRENT_USER; @@ -189,6 +190,7 @@ root@localhost role1 YES NO root@localhost role2 YES NO # On node_2 +connection node_2; SELECT * FROM mysql.roles_mapping; Host User Role Admin_option role1 role4 Y diff --git a/mysql-test/suite/galera/r/galera_rsu_add_pk.result b/mysql-test/suite/galera/r/galera_rsu_add_pk.result index 3fd24af9ad7..4c79da154e2 100644 --- a/mysql-test/suite/galera/r/galera_rsu_add_pk.result +++ b/mysql-test/suite/galera/r/galera_rsu_add_pk.result @@ -1,8 +1,10 @@ +connection node_1; CREATE TABLE ten (f1 INTEGER); INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; INSERT INTO t1 (f1) SELECT 100000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;; +connection node_2; SET SESSION wsrep_OSU_method = "RSU"; ALTER TABLE t1 ADD PRIMARY KEY (f1); SET SESSION wsrep_OSU_method = "TOI"; @@ -13,6 +15,7 @@ COUNT(*) = 300000 SELECT MAX(f1) = 299999 FROM t1; MAX(f1) = 299999 1 +connection node_1; SELECT COUNT(*) = 300000 FROM t1; COUNT(*) = 300000 1 diff --git a/mysql-test/suite/galera/r/galera_rsu_drop_pk.result b/mysql-test/suite/galera/r/galera_rsu_drop_pk.result index 039fb68d244..f64649ef4e2 100644 --- a/mysql-test/suite/galera/r/galera_rsu_drop_pk.result +++ b/mysql-test/suite/galera/r/galera_rsu_drop_pk.result @@ -1,8 +1,10 @@ +connection node_1; CREATE TABLE ten (f1 INTEGER); INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; INSERT INTO t1 (f1) SELECT 100000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;; +connection node_2; SET SESSION wsrep_OSU_method = "RSU"; ALTER TABLE t1 DROP PRIMARY KEY; SET SESSION wsrep_OSU_method = "TOI"; @@ -13,6 +15,7 @@ COUNT(*) = 300000 SELECT MAX(f1) = 299999 FROM t1; MAX(f1) = 299999 1 +connection node_1; SELECT COUNT(*) = 300000 FROM t1; COUNT(*) = 300000 1 @@ -22,8 +25,10 @@ MAX(f1) = 299999 SET SESSION wsrep_OSU_method = "RSU"; ALTER TABLE t1 DROP PRIMARY KEY; SET SESSION wsrep_OSU_method = "TOI"; +connection node_2; INSERT INTO t1 (f1) VALUES (1); INSERT INTO t1 (f1) VALUES (10); +connection node_1; SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 1; COUNT(*) = 2 1 @@ -32,6 +37,7 @@ COUNT(*) = 2 1 INSERT INTO t1 (f1) VALUES (100); INSERT INTO t1 (f1) VALUES (1000); +connection node_2; SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 100; COUNT(*) = 2 1 diff --git a/mysql-test/suite/galera/r/galera_rsu_wsrep_desync.result b/mysql-test/suite/galera/r/galera_rsu_wsrep_desync.result index aa0d20a3466..a103e810588 100644 --- a/mysql-test/suite/galera/r/galera_rsu_wsrep_desync.result +++ b/mysql-test/suite/galera/r/galera_rsu_wsrep_desync.result @@ -5,6 +5,7 @@ SET wsrep_OSU_method=RSU; SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue'; ALTER TABLE t1 ADD COLUMN f2 INTEGER;; connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1; connection node_1a; SET GLOBAL wsrep_desync=0; SET DEBUG_SYNC= 'now SIGNAL continue'; @@ -31,9 +32,11 @@ SET DEBUG_SYNC = 'alter_table_before_create_table_no_lock WAIT_FOR continue'; ALTER TABLE t1 ADD COLUMN f2 INTEGER;; connection node_1a; SET GLOBAL wsrep_desync=1;; +connection node_1b; SET DEBUG_SYNC= 'now SIGNAL continue'; -SET GLOBAL wsrep_desync=0; connection node_1; +connection node_1a; +SET GLOBAL wsrep_desync=0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/galera/r/galera_split_brain.result b/mysql-test/suite/galera/r/galera_split_brain.result index 9c5952cfa28..1f9b67eeff3 100644 --- a/mysql-test/suite/galera/r/galera_split_brain.result +++ b/mysql-test/suite/galera/r/galera_split_brain.result @@ -1,11 +1,13 @@ -call mtr.add_suppression("WSREP: TO isolation failed for: "); -connection node_1; connection node_1; connection node_2; +call mtr.add_suppression("WSREP: TO isolation failed for: "); +connection node_1; connection node_2; Killing server ... connection node_1; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -SET GLOBAL wsrep_cluster_address = ''; +connection node_2; connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera/r/galera_sst_rsync.result b/mysql-test/suite/galera/r/galera_sst_rsync.result index df2d9190a4b..b16a496554b 100644 --- a/mysql-test/suite/galera/r/galera_sst_rsync.result +++ b/mysql-test/suite/galera/r/galera_sst_rsync.result @@ -1,4 +1,5 @@ Performing State Transfer on a server that has been shut down cleanly and restarted +connection node_1; CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; @@ -8,6 +9,7 @@ INSERT INTO t1 VALUES ('node1_committed_before'); INSERT INTO t1 VALUES ('node1_committed_before'); INSERT INTO t1 VALUES ('node1_committed_before'); COMMIT; +connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES ('node2_committed_before'); @@ -17,6 +19,7 @@ INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Shutting down server ... +connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES ('node1_committed_during'); @@ -31,6 +34,7 @@ INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); @@ -38,6 +42,7 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +connection node_2; Starting server ... SET AUTOCOMMIT=OFF; START TRANSACTION; @@ -47,6 +52,7 @@ INSERT INTO t1 VALUES ('node2_committed_after'); INSERT INTO t1 VALUES ('node2_committed_after'); INSERT INTO t1 VALUES ('node2_committed_after'); COMMIT; +connection node_1; INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); @@ -61,6 +67,7 @@ INSERT INTO t1 VALUES ('node1_committed_after'); INSERT INTO t1 VALUES ('node1_committed_after'); INSERT INTO t1 VALUES ('node1_committed_after'); COMMIT; +connection node_1a_galera_st_shutdown_slave; INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); @@ -75,6 +82,7 @@ COUNT(*) = 0 1 COMMIT; SET AUTOCOMMIT=ON; +connection node_1; SELECT COUNT(*) = 35 FROM t1; COUNT(*) = 35 1 @@ -86,6 +94,7 @@ COMMIT; SET AUTOCOMMIT=ON; Performing State Transfer on a server that starts from a clean var directory This is accomplished by shutting down node #2 and removing its var directory before restarting it +connection node_1; CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; @@ -95,6 +104,7 @@ INSERT INTO t1 VALUES ('node1_committed_before'); INSERT INTO t1 VALUES ('node1_committed_before'); INSERT INTO t1 VALUES ('node1_committed_before'); COMMIT; +connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES ('node2_committed_before'); @@ -104,6 +114,7 @@ INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Shutting down server ... +connection node_1; Cleaning var directory ... SET AUTOCOMMIT=OFF; START TRANSACTION; @@ -119,6 +130,7 @@ INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); @@ -126,6 +138,7 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +connection node_2; Starting server ... SET AUTOCOMMIT=OFF; START TRANSACTION; @@ -135,6 +148,7 @@ INSERT INTO t1 VALUES ('node2_committed_after'); INSERT INTO t1 VALUES ('node2_committed_after'); INSERT INTO t1 VALUES ('node2_committed_after'); COMMIT; +connection node_1; INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); @@ -149,6 +163,7 @@ INSERT INTO t1 VALUES ('node1_committed_after'); INSERT INTO t1 VALUES ('node1_committed_after'); INSERT INTO t1 VALUES ('node1_committed_after'); COMMIT; +connection node_1a_galera_st_clean_slave; INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); @@ -163,6 +178,7 @@ COUNT(*) = 0 1 COMMIT; SET AUTOCOMMIT=ON; +connection node_1; SELECT COUNT(*) = 35 FROM t1; COUNT(*) = 35 1 @@ -173,6 +189,7 @@ DROP TABLE t1; COMMIT; SET AUTOCOMMIT=ON; Performing State Transfer on a server that has been killed and restarted +connection node_1; CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; @@ -182,6 +199,7 @@ INSERT INTO t1 VALUES ('node1_committed_before'); INSERT INTO t1 VALUES ('node1_committed_before'); INSERT INTO t1 VALUES ('node1_committed_before'); COMMIT; +connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES ('node2_committed_before'); @@ -191,6 +209,7 @@ INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Killing server ... +connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES ('node1_committed_during'); @@ -205,6 +224,7 @@ INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); @@ -212,6 +232,7 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +connection node_2; Performing --wsrep-recover ... Starting server ... Using --wsrep-start-position when starting mysqld ... @@ -223,6 +244,7 @@ INSERT INTO t1 VALUES ('node2_committed_after'); INSERT INTO t1 VALUES ('node2_committed_after'); INSERT INTO t1 VALUES ('node2_committed_after'); COMMIT; +connection node_1; INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); INSERT INTO t1 VALUES ('node1_to_be_committed_after'); @@ -237,6 +259,7 @@ INSERT INTO t1 VALUES ('node1_committed_after'); INSERT INTO t1 VALUES ('node1_committed_after'); INSERT INTO t1 VALUES ('node1_committed_after'); COMMIT; +connection node_1a_galera_st_kill_slave; INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); @@ -251,6 +274,7 @@ COUNT(*) = 0 1 COMMIT; SET AUTOCOMMIT=ON; +connection node_1; SELECT COUNT(*) = 35 FROM t1; COUNT(*) = 35 1 @@ -262,6 +286,7 @@ COMMIT; SET AUTOCOMMIT=ON; Performing State Transfer on a server that has been killed and restarted while a DDL was in progress on it +connection node_1; CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; @@ -270,6 +295,7 @@ INSERT INTO t1 VALUES ('node1_committed_before'); INSERT INTO t1 VALUES ('node1_committed_before'); INSERT INTO t1 VALUES ('node1_committed_before'); INSERT INTO t1 VALUES ('node1_committed_before'); +connection node_2; START TRANSACTION; INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); @@ -278,9 +304,12 @@ INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; +connection node_1; ALTER TABLE t1 ADD COLUMN f2 INTEGER; +connection node_2; SET wsrep_sync_wait = 0; Killing server ... +connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 (f1) VALUES ('node1_committed_during'); @@ -295,6 +324,7 @@ INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); +connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); @@ -302,7 +332,9 @@ INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); +connection node_2; Performing --wsrep-recover ... +connection node_2; Starting server ... Using --wsrep-start-position when starting mysqld ... SET AUTOCOMMIT=OFF; @@ -313,6 +345,7 @@ INSERT INTO t1 (f1) VALUES ('node2_committed_after'); INSERT INTO t1 (f1) VALUES ('node2_committed_after'); INSERT INTO t1 (f1) VALUES ('node2_committed_after'); COMMIT; +connection node_1; INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); @@ -327,6 +360,7 @@ INSERT INTO t1 (f1) VALUES ('node1_committed_after'); INSERT INTO t1 (f1) VALUES ('node1_committed_after'); INSERT INTO t1 (f1) VALUES ('node1_committed_after'); COMMIT; +connection node_1a_galera_st_kill_slave_ddl; INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); @@ -344,6 +378,7 @@ COUNT(*) = 0 1 COMMIT; SET AUTOCOMMIT=ON; +connection node_1; SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; COUNT(*) = 2 1 diff --git a/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2.result b/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2.result index 750d73b615f..df2d9190a4b 100644 --- a/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2.result +++ b/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2.result @@ -277,7 +277,7 @@ INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; -SET GLOBAL debug = 'd,sync.alter_opened_table'; +SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; ALTER TABLE t1 ADD COLUMN f2 INTEGER; SET wsrep_sync_wait = 0; Killing server ... @@ -356,3 +356,4 @@ COUNT(*) = 0 DROP TABLE t1; COMMIT; SET AUTOCOMMIT=ON; +SET GLOBAL debug_dbug = $debug_orig; diff --git a/mysql-test/suite/galera/r/galera_sync_wait_show.result b/mysql-test/suite/galera/r/galera_sync_wait_show.result index 4a73a573041..4c104eb54d8 100644 --- a/mysql-test/suite/galera/r/galera_sync_wait_show.result +++ b/mysql-test/suite/galera/r/galera_sync_wait_show.result @@ -42,8 +42,8 @@ CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.f1 = 'a'; connection node_2; SHOW CREATE TRIGGER tr1; -Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -tr1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.f1 = 'a' latin1 latin1_swedish_ci latin1_swedish_ci +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +tr1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.f1 = 'a' latin1 latin1_swedish_ci latin1_swedish_ci # DROP TABLE t1; connection node_1; CREATE EVENT event1 ON SCHEDULE AT '2038-01-01 23:59:59' DO SELECT 1; diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_error.result b/mysql-test/suite/galera/r/galera_toi_ddl_error.result index 656e20bcc46..dafad153867 100644 --- a/mysql-test/suite/galera/r/galera_toi_ddl_error.result +++ b/mysql-test/suite/galera/r/galera_toi_ddl_error.result @@ -3,6 +3,7 @@ INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t1 (f1) SELECT (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; INSERT INTO t1 (f1) SELECT MAX(f1) FROM t1; +connection node_2; ALTER TABLE t1 ADD PRIMARY KEY (f1); ERROR 23000: Duplicate entry '111110' for key 'PRIMARY' SHOW CREATE TABLE t1; @@ -10,6 +11,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 +connection node_1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/galera/r/galera_transaction_replay.result b/mysql-test/suite/galera/r/galera_transaction_replay.result index e932e4aed02..7fd837433d2 100644 --- a/mysql-test/suite/galera/r/galera_transaction_replay.result +++ b/mysql-test/suite/galera/r/galera_transaction_replay.result @@ -39,6 +39,7 @@ SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c'; COUNT(*) = 1 1 DROP TABLE t1; +connection node_1; CREATE TABLE t1 (i int primary key, j int) ENGINE=INNODB; INSERT INTO t1 VALUES (1, 0), (3, 0); SELECT * FROM t1; @@ -46,23 +47,32 @@ i j 1 0 3 0 PREPARE stmt1 FROM "UPDATE t1 SET j = 1 where i > 0"; +connection node_1a; SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_enter_sync'; +connection node_1; EXECUTE stmt1;; +connection node_1a; SET SESSION wsrep_sync_wait = 0; SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 1; +connection node_2; INSERT INTO t1 VALUES(2,2); +connection node_1a; +connection node_1a; SET GLOBAL wsrep_provider_options = 'dbug='; SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_enter_sync'; +connection node_1; SELECT * FROM t1; i j 1 1 2 2 3 1 +connection node_2; SELECT * FROM t1; i j 1 1 2 2 3 1 +connection node_1; DEALLOCATE PREPARE stmt1; DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_var_cluster_address.result b/mysql-test/suite/galera/r/galera_var_cluster_address.result index 09971c08580..ef75cf21a79 100644 --- a/mysql-test/suite/galera/r/galera_var_cluster_address.result +++ b/mysql-test/suite/galera/r/galera_var_cluster_address.result @@ -1,9 +1,9 @@ connection node_1; connection node_2; -connection node_1; +connection node_2; SET GLOBAL wsrep_cluster_address = 'foo://'; SET SESSION wsrep_sync_wait=0; -SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS; +SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS; ERROR 08S01: WSREP has not yet prepared node for application use SHOW STATUS LIKE 'wsrep_ready'; Variable_name Value @@ -17,16 +17,14 @@ wsrep_local_state 0 SHOW STATUS LIKE 'wsrep_local_state_comment'; Variable_name Value wsrep_local_state_comment Initialized -connection node_2; +connection node_1; SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 1 1 SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; VARIABLE_VALUE = 'Primary' 1 -connection node_1; connection node_2; -SET GLOBAL wsrep_cluster_address = @@wsrep_cluster_address; connection node_1; SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; VARIABLE_VALUE = 'Primary' @@ -34,29 +32,16 @@ VARIABLE_VALUE = 'Primary' SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 2 1 -connection node_1; -SET GLOBAL wsrep_cluster_address = 'gcomm://192.0.2.1'; -SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS; -ERROR 08S01: WSREP has not yet prepared node for application use -SHOW STATUS LIKE 'wsrep_ready'; -Variable_name Value -wsrep_ready OFF -SHOW STATUS LIKE 'wsrep_cluster_status'; -Variable_name Value -wsrep_cluster_status non-Primary -SHOW STATUS LIKE 'wsrep_local_state'; -Variable_name Value -wsrep_local_state 0 -SHOW STATUS LIKE 'wsrep_local_state_comment'; -Variable_name Value -wsrep_local_state_comment Initialized -connection node_1; connection node_2; -SET GLOBAL wsrep_cluster_address = @@wsrep_cluster_address; -connection node_1; -SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; -VARIABLE_VALUE = 'Primary' -1 -SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; -VARIABLE_VALUE = 2 -1 +CALL mtr.add_suppression("Backend not supported: foo"); +CALL mtr.add_suppression("Failed to initialize backend using 'foo"); +CALL mtr.add_suppression("Failed to open channel 'my_wsrep_cluster' at 'foo"); +CALL mtr.add_suppression("gcs connect failed: Socket type not supported"); +CALL mtr.add_suppression("wsrep::connect\\(\\) failed: 7"); +CALL mtr.add_suppression("gcs_caused\\(\\) returned -103 \\(Software caused connection abort\\)"); +CALL mtr.add_suppression("failed to open gcomm backend connection: 110: failed to reach primary view: 110"); +CALL mtr.add_suppression("Failed to open backend connection: -110 \\(Connection timed out\\)"); +CALL mtr.add_suppression("gcs connect failed: Connection timed out"); +CALL mtr.add_suppression("WSREP: wsrep::connect\\(foo://\\) failed: 7"); +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera/r/galera_var_desync_on.result b/mysql-test/suite/galera/r/galera_var_desync_on.result index 54c30370c4a..a26acbd4d6b 100644 --- a/mysql-test/suite/galera/r/galera_var_desync_on.result +++ b/mysql-test/suite/galera/r/galera_var_desync_on.result @@ -33,4 +33,5 @@ COUNT(*) = 11 1 CALL mtr.add_suppression("Protocol violation"); DROP TABLE t1; +connection node_1; CALL mtr.add_suppression("Protocol violation"); diff --git a/mysql-test/suite/galera/r/galera_var_dirty_reads.result b/mysql-test/suite/galera/r/galera_var_dirty_reads.result index 6b3a3ec0eb5..118e2ca3019 100644 --- a/mysql-test/suite/galera/r/galera_var_dirty_reads.result +++ b/mysql-test/suite/galera/r/galera_var_dirty_reads.result @@ -1,9 +1,15 @@ +connection node_1; +connection node_2; connection node_2; CREATE TABLE t1(i INT) ENGINE=INNODB; INSERT INTO t1 VALUES(1); SELECT * FROM t1; i 1 +create user user1; +grant all privileges on *.* to user1; +create user user2; +grant all privileges on *.* to user2; SET @@global.wsrep_cluster_address = ''; SET @@session.wsrep_dirty_reads=OFF; SET SESSION wsrep_sync_wait=0; @@ -19,11 +25,74 @@ SET @@session.wsrep_dirty_reads=ON; SELECT * FROM t1; i 1 +connect con1, localhost, user1,,test,$NODE_MYPORT_2,$NODE_MYSOCK_2; +SET SESSION wsrep_sync_wait=0; +set session wsrep_dirty_reads=1; +prepare stmt_show from 'select 1'; +prepare stmt_select from 'select * from t1'; +prepare stmt_insert from 'insert into t1 values(1)'; +set session wsrep_dirty_reads=0; +execute stmt_show; +ERROR 08S01: WSREP has not yet prepared node for application use +execute stmt_select; +ERROR 08S01: WSREP has not yet prepared node for application use +execute stmt_insert; +ERROR 08S01: WSREP has not yet prepared node for application use +SET wsrep_dirty_reads=ON; +select @@session.wsrep_dirty_reads; +@@session.wsrep_dirty_reads +1 +execute stmt_show; +1 +1 +execute stmt_select; +i +1 +execute stmt_insert; +ERROR 08S01: WSREP has not yet prepared node for application use +SET @@global.wsrep_dirty_reads=ON; +connect con2, localhost, user2,,test,$NODE_MYPORT_2,$NODE_MYSOCK_2; +select @@session.wsrep_dirty_reads; +@@session.wsrep_dirty_reads +1 +prepare stmt_show from 'select 1'; +prepare stmt_select from 'select * from t1'; +prepare stmt_insert from 'insert into t1 values(1)'; +execute stmt_show; +1 +1 +execute stmt_select; +i +1 +execute stmt_insert; +ERROR 08S01: WSREP has not yet prepared node for application use +SET SESSION wsrep_sync_wait=1; +execute stmt_show; +1 +1 +execute stmt_select; +i +1 +execute stmt_insert; +ERROR 08S01: WSREP has not yet prepared node for application use +SET SESSION wsrep_sync_wait=7; +execute stmt_show; +1 +1 +execute stmt_select; +i +1 +execute stmt_insert; +ERROR 08S01: WSREP has not yet prepared node for application use +connection node_2; +SET @@global.wsrep_dirty_reads=OFF; connection node_1; SELECT * FROM t1; i 1 DROP TABLE t1; +drop user user1; +drop user user2; disconnect node_2; disconnect node_1; # End of test diff --git a/mysql-test/suite/galera/r/galera_var_load_data_splitting.result b/mysql-test/suite/galera/r/galera_var_load_data_splitting.result index db145fd1561..3e451abbed1 100644 --- a/mysql-test/suite/galera/r/galera_var_load_data_splitting.result +++ b/mysql-test/suite/galera/r/galera_var_load_data_splitting.result @@ -1,9 +1,12 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +connection node_2; SET GLOBAL wsrep_load_data_splitting = TRUE; +connection node_2; SELECT COUNT(*) = 95000 FROM t1; COUNT(*) = 95000 1 wsrep_last_committed_diff 1 +connection node_1; SET GLOBAL wsrep_load_data_splitting = 1;; DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result b/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result index bf5a09f6a77..87f8862df7e 100644 --- a/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result +++ b/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result @@ -94,6 +94,16 @@ connection node_1; COMMIT; DROP TABLE t1; DROP TABLE t2; +# +# MDEV-11152: wsrep_replicate_myisam: SELECT gets replicated using TO +# +connection node_1; +CREATE TABLE t1 (i INT) ENGINE=INNODB; +INSERT INTO t1 VALUES(1); +SELECT * FROM t1; +i +1 +DROP TABLE t1; connection node_1; SET GLOBAL wsrep_replicate_myisam = 0; connection node_2; diff --git a/mysql-test/suite/galera/r/galera_wan_restart_ist.result b/mysql-test/suite/galera/r/galera_wan_restart_ist.result index e58bff34e54..8a2a7d0818e 100644 --- a/mysql-test/suite/galera/r/galera_wan_restart_ist.result +++ b/mysql-test/suite/galera/r/galera_wan_restart_ist.result @@ -1,53 +1,88 @@ +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4; +connection node_1; +connection node_2; +connection node_3; +connection node_4; SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 4 1 +connection node_1; CREATE TABLE t1 (f1 INTEGER); INSERT INTO t1 VALUES (1); +connection node_2; INSERT INTO t1 VALUES (2); +connection node_3; INSERT INTO t1 VALUES (3); +connection node_4; INSERT INTO t1 VALUES (4); +connection node_3; INSERT INTO t1 VALUES (13); Shutting down server ... +connection node_1; INSERT INTO t1 VALUES (11); +connection node_2; INSERT INTO t1 VALUES (12); +connection node_4; INSERT INTO t1 VALUES (14); +connection node_3; INSERT INTO t1 VALUES (131); +connection node_2; INSERT INTO t1 VALUES (22); Shutting down server ... +connection node_1; INSERT INTO t1 VALUES (21); +connection node_3; INSERT INTO t1 VALUES (23); +connection node_4; INSERT INTO t1 VALUES (24); +connection node_2; INSERT INTO t1 VALUES (221); +connection node_4; INSERT INTO t1 VALUES (34); Shutting down server ... +connection node_1; INSERT INTO t1 VALUES (31); +connection node_2; INSERT INTO t1 VALUES (32); +connection node_3; INSERT INTO t1 VALUES (33); +connection node_4; INSERT INTO t1 VALUES (341); +connection node_1; SELECT COUNT(*) = 19 FROM t1; COUNT(*) = 19 1 +connection node_2; SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 4 1 SELECT COUNT(*) = 19 FROM t1; COUNT(*) = 19 1 +connection node_3; SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 4 1 SELECT COUNT(*) = 19 FROM t1; COUNT(*) = 19 1 +connection node_4; SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 4 1 SELECT COUNT(*) = 19 FROM t1; COUNT(*) = 19 1 +connection node_1; DROP TABLE t1; CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); +connection node_2; CALL mtr.add_suppression("Action message in non-primary configuration from member 0"); +connection node_3; CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); CALL mtr.add_suppression("Action message in non-primary configuration from member 0"); +connection node_4; CALL mtr.add_suppression("Action message in non-primary configuration from member 0"); +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera/r/galera_wan_restart_sst.result b/mysql-test/suite/galera/r/galera_wan_restart_sst.result index 15de0fab342..71786cdd023 100644 --- a/mysql-test/suite/galera/r/galera_wan_restart_sst.result +++ b/mysql-test/suite/galera/r/galera_wan_restart_sst.result @@ -1,54 +1,83 @@ SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 4 1 +connection node_1; CREATE TABLE t1 (f1 INTEGER); INSERT INTO t1 VALUES (1); +connection node_2; INSERT INTO t1 VALUES (2); +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_3; INSERT INTO t1 VALUES (3); +connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4; +connection node_4; INSERT INTO t1 VALUES (4); +connection node_3; INSERT INTO t1 VALUES (13); Killing server ... +connection node_1; INSERT INTO t1 VALUES (11); +connection node_2; INSERT INTO t1 VALUES (12); +connection node_4; INSERT INTO t1 VALUES (14); +connection node_3; INSERT INTO t1 VALUES (131); +connection node_2; INSERT INTO t1 VALUES (22); Killing server ... +connection node_1; INSERT INTO t1 VALUES (21); +connection node_3; INSERT INTO t1 VALUES (23); +connection node_4; INSERT INTO t1 VALUES (24); +connection node_2; INSERT INTO t1 VALUES (221); +connection node_4; INSERT INTO t1 VALUES (34); Killing server ... +connection node_1; INSERT INTO t1 VALUES (31); +connection node_2; INSERT INTO t1 VALUES (32); +connection node_3; INSERT INTO t1 VALUES (33); +connection node_4; INSERT INTO t1 VALUES (341); +connection node_1; SELECT COUNT(*) = 19 FROM t1; COUNT(*) = 19 1 +connection node_2; SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 4 1 SELECT COUNT(*) = 19 FROM t1; COUNT(*) = 19 1 +connection node_3; SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 4 1 SELECT COUNT(*) = 19 FROM t1; COUNT(*) = 19 1 +connection node_4; SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 4 1 SELECT COUNT(*) = 19 FROM t1; COUNT(*) = 19 1 +connection node_1; DROP TABLE t1; CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); CALL mtr.add_suppression("WSREP: gcs_caused\\(\\) returned -1 \\(Operation not permitted\\)"); +connection node_2; CALL mtr.add_suppression("Action message in non-primary configuration from member 0"); +connection node_3; CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); CALL mtr.add_suppression("Action message in non-primary configuration from member 0"); +connection node_4; CALL mtr.add_suppression("Action message in non-primary configuration from member 0"); diff --git a/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result b/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result index 06fc27ae7ed..5324d1c11dd 100644 --- a/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result +++ b/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result @@ -1,7 +1,9 @@ +connection node_1; CREATE TABLE ten (f1 INTEGER); INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; +connection node_2; SET GLOBAL wsrep_desync = TRUE; SET SESSION wsrep_on = FALSE; ALTER TABLE t1 ADD PRIMARY KEY (f1); @@ -14,6 +16,7 @@ COUNT(*) = 200000 SELECT MAX(f1) = 199999 FROM t1; MAX(f1) = 199999 1 +connection node_1; SELECT COUNT(*) = 200000 FROM t1; COUNT(*) = 200000 1 @@ -25,8 +28,10 @@ SET SESSION wsrep_on = FALSE; ALTER TABLE t1 ADD PRIMARY KEY (f1); SET SESSION wsrep_on = TRUE; SET GLOBAL wsrep_desync = FALSE; +connection node_2; INSERT INTO t1 (f1) VALUES (1); ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +connection node_1; INSERT INTO t1 (f1) VALUES (100); ERROR 23000: Duplicate entry '100' for key 'PRIMARY' DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/mdev_10518.result b/mysql-test/suite/galera/r/mdev_10518.result index b2a3e0a65ef..4ccd5fd1d23 100644 --- a/mysql-test/suite/galera/r/mdev_10518.result +++ b/mysql-test/suite/galera/r/mdev_10518.result @@ -1,4 +1,5 @@ # On node_1 +connection node_1; list of GTID variables : gtid_domain_id 1 gtid_binlog_pos @@ -8,6 +9,7 @@ gtid_slave_pos wsrep_gtid_domain_id 4294967295 wsrep_gtid_mode 1 # On node_2 +connection node_2; list of GTID variables : gtid_domain_id 2 gtid_binlog_pos @@ -17,6 +19,7 @@ gtid_slave_pos wsrep_gtid_domain_id 4294967295 wsrep_gtid_mode 1 # On node_1 +connection node_1; CREATE TABLE t1(i INT) ENGINE=INNODB; CREATE TABLE t2(i INT) ENGINE=MEMORY; INSERT INTO t1 VALUES(1); @@ -34,6 +37,7 @@ gtid_slave_pos wsrep_gtid_domain_id 4294967295 wsrep_gtid_mode 1 # On node_2 +connection node_2; SELECT * FROM t1; i 1 @@ -46,6 +50,7 @@ gtid_slave_pos wsrep_gtid_domain_id 4294967295 wsrep_gtid_mode 1 # On node_1 +connection node_1; INSERT INTO t2 VALUES(1); SELECT * FROM t2; i @@ -59,6 +64,7 @@ gtid_slave_pos wsrep_gtid_domain_id 4294967295 wsrep_gtid_mode 1 # On node_2 +connection node_2; SELECT * FROM t2; i list of GTID variables : @@ -70,5 +76,8 @@ gtid_slave_pos wsrep_gtid_domain_id 4294967295 wsrep_gtid_mode 1 # On node_1 +connection node_1; DROP TABLE t1, t2; +disconnect node_2; +disconnect node_1; # End of test diff --git a/mysql-test/suite/galera/r/mysql-wsrep#31.result b/mysql-test/suite/galera/r/mysql-wsrep#31.result index 973f11543fa..1092f4ddb0c 100644 --- a/mysql-test/suite/galera/r/mysql-wsrep#31.result +++ b/mysql-test/suite/galera/r/mysql-wsrep#31.result @@ -1,4 +1,6 @@ connection node_1; +connection node_2; +connection node_1; CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; INSERT INTO t1 VALUES('test'); CREATE DATABASE db; @@ -11,3 +13,6 @@ Using --wsrep-start-position when starting mysqld ... connection node_1; DROP TABLE t1; DROP DATABASE db; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera/r/partition.result b/mysql-test/suite/galera/r/partition.result index 15f0275a04c..824572065c1 100644 --- a/mysql-test/suite/galera/r/partition.result +++ b/mysql-test/suite/galera/r/partition.result @@ -56,10 +56,10 @@ t1 CREATE TABLE `t1` ( `i` int(10) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`i`) ) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (i) + PARTITION BY RANGE (i) (PARTITION p1 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION p2 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SHOW CREATE TABLE p1; Table Create Table p1 CREATE TABLE `p1` ( @@ -93,9 +93,9 @@ t1 CREATE TABLE `t1` ( `i` int(10) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`i`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (i) + PARTITION BY RANGE (i) (PARTITION p1 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) # On node_2 connection node_2; @@ -105,9 +105,9 @@ t1 CREATE TABLE `t1` ( `i` int(10) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`i`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (i) + PARTITION BY RANGE (i) (PARTITION p1 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) DROP TABLE t1, p1; # # MDEV-5146: Bulk loads into partitioned table not working diff --git a/mysql-test/suite/galera/t/enforce_storage_engine2.opt b/mysql-test/suite/galera/t/enforce_storage_engine2.opt new file mode 100644 index 00000000000..03f7dc5e527 --- /dev/null +++ b/mysql-test/suite/galera/t/enforce_storage_engine2.opt @@ -0,0 +1,2 @@ +--enforce_storage_engine=innodb --sql_mode='' + diff --git a/mysql-test/suite/galera/t/enforce_storage_engine2.test b/mysql-test/suite/galera/t/enforce_storage_engine2.test new file mode 100644 index 00000000000..7a822bced59 --- /dev/null +++ b/mysql-test/suite/galera/t/enforce_storage_engine2.test @@ -0,0 +1,20 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--echo # +--echo # MDEV-9312: storage engine not enforced during galera cluster +--echo # replication +--echo # +--connection node_1 +CREATE TABLE t1(i INT) ENGINE=INNODB; +CREATE TABLE t2(i INT) ENGINE=MYISAM; + +--connection node_2 +SHOW TABLES; +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t2; + +# Cleanup +DROP TABLE t1, t2; + +--echo # End of tests diff --git a/mysql-test/suite/galera/t/galera#414.test b/mysql-test/suite/galera/t/galera#414.test index b426e6510b6..0ee6dcac700 100644 --- a/mysql-test/suite/galera/t/galera#414.test +++ b/mysql-test/suite/galera/t/galera#414.test @@ -3,6 +3,7 @@ # --source include/big_test.inc +--source include/have_innodb.inc --source include/galera_cluster.inc # We perform the shutdown/restart sequence in here. If there was a crash during shutdown, MTR will detect it diff --git a/mysql-test/suite/galera/t/galera_binlog_checksum.test b/mysql-test/suite/galera/t/galera_binlog_checksum.test index 48669305242..09d7a02f312 100644 --- a/mysql-test/suite/galera/t/galera_binlog_checksum.test +++ b/mysql-test/suite/galera/t/galera_binlog_checksum.test @@ -20,3 +20,24 @@ UPDATE t1 SET f1 = 2 WHERE f1 = 1; SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; DROP TABLE t1; + +--echo # +--echo # MDEV-11149: wsrep_replicate_mysaim: DML fails when binlog checksum +--echo # enabled +--echo # + +--connection node_1 +let $wsrep_replicate_myisam_saved= `SELECT @@wsrep_replicate_myisam`; +SET @@global.wsrep_replicate_myisam=1; + +CREATE TABLE t1 (i INT) ENGINE=MYISAM; +INSERT INTO t1 VALUES(1); + +--connection node_2 +SELECT * FROM t1; + +--connection node_1 +DROP TABLE t1; +eval SET @@global.wsrep_replicate_myisam=$wsrep_replicate_myisam_saved; + +--echo # End of tests. diff --git a/mysql-test/suite/galera/t/galera_forced_binlog_format.test b/mysql-test/suite/galera/t/galera_forced_binlog_format.test index 982276cc317..364f41529a4 100644 --- a/mysql-test/suite/galera/t/galera_forced_binlog_format.test +++ b/mysql-test/suite/galera/t/galera_forced_binlog_format.test @@ -20,7 +20,7 @@ INSERT INTO t1 VALUES (2); --replace_regex /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/ --replace_column 2 5 -SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 249; +SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 256; DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_split_brain.test b/mysql-test/suite/galera/t/galera_split_brain.test index 22f6370241c..a85a2ad9b8d 100644 --- a/mysql-test/suite/galera/t/galera_split_brain.test +++ b/mysql-test/suite/galera/t/galera_split_brain.test @@ -25,11 +25,8 @@ CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; # Reset the master and restart the slave so that post-test checks can run -SET GLOBAL wsrep_cluster_address = ''; ---disable_query_log ---eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig'; ---enable_query_log +--connection node_2 --source include/start_mysqld.inc --sleep 5 --source include/wait_until_connected_again.inc diff --git a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.test b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.test index c6823795e59..aac6822170a 100644 --- a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.test +++ b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.test @@ -2,8 +2,18 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + --source suite/galera/include/galera_st_shutdown_slave.inc --source suite/galera/include/galera_st_clean_slave.inc --source suite/galera/include/galera_st_kill_slave.inc --source suite/galera/include/galera_st_kill_slave_ddl.inc + +# Restore original auto_increment_offset values. +--source include/auto_increment_offset_restore.inc + +--source include/galera_end.inc diff --git a/mysql-test/suite/galera/t/galera_sync_wait_show.test b/mysql-test/suite/galera/t/galera_sync_wait_show.test index 250b1f76e98..3707b7ebaf1 100644 --- a/mysql-test/suite/galera/t/galera_sync_wait_show.test +++ b/mysql-test/suite/galera/t/galera_sync_wait_show.test @@ -57,6 +57,7 @@ CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.f1 = 'a'; --connection node_2 +--replace_column 7 # SHOW CREATE TRIGGER tr1; DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_var_cluster_address.test b/mysql-test/suite/galera/t/galera_var_cluster_address.test index dfd84002dd6..4e5d138ae0a 100644 --- a/mysql-test/suite/galera/t/galera_var_cluster_address.test +++ b/mysql-test/suite/galera/t/galera_var_cluster_address.test @@ -6,17 +6,15 @@ --source include/have_innodb.inc # Save original auto_increment_offset values. ---connection node_1 -let $auto_increment_offset_node_1 = `SELECT @@global.auto_increment_offset`; ---connection node_2 -let $auto_increment_offset_node_2 = `SELECT @@global.auto_increment_offset`; - +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc # # Set to invalid value # ---connection node_1 ---let $wsrep_cluster_address_node1 = `SELECT @@wsrep_cluster_address` +--connection node_2 +--let $wsrep_cluster_address_node2 = `SELECT @@wsrep_cluster_address` SET GLOBAL wsrep_cluster_address = 'foo://'; # With wsrep_sync_wait, this returns an error @@ -26,7 +24,7 @@ SET GLOBAL wsrep_cluster_address = 'foo://'; SET SESSION wsrep_sync_wait=0; --error ER_UNKNOWN_COM_ERROR -SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS; +SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS; # Must return 'OFF' SHOW STATUS LIKE 'wsrep_ready'; @@ -38,9 +36,9 @@ SHOW STATUS LIKE 'wsrep_cluster_status'; SHOW STATUS LIKE 'wsrep_local_state'; SHOW STATUS LIKE 'wsrep_local_state_comment'; ---connection node_2 +--connection node_1 --sleep 1 -# Node #2 thinks that it is now part of a single-node primary cluster +# Node #1 thinks that it is now part of a single-node primary cluster SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; @@ -48,13 +46,10 @@ SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VA # Reset everything as it was # ---connection node_1 ---disable_query_log ---eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_node1'; ---enable_query_log - --connection node_2 -SET GLOBAL wsrep_cluster_address = @@wsrep_cluster_address; +--disable_query_log +--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_node2'; +--enable_query_log --source include/wait_until_connected_again.inc @@ -62,49 +57,19 @@ SET GLOBAL wsrep_cluster_address = @@wsrep_cluster_address; SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; -# -# Set to invalid host -# - ---connection node_1 -SET GLOBAL wsrep_cluster_address = 'gcomm://192.0.2.1'; - ---error ER_UNKNOWN_COM_ERROR -SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS; - -# Must return 'OFF' -SHOW STATUS LIKE 'wsrep_ready'; - -# Must return 'Non-primary' -SHOW STATUS LIKE 'wsrep_cluster_status'; - -# Must return 0 = 'Initialized' -SHOW STATUS LIKE 'wsrep_local_state'; -SHOW STATUS LIKE 'wsrep_local_state_comment'; - -# -# Reset everything as it was -# - ---connection node_1 ---disable_query_log ---eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_node1'; ---enable_query_log - --connection node_2 -SET GLOBAL wsrep_cluster_address = @@wsrep_cluster_address; ---sleep 1 - ---connection node_1 -SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; -SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +CALL mtr.add_suppression("Backend not supported: foo"); +CALL mtr.add_suppression("Failed to initialize backend using 'foo"); +CALL mtr.add_suppression("Failed to open channel 'my_wsrep_cluster' at 'foo"); +CALL mtr.add_suppression("gcs connect failed: Socket type not supported"); +CALL mtr.add_suppression("wsrep::connect\\(\\) failed: 7"); +CALL mtr.add_suppression("gcs_caused\\(\\) returned -103 \\(Software caused connection abort\\)"); +CALL mtr.add_suppression("failed to open gcomm backend connection: 110: failed to reach primary view: 110"); +CALL mtr.add_suppression("Failed to open backend connection: -110 \\(Connection timed out\\)"); +CALL mtr.add_suppression("gcs connect failed: Connection timed out"); +CALL mtr.add_suppression("WSREP: wsrep::connect\\(foo://\\) failed: 7"); # Restore original auto_increment_offset values. ---disable_query_log ---connection node_1 ---eval SET @@global.auto_increment_offset = $auto_increment_offset_node_1; ---connection node_2 ---eval SET @@global.auto_increment_offset = $auto_increment_offset_node_2; ---enable_query_log - +--source include/auto_increment_offset_restore.inc +--source include/galera_end.inc diff --git a/mysql-test/suite/galera/t/galera_var_dirty_reads.test b/mysql-test/suite/galera/t/galera_var_dirty_reads.test index dfd8d5ecf29..bcdb1574a3d 100644 --- a/mysql-test/suite/galera/t/galera_var_dirty_reads.test +++ b/mysql-test/suite/galera/t/galera_var_dirty_reads.test @@ -17,6 +17,11 @@ CREATE TABLE t1(i INT) ENGINE=INNODB; INSERT INTO t1 VALUES(1); SELECT * FROM t1; +create user user1; +grant all privileges on *.* to user1; +create user user2; +grant all privileges on *.* to user2; + SET @@global.wsrep_cluster_address = ''; SET @@session.wsrep_dirty_reads=OFF; @@ -36,6 +41,67 @@ SET @@session.wsrep_dirty_reads=ON; SELECT * FROM t1; +--enable_connect_log +--connect (con1, localhost, user1,,test,$NODE_MYPORT_2,$NODE_MYSOCK_2) +#Just test the session behavior +SET SESSION wsrep_sync_wait=0; + +set session wsrep_dirty_reads=1; +#Prepared statement creation should be allowed MDEV-11479 +prepare stmt_show from 'select 1'; +prepare stmt_select from 'select * from t1'; +prepare stmt_insert from 'insert into t1 values(1)'; +set session wsrep_dirty_reads=0; + +#No Preapare stmt/proceure will be allowed +--error ER_UNKNOWN_COM_ERROR +execute stmt_show; +--error ER_UNKNOWN_COM_ERROR +execute stmt_select; +--error ER_UNKNOWN_COM_ERROR +execute stmt_insert; + +SET wsrep_dirty_reads=ON; +select @@session.wsrep_dirty_reads; +#Only prepare statement which does not change data should be allowed +execute stmt_show; +execute stmt_select; +--error ER_UNKNOWN_COM_ERROR +execute stmt_insert; +SET @@global.wsrep_dirty_reads=ON; + +--connect (con2, localhost, user2,,test,$NODE_MYPORT_2,$NODE_MYSOCK_2) +#Just test the session behavior +select @@session.wsrep_dirty_reads; + +prepare stmt_show from 'select 1'; +prepare stmt_select from 'select * from t1'; +prepare stmt_insert from 'insert into t1 values(1)'; + +#Only prepare statement which does not change data should be allowed +execute stmt_show; +execute stmt_select; +--error ER_UNKNOWN_COM_ERROR +execute stmt_insert; + +#wsrep_dirty_read should work when wsrep_sync_wait is 1 or non zero +#because we already are disconnected , So It does not make any sense +#to wait for other nodes +SET SESSION wsrep_sync_wait=1; +execute stmt_show; +execute stmt_select; +--error ER_UNKNOWN_COM_ERROR +execute stmt_insert; + +SET SESSION wsrep_sync_wait=7; +execute stmt_show; +execute stmt_select; +--error ER_UNKNOWN_COM_ERROR +execute stmt_insert; + +--connection node_2 +SET @@global.wsrep_dirty_reads=OFF; + --disable_query_log --eval SET @@global.wsrep_cluster_address = '$wsrep_cluster_address_saved' --enable_query_log @@ -45,6 +111,8 @@ SELECT * FROM t1; SELECT * FROM t1; # Cleanup DROP TABLE t1; +drop user user1; +drop user user2; # Restore original auto_increment_offset values. --source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test b/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test index 9cb0edf1810..90c786f0af0 100644 --- a/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test +++ b/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test @@ -132,6 +132,16 @@ COMMIT; DROP TABLE t1; DROP TABLE t2; +--echo # +--echo # MDEV-11152: wsrep_replicate_myisam: SELECT gets replicated using TO +--echo # +--connection node_1 +CREATE TABLE t1 (i INT) ENGINE=INNODB; +INSERT INTO t1 VALUES(1); +# This command should not get replicated. +SELECT * FROM t1; +DROP TABLE t1; + --connection node_1 --eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig diff --git a/mysql-test/suite/galera/t/galera_wan_restart_ist.test b/mysql-test/suite/galera/t/galera_wan_restart_ist.test index 42f63df3acc..1cf5d4c7f74 100644 --- a/mysql-test/suite/galera/t/galera_wan_restart_ist.test +++ b/mysql-test/suite/galera/t/galera_wan_restart_ist.test @@ -12,6 +12,16 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--let $node_4=node_4 +--source include/auto_increment_offset_save.inc + SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; --connection node_1 @@ -21,11 +31,9 @@ INSERT INTO t1 VALUES (1); --connection node_2 INSERT INTO t1 VALUES (2); ---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connection node_3 INSERT INTO t1 VALUES (3); ---connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 --connection node_4 INSERT INTO t1 VALUES (4); @@ -146,3 +154,8 @@ CALL mtr.add_suppression("Action message in non-primary configuration from membe --connection node_4 CALL mtr.add_suppression("Action message in non-primary configuration from member 0"); + +# Restore original auto_increment_offset values. +--source include/auto_increment_offset_restore.inc + +--source include/galera_end.inc diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def index fb23a81bfb8..ca55c41ff72 100644 --- a/mysql-test/suite/galera_3nodes/disabled.def +++ b/mysql-test/suite/galera_3nodes/disabled.def @@ -3,3 +3,5 @@ galera_evs_suspect_timeout : TODO: investigate galera_innobackupex_backup : TODO: investigate galera_slave_options_do :MDEV-8798 galera_slave_options_ignore : MDEV-8798 +galera_pc_bootstrap : TODO: Investigate: Timeout in wait_condition.inc +galera_pc_weight : Test times out diff --git a/mysql-test/suite/galera_3nodes/r/galera_certification_ccc.result b/mysql-test/suite/galera_3nodes/r/galera_certification_ccc.result index 96a2bec0d7f..b1bbb1406a1 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_certification_ccc.result +++ b/mysql-test/suite/galera_3nodes/r/galera_certification_ccc.result @@ -1,3 +1,7 @@ +connection node_1; +connection node_2; +connection node_3; +connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; @@ -5,13 +9,20 @@ INSERT INTO t1 VALUES (1); SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 3 1 +connection node_3; SET GLOBAL wsrep_cluster_address = ''; +connection node_1; INSERT INTO t1 VALUES (2); SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 2 1 COMMIT; +connection node_2; SELECT COUNT(*) = 2 FROM t1; COUNT(*) = 2 1 +connection node_3; +connection node_1; DROP TABLE t1; +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera_3nodes/r/galera_certification_double_failure.result b/mysql-test/suite/galera_3nodes/r/galera_certification_double_failure.result index 9dc735d5d3d..c2fdfc38dd5 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_certification_double_failure.result +++ b/mysql-test/suite/galera_3nodes/r/galera_certification_double_failure.result @@ -1,11 +1,15 @@ +connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (1); +connection node_2; INSERT INTO t1 VALUES (1); +connection node_3; INSERT INTO t2 VALUES (1); +connection node_1; COMMIT; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes/r/galera_ist_gcache_rollover.result b/mysql-test/suite/galera_3nodes/r/galera_ist_gcache_rollover.result index 6c66bf4a891..3d4dbcc00b0 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_ist_gcache_rollover.result +++ b/mysql-test/suite/galera_3nodes/r/galera_ist_gcache_rollover.result @@ -1,13 +1,23 @@ +connection node_1; +connection node_2; +connection node_3; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); INSERT INTO t1 VALUES (01), (02), (03), (04), (05); +connection node_2; Unloading wsrep provider ... SET GLOBAL wsrep_provider = 'none'; +connection node_3; Unloading wsrep provider ... SET GLOBAL wsrep_provider = 'none'; +connection node_1; INSERT INTO t1 VALUES (11), (12), (13), (14), (15); INSERT INTO t1 VALUES (21), (22), (23), (24), (25); SET GLOBAL wsrep_provider_options = 'dbug=d,ist_sender_send_after_get_buffers'; +connection node_2; +connection node_1; INSERT INTO t1 VALUES (31), (32), (33), (34), (35); +connection node_3; +connection node_1; SHOW STATUS LIKE 'wsrep_debug_sync_waiters'; Variable_name Value wsrep_debug_sync_waiters ist_sender_send_after_get_buffers ist_sender_send_after_get_buffers @@ -19,6 +29,9 @@ INSERT INTO t2 VALUES (REPEAT('x', 512 * 1024)); SET GLOBAL wsrep_provider_options = 'dbug='; SET GLOBAL wsrep_provider_options = 'signal=ist_sender_send_after_get_buffers'; INSERT INTO t1 VALUES (51), (52), (53), (54), (55); +connection node_2; +connection node_3; +connection node_2; SELECT COUNT(*) = 30 FROM t1; COUNT(*) = 30 1 @@ -31,6 +44,7 @@ LENGTH(f1) = 512 * 1024 1 1 CALL mtr.add_suppression("WSREP: Unsupported protocol downgrade: incremental data collection disabled"); +connection node_3; SELECT COUNT(*) = 30 FROM t1; COUNT(*) = 30 1 @@ -44,3 +58,6 @@ LENGTH(f1) = 512 * 1024 1 CALL mtr.add_suppression("WSREP: Unsupported protocol downgrade: incremental data collection disabled"); DROP TABLE t1, t2; +disconnect node_3; +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result b/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result index ec97d392c0f..4f9951c382f 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result +++ b/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result @@ -1,8 +1,14 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); +connection node_3; SET GLOBAL wsrep_slave_threads = 2; +connection node_1; UPDATE t1 SET f1 = f1 + 10;; +connection node_2; UPDATE t1 SET f1 = f1 + 100;; +connection node_1; +connection node_2; +connection node_3; SELECT f1 = 111 FROM t1; f1 = 111 1 diff --git a/mysql-test/suite/galera_3nodes/suite.pm b/mysql-test/suite/galera_3nodes/suite.pm index 39d5acbcc1b..c91e6e07d76 100644 --- a/mysql-test/suite/galera_3nodes/suite.pm +++ b/mysql-test/suite/galera_3nodes/suite.pm @@ -26,6 +26,7 @@ push @::global_suppressions, ( qr(WSREP: wsrep_sst_receive_address is set to '127.0.0.1), qr(WSREP: Could not open saved state file for reading: ), + qr(WSREP: Could not open state file for reading: ), qr(WSREP: Gap in state sequence. Need state transfer.), qr(WSREP: Failed to prepare for incremental state transfer:), qr(WSREP:.*down context.*), @@ -33,13 +34,14 @@ push @::global_suppressions, qr(WSREP: last inactive check more than .* skipping check), qr(WSREP: SQL statement was ineffective), qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned.), - qr|WSREP: access file\(gvwstate.dat\) failed\(No such file or directory\)|, + qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|, qr(WSREP: Quorum: No node with complete state), qr(WSREP: Initial position was provided by configuration or SST, avoiding override), qr|WSREP: discarding established \(time wait\) .*|, qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside. Will use that one.), qr(WSREP: evs::proto.*), qr|WSREP: Ignoring possible split-brain (allowed by configuration) from view:.*|, + qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable), qr(WSREP: Could not find peer:), qr(WSREP: Protocol violation. JOIN message sender .*), qr(WSREP: JOIN message from member [0-9]* in non-primary configuration. Ignored.), diff --git a/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test index 8575d99f066..a67b30e3fa1 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test +++ b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test @@ -17,6 +17,12 @@ --let $galera_server_number = 3 --source include/galera_connect.inc +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); INSERT INTO t1 VALUES (01), (02), (03), (04), (05); @@ -99,3 +105,9 @@ SELECT LENGTH(f1) = 512 * 1024 FROM t2; CALL mtr.add_suppression("WSREP: Unsupported protocol downgrade: incremental data collection disabled"); DROP TABLE t1, t2; + +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc + +--let $galera_cluster_size=3 +--source include/galera_end.inc diff --git a/mysql-test/suite/gcol/inc/gcol_blocked_sql_funcs_main.inc b/mysql-test/suite/gcol/inc/gcol_blocked_sql_funcs_main.inc new file mode 100644 index 00000000000..88091ce42a4 --- /dev/null +++ b/mysql-test/suite/gcol/inc/gcol_blocked_sql_funcs_main.inc @@ -0,0 +1,249 @@ +################################################################################ +# inc/gcol_blocked_sql_funcs_main.inc # +# # +# Purpose: # +# Tests around sql functions # +# # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-08-31 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# MySQL doesn't support them, but MariaDB does: +# +create or replace table t1 (b double generated always as (rand()) virtual); +create or replace table t1 (a datetime generated always as (curdate()) virtual); +create or replace table t1 (a datetime generated always as (current_date) virtual); +create or replace table t1 (a datetime generated always as (current_date()) virtual); +create or replace table t1 (a datetime generated always as (current_time) virtual); +create or replace table t1 (a datetime generated always as (current_time()) virtual); +create or replace table t1 (a datetime generated always as (current_timestamp()) virtual); +create or replace table t1 (a datetime generated always as (current_timestamp) virtual); +create or replace table t1 (a datetime generated always as (curtime()) virtual); +create or replace table t1 (a datetime, b varchar(10) generated always as (localtime()) virtual); +create or replace table t1 (a datetime, b varchar(10) generated always as (localtime) virtual); +create or replace table t1 (a datetime, b varchar(10) generated always as (localtimestamp()) virtual); +create or replace table t1 (a datetime, b varchar(10) generated always as (localtimestamp) virtual); +create or replace table t1 (a datetime, b varchar(10) generated always as (now()) virtual); +create or replace table t1 (a int, b varchar(10) generated always as (sysdate()) virtual); +create or replace table t1 (a datetime, b datetime generated always as (unix_timestamp()) virtual); +create or replace table t1 (a datetime, b datetime generated always as (utc_date()) virtual); +create or replace table t1 (a datetime, b datetime generated always as (utc_time()) virtual); +create or replace table t1 (a datetime, b datetime generated always as (utc_timestamp()) virtual); +create or replace table t1 (a int generated always as (connection_id()) virtual); +create or replace table t1 (a varchar(32) generated always as (current_user()) virtual); +create or replace table t1 (a varchar(32) generated always as (current_user) virtual); +create or replace table t1 (a varchar(1024), b varchar(1024) generated always as (database()) virtual); +create or replace table t1 (a varchar(32) generated always as (schema()) virtual); +create or replace table t1 (a varchar(32) generated always as (session_user()) virtual); +create or replace table t1 (a varchar(32) generated always as (system_user()) virtual); +create or replace table t1 (a varchar(1024), b varchar(1024) generated always as (user()) virtual); +create or replace table t1 (a varchar(1024) generated always as (uuid_short()) virtual); +create or replace table t1 (a varchar(1024) generated always as (uuid()) virtual); +create or replace table t1 (a varchar(1024), b varchar(1024) generated always as (version()) virtual); +create or replace table t1 (a varchar(1024), b varchar(1024) generated always as (encrypt(a)) virtual); +create or replace table t1 (a varchar(1024), b varchar(1024) generated always as (UpdateXML(a,'/a','fff')) virtual); +drop table t1; + +# +# NOTE: All SQL functions below should be rejected, otherwise BUG. +# + +--echo # LOAD_FILE() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a varchar(64), b varchar(1024) generated always as (load_file(a)) virtual); + +--echo # MATCH() +if (!$skip_full_text_check) +{ + -- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED + create table t1 (a varchar(32), b bool generated always as (match a against ('sample text')) virtual); +} + +--echo # BENCHMARK() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a varchar(1024), b varchar(1024) generated always as (benchmark(a,3)) virtual); + +--echo # FOUND_ROWS() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a varchar(1024), b varchar(1024) generated always as (found_rows()) virtual); + +--echo # GET_LOCK() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a varchar(1024), b varchar(1024) generated always as (get_lock(a,10)) virtual); + +--echo # IS_FREE_LOCK() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a varchar(1024), b varchar(1024) generated always as (is_free_lock(a)) virtual); + +--echo # IS_USED_LOCK() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a varchar(1024), b varchar(1024) generated always as (is_used_lock(a)) virtual); + +--echo # LAST_INSERT_ID() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int generated always as (last_insert_id()) virtual); + +--echo # MASTER_POS_WAIT() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a varchar(32), b int generated always as (master_pos_wait(a,0,2)) virtual); + +--echo # NAME_CONST() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a varchar(32) generated always as (name_const('test',1)) virtual); + +--echo # RELEASE_LOCK() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a varchar(32), b int generated always as (release_lock(a)) virtual); + +--echo # ROW_COUNT() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int generated always as (row_count()) virtual); + +--echo # SLEEP() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b int generated always as (sleep(a)) virtual); + +--echo # VALUES() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a varchar(1024), b varchar(1024) generated always as (values(a)) virtual); + +--echo # Stored procedures + +delimiter //; +create procedure p1() +begin + select current_user(); +end // + +create function f1() +returns int +begin + return 1; +end // + +delimiter ;// + +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int generated always as (p1()) virtual); +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int generated always as (f1()) virtual); + +drop procedure p1; +drop function f1; + +--echo # Unknown functions +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int generated always as (f1()) virtual); + +--echo # +--echo # GROUP BY FUNCTIONS +--echo # + +--echo # AVG() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b int generated always as (avg(a)) virtual); + +--echo # BIT_AND() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b int generated always as (bit_and(a)) virtual); + +--echo # BIT_OR() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b int generated always as (bit_or(a)) virtual); + +--echo # BIT_XOR() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b int generated always as (bit_xor(a)) virtual); + +--echo # COUNT(DISTINCT) +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b int generated always as (count(distinct a)) virtual); + +--echo # COUNT() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b int generated always as (count(a)) virtual); + +--echo # GROUP_CONCAT() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a varchar(32), b int generated always as (group_concat(a,'')) virtual); + +--echo # MAX() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b int generated always as (max(a)) virtual); + +--echo # MIN() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b int generated always as (min(a)) virtual); + +--echo # STD() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b int generated always as (std(a)) virtual); + +--echo # STDDEV_POP() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b int generated always as (stddev_pop(a)) virtual); + +--echo # STDDEV_SAMP() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b int generated always as (stddev_samp(a)) virtual); + +--echo # STDDEV() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b int generated always as (stddev(a)) virtual); + +--echo # SUM() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b int generated always as (sum(a)) virtual); + +--echo # VAR_POP() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b int generated always as (var_pop(a)) virtual); + +--echo # VAR_SAMP() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b int generated always as (var_samp(a)) virtual); + +--echo # VARIANCE() +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b int generated always as (variance(a)) virtual); + +--echo # +--echo # Sub-selects +--echo # + +create table t1 (a int); +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t2 (a int, b int generated always as (select count(*) virtual from t1)); +drop table t1; + +--echo # +--echo # Long expression + +let $tmp_long_string = `SELECT repeat('a',240)`; +eval create table t1 (a int, b varchar(300) generated always as (concat(a,'$tmp_long_string')) virtual); +drop table t1; +let $tmp_long_string = `SELECT repeat('a',243)`; +# Limit is lifted to 64K. TODO write a test for it. +# --error 1470 +eval create table t1 (a int, b varchar(300) generated always as (concat(a,'$tmp_long_string')) virtual); +drop table t1; + +--echo # +--echo # Constant expression +create table t1 (a int generated always as (PI()) virtual); +drop table t1; + +--echo # bug#21098119: GCOL WITH MATCH/AGAINST --> +--echo # ASSERTION FAILED: TR && TR->TABLE->FILE +--echo # +create table t1 (a int); +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +alter table t1 add column r blob generated always +as (match(a) against ('' in boolean mode)) virtual; +drop table t1; diff --git a/mysql-test/suite/gcol/inc/gcol_cleanup.inc b/mysql-test/suite/gcol/inc/gcol_cleanup.inc new file mode 100644 index 00000000000..39f7ff7fcea --- /dev/null +++ b/mysql-test/suite/gcol/inc/gcol_cleanup.inc @@ -0,0 +1,24 @@ +################################################################################ +# inc/gcol_cleanup.inc # +# # +# Purpose: # +# Removal of the objects created by the t/.test # +# scripts. # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-08-31 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +--disable_warnings +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; +--enable_warnings diff --git a/mysql-test/suite/gcol/inc/gcol_column_def_options.inc b/mysql-test/suite/gcol/inc/gcol_column_def_options.inc new file mode 100644 index 00000000000..bd84ace62ec --- /dev/null +++ b/mysql-test/suite/gcol/inc/gcol_column_def_options.inc @@ -0,0 +1,585 @@ +################################################################################ +# inc/gcol_column_def_options.inc # +# # +# Purpose: # +# Testing different optional parameters specified when defining # +# a generated column. # +# # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-02 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ +--source include/have_partition.inc + +--echo # +--echo # Section 1. Wrong column definition options +--echo # - DEFAULT +--echo # - AUTO_INCREMENT + +--echo # NOT NULL +--error ER_PARSE_ERROR +create table t1 (a int, b int generated always as (a+1) virtual not null); +--error ER_PARSE_ERROR +create table t1 (a int, b int generated always as (a+1) stored not null); +create table t1 (a int); +--error ER_PARSE_ERROR +alter table t1 add column b int generated always as (a+1) virtual not null; +drop table t1; + +--error ER_PARSE_ERROR +create table t1 (a int, b int generated always as (a+1) virtual null); +create table t1 (a int); +--error ER_PARSE_ERROR +alter table t1 add column b int generated always as (a+1) virtual null; +drop table t1; + +--echo # Added columns mixed with virtual GC and other columns +create table t1 (a int); +insert into t1 values(1); +--enable_info +alter table t1 add column (b int generated always as (a+1) virtual, c int); +alter table t1 add column (d int, e int generated always as (a+1) virtual); +alter table t1 add column (f int generated always as (a+1) virtual, g int as(5) stored); +alter table t1 add column (h int generated always as (a+1) virtual, i int as(5) virtual); +--disable_info +drop table t1; + +--echo # DEFAULT +--error 1064 +create table t1 (a int, b int generated always as (a+1) virtual default 0); +create table t1 (a int); +--error 1064 +alter table t1 add column b int generated always as (a+1) virtual default 0; +drop table t1; + +--echo # AUTO_INCREMENT +--error 1064 +create table t1 (a int, b int generated always as (a+1) virtual AUTO_INCREMENT); +create table t1 (a int); +--error 1064 +alter table t1 add column b int generated always as (a+1) virtual AUTO_INCREMENT; +drop table t1; + +--echo # [PRIMARY] KEY +if ($support_virtual_index) +{ +--error ER_PARSE_ERROR +create table t1 (a int, b int generated always as (a+1) virtual key); +} +--error ER_PARSE_ERROR +create table t1 (a int, b int generated always as (a+1) stored key); +if ($support_virtual_index) +{ +--error ER_PARSE_ERROR +create table t1 (a int, b int generated always as (a+1) virtual primary key); +} +--error ER_PARSE_ERROR +create table t1 (a int, b int generated always as (a+1) stored primary key); +create table t1 (a int); +if ($support_virtual_index) +{ +--error ER_PARSE_ERROR +alter table t1 add column b int generated always as (a+1) virtual key; +} +--error ER_PARSE_ERROR +alter table t1 add column b int generated always as (a+1) stored key; +if ($support_virtual_index) +{ +--error ER_PARSE_ERROR +alter table t1 add column c int generated always as (a+2) virtual primary key; +} +show create table t1; +--error ER_PARSE_ERROR +alter table t1 add column c int generated always as (a+2) stored primary key; +drop table t1; + +--echo # Section 2. Other column definition options +--echo # - COMMENT +--echo # - REFERENCES (only syntax testing here) +--echo # - STORED (only systax testing here) +create table t1 (a int, b int generated always as (a % 2) virtual comment 'my comment'); +show create table t1; +describe t1; +drop table t1; +create table t1 (a int, b int generated always as (a % 2) virtual); +alter table t1 modify b int generated always as (a % 2) virtual comment 'my comment'; +show create table t1; +describe t1; +insert into t1 (a) values (1); +select * from t1; +insert into t1 values (2,default); +select a,b from t1 order by a; +create table t2 like t1; +show create table t2; +describe t2; +insert into t2 (a) values (1); +select * from t2; +insert into t2 values (2,default); +select a,b from t2 order by a; +drop table t2; +drop table t1; + +create table t1 (a int, b int generated always as (a % 2) stored); +show create table t1; +describe t1; +insert into t1 (a) values (1); +select * from t1; +insert into t1 values (2,default); +select a,b from t1 order by a; +drop table t1; + + +create table t2 (a int); +create table t1 (a int, b int generated always as (a % 2) stored references t2(a)); +show create table t1; +drop table t1; +create table t1 (a int, b int generated always as (a % 2) virtual); +--error 1064 +alter table t1 modify b int generated always as (a % 2) stored references t2(a); +show create table t1; +drop table t1; +drop table t2; +--echo FK options +create table t1(a int, b int as (a % 2), c int as (a) stored); +create table t2 (a int); +--error ER_KEY_COLUMN_DOES_NOT_EXITS +alter table t1 add constraint foreign key fk(d) references t2(a); +if ($support_virtual_foreign) +{ +--replace_regex /`#sql-.*`/`#sql-temporary`/ +--error ER_CANT_CREATE_TABLE +alter table t1 add constraint foreign key fk(b) references t2(a); +} +--error ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN +alter table t1 add constraint foreign key fk(c) references t2(a) on delete set null; +--error ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN +alter table t1 add constraint foreign key fk(c) references t2(a) on update set null; +--error ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN +alter table t1 add constraint foreign key fk(c) references t2(a) on update cascade; +drop table t1; +drop table t2; +--echo Generated always is optional +create table t1 (a int, b int as (a % 2) virtual); +show create table t1; +describe t1; +drop table t1; +create table t1 (a int, b int as (a % 2) stored); +show create table t1; +describe t1; +drop table t1; +--echo Default should be non-stored column +create table t1 (a int, b int as (a % 2)); +show create table t1; +describe t1; +drop table t1; +--echo Expression can be constant +create table t1 (a int, b int as (5 * 2)); +show create table t1; +describe t1; +drop table t1; +--echo Test generated columns referencing other generated columns +create table t1 (a int unique, b int generated always as(-a) virtual, c int generated always as (b + 1) virtual); +insert into t1 (a) values (1), (2); +--sorted_result +select * from t1; +insert into t1(a) values (1) on duplicate key update a=3; +--sorted_result +select * from t1; +update t1 set a=4 where a=2; +--sorted_result +select * from t1; +drop table t1; + +--error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD +create table t1 (a int, b int generated always as(-b) virtual, c int generated always as (b + 1) virtual); +--error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD +create table t1 (a int, b int generated always as(-c) virtual, c int generated always as (b + 1) virtual); +--error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD +create table t1 (pk int auto_increment primary key, col_int_nokey int generated always as (pk + col_int_key) stored, col_int_key int); + +--echo # Bug#20339347: FAIL TO USE CREATE ....SELECT STATEMENT TO CREATE A NEW TABLE +create table t1 (a int, b int generated always as(-a) virtual, c int generated always as (b + 1) stored); +insert into t1(a) values(1),(2); +create table tt as select * from t1; +select * from t1 order by a; +select * from tt order by a; +drop table t1,tt; + +if (!$support_virtual_index) +{ +--echo # Bug#20769299: INCORRECT KEY ERROR WHEN TRYING TO CREATE INDEX ON +--echo # VIRTUAL GC FOR MYISAM +--error ER_KEY_BASED_ON_GENERATED_GENERATED_COLUMN +CREATE TABLE A ( +pk INTEGER, +col_int_nokey INTEGER, +col_int_key INTEGER GENERATED ALWAYS AS (pk + col_int_nokey) VIRTUAL, KEY +(col_int_key)); +} + +--echo # Bug#20745142: GENERATED COLUMNS: ASSERTION FAILED: +--echo # THD->CHANGE_LIST.IS_EMPTY() +--echo # +--error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD +CREATE TABLE t1(a bigint AS (a between 1 and 1)); + +--echo # Bug#20757211: GENERATED COLUMNS: ALTER TABLE CRASHES +--echo # IN FIND_FIELD_IN_TABLE +--echo # +CREATE TABLE t1(a int); +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +ALTER TABLE t1 ADD COLUMN z int GENERATED ALWAYS AS +( 1 NOT IN (SELECT 1 FROM t1 WHERE c0006) ) virtual; +DROP TABLE t1; + +--echo # Bug#20566243: ERROR WHILE DOING CREATE TABLE T1 SELECT (QUERY ON GC COLUMNS) +CREATE TABLE t1(a int, b int as (a + 1), + c varchar(12) as ("aaaabb") stored, d blob as (c)); +INSERT INTO t1(a) VALUES(1),(3); +SHOW CREATE TABLE t1; +SELECT * FROM t1 order by a; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +CREATE TABLE t3 AS SELECT * FROM t1; +SHOW CREATE TABLE t3; +SELECT * FROM t3 order by a; +CREATE TABLE t4 AS SELECT b,c,d FROM t1; +SHOW CREATE TABLE t4; +SELECT * FROM t4 order by b; +DROP TABLE t1,t2,t3,t4; + +--echo # Bug#21025003:WL8149:ASSERTION `CTX->NUM_TO_DROP_FK +--echo # == HA_ALTER_INFO->ALTER_INFO-> FAILED +--echo # +CREATE TABLE t1 ( + col1 int(11) DEFAULT NULL, + col2 int(11) DEFAULT NULL, + col3 int(11) DEFAULT NULL, + col4 int(11) DEFAULT NULL, + col5 int(11) GENERATED ALWAYS AS (col4 / col2) VIRTUAL, + col6 text +); +INSERT INTO t1(col1,col2,col3,col4,col6) VALUES(NULL,1,4,0,REPEAT(2,1000)); +--error ER_CANT_DROP_FIELD_OR_KEY +ALTER TABLE t1 DROP PRIMARY KEY , ADD KEY idx ( col5, col2 ); +DROP TABLE t1; +--echo # Bug#20949226:i CAN ASSIGN NON-DEFAULT() VALUE TO GENERATED COLUMN +--echo # +CREATE TABLE t1 (c1 INT, c2 INT AS (c1 * 2)) SELECT 1 AS c1, 5 AS c2; +CREATE TABLE t2 (a int); +INSERT INTO t2 values(1); +DROP TABLE t1; +CREATE TABLE t1 (c1 INT, c2 INT AS (c1 * 2)) SELECT 1 AS c1, a AS c2 from t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT, c2 INT AS (c1 * 2)) SELECT 1 AS c1, 5; +SELECT * FROM t1; +DROP TABLE t1, t2; + +if ($support_virtual_index) +{ +--echo # Bug#21074624:i WL8149:SIG 11 INNOBASE_GET_COMPUTED_VALUE | +--echo # INNOBASE/HANDLER/HA_INNODB.CC:19082 +CREATE TABLE t1 ( + col1 int(11) NOT NULL, + col2 int(11) DEFAULT NULL, + col3 int(11) NOT NULL, + col4 int(11) DEFAULT NULL, + col5 int(11) GENERATED ALWAYS AS (col2 % col4) VIRTUAL, + col6 int(11) GENERATED ALWAYS AS (col3 + col3) VIRTUAL, + col7 int(11) GENERATED ALWAYS AS (col5 / col5) VIRTUAL, + col8 int(11) GENERATED ALWAYS AS (col6 / col5) VIRTUAL, + col9 text, + extra int(11) DEFAULT NULL, + KEY idx (col5) +); +INSERT INTO t1(col1,col2,col3,col4,col9,extra) +VALUES(0,6,3,4,REPEAT(4,1000),0); +ALTER TABLE t1 DROP COLUMN col1; +DROP TABLE t1; + +--echo # Bug#21390605:VALGRIND ERROR ON DELETE FROM TABLE CONTAINING +--echo # AN INDEXED VIRTUAL COLUMN +CREATE TABLE t1 ( + a INTEGER, + b INTEGER GENERATED ALWAYS AS (a) VIRTUAL, + c INTEGER GENERATED ALWAYS AS (b) VIRTUAL, + INDEX idx (b,c) +); +INSERT INTO t1 (a) VALUES (42); +DELETE FROM t1 WHERE c = 42; +DROP TABLE t1; +} + +--echo # Bug#20757211: GENERATED COLUMNS: ALTER TABLE CRASHES +--echo # IN FIND_FIELD_IN_TABLE +--echo # +CREATE TABLE t1(a int); +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +ALTER TABLE t1 ADD COLUMN z int GENERATED ALWAYS AS +( 1 NOT IN (SELECT 1 FROM t1 WHERE c0006) ) virtual; +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +CREATE TABLE t2(a int, b int as (1 NOT IN (SELECT 1 FROM t1 WHERE not_exist_col))); +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +CREATE TABLE t2(a int, b int as (1 NOT IN (SELECT 1 FROM dual))); +DROP TABLE t1; + +if(! $testing_ndb) { +--echo # Bug#21142905: PARTITIONED GENERATED COLS - +--echo # !TABLE || (!TABLE->WRITE_SET || BITMAP_IS_SET +--echo # +CREATE TABLE t1 ( +a int, +b int generated always as (a) virtual, +c int generated always as (b+a) virtual, +d int generated always as (b+a) virtual +) PARTITION BY LINEAR HASH (b); +INSERT INTO t1(a) VALUES(0); +DELETE FROM t1 WHERE c=1; +DROP TABLE t1; +} + +--error ER_PARSE_ERROR +CREATE TABLE t1 (c CHAR(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ("foo bar")); +CREATE TABLE t1 (i INT); +--error ER_PARSE_ERROR +ALTER TABLE t1 ADD COLUMN c CHAR(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ("foo bar"); +DROP TABLE t1; +--error ER_PARSE_ERROR +CREATE TABLE t1 (i INT COLLATE utf8_bin, c INT COLLATE utf8_bin GENERATED ALWAYS AS (10)); + +--echo # Check for a charset mismatch processing: + +--echo # Bug #21469535: VALGRIND ERROR (CONDITIONAL JUMP) WHEN INSERT +--echo # ROWS INTO A PARTITIONED TABLE +--echo # +CREATE TABLE t1 ( + id INT NOT NULL, + store_id INT NOT NULL, + x INT GENERATED ALWAYS AS (id + store_id) +) +PARTITION BY RANGE (store_id) ( + PARTITION p0 VALUES LESS THAN (6), + PARTITION p1 VALUES LESS THAN (11), + PARTITION p2 VALUES LESS THAN (16), + PARTITION p3 VALUES LESS THAN (21) +); + +INSERT INTO t1 VALUES(1, 2, default); +DROP TABLE t1; + +--echo # Bug#21465626:ASSERT/CRASH ON DROPPING/ADDING VIRTUAL COLUMN +CREATE TABLE t (a int(11), b int(11), + c int(11) GENERATED ALWAYS AS (a+b) VIRTUAL, + d int(11) GENERATED ALWAYS AS (a+b) VIRTUAL); +INSERT INTO t(a,b) VALUES(1,2); +--enable_info +--echo # Mixed drop/add/rename virtual with non-virtual columns, +--echo # ALGORITHM=INPLACE is not supported for InnoDB +ALTER TABLE t DROP d, ADD e varchar(10); +ALTER TABLE t ADD d int, ADD f char(10) AS ('aaa'); +ALTER TABLE t CHANGE d dd int, CHANGE f ff varchar(10) AS ('bbb'); +--echo # Only drop/add/change virtual, inplace is supported for Innodb +ALTER TABLE t DROP c, DROP ff; +ALTER TABLE t ADD c int(11) as (a+b), ADD f varchar(10) as ('aaa'); +ALTER TABLE t CHANGE c c int(11) as (a), CHANGE f f varchar(10) as('bbb'); +--echo # Change order should be ALGORITHM=INPLACE on Innodb +ALTER TABLE t CHANGE c c int(11) as (a) after f; +ALTER TABLE t CHANGE b b int(11) after c; +--echo # TODO: Changing virtual column type should be ALGORITHM=INPLACE on InnoDB, current it goes only with COPY method +ALTER TABLE t CHANGE c c varchar(10) as ('a'); +--echo # Changing stored column type is ALGORITHM=COPY +ALTER TABLE t CHANGE dd d varchar(10); +if ($support_virtual_index) +{ +# no RENAME INDEX yet +#ALTER TABLE t ADD INDEX idx(a), ADD INDEX idx1(c); +#ALTER TABLE t RENAME INDEX idx TO idx2, RENAME INDEX idx1 TO idx3; +#ALTER TABLE t DROP INDEX idx2, DROP INDEX idx3; +ALTER TABLE t ADD INDEX idx(c), ADD INDEX idx1(d); +ALTER TABLE t DROP INDEX idx, DROP INDEX idx1; +} +--disable_info +DROP TABLE t; + +--echo # Bug#21854004: GCOLS:INNODB: FAILING ASSERTION: I < TABLE->N_DEF +CREATE TABLE t1( + col1 INTEGER PRIMARY KEY, + col2 INTEGER, + col3 INTEGER, + col4 INTEGER, + vgc1 INTEGER AS (col2 + col3) VIRTUAL, + sgc1 INTEGER AS (col2 - col3) STORED +); + +INSERT INTO t1(col1, col2, col3) VALUES + (1, 10, 100), (2, 20, 200); + +SELECT * FROM t1 order by col1; + +# Change expression of a virtual generated column +ALTER TABLE t1 MODIFY COLUMN vgc1 INTEGER AS (col2 * col3) VIRTUAL; +SELECT * FROM t1 order by col1; + +# Change expression of a stored generated column +ALTER TABLE t1 MODIFY COLUMN sgc1 INTEGER AS (col2 / col3) STORED; +SELECT * FROM t1 order by col1; + +ALTER TABLE t1 MODIFY COLUMN vgc1 INTEGER AS (col2 + col3) VIRTUAL; +ALTER TABLE t1 MODIFY COLUMN sgc1 INTEGER AS (col2 - col3) STORED; + +if ($support_virtual_index) +{ +ALTER TABLE t1 ADD INDEX vgc1 (vgc1); +} +ALTER TABLE t1 ADD INDEX sgc1 (sgc1); + +if ($support_virtual_index) +{ +# Change expression of a virtual generated column, with index +ALTER TABLE t1 MODIFY COLUMN vgc1 INTEGER AS (col2 * col3) VIRTUAL; +SELECT * FROM t1 order by col1; +SELECT vgc1 FROM t1 order by vgc1; +} + +# Change expression of a stored generated column, with index +ALTER TABLE t1 MODIFY COLUMN sgc1 INTEGER AS (col2 / col3) STORED; +SELECT * FROM t1 order by col1; +SELECT sgc1 FROM t1 order by sgc1; + +if ($support_virtual_index) +{ +ALTER TABLE t1 DROP INDEX vgc1; +} +ALTER TABLE t1 DROP INDEX sgc1; + +if ($support_virtual_index) +{ +ALTER TABLE t1 MODIFY COLUMN vgc1 INTEGER AS (col2 + col3) VIRTUAL; +ALTER TABLE t1 ADD UNIQUE INDEX vgc1 (vgc1); +} +ALTER TABLE t1 MODIFY COLUMN sgc1 INTEGER AS (col2 - col3) STORED; +ALTER TABLE t1 ADD UNIQUE INDEX sgc1 (sgc1); + +# Change expression of a virtual generated column, with unique index +if ($support_virtual_index) +{ +--error ER_DUP_ENTRY +ALTER TABLE t1 MODIFY COLUMN vgc1 INTEGER AS (col2 / col3) VIRTUAL; +} +--error ER_DUP_ENTRY +ALTER TABLE t1 MODIFY COLUMN sgc1 INTEGER AS (col2 / col3) STORED; + +ALTER TABLE t1 MODIFY COLUMN vgc1 INTEGER AS (col2 * col3) VIRTUAL; +SELECT * FROM t1 order by col1; +SELECT vgc1 FROM t1 order by col1; + +ALTER TABLE t1 MODIFY COLUMN sgc1 INTEGER AS (col2 * col3) STORED; +SELECT * FROM t1 order by col1; +SELECT sgc1 FROM t1 order by sgc1; + +# Change virtual generated column to become stored +--error ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN +ALTER TABLE t1 MODIFY COLUMN vgc1 INTEGER AS (col2 * col3) STORED; + +# Change stored generated column to become virtual +--error ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN +ALTER TABLE t1 MODIFY COLUMN sgc1 INTEGER AS (col2 / col3) VIRTUAL; + +# Change base column to become stored generated column: +ALTER TABLE t1 MODIFY COLUMN col4 INTEGER AS (col1 + col2 + col3) STORED; +SELECT * FROM t1 order by col1; + +# Change stored generated column to become base column: +ALTER TABLE t1 MODIFY COLUMN col4 INTEGER; +SELECT * FROM t1 order by col1; + +DROP TABLE t1; + +if ($support_virtual_index) +{ +--echo # +--echo # bug#22018979: RECORD NOT FOUND ON UPDATE, +--echo # VIRTUAL COLUMN, ASSERTION 0 +--disable_warnings +SET @sql_mode_save= @@sql_mode; +SET sql_mode= 'ANSI'; +CREATE TABLE t1 ( + a INT, + b VARCHAR(10), + c CHAR(3) GENERATED ALWAYS AS (substr(b,1,3)) VIRTUAL, + PRIMARY KEY (a), + KEY c(c) +); +INSERT INTO t1(a, b) values(1, 'bbbb'), (2, 'cc'); +SHOW CREATE TABLE t1; +SELECT * FROM t1 order by a; + +SET sql_mode= ''; +FLUSH TABLE t1; +SHOW CREATE TABLE t1; +SELECT * FROM t1 order by a; +DELETE FROM t1 where a= 2; + +SET sql_mode= @sql_mode_save; +DROP TABLE t1; +--enable_warnings +} + + +--echo # +--echo # Bug#22680839: DEFAULT IS NOT DETERMINISTIC AND SHOULD NOT BE +--echo # ALLOWED IN GENERATED COLUMNS +--echo # +if ($support_virtual_index) +{ +CREATE TABLE tzz(a INT DEFAULT 5, + gc1 INT AS (a+DEFAULT(a)) VIRTUAL, + gc2 INT AS (a+DEFAULT(a)) STORED, + KEY k1(gc1)); +INSERT INTO tzz(A) VALUES (1); +SELECT * FROM tzz; +SELECT gc1 FROM tzz; + +ALTER TABLE tzz MODIFY COLUMN a INT DEFAULT 6; +SELECT * FROM tzz; +SELECT gc1 FROM tzz; +DROP TABLE tzz; +} + +--echo # Test 1: ALTER DEFAULT +--echo # +CREATE TABLE t1(a INT PRIMARY KEY DEFAULT 5, + b INT AS (1 + DEFAULT(a)) STORED, + c INT AS (1 + DEFAULT(a)) VIRTUAL); +INSERT INTO t1 VALUES (); +--disable_warnings +# Check how many rows are accessed: >0 = COPY +--enable_info +ALTER TABLE t1 ALTER COLUMN a SET DEFAULT 7; +ALTER TABLE t1 MODIFY COLUMN a INT DEFAULT 8; +ALTER TABLE t1 CHANGE COLUMN a a DOUBLE DEFAULT 5; +--disable_info +DROP TABLE t1; + +--echo # Test 2: ALTER DEFAULT + ADD GCOL +--echo # +CREATE TABLE t1(a INT PRIMARY KEY DEFAULT 5); +INSERT INTO t1 VALUES(); +--enable_info +ALTER TABLE t1 ALTER COLUMN a SET DEFAULT 7, + ADD COLUMN b1 INT AS (1 + DEFAULT(a)) STORED; +ALTER TABLE t1 ALTER COLUMN a SET DEFAULT 7, + ADD COLUMN c1 INT AS (1 + DEFAULT(a)) VIRTUAL; +--disable_info +# Check how many rows are accessed: >0 = COPY +--enable_info +ALTER TABLE t1 ALTER COLUMN a SET DEFAULT 7, + ADD COLUMN b INT AS (1 + DEFAULT(a)) STORED, + ADD COLUMN c INT AS (1 + DEFAULT(a)) VIRTUAL; +--disable_info +DROP TABLE t1; +--enable_warnings diff --git a/mysql-test/suite/gcol/inc/gcol_dependancies_on_vcol.inc b/mysql-test/suite/gcol/inc/gcol_dependancies_on_vcol.inc new file mode 100644 index 00000000000..5ef433097d9 --- /dev/null +++ b/mysql-test/suite/gcol/inc/gcol_dependancies_on_vcol.inc @@ -0,0 +1,43 @@ +################################################################################ +# inc/gcol_dependencies_on_gcol.inc # +# # +# Purpose: # +# Testing scenarios when columns depend on generated columns, i.e. such as # +# - a generated column is based on a generated column # +# - a "real" column on which a generated one is renamed/dropped # +# - a generated column involved in partitioning is renamed/dropped # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-02 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +--echo # Can't define a generated column on another generated column +--error ER_VCOL_BASED_ON_VCOL +create table t1 (a int, b int generated always as (a+1) virtual, c int generated always as (b+1) virtual); +create table t1 (a int, b int generated always as (a+1) virtual); +--error ER_VCOL_BASED_ON_VCOL +alter table t1 add column c int generated always as (b+1) virtual; +drop table t1; + +--echo # Can't rename or drop a column used in the function of a generated column +create table t1 (a int, b int generated always as (a+1) virtual); +--echo # On renaming/dropping a column on which a virtual field is +--echo # defined the following error is displayed: +--echo # "Unknown column 'a' in 'generated column function'" +--error 1054 +alter table t1 drop column a; +--error 1054 +alter table t1 change a c int; +drop table t1; + +--echo # Can't rename or drop a generated column used by the paritition function +create table t1 (a int, b int generated always as (a+1) virtual) partition by hash(b); +--error 1054 +alter table t1 drop b; +--error 1054 +alter table t1 change b c int generated always as (a+1) virtual; + diff --git a/mysql-test/suite/gcol/inc/gcol_handler.inc b/mysql-test/suite/gcol/inc/gcol_handler.inc new file mode 100644 index 00000000000..9ac6d5916ca --- /dev/null +++ b/mysql-test/suite/gcol/inc/gcol_handler.inc @@ -0,0 +1,77 @@ +################################################################################ +# inc/gcol_handler.inc # +# # +# Purpose: # +# Testing HANDLER. # +# # +# # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-04 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +create table t1 (a int, + b int generated always as (-a) virtual, + c int generated always as (-a) stored, + d char(1), + index (a), + index (c)); +insert into t1 (a,d) values (4,'a'), (2,'b'), (1,'c'), (3,'d'); +select * from t1; + +--echo # HANDLER tbl_name OPEN +handler t1 open; + +--echo # HANDLER tbl_name READ non-gcol_index_name > (value1,value2,...) +handler t1 read a > (2); + +--echo # HANDLER tbl_name READ non-gcol_index_name > (value1,value2,...) WHERE non-gcol_field=expr +handler t1 read a > (2) where d='c'; + +--echo # HANDLER tbl_name READ gcol_index_name = (value1,value2,...) +handler t1 read c = (-2); + +--echo # HANDLER tbl_name READ gcol_index_name = (value1,value2,...) WHERE non-gcol_field=expr +handler t1 read c = (-2) where d='c'; + +--echo # HANDLER tbl_name READ non-gcol_index_name > (value1,value2,...) WHERE gcol_field=expr +handler t1 read a > (2) where b=-3 && c=-3; + +--echo # HANDLER tbl_name READ gcol_index_name <= (value1,value2,...) +handler t1 read c <= (-2); + +--echo # HANDLER tbl_name READ gcol_index_name > (value1,value2,...) WHERE gcol_field=expr +handler t1 read c <= (-2) where b=-3; + +--echo # HANDLER tbl_name READ gcol_index_name FIRST +handler t1 read c first; + +--echo # HANDLER tbl_name READ gcol_index_name NEXT +handler t1 read c next; + +--echo # HANDLER tbl_name READ gcol_index_name PREV +handler t1 read c prev; + +--echo # HANDLER tbl_name READ gcol_index_name LAST +handler t1 read c last; + +--echo # HANDLER tbl_name READ FIRST where non-gcol=expr +handler t1 read FIRST where a >= 2; + +--echo # HANDLER tbl_name READ FIRST where gcol=expr +handler t1 read FIRST where b >= -2; + +--echo # HANDLER tbl_name READ NEXT where non-gcol=expr +handler t1 read NEXT where d='c'; + +--echo # HANDLER tbl_name READ NEXT where gcol=expr +handler t1 read NEXT where b<=-4; + +--echo # HANDLER tbl_name CLOSE +handler t1 close; + +drop table t1; diff --git a/mysql-test/suite/gcol/inc/gcol_ins_upd.inc b/mysql-test/suite/gcol/inc/gcol_ins_upd.inc new file mode 100644 index 00000000000..4b3431eea2e --- /dev/null +++ b/mysql-test/suite/gcol/inc/gcol_ins_upd.inc @@ -0,0 +1,610 @@ +################################################################################ +# inc/gcol_ins_upd.inc # +# # +# Purpose: # +# Testing DDL operations such as INSERT, UPDATE, REPLACE and DELETE. # +# # +# # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-04 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +let $create1 = create table t1 (a int, + b int generated always as (-a) virtual, + c int generated always as (-a) stored); +let $create2 = create table t1 (a int unique, + b int generated always as (-a) virtual, + c int generated always as (-a) stored); +let $create3 = create table t1 (a int, + b int generated always as (-a) virtual, + c int generated always as (-a) stored unique); +let $create4 = create table t1 (a int, + b int generated always as (-a) virtual, + c int generated always as (-a) stored unique, + d varchar(16)); +eval $create1; +set sql_warnings = 1; + +--echo # +--echo # *** INSERT *** +--echo # + +--echo # INSERT INTO tbl_name VALUES... DEFAULT is specified against gcols +insert into t1 values (1,default,default); +select * from t1; +delete from t1; +select * from t1; + +--echo # INSERT INTO tbl_name VALUES... NULL is specified against gcols +insert into t1 values (1,null,null); +select * from t1; +delete from t1; +select * from t1; + +--echo # INSERT INTO tbl_name VALUES... a non-NULL value is specified against gcols +insert into t1 values (1,2,3); +select * from t1; +delete from t1; +select * from t1; + +--echo # INSERT INTO tbl_name () VALUES... +insert into t1 (a) values (1), (2); +select * from t1 order by a; +delete from t1; +select * from t1; + +--echo # INSERT INTO tbl_name () VALUES... DEFAULT is specified +--echo # against gcols +insert into t1 (a,b) values (1,default), (2,default); +select * from t1 order by a; +delete from t1; +select * from t1; + +--echo # INSERT INTO tbl_name () VALUES... NULL is specified against gcols +insert into t1 (a,b) values (1,null), (2,null); +select * from t1; +delete from t1; +select * from t1; + +--echo # INSERT INTO tbl_name () VALUES... a non-NULL value is specified +--echo # against gcols +insert into t1 (a,b) values (1,3), (2,4); +select * from t1; +delete from t1; +select * from t1; +drop table t1; + +--echo # Table with UNIQUE non-gcol field. INSERT INTO tbl_name VALUES... ON DUPLICATE +--echo # KEY UPDATE =expr, =expr +eval $create2; +insert into t1 values (1,default,default); +insert into t1 values (1,default,default) + on duplicate key update a=2, b=default; +select a,b,c from t1; +delete from t1 where b in (1,2); +select * from t1; +drop table t1; + +--echo # Table with UNIQUE gcol field. INSERT INTO tbl_name VALUES... ON DUPLICATE +--echo # KEY UPDATE =expr, =expr +eval $create3; +insert into t1 values (1,default,default); +insert into t1 values (1,default,default) + on duplicate key update a=2, b=default; +select a,b,c from t1; + +--echo # CREATE new_table ... LIKE old_table +--echo # INSERT INTO new_table SELECT * from old_table +create table t2 like t1; +insert into t2(a) select a from t1; +select * from t2; +drop table t2; + +--echo # CREATE new_table ... LIKE old_table INSERT INTO new_table (, ) +--echo # SELECT , from old_table +insert into t1 values (1,default,default); +select * from t1; +create table t2 like t1; +insert into t2 (a) select a from t1; +select * from t2 order by a; +drop table t2; +drop table t1; + +--echo # +--echo # *** UPDATE *** +--echo # + +--echo # UPDATE tbl_name SET non-gcol=expr WHERE non-gcol=expr +eval $create1; +insert into t1 (a) values (1), (2); +select * from t1 order by a; +update t1 set a=3 where a=2; +select * from t1 order by a; +delete from t1; +select * from t1; + +--echo # UPDATE tbl_name SET gcol=expr WHERE non-gcol=expr +insert into t1 (a) values (1), (2); +select * from t1 order by a; +update t1 set c=3 where a=2; +select * from t1 order by a; +delete from t1; +select * from t1; + +--echo # UPDATE tbl_name SET non-gcol=expr WHERE gcol=expr +insert into t1 (a) values (1), (2); +select * from t1 order by a; +update t1 set a=3 where b=-2; +select * from t1 order by a; +delete from t1; +select * from t1; + +--echo # UPDATE tbl_name SET gcol=expr WHERE gcol=expr +insert into t1 (a) values (1), (2); +select * from t1 order by a; +update t1 set c=3 where b=-2; +select * from t1 order by a; +delete from t1; +select * from t1; +drop table t1; + +--echo # INDEX created on gcol +--echo # UPDATE tbl_name SET non-gcol=expr WHERE gcol=const +eval $create3; +insert into t1 (a) values (1), (2); +select * from t1 order by a; +update t1 set a=3 where c=-2; +select * from t1; +delete from t1; +select * from t1; + + +--echo # INDEX created on gcol +--echo # UPDATE tbl_name SET non-gcol=expr WHERE gcol=between const1 and const2 +insert into t1 (a) values (1), (2); +select * from t1 order by a; +update t1 set a=3 where c between -3 and -2; +select * from t1 order by a; +delete from t1; +select * from t1; + +--echo # No INDEX created on gcol +--echo # UPDATE tbl_name SET non-gcol=expr WHERE gcol=between const1 and const2 +insert into t1 (a) values (1), (2); +select * from t1 order by a; +update t1 set a=3 where b between -3 and -2; +select * from t1 order by a; +delete from t1; +select * from t1; + +--echo # INDEX created on gcol +--echo # UPDATE tbl_name SET non-gcol=expr +--echo # WHERE gcol=between const1 and const2 ORDER BY gcol +insert into t1 (a) values (1), (2), (3), (4), (5); +select * from t1 order by a; +update t1 set a=6 where c between -1 and 0 + order by c; +select * from t1 order by a; +delete from t1 where c between -6 and 0; +select * from t1; + +--echo # INDEX created on gcol +--echo # UPDATE tbl_name SET non-gcol=expr +--echo # WHERE gcol=between const1 and const2 ORDER BY gcol LIMIT 2 +insert into t1 (a) values (1), (2), (3), (4), (5); +select * from t1 order by a; +update t1 set a=6 where c between -1 and 0 + order by c limit 2; +select * from t1 order by a; +delete from t1 where c between -2 and 0 order by c; +select * from t1 order by a; +delete from t1; + +--echo # INDEX created on gcol +--echo # UPDATE tbl_name SET non-gcol=expr +--echo # WHERE indexed gcol=between const1 and const2 and non-indexed gcol=const3 +insert into t1 (a) values (1), (2), (3), (4), (5); +select * from t1 order by a; +update t1 set a=6 where (c between -2 and 0) and (b=-1); +select * from t1 order by a; +delete from t1; + +--echo # INDEX created on gcol +--echo # UPDATE tbl_name SET non-gcol=expr +--echo # WHERE indexed gcol=between const1 and const2 and non-indexed gcol=const3 +--echo # ORDER BY indexed gcol +insert into t1 (a) values (1), (2), (3), (4), (5); +select * from t1 order by a; +update t1 set a=6 where (c between -2 and 0) and (b=-1) order by c; +select * from t1 order by a; +delete from t1; +drop table t1; + +let $innodb_engine = `SELECT @@session.default_storage_engine='innodb'`; +if ($innodb_engine) +{ + --echo # + --echo # Verify ON UPDATE/DELETE actions of FOREIGN KEYs + create table t2 (a int primary key, name varchar(10)); + create table t1 (a int primary key, b int generated always as (a % 10) stored); + insert into t2 values (1, 'value1'), (2,'value2'), (3,'value3'); + insert into t1 (a) values (1),(2),(3); + select * from t1 order by a; + select * from t2 order by a; + select t1.a, t1.b, t2.name from t1,t2 where t1.b=t2.a order by t1.a; + + --echo # - ON UPDATE RESTRICT + alter table t1 add foreign key (b) references t2(a) on update restrict; + --error 1452 + insert into t1 (a) values (4); + --error 1451 + update t2 set a=4 where a=3; + select t1.a, t1.b, t2.name from t1,t2 where t1.b=t2.a; + alter table t1 drop foreign key t1_ibfk_1; + + --echo # - ON DELETE RESTRICT + alter table t1 add foreign key (b) references t2(a) on delete restrict; + --error 1451 + delete from t2 where a=3; + select t1.a, t1.b, t2.name from t1,t2 where t1.b=t2.a; + select t1.a, t1.b, t2.name from t1 left outer join t2 on (t1.b=t2.a); + alter table t1 drop foreign key t1_ibfk_1; + + --echo # - ON DELETE CASCADE + alter table t1 add foreign key (b) references t2(a) on delete cascade; + delete from t2 where a=3; + select t1.a, t1.b, t2.name from t1,t2 where t1.b=t2.a; + select t1.a, t1.b, t2.name from t1 left outer join t2 on (t1.b=t2.a); + alter table t1 drop foreign key t1_ibfk_1; + + drop table t1; + drop table t2; +} + +--echo # +--echo # *** REPLACE *** +--echo # + +--echo # UNIQUE INDEX on gcol +--echo # REPLACE tbl_name (non-gcols) VALUES (non-gcols); +eval $create4; +insert into t1 (a,d) values (1,'a'), (2,'b'); +select * from t1 order by a; +replace t1 (a,d) values (1,'c'); +select * from t1 order by a; +delete from t1; +select * from t1; + + +# *** DELETE +# All required tests for DELETE are performed as part of the above testing +# for INSERT, UPDATE and REPLACE. + +set sql_warnings = 0; +drop table t1; + +if ($innodb_engine) { +--echo Bug#20170778: WL411:FAILING ASSERTION `!TABLE || (!TABLE->WRITE_SET || +--echo BITMAP_IS_SET(TABLE->WR +--echo # +CREATE TABLE t1 (col1 INT, col2 INT, col3 INT, col4 INT, col5 +INT GENERATED ALWAYS AS (col3 * col2) VIRTUAL, col6 INT GENERATED ALWAYS AS +(col4 * col1) STORED, col7 INT GENERATED ALWAYS AS (col6 + col6) VIRTUAL, +col8 INT GENERATED ALWAYS AS (col6 / col5) STORED, col9 TEXT); + +SET @fill_amount = (@@innodb_page_size / 2 ) + 1; + +INSERT INTO t1 (col1,col2,col3,col4,col5,col6,col7,col8,col9) VALUES /* 3 */ +(3, 3 / 3, 3 + 3, 3 / 3, DEFAULT, DEFAULT, DEFAULT, DEFAULT ,REPEAT(CAST(3 AS +CHAR(1)),@fill_amount)) , (3, 3 * 3, 3 + 3, 3 / 3, DEFAULT, DEFAULT, DEFAULT, +DEFAULT ,REPEAT(CAST(3 AS CHAR(1)),@fill_amount)); + +UPDATE t1 SET col1 = 2; +UPDATE t1 SET col7 = DEFAULT; +UPDATE t1 SET col8 = DEFAULT; +DROP TABLE t1; +} + +if ($support_virtual_index) +{ +--echo Bug#20797344: WL#8149: ALLOCATED SPACE FOR INDEXED BLOB VGC CAN BE +--echo OVERWRITTEN FOR UPDATE +--echo # +CREATE TABLE t (a varchar(100), b blob, +c blob GENERATED ALWAYS AS (concat(a,b)) VIRTUAL, +d blob GENERATED ALWAYS AS (b) VIRTUAL, +e int(11) GENERATED ALWAYS AS (10) VIRTUAL, +h int(11) NOT NULL, PRIMARY KEY (h), key(c(20))); +INSERT INTO t(a,b,h) VALUES('aaaaaaa','1111111', 11); +INSERT INTO t(a,b,h) VALUES('bbbbbbb','2222222', 22); +SELECT c FROM t; +UPDATE t SET a='ccccccc'; +SELECT c FROM t; +DROP TABLE t; +} + +--echo # Bug#21081742: ASSERTION !TABLE || (!TABLE->WRITE_SET || +--echo # BITMAP_IS_SET(TABLE->WRITE_SET +--echo # + +CREATE TABLE b ( +pk INTEGER AUTO_INCREMENT, +col_varchar_nokey VARCHAR(1), +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)), +PRIMARY KEY (pk) +); + +INSERT INTO b (col_varchar_nokey) VALUES ('v'),('v'); + +CREATE TABLE d ( +pk INTEGER AUTO_INCREMENT, +col_varchar_nokey VARCHAR(1), +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)), +PRIMARY KEY (pk) +) ; + +INSERT INTO d (col_varchar_nokey) VALUES ('q'),('g'),('e'),('l'),(NULL),('v'),('c'),('u'),('x'); + +CREATE TABLE bb ( +pk INTEGER AUTO_INCREMENT, +col_varchar_nokey VARCHAR(1) /*! NULL */, +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)), +PRIMARY KEY (pk) +); + +INSERT INTO bb (col_varchar_nokey) VALUES ('j'),('h'); + +EXPLAIN UPDATE +d AS OUTR1, b AS OUTR2 +SET OUTR1.col_varchar_nokey = NULL +WHERE +( 't', 'b' ) IN +( +SELECT +INNR1.col_varchar_nokey AS x, +INNR1.col_varchar_key AS y +FROM bb AS INNR1 +WHERE OUTR1.pk = 1 +); + +DROP TABLE IF EXISTS b,bb,d; + + +--echo # +--echo # Bug#21216067 ASSERTION FAILED ROW_UPD_SEC_INDEX_ENTRY (INNOBASE/ROW/ROW0UPD.CC:2103) +--echo # + +CREATE TABLE t ( +x INT, y INT, gc INT GENERATED ALWAYS AS (x+1) STORED +); +INSERT INTO t VALUES (); +UPDATE t t1, t t2 SET t2.y = 1, t1.x = 2; +SELECT * FROM t; +DROP TABLE t; + +if ($support_virtual_index) +{ +CREATE TABLE t ( +x INT, y INT, gc INT GENERATED ALWAYS AS (x+1), KEY (x,gc) +); +INSERT INTO t VALUES (); +UPDATE t t1, t t2 SET t1.x = 1, t2.y = 2; +SELECT * FROM t; +SELECT gc FROM t; +CHECK TABLE t; +DROP TABLE t; +} + +let $query= +UPDATE C AS OUTR1, C AS OUTR2 +SET OUTR1.`col_varchar_nokey` = 'f', +OUTR2.`col_varchar_nokey` = "a"; + +--echo # stored + +CREATE TABLE C ( +col_varchar_nokey VARCHAR(1), +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)) STORED +); + +INSERT INTO C (col_varchar_nokey) VALUES ('c'); +eval EXPLAIN $query; +eval $query; +SELECT * from C; +DROP TABLE C; + +--echo # stored, indexed + +CREATE TABLE C ( +col_varchar_nokey VARCHAR(1), +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)) STORED, +KEY (col_varchar_key, col_varchar_nokey) +); + +INSERT INTO C (col_varchar_nokey) VALUES ('c'); +eval EXPLAIN $query; +eval $query; +SELECT * from C; +DROP TABLE C; + +--echo # virtual + +CREATE TABLE C ( +col_varchar_nokey VARCHAR(1), +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)) VIRTUAL +); + +INSERT INTO C (col_varchar_nokey) VALUES ('c'); +eval EXPLAIN $query; +eval $query; +SELECT * from C; +DROP TABLE C; + +if ($support_virtual_index) +{ +--echo # virtual, indexed + +CREATE TABLE C ( +col_varchar_nokey VARCHAR(1), +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)) VIRTUAL, +KEY (col_varchar_key, col_varchar_nokey) +); + +INSERT INTO C (col_varchar_nokey) VALUES ('c'); +eval EXPLAIN $query; +eval $query; +SELECT * from C; +DROP TABLE C; + +--echo # +--echo # Bug #21530366 CRASH/ASSERTION, CORRUPTION WITH INDEXES + +--echo # VIRTUAL COLUMNS, BLOB +--echo # + +CREATE TABLE t ( + a INTEGER, + b BLOB GENERATED ALWAYS AS (a) VIRTUAL, + INDEX (b(57)) +); + +INSERT INTO t (a) VALUES (9); +UPDATE t SET a = 10; +DELETE FROM t WHERE a = 10; + +DROP TABLE t; + +--echo # Bug#21807818: Generated columns not updated with empty insert list + +CREATE TABLE t ( +a BLOB GENERATED ALWAYS AS ('') VIRTUAL, +b TIMESTAMP(4) GENERATED ALWAYS AS ('') VIRTUAL, +KEY (a(183),b) +); + +INSERT INTO t VALUES(), (), (); + +DELETE IGNORE FROM t; + +DROP TABLE t; + +--echo # +--echo # Bug#22195458:GCOLS: ASSERTION 0 AND CORRUPTION... +--echo # +--disable_warnings +CREATE TABLE t ( + a INT, + b YEAR GENERATED ALWAYS AS ('a') VIRTUAL, + c YEAR GENERATED ALWAYS AS ('aaaa') VIRTUAL, + b1 YEAR GENERATED ALWAYS AS ('a') STORED, + c1 YEAR GENERATED ALWAYS AS ('aaaa') STORED, + UNIQUE(b), + UNIQUE(b1) +); +INSERT INTO t VALUES(); +SELECT b from t; +SELECT b1 from t; +SELECT * from t; +DELETE FROM t; +CHECK TABLE t EXTENDED; +DROP TABLE t; +--enable_warnings + +--echo # Bug#22195364:GCOLS: FAILING ASSERTION: +--echo # DFIELD_IS_NULL(DFIELD2) || DFIELD2->DATA +CREATE TABLE t ( + a INT, + c BLOB GENERATED ALWAYS AS ('') VIRTUAL, + UNIQUE KEY(c(1),a) +); +INSERT INTO t(a) VALUES(1) ON DUPLICATE KEY UPDATE a=2; +SELECT * FROM t; +INSERT INTO t(a) VALUES(1) ON DUPLICATE KEY UPDATE a=2; +SELECT * FROM t; +# Test Field_blob::store_to_mem +SELECT GROUP_CONCAT(c ORDER BY c) FROM t; +DROP TABLE t; +} + +--echo #Bug#21929967:GCOLS:GCOL VALUE CHANGES WHEN SESSION CHANGES SQL_MODE +CREATE TABLE t(c1 INT GENERATED ALWAYS AS (1) VIRTUAL, + c2 INT GENERATED ALWAYS AS(2) STORED); +INSERT INTO t VALUES(DEFAULT, DEFAULT); +SELECT * FROM t; +CREATE TABLE t1(c1 INT, c2 INT GENERATED ALWAYS AS(c1 + 1) STORED); +INSERT INTO t1(c2) VALUES(DEFAULT); +SELECT * FROM t1; +CREATE TABLE t2(c1 INT DEFAULT 1, c2 INT GENERATED ALWAYS AS(c1 + 1) STORED); +INSERT INTO t2(c2) VALUES(DEFAULT); +SELECT * FROM t2; +DROP TABLE t, t1, t2; + +--echo # Bug#22179637: INSERT INTO TABLE FROM SELECT ACCEPTS TO INSERT INTO +--echo # GENERATED COLUMNS +CREATE TABLE t1 ( + i1 INTEGER, + i2 INTEGER GENERATED ALWAYS AS (i1 + i1) +); +INSERT INTO t1 (i1) SELECT 5; +INSERT INTO t1 (i1) SELECT 5 ON DUPLICATE KEY UPDATE i2= DEFAULT; +SELECT * FROM t1; + +CREATE TABLE t2 ( + i1 INTEGER, + i2 INTEGER GENERATED ALWAYS AS (i1 + i1) STORED +); +INSERT INTO t2 (i1) SELECT 5; +INSERT INTO t2 (i1) SELECT 5 ON DUPLICATE KEY UPDATE i2= DEFAULT; +SELECT * FROM t2; + +DROP TABLE t1,t2; + +if ($support_virtual_index) +{ + +--echo # +--echo # Bug#22070021 GCOL:ASSERTION `!TABLE || (!TABLE->WRITE_SET || +--echo # BITMAP_IS_SET(TABLE->WRITE_SET, +--echo # + +CREATE TABLE t1( +c1 INT, +c2 INT GENERATED ALWAYS AS (c1 + c1) VIRTUAL, +KEY(c2) +); + +INSERT INTO t1(c1) VALUES(0); +DELETE O1.* FROM t1 AS O1, t1 AS O2; +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # Bug#21944199 SIMPLE DELETE QUERY CAUSES INNODB: FAILING ASSERTION: 0 +--echo # & DATA CORRUPTION +--echo # + +CREATE TEMPORARY TABLE t1 ( + a INTEGER NOT NULL, + b INTEGER GENERATED ALWAYS AS (a+1) VIRTUAL +); + +INSERT INTO t1 (a) VALUES (0), (0), (0); + +ALTER TABLE t1 ADD INDEX idx (b); + +DELETE FROM t1; + +DROP TEMPORARY TABLE t1; + +} diff --git a/mysql-test/suite/gcol/inc/gcol_keys.inc b/mysql-test/suite/gcol/inc/gcol_keys.inc new file mode 100644 index 00000000000..7f888ef54a5 --- /dev/null +++ b/mysql-test/suite/gcol/inc/gcol_keys.inc @@ -0,0 +1,767 @@ +################################################################################ +# inc/gcol_keys.inc # +# # +# Purpose: # +# Testing keys, indexes defined upon generated columns. # +# # +# # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-02 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +if (!$support_virtual_index) { + let $skip_spatial_index_check=1; + let $skip_foreign_key_check=1; +} + +--echo # - UNIQUE KEY +--echo # - INDEX +--echo # - FULLTEXT INDEX +--echo # - SPATIAL INDEX (not supported) +--echo # - FOREIGN INDEX (partially supported) +--echo # - CHECK (allowed but not used) + +--echo # UNIQUE +if($support_virtual_index) +{ +create table t1 (a int, b int generated always as (a*2) virtual unique); +show create table t1; +describe t1; +drop table t1; +} +create table t1 (a int, b int generated always as (a*2) stored unique); +show create table t1; +describe t1; +drop table t1; + +if($support_virtual_index) +{ +create table t1 (a int, b int generated always as (a*2) virtual, unique key (b)); +show create table t1; +describe t1; +drop table t1; +} +create table t1 (a int, b int generated always as (a*2) stored, unique (b)); +show create table t1; +describe t1; +drop table t1; + +if($support_virtual_index) +{ +create table t1 (a int, b int generated always as (a*2) virtual); +alter table t1 add unique key (b); +drop table t1; +} +create table t1 (a int, b int generated always as (a*2) stored); +alter table t1 add unique key (b); +drop table t1; + +--echo # Testing data manipulation operations involving UNIQUE keys +--echo # on generated columns can be found in: +--echo # - gcol_ins_upd.inc +--echo # - gcol_select.inc + +--echo # +--echo # INDEX +if($support_virtual_index) +{ +create table t1 (a int, b int generated always as (a*2) virtual, index (b)); +show create table t1; +describe t1; +drop table t1; + +create table t1 (a int, b int generated always as (a*2) virtual, index (a,b)); +drop table t1; +} + +create table t1 (a int, b int generated always as (a*2) stored, index (b)); +show create table t1; +describe t1; +drop table t1; + +create table t1 (a int, b int generated always as (a*2) stored, index (a,b)); +show create table t1; +describe t1; +drop table t1; + +if($support_virtual_index) +{ +create table t1 (a int, b int generated always as (a*2) virtual); +alter table t1 add index (b); + +alter table t1 add index (a,b); +drop table t1; +} + +create table t1 (a int, b int generated always as (a*2) stored); +alter table t1 add index (b); +drop table t1; + +create table t1 (a int, b int generated always as (a*2) stored); +alter table t1 add index (a,b); +create table t2 like t1; +drop table t2; +drop table t1; + +--echo # Testing data manipulation operations involving INDEX +--echo # on generated columns can be found in: +--echo # - gcol_select.inc + +--echo # +--echo # TODO: FULLTEXT INDEX + +--echo # SPATIAL INDEX +if (!$skip_spatial_index_check) +{ + --echo # Error "All parts of a SPATIAL index must be geometrical" + --error ER_WRONG_ARGUMENTS + create table t1 (a int, b int generated always as (a+1) stored, spatial index (b)); + create table t1 (a int, b int generated always as (a+1) stored); + --error ER_WRONG_ARGUMENTS + alter table t1 add spatial index (b); + drop table t1; +} + +--echo # FOREIGN KEY + +--echo # Rejected FK options. +--error ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN +create table t1 (a int, b int generated always as (a+1) stored, + foreign key (b) references t2(a) on update set null); +--error ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN +create table t1 (a int, b int generated always as (a+1) stored, + foreign key (b) references t2(a) on update cascade); +--error ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN +create table t1 (a int, b int generated always as (a+1) stored, + foreign key (b) references t2(a) on delete set null); + +create table t1 (a int, b int generated always as (a+1) stored); +--error ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN +alter table t1 add foreign key (b) references t2(a) on update set null; +--error ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN +alter table t1 add foreign key (b) references t2(a) on update cascade; +--error ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN +alter table t1 add foreign key (b) references t2(a) on delete set null; +drop table t1; + +if(!$skip_foreign_key_check) +{ +--error ER_CANT_CREATE_TABLE +create table t1 (a int, b int generated always as (a+1) virtual, + foreign key (b) references t2(a)); + +create table t1 (a int, b int generated always as (a+1) virtual); +--replace_regex /`#sql-.*`/`#sql-temporary`/ +--error ER_CANT_CREATE_TABLE +alter table t1 add foreign key (b) references t2(a); +drop table t1; +} + +--echo # Allowed FK options. +create table t2 (a int primary key, b char(5)); +create table t1 (a int, b int generated always as (a % 10) stored, + foreign key (b) references t2(a) on update restrict); +drop table t1; +create table t1 (a int, b int generated always as (a % 10) stored, + foreign key (b) references t2(a) on update no action); +drop table t1; +create table t1 (a int, b int generated always as (a % 10) stored, + foreign key (b) references t2(a) on delete restrict); +drop table t1; +create table t1 (a int, b int generated always as (a % 10) stored, + foreign key (b) references t2(a) on delete cascade); +drop table t1; +create table t1 (a int, b int generated always as (a % 10) stored, + foreign key (b) references t2(a) on delete no action); +drop table t1,t2; + +if($support_virtual_index) +{ +--echo # +--echo # Bug#20553262: WL8149: ASSERTION `DELSUM+(INT) Y/4-TEMP >= 0' FAILED +--echo # +CREATE TABLE c ( +pk integer AUTO_INCREMENT, +col_datetime_nokey DATETIME /*! NULL */, +col_time_nokey TIME /*! NULL */, +col_datetime_key DATETIME GENERATED ALWAYS AS +(ADDTIME(col_datetime_nokey, col_time_nokey)), +col_time_key TIME GENERATED ALWAYS AS +(ADDTIME(col_datetime_nokey, col_time_nokey)), +col_varchar_nokey VARCHAR(1) /*! NULL */, +PRIMARY KEY (pk), +KEY (col_time_key), +KEY (col_datetime_key)); + +INSERT INTO c ( col_time_nokey,col_datetime_nokey,col_varchar_nokey) values +('14:03:03.042673','2001-11-28 00:50:27.051028', 'c'), +('01:46:09.016386','2007-10-09 19:53:04.008332', NULL), +('16:21:18.052408','2001-11-08 21:02:12.009395', 'x'), +('18:56:33.027423','2003-04-01 00:00:00', 'i'); + +--replace_column 10 x 11 x +EXPLAIN SELECT +outr.col_time_key AS x +FROM c as outr +WHERE +outr.col_varchar_nokey in ('c', 'x', 'i') +AND (outr.col_time_key IS NULL OR + outr.col_datetime_key = '2009-09-27'); + +SELECT +outr.col_time_key AS x +FROM c AS outr +WHERE +outr.col_varchar_nokey in ('c', 'x', 'i') +AND (outr.col_time_key IS NULL OR + outr.col_datetime_key = '2009-09-27'); + +DROP TABLE c; + +--echo # +--echo # Bug#20913803: WL8149: SIG 11 IN DFIELD_DUP | +--echo # INNOBASE/INCLUDE/DATA0DATA.IC:253 +--echo # +CREATE TABLE A ( +col_varchar_nokey TEXT , +col_varchar_key TEXT GENERATED ALWAYS AS (REPEAT(col_varchar_nokey, 1000)), +KEY (col_varchar_key(50)) +); + +INSERT INTO A (col_varchar_nokey) VALUES (''); + +CREATE TABLE D ( +pk INTEGER AUTO_INCREMENT, +col_date_nokey BLOB, +col_date_key BLOB GENERATED ALWAYS AS (REPEAT(col_date_nokey,1000)) VIRTUAL, +col_datetime_nokey LONGBLOB, +col_time_nokey LONGTEXT, + +col_datetime_key LONGBLOB GENERATED ALWAYS AS (REPEAT(col_datetime_nokey, 1000)), +col_time_key LONGTEXT GENERATED ALWAYS AS (REPEAT(col_datetime_nokey, 1000)), + +col_varchar_nokey TEXT, +col_varchar_key TEXT GENERATED ALWAYS AS (REPEAT(col_varchar_nokey, 1000)), + +PRIMARY KEY (pk), +KEY (col_varchar_key(50)), +KEY (col_date_key(20)), +KEY (col_time_key(20)), +KEY (col_datetime_key(20)), +KEY (col_varchar_key(10), col_date_key(10), col_time_key(5), col_datetime_key(5)) +); + +INSERT INTO D ( +col_date_nokey, +col_time_nokey, +col_datetime_nokey, +col_varchar_nokey +) VALUES ('', '', '', ''),('', '', '', ''); + +DELETE FROM OUTR1.* USING D AS OUTR1 RIGHT JOIN A AS OUTR2 ON +( OUTR1 . `col_varchar_nokey` = OUTR2 . `col_varchar_nokey` ); + +DROP TABLE IF EXISTS A,D; +--echo # +--echo # Bug#21024896: SIG 11 INNOBASE_ADD_ONE_VIRTUAL | +--echo # INNOBASE/HANDLER/HANDLER0ALTER.CC +--echo # +CREATE TABLE t1 ( + col1 int(11) DEFAULT NULL, + col2 int(11) DEFAULT NULL, + col3 int(11) NOT NULL, + col4 int(11) DEFAULT NULL, + col5 int(11) GENERATED ALWAYS AS (col2 / col2) VIRTUAL, + col7 int(11) GENERATED ALWAYS AS (col5 + col5) VIRTUAL, + col8 int(11) GENERATED ALWAYS AS (col5 * col5) VIRTUAL, + col9 text, + col6 int(11) DEFAULT NULL, + PRIMARY KEY (`col3`), + UNIQUE KEY uidx (`col2`), + KEY idx (`col5`) +); + +INSERT INTO t1(col1,col2,col3,col4,col9,col6) +VALUES(1,1,0,1,REPEAT(col1,1000),0), (3,2,1,1,REPEAT(col1,1000),NULL); + +ALTER TABLE t1 ADD COLUMN extra INT; +DROP TABLE t1; + + +--echo # +--echo # Bug#21316860: WL8149:INNODB: FAILING ASSERTION: +--echo # TEMPL->CLUST_REC_FIELD_NO != ULINT_UNDEFINED +--echo # +CREATE TABLE t1 ( + pk int(11) NOT NULL, + col_int_nokey int(11), + col_int_key int(11) GENERATED ALWAYS AS (col_int_nokey) VIRTUAL, + col_date_nokey date, + col_date_key date GENERATED ALWAYS AS (col_date_nokey) VIRTUAL, + PRIMARY KEY (pk), + UNIQUE KEY col_int_key (col_int_key) +); + +ALTER TABLE t1 DROP COLUMN pk; +DROP TABLE t1; + +--echo # Remove the impact on PK choose by index on virtual generated column +CREATE TABLE t1 ( + pk int(11) NOT NULL, + col_int_nokey int(11) DEFAULT NULL, + col_int_key int(11) GENERATED ALWAYS AS (col_int_nokey) VIRTUAL, + UNIQUE KEY col_int_key (col_int_key) +); + +ALTER TABLE t1 add unique index idx(pk); +DESC t1; +DROP TABLE t1; + +--echo # +--echo # Bug#21346132: WL8149:INNODB: FAILING ASSERTION: +--echo # PRIMARY_KEY_NO == -1 || PRIMARY_KEY_NO == 0 +--echo # +CREATE TABLE t1 ( + col_int_nokey int(11) NOT NULL, + col_int_key int(11) GENERATED ALWAYS AS (col_int_nokey), + col_varchar_nokey varchar(1) NOT NULL, + col_varchar_key varchar(2) GENERATED ALWAYS AS (col_varchar_nokey), + UNIQUE KEY col_int_key (col_int_key), + UNIQUE KEY col_varchar_key (col_varchar_key), + UNIQUE KEY col_int_key_2 (col_int_key,col_varchar_key), + UNIQUE KEY col_varchar_key_2 (col_varchar_key,col_varchar_nokey), + KEY col_int_key_3 (col_int_key,col_int_nokey) +); + +ALTER TABLE t1 DROP COLUMN col_varchar_key; +DROP TABLE t1; +--echo # +--echo # Bug#21320151 WL8149: WRONG RESULT WITH INDEX SCAN +--echo # + +CREATE TABLE t1 ( + id INTEGER NOT NULL, + b INTEGER GENERATED ALWAYS AS (id+1) VIRTUAL, + UNIQUE KEY (b) +); + +INSERT INTO t1 (id) VALUES (2),(3),(4),(5),(6),(7),(8),(9),(10); + +--disable_query_log +--disable_result_log +ANALYZE TABLE t1; +--enable_result_log +--enable_query_log + +# covering index scan +let query= SELECT b FROM t1 FORCE INDEX(b); +eval EXPLAIN $query; +eval $query; + +# range scan +let $query= SELECT b FROM t1 FORCE INDEX(b) WHERE b BETWEEN 1 AND 5; +eval EXPLAIN $query; +eval $query; + +DROP TABLE t1; + +} +--echo +--echo # Testing data manipulation operations involving FOREIGN KEY +--echo # on generated columns can be found in: +--echo # - gcol_ins_upd.inc +--echo # - gcol_select.inc + +--echo # +--echo # TODO: CHECK + +--echo # +--echo # Test how optimizer picks indexes defined on a GC +--echo # +CREATE TABLE t1 (f1 int, gc int AS (f1 + 1) STORED, UNIQUE(gc)); +INSERT INTO t1(f1) VALUES (1),(2),(0),(9),(3),(4),(8),(7),(5),(6); +ANALYZE TABLE t1; +--echo # Should use index +--sorted_result +SELECT * FROM t1 WHERE f1 + 1 > 7; +EXPLAIN SELECT * FROM t1 WHERE f1 + 1 > 7; + +SELECT * FROM t1 WHERE f1 + 1 = 7; +EXPLAIN SELECT * FROM t1 WHERE f1 + 1 = 7; +--sorted_result +SELECT * FROM t1 WHERE f1 + 1 IN (7,5); +EXPLAIN SELECT * FROM t1 WHERE f1 + 1 IN(7,5); +--sorted_result +SELECT * FROM t1 WHERE f1 + 1 BETWEEN 5 AND 7; +EXPLAIN SELECT * FROM t1 WHERE f1 + 1 BETWEEN 5 AND 7; + +--echo # Check that expression isn't transformed for a disabled key +--sorted_result +SELECT * FROM t1 IGNORE KEY (gc) WHERE f1 + 1 BETWEEN 5 AND 7; +EXPLAIN SELECT * FROM t1 IGNORE KEY (gc) WHERE f1 + 1 BETWEEN 5 AND 7; + +--echo # Check that ORDER BY could be optimized +SELECT * FROM t1 ORDER BY f1 + 1; +EXPLAIN SELECT * FROM t1 ORDER BY f1 + 1; +EXPLAIN SELECT * FROM t1 IGNORE KEY (gc) ORDER BY f1 + 1; + +--echo # Check that GROUP BY could be optimized +SELECT f1 + 1, MAX(GC) FROM t1 GROUP BY f1 + 1; +EXPLAIN SELECT f1 + 1, MAX(GC) FROM t1 GROUP BY f1 + 1; +EXPLAIN SELECT f1 + 1, MAX(GC) + FROM t1 IGNORE KEY (gc) GROUP BY f1 + 1; + +--echo # Shouldn't use index +--sorted_result +SELECT * FROM t1 WHERE f1 + 1 > 7.0; +EXPLAIN SELECT * FROM t1 WHERE f1 + 1 > 7.0; + +DROP TABLE t1; +--echo # Pick index with proper type +CREATE TABLE t1 (f1 int, + gc_int int AS (f1 + 1) STORED, + gc_date DATE AS (f1 + 1) STORED, + KEY gc_int_idx(gc_int), + KEY gc_date_idx(gc_date)); +INSERT INTO t1(f1) VALUES + (030303),(040404), + (050505),(060606), + (010101),(020202), + (030303),(040404), + (050505),(060606), + (010101),(020202), + (090909),(101010), + (010101),(020202), + (070707),(080808); +ANALYZE TABLE t1; + +--sorted_result +SELECT * FROM t1 WHERE f1 + 1 > 070707; +--echo # INT column & index should be picked +EXPLAIN SELECT * FROM t1 WHERE f1 + 1 > 070707; +--sorted_result +SELECT * FROM t1 WHERE f1 + 1 > CAST(070707 AS DATE); +--echo # DATE column & index should be picked +EXPLAIN SELECT * FROM t1 WHERE f1 + 1 > CAST(070707 AS DATE); + +DROP TABLE t1; + +--echo # +--echo # BUG#21229846: WL8170: SIGNAL 11 IN JOIN::MAKE_SUM_FUNC_LIST +--echo # +CREATE TABLE t1 ( + pk int primary key auto_increment, + col_int_key INTEGER , + col_int_gc_key INT GENERATED ALWAYS AS (col_int_key + 1) STORED, + KEY col_int_gc_key(col_int_gc_key) +); + +INSERT INTO t1 ( col_int_key) VALUES (7); + +ANALYZE TABLE t1; + +SELECT table1.col_int_key + 1 AS field1, table2.col_int_key AS field2 + FROM (t1 AS table1 JOIN t1 AS table2 ON (table2.pk = table1.pk)) + ORDER BY field1, field2; + +EXPLAIN SELECT table1.col_int_key + 1 AS field1, table2.col_int_key AS field2 + FROM (t1 AS table1 JOIN t1 AS table2 ON (table2.pk = table1.pk)) + ORDER BY field1, field2; + +SELECT table1.col_int_key + 1 AS field1, table2.col_int_key AS field2 + FROM (t1 AS table1 JOIN t1 AS table2 ON (table2.pk = table1.pk)) + GROUP BY field1, field2; + +EXPLAIN SELECT table1.col_int_key + 1 AS field1, table2.col_int_key AS field2 + FROM (t1 AS table1 JOIN t1 AS table2 ON (table2.pk = table1.pk)) + GROUP BY field1, field2; + +DROP TABLE t1; + +if($support_virtual_index) +{ +--echo # +--echo # Bug#21391781 ASSERT WHEN RUNNING ALTER TABLE ON A TABLE WITH INDEX +--echo # ON VIRTUAL COLUMN +--echo # + +# +# Test 1: column number 2 and 66 are virtual and there is an index +# on column number 2. +# +CREATE TABLE t1 ( + col1 INTEGER NOT NULL, + col2 INTEGER NOT NULL, + gcol1 INTEGER GENERATED ALWAYS AS (col1 + col2) VIRTUAL, + col3 INTEGER NOT NULL, + col4 INTEGER NOT NULL, + col5 INTEGER DEFAULT NULL, + col6 INTEGER DEFAULT NULL, + col7 INTEGER DEFAULT NULL, + col8 INTEGER DEFAULT NULL, + col9 INTEGER DEFAULT NULL, + col10 INTEGER DEFAULT NULL, + col11 INTEGER DEFAULT NULL, + col12 INTEGER DEFAULT NULL, + col13 INTEGER DEFAULT NULL, + col14 INTEGER DEFAULT NULL, + col15 INTEGER DEFAULT NULL, + col16 INTEGER DEFAULT NULL, + col17 INTEGER DEFAULT NULL, + col18 INTEGER DEFAULT NULL, + col19 INTEGER DEFAULT NULL, + col20 INTEGER DEFAULT NULL, + col21 INTEGER DEFAULT NULL, + col22 INTEGER DEFAULT NULL, + col23 INTEGER DEFAULT NULL, + col24 INTEGER DEFAULT NULL, + col25 INTEGER DEFAULT NULL, + col26 INTEGER DEFAULT NULL, + col27 INTEGER DEFAULT NULL, + col28 INTEGER DEFAULT NULL, + col29 INTEGER DEFAULT NULL, + col30 INTEGER DEFAULT NULL, + col31 INTEGER DEFAULT NULL, + col32 INTEGER DEFAULT NULL, + col33 INTEGER DEFAULT NULL, + col34 INTEGER DEFAULT NULL, + col35 INTEGER DEFAULT NULL, + col36 INTEGER DEFAULT NULL, + col37 INTEGER DEFAULT NULL, + col38 INTEGER DEFAULT NULL, + col39 INTEGER DEFAULT NULL, + col40 INTEGER DEFAULT NULL, + col41 INTEGER DEFAULT NULL, + col42 INTEGER DEFAULT NULL, + col43 INTEGER DEFAULT NULL, + col44 INTEGER DEFAULT NULL, + col45 INTEGER DEFAULT NULL, + col46 INTEGER DEFAULT NULL, + col47 INTEGER DEFAULT NULL, + col48 INTEGER DEFAULT NULL, + col49 INTEGER DEFAULT NULL, + col50 INTEGER DEFAULT NULL, + col51 INTEGER DEFAULT NULL, + col52 INTEGER DEFAULT NULL, + col53 INTEGER DEFAULT NULL, + col54 INTEGER DEFAULT NULL, + col55 INTEGER DEFAULT NULL, + col56 INTEGER DEFAULT NULL, + col57 INTEGER DEFAULT NULL, + col58 INTEGER DEFAULT NULL, + col59 INTEGER DEFAULT NULL, + col60 INTEGER DEFAULT NULL, + col61 INTEGER DEFAULT NULL, + col62 INTEGER DEFAULT NULL, + col63 INTEGER DEFAULT NULL, + col64 INTEGER DEFAULT NULL, + col65 INTEGER DEFAULT NULL, + gcol2 INTEGER GENERATED ALWAYS AS (col3 / col4) VIRTUAL, + KEY idx1 (gcol1) +); + +INSERT INTO t1 (col1, col2, col3, col4) + VALUES (1,1,1,1), (2,2,2,2), (3,3,3,3), (4,4,4,4), (5,5,5,5); + +# This will call my_eval_gcolumn_expr to compute the indexed column value +ALTER TABLE t1 ADD COLUMN extra INTEGER; + +SELECT gcol1 FROM t1 FORCE INDEX(idx1); + +DROP TABLE t1; + +# +# Test 2: column number 2 and 66 are virtual and there is an index +# on column number 66. +# +CREATE TABLE t1 ( + col1 INTEGER NOT NULL, + col2 INTEGER NOT NULL, + gcol1 INTEGER GENERATED ALWAYS AS (col1 + col2) VIRTUAL, + col3 INTEGER NOT NULL, + col4 INTEGER NOT NULL, + col5 INTEGER DEFAULT NULL, + col6 INTEGER DEFAULT NULL, + col7 INTEGER DEFAULT NULL, + col8 INTEGER DEFAULT NULL, + col9 INTEGER DEFAULT NULL, + col10 INTEGER DEFAULT NULL, + col11 INTEGER DEFAULT NULL, + col12 INTEGER DEFAULT NULL, + col13 INTEGER DEFAULT NULL, + col14 INTEGER DEFAULT NULL, + col15 INTEGER DEFAULT NULL, + col16 INTEGER DEFAULT NULL, + col17 INTEGER DEFAULT NULL, + col18 INTEGER DEFAULT NULL, + col19 INTEGER DEFAULT NULL, + col20 INTEGER DEFAULT NULL, + col21 INTEGER DEFAULT NULL, + col22 INTEGER DEFAULT NULL, + col23 INTEGER DEFAULT NULL, + col24 INTEGER DEFAULT NULL, + col25 INTEGER DEFAULT NULL, + col26 INTEGER DEFAULT NULL, + col27 INTEGER DEFAULT NULL, + col28 INTEGER DEFAULT NULL, + col29 INTEGER DEFAULT NULL, + col30 INTEGER DEFAULT NULL, + col31 INTEGER DEFAULT NULL, + col32 INTEGER DEFAULT NULL, + col33 INTEGER DEFAULT NULL, + col34 INTEGER DEFAULT NULL, + col35 INTEGER DEFAULT NULL, + col36 INTEGER DEFAULT NULL, + col37 INTEGER DEFAULT NULL, + col38 INTEGER DEFAULT NULL, + col39 INTEGER DEFAULT NULL, + col40 INTEGER DEFAULT NULL, + col41 INTEGER DEFAULT NULL, + col42 INTEGER DEFAULT NULL, + col43 INTEGER DEFAULT NULL, + col44 INTEGER DEFAULT NULL, + col45 INTEGER DEFAULT NULL, + col46 INTEGER DEFAULT NULL, + col47 INTEGER DEFAULT NULL, + col48 INTEGER DEFAULT NULL, + col49 INTEGER DEFAULT NULL, + col50 INTEGER DEFAULT NULL, + col51 INTEGER DEFAULT NULL, + col52 INTEGER DEFAULT NULL, + col53 INTEGER DEFAULT NULL, + col54 INTEGER DEFAULT NULL, + col55 INTEGER DEFAULT NULL, + col56 INTEGER DEFAULT NULL, + col57 INTEGER DEFAULT NULL, + col58 INTEGER DEFAULT NULL, + col59 INTEGER DEFAULT NULL, + col60 INTEGER DEFAULT NULL, + col61 INTEGER DEFAULT NULL, + col62 INTEGER DEFAULT NULL, + col63 INTEGER DEFAULT NULL, + col64 INTEGER DEFAULT NULL, + col65 INTEGER DEFAULT NULL, + gcol2 INTEGER GENERATED ALWAYS AS (col3 / col4) VIRTUAL, + KEY idx1 (gcol2) +); + +INSERT INTO t1 (col1, col2, col3, col4) + VALUES (1,1,1,1), (2,2,2,2), (3,3,3,3), (4,4,4,4), (5,5,5,5); + +# This will call my_eval_gcolumn_expr to compute the indexed column value +ALTER TABLE t1 ADD COLUMN extra INTEGER; + +SELECT gcol2 FROM t1 FORCE INDEX(idx1); + +DROP TABLE t1; +} + +if($support_virtual_index) +{ +--echo # +--echo # Bug#21628161 CRASH/MEMORY CORRUPTION ADDING INDEXES TO VIRTUAL COLUMN +--echo # +# When generating the value of column b, an out-of-range warning is +# raised. A warning is required in order to reproduce the bug, but it +# is promoted to an error on insertion unless we turn off strict mode. +CREATE TABLE t (a INT, + b BOOLEAN GENERATED ALWAYS AS (a+10000) VIRTUAL, + c BLOB GENERATED ALWAYS AS (b=2) VIRTUAL); +INSERT INTO t(a) VALUES (1); +# Before index was created, this query returned the expected one match. +SELECT * FROM t WHERE c = '0'; +# Adding an index sometimes crashed, other times populated it with garbage ... +ALTER TABLE t ADD UNIQUE INDEX (c(1)); +# ... so that this query found no match in the index. +SELECT * FROM t WHERE c = '0'; +DROP TABLE t; + +--echo # +--echo # Bug#21688115 VIRTUAL COLUMN COMPUTATION SAVE_IN_FIELD() +--echo # DID NOT RETURN TRUE WITH DIVIDE 0 +--echo # +CREATE TABLE t (a INT, b INT, h VARCHAR(10)); +INSERT INTO t VALUES (12, 3, "ss"); +INSERT INTO t VALUES (13, 4, "ss"); +INSERT INTO t VALUES (14, 0, "ss"); +ALTER TABLE t ADD c INT GENERATED ALWAYS AS (a/b) VIRTUAL; +#--error ER_DIVISION_BY_ZERO +CREATE INDEX idx ON t(c); +CALL mtr.add_suppression("\\[Warning\\] InnoDB: Compute virtual column values failed"); +DROP TABLE t; +} + +--echo # +--echo # Bug#21770798 OPTIMIZER DOES NOT USE INDEX FOR GENERATED EXPRESSIONS +--echo # WITH LOGICAL OPERATORS +--echo # +CREATE TABLE t (a INT, b INT, + gc_and INT GENERATED ALWAYS AS (a AND b) STORED, + gc_or INT GENERATED ALWAYS AS (a OR b) STORED, + gc_xor INT GENERATED ALWAYS AS (a XOR b) STORED, + gc_not INT GENERATED ALWAYS AS (NOT a) STORED, + gc_case INT GENERATED ALWAYS AS + (CASE WHEN (a AND b) THEN a ELSE b END) STORED, + INDEX(gc_and), INDEX(gc_or), INDEX(gc_xor), INDEX(gc_not), + INDEX(gc_case)); +INSERT INTO t (a, b) VALUES (0, 0), (0, 1), (1, 0), (1, 1); +ANALYZE TABLE t; +EXPLAIN SELECT a, b FROM t WHERE (a AND b) = 1; +SELECT a, b FROM t WHERE (a AND b) = 1; +EXPLAIN SELECT a, b FROM t WHERE 1 = (a AND b); +SELECT a, b FROM t WHERE 1 = (a AND b); +EXPLAIN SELECT a, b FROM t WHERE (a AND b) IN (1, 2, 3); +SELECT a, b FROM t WHERE (a AND b) IN (1, 2, 3); +EXPLAIN SELECT a, b FROM t WHERE (a OR b) = 1; +--sorted_result +SELECT a, b FROM t WHERE (a OR b) = 1; +EXPLAIN SELECT a, b FROM t WHERE (a OR b) BETWEEN 1 AND 10; +--sorted_result +SELECT a, b FROM t WHERE (a OR b) BETWEEN 1 AND 10; +# XOR and NOT worked even before the bug fix, but we test all logical +# operators here for completeness. +EXPLAIN SELECT a, b FROM t WHERE (a XOR b) = 1; +--sorted_result +SELECT a, b FROM t WHERE (a XOR b) = 1; +EXPLAIN SELECT a FROM t WHERE (NOT a) = 1; +SELECT a FROM t WHERE (NOT a) = 1; +# Also verify that a logical expression nested inside another +# expression doesn't prevent substitution. +EXPLAIN SELECT a FROM t WHERE (CASE WHEN (a AND b) THEN a ELSE b END) = 1; +--sorted_result +SELECT a FROM t WHERE (CASE WHEN (a AND b) THEN a ELSE b END) = 1; +# The expression must be exactly the same as the generated expression. +# (b AND a) is not recognized as equivalent to (a AND b). +EXPLAIN SELECT a, b FROM t WHERE 1 = (b AND a); +SELECT a, b FROM t WHERE 1 = (b AND a); +--sorted_result +EXPLAIN SELECT a, b FROM t WHERE 1 = (b OR a); +SELECT a, b FROM t WHERE 1 = (b OR a); +DROP TABLE t; + +--echo # +--echo # Bug#22810883: ASSERTION FAILED: +--echo # !(USED_TABS & (~READ_TABLES & ~FILTER_FOR_TABLE)) +--echo # +CREATE TABLE t1 (a1 INTEGER GENERATED ALWAYS AS (1 AND 0) STORED, + a2 INTEGER, KEY (a1)); +INSERT INTO t1 VALUES (); +CREATE TABLE t2 (b INTEGER); +INSERT INTO t2 VALUES (1); +ANALYZE TABLE t1, t2; +--echo # Used to choose the index on a1 and get wrong results. +--let $query= SELECT * FROM t1 WHERE (a2 AND a2) = 0 +--eval EXPLAIN $query +--eval $query +--echo # Used to get assertion or wrong results. +--let $query= SELECT * FROM t1 STRAIGHT_JOIN t2 ON b WHERE (b AND b) = 1 +--eval EXPLAIN $query +--eval $query +DROP TABLE t1, t2; + +--echo # diff --git a/mysql-test/suite/gcol/inc/gcol_non_stored_columns.inc b/mysql-test/suite/gcol/inc/gcol_non_stored_columns.inc new file mode 100644 index 00000000000..f32487d20a1 --- /dev/null +++ b/mysql-test/suite/gcol/inc/gcol_non_stored_columns.inc @@ -0,0 +1,155 @@ +################################################################################ +# inc/gcol_non_stored_columns.inc # +# # +# Purpose: # +# Ensure that MySQL behaviour is consistent irrelevant of # +# - the place of a non-stored column among other columns, # +# - the total number of non-stored fields. # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-04 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +--echo # Case 1. All non-stored columns. +eval create $opt_tmp table t1 (a int generated always as (2+3) virtual); +insert into t1 values (default); +select * from t1; +insert into t1 values (default); +select * from t1; +drop table t1; +--echo # Case 2. CREATE +--echo # - Column1: "real" +--echo # - Column 2: virtual non-stored +eval create $opt_tmp table t1 (a int, b int generated always as (-a) virtual); +insert into t1 values (1,default); +select * from t1; +insert into t1 values (2,default); +select * from t1 order by a; +drop table t1; + +--echo # Case 3. CREATE +--echo # - Column1: "real" +--echo # - Column 2: virtual stored +eval create $opt_tmp table t1 (a int, b int generated always as (-a) stored); +insert into t1 values (1,default); +select * from t1; +insert into t1 values (2,default); +select * from t1 order by a; +drop table t1; + +--echo # Case 4. CREATE +--echo # - Column1: virtual non-stored +--echo # - Column2: "real" +eval create $opt_tmp table t1 (a int generated always as (-b) virtual, b int); +insert into t1 values (default,1); +select * from t1; +insert into t1 values (default,2); +select * from t1 order by a; +drop table t1; + +--echo # Case 5. CREATE +--echo # - Column1: virtual stored +--echo # - Column2: "real" +eval create $opt_tmp table t1 (a int generated always as (-b) stored, b int); +insert into t1 values (default,1); +select * from t1; +insert into t1 values (default,2); +select * from t1 order by a; +drop table t1; + +--echo # Case 6. CREATE +--echo # - Column1: "real" +--echo # - Column2: virtual non-stored +--echo # - Column3: virtual stored +eval create $opt_tmp table t1 (a int, b int generated always as (-a), c int generated always as (-a) stored); +insert into t1 values (1,default,default); +select * from t1; +insert into t1 values (2,default,default); +select * from t1 order by a; +drop table t1; + +--echo # Case 7. ALTER. Modify virtual stored -> virtual non-stored +eval create $opt_tmp table t1 (a int, b int generated always as (a % 2) stored); +--error ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN +alter table t1 modify b int generated always as (a % 2) virtual; +show create table t1; +drop table t1; + +--echo # Case 8. ALTER. Modify virtual non-stored -> virtual stored +eval create $opt_tmp table t1 (a int, b int generated always as (a % 2) virtual); +--error ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN +alter table t1 modify b int generated always as (a % 2) stored; +show create table t1; +drop table t1; + +--echo # Case 9. CREATE LIKE +--echo # - Column1: "real" +--echo # - Column2: virtual non-stored +--echo # - Column3: virtual stored +eval create $opt_tmp table t1 (a int, b int generated always as (-a), c int generated always as (-a) stored); +eval create $opt_tmp table t2 like t1; +insert into t2 values (1,default,default); +select * from t2; +insert into t2 values (2,default,default); +select * from t2 order by a; +drop table t2; +drop table t1; + +--echo # Case 10. ALTER. Dropping a virtual non-stored column. +--echo # - Column1: virtual non-stored +--echo # - Column2: "real" +eval create $opt_tmp table t1 (a int generated always as (-b) virtual, b int, c varchar(5)); +insert into t1 values (default,1,'v1'); +insert into t1 values (default,2,'v2'); +select * from t1 order by b; +alter table t1 drop column a; +select * from t1 order by b; +show create table t1; +drop table t1; + +--echo # Case 11. ALTER. Dropping a virtual stored column. +--echo # - Column1: virtual stored +--echo # - Column2: "real" +eval create $opt_tmp table t1 (a int generated always as (-b) stored, b int, c char(5)); +insert into t1 values (default,1,'v1'); +insert into t1 values (default,2,'v2'); +select * from t1 order by b; +alter table t1 drop column a; +select * from t1 order by b; +show create table t1; +drop table t1; + +--echo # Case 12. ALTER. Adding a new virtual non-stored column. +eval create $opt_tmp table t1 (a int, b datetime); +insert into t1 values (1,'2008-09-04'); +insert into t1 values (2,'2008-09-05'); +select * from t1 order by a; +alter table t1 add column c int generated always as (dayofyear(b)) virtual after a; +select * from t1 order by a; +show create table t1; +drop table t1; + +--echo # Case 13. ALTER. Adding a new virtual stored column. +eval create $opt_tmp table t1 (a int, b datetime); +insert into t1 values (1,'2008-09-04'); +insert into t1 values (2,'2008-09-05'); +select * from t1 order by a; +alter table t1 add column c int generated always as (dayofyear(b)) stored after a; +select * from t1 order by a; +show create table t1; +drop table t1; + +--echo # Case 15. ALTER. Changing the expression of a virtual non-stored column. +eval create $opt_tmp table t1 (a int, b datetime, c int generated always as (week(b)) virtual); +insert into t1 values (1,'2008-09-04',default); +insert into t1 values (2,'2008-09-05',default); +select * from t1 order by a; +alter table t1 change column c c int generated always as (week(b,1)) virtual; +select * from t1 order by a; +show create table t1; +drop table t1; + diff --git a/mysql-test/suite/gcol/inc/gcol_partition.inc b/mysql-test/suite/gcol/inc/gcol_partition.inc new file mode 100644 index 00000000000..df199e86c68 --- /dev/null +++ b/mysql-test/suite/gcol/inc/gcol_partition.inc @@ -0,0 +1,155 @@ +################################################################################ +# inc/gcol_partition.inc # +# # +# Purpose: # +# Testing partitioning tables with generated columns. # +# # +# # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-04 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +--source include/have_partition.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +--echo # Case 1. Partitioning by RANGE based on a non-stored generated column. + +CREATE TABLE t1 ( + a DATE NOT NULL, + b int generated always as (year(a)) virtual +) +PARTITION BY RANGE( b ) ( + PARTITION p0 VALUES LESS THAN (2006), + PARTITION p2 VALUES LESS THAN (2008) +); + +insert into t1 values ('2006-01-01',default); +insert into t1 values ('2007-01-01',default); +insert into t1 values ('2005-01-01',default); +select * from t1; + +# Specifically for MyISAM, check that data is written into correct +# $MYSQLTEST_VARDIR/master-data/test/t1*p?.MYD files + +--echo # Modify the expression of generated column b +ALTER TABLE t1 modify b int generated always as (year(a)-1) virtual; + +select * from t1; + +drop table t1; + +--echo # Case 2. Partitioning by LIST based on a stored generated column. + +CREATE TABLE t1 (a int, b int generated always as (a % 3 ) stored) +PARTITION BY LIST (a+1) +(PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2)); + +insert into t1 values (1,default); +select * from t1; + +# +# NOTE: The following tests are currently failing due to a +# [suspected] bug in the existing partition functionality. +# Here is what was observed when using mysqld compiled prior +# to adding the generated column functionality. +# mysql> create table t1 (a int) partition by list (a) +# (partition p1 values in (1), partition p2 values in (2)); +# Query OK, 0 rows affected (0.00 sec) +# +# mysql> insert into t1 values (1), (1), (2); +# Query OK, 3 rows affected (0.00 sec) +# Records: 3 Duplicates: 0 Warnings: 0 +# +# mysql> select * from t1; +# +------+ +# | a | +# +------+ +# | 1 | +# | 1 | +# | 2 | +# +------+ +# 3 rows in set (0.00 sec) +# +# mysql> alter table t1 reorganize partition p1 into +# (partition p1 values in (3)); +# Query OK, 2 rows affected (3.90 sec) +# Records: 2 Duplicates: 2 Warnings: 0 +# +# mysql> select * from t1; +# +------+ +# | a | +# +------+ +# | 2 | <- Two row have been lost!!! +# +------+ +# 1 row in set (0.00 sec) + +# +#alter table t1 change b b virtual int as ((a % 3)+1) stored; +#--error ER_NO_PARTITION_FOR_GIVEN_VALUE +#alter table t1 change b b virtual int as (a % 2) stored; +#if ($myisam_engine) +#{ +# --echo # Check how data is physically partitioned. +# --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +# --exec du -b $MYSQLTEST_VARDIR/master-data/test/t1*p?.MYD +#} + +select * from t1; + +drop table t1; + +--echo # Case 3. Partitioning by HASH based on a non-stored generated column. + +CREATE TABLE t1 ( + a DATE NOT NULL, + b int generated always as (year(a)) virtual +) +PARTITION BY HASH( b % 3 ) PARTITIONS 3; + +insert into t1 values ('2005-01-01',default); +insert into t1 values ('2006-01-01',default); +select * from t1; + +--echo # Modify the expression of generated column b +ALTER TABLE t1 modify b int generated always as (year(a)-1) virtual; + +select * from t1; + +drop table t1; + +--echo # +--echo # Bug#21779011 INVALID READS AND SENDING RANDOM SERVER MEMORY BACK +--echo # TO CLIENT +--echo # + +CREATE TABLE t ( + c INTEGER GENERATED ALWAYS AS (2) VIRTUAL, + d INTEGER, + KEY (d) +) PARTITION BY KEY (d) PARTITIONS 2; + +INSERT INTO t (d) VALUES (1),(1),(2),(2); + +SELECT c FROM t WHERE d >= 1 GROUP BY d LIMIT 2; + +DROP TABLE t; + +--echo # +--echo # Bug#21779554: CHECK_MISPLACED_ROWS BOGUS "FOUND A MISPLACED ROW" +--echo # AND CRASHES +--echo # +CREATE TABLE t(a INT,b INT GENERATED ALWAYS AS (1) VIRTUAL,c INT) +PARTITION BY KEY (b)PARTITIONS 6; +INSERT INTO t VALUES(); +CHECK TABLE t EXTENDED; +FLUSH TABLES; +CHECK TABLE t EXTENDED; +DROP TABLE t; diff --git a/mysql-test/suite/gcol/inc/gcol_select.inc b/mysql-test/suite/gcol/inc/gcol_select.inc new file mode 100644 index 00000000000..efaffd5168d --- /dev/null +++ b/mysql-test/suite/gcol/inc/gcol_select.inc @@ -0,0 +1,1163 @@ +################################################################################ +# inc/gcol_select.inc # +# # +# Purpose: # +# Testing different SELECTs. # +# # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-18 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# Table t1 is used below to test: +# - Join type of ALL (sequential scan of the entire table) +# - Join type of Index +# - Join type of Range +# - Join type of Ref_or_null +create table t1 (a int, + b int generated always as (-a) virtual, + c int generated always as (-a) stored, + index (c)); +insert into t1 (a) values (2), (1), (1), (3), (NULL); + +# Table t2 is used below to test: +# - Join type of system and const +create table t2 like t1; +insert into t2 (a) values (1); + +# Table t3 is used below to test +# - Join type of Eq_ref with a unique generated column +# - Join type of Const +create table t3 (a int primary key, + b int generated always as (-a) virtual, + c int generated always as (-a) stored unique); +insert into t3 (a) values (2),(1),(3); +analyze table t1,t2,t3; + +--echo # select_type=SIMPLE, type=system +let $s = select * from t2; +eval $s; +eval explain $s; + +let $s = select * from t2 where c=-1; +eval $s; +eval explain $s; + +--echo # select_type=SIMPLE, type=ALL +let $s = select * from t1 where b=-1; +eval $s; +eval explain $s; + +--echo # select_type=SIMPLE, type=const +let $s = select * from t3 where a=1; +eval $s; +eval explain $s; + +--echo # select_type=SIMPLE, type=range +let $s = select * from t3 where c>=-1; +eval $s; +eval explain $s; + +--echo # select_type=SIMPLE, type=ref +let $s = select * from t1,t3 where t1.c=t3.c and t3.c=-1; +eval $s; +eval explain $s; + +--echo # select_type=PRIMARY, type=index,ALL +let $s = select * from t1 where b in (select c from t3); +--sorted_result +eval $s; +eval explain $s; + +--echo # select_type=PRIMARY, type=range,ref +--sorted_result +let $s = select * from t1 where c in (select c from t3 where c between -2 and -1); +eval $s; +eval explain $s; + +--echo # select_type=UNION, type=system +--echo # select_type=UNION RESULT, type= +let $s = select * from t1 union select * from t2; +--sorted_result +eval $s; +eval explain $s; + +--echo # select_type=DERIVED, type=system +let $s = select * from (select a,b,c from t1) as t11; +--sorted_result +eval $s; +eval explain $s; + +--echo ### +--echo ### Using aggregate functions with/without DISTINCT +--echo ### +--echo # SELECT COUNT(*) FROM tbl_name +let $s = select count(*) from t1; +eval $s; +eval explain $s; + +--echo # SELECT COUNT(DISTINCT ) FROM tbl_name +let $s = select count(distinct a) from t1; +eval $s; +eval explain $s; + +--echo # SELECT COUNT(DISTINCT ) FROM tbl_name +let $s = select count(distinct b) from t1; +eval $s; +eval explain $s; + +--echo # SELECT COUNT(DISTINCT ) FROM tbl_name +let $s = select count(distinct c) from t1; +eval $s; +eval explain $s; + +--echo ### +--echo ### filesort & range-based utils +--echo ### +--echo # SELECT * FROM tbl_name WHERE +let $s = select * from t3 where c >= -2; +--sorted_result +eval $s; +eval explain $s; + +--echo # SELECT * FROM tbl_name WHERE +let $s = select * from t3 where a between 1 and 2; +--sorted_result +eval $s; +eval explain $s; + +--echo # SELECT * FROM tbl_name WHERE +let $s = select * from t3 where b between -2 and -1; +--sorted_result +eval $s; +eval explain $s; + +--echo # SELECT * FROM tbl_name WHERE +let $s = select * from t3 where c between -2 and -1; +--sorted_result +eval $s; +eval explain $s; + +#### Remove for MyISAM due to a bug +#### when all the three records are returned (a=1,2,3) +#### instead of just two (a=1,2). +#### This bug is presumably in base SQL routines as the same happens +#### with this table: +#### create table t4 (a int primary key, b int, c int unique); +let $myisam_engine = `SELECT @@session.default_storage_engine='myisam'`; +if (!$myisam_engine) +{ + --echo # SELECT * FROM tbl_name WHERE ORDER BY + let $s = select * from t3 where a between 1 and 2 order by b; + eval $s; + eval explain $s; + --echo # bug#20022189: WL411:DEBUG ASSERT AT FIELD_LONG::VAL_INT IN SQL/FIELD.CC + --echo # SELECT * FROM tbl_name WHERE ORDER BY + let $s = select * from t3 where a between 1 and 2 order by c; + eval $s; + eval explain $s; +} +--echo # bug#20022189: WL411:DEBUG ASSERT AT FIELD_LONG::VAL_INT IN SQL/FIELD.CC +CREATE TABLE t4 ( + `pk` int(11) NOT NULL , + `col_int_nokey` int(11) GENERATED ALWAYS AS (pk + col_int_key) STORED, + `col_int_key` int(11) DEFAULT NULL, + `col_date_nokey` date DEFAULT NULL, + `col_datetime_key` datetime DEFAULT NULL, + PRIMARY KEY (`pk`), + KEY `col_int_key` (`col_int_key`), + KEY `col_datetime_key` (`col_datetime_key`) +); + +INSERT INTO t4 VALUES +(1,default,4,'2008-12-05','1900-01-01 00:00:00'); + +SELECT +SQL_BIG_RESULT +GRANDPARENT1 . `col_int_nokey` AS g1 +FROM t4 AS GRANDPARENT1 LEFT JOIN t4 AS GRANDPARENT2 ON ( GRANDPARENT2 . +`col_datetime_key` <= GRANDPARENT1 . `col_date_nokey` ) +GROUP BY GRANDPARENT1 . `pk`; +DROP TABLE t4; + +--echo # SELECT * FROM tbl_name WHERE ORDER BY +let $s = select * from t3 where a between 1 and 2 order by c; +eval $s; +eval explain $s; + +--echo # SELECT * FROM tbl_name WHERE ORDER BY +let $s = select * from t3 where b between -2 and -1 order by a; +eval $s; +eval explain $s; + +#### Remove for MyISAM due to a bug +#### when all the three records are returned (a=1,2,3) +#### instead of just two (a=1,2). +#### This bug is presumably in base SQL routines as the same happens +#### with this table: +#### create table t4 (a int primary key, b int, c int unique); +let $innodb_engine = `SELECT @@session.default_storage_engine='innodb'`; +if (!$innodb_engine) +{ + --echo # SELECT * FROM tbl_name WHERE ORDER BY + let $s = select * from t3 where c between -2 and -1 order by a; + eval $s; + eval explain $s; +} + +--echo # SELECT * FROM tbl_name WHERE ORDER BY +let $s = select * from t3 where b between -2 and -1 order by b; +eval $s; +eval explain $s; + +--echo # SELECT * FROM tbl_name WHERE ORDER BY +let $s = select * from t3 where c between -2 and -1 order by b; +eval $s; +eval explain $s; + +--echo # SELECT * FROM tbl_name WHERE ORDER BY +let $s = select * from t3 where b between -2 and -1 order by c; +eval $s; +eval explain $s; + +--echo # SELECT * FROM tbl_name WHERE ORDER BY +let $s = select * from t3 where c between -2 and -1 order by c; +eval $s; +eval explain $s; + +--echo # SELECT sum() FROM tbl_name GROUP BY +let $s = select sum(b) from t1 group by b; +eval $s; +eval explain $s; + +--echo # SELECT sum() FROM tbl_name GROUP BY +let $s = select sum(c) from t1 group by c; +eval $s; +eval explain $s; + +--echo # SELECT sum() FROM tbl_name GROUP BY +let $s = select sum(b) from t1 group by c; +eval $s; +eval explain $s; + +--echo # SELECT sum() FROM tbl_name GROUP BY +let $s = select sum(c) from t1 group by b; +eval $s; +eval explain $s; + +drop table t1; + +--echo # +--echo # Bug#20241655: WL411:FAILING ASSERTION ASSERTION +--echo # +CREATE TABLE BB ( + col_time_key time NOT NULL, + col_time_nokey time GENERATED ALWAYS AS (ADDTIME(col_datetime_key, col_time_key)) VIRTUAL, + col_datetime_key datetime NOT NULL); +INSERT INTO BB VALUES('23:28:02', default, '2005-03-15 22:48:25'); + +CREATE TABLE CC ( + col_time_key time NOT NULL, + col_time_nokey time GENERATED ALWAYS AS (ADDTIME(col_datetime_key, col_time_key)) VIRTUAL, + col_datetime_key datetime NOT NULL +); +INSERT INTO CC VALUES('16:22:51', default, '1900-01-01 00:00:00'); + +SELECT 1 AS g1 FROM BB AS gp1 LEFT JOIN BB AS gp2 USING ( col_time_nokey); +DROP TABLE BB, CC; + +--echo # +--echo # Bug#20328786: WL411:VALGRIND WARNINGS OF CONDITIONAL +--echo # JUMP WHILE SELECTING FROM VIEW +--echo # +CREATE TABLE A ( + pk INTEGER AUTO_INCREMENT, + col_int_nokey INTEGER, + col_int_key INTEGER GENERATED ALWAYS AS (2 + 2 + col_int_nokey) STORED, + PRIMARY KEY (pk) +); + +CREATE TABLE C ( + pk INTEGER AUTO_INCREMENT, + col_int_nokey INTEGER, + col_int_key INTEGER GENERATED ALWAYS AS (2 + 2 + col_int_nokey) STORED, + col_varchar_nokey VARCHAR(1), + col_varchar_key VARCHAR(2) GENERATED ALWAYS AS + (CONCAT(col_varchar_nokey, col_varchar_nokey)) STORED, + PRIMARY KEY (pk), + KEY (col_int_key), + KEY (col_varchar_key, col_int_key) +); + +INSERT INTO C ( + col_int_nokey, + col_varchar_nokey +) VALUES (4, 'v'),(62, 'v'),(7, 'c'),(1, NULL),(0, 'x'),(7, 'i'),(7, 'e'),(1, 'p'),(7, 's'),(1, 'j'),(5, 'z'),(2, 'c'),(0, 'a'),(1, 'q'),(8, 'y'),(1, NULL),(1, 'r'),(9, 'v'),(1, NULL),(5, 'r'); + +CREATE OR REPLACE ALGORITHM=MERGE VIEW V1 AS SELECT alias1. +col_varchar_key AS field1 , alias1.pk AS field2, alias2. +col_int_nokey AS field3 FROM C AS alias1 LEFT JOIN A AS alias2 ON +alias1.pk = alias2.col_int_key WHERE alias1.pk > 8 AND alias1 +.pk < ( 9 + 2 ) AND alias1.col_int_key <> 1 OR alias1.col_int_key +> 0 AND alias1.col_int_key <= ( 3 + 2 ) ORDER BY field1, field2, field3 +LIMIT 100 OFFSET 6; + +SELECT * FROM V1; + +DROP VIEW V1; +DROP TABLE A,C; + +--echo # +--echo # Bug#20406510: WL411:VALGRIND WARNINGS WITH +--echo # COUNT DISTINCT QUERY ON VIRTUAL GC VARCHAR COLUMN +--echo # +CREATE TABLE A ( + pk INTEGER AUTO_INCREMENT, + col_time_key TIME NOT NULL, + col_datetime_key DATETIME NOT NULL, + PRIMARY KEY (pk), + KEY (col_time_key), + KEY (col_datetime_key) +); + +CREATE TABLE C ( + pk INTEGER AUTO_INCREMENT, + col_int_key INTEGER NOT NULL, + col_varchar_key VARCHAR(1) NOT NULL, + col_varchar_nokey VARCHAR(2) GENERATED ALWAYS AS + (CONCAT(col_varchar_key, col_varchar_key)), + PRIMARY KEY (pk), + KEY (col_int_key), + KEY (col_varchar_key, col_int_key) +); + +INSERT INTO C (col_int_key,col_varchar_key) VALUES (0, 'j'),(8, 'v'),(1, 'c'),(8, 'm'),(9, 'd'); +SELECT MIN( alias2 . col_int_key ) AS field1, +COUNT( DISTINCT alias2 . col_varchar_nokey ) AS field2 +FROM ( A AS alias1 , C AS alias2 ) +ORDER BY alias1.col_time_key, alias1.col_datetime_key, alias1.pk ASC; +DROP TABLE A,C; + +--echo # +--echo # Bug#20566325: WL8149: INNODB: FAILING ASSERTION: +--echo # COL_NR < TABLE->N_DEF +--echo # +CREATE TABLE A ( +pk INTEGER AUTO_INCREMENT, +col_varchar_nokey VARCHAR(1) NOT NULL, +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)), +PRIMARY KEY (pk) +); + +INSERT /*! IGNORE */ INTO A (col_varchar_nokey) VALUES ('k'); + +CREATE TABLE CC ( +pk INTEGER AUTO_INCREMENT, +col_datetime_nokey DATETIME /*! NULL */, +col_time_nokey TIME /*! NULL */, +col_time_key TIME GENERATED ALWAYS AS +(ADDTIME(col_datetime_nokey, col_time_nokey)), +col_varchar_nokey VARCHAR(1) /*! NULL */, +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)), +PRIMARY KEY (pk)); + +INSERT INTO CC (col_time_nokey,col_datetime_nokey,col_varchar_nokey) VALUES +('13:06:13.033877','1900-01-01 00:00:00', 'p'), +(NULL, '2007-05-25 11:58:54.015689', 'g'); + +SELECT +table1.col_time_key AS field1, +'z' AS field2 +FROM +(CC AS table1 LEFT OUTER JOIN (A AS table2 STRAIGHT_JOIN CC AS table3 ON +(table3.col_varchar_key = table2.col_varchar_nokey)) ON +(table3.col_varchar_key = table2.col_varchar_nokey)) +WHERE +table2.pk != 6 +AND table1.col_varchar_key IN ('l', 's' , 'b' ) +AND table3.col_varchar_key != table1.col_varchar_key +ORDER BY table1.col_varchar_key , field1 , field2; + +DROP TABLE A,CC; + +if ($support_virtual_index) +{ +--echo # +--echo # Bug#20573302: WL8149: SEGV IN HA_INNOBASE:: +--echo # BUILD_TEMPLATE AT INNOBASE/HANDLER/HA_INNODB.CC:665 +--echo # +CREATE TABLE c ( + pk INTEGER AUTO_INCREMENT, + col_int_nokey INTEGER NOT NULL, + col_int_key INTEGER GENERATED ALWAYS AS (col_int_nokey) VIRTUAL, + + col_date_nokey DATE NOT NULL, + col_date_key DATE GENERATED ALWAYS AS (DATE_ADD(col_date_nokey,interval 30 day)) VIRTUAL, + + col_datetime_nokey DATETIME NOT NULL, + col_time_nokey TIME NOT NULL, + + col_datetime_key DATETIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)), + col_time_key TIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)), + + col_varchar_nokey VARCHAR(1) NOT NULL, + col_varchar_key VARCHAR(2) GENERATED ALWAYS AS (CONCAT(col_varchar_nokey, col_varchar_nokey)), + + PRIMARY KEY (pk), + KEY (col_int_key), + KEY (col_varchar_key), + KEY (col_date_key), + KEY (col_time_key), + KEY (col_datetime_key), + KEY (col_int_key, col_varchar_key), + KEY (col_int_key, col_varchar_key, col_date_key, + col_time_key, col_datetime_key)); + +INSERT /*! IGNORE */ INTO c ( + col_int_nokey, + col_date_nokey, + col_time_nokey, + col_datetime_nokey, + col_varchar_nokey + ) VALUES +(1, '2009-12-01', '00:21:38.058143', '2007-05-28 00:00:00', 'c'), +(8, '2004-12-17', '04:08:02.046897', '2009-07-25 09:21:20.064099', 'm'), +(9, '2000-03-14', '16:25:11.040240', '2002-01-16 00:00:00', 'd'), +(24, '2000-10-08', '10:14:58.018534', '2006-10-12 04:32:53.031976', 'd'), +(6, '2006-05-25', '19:47:59.011283', '2001-02-15 03:08:38.035426', 'y'), +(1, '2008-01-23', '11:14:24.032949', '2004-10-02 20:31:15.022553', 't'), +(6, '2007-06-18', NULL, '2002-08-20 22:48:00.035785', 'd'), +(2, '2002-10-13', '00:00:00', '1900-01-01 00:00:00', 's'), +(4, '1900-01-01', '15:57:25.019666', '2005-08-15 00:00:00', 'r'), +(8, NULL, '07:05:51.006712', '1900-01-01 00:00:00', 'm'), +(4, '2006-03-09', '19:22:21.057406', '2008-05-16 08:09:06.002924', 'b'), +(4, '2001-06-05', '03:53:16.001370', '2001-01-20 12:47:23.022022', 'x'), +(7, '2006-05-28', '09:16:38.034570', '2008-07-02 00:00:00', 'g'), +(4, '2001-04-19', '15:37:26.028315', '1900-01-01 00:00:00', 'p'), +(1, '1900-01-01', '00:00:00', '2002-12-08 11:34:58.001571', 'q'), +(9, '2004-08-20', '05:03:03.047452', '1900-01-01 00:00:00', 'w'), +(4, '2004-10-10', '02:59:24.063764', '1900-01-01 00:00:00', 'd'), +(8, '2000-04-02', '00:01:58.064243', '2002-08-25 20:35:06.064634', 'e'), +(4, '2006-11-02', '00:00:00', '2001-10-22 11:13:24.048128', 'b'), +(8, '2009-01-28', '02:20:16.024931', '2003-03-12 02:00:34.029335', 'y'); + +CREATE TABLE cc ( + pk INTEGER AUTO_INCREMENT, + col_int_nokey INTEGER NOT NULL, + col_int_key INTEGER GENERATED ALWAYS AS (col_int_nokey) VIRTUAL, + + col_date_nokey DATE NOT NULL, + col_date_key DATE GENERATED ALWAYS AS (DATE_ADD(col_date_nokey,interval 30 day)) VIRTUAL, + + col_datetime_nokey DATETIME NOT NULL, + col_time_nokey TIME NOT NULL, + + col_datetime_key DATETIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)), + col_time_key TIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)), + + col_varchar_nokey VARCHAR(1) NOT NULL, + col_varchar_key VARCHAR(2) GENERATED ALWAYS AS (CONCAT(col_varchar_nokey, col_varchar_nokey)), + + PRIMARY KEY (pk), + KEY (col_int_key), + KEY (col_varchar_key), + KEY (col_date_key), + KEY (col_time_key), + KEY (col_datetime_key), + KEY (col_int_key, col_varchar_key), + KEY (col_int_key, col_varchar_key, col_date_key, + col_time_key, col_datetime_key)); + +INSERT /*! IGNORE */ INTO cc ( + col_int_nokey, + col_date_nokey, + col_time_nokey, + col_datetime_nokey, + col_varchar_nokey + ) VALUES +(0, '2003-02-06', '22:02:09.059926', '2003-08-07 14:43:09.011144', 'x'), +(0, '2005-04-16', '19:33:15.014160', '2005-12-11 00:00:00', 'n'), +(1, '2005-07-23', '22:03:16.058787', '2005-12-26 20:48:07.043628', 'w'), +(7, '2001-11-15', '06:31:23.027263', '2008-06-12 06:41:21.012493', 's'), +(0, '2006-03-24', '02:19:08.013275', '2007-10-11 18:46:28.030000', 'a'), +(4, '2008-07-10', NULL, '2006-04-04 22:22:40.057947', 'd'), +(1, '2009-12-07', NULL, '2002-08-10 20:52:58.035137', 'w'), +(1, '2008-05-01', '10:28:01.038587', '2008-10-03 11:17:23.005299', 'j'), +(1, '2008-06-22', '00:00:00', '2009-01-06 20:11:01.034339', 'm'), +(4, '2001-11-11', '15:02:50.048785', '2009-09-19 00:00:00', 'k'), +(7, '2000-12-21', '05:29:13.012729', '2007-09-02 12:14:27.029187', 't'), +(4, '2007-09-03', '23:45:33.048507', '2003-09-26 00:00:00', 'k'), +(2, '2003-02-18', '19:10:53.057455', '2001-11-18 18:10:16.063189', 'e'), +(0, '2008-12-01', '01:45:27.037313', '2005-02-15 04:08:17.015554', 'i'), +(1, '2008-10-18', '03:56:03.060218', '2009-06-13 23:04:40.013006', 't'), +(91, '2004-08-28', '12:43:17.023797', '1900-01-01 00:00:00', 'm'), +(6, '2006-10-05', '13:33:46.053634', '2005-03-20 02:48:24.045653', 'z'), +(3, '2003-05-16', NULL, '2002-03-16 11:47:27.045297', 'c'), +(6, '2008-10-10', NULL, '2000-05-22 00:00:00', 'i'), +(8, '2002-01-19', '05:18:40.006865', '2009-02-12 00:00:00', 'v'); + +--replace_column 10 # 11 # +EXPLAIN +SELECT subquery2_t2.col_int_key AS subquery2_field1 +FROM (c AS subquery2_t1 RIGHT JOIN + (c AS subquery2_t2 LEFT JOIN cc AS subquery2_t3 ON + (subquery2_t3.col_int_nokey = subquery2_t2.col_int_key )) ON + (subquery2_t3.col_varchar_key = subquery2_t2.col_varchar_key)) +ORDER BY subquery2_field1; + +SELECT subquery2_t2.col_int_key AS subquery2_field1 +FROM (c AS subquery2_t1 RIGHT JOIN + (c AS subquery2_t2 LEFT JOIN cc AS subquery2_t3 ON + (subquery2_t3.col_int_nokey = subquery2_t2.col_int_key )) ON + (subquery2_t3.col_varchar_key = subquery2_t2.col_varchar_key)) +ORDER BY subquery2_field1; +SELECT subquery2_t2.col_int_key AS subquery2_field1 +FROM (c AS subquery2_t1 RIGHT JOIN + (c AS subquery2_t2 LEFT JOIN cc AS subquery2_t3 ON + (subquery2_t3.col_int_nokey = subquery2_t2.col_int_key )) ON + (subquery2_t3.col_varchar_key = subquery2_t2.col_varchar_key)) +ORDER BY subquery2_field1; + +DROP TABLE c,cc; + +--echo # +--echo # Bug#2081065: WL8149:RESULT DIFF SEEN FOR SIMPLE +--echo # RANGE QUERIES WITH ORDER BY +--echo # +CREATE TABLE cc ( + pk INTEGER AUTO_INCREMENT, + col_int_nokey INTEGER NOT NULL, + col_int_key INTEGER GENERATED ALWAYS AS + (col_int_nokey + col_int_nokey) VIRTUAL, + PRIMARY KEY (pk), + KEY (col_int_key) +); +INSERT INTO cc (col_int_nokey) VALUES (0),(1),(7),(0),(4),(5); +--replace_column 10 # 11 # +EXPLAIN SELECT pk FROM cc WHERE col_int_key > 3; +SELECT pk FROM cc WHERE col_int_key > 3; +--replace_column 10 # 11 # +EXPLAIN SELECT pk FROM cc WHERE col_int_key > 3 ORDER BY 1; +SELECT pk FROM cc WHERE col_int_key > 3 ORDER BY 1; +DROP TABLE cc; + +--echo # +--echo # Bug#20849676 :WL8149:ASSERTION `!TABLE || (!TABLE->READ_SET +--echo # || BITMAP_IS_SET(TABLE->READ_SET +--echo # +CREATE TABLE c ( + pk INTEGER AUTO_INCREMENT, + col_int_nokey INTEGER NOT NULL, + col_int_key INTEGER GENERATED ALWAYS AS + (col_int_nokey + col_int_nokey) VIRTUAL, + col_varchar_nokey VARCHAR(1) NOT NULL, + col_varchar_key VARCHAR(2) GENERATED ALWAYS AS + (CONCAT(col_varchar_nokey, col_varchar_nokey)), + PRIMARY KEY (pk), + KEY (col_int_key), + KEY (col_varchar_key), + KEY (col_int_key, col_varchar_key) +) ; + +INSERT INTO c (col_int_nokey, col_varchar_nokey) VALUES +(1, 'c'),(8, 'm'),(9, 'd'),(24, 'd'),(6, 'y'),(1, 't'),(6, 'd'), +(2, 'r'),(8, 'm'),(4, 'b'),(4, 'x'),(7, 'g'),(4, 'p'),(1, 'q'), +(9, 'w'),(4, 'd'),(8, 'e'),(4, 'b'),(8, 'y'); + +CREATE TABLE a ( + pk INTEGER AUTO_INCREMENT, + col_datetime_nokey DATETIME NOT NULL, + col_time_nokey TIME NOT NULL, + col_datetime_key DATETIME GENERATED ALWAYS AS + (ADDTIME(col_datetime_nokey, col_time_nokey)), + col_time_key TIME GENERATED ALWAYS AS + (ADDTIME(col_datetime_nokey, col_time_nokey)), + col_varchar_nokey VARCHAR(1) NOT NULL, + col_varchar_key VARCHAR(2) GENERATED ALWAYS AS + (CONCAT(col_varchar_nokey, col_varchar_nokey)), + PRIMARY KEY (pk), + KEY (col_varchar_key), + KEY (col_time_key), + KEY (col_datetime_key), + KEY (col_varchar_key, col_time_key, col_datetime_key) +); + +INSERT INTO a ( + col_time_nokey, + col_datetime_nokey, + col_varchar_nokey) VALUES +('04:08:02.046897', '2001-11-04 19:07:55.051133', 'k'); + +ANALYZE TABLE a, c; + +--replace_column 10 # +--disable_warnings +EXPLAIN +SELECT +table1.pk AS field1 , +table1.col_datetime_key AS field2 +FROM +( a AS table1 LEFT JOIN ( ( c AS table2 STRAIGHT_JOIN ( SELECT +SUBQUERY1_t1.* FROM ( c AS SUBQUERY1_t1 INNER JOIN ( c AS SUBQUERY1_t2 +STRAIGHT_JOIN c AS SUBQUERY1_t3 ON (SUBQUERY1_t3.col_varchar_key = +SUBQUERY1_t2.col_varchar_key ) ) +ON (SUBQUERY1_t3.pk = SUBQUERY1_t2.col_int_key +OR SUBQUERY1_t1.col_int_key <> 1 ) ) +WHERE SUBQUERY1_t2.pk >= 9 ) AS table3 +ON (table3.col_int_key = table2.col_int_key ) ) ) +ON (table3.col_int_nokey = table2.pk ) ) +GROUP BY field1, field2; +SELECT +table1.pk AS field1 , +table1.col_datetime_key AS field2 +FROM +( a AS table1 LEFT JOIN ( ( c AS table2 STRAIGHT_JOIN ( SELECT +SUBQUERY1_t1.* FROM ( c AS SUBQUERY1_t1 INNER JOIN ( c AS SUBQUERY1_t2 +STRAIGHT_JOIN c AS SUBQUERY1_t3 ON (SUBQUERY1_t3.col_varchar_key = +SUBQUERY1_t2.col_varchar_key ) ) +ON (SUBQUERY1_t3.pk = SUBQUERY1_t2.col_int_key +OR SUBQUERY1_t1.col_int_key <> 1 ) ) +WHERE SUBQUERY1_t2.pk >= 9 ) AS table3 +ON (table3.col_int_key = table2.col_int_key ) ) ) +ON (table3.col_int_nokey = table2.pk ) ) +GROUP BY field1, field2; + +--enable_warnings +DROP TABLE IF EXISTS c,a; +CREATE TABLE c ( +col_int_nokey INTEGER NOT NULL, +col_int_key INTEGER GENERATED ALWAYS AS + (col_int_nokey + col_int_nokey) VIRTUAL, +col_varchar_nokey VARCHAR(1) NOT NULL, +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS + (CONCAT(col_varchar_nokey, col_varchar_nokey)), + +KEY (col_int_key), +KEY (col_int_key, col_varchar_key) +) ; + +INSERT INTO c ( +col_int_nokey, +col_varchar_nokey +) VALUES (1, 'c'),(8, 'm'),(9, 'd'),(24, 'd'),(6, 'y'),(1, 't'), +(6, 'd'),(2, 's'),(4, 'r'),(8, 'm'),(4, 'b'),(4, 'x'),(7, 'g'),(4, 'p'), +(1, 'q'),(9, 'w'),(4, 'd'),(8, 'e'),(4, 'b'),(8, 'y'); + +CREATE TABLE cc ( +col_int_nokey INTEGER, +col_int_key INTEGER GENERATED ALWAYS AS +(col_int_nokey + col_int_nokey) VIRTUAL, +col_varchar_nokey VARCHAR(1), +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)), +KEY (col_int_key), +KEY (col_varchar_key), +KEY (col_int_key, col_varchar_key), +KEY (col_int_key, col_int_nokey), +KEY (col_varchar_key, col_varchar_nokey) +); +INSERT INTO cc ( +col_int_nokey, +col_varchar_nokey +) VALUES (8, 'p'),(9, 'g'),(9, 'i'),(4, 'p'),(7, 'h'),(1, 'e'),(8, 'e'),(6, 'u'), +(6, 'j'),(6, 'e'),(1, 'z'),(227, 'w'),(NULL, 't'),(9, 'i'),(1, 'i'),(8, 'i'), +(5, 'b'),(8,'m'),(7, 'j'),(2, 'v'); +ANALYZE TABLE c, cc; + +--replace_column 10 # +--disable_warnings + +let query=SELECT +alias2 . col_varchar_key AS field1 +FROM ( cc AS alias1 , cc AS alias2 ) +WHERE +( alias2 . col_int_key , alias1 . col_int_nokey ) +NOT IN +( +SELECT +DISTINCT SQ1_alias2 . col_int_nokey AS SQ1_field1 , +SQ1_alias1 . col_int_key AS SQ1_field2 +FROM ( cc AS SQ1_alias1 , c AS SQ1_alias2 ) +GROUP BY SQ1_field1 , SQ1_field2 +) +GROUP BY field1; + +eval EXPLAIN $query; +eval $query; + +DROP TABLE IF EXISTS c,cc; + +SET @save_old_sql_mode= @@sql_mode; +SET sql_mode=""; +CREATE TABLE d ( + col_int int(11) DEFAULT NULL, + col_varchar_10_utf8 varchar(10) CHARACTER SET utf8 DEFAULT NULL, + pk int(11) NOT NULL AUTO_INCREMENT, + col_int_key int(11) GENERATED ALWAYS AS (col_int+col_int) VIRTUAL, + col_varchar_10_utf8_key varchar(10) CHARACTER SET utf8 GENERATED ALWAYS AS (REPEAT(SUBSTRING(col_varchar_10_utf8, -1), 5)) VIRTUAL, + PRIMARY KEY (pk), + KEY col_int_key (col_int_key), + KEY col_varchar_10_utf8_key (col_varchar_10_utf8_key), + KEY cover_key1 (col_int_key, col_varchar_10_utf8_key) +); + +INSERT INTO d (col_int, col_varchar_10_utf8) VALUES ('qhlhtrovam',1),('how',2),('htrovamzqr',3),('rovamzqrdc',4),('well',5),('g',6),('rdcenchyhu',7),('want',8); + +SELECT table1.pk AS field1 FROM d AS table1 LEFT JOIN d AS table2 ON table1.col_varchar_10_utf8_key = table2.col_varchar_10_utf8_key WHERE table1.col_int_key IS NULL GROUP BY table1.pk ; + +DROP TABLE d; + +--echo # +--echo # Bug#21153237: WL8149: QUERIES USING FILESORT +--echo # ON VIRTUAL GC HAVING INDEX GIVES WRONG RESULTS +--echo # +CREATE TABLE j ( +col_int int(11), +pk int(11) NOT NULL, +col_varchar_10_utf8 varchar(10) CHARACTER SET utf8 DEFAULT NULL, +col_varchar_255_utf8_key varchar(255) CHARACTER SET utf8 GENERATED ALWAYS AS +(col_varchar_10_utf8) VIRTUAL, +PRIMARY KEY (pk), +KEY cover_key1 (col_int, col_varchar_255_utf8_key)); + +INSERT INTO j(col_int, pk, col_varchar_10_utf8) VALUES(9, 1, '951910400'), +(-1934295040, 2, '1235025920'),(-584581120, 3, '-1176633344'),(3, 4, '1074462720'); + +--replace_column 10 # +EXPLAIN SELECT col_varchar_255_utf8_key FROM j ORDER BY 1; +SELECT col_varchar_255_utf8_key FROM j ORDER BY col_varchar_255_utf8_key; + +DROP TABLE j; + +set sql_mode= @save_old_sql_mode; +--enable_warnings +} + +CREATE TABLE cc ( + pk int(11) NOT NULL AUTO_INCREMENT, + col_int_nokey int(11) NOT NULL, + col_int_key int(11) GENERATED ALWAYS AS (col_int_nokey) STORED, + col_date_nokey date NOT NULL, + col_date_key date GENERATED ALWAYS AS (col_date_nokey) STORED, + col_datetime_nokey datetime NOT NULL, + col_time_nokey time NOT NULL, + col_datetime_key datetime GENERATED ALWAYS AS (col_datetime_nokey)STORED, + col_time_key time GENERATED ALWAYS AS (col_time_nokey) STORED, + col_varchar_nokey varchar(1) NOT NULL, + col_varchar_key varchar(1) GENERATED ALWAYS AS (col_varchar_nokey)STORED, + PRIMARY KEY (pk), + KEY gc_idx1 (col_int_key), + KEY gc_idx2 (col_varchar_key), + KEY gc_idx3 (col_date_key), + KEY gc_idx4 (col_time_key), + KEY gc_idx5 (col_datetime_key), + KEY gc_idx6 (col_varchar_key,col_int_key), + KEY gc_idx7 (col_date_key,col_datetime_key,col_time_key), + KEY gc_idx8(col_int_key,col_varchar_key,col_date_key,col_time_key, + col_datetime_key) +); + +INSERT INTO cc ( + col_int_nokey, + col_date_nokey, + col_time_nokey, + col_datetime_nokey, + col_varchar_nokey +) VALUES (1, '2009-12-01', '00:21:38.058143', '2007-05-28 00:00:00', 'c'), +(8, '2004-12-17', '04:08:02.046897', '2009-07-25 09:21:20.064099', 'm'), +(9, '2000-03-14', '16:25:11.040240', '2002-01-16 00:00:00', 'd'), +(24, '2000-10-08', '10:14:58.018534', '2006-10-12 04:32:53.031976', 'd'), +(6, '2006-05-25', '19:47:59.011283', '2001-02-15 03:08:38.035426', 'y'), +(1, '2008-01-23', '11:14:24.032949', '2004-10-02 20:31:15.022553', 't'); +SET @save_old_sql_mode= @@sql_mode; +SET sql_mode=""; + +# Warnings arrive in unpredictable order with NDB and cannot be sorted +if ($testing_ndb) +{ +--disable_warnings +} +SELECT DISTINCT alias1.col_varchar_key AS field1 +FROM ( cc AS alias1 STRAIGHT_JOIN + (( cc AS alias2 STRAIGHT_JOIN cc AS alias3 ON + (alias3.col_varchar_key > alias2.col_varchar_key ) ) ) ON + (( alias3 .pk >= alias2.col_int_nokey ) AND + (alias3 .pk >= alias2.col_int_nokey ) )) +WHERE alias1.col_varchar_key <= 'v' +GROUP BY field1 HAVING field1 = 91 +ORDER BY field1, alias1.col_date_key, field1 ASC, field1 DESC, + alias1.col_time_key ASC, field1; +DROP TABLE cc; +SET sql_mode=@save_old_sql_mode; +if ($testing_ndb) +{ +--enable_warnings +} + +--echo # +--echo # Bug#20797941: WL8149:ASSERTION !TABLE || +--echo # (!TABLE->READ_SET || BITMAP_IS_SET(TABLE->READ_SET +--echo # +CREATE TABLE t(a int, b int as(a+1)); +INSERT INTO t(a) values(1),(2); +SELECT * FROM t ORDER BY b; +DROP TABLE t; + +if ($support_virtual_index) +{ +--echo # +--echo # Testing a few index-based accesses on the virtual column +--echo # + +CREATE TABLE t1 ( +id int(11) NOT NULL, +b int(11) GENERATED ALWAYS AS (id+1) VIRTUAL, +UNIQUE KEY (b) ); + +--error ER_BAD_NULL_ERROR +INSERT INTO t1 (id) VALUES(NULL); + +INSERT INTO t1 (id) VALUES(2),(3); + +# constant table read with one index lookup +EXPLAIN SELECT * FROM t1 FORCE INDEX(b) WHERE b=3; + +# eq_ref +EXPLAIN SELECT * FROM t1 AS t2 STRAIGHT_JOIN t1 FORCE INDEX(b) WHERE t1.b=t2.b; + +# covering index scan +EXPLAIN SELECT b FROM t1 FORCE INDEX(b); + +# range scan +INSERT INTO t1 (id) VALUES(4),(5),(6),(7),(8),(9),(10); +EXPLAIN SELECT b FROM t1 FORCE INDEX(b) WHERE b BETWEEN 1 AND 5; + +# index-subquery +EXPLAIN SELECT * FROM t2 AS t1 WHERE b NOT IN (SELECT b FROM t1 FORCE INDEX(b)); + +DROP TABLE t1; +} + +DROP TABLE t2, t3; + +--echo # +--echo # Bug#21317507:GC: STORED COLUMN REJECTED, BUT VIRTUAL IS ACCEPTED +--echo # +--disable_abort_on_error +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(2147483647); +ALTER TABLE t1 ADD COLUMN b SMALLINT AS (a) VIRTUAL; +ALTER TABLE t1 DROP COLUMN b; +ALTER TABLE t1 ADD COLUMN c SMALLINT AS (a) VIRTUAL; +ALTER TABLE t1 DROP COLUMN c; +ALTER TABLE t1 ADD COLUMN d SMALLINT AS (a) VIRTUAL; +ALTER TABLE t1 DROP COLUMN d; +ALTER TABLE t1 ADD COLUMN c INT AS(a) VIRTUAL; +ALTER TABLE t1 CHANGE c c SMALLINT AS(a) VIRTUAL; +ALTER TABLE t1 MODIFY c TINYINT AS(a) VIRTUAL; +SELECT * FROM t1; +DROP TABLE t1; +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(2147483647); +ALTER TABLE t1 ADD COLUMN h INT AS (a) VIRTUAL; +ALTER TABLE t1 CHANGE h i INT AS (a) VIRTUAL, ALGORITHM=COPY; +ALTER TABLE t1 ADD COLUMN b SMALLINT AS (a) VIRTUAL, ALGORITHM=COPY, LOCK=NONE; +ALTER TABLE t1 ADD COLUMN e SMALLINT AS (a) VIRTUAL, ALGORITHM=COPY, LOCK=NONE; +ALTER TABLE t1 ADD COLUMN f SMALLINT AS (a) VIRTUAL, ALGORITHM=COPY, LOCK=SHARED; +ALTER TABLE t1 ADD COLUMN g SMALLINT AS (a) VIRTUAL, ALGORITHM=COPY, LOCK=EXCLUSIVE; +--enable_abort_on_error +DROP TABLE t1; + +--echo # +--echo # Bug#21980430 GCOLS: CRASHING +--echo # +CREATE TABLE t ( + a INT, + b BLOB, + c BLOB GENERATED ALWAYS AS (a+b) VIRTUAL, + UNIQUE KEY i0008 (a) +); + +INSERT INTO t(a,b) VALUES(1,'cccc'); +let $query= +SELECT /*+ bka() */ 1 AS c FROM t AS b RIGHT JOIN t AS c ON b.a > c.c +WHERE b.b>c.a; +eval EXPLAIN $query; +eval $query; +DROP TABLE t; + +# Force DS-MRR to be used +set @optimizer_switch_save = @@optimizer_switch; +set optimizer_switch='mrr_cost_based=off'; + +# Reduce the size of the DS-MRR sort buffer to force multiple rounds +set @read_rnd_buffer_size_save= @@read_rnd_buffer_size; +set read_rnd_buffer_size=32; + +CREATE TABLE t0 ( + i1 INTEGER NOT NULL +); + +INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +CREATE TABLE t1 ( + pk INTEGER NOT NULL, + i1 INTEGER NOT NULL, + i2 INTEGER NOT NULL, + v1 INTEGER GENERATED ALWAYS AS (i2 + 1) VIRTUAL, + v2 INTEGER GENERATED ALWAYS AS (i1 / (i1 - i2 + 57)) VIRTUAL, + PRIMARY KEY (pk), + INDEX idx(i1) +); + +INSERT INTO t1 (pk, i1, i2) +SELECT a0.i1 + a1.i1*10 + a2.i1*100, + a0.i1 + a1.i1*10, + a0.i1 + a1.i1*10 +FROM t0 AS a0, t0 AS a1, t0 AS a2; + +# Do a DS-MRR scan on an index on a non-generated column +# (this caused Division by 0 errors to be reported). +let query1= +SELECT * FROM t1 +WHERE i1 > 41 AND i1 <= 43; + +eval EXPLAIN $query1; +--sorted_result +eval $query1; + +if ($support_virtual_index) +{ +ALTER TABLE t1 ADD INDEX idx2(v1); +} + +# Do a DS-MRR scan on an index on a virtual column +# (this query returned too few records). +let query2= +SELECT * FROM t1 +WHERE v1 > 41 AND v1 <= 43; + +--replace_column 9 # +eval EXPLAIN $query2; +--sorted_result +eval $query2; + +DROP TABLE t0, t1; + +# Restore defaults +set optimizer_switch= @optimizer_switch_save; +set @@read_rnd_buffer_size= @read_rnd_buffer_size_save; + +--echo # +--echo # Bug#21872184 CONDITIONAL JUMP AT JOIN_CACHE::WRITE_RECORD_DATA IN +--echo # SQL_JOIN_BUFFER.CC +--echo # + +--echo # +--echo # Test 1: Dynamic range scan with one covering index +--echo # + +# This is the original test case which produces the valgrind error when +# inserting data into the join buffer. The test failure only occurs with +# InnoDB since it is only InnoDB that currently supports indexes on +# virtual columns and is the only storage engine that includes the +# primary key in each secondary key. + +CREATE TABLE t1 ( + i1 INTEGER NOT NULL, + c1 VARCHAR(1) NOT NULL +); + +INSERT INTO t1 +VALUES (10, 'c'), (10, 'i'), (2, 't'), (4, 'g'); + +CREATE TABLE t2 ( + i1 INTEGER NOT NULL, + c1 VARCHAR(1) NOT NULL +); + +INSERT INTO t2 +VALUES (2, 'k'), (9, 'k'), (7, 'o'), (5, 'n'), (7, 'e'); + +CREATE TABLE t3 ( + pk INTEGER NOT NULL, + i1 INTEGER, + i2_key INTEGER GENERATED ALWAYS AS (i1 + i1) VIRTUAL, + PRIMARY KEY (pk) +); + +if ($support_virtual_index) +{ +--echo # Add a covering index. The reason for this index being covering is that +--echo # secondary indexes in InnoDB include the primary key. +ALTER TABLE t3 ADD INDEX v_idx (i2_key); +} + +INSERT INTO t3 (pk, i1) +VALUES (1, 1), (2, 48), (3, 228), (4, 3), (5, 5), + (6, 39), (7, 6), (8, 8), (9, 3); + +CREATE TABLE t4 ( + i1 INTEGER NOT NULL, + c1 VARCHAR(1) NOT NULL +); + +INSERT INTO t4 +VALUES (1, 'j'), (2, 'c'), (0, 'a'); + +ANALYZE TABLE t1, t2, t3, t4; + +# Hint is added to avoid materialization of the subquery +let query= +SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN + ( + SELECT /*+ QB_NAME(subq1) */ t4.i1 + FROM t4 + WHERE t4.c1 < 'o' + ) +) +AND t1.i1 <= t3.i2_key; + +eval EXPLAIN $query; +--sorted_result +eval $query; + +--echo # +--echo # Test 2: Two alternative covering indexes for the range scan +--echo # + +# Adding second covering index +if ($support_virtual_index) +{ +ALTER TABLE t3 ADD INDEX v_idx2 (i2_key, i1); +} + +# Hint is added to avoid materialization of the subquery +let query= +SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN + ( + SELECT /*+ QB_NAME(subq1) */ t4.i1 + FROM t4 + WHERE t4.c1 < 'o' + ) +) +AND t1.i1 <= t3.i2_key; + +eval EXPLAIN $query; +--sorted_result +eval $query; + +--echo # +--echo # Test 3: One covering index including the base column for the virtual +--echo # column +--echo # + +if ($support_virtual_index) +{ +--echo # Drop the index with only the virtual column +ALTER TABLE t3 DROP INDEX v_idx; +} + +# Hint is added to avoid materialization of the subquery +let query= +SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN + ( + SELECT /*+ QB_NAME(subq1) */ t4.i1 + FROM t4 + WHERE t4.c1 < 'o' + ) +) +AND t1.i1 <= t3.i2_key; + +eval EXPLAIN $query; +--sorted_result +eval $query; + +--echo # +--echo # Test 4: One non-covering index +--echo # + +if ($support_virtual_index) +{ +--echo # Drop the index on two columns, add index on just one virtual column +ALTER TABLE t3 DROP INDEX v_idx2; +ALTER TABLE t3 ADD INDEX v_idx (i2_key); +} + +--echo # Add more data to the table so that it will run the dynamic range scan +--echo # as both table scan and range scan (the purpose of this is to make the +--echo # table scan more expensive). +INSERT INTO t3 (pk, i1) +VALUES (10,1), (11,1), (12,1), (13,1), (14,1),(15,1), (16,1),(17,1), (18,1), + (19,1), (20,1), (21,1), (22,1), (23,1), (24,1),(25,1),(26,1),(27,1), + (28,1), (29,1); + +--echo # Change the query to read an extra column (t3.i1) making the index +--echo # non-covering. +# Hint is added to avoid materialization of the subquery +let query= +SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1, t3.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN + ( + SELECT /*+ QB_NAME(subq1) */ t4.i1 + FROM t4 + WHERE t4.c1 < 'o' + ) +) +AND t1.i1 <= t3.i2_key; + +eval EXPLAIN $query; +--sorted_result +eval $query; + +--echo # +--echo # Test 5: Test where the added primary key to secondary indexes is +--echo # used after it has been included in the join buffer +--echo # + +# This test is only relevant for storage engines that add the primary key +# to all secondary keys (e.g. InnoDB). For these engines, the fields in the +# primary key might be included when deciding that a secondary index is +# covering for the query. This is the case for most of the secondary indexes +# on t3 in this test. But in the above queries, the subquery is non-dependent +# and the "t3.pk IN .." will be evaluated after rows for t3 are read. At this +# time t3.pk is in the record buffer. t3.pk is not used after it has been +# inserted into the join buffer. To test that t3.pk is actually correctly +# included in the join buffer we change the subquery to be dependent and +# only evaluated after the join has been done. +# The purpose of this test is to ensure that we correctly handle and +# include primary key fields that are added to a covering secondary index. + +# The difference between this query and the query in test 1 is that +# an extra query condition is added to the subquery. +# Hint is added to avoid materialization of the subquery +let query= +SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN + ( + SELECT /*+ QB_NAME(subq1) */ t4.i1 + FROM t4 + WHERE t4.c1 < 'o' and t4.i1 < (t2.i1 + 1) + ) +) +AND t1.i1 <= t3.i2_key; + +eval EXPLAIN $query; +--sorted_result +eval $query; + +DROP TABLE t1, t2, t3, t4; diff --git a/mysql-test/suite/gcol/inc/gcol_supported_sql_funcs.inc b/mysql-test/suite/gcol/inc/gcol_supported_sql_funcs.inc new file mode 100644 index 00000000000..88f2f7c4da1 --- /dev/null +++ b/mysql-test/suite/gcol/inc/gcol_supported_sql_funcs.inc @@ -0,0 +1,47 @@ +################################################################################ +# inc/gcol_supported_sql_funcs.inc # +# # +# Purpose: # +# Tests frame for allowed sql functions # +# # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-08-31 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +--enable_warnings +set sql_warnings = 1; +eval create table t1 ($cols); +show create table t1; +if ($rows) +{ +# Allow out-of-range errors +--error 0,1264,1690,3020 + eval insert into t1 values ($values1); + dec $rows; +} +if ($rows) +{ +--error 0,1292,1690,3020 + eval insert into t1 values ($values2); + dec $rows; +} +if ($rows) +{ +--error 0,1690,3020 + eval insert into t1 values ($values3); + dec $rows; +} +if ($rows) +{ + eval insert into t1 values ($values4); + dec $rows; +} +--sorted_result +select * from t1; +drop table t1; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/inc/gcol_supported_sql_funcs_main.inc b/mysql-test/suite/gcol/inc/gcol_supported_sql_funcs_main.inc new file mode 100644 index 00000000000..88268ddd6c4 --- /dev/null +++ b/mysql-test/suite/gcol/inc/gcol_supported_sql_funcs_main.inc @@ -0,0 +1,1245 @@ +################################################################################ +# inc/gcol_supported_sql_funcs_main.inc # +# # +# Purpose: # +# Tests frame for allowed sql functions # +# # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-08-31 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ +set time_zone="+03:00"; +--echo # +--echo # NUMERIC FUNCTIONS +--echo # + +--echo # ABS() +let $cols = a int, b int generated always as (abs(a)) virtual; +let $values1 = -1, default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # ACOS() +let $cols = a double, b double generated always as (format(acos(a),6)) virtual; +let $values1 = 1, default; +let $values2 = 1.0001,default; +let $values3 = 0,default; +let $rows = 3; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # ASIN() +let $cols = a double, b double generated always as (format(asin(a),6)) virtual; +let $values1 = 0.2, default; +let $values2 = 1.0001,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo #ATAN +let $cols = a double, b double, c double generated always as (format(atan(a,b),6)) virtual; +let $values1 = -2,2,default; +let $values2 = format(PI(),6),0,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +let $cols = a double, c double generated always as (format(atan(a),6)) virtual; +let $values1 = -2,default; +let $values2 = format(PI(),6),default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # ATAN2 +let $cols = a double, b double, c double generated always as (format(atan2(a,b),6)) virtual; +let $values1 = -2,2,default; +let $values2 = format(PI(),6),0,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # CEIL() +let $cols = a double, b int generated always as (ceil(a)) virtual; +let $values1 = 1.23,default; +let $values2 = -1.23,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # CONV() +let $cols = a varchar(10), b int, c int, d varchar(10) generated always as (conv(a,b,c)) virtual; +let $values1 = 'a',16,2,default; +let $values2 = '6e',18,8,default; +let $values3 = -17,10,-18,default; +let $values4 = 10+'10'+'10'+0xa,10,10,default; +let $rows = 4; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # COS() +let $cols = a double, b double generated always as (format(cos(a),6)) virtual; +let $values1 = format(PI(),6),default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # COT() +let $cols = a double, b double generated always as (format(cot(a),6)) virtual; +let $values1 = 0,default; +let $values2 = 12,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # CRC32() +let $cols = a varchar(10), b bigint generated always as (crc32(a)) virtual; +let $values1 = 'MySQL',default; +let $values2 = 'mysql',default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # DEGREES() +let $cols = a double, b double generated always as (format(degrees(a),6)) virtual; +let $values1 = format(PI(),6),default; +let $values2 = format(PI()/2,6),default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # / +let $cols = a double, b double generated always as (a/2) virtual; +let $values1 = 2,default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # EXP() +let $cols = a double, b double generated always as (format(exp(a),6)) virtual; +let $values1 = 2,default; +let $values2 = -2,default; +let $values3 = 0,default; +let $rows = 3; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # FLOOR() +let $cols = a double, b bigint generated always as (floor(a)) virtual; +let $values1 = 1.23,default; +let $values2 = -1.23,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # LN() +let $cols = a double, b double generated always as (format(ln(a),6)) virtual; +let $values1 = 2,default; +let $values2 = -2,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # LOG() +let $cols = a double, b double, c double generated always as (format(log(a,b),6)) virtual; +let $values1 = 2,65536,default; +let $values2 = 10,100,default; +let $values3 = 1,100,default; +let $rows = 3; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +let $cols = a double, b double generated always as (format(log(a),6)) virtual; +let $values1 = 2,default; +let $values2 = -2,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # LOG2() +let $cols = a double, b double generated always as (format(log2(a),6)) virtual; +let $values1 = 65536,default; +let $values2 = -100,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # LOG10() +let $cols = a double, b double generated always as (format(log10(a),6)) virtual; +let $values1 = 2,default; +let $values2 = 100,default; +let $values3 = -100,default; +let $rows = 3; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # - +let $cols = a double, b double generated always as (a-1) virtual; +let $values1 = 2,default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # MOD() +let $cols = a int, b int generated always as (mod(a,10)) virtual; +let $values1 = 1,default; +let $values2 = 11,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # % +let $cols = a int, b int generated always as (a % 10) virtual; +let $values1 = 1,default; +let $values2 = 11,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # OCT() +let $cols = a double, b varchar(10) generated always as (oct(a)) virtual; +let $values1 = 12,default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # PI() +let $cols = a double, b double generated always as (format(PI()*a*a,6)) virtual; +let $values1 = 1,default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # + +let $cols = a int, b int generated always as (a+1) virtual; +let $values1 = 1,default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # POW, POWER +let $cols = a int, b int generated always as (pow(a,2)) virtual, c int generated always as (power(a,2)) virtual; +let $values1 = 1,default,default; +let $values2 = 2,default,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # RADIANS() +let $cols = a double, b double generated always as (format(radians(a),6)) virtual; +let $values1 = 90,default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # ROUND() +let $cols = a double, b int generated always as (round(a)) virtual; +let $values1 = -1.23,default; +let $values2 = -1.58,default; +let $values3 = 1.58,default; +let $rows = 3; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +let $cols = a double, b double, c int generated always as (round(a,b)) virtual; +let $values1 = 1.298,1,default; +let $values2 = 1.298,0,default; +let $values3 = 23.298,-1,default; +let $rows = 3; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # SIGN() +let $cols = a double, b int generated always as (sign(a)) virtual; +let $values1 = -32,default; +let $values2 = 0,default; +let $values3 = 234,default; +let $rows = 3; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # SIN() +let $cols = a double, b double generated always as (format(sin(a),6)) virtual; +let $values1 = format(PI()/2,6),default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # SQRT() +let $cols = a double, b double generated always as (format(sqrt(a),6)) virtual; +let $values1 = 4,default; +let $values2 = 20,default; +let $values3 = -16,default; +let $rows = 3; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # TAN() +let $cols = a double, b double generated always as (format(tan(a),6)) virtual; +let $values1 = format(PI(),6),default; +let $values2 = format(PI()+1,6),default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # * +let $cols = a double, b double generated always as (a*3) virtual; +let $values1 = 0,default; +let $values2 = 1,default; +let $values3 = 2,default; +let $rows = 3; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # TRUNCATE() +let $cols = a double, b double generated always as (truncate(a,4)) virtual; +let $values1 = 1.223,default; +let $values2 = 1.999,default; +let $values3 = 1.999,default; +let $values4 = 122,default; +let $rows = 4; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # Unary - +let $cols = a double, b double generated always as (-a) virtual; +let $values1 = 1,default; +let $values2 = -1,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # +--echo # STRING FUNCTIONS +--echo # + +--echo # ASCII() +let $cols = a char(2), b int generated always as (ascii(a)) virtual; +let $values1 = '2',default; +let $values2 = 2,default; +let $values3 = 'dx',default; +let $rows = 3; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # BIN() +let $cols = a int, b varchar(10) generated always as (bin(a)) virtual; +let $values1 = 12,default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # BIT_LENGTH() +let $cols = a varchar(10), b bigint generated always as (bit_length(a)) virtual; +let $values1 = 'text',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # CHAR_LENGTH() +let $cols = a varchar(10), b bigint generated always as (char_length(a)) virtual; +let $values1 = 'text',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # CHAR() +let $cols = a int, b int, c varbinary(10) generated always as (char(a,b)) virtual; +let $values1 = 77,121,default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # CHARACTER_LENGTH() +let $cols = a varchar(10), b bigint generated always as (character_length(a)) virtual; +let $values1 = 'text',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # CONCAT_WS() +let $cols = a varchar(10), b varchar(10), c varchar(20) generated always as (concat_ws(',',a,b)) virtual; +let $values1 = 'value1','value2',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # CONCAT() +let $cols = a varchar(10), b varchar(10), c varchar(20) generated always as (concat(a,',',b)) virtual; +let $values1 = 'value1','value2',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # ELT() +let $cols = a varchar(10), b varchar(10), c int, d varchar(10) generated always as (elt(c,a,b)) virtual; +let $values1 = 'value1','value2',1,default; +let $values2 = 'value1','value2',2,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # EXPORT_SET() +let $cols = a int, b varchar(10) generated always as (export_set(a,'1','0','',10)) virtual; +let $values1 = 6,default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # FIELD() +let $cols = a varchar(10), b varchar(10), c int generated always as (field('aa',a,b)) virtual; +let $values1 = 'aa','bb',default; +let $values2 = 'bb','aa',default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # FIND_IN_SET() +let $cols = a varchar(10), b varchar(10), c int generated always as (find_in_set(a,b)) virtual; +let $values1 = 'aa','aa,bb,cc',default; +let $values2 = 'aa','bb,aa,cc',default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # FORMAT() +let $cols = a double, b varchar(20) generated always as (format(a,2)) virtual; +let $values1 = 12332.123456,default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # HEX() +let $cols = a int, b varchar(10) generated always as (hex(a)) virtual; +let $values1 = 17,default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +let $cols = a varchar(10), b varchar(10) generated always as (hex(a)) virtual; +let $values1 = 'abc',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # INSERT() +let $cols = a varchar(10), b varchar(10), c varchar(20) generated always as (insert(a,length(a),length(b),b)) virtual; +let $values1 = 'start,','end',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # INSTR() +let $cols = a varchar(10), b varchar(10), c int generated always as (instr(a,b)) virtual; +let $values1 = 'foobarbar,','bar',default; +let $values2 = 'xbar,','foobar',default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # LCASE() +let $cols = a varchar(10), b varchar(10) generated always as (lcase(a)) virtual; +let $values1 = 'MySQL',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # LEFT() +let $cols = a varchar(10), b varchar(5) generated always as (left(a,5)) virtual; +let $values1 = 'foobarbar',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # LENGTH() +let $cols = a varchar(10), b int generated always as (length(a)) virtual; +let $values1 = 'text',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # LIKE +let $cols = a varchar(10), b bool generated always as (a like 'H%o') virtual; +let $values1 = 'Hello',default; +let $values2 = 'MySQL',default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # LOCATE() +let $cols = a varchar(10), b varchar(10) generated always as (locate('bar',a)) virtual; +let $values1 = 'foobarbar',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # LOWER() +let $cols = a varchar(10), b varchar(10) generated always as (lower(a)) virtual; +let $values1 = 'MySQL',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # LPAD() +let $cols = a varchar(10), b varchar(10) generated always as (lpad(a,4,' ')) virtual; +let $values1 = 'MySQL',default; +let $values2 = 'M',default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # LTRIM() +let $cols = a varchar(10), b varchar(10) generated always as (ltrim(a)) virtual; +let $values1 = ' MySQL',default; +let $values2 = 'MySQL',default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # MAKE_SET() +let $cols = a varchar(10), b varchar(10), c int, d varchar(30) generated always as (make_set(c,a,b)) virtual; +let $values1 = 'a','b',1,default; +let $values2 = 'a','b',3,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # MID() +let $cols = a varchar(10), b varchar(10) generated always as (mid(a,1,2)) virtual; +let $values1 = 'foobarbar',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # NOT LIKE +let $cols = a varchar(10), b bool generated always as (a not like 'H%o') virtual; +let $values1 = 'Hello',default; +let $values2 = 'MySQL',default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # NOT REGEXP +let $cols = a varchar(10), b bool generated always as (a not regexp 'H.+o') virtual; +let $values1 = 'Hello',default; +let $values2 = 'hello',default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # OCTET_LENGTH() +let $cols = a varchar(10), b int generated always as (octet_length(a)) virtual; +let $values1 = 'text',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # ORD() +let $cols = a varchar(10), b bigint generated always as (ord(a)) virtual; +let $values1 = '2',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # POSITION() +let $cols = a varchar(10), b varchar(10) generated always as (position('bar' in a)) virtual; +let $values1 = 'foobarbar',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # QUOTE() +let $cols = a varchar(10), b varchar(10) generated always as (quote(a)) virtual; +let $values1 = 'Don\'t',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # REGEXP() +let $cols = a varchar(10), b bool generated always as (a regexp 'H.+o') virtual; +let $values1 = 'Hello',default; +let $values2 = 'hello',default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # REPEAT() +let $cols = a varchar(10), b varchar(30) generated always as (repeat(a,3)) virtual; +let $values1 = 'MySQL',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # REPLACE() +let $cols = a varchar(10), b varchar(30) generated always as (replace(a,'aa','bb')) virtual; +let $values1 = 'maa',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # REVERSE() +let $cols = a varchar(10), b varchar(30) generated always as (reverse(a)) virtual; +let $values1 = 'maa',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # RIGHT() +let $cols = a varchar(10), b varchar(10) generated always as (right(a,4)) virtual; +let $values1 = 'foobarbar',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # RLIKE() +let $cols = a varchar(10), b bool generated always as (a rlike 'H.+o') virtual; +let $values1 = 'Hello',default; +let $values2 = 'MySQL',default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # RPAD() +let $cols = a varchar(10), b varchar(10) generated always as (rpad(a,4,'??')) virtual; +let $values1 = 'He',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # RTRIM(); +let $cols = a varchar(10), b varchar(10) generated always as (rtrim(a)) virtual; +let $values1 = 'Hello ',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # SOUNDEX() +let $cols = a varchar(10), b varchar(20) generated always as (soundex(a)) virtual; +let $values1 = 'Hello',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # SOUNDS LIKE +let $cols = a varchar(10), b varchar(10), c bool generated always as (a sounds like b) virtual; +let $values1 = 'Hello','Hello',default; +let $values2 = 'Hello','MySQL',default; +let $values3 = 'Hello','hello',default; +let $rows = 3; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # SPACE() +let $cols = a varchar(5), b varchar(10) generated always as (concat(a,space(5))) virtual; +let $values1 = 'Hello', default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # STRCMP() +let $cols = a varchar(9), b varchar(9), c tinyint(1) generated always as (strcmp(a,b)) virtual; +let $values1 = 'Hello','Hello', default; +let $values2 = 'Hello','Hello1', default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # SUBSTR() +let $cols = a varchar(5), b varchar(10) generated always as (substr(a,2)) virtual; +let $values1 = 'Hello',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # SUBSTRING_INDEX() +let $cols = a varchar(15), b varchar(10) generated always as (substring_index(a,'.',2)) virtual; +let $values1 = 'www.mysql.com',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # SUBSTRING() +let $cols = a varchar(5), b varchar(10) generated always as (substring(a from 2 for 2)) virtual; +let $values1 = 'Hello',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # TRIM() +let $cols = a varchar(15), b varchar(10) generated always as (trim(a)) virtual; +let $values1 = ' aa ',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # UCASE() +let $cols = a varchar(5), b varchar(10) generated always as (ucase(a)) virtual; +let $values1 = 'MySQL',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # UNHEX() +let $cols = a varchar(15), b varchar(10) generated always as (unhex(a)) virtual; +let $values1 = '4D7953514C',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # UPPER() +let $cols = a varchar(5), b varchar(10) generated always as (upper(a)) virtual; +let $values1 = 'MySQL',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # WEIGHT_STRING() +let $cols = a varchar(5), b varchar(10) generated always as (weight_string(a as char(4))) virtual; +let $values1 = 'MySQL',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # +--echo # CONTROL FLOW FUNCTIONS +--echo # + +--echo # CASE +let $cols = a varchar(10), b varchar(16) generated always as (case a when NULL then 'asd' when 'b' then 'B' else a end) virtual; +let $values1 = NULL,default; +let $values2 = 'b',default; +let $values3 = 'c',default; +let $rows = 3; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # IF +let $cols = a int, b int, c int generated always as (if(a=1,a,b)) virtual; +let $values1 = 1,2,default; +let $values2 = 3,4,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # IFNULL +let $cols = a varchar(10), b varchar(10), c varchar(10) generated always as (ifnull(a,'DEFAULT')) virtual; +let $values1 = NULL,'adf',default; +let $values2 = 'a','adf',default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # NULLIF +let $cols = a varchar(10), b varchar(10) generated always as (nullif(a,'DEFAULT')) virtual; +let $values1 = 'DEFAULT',default; +let $values2 = 'a',default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # +--echo # OPERATORS +--echo # + +--echo # AND, && +let $cols = a int, b bool generated always as (a>0 && a<2) virtual; +let $values1 = -1,default; +let $values2 = 1,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # BETWEEN ... AND ... +let $cols = a int, b bool generated always as (a between 0 and 2) virtual; +let $values1 = -1,default; +let $values2 = 1,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # BINARY +let $cols = a varchar(10), b varbinary(10) generated always as (binary a) virtual; +let $values1 = '11',default; +let $values2 = 1,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # & +let $cols = a int, b int generated always as (a & 5) virtual; +let $values1 = 1,default; +let $values2 = 0,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # ~ +let $cols = a int, b int generated always as (~a) virtual; +let $values1 = 1,default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # | +let $cols = a int, b int generated always as (a | 5) virtual; +let $values1 = 1,default; +let $values2 = 0,default; +let $values3 = 2,default; +let $rows = 3; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # ^ +let $cols = a int, b int generated always as (a ^ 5) virtual; +let $values1 = 1,default; +let $values2 = 0,default; +let $values3 = 2,default; +let $rows = 3; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # DIV +let $cols = a int, b int generated always as (a div 5) virtual; +let $values1 = 1,default; +let $values2 = 7,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # <=> +let $cols = a int, b int, c bool generated always as (a <=> b) virtual; +let $values1 = 1,1,default; +let $values2 = NULL,NULL,default; +let $values3 = 1,NULL,default; +let $rows = 3; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # = +let $cols = a varchar(10), b varchar(10), c bool generated always as (a=b) virtual; +let $values1 = 'a','b',default; +let $values2 = 'a','a',default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # >= +let $cols = a varchar(10), b varchar(10), c bool generated always as (a >= b) virtual; +let $values1 = 'a','b',default; +let $values2 = 'a','a',default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # > +let $cols = a varchar(10), b varchar(10), c bool generated always as (a > b) virtual; +let $values1 = 'a','b',default; +let $values2 = 'a','a',default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # IS NOT NULL +let $cols = a int, b bool generated always as (a is not null) virtual; +let $values1 = 1,default; +let $values2 = NULL,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # IS NULL +let $cols = a int, b bool generated always as (a is null) virtual; +let $values1 = 1,default; +let $values2 = NULL,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # << +let $cols = a int, b int generated always as (a << 2) virtual; +let $values1 = 1,default; +let $values2 = 3,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # <= +let $cols = a varchar(10), b varchar(10), c bool generated always as (a <= b) virtual; +let $values1 = 'b','a',default; +let $values2 = 'b','b',default; +let $values3 = 'b','c',default; +let $rows = 3; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # < +let $cols = a varchar(10), b varchar(10), c bool generated always as (a < b) virtual; +let $values1 = 'b','a',default; +let $values2 = 'b','b',default; +let $values3 = 'b','c',default; +let $rows = 3; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # NOT BETWEEN ... AND ... +let $cols = a int, b bool generated always as (a not between 0 and 2) virtual; +let $values1 = -1,default; +let $values2 = 1,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # <> +let $cols = a varchar(10), b varchar(10), c bool generated always as (a <> b) virtual; +let $values1 = 'b','a',default; +let $values2 = 'b','b',default; +let $values3 = 'b','c',default; +let $rows = 3; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # != +let $cols = a varchar(10), b varchar(10), c bool generated always as (a != b) virtual; +let $values1 = 'b','a',default; +let $values2 = 'b','b',default; +let $values3 = 'b','c',default; +let $rows = 3; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # ||, OR +let $cols = a int, b int generated always as (a>5 || a<3) virtual; +let $values1 = 1,default; +let $values2 = 4,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # >> +let $cols = a int, b int generated always as (a >> 2) virtual; +let $values1 = 8,default; +let $values2 = 3,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # XOR +let $cols = a int, b int generated always as (a xor 5) virtual; +let $values1 = 0,default; +let $values2 = 1,default; +let $values3 = 2,default; +let $rows = 3; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # +--echo # DATE AND TIME FUNCTIONS +--echo # + +--echo # ADDDATE() +let $cols = a datetime, b datetime generated always as (adddate(a,interval 1 month)) virtual; +let $values1 = '2008-08-31',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # ADDTIME() +let $cols = a datetime, b datetime generated always as (addtime(a,'02:00:00')) virtual; +let $values1 = '2008-08-31',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # CONVERT_TZ() +let $cols = a datetime, b datetime generated always as (convert_tz(a,'MET','UTC')) virtual; +let $values1 = '2008-08-31',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # DATE_ADD() +let $cols = a datetime, b datetime generated always as (date_add(a,interval 1 month)) virtual; +let $values1 = '2008-08-31',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # DATE_FORMAT() +let $cols = a datetime, b varchar(64) generated always as (date_format(a,'%W %M %D')) virtual; +let $values1 = '2008-08-31',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # DATE_SUB() +let $cols = a datetime, b datetime generated always as (date_sub(a,interval 1 month)) virtual; +let $values1 = '2008-08-31',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # DATE() +let $cols = a datetime, b datetime generated always as (date(a)) virtual; +let $values1 = '2008-08-31 02:00:00',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # DATEDIFF() +let $cols = a datetime, b bigint generated always as (datediff(a,'2000-01-01')) virtual; +let $values1 = '2008-08-31',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # DAY() +let $cols = a datetime, b int generated always as (day(a)) virtual; +let $values1 = '2008-08-31',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # DAYNAME() +let $cols = a datetime, b varchar(10) generated always as (dayname(a)) virtual; +let $values1 = '2008-08-31',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # DAYOFMONTH() +let $cols = a datetime, b int generated always as (dayofmonth(a)) virtual; +let $values1 = '2008-08-31',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # DAYOFWEEK() +let $cols = a datetime, b int generated always as (dayofweek(a)) virtual; +let $values1 = '2008-08-31',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # DAYOFYEAR() +let $cols = a datetime, b int generated always as (dayofyear(a)) virtual; +let $values1 = '2008-08-31',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # EXTRACT +let $cols = a datetime, b int generated always as (extract(year from a)) virtual; +let $values1 = '2008-08-31',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # FROM_DAYS() +let $cols = a bigint, b datetime generated always as (from_days(a)) virtual; +let $values1 = 730669,default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # FROM_UNIXTIME() +let $cols = a bigint, b datetime generated always as (from_unixtime(a)) virtual; +let $values1 = 1196440219,default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # GET_FORMAT() +let $cols = a datetime, b varchar(32) generated always as (date_format(a,get_format(DATE,'EUR'))) virtual; +let $values1 = '2008-08-31',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # HOUR() +let $cols = a time, b bigint generated always as (hour(a)) virtual; +let $values1 = '10:05:03',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # LAST_DAY() +let $cols = a datetime, b datetime generated always as (last_day(a)) virtual; +let $values1 = '2003-02-05',default; +let $values2 = '2003-02-32',default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # MAKEDATE() +let $cols = a int, b datetime generated always as (makedate(a,1)) virtual; +let $values1 = 2001,default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # MAKETIME() +let $cols = a int, b time generated always as (maketime(a,1,3)) virtual; +let $values1 = 12,default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # MICROSECOND() +let $cols = a datetime, b bigint generated always as (microsecond(a)) virtual; +let $values1 = '2009-12-31 12:00:00.123456',default; +let $values2 = '2009-12-31 23:59:59.000010',default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # MINUTE() +let $cols = a datetime, b int generated always as (minute(a)) virtual; +let $values1 = '2009-12-31 23:59:59.000010',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # MONTH() +let $cols = a datetime, b int generated always as (month(a)) virtual; +let $values1 = '2009-12-31 23:59:59.000010',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # MONTHNAME() +let $cols = a datetime, b varchar(16) generated always as (monthname(a)) virtual; +let $values1 = '2009-12-31 23:59:59.000010',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # PERIOD_ADD() +let $cols = a int, b int generated always as (period_add(a,2)) virtual; +let $values1 = 200801,default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # PERIOD_DIFF() +let $cols = a int, b int, c int generated always as (period_diff(a,b)) virtual; +let $values1 = 200802,200703,default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # QUARTER() +let $cols = a datetime, b int generated always as (quarter(a)) virtual; +let $values1 = '2008-08-31',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # SEC_TO_TIME() +let $cols = a bigint, b time generated always as (sec_to_time(a)) virtual; +let $values1 = 2378,default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # SECOND() +let $cols = a datetime, b int generated always as (second(a)) virtual; +let $values1 = '10:05:03',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # STR_TO_DATE() +let $cols = a varchar(64), b datetime generated always as (str_to_date(a,'%m/%d/%Y')) virtual; +let $values1 = '04/30/2004',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # SUBDATE() +let $cols = a datetime, b datetime generated always as (subdate(a,interval 1 month)) virtual; +let $values1 = '2008-08-31',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # SUBTIME() +let $cols = a datetime, b datetime generated always as (subtime(a,'02:00:00')) virtual; +let $values1 = '2008-08-31',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # TIME_FORMAT() +let $cols = a datetime, b varchar(32) generated always as (time_format(a,'%r')) virtual; +let $values1 = '2008-08-31 02:03:04',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # TIME_TO_SEC() +let $cols = a time, b bigint generated always as (time_to_sec(a)) virtual; +let $values1 = '22:23:00',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # TIME() +let $cols = a datetime, b time generated always as (time(a)) virtual; +let $values1 = '2008-08-31 02:03:04',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # TIMEDIFF() +let $cols = a datetime, b datetime, c time generated always as (timediff(a,b)) virtual; +let $values1 = '2008-12-31 23:59:59.000001','2008-12-30 01:01:01.000002',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # TIMESTAMP() +let $cols = a datetime, b timestamp generated always as (timestamp(a)) virtual; +let $values1 = '2008-12-31',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # TIMESTAMPADD() +let $cols = a datetime, b timestamp generated always as (timestampadd(minute,1,a)) virtual; +let $values1 = '2003-01-02',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # TIMESTAMPDIFF() +let $cols = a timestamp, c bigint generated always as (timestampdiff(MONTH, a, a)) virtual; +let $values1 = '2003-02-01',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # TO_DAYS() +let $cols = a datetime, b bigint generated always as (to_days(a)) virtual; +let $values1 = '2007-10-07',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # WEEK() +let $cols = a datetime, b int generated always as (week(a)) virtual; +let $values1 = '2008-09-01',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # WEEKDAY() +let $cols = a datetime, b int generated always as (weekday(a)) virtual; +let $values1 = '2008-09-01',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # WEEKOFYEAR() +let $cols = a datetime, b int generated always as (weekofyear(a)) virtual; +let $values1 = '2008-09-01',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # YEAR() +let $cols = a datetime, b int generated always as (year(a)) virtual; +let $values1 = '2008-09-01',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # YEARWEEK() +let $cols = a datetime, b int generated always as (yearweek(a)) virtual; +let $values1 = '2008-09-01',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # +--echo # FULL TEXT SEARCH FUNCTIONS +--echo # +--echo # None. + +--echo # +--echo # CAST FUNCTIONS AND OPERATORS +--echo # + +--echo # CAST() +let $cols = a int, b bigint unsigned generated always as (cast(a as unsigned)) virtual; +let $values1 = 1,default; +let $values2 = -1,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # Convert() +let $cols = a int, b bigint unsigned generated always as (convert(a,unsigned)) virtual; +let $values1 = 1,default; +let $values2 = -1,default; +let $rows = 2; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # +--echo # XML FUNCTIONS +--echo # +--echo # ExtractValue() +let $cols = a varchar(1024), b varchar(1024) generated always as (ExtractValue(a,'/b')) virtual; +let $values1 = 'text',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # None. + + +--echo # +--echo # OTHER FUNCTIONS +--echo # + +--echo # AES_DECRYPT(), AES_ENCRYPT() +let $cols = a varchar(1024), b varchar(1024) generated always as (aes_encrypt(aes_decrypt(a,'adf'),'adf')) virtual; +let $values1 = 'MySQL',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # BIT_COUNT() +let $cols = a int, b int generated always as (bit_count(a)) virtual; +let $values1 = 5,default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # CHARSET() +let $cols = a varchar(1024), b varchar(1024) generated always as (charset(a)) virtual; +let $values1 = 'abc',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # COERCIBILITY() +let $cols = a varchar(1024), b int generated always as (coercibility(a)) virtual; +let $values1 = 'abc',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # COLLATION() +let $cols = a varchar(1024), b varchar(1024) generated always as (collation(a)) virtual; +let $values1 = 'abc',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # COMPRESS(), UNCOMPRESS() +let $cols = a varchar(1024), b varchar(1024) generated always as (uncompress(compress(a))) virtual; +let $values1 = 'MySQL',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # ENCODE(), DECODE() +let $cols = a varchar(1024), b varchar(1024) generated always as (decode(encode(a,'abc'),'abc')) virtual; +let $values1 = 'MySQL',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # DEFAULT() +let $cols = a varchar(1024) default 'aaa', b varchar(1024) generated always as (ifnull(a,default(a))) virtual; +let $values1 = 'any value',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # DES_ENCRYPT(), DES_DECRYPT() +--source include/have_ssl_crypto_functs.inc +let $cols = a varchar(1024), b varchar(1024) generated always as (des_encrypt(des_decrypt(a,'adf'),'adf')) virtual; +let $values1 = 'MySQL',default; +--disable_warnings +eval create table t1 ($cols); +show create table t1; +--enable_warnings +eval insert into t1 values ($values1); +select * from t1; +drop table t1; + +--echo # INET_ATON(), INET_NTOA() +let $cols = a varchar(1024), b varchar(1024) generated always as (inet_ntoa(inet_aton(a))) virtual; +let $values1 = '127.0.0.1',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # MD5() +let $cols = a varchar(1024), b varbinary(32) generated always as (md5(a)) virtual; +let $values1 = 'testing',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # PASSWORD() +let $cols = a varchar(1024), b varchar(1024) generated always as (password(a)) virtual; +let $values1 = 'badpwd',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # SHA1() +let $cols = a varchar(1024), b varchar(1024) generated always as (sha1(a)) virtual; +let $values1 = 'abc',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # SHA() +let $cols = a varchar(1024), b varchar(1024) generated always as (sha(a)) virtual; +let $values1 = 'abc',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # SHA2() +let $cols = a varchar(1024), b varchar(1024) generated always as (sha2(a,224)) virtual; +let $values1 = 'abc',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + +--echo # UNCOMPRESSED_LENGTH() +let $cols = a char, b varchar(1024) generated always as (uncompressed_length(compress(repeat(a,30)))) virtual; +let $values1 = 'a',default; +let $rows = 1; +--source suite/gcol/inc/gcol_supported_sql_funcs.inc + diff --git a/mysql-test/suite/gcol/inc/gcol_trigger_sp.inc b/mysql-test/suite/gcol/inc/gcol_trigger_sp.inc new file mode 100644 index 00000000000..b6ba5280216 --- /dev/null +++ b/mysql-test/suite/gcol/inc/gcol_trigger_sp.inc @@ -0,0 +1,114 @@ +################################################################################ +# inc/gcol_trigger_sp.inc # +# # +# Purpose: # +# Testing triggers, stored procedures and functions # +# defined on tables with generated columns. # +# # +# # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-04 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +create table t1 (a int, + b int generated always as (a/10) virtual, + c int generated always as (a/10) stored); + +create table t2 (a timestamp); + +delimiter |; + +create trigger trg1 before insert on t1 for each row +begin + if (new.b < 10) then + set new.a:= 100; + set new.b:= 9; + set new.c:= 9; + end if; + + if (new.c > 50) then + set new.a:= 500; + end if; +end| + +create trigger trg2 after insert on t1 for each row +begin + if (new.b >= 60) then + insert into t2 values (now()); + end if; +end| + +create function f1() +returns int +begin + declare sum1 int default '0'; + declare cur1 cursor for select sum(b) from t1; + open cur1; + fetch cur1 into sum1; + close cur1; + return sum1; +end| + +delimiter ;| + +set sql_warnings = 1; + +insert into t1 (a) values (200); +select * from t1; +select * from t2; + +insert into t1 (a) values (10); +--sorted_result +select * from t1; +select * from t2; + +insert into t1 (a) values (600); +--sorted_result +select * from t1; +--replace_column 1 +select * from t2; + +select f1(); + +set sql_warnings = 0; + +drop trigger trg1; +drop trigger trg2; +drop table t2; + +delimiter |; + +create procedure p1() +begin + declare i int default '0'; + create table t2 like t1; + insert into t2 (a) values (100), (200); + begin + declare cur1 cursor for select sum(c) from t2; + open cur1; + fetch cur1 into i; + close cur1; + if (i=30) then + insert into t1 values (300,default,default); + end if; + end; +end| + +delimiter ;| + +delete from t1; + +call p1(); + +--sorted_result +select * from t2; +--sorted_result +select * from t1; + +drop table t1,t2; +drop procedure p1; diff --git a/mysql-test/suite/gcol/inc/gcol_unsupported_storage_engines.inc b/mysql-test/suite/gcol/inc/gcol_unsupported_storage_engines.inc new file mode 100644 index 00000000000..2b85a2c205a --- /dev/null +++ b/mysql-test/suite/gcol/inc/gcol_unsupported_storage_engines.inc @@ -0,0 +1,21 @@ +################################################################################ +# inc/gcol_unsupported_storage_engines.inc # +# # +# Purpose: # +# Ensure that defining a generated column for an unsupported table type # +# results in a graceful error. # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-02 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +--error ER_UNSUPPORTED_ENGINE_FOR_GENERATED_COLUMNS +create table t1 (a int, b int generated always as (a+1) virtual); +create table t1 (a int); +--error ER_UNSUPPORTED_ENGINE_FOR_GENERATED_COLUMNS +alter table t1 add column b int generated always as (a+1) virtual; +drop table t1; diff --git a/mysql-test/suite/gcol/inc/gcol_view.inc b/mysql-test/suite/gcol/inc/gcol_view.inc new file mode 100644 index 00000000000..51cb9b5d725 --- /dev/null +++ b/mysql-test/suite/gcol/inc/gcol_view.inc @@ -0,0 +1,223 @@ +################################################################################ +# inc/gcol_view.inc # +# # +# Purpose: # +# Testing views defined on tables with generated columns. # +# # +# # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-04 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + + + +create table t1 (a int not null, + b int generated always as (-a) virtual, + c int generated always as (-a) stored); +insert into t1 (a) values (1), (1), (2), (2), (3); +analyze table t1; + +# simple view +create view v1 (d,e) as select abs(b), abs(c) from t1; +--sorted_result +select d,e from v1; +select is_updatable from information_schema.views where table_name='v1'; + +# view with different algorithms (explain output differs) +--replace_column 10 X +explain select d,e from v1; +create algorithm=temptable view v2 (d,e) as select abs(b), abs(c) from t1; +show create view v2; +--sorted_result +select d,e from v2; +--replace_column 10 X +explain select d,e from v2; + +# VIEW on VIEW test +create view v3 (d,e) as select d*2, e*2 from v1; +--sorted_result +select * from v3; +--replace_column 10 X +explain select * from v3; + +drop view v1,v2,v3; +drop table t1; + +# +# DISTINCT option for VIEW +# +create table t1 (a int not null, + b int generated always as (-a) virtual, + c int generated always as (-a) stored); +insert into t1 (a) values (1), (2), (3), (1), (2), (3); +create view v1 as select distinct b from t1; +--sorted_result +select * from v1; +--replace_column 10 X +explain select * from v1; +--sorted_result +select * from t1; +drop view v1; +create view v1 as select distinct c from t1; +--sorted_result +select * from v1; +--replace_column 10 X +explain select * from v1; +--sorted_result +select * from t1; +drop view v1; +drop table t1; + +# +# LIMIT clause test +# +create table t1 (a int not null, + b int generated always as (-a) virtual, + c int generated always as (-a) stored); +insert into t1 (a) values (1), (2), (3), (4); +create view v1 as select b+1 from t1 order by 1 desc limit 2; +select * from v1; +--replace_column 10 X +explain select * from v1; +drop view v1; +create view v1 as select c+1 from t1 order by 1 desc limit 2; +--sorted_result +select * from v1; +--replace_column 10 X +explain select * from v1; +drop view v1; +drop table t1; + +# +# simple view + simple update, insert and delete +# +create table t1 (a int, + b int, + c int generated always as (-a) virtual, + d int generated always as (-a) stored, + primary key(a)); +insert into t1 (a,b) values (10,2), (20,3), (30,4), (40,5), (50,10); +create view v1 (a,e,f,g) as select a, b+1,c+1,d+1 from t1; +# updatable field of updateable view +update v1 set a=a+e; +select * from v1 order by a; +select * from t1 order by a; +delete from v1; +select * from v1; +select * from t1; +--error ER_NON_INSERTABLE_TABLE +insert into v1 (a,e) values (60,15); +drop table t1; +drop view v1; + +# +# outer join based on VIEW with WHERE clause +# +create table t1 (a int, + b int generated always as (-a) virtual, + c int generated always as (-a) stored, + primary key(a)); +insert into t1 (a) values (1), (2), (3); +create view v1 (x,y,z) as select a,b,c from t1 where b < -1; +--sorted_result +select t1.a, v1.x, v1.y, v1.z from t1 left join v1 on (t1.b= v1.y); +drop view v1; +create view v1 (x,y,z) as select a,b,c from t1 where c < -1; +--sorted_result +select t1.a, v1.x, v1.y, v1.z from t1 left join v1 on (t1.c= v1.z); +drop view v1; +drop table t1; + +# +# VIEW built over UNION +# +create table t1 (a1 int, + b1 int generated always as (-a1) virtual, + c1 int generated always as (-a1) stored); +create table t2 (a2 int, + b2 int generated always as (-a2) virtual, + c2 int generated always as (-a2) stored); +insert into t1 (a1) values (1), (2); +insert into t2 (a2) values (2), (3); +create view v1 as select * from t1,t2 union all select * from t1,t2; +--sorted_result +select * from v1; +drop view v1; +drop table t1, t2; + +# +# Showing VIEW with VIEWs in subquery +# +create table t1 (a int, + b int generated always as (-a) virtual, + c int generated always as (-a) stored); +create table t2 like t1; +create view v1 as select a,b,c from t1; +create view v2 as select a,b,c from t2 where b in (select b from v1); +show create view v2; +drop view v2, v1; +drop table t1, t2; + +# +# TODO: VIEW with full text +# +#CREATE TABLE t1 (c1 int not null auto_increment primary key, c2 varchar(20), fulltext(c2)); +#insert into t1 (c2) VALUES ('real Beer'),('Water'),('Kossu'),('Coca-Cola'),('Vodka'),('Wine'),('almost real Beer'); +#select * from t1 WHERE match (c2) against ('Beer'); +#CREATE VIEW v1 AS SELECT * from t1 WHERE match (c2) against ('Beer'); +#select * from v1; +#drop view v1; +#drop table t1; + +# +# distinct in temporary table with a VIEW +# +create table t1 (a int, + b int generated always as (-a) virtual, + c int generated always as (-a) stored); +insert into t1 (a) values (1),(1),(2),(2),(3),(3); +create view v1 as select b from t1; +--sorted_result +select distinct b from v1; +select distinct b from v1 order by b limit 2; +select distinct b from t1 order by b limit 2; +prepare stmt1 from "select distinct b from v1 order by b limit 2"; +execute stmt1; +execute stmt1; +deallocate prepare stmt1; +drop view v1; +create view v1 as select c from t1; +--sorted_result +select distinct c from v1; +select distinct c from v1 order by c limit 2; +select distinct c from t1 order by c limit 2; +prepare stmt1 from "select distinct c from v1 order by c limit 2"; +execute stmt1; +execute stmt1; +deallocate prepare stmt1; +drop view v1; +drop table t1; + +# +# WITH CHECK OPTION insert/update test +# +create table t1 (a int, + b int generated always as (-a) virtual, + c int generated always as (-a) stored); +create view v1 as select * from t1 where b > -2 && c >-2 with check option; +# simple insert +insert into v1 (a) values (1); +-- error 1369 +insert into v1 (a) values (3); +# simple insert with ignore +insert ignore into v1 (a) values (2),(3),(0); +--sorted_result +select * from t1; +drop view v1; +drop table t1; + diff --git a/mysql-test/suite/gcol/inc/innodb_v_large_col.inc b/mysql-test/suite/gcol/inc/innodb_v_large_col.inc new file mode 100644 index 00000000000..70e188635fa --- /dev/null +++ b/mysql-test/suite/gcol/inc/innodb_v_large_col.inc @@ -0,0 +1,53 @@ +--source include/have_innodb.inc + +eval CREATE TABLE `t` ( +`a` VARCHAR(10000), `b` VARCHAR(3000), +`c` VARCHAR(14000) GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, +`d` VARCHAR(5000) GENERATED ALWAYS AS (b) VIRTUAL, +`e` INT(11) GENERATED ALWAYS AS (10) VIRTUAL, +`h` INT(11) NOT NULL, +PRIMARY KEY (`h`) ) ROW_FORMAT=$row_format ENGINE=InnoDB; + +SHOW CREATE TABLE t; + +INSERT INTO t VALUES (REPEAT('g', 10000), REPEAT('x', 2800), DEFAULT, DEFAULT, DEFAULT, 1); + +INSERT INTO t VALUES (REPEAT('a', 9000), REPEAT('b', 2000), DEFAULT, DEFAULT, DEFAULT, 2); +INSERT INTO t VALUES (REPEAT('m', 8000), REPEAT('n', 3000), DEFAULT, DEFAULT, DEFAULT, 3); +CREATE INDEX idx ON t(c(100), d(20)); +UPDATE t SET a = REPEAT(CAST(1 AS CHAR), 2000) WHERE h = 1; + +delimiter |; +CREATE PROCEDURE UPDATE_t() +begin + DECLARE i INT DEFAULT 1; + WHILE (i <= 100) DO + UPDATE t SET a = REPEAT(CAST(i AS CHAR), 2000) WHERE h = 1; + SET i = i + 1; + END WHILE; +END| + +CREATE PROCEDURE DELETE_insert_t() +begin + DECLARE i INT DEFAULT 1; + WHILE (i <= 100) DO + DELETE FROM t WHERE h = 1; + INSERT INTO t VALUES (REPEAT(CAST(i AS CHAR), 2000) , REPEAT('b', 2000), DEFAULT, DEFAULT, DEFAULT, 1); + SET i = i + 1; + END WHILE; +END| +delimiter ;| + +CALL UPDATE_t(); + +CALL DELETE_insert_t(); + +UPDATE t SET a = NULL WHERE h=1; + +START TRANSACTION; +CALL UPDATE_t(); +ROLLBACK; + +DROP PROCEDURE DELETE_insert_t; +DROP PROCEDURE UPDATE_t; +DROP TABLE t; diff --git a/mysql-test/suite/gcol/r/federated_gcol.result b/mysql-test/suite/gcol/r/federated_gcol.result new file mode 100644 index 00000000000..9c8de3987f0 --- /dev/null +++ b/mysql-test/suite/gcol/r/federated_gcol.result @@ -0,0 +1,49 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +stop slave; +DROP DATABASE IF EXISTS federated; +CREATE DATABASE federated; +DROP DATABASE IF EXISTS federated; +CREATE DATABASE federated; +SET @OLD_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT; +SET @@GLOBAL.CONCURRENT_INSERT= 0; +DROP TABLE IF EXISTS federated.t1; +Warnings: +Note 1051 Unknown table 't1' +DROP TABLE IF EXISTS federated.t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL, +`group` int NOT NULL default 0, +`tmp` virtual int as (`id` + 1) +) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +ERROR HY000: 'Specified storage engine' is not yet supported for generated columns. +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL, +`group` int NOT NULL default 0 +) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +alter table federated.t1 add column `tmp` virtual int as (`id` + 1); +ERROR HY000: Table storage engine for 't1' doesn't have this option +DROP TABLE IF EXISTS federated.t1; +End of 5.1 tests +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; +SET @@GLOBAL.CONCURRENT_INSERT= @OLD_CONCURRENT_INSERT; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_archive.result b/mysql-test/suite/gcol/r/gcol_archive.result new file mode 100644 index 00000000000..fb6fd544204 --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_archive.result @@ -0,0 +1,14 @@ +SET @@session.default_storage_engine = 'archive'; +create table t1 (a int, b int generated always as (a+1) virtual); +ERROR HY000: ARCHIVE storage engine does not support generated columns +create table t1 (a int); +alter table t1 add column b int generated always as (a+1) virtual; +ERROR HY000: ARCHIVE storage engine does not support generated columns +drop table t1; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_blackhole.result b/mysql-test/suite/gcol/r/gcol_blackhole.result new file mode 100644 index 00000000000..3ee4f4e91a4 --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_blackhole.result @@ -0,0 +1,14 @@ +SET @@session.default_storage_engine = 'blackhole'; +create table t1 (a int, b int generated always as (a+1) virtual); +ERROR HY000: BLACKHOLE storage engine does not support generated columns +create table t1 (a int); +alter table t1 add column b int generated always as (a+1) virtual; +ERROR HY000: BLACKHOLE storage engine does not support generated columns +drop table t1; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_innodb.result b/mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_innodb.result new file mode 100644 index 00000000000..27270654e9b --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_innodb.result @@ -0,0 +1,179 @@ +SET @@session.default_storage_engine = 'InnoDB'; +create or replace table t1 (b double generated always as (rand()) virtual); +create or replace table t1 (a datetime generated always as (curdate()) virtual); +create or replace table t1 (a datetime generated always as (current_date) virtual); +create or replace table t1 (a datetime generated always as (current_date()) virtual); +create or replace table t1 (a datetime generated always as (current_time) virtual); +create or replace table t1 (a datetime generated always as (current_time()) virtual); +create or replace table t1 (a datetime generated always as (current_timestamp()) virtual); +create or replace table t1 (a datetime generated always as (current_timestamp) virtual); +create or replace table t1 (a datetime generated always as (curtime()) virtual); +create or replace table t1 (a datetime, b varchar(10) generated always as (localtime()) virtual); +create or replace table t1 (a datetime, b varchar(10) generated always as (localtime) virtual); +create or replace table t1 (a datetime, b varchar(10) generated always as (localtimestamp()) virtual); +create or replace table t1 (a datetime, b varchar(10) generated always as (localtimestamp) virtual); +create or replace table t1 (a datetime, b varchar(10) generated always as (now()) virtual); +create or replace table t1 (a int, b varchar(10) generated always as (sysdate()) virtual); +create or replace table t1 (a datetime, b datetime generated always as (unix_timestamp()) virtual); +create or replace table t1 (a datetime, b datetime generated always as (utc_date()) virtual); +create or replace table t1 (a datetime, b datetime generated always as (utc_time()) virtual); +create or replace table t1 (a datetime, b datetime generated always as (utc_timestamp()) virtual); +create or replace table t1 (a int generated always as (connection_id()) virtual); +create or replace table t1 (a varchar(32) generated always as (current_user()) virtual); +create or replace table t1 (a varchar(32) generated always as (current_user) virtual); +create or replace table t1 (a varchar(1024), b varchar(1024) generated always as (database()) virtual); +create or replace table t1 (a varchar(32) generated always as (schema()) virtual); +create or replace table t1 (a varchar(32) generated always as (session_user()) virtual); +create or replace table t1 (a varchar(32) generated always as (system_user()) virtual); +create or replace table t1 (a varchar(1024), b varchar(1024) generated always as (user()) virtual); +create or replace table t1 (a varchar(1024) generated always as (uuid_short()) virtual); +create or replace table t1 (a varchar(1024) generated always as (uuid()) virtual); +create or replace table t1 (a varchar(1024), b varchar(1024) generated always as (version()) virtual); +create or replace table t1 (a varchar(1024), b varchar(1024) generated always as (encrypt(a)) virtual); +create or replace table t1 (a varchar(1024), b varchar(1024) generated always as (UpdateXML(a,'/a','fff')) virtual); +drop table t1; +# LOAD_FILE() +create table t1 (a varchar(64), b varchar(1024) generated always as (load_file(a)) virtual); +ERROR HY000: Function or expression 'load_file()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# MATCH() +# BENCHMARK() +create table t1 (a varchar(1024), b varchar(1024) generated always as (benchmark(a,3)) virtual); +ERROR HY000: Function or expression 'benchmark()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# FOUND_ROWS() +create table t1 (a varchar(1024), b varchar(1024) generated always as (found_rows()) virtual); +ERROR HY000: Function or expression 'found_rows()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# GET_LOCK() +create table t1 (a varchar(1024), b varchar(1024) generated always as (get_lock(a,10)) virtual); +ERROR HY000: Function or expression 'get_lock()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# IS_FREE_LOCK() +create table t1 (a varchar(1024), b varchar(1024) generated always as (is_free_lock(a)) virtual); +ERROR HY000: Function or expression 'is_free_lock()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# IS_USED_LOCK() +create table t1 (a varchar(1024), b varchar(1024) generated always as (is_used_lock(a)) virtual); +ERROR HY000: Function or expression 'is_used_lock()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# LAST_INSERT_ID() +create table t1 (a int generated always as (last_insert_id()) virtual); +ERROR HY000: Function or expression 'last_insert_id()' cannot be used in the GENERATED ALWAYS AS clause of `a` +# MASTER_POS_WAIT() +create table t1 (a varchar(32), b int generated always as (master_pos_wait(a,0,2)) virtual); +ERROR HY000: Function or expression 'master_pos_wait()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# NAME_CONST() +create table t1 (a varchar(32) generated always as (name_const('test',1)) virtual); +ERROR HY000: Function or expression 'name_const()' cannot be used in the GENERATED ALWAYS AS clause of `a` +# RELEASE_LOCK() +create table t1 (a varchar(32), b int generated always as (release_lock(a)) virtual); +ERROR HY000: Function or expression 'release_lock()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# ROW_COUNT() +create table t1 (a int generated always as (row_count()) virtual); +ERROR HY000: Function or expression 'row_count()' cannot be used in the GENERATED ALWAYS AS clause of `a` +# SLEEP() +create table t1 (a int, b int generated always as (sleep(a)) virtual); +ERROR HY000: Function or expression 'sleep()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# VALUES() +create table t1 (a varchar(1024), b varchar(1024) generated always as (values(a)) virtual); +ERROR HY000: Function or expression 'values()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# Stored procedures +create procedure p1() +begin +select current_user(); +end // +create function f1() +returns int +begin +return 1; +end // +create table t1 (a int generated always as (p1()) virtual); +ERROR HY000: Function or expression '`p1`()' cannot be used in the GENERATED ALWAYS AS clause of `a` +create table t1 (a int generated always as (f1()) virtual); +ERROR HY000: Function or expression '`f1`()' cannot be used in the GENERATED ALWAYS AS clause of `a` +drop procedure p1; +drop function f1; +# Unknown functions +create table t1 (a int generated always as (f1()) virtual); +ERROR HY000: Function or expression '`f1`()' cannot be used in the GENERATED ALWAYS AS clause of `a` +# +# GROUP BY FUNCTIONS +# +# AVG() +create table t1 (a int, b int generated always as (avg(a)) virtual); +ERROR HY000: Function or expression 'avg()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# BIT_AND() +create table t1 (a int, b int generated always as (bit_and(a)) virtual); +ERROR HY000: Function or expression 'bit_and()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# BIT_OR() +create table t1 (a int, b int generated always as (bit_or(a)) virtual); +ERROR HY000: Function or expression 'bit_or()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# BIT_XOR() +create table t1 (a int, b int generated always as (bit_xor(a)) virtual); +ERROR HY000: Function or expression 'bit_xor()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# COUNT(DISTINCT) +create table t1 (a int, b int generated always as (count(distinct a)) virtual); +ERROR HY000: Function or expression 'count(distinct )' cannot be used in the GENERATED ALWAYS AS clause of `b` +# COUNT() +create table t1 (a int, b int generated always as (count(a)) virtual); +ERROR HY000: Function or expression 'count()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# GROUP_CONCAT() +create table t1 (a varchar(32), b int generated always as (group_concat(a,'')) virtual); +ERROR HY000: Function or expression 'group_concat()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# MAX() +create table t1 (a int, b int generated always as (max(a)) virtual); +ERROR HY000: Function or expression 'max()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# MIN() +create table t1 (a int, b int generated always as (min(a)) virtual); +ERROR HY000: Function or expression 'min()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# STD() +create table t1 (a int, b int generated always as (std(a)) virtual); +ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# STDDEV_POP() +create table t1 (a int, b int generated always as (stddev_pop(a)) virtual); +ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# STDDEV_SAMP() +create table t1 (a int, b int generated always as (stddev_samp(a)) virtual); +ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# STDDEV() +create table t1 (a int, b int generated always as (stddev(a)) virtual); +ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# SUM() +create table t1 (a int, b int generated always as (sum(a)) virtual); +ERROR HY000: Function or expression 'sum()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# VAR_POP() +create table t1 (a int, b int generated always as (var_pop(a)) virtual); +ERROR HY000: Function or expression 'variance()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# VAR_SAMP() +create table t1 (a int, b int generated always as (var_samp(a)) virtual); +ERROR HY000: Function or expression 'var_samp()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# VARIANCE() +create table t1 (a int, b int generated always as (variance(a)) virtual); +ERROR HY000: Function or expression 'variance()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# +# Sub-selects +# +create table t1 (a int); +create table t2 (a int, b int generated always as (select count(*) virtual from t1)); +ERROR HY000: Function or expression 'select ...' cannot be used in the GENERATED ALWAYS AS clause of `b` +drop table t1; +# +# Long expression +create table t1 (a int, b varchar(300) generated always as (concat(a,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')) virtual); +drop table t1; +create table t1 (a int, b varchar(300) generated always as (concat(a,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')) virtual); +drop table t1; +# +# Constant expression +create table t1 (a int generated always as (PI()) virtual); +drop table t1; +# bug#21098119: GCOL WITH MATCH/AGAINST --> +# ASSERTION FAILED: TR && TR->TABLE->FILE +# +create table t1 (a int); +alter table t1 add column r blob generated always +as (match(a) against ('' in boolean mode)) virtual; +ERROR HY000: Function or expression 'match ... against()' cannot be used in the GENERATED ALWAYS AS clause of `r` +drop table t1; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_myisam.result b/mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_myisam.result new file mode 100644 index 00000000000..24fd3b988c2 --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_myisam.result @@ -0,0 +1,181 @@ +SET @@session.default_storage_engine = 'MyISAM'; +create or replace table t1 (b double generated always as (rand()) virtual); +create or replace table t1 (a datetime generated always as (curdate()) virtual); +create or replace table t1 (a datetime generated always as (current_date) virtual); +create or replace table t1 (a datetime generated always as (current_date()) virtual); +create or replace table t1 (a datetime generated always as (current_time) virtual); +create or replace table t1 (a datetime generated always as (current_time()) virtual); +create or replace table t1 (a datetime generated always as (current_timestamp()) virtual); +create or replace table t1 (a datetime generated always as (current_timestamp) virtual); +create or replace table t1 (a datetime generated always as (curtime()) virtual); +create or replace table t1 (a datetime, b varchar(10) generated always as (localtime()) virtual); +create or replace table t1 (a datetime, b varchar(10) generated always as (localtime) virtual); +create or replace table t1 (a datetime, b varchar(10) generated always as (localtimestamp()) virtual); +create or replace table t1 (a datetime, b varchar(10) generated always as (localtimestamp) virtual); +create or replace table t1 (a datetime, b varchar(10) generated always as (now()) virtual); +create or replace table t1 (a int, b varchar(10) generated always as (sysdate()) virtual); +create or replace table t1 (a datetime, b datetime generated always as (unix_timestamp()) virtual); +create or replace table t1 (a datetime, b datetime generated always as (utc_date()) virtual); +create or replace table t1 (a datetime, b datetime generated always as (utc_time()) virtual); +create or replace table t1 (a datetime, b datetime generated always as (utc_timestamp()) virtual); +create or replace table t1 (a int generated always as (connection_id()) virtual); +create or replace table t1 (a varchar(32) generated always as (current_user()) virtual); +create or replace table t1 (a varchar(32) generated always as (current_user) virtual); +create or replace table t1 (a varchar(1024), b varchar(1024) generated always as (database()) virtual); +create or replace table t1 (a varchar(32) generated always as (schema()) virtual); +create or replace table t1 (a varchar(32) generated always as (session_user()) virtual); +create or replace table t1 (a varchar(32) generated always as (system_user()) virtual); +create or replace table t1 (a varchar(1024), b varchar(1024) generated always as (user()) virtual); +create or replace table t1 (a varchar(1024) generated always as (uuid_short()) virtual); +create or replace table t1 (a varchar(1024) generated always as (uuid()) virtual); +create or replace table t1 (a varchar(1024), b varchar(1024) generated always as (version()) virtual); +create or replace table t1 (a varchar(1024), b varchar(1024) generated always as (encrypt(a)) virtual); +create or replace table t1 (a varchar(1024), b varchar(1024) generated always as (UpdateXML(a,'/a','fff')) virtual); +drop table t1; +# LOAD_FILE() +create table t1 (a varchar(64), b varchar(1024) generated always as (load_file(a)) virtual); +ERROR HY000: Function or expression 'load_file()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# MATCH() +create table t1 (a varchar(32), b bool generated always as (match a against ('sample text')) virtual); +ERROR HY000: Function or expression 'match ... against()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# BENCHMARK() +create table t1 (a varchar(1024), b varchar(1024) generated always as (benchmark(a,3)) virtual); +ERROR HY000: Function or expression 'benchmark()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# FOUND_ROWS() +create table t1 (a varchar(1024), b varchar(1024) generated always as (found_rows()) virtual); +ERROR HY000: Function or expression 'found_rows()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# GET_LOCK() +create table t1 (a varchar(1024), b varchar(1024) generated always as (get_lock(a,10)) virtual); +ERROR HY000: Function or expression 'get_lock()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# IS_FREE_LOCK() +create table t1 (a varchar(1024), b varchar(1024) generated always as (is_free_lock(a)) virtual); +ERROR HY000: Function or expression 'is_free_lock()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# IS_USED_LOCK() +create table t1 (a varchar(1024), b varchar(1024) generated always as (is_used_lock(a)) virtual); +ERROR HY000: Function or expression 'is_used_lock()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# LAST_INSERT_ID() +create table t1 (a int generated always as (last_insert_id()) virtual); +ERROR HY000: Function or expression 'last_insert_id()' cannot be used in the GENERATED ALWAYS AS clause of `a` +# MASTER_POS_WAIT() +create table t1 (a varchar(32), b int generated always as (master_pos_wait(a,0,2)) virtual); +ERROR HY000: Function or expression 'master_pos_wait()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# NAME_CONST() +create table t1 (a varchar(32) generated always as (name_const('test',1)) virtual); +ERROR HY000: Function or expression 'name_const()' cannot be used in the GENERATED ALWAYS AS clause of `a` +# RELEASE_LOCK() +create table t1 (a varchar(32), b int generated always as (release_lock(a)) virtual); +ERROR HY000: Function or expression 'release_lock()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# ROW_COUNT() +create table t1 (a int generated always as (row_count()) virtual); +ERROR HY000: Function or expression 'row_count()' cannot be used in the GENERATED ALWAYS AS clause of `a` +# SLEEP() +create table t1 (a int, b int generated always as (sleep(a)) virtual); +ERROR HY000: Function or expression 'sleep()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# VALUES() +create table t1 (a varchar(1024), b varchar(1024) generated always as (values(a)) virtual); +ERROR HY000: Function or expression 'values()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# Stored procedures +create procedure p1() +begin +select current_user(); +end // +create function f1() +returns int +begin +return 1; +end // +create table t1 (a int generated always as (p1()) virtual); +ERROR HY000: Function or expression '`p1`()' cannot be used in the GENERATED ALWAYS AS clause of `a` +create table t1 (a int generated always as (f1()) virtual); +ERROR HY000: Function or expression '`f1`()' cannot be used in the GENERATED ALWAYS AS clause of `a` +drop procedure p1; +drop function f1; +# Unknown functions +create table t1 (a int generated always as (f1()) virtual); +ERROR HY000: Function or expression '`f1`()' cannot be used in the GENERATED ALWAYS AS clause of `a` +# +# GROUP BY FUNCTIONS +# +# AVG() +create table t1 (a int, b int generated always as (avg(a)) virtual); +ERROR HY000: Function or expression 'avg()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# BIT_AND() +create table t1 (a int, b int generated always as (bit_and(a)) virtual); +ERROR HY000: Function or expression 'bit_and()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# BIT_OR() +create table t1 (a int, b int generated always as (bit_or(a)) virtual); +ERROR HY000: Function or expression 'bit_or()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# BIT_XOR() +create table t1 (a int, b int generated always as (bit_xor(a)) virtual); +ERROR HY000: Function or expression 'bit_xor()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# COUNT(DISTINCT) +create table t1 (a int, b int generated always as (count(distinct a)) virtual); +ERROR HY000: Function or expression 'count(distinct )' cannot be used in the GENERATED ALWAYS AS clause of `b` +# COUNT() +create table t1 (a int, b int generated always as (count(a)) virtual); +ERROR HY000: Function or expression 'count()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# GROUP_CONCAT() +create table t1 (a varchar(32), b int generated always as (group_concat(a,'')) virtual); +ERROR HY000: Function or expression 'group_concat()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# MAX() +create table t1 (a int, b int generated always as (max(a)) virtual); +ERROR HY000: Function or expression 'max()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# MIN() +create table t1 (a int, b int generated always as (min(a)) virtual); +ERROR HY000: Function or expression 'min()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# STD() +create table t1 (a int, b int generated always as (std(a)) virtual); +ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# STDDEV_POP() +create table t1 (a int, b int generated always as (stddev_pop(a)) virtual); +ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# STDDEV_SAMP() +create table t1 (a int, b int generated always as (stddev_samp(a)) virtual); +ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# STDDEV() +create table t1 (a int, b int generated always as (stddev(a)) virtual); +ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# SUM() +create table t1 (a int, b int generated always as (sum(a)) virtual); +ERROR HY000: Function or expression 'sum()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# VAR_POP() +create table t1 (a int, b int generated always as (var_pop(a)) virtual); +ERROR HY000: Function or expression 'variance()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# VAR_SAMP() +create table t1 (a int, b int generated always as (var_samp(a)) virtual); +ERROR HY000: Function or expression 'var_samp()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# VARIANCE() +create table t1 (a int, b int generated always as (variance(a)) virtual); +ERROR HY000: Function or expression 'variance()' cannot be used in the GENERATED ALWAYS AS clause of `b` +# +# Sub-selects +# +create table t1 (a int); +create table t2 (a int, b int generated always as (select count(*) virtual from t1)); +ERROR HY000: Function or expression 'select ...' cannot be used in the GENERATED ALWAYS AS clause of `b` +drop table t1; +# +# Long expression +create table t1 (a int, b varchar(300) generated always as (concat(a,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')) virtual); +drop table t1; +create table t1 (a int, b varchar(300) generated always as (concat(a,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')) virtual); +drop table t1; +# +# Constant expression +create table t1 (a int generated always as (PI()) virtual); +drop table t1; +# bug#21098119: GCOL WITH MATCH/AGAINST --> +# ASSERTION FAILED: TR && TR->TABLE->FILE +# +create table t1 (a int); +alter table t1 add column r blob generated always +as (match(a) against ('' in boolean mode)) virtual; +ERROR HY000: Function or expression 'match ... against()' cannot be used in the GENERATED ALWAYS AS clause of `r` +drop table t1; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_bug20746926.result b/mysql-test/suite/gcol/r/gcol_bug20746926.result new file mode 100644 index 00000000000..74fe76b3f1a --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_bug20746926.result @@ -0,0 +1,32 @@ +#Bug #20746926: GENERATED COLUMNS: INVALID READ OF THD WHEN WARNINGS +# +# Testing cmp_item_datetime +connect con1,localhost,root,,; +set sql_mode=''; +create table t1 ( +a date not null, +b mediumtext generated always as ((a not in (a,a))) virtual, +c timestamp generated always as ((a not in (b,b))) stored +); +insert t1(a) values(7777777777); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +Warning 1292 Incorrect datetime value: '0' +show warnings; +Level Code Message +Warning 1265 Data truncated for column 'a' at row 1 +Warning 1292 Incorrect datetime value: '0' +disconnect con1; +connect con2,localhost,root,,; +set sql_mode=''; +insert t1(a) values(6666666666); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +Warning 1292 Incorrect datetime value: '0' +show warnings; +Level Code Message +Warning 1265 Data truncated for column 'a' at row 1 +Warning 1292 Incorrect datetime value: '0' +drop table t1; +disconnect con2; +connection default; diff --git a/mysql-test/suite/gcol/r/gcol_bugfixes.result b/mysql-test/suite/gcol/r/gcol_bugfixes.result new file mode 100644 index 00000000000..ff7100817f5 --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_bugfixes.result @@ -0,0 +1,577 @@ +# Bug#21230709: Alter table statement fails with division by zero +CREATE TABLE t1 ( +col1 INTEGER NOT NULL, +col2 INTEGER NOT NULL, +col3 INTEGER NOT NULL, +gcol1 INTEGER GENERATED ALWAYS AS (col3 + col3) VIRTUAL, +col4 INTEGER DEFAULT NULL, +col5 INTEGER DEFAULT NULL, +col6 INTEGER DEFAULT NULL, +col7 INTEGER DEFAULT NULL, +col8 INTEGER DEFAULT NULL, +col9 INTEGER DEFAULT NULL, +col10 INTEGER DEFAULT NULL, +col11 INTEGER DEFAULT NULL, +col12 INTEGER DEFAULT NULL, +col13 INTEGER DEFAULT NULL, +col14 INTEGER DEFAULT NULL, +col15 INTEGER DEFAULT NULL, +col16 INTEGER DEFAULT NULL, +col17 INTEGER DEFAULT NULL, +col18 INTEGER DEFAULT NULL, +col19 INTEGER DEFAULT NULL, +col20 INTEGER DEFAULT NULL, +col21 INTEGER DEFAULT NULL, +col22 INTEGER DEFAULT NULL, +col23 INTEGER DEFAULT NULL, +col24 INTEGER DEFAULT NULL, +col25 INTEGER DEFAULT NULL, +col26 INTEGER DEFAULT NULL, +col27 INTEGER DEFAULT NULL, +col28 INTEGER DEFAULT NULL, +col29 INTEGER DEFAULT NULL, +col30 INTEGER DEFAULT NULL, +col31 INTEGER DEFAULT NULL, +col32 INTEGER DEFAULT NULL, +col33 INTEGER DEFAULT NULL, +gcol2 INTEGER GENERATED ALWAYS AS (col2 + col2) VIRTUAL, +gcol3 INTEGER GENERATED ALWAYS AS (gcol2 / gcol2) VIRTUAL, +PRIMARY KEY (col1), +KEY idx1 (gcol1) +) engine=innodb; +INSERT INTO t1 (col1, col2, col3) +VALUES (0,1,2), (1,2,3), (2,3,4), (3,4,5), (4,5,6); +FLUSH TABLE t1; +ALTER TABLE t1 ADD COLUMN extra INTEGER; +DROP TABLE t1; +# +# Bug 21340801 WL8149:ASSERTION `IS_VIRTUAL_GCOL()' FAILED +# +CREATE TABLE t1 ( +c_blob BLOB, +c_blob_key BLOB GENERATED ALWAYS AS (REPEAT(c_blob,15)) STORED, +KEY (c_blob_key(200)) +); +INSERT INTO t1 (c_blob) VALUES ('xceks'); +DROP TABLE t1; +# +# Bug#21345972 WL8149:JOIN_CACHE::FILTER_VIRTUAL_GCOL_BASE_COLS(): ASSERTION `FALSE' FAILED. +# +CREATE TABLE c ( +pk INTEGER AUTO_INCREMENT, +col_int_nokey INTEGER, +gcol_int_key INTEGER GENERATED ALWAYS AS (col_int_nokey + col_int_nokey) VIRTUAL, +col_date_nokey DATE, +gcol_date_key DATE GENERATED ALWAYS AS (DATE_ADD(col_date_nokey,interval 30 day)) VIRTUAL, +col_datetime_nokey DATETIME, +col_time_nokey TIME, +gcol_datetime_key DATETIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL, +gcol_time_key TIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL, +col_varchar_nokey VARCHAR(1), +gcol_varchar_key VARCHAR(2) GENERATED ALWAYS AS (CONCAT(col_varchar_nokey, col_varchar_nokey)) VIRTUAL, +PRIMARY KEY (pk), +UNIQUE KEY (gcol_int_key), +UNIQUE KEY (gcol_varchar_key), +UNIQUE KEY (gcol_date_key), +KEY (gcol_time_key), +KEY (gcol_datetime_key), +UNIQUE KEY (gcol_int_key, gcol_varchar_key), +KEY (gcol_int_key, col_int_nokey), +KEY(gcol_int_key,gcol_date_key), +KEY(gcol_int_key, gcol_time_key), +KEY(gcol_int_key, gcol_datetime_key), +UNIQUE KEY(gcol_date_key,gcol_time_key,gcol_datetime_key), +UNIQUE KEY (gcol_varchar_key, col_varchar_nokey), +UNIQUE KEY (gcol_int_key, gcol_varchar_key, gcol_date_key, gcol_time_key, gcol_datetime_key) +) ENGINE=INNODB; +INSERT IGNORE INTO c ( col_int_nokey, col_date_nokey, col_time_nokey, col_datetime_nokey, col_varchar_nokey) +VALUES (7, '2004-04-09', '14:03:03.042673', '2001-11-28 00:50:27.051028', 'c'), +(1, '2006-05-13', '01:46:09.016386', '2007-10-09 19:53:04.008332', NULL); +Warnings: +Note 1265 Data truncated for column 'gcol_time_key' at row 1 +Note 1265 Data truncated for column 'gcol_time_key' at row 2 +CREATE TABLE bb ( +pk INTEGER AUTO_INCREMENT, +col_int_nokey INTEGER, +gcol_int_key INTEGER GENERATED ALWAYS AS (col_int_nokey + col_int_nokey) VIRTUAL, +col_date_nokey DATE, +gcol_date_key DATE GENERATED ALWAYS AS (DATE_ADD(col_date_nokey,interval 30 day)) VIRTUAL, +col_datetime_nokey DATETIME, +col_time_nokey TIME, +gcol_datetime_key DATETIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL, +gcol_time_key TIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL, +col_varchar_nokey VARCHAR(1), +gcol_varchar_key VARCHAR(2) GENERATED ALWAYS AS (CONCAT(col_varchar_nokey, col_varchar_nokey)) VIRTUAL, +PRIMARY KEY (pk), +UNIQUE KEY (gcol_int_key), +UNIQUE KEY (gcol_varchar_key), +UNIQUE KEY (gcol_date_key), +KEY (gcol_time_key), +KEY (gcol_datetime_key), +UNIQUE KEY (gcol_int_key, gcol_varchar_key), +KEY (gcol_int_key, col_int_nokey), +KEY(gcol_int_key,gcol_date_key), +KEY(gcol_int_key, gcol_time_key), +KEY(gcol_int_key, gcol_datetime_key), +UNIQUE KEY(gcol_date_key,gcol_time_key,gcol_datetime_key), +UNIQUE KEY (gcol_varchar_key, col_varchar_nokey), +UNIQUE KEY (gcol_int_key, gcol_varchar_key, gcol_date_key, gcol_time_key, gcol_datetime_key) +) AUTO_INCREMENT=10 ENGINE=INNODB; +INSERT IGNORE INTO bb ( col_int_nokey, col_date_nokey, col_time_nokey, col_datetime_nokey, col_varchar_nokey) +VALUES (0, '2003-08-04', '01:48:05.048577', '2006-11-03 00:00:00', 'p'), +(2, '2007-11-06', '00:00:00', '2009-11-26 19:28:11.005115', 'n'); +Warnings: +Note 1265 Data truncated for column 'gcol_time_key' at row 1 +Note 1265 Data truncated for column 'gcol_time_key' at row 2 +CREATE TABLE cc ( +pk INTEGER AUTO_INCREMENT, +col_int_nokey INTEGER, +gcol_int_key INTEGER GENERATED ALWAYS AS (col_int_nokey + col_int_nokey) VIRTUAL, +col_date_nokey DATE, +gcol_date_key DATE GENERATED ALWAYS AS (DATE_ADD(col_date_nokey,interval 30 day)) VIRTUAL, +col_datetime_nokey DATETIME, +col_time_nokey TIME, +gcol_datetime_key DATETIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL, +gcol_time_key TIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL, +col_varchar_nokey VARCHAR(1), +gcol_varchar_key VARCHAR(2) GENERATED ALWAYS AS (CONCAT(col_varchar_nokey, col_varchar_nokey)) VIRTUAL, +PRIMARY KEY (pk), +UNIQUE KEY (gcol_int_key), +UNIQUE KEY (gcol_varchar_key), +UNIQUE KEY (gcol_date_key), +KEY (gcol_time_key), +KEY (gcol_datetime_key), +UNIQUE KEY (gcol_int_key, gcol_varchar_key), +KEY (gcol_int_key, col_int_nokey), +KEY(gcol_int_key,gcol_date_key), +KEY(gcol_int_key, gcol_time_key), +KEY(gcol_int_key, gcol_datetime_key), +UNIQUE KEY(gcol_date_key,gcol_time_key,gcol_datetime_key), +UNIQUE KEY (gcol_varchar_key, col_varchar_nokey), +UNIQUE KEY (gcol_int_key, gcol_varchar_key, gcol_date_key, gcol_time_key, gcol_datetime_key) +) AUTO_INCREMENT=10 ENGINE=INNODB; +INSERT IGNORE INTO cc (col_int_nokey, col_date_nokey, col_time_nokey, col_datetime_nokey, col_varchar_nokey) +VALUES (172, '2009-04-23', '00:00:00', '2000-12-07 10:17:40.013275', 'h'), +(NULL, '2002-10-06', '00:50:49.017545', NULL, 'm'); +Warnings: +Note 1265 Data truncated for column 'gcol_time_key' at row 1 +EXPLAIN SELECT +gp1 . gcol_datetime_key AS g1 +FROM cc AS gp1 LEFT JOIN c AS gp2 ON ( gp2 . gcol_datetime_key <> gp1 . +col_time_nokey ) +WHERE +gp1 . col_varchar_nokey IN +( +SELECT +DISTINCT p1 . gcol_varchar_key AS p1 +FROM bb AS p1 LEFT JOIN bb AS p2 +ON ( p1 . gcol_int_key = p2 . pk ) +) +AND gp1 . col_varchar_nokey = 'b' +HAVING g1 > 6; +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 +SELECT +gp1 . gcol_datetime_key AS g1 +FROM cc AS gp1 LEFT JOIN c AS gp2 ON ( gp2 . gcol_datetime_key <> gp1 . +col_time_nokey ) +WHERE +gp1 . col_varchar_nokey IN +( +SELECT +DISTINCT p1 . gcol_varchar_key AS p1 +FROM bb AS p1 LEFT JOIN bb AS p2 +ON ( p1 . gcol_int_key = p2 . pk ) +) +AND gp1 . col_varchar_nokey = 'b' +HAVING g1 > 6; +g1 +DROP TABLE bb, c, cc; +# Bug#21284646: Assertion !(table || table->read_set || bitmap_is_set()) +CREATE TABLE c ( +pk INTEGER AUTO_INCREMENT, +col_int_nokey INTEGER NOT NULL, +col_int_key INTEGER GENERATED ALWAYS AS (col_int_nokey + col_int_nokey) VIRTUAL, +col_date_nokey DATE NOT NULL, +col_date_key DATE GENERATED ALWAYS AS (DATE_ADD(col_date_nokey,interval 30 day)) VIRTUAL, +col_datetime_nokey DATETIME NOT NULL, +col_time_nokey TIME NOT NULL, +col_datetime_key DATETIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL, +col_time_key TIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL, +col_varchar_nokey VARCHAR(1) NOT NULL, +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS (CONCAT(col_varchar_nokey, col_varchar_nokey)) VIRTUAL, +PRIMARY KEY (pk,col_int_nokey), +UNIQUE KEY (col_int_key), +UNIQUE KEY (col_varchar_key), +UNIQUE KEY (col_date_key), +KEY (col_time_key), +KEY (col_datetime_key), +UNIQUE KEY (col_int_key, col_varchar_key), +KEY (col_int_key, col_int_nokey), +KEY(col_int_key,col_date_key), +KEY(col_int_key, col_time_key), +KEY(col_int_key, col_datetime_key), +UNIQUE KEY (col_date_key,col_time_key,col_datetime_key), +UNIQUE KEY (col_varchar_key, col_varchar_nokey), +UNIQUE KEY (col_int_key, col_varchar_key, col_date_key, col_time_key, col_datetime_key) +) ENGINE=INNODB; +INSERT INTO c (col_int_nokey, col_date_nokey, col_time_nokey, col_datetime_nokey, col_varchar_nokey) VALUES +(1, '2009-12-01', '00:21:38.058143', '2007-05-28 00:00:00', 'c'), +(8, '2004-12-17', '04:08:02.046897', '2009-07-25 09:21:20.064099', 'm'), +(9, '2000-03-14', '16:25:11.040240', '2002-01-16 00:00:00', 'd'), +(6, '2006-05-25', '19:47:59.011283', '2001-02-15 03:08:38.035426', 'y'), +(2, '2002-10-13', '00:00:00', '1900-01-01 00:00:00', 's'), +(4, '1900-01-01', '15:57:25.019666', '2005-08-15 00:00:00', 'r'); +Warnings: +Note 1265 Data truncated for column 'col_time_key' at row 1 +Note 1265 Data truncated for column 'col_time_key' at row 2 +Note 1265 Data truncated for column 'col_time_key' at row 3 +Note 1265 Data truncated for column 'col_time_key' at row 4 +Note 1265 Data truncated for column 'col_time_key' at row 5 +Note 1265 Data truncated for column 'col_time_key' at row 6 +ANALYZE TABLE c; +Table Op Msg_type Msg_text +test.c analyze status OK +explain SELECT COUNT(DISTINCT col_varchar_key) AS x +FROM c +WHERE col_varchar_key IN ('rr', 'rr') OR +col_int_nokey <> 9 AND +pk >= 8 +HAVING x > '2000-02-06' +ORDER BY col_time_nokey, pk; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE c ALL PRIMARY,col_varchar_key,col_varchar_key_2 NULL NULL NULL 6 Using where +SELECT COUNT(DISTINCT col_varchar_key) AS x +FROM c +WHERE col_varchar_key IN ('rr', 'rr') OR +col_int_nokey <> 9 AND +pk >= 8 +HAVING x > '2000-02-06' +ORDER BY col_time_nokey, pk; +x +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '2000-02-06' +DROP TABLE c; +# Bug#21341044: Conditional jump at sort_param::make_sort_key +CREATE TABLE t1 ( +pk INTEGER AUTO_INCREMENT, +col_int_nokey INTEGER, +col_int_key INTEGER GENERATED ALWAYS AS (col_int_nokey + col_int_nokey) VIRTUAL, +col_blob_nokey BLOB, +col_blob_key BLOB GENERATED ALWAYS AS (REPEAT(col_blob_nokey,15)) VIRTUAL, +col_longblob_nokey LONGBLOB, +col_longtext_nokey LONGTEXT, +col_longblob_key LONGBLOB GENERATED ALWAYS AS (REPEAT(col_longblob_nokey, 20)) VIRTUAL, +col_longtext_key LONGTEXT GENERATED ALWAYS AS (REPEAT(col_longblob_nokey, 18)) VIRTUAL, +col_text_nokey TEXT, +col_text_key TEXT GENERATED ALWAYS AS (REPEAT(col_text_nokey, 30)) VIRTUAL, +PRIMARY KEY (pk), +KEY (col_int_key), +KEY (col_text_key(50)), +KEY (col_blob_key(200)), +KEY (col_longtext_key(200)), +KEY (col_longblob_key(200)), +KEY (col_int_key, col_text_key(100)), +KEY (col_int_key, col_longtext_key(100)), +KEY (col_int_key, col_blob_key(100)), +KEY (col_int_key, col_longblob_key(100)), +KEY (col_longtext_key(10), col_longblob_key(100)), +KEY (col_int_key, col_text_key(10), col_blob_key(100), col_longtext_key(50), col_longblob_key(50)) +) engine=innodb; +INSERT INTO t1 (col_int_nokey,col_blob_nokey,col_longtext_nokey,col_longblob_nokey,col_text_nokey) +VALUES +(0, 'ijcszxw', 'ijcszxw', 'ijcszxw', 'ijcszxw'), +(5, 'jcszxwb', 'jcszxwb', 'jcszxwb', 'jcszxwb'), +(4, 'cszxwbjjvv', 'cszxwbjjvv', 'cszxwbjjvv', 'cszxwbjjvv'), +(3, 'szxw', 'szxw', 'szxw', 'szxw'), +(7, 'zxwb', 'zxwb', 'zxwb', 'zxwb'), +(42, 'xwbjjvvky', 'xwbjjvvky', 'xwbjjvvky', 'xwbjjvvky'), +(142, 'wbjj', 'wbjj', 'wbjj', 'wbjj'), +(5, 'bjjv', 'bjjv', 'bjjv', 'bjjv'), +(0, 'jjvvkymalu', 'jjvvkymalu', 'jjvvkymalu', 'jjvvkymalu'), +(3, 'j', 'j', 'j', 'j'); +SELECT alias1.pk AS field1 +FROM t1 AS alias1 LEFT OUTER JOIN t1 AS alias2 +ON alias1.col_int_key = alias2.col_int_key +WHERE alias2.col_int_key BETWEEN 8 AND (8 + 1 ) OR +alias2.col_int_key BETWEEN 8 AND (8 + 5 ) AND +alias2.col_int_key != 20 OR +alias2.col_int_key IN (8, 5, 8) AND +alias2.col_int_key >= 0 AND +alias2.col_int_key <= ( 8 + 75 ) AND +alias1.pk IS NOT NULL +ORDER BY field1; +field1 +2 +2 +3 +8 +8 +DROP TABLE t1; +# bug#21487651: gcols: memory leak after failed alter table +CREATE TABLE t(a int); +ALTER TABLE t ADD COLUMN b int GENERATED ALWAYS AS ( +date_sub(a,interval a month)) VIRTUAL; +ALTER TABLE t ADD COLUMN c int GENERATED ALWAYS AS (sum(a)); +ERROR HY000: Function or expression 'sum()' cannot be used in the GENERATED ALWAYS AS clause of `c` +DROP TABLE t; +# +# Bug#21628840: CRASH/MEMORY CORRUPTION ADDING INDEXES TO VIRTUAL COLUMN +# (II) +# +CREATE TABLE t1( a INT ) ENGINE = INNODB; +INSERT INTO t1( a ) VALUES ( 1 ), ( 2 ), ( 3 ), ( 4 ), ( 5 ); +ALTER TABLE t1 ADD COLUMN b INT GENERATED ALWAYS AS (a - 1) STORED; +ALTER TABLE t1 ADD COLUMN c INT GENERATED ALWAYS AS (b + 1) VIRTUAL; +# Used to cause valgrind warning. +ALTER TABLE t1 ADD INDEX( c ); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +# Make sure the index is correct. That's kinda important. +EXPLAIN +SELECT c FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL c 5 NULL 5 Using index +SELECT c FROM t1; +c +1 +2 +3 +4 +5 +DROP TABLE t1; +# +# Bug#21797776 ASSERTION `BIT < MAP->N_BITS' FAILED. +# +CREATE TABLE C ( +col_int_1 INT, +col_int_2 INT GENERATED ALWAYS AS (col_int_1 + col_int_1) STORED, +col_int_3 INT GENERATED ALWAYS AS (col_int_2 + col_int_1) VIRTUAL +); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS +SELECT +col_int_2 AS field1, col_int_2 AS field2, +col_int_3 AS field3, col_int_3 AS field4 +FROM C; +SELECT * FROM v1; +field1 field2 field3 field4 +DROP TABLE C; +DROP VIEW v1; +# +# Bug#21613615 GCOLS: ASSERTION FAILED: !TABLE || (!TABLE->READ_SET || BITMAP_IS_SET +# +CREATE TABLE t (a INT); +CREATE TABLE v ( +a INT, +c INT, +b CHAR(2) GENERATED ALWAYS AS (a IN (1)) VIRTUAL, +KEY(c,b(1))); +INSERT INTO v (a,c) VALUES (1,1); +EXPLAIN SELECT 1 FROM t WHERE ( SELECT 1 FROM t ) >=ANY( SELECT c FROM v ); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +SELECT 1 FROM t WHERE ( SELECT 1 FROM t ) >=ANY( SELECT c FROM v ); +1 +EXPLAIN SELECT (SELECT MAX(c) FROM v); +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 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +SELECT (SELECT MAX(c) FROM v); +(SELECT MAX(c) FROM v) +1 +DROP TABLE t, v; +CREATE TABLE v ( +a INT, +c INT, +b CHAR(2) GENERATED ALWAYS AS (a IN (1)) VIRTUAL, KEY(c,b(1))); +INSERT INTO v (a,c) VALUES (1,1); +SELECT MAX(c), COUNT(b) FROM v; +MAX(c) COUNT(b) +1 1 +DROP TABLE v; +CREATE TABLE v ( +a INT PRIMARY KEY, +b INT, KEY(b)); +INSERT INTO v (a,b) VALUES (1,1); +SELECT MAX(a) FROM v WHERE b=1; +MAX(a) +1 +DROP TABLE v; +# +# Bug#21824519: ASSERTION IN DROP TRIGGER WHEN TABLE HAS +# VIRTUAL GENERATED COLUMN +# +CREATE TABLE t (a INT, b INT GENERATED ALWAYS AS (a) VIRTUAL); +CREATE TRIGGER tr BEFORE INSERT ON t FOR EACH ROW BEGIN END; +INSERT INTO t (a) VALUES (1); +SELECT * FROM t; +a b +1 1 +DROP TRIGGER tr; +SELECT * FROM t; +a b +1 1 +CREATE FUNCTION f() RETURNS INT RETURN (SELECT COUNT(*) FROM t); +SELECT f(); +f() +1 +DROP FUNCTION f; +SELECT * FROM t; +a b +1 1 +DROP TABLE t; +# +# Bug#21833760 CALC_DAYNR: ASSERTION `DELSUM+(INT) Y/4-TEMP >= 0' FAILED. +# +CREATE TABLE C( +c1 INT AUTO_INCREMENT, +c8 DATETIME, +c9 TIME, +c11 TIME GENERATED ALWAYS AS(ADDTIME(c8,c9)) VIRTUAL, +c13 TIME GENERATED ALWAYS AS(ADDTIME(c8,c11)) VIRTUAL, +PRIMARY KEY(c1), +UNIQUE KEY(c13) +); +INSERT INTO C (c8,c9) VALUES('1970-01-01',0),('1970-01-01',1); +Warnings: +Note 1265 Data truncated for column 'c11' at row 1 +Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c11' at row 2 +Note 1265 Data truncated for column 'c13' at row 2 +CREATE VIEW view_C AS SELECT * FROM C; +SELECT /*+ NO_BNL(t1) */ t1.c13 FROM C AS t2 STRAIGHT_JOIN C AS t1 FORCE INDEX(c13); +c13 +00:00:00 +00:00:00 +00:00:01 +00:00:01 +SELECT DISTINCT t1.c13 FROM C AS t1, view_C AS t2; +c13 +00:00:00 +00:00:01 +DROP TABLE C; +DROP VIEW view_C; +# +# Bug#21810529: CRASH IN ITEM_FUNC::WALK WHEN CODE JUMPS TO GARBAGE +# LOCATION +# +CREATE TABLE t (a TIME,b INT GENERATED ALWAYS AS (a=1) VIRTUAL); +ALTER TABLE t CHANGE COLUMN q w INT; +ERROR 42S22: Unknown column 'q' in 't' +ALTER TABLE t CHANGE COLUMN q w INT; +ERROR 42S22: Unknown column 'q' in 't' +ALTER TABLE t CHANGE COLUMN q w INT; +ERROR 42S22: Unknown column 'q' in 't' +ALTER TABLE t CHANGE COLUMN q w INT; +ERROR 42S22: Unknown column 'q' in 't' +DROP TABLE t; +# +# Bug#21940542 TOO MUCH SPAM: INNODB: COMPUTE VIRTUAL COLUMN VALUES FAILED +# +CREATE TABLE t(b BLOB); +ALTER TABLE t ADD COLUMN c INT GENERATED ALWAYS AS ((1,1)) VIRTUAL; +ERROR 21000: Operand should contain 1 column(s) +DROP TABLE t; +CREATE TABLE t(b BLOB, c INT GENERATED ALWAYS AS ((1,1)) VIRTUAL); +ERROR 21000: Operand should contain 1 column(s) +# +# Bug#21929967 GCOLS: GCOL VALUE CHANGES WHEN SESSION CHANGES SQL_MODE +# +CREATE TABLE t1(a CHAR(1), b CHAR(1), c CHAR(2) AS (a || b)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(1) DEFAULT NULL, + `b` char(1) DEFAULT NULL, + `c` char(2) GENERATED ALWAYS AS (`a` <> 0 or `b` <> 0) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a,b) VALUES('1','1'); +SELECT * FROM t1; +a b c +1 1 1 +SET SQL_MODE=PIPES_AS_CONCAT; +SELECT * FROM t1; +a b c +1 1 1 +FLUSH TABLES; +SELECT * FROM t1; +a b c +1 1 1 +DROP TABLE t1; +CREATE TABLE t1(a CHAR(1), b CHAR(1), c CHAR(2) AS (a || b)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(1) DEFAULT NULL, + `b` char(1) DEFAULT NULL, + `c` char(2) GENERATED ALWAYS AS (concat(`a`,`b`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a,b) VALUES('1','1'); +SELECT * FROM t1; +a b c +1 1 11 +SET SQL_MODE=DEFAULT; +SELECT * FROM t1; +a b c +1 1 11 +FLUSH TABLES; +SELECT * FROM t1; +a b c +1 1 11 +DROP TABLE t1; +# Bug#22018999: gcols: assertion failed: !error +SET @save_old_sql_mode= @@sql_mode; +SET sql_mode=""; +CREATE TABLE t (a INTEGER AS (SUBSTR('','a',1))) engine=innodb; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'a' +DROP TABLE t; +CREATE TABLE t (a INTEGER) engine=innodb; +ALTER TABLE t ADD b INTEGER AS (SUBSTR('','a',1)); +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'a' +Warning 1292 Truncated incorrect INTEGER value: 'a' +DROP TABLE t; +set sql_mode= @save_old_sql_mode; +# Bug#21875520 Problems with virtual column indexes +CREATE TABLE t( +a TIMESTAMP, +b BLOB, +c TIMESTAMP GENERATED ALWAYS AS (GREATEST(a, '2000-01-01 00:00:00')) VIRTUAL, +UNIQUE KEY(c) +); +INSERT INTO t(b) VALUES (''); +UPDATE t SET a='2001-01-01 00:00:00'; +SELECT c FROM t; +c +2001-01-01 00:00:00 +SELECT c, a FROM t; +c a +2001-01-01 00:00:00 2001-01-01 00:00:00 +UPDATE t SET b='xyz'; +DO (SELECT @c1:= c FROM t); +DO (SELECT (@c2:= c) - a FROM t); +SELECT @c2 - @c1; +@c2 - @c1 +0 +DROP TABLE t; +# +# Bug#22133710 GCOLS: READ UNCOMMITTED: ASSERT !TABLE || (!TABLE->WRITE_SET || BITMAP_IS_SET(TA +# +CREATE TABLE t ( +a INT, +b INT GENERATED ALWAYS AS (1) VIRTUAL, +c INT GENERATED ALWAYS AS (1) VIRTUAL, +d INT GENERATED ALWAYS AS (1) VIRTUAL, +KEY (b,d) +) ENGINE=INNODB; +INSERT INTO t VALUES(); +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ; +SELECT 1 FROM t WHERE c GROUP BY b; +1 +1 +COMMIT; +DROP TABLE t; diff --git a/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result b/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result new file mode 100644 index 00000000000..37be09b221f --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result @@ -0,0 +1,696 @@ +SET @@session.default_storage_engine = 'InnoDB'; +# +# Section 1. Wrong column definition options +# - DEFAULT +# - AUTO_INCREMENT +# NOT NULL +create table t1 (a int, b int generated always as (a+1) virtual not null); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'not null)' at line 1 +create table t1 (a int, b int generated always as (a+1) stored not null); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'not null)' at line 1 +create table t1 (a int); +alter table t1 add column b int generated always as (a+1) virtual not null; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'not null' at line 1 +drop table t1; +create table t1 (a int, b int generated always as (a+1) virtual null); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'null)' at line 1 +create table t1 (a int); +alter table t1 add column b int generated always as (a+1) virtual null; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'null' at line 1 +drop table t1; +# Added columns mixed with virtual GC and other columns +create table t1 (a int); +insert into t1 values(1); +alter table t1 add column (b int generated always as (a+1) virtual, c int); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +alter table t1 add column (d int, e int generated always as (a+1) virtual); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +alter table t1 add column (f int generated always as (a+1) virtual, g int as(5) stored); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +alter table t1 add column (h int generated always as (a+1) virtual, i int as(5) virtual); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +drop table t1; +# DEFAULT +create table t1 (a int, b int generated always as (a+1) virtual default 0); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'default 0)' at line 1 +create table t1 (a int); +alter table t1 add column b int generated always as (a+1) virtual default 0; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'default 0' at line 1 +drop table t1; +# AUTO_INCREMENT +create table t1 (a int, b int generated always as (a+1) virtual AUTO_INCREMENT); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AUTO_INCREMENT)' at line 1 +create table t1 (a int); +alter table t1 add column b int generated always as (a+1) virtual AUTO_INCREMENT; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AUTO_INCREMENT' at line 1 +drop table t1; +# [PRIMARY] KEY +create table t1 (a int, b int generated always as (a+1) virtual key); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'key)' at line 1 +create table t1 (a int, b int generated always as (a+1) stored key); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'key)' at line 1 +create table t1 (a int, b int generated always as (a+1) virtual primary key); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'primary key)' at line 1 +create table t1 (a int, b int generated always as (a+1) stored primary key); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'primary key)' at line 1 +create table t1 (a int); +alter table t1 add column b int generated always as (a+1) virtual key; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'key' at line 1 +alter table t1 add column b int generated always as (a+1) stored key; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'key' at line 1 +alter table t1 add column c int generated always as (a+2) virtual primary key; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'primary key' at line 1 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +alter table t1 add column c int generated always as (a+2) stored primary key; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'primary key' at line 1 +drop table t1; +# Section 2. Other column definition options +# - COMMENT +# - REFERENCES (only syntax testing here) +# - STORED (only systax testing here) +create table t1 (a int, b int generated always as (a % 2) virtual comment 'my comment'); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL COMMENT 'my comment' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES NULL VIRTUAL GENERATED +drop table t1; +create table t1 (a int, b int generated always as (a % 2) virtual); +alter table t1 modify b int generated always as (a % 2) virtual comment 'my comment'; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL COMMENT 'my comment' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES NULL VIRTUAL GENERATED +insert into t1 (a) values (1); +select * from t1; +a b +1 1 +insert into t1 values (2,default); +select a,b from t1 order by a; +a b +1 1 +2 0 +create table t2 like t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL COMMENT 'my comment' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +describe t2; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES NULL VIRTUAL GENERATED +insert into t2 (a) values (1); +select * from t2; +a b +1 1 +insert into t2 values (2,default); +select a,b from t2 order by a; +a b +1 1 +2 0 +drop table t2; +drop table t1; +create table t1 (a int, b int generated always as (a % 2) stored); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 2) STORED +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES NULL STORED GENERATED +insert into t1 (a) values (1); +select * from t1; +a b +1 1 +insert into t1 values (2,default); +select a,b from t1 order by a; +a b +1 1 +2 0 +drop table t1; +create table t2 (a int); +create table t1 (a int, b int generated always as (a % 2) stored references t2(a)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 2) STORED +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1; +create table t1 (a int, b int generated always as (a % 2) virtual); +alter table t1 modify b int generated always as (a % 2) stored references t2(a); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'references t2(a)' at line 1 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1; +drop table t2; +FK options +create table t1(a int, b int as (a % 2), c int as (a) stored); +create table t2 (a int); +alter table t1 add constraint foreign key fk(d) references t2(a); +ERROR 42000: Key column 'd' doesn't exist in table +alter table t1 add constraint foreign key fk(c) references t2(a) on delete set null; +ERROR HY000: Cannot define foreign key with ON DELETE SET NULL clause on a generated column +alter table t1 add constraint foreign key fk(c) references t2(a) on update set null; +ERROR HY000: Cannot define foreign key with ON UPDATE SET NULL clause on a generated column +alter table t1 add constraint foreign key fk(c) references t2(a) on update cascade; +ERROR HY000: Cannot define foreign key with ON UPDATE CASCADE clause on a generated column +drop table t1; +drop table t2; +Generated always is optional +create table t1 (a int, b int as (a % 2) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES NULL VIRTUAL GENERATED +drop table t1; +create table t1 (a int, b int as (a % 2) stored); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 2) STORED +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES NULL STORED GENERATED +drop table t1; +Default should be non-stored column +create table t1 (a int, b int as (a % 2)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES NULL VIRTUAL GENERATED +drop table t1; +Expression can be constant +create table t1 (a int, b int as (5 * 2)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (5 * 2) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES NULL VIRTUAL GENERATED +drop table t1; +Test generated columns referencing other generated columns +create table t1 (a int unique, b int generated always as(-a) virtual, c int generated always as (b + 1) virtual); +insert into t1 (a) values (1), (2); +select * from t1; +a b c +1 -1 0 +2 -2 -1 +insert into t1(a) values (1) on duplicate key update a=3; +select * from t1; +a b c +2 -2 -1 +3 -3 -2 +update t1 set a=4 where a=2; +select * from t1; +a b c +3 -3 -2 +4 -4 -3 +drop table t1; +create table t1 (a int, b int generated always as(-b) virtual, c int generated always as (b + 1) virtual); +ERROR 01000: Expression for field `b` is refering to uninitialized field `b` +create table t1 (a int, b int generated always as(-c) virtual, c int generated always as (b + 1) virtual); +ERROR 01000: Expression for field `b` is refering to uninitialized field `c` +create table t1 (pk int auto_increment primary key, col_int_nokey int generated always as (pk + col_int_key) stored, col_int_key int); +ERROR 01000: Expression for field `col_int_nokey` is refering to uninitialized field `pk` +# Bug#20339347: FAIL TO USE CREATE ....SELECT STATEMENT TO CREATE A NEW TABLE +create table t1 (a int, b int generated always as(-a) virtual, c int generated always as (b + 1) stored); +insert into t1(a) values(1),(2); +create table tt as select * from t1; +select * from t1 order by a; +a b c +1 -1 0 +2 -2 -1 +select * from tt order by a; +a b c +1 -1 0 +2 -2 -1 +drop table t1,tt; +# Bug#20745142: GENERATED COLUMNS: ASSERTION FAILED: +# THD->CHANGE_LIST.IS_EMPTY() +# +CREATE TABLE t1(a bigint AS (a between 1 and 1)); +ERROR 01000: Expression for field `a` is refering to uninitialized field `a` +# Bug#20757211: GENERATED COLUMNS: ALTER TABLE CRASHES +# IN FIND_FIELD_IN_TABLE +# +CREATE TABLE t1(a int); +ALTER TABLE t1 ADD COLUMN z int GENERATED ALWAYS AS +( 1 NOT IN (SELECT 1 FROM t1 WHERE c0006) ) virtual; +ERROR HY000: Function or expression 'select ...' cannot be used in the GENERATED ALWAYS AS clause of `z` +DROP TABLE t1; +# Bug#20566243: ERROR WHILE DOING CREATE TABLE T1 SELECT (QUERY ON GC COLUMNS) +CREATE TABLE t1(a int, b int as (a + 1), +c varchar(12) as ("aaaabb") stored, d blob as (c)); +INSERT INTO t1(a) VALUES(1),(3); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL, + `c` varchar(12) GENERATED ALWAYS AS ('aaaabb') STORED, + `d` blob GENERATED ALWAYS AS (`c`) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t1 order by a; +a b c d +1 2 aaaabb aaaabb +3 4 aaaabb aaaabb +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL, + `c` varchar(12) GENERATED ALWAYS AS ('aaaabb') STORED, + `d` blob GENERATED ALWAYS AS (`c`) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +CREATE TABLE t3 AS SELECT * FROM t1; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` varchar(12) DEFAULT NULL, + `d` blob DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t3 order by a; +a b c d +1 2 aaaabb aaaabb +3 4 aaaabb aaaabb +CREATE TABLE t4 AS SELECT b,c,d FROM t1; +SHOW CREATE TABLE t4; +Table Create Table +t4 CREATE TABLE `t4` ( + `b` int(11) DEFAULT NULL, + `c` varchar(12) DEFAULT NULL, + `d` blob DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t4 order by b; +b c d +2 aaaabb aaaabb +4 aaaabb aaaabb +DROP TABLE t1,t2,t3,t4; +# Bug#21025003:WL8149:ASSERTION `CTX->NUM_TO_DROP_FK +# == HA_ALTER_INFO->ALTER_INFO-> FAILED +# +CREATE TABLE t1 ( +col1 int(11) DEFAULT NULL, +col2 int(11) DEFAULT NULL, +col3 int(11) DEFAULT NULL, +col4 int(11) DEFAULT NULL, +col5 int(11) GENERATED ALWAYS AS (col4 / col2) VIRTUAL, +col6 text +); +INSERT INTO t1(col1,col2,col3,col4,col6) VALUES(NULL,1,4,0,REPEAT(2,1000)); +ALTER TABLE t1 DROP PRIMARY KEY , ADD KEY idx ( col5, col2 ); +ERROR 42000: Can't DROP INDEX `PRIMARY`; check that it exists +DROP TABLE t1; +# Bug#20949226:i CAN ASSIGN NON-DEFAULT() VALUE TO GENERATED COLUMN +# +CREATE TABLE t1 (c1 INT, c2 INT AS (c1 * 2)) SELECT 1 AS c1, 5 AS c2; +Warnings: +Warning 1906 The value specified for generated column 'c2' in table 't1' ignored +CREATE TABLE t2 (a int); +INSERT INTO t2 values(1); +DROP TABLE t1; +CREATE TABLE t1 (c1 INT, c2 INT AS (c1 * 2)) SELECT 1 AS c1, a AS c2 from t2; +Warnings: +Warning 1906 The value specified for generated column 'c2' in table 't1' ignored +DROP TABLE t1; +CREATE TABLE t1 (c1 INT, c2 INT AS (c1 * 2)) SELECT 1 AS c1, 5; +SELECT * FROM t1; +c2 c1 5 +2 1 5 +DROP TABLE t1, t2; +# Bug#21074624:i WL8149:SIG 11 INNOBASE_GET_COMPUTED_VALUE | +# INNOBASE/HANDLER/HA_INNODB.CC:19082 +CREATE TABLE t1 ( +col1 int(11) NOT NULL, +col2 int(11) DEFAULT NULL, +col3 int(11) NOT NULL, +col4 int(11) DEFAULT NULL, +col5 int(11) GENERATED ALWAYS AS (col2 % col4) VIRTUAL, +col6 int(11) GENERATED ALWAYS AS (col3 + col3) VIRTUAL, +col7 int(11) GENERATED ALWAYS AS (col5 / col5) VIRTUAL, +col8 int(11) GENERATED ALWAYS AS (col6 / col5) VIRTUAL, +col9 text, +extra int(11) DEFAULT NULL, +KEY idx (col5) +); +INSERT INTO t1(col1,col2,col3,col4,col9,extra) +VALUES(0,6,3,4,REPEAT(4,1000),0); +ALTER TABLE t1 DROP COLUMN col1; +DROP TABLE t1; +# Bug#21390605:VALGRIND ERROR ON DELETE FROM TABLE CONTAINING +# AN INDEXED VIRTUAL COLUMN +CREATE TABLE t1 ( +a INTEGER, +b INTEGER GENERATED ALWAYS AS (a) VIRTUAL, +c INTEGER GENERATED ALWAYS AS (b) VIRTUAL, +INDEX idx (b,c) +); +INSERT INTO t1 (a) VALUES (42); +DELETE FROM t1 WHERE c = 42; +DROP TABLE t1; +# Bug#20757211: GENERATED COLUMNS: ALTER TABLE CRASHES +# IN FIND_FIELD_IN_TABLE +# +CREATE TABLE t1(a int); +ALTER TABLE t1 ADD COLUMN z int GENERATED ALWAYS AS +( 1 NOT IN (SELECT 1 FROM t1 WHERE c0006) ) virtual; +ERROR HY000: Function or expression 'select ...' cannot be used in the GENERATED ALWAYS AS clause of `z` +CREATE TABLE t2(a int, b int as (1 NOT IN (SELECT 1 FROM t1 WHERE not_exist_col))); +ERROR HY000: Function or expression 'select ...' cannot be used in the GENERATED ALWAYS AS clause of `b` +CREATE TABLE t2(a int, b int as (1 NOT IN (SELECT 1 FROM dual))); +ERROR HY000: Function or expression 'select ...' cannot be used in the GENERATED ALWAYS AS clause of `b` +DROP TABLE t1; +# Bug#21142905: PARTITIONED GENERATED COLS - +# !TABLE || (!TABLE->WRITE_SET || BITMAP_IS_SET +# +CREATE TABLE t1 ( +a int, +b int generated always as (a) virtual, +c int generated always as (b+a) virtual, +d int generated always as (b+a) virtual +) PARTITION BY LINEAR HASH (b); +INSERT INTO t1(a) VALUES(0); +DELETE FROM t1 WHERE c=1; +DROP TABLE t1; +CREATE TABLE t1 (c CHAR(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ("foo bar")); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'GENERATED ALWAYS AS ("foo bar"))' at line 1 +CREATE TABLE t1 (i INT); +ALTER TABLE t1 ADD COLUMN c CHAR(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ("foo bar"); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'GENERATED ALWAYS AS ("foo bar")' at line 1 +DROP TABLE t1; +CREATE TABLE t1 (i INT COLLATE utf8_bin, c INT COLLATE utf8_bin GENERATED ALWAYS AS (10)); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'GENERATED ALWAYS AS (10))' at line 1 +# Check for a charset mismatch processing: +# Bug #21469535: VALGRIND ERROR (CONDITIONAL JUMP) WHEN INSERT +# ROWS INTO A PARTITIONED TABLE +# +CREATE TABLE t1 ( +id INT NOT NULL, +store_id INT NOT NULL, +x INT GENERATED ALWAYS AS (id + store_id) +) +PARTITION BY RANGE (store_id) ( +PARTITION p0 VALUES LESS THAN (6), +PARTITION p1 VALUES LESS THAN (11), +PARTITION p2 VALUES LESS THAN (16), +PARTITION p3 VALUES LESS THAN (21) +); +INSERT INTO t1 VALUES(1, 2, default); +DROP TABLE t1; +# Bug#21465626:ASSERT/CRASH ON DROPPING/ADDING VIRTUAL COLUMN +CREATE TABLE t (a int(11), b int(11), +c int(11) GENERATED ALWAYS AS (a+b) VIRTUAL, +d int(11) GENERATED ALWAYS AS (a+b) VIRTUAL); +INSERT INTO t(a,b) VALUES(1,2); +# Mixed drop/add/rename virtual with non-virtual columns, +# ALGORITHM=INPLACE is not supported for InnoDB +ALTER TABLE t DROP d, ADD e varchar(10); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t ADD d int, ADD f char(10) AS ('aaa'); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t CHANGE d dd int, CHANGE f ff varchar(10) AS ('bbb'); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +# Only drop/add/change virtual, inplace is supported for Innodb +ALTER TABLE t DROP c, DROP ff; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t ADD c int(11) as (a+b), ADD f varchar(10) as ('aaa'); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t CHANGE c c int(11) as (a), CHANGE f f varchar(10) as('bbb'); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Change order should be ALGORITHM=INPLACE on Innodb +ALTER TABLE t CHANGE c c int(11) as (a) after f; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t CHANGE b b int(11) after c; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +# TODO: Changing virtual column type should be ALGORITHM=INPLACE on InnoDB, current it goes only with COPY method +ALTER TABLE t CHANGE c c varchar(10) as ('a'); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +# Changing stored column type is ALGORITHM=COPY +ALTER TABLE t CHANGE dd d varchar(10); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t ADD INDEX idx(c), ADD INDEX idx1(d); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t DROP INDEX idx, DROP INDEX idx1; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +DROP TABLE t; +# Bug#21854004: GCOLS:INNODB: FAILING ASSERTION: I < TABLE->N_DEF +CREATE TABLE t1( +col1 INTEGER PRIMARY KEY, +col2 INTEGER, +col3 INTEGER, +col4 INTEGER, +vgc1 INTEGER AS (col2 + col3) VIRTUAL, +sgc1 INTEGER AS (col2 - col3) STORED +); +INSERT INTO t1(col1, col2, col3) VALUES +(1, 10, 100), (2, 20, 200); +SELECT * FROM t1 order by col1; +col1 col2 col3 col4 vgc1 sgc1 +1 10 100 NULL 110 -90 +2 20 200 NULL 220 -180 +ALTER TABLE t1 MODIFY COLUMN vgc1 INTEGER AS (col2 * col3) VIRTUAL; +SELECT * FROM t1 order by col1; +col1 col2 col3 col4 vgc1 sgc1 +1 10 100 NULL 1000 -90 +2 20 200 NULL 4000 -180 +ALTER TABLE t1 MODIFY COLUMN sgc1 INTEGER AS (col2 / col3) STORED; +SELECT * FROM t1 order by col1; +col1 col2 col3 col4 vgc1 sgc1 +1 10 100 NULL 1000 0 +2 20 200 NULL 4000 0 +ALTER TABLE t1 MODIFY COLUMN vgc1 INTEGER AS (col2 + col3) VIRTUAL; +ALTER TABLE t1 MODIFY COLUMN sgc1 INTEGER AS (col2 - col3) STORED; +ALTER TABLE t1 ADD INDEX vgc1 (vgc1); +ALTER TABLE t1 ADD INDEX sgc1 (sgc1); +ALTER TABLE t1 MODIFY COLUMN vgc1 INTEGER AS (col2 * col3) VIRTUAL; +SELECT * FROM t1 order by col1; +col1 col2 col3 col4 vgc1 sgc1 +1 10 100 NULL 1000 -90 +2 20 200 NULL 4000 -180 +SELECT vgc1 FROM t1 order by vgc1; +vgc1 +1000 +4000 +ALTER TABLE t1 MODIFY COLUMN sgc1 INTEGER AS (col2 / col3) STORED; +SELECT * FROM t1 order by col1; +col1 col2 col3 col4 vgc1 sgc1 +1 10 100 NULL 1000 0 +2 20 200 NULL 4000 0 +SELECT sgc1 FROM t1 order by sgc1; +sgc1 +0 +0 +ALTER TABLE t1 DROP INDEX vgc1; +ALTER TABLE t1 DROP INDEX sgc1; +ALTER TABLE t1 MODIFY COLUMN vgc1 INTEGER AS (col2 + col3) VIRTUAL; +ALTER TABLE t1 ADD UNIQUE INDEX vgc1 (vgc1); +ALTER TABLE t1 MODIFY COLUMN sgc1 INTEGER AS (col2 - col3) STORED; +ALTER TABLE t1 ADD UNIQUE INDEX sgc1 (sgc1); +ALTER TABLE t1 MODIFY COLUMN vgc1 INTEGER AS (col2 / col3) VIRTUAL; +ERROR 23000: Duplicate entry '0' for key 'vgc1' +ALTER TABLE t1 MODIFY COLUMN sgc1 INTEGER AS (col2 / col3) STORED; +ERROR 23000: Duplicate entry '0' for key 'sgc1' +ALTER TABLE t1 MODIFY COLUMN vgc1 INTEGER AS (col2 * col3) VIRTUAL; +SELECT * FROM t1 order by col1; +col1 col2 col3 col4 vgc1 sgc1 +1 10 100 NULL 1000 -90 +2 20 200 NULL 4000 -180 +SELECT vgc1 FROM t1 order by col1; +vgc1 +1000 +4000 +ALTER TABLE t1 MODIFY COLUMN sgc1 INTEGER AS (col2 * col3) STORED; +SELECT * FROM t1 order by col1; +col1 col2 col3 col4 vgc1 sgc1 +1 10 100 NULL 1000 1000 +2 20 200 NULL 4000 4000 +SELECT sgc1 FROM t1 order by sgc1; +sgc1 +1000 +4000 +ALTER TABLE t1 MODIFY COLUMN vgc1 INTEGER AS (col2 * col3) STORED; +ERROR HY000: This is not yet supported for generated columns +ALTER TABLE t1 MODIFY COLUMN sgc1 INTEGER AS (col2 / col3) VIRTUAL; +ERROR HY000: This is not yet supported for generated columns +ALTER TABLE t1 MODIFY COLUMN col4 INTEGER AS (col1 + col2 + col3) STORED; +SELECT * FROM t1 order by col1; +col1 col2 col3 col4 vgc1 sgc1 +1 10 100 111 1000 1000 +2 20 200 222 4000 4000 +ALTER TABLE t1 MODIFY COLUMN col4 INTEGER; +SELECT * FROM t1 order by col1; +col1 col2 col3 col4 vgc1 sgc1 +1 10 100 111 1000 1000 +2 20 200 222 4000 4000 +DROP TABLE t1; +# +# bug#22018979: RECORD NOT FOUND ON UPDATE, +# VIRTUAL COLUMN, ASSERTION 0 +SET @sql_mode_save= @@sql_mode; +SET sql_mode= 'ANSI'; +CREATE TABLE t1 ( +a INT, +b VARCHAR(10), +c CHAR(3) GENERATED ALWAYS AS (substr(b,1,3)) VIRTUAL, +PRIMARY KEY (a), +KEY c(c) +); +INSERT INTO t1(a, b) values(1, 'bbbb'), (2, 'cc'); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" int(11) NOT NULL, + "b" varchar(10) DEFAULT NULL, + "c" char(3) GENERATED ALWAYS AS (substr("b",1,3)) VIRTUAL, + PRIMARY KEY ("a"), + KEY "c" ("c") +) +SELECT * FROM t1 order by a; +a b c +1 bbbb bbb +2 cc cc +SET sql_mode= ''; +FLUSH TABLE t1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(10) DEFAULT NULL, + `c` char(3) GENERATED ALWAYS AS (substr(`b`,1,3)) VIRTUAL, + PRIMARY KEY (`a`), + KEY `c` (`c`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t1 order by a; +a b c +1 bbbb bbb +2 cc cc +DELETE FROM t1 where a= 2; +SET sql_mode= @sql_mode_save; +DROP TABLE t1; +# +# Bug#22680839: DEFAULT IS NOT DETERMINISTIC AND SHOULD NOT BE +# ALLOWED IN GENERATED COLUMNS +# +CREATE TABLE tzz(a INT DEFAULT 5, +gc1 INT AS (a+DEFAULT(a)) VIRTUAL, +gc2 INT AS (a+DEFAULT(a)) STORED, +KEY k1(gc1)); +INSERT INTO tzz(A) VALUES (1); +SELECT * FROM tzz; +a gc1 gc2 +1 6 6 +SELECT gc1 FROM tzz; +gc1 +6 +ALTER TABLE tzz MODIFY COLUMN a INT DEFAULT 6; +SELECT * FROM tzz; +a gc1 gc2 +1 7 7 +SELECT gc1 FROM tzz; +gc1 +7 +DROP TABLE tzz; +# Test 1: ALTER DEFAULT +# +CREATE TABLE t1(a INT PRIMARY KEY DEFAULT 5, +b INT AS (1 + DEFAULT(a)) STORED, +c INT AS (1 + DEFAULT(a)) VIRTUAL); +INSERT INTO t1 VALUES (); +ALTER TABLE t1 ALTER COLUMN a SET DEFAULT 7; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 MODIFY COLUMN a INT DEFAULT 8; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 CHANGE COLUMN a a DOUBLE DEFAULT 5; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +DROP TABLE t1; +# Test 2: ALTER DEFAULT + ADD GCOL +# +CREATE TABLE t1(a INT PRIMARY KEY DEFAULT 5); +INSERT INTO t1 VALUES(); +ALTER TABLE t1 ALTER COLUMN a SET DEFAULT 7, +ADD COLUMN b1 INT AS (1 + DEFAULT(a)) STORED; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ALTER COLUMN a SET DEFAULT 7, +ADD COLUMN c1 INT AS (1 + DEFAULT(a)) VIRTUAL; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ALTER COLUMN a SET DEFAULT 7, +ADD COLUMN b INT AS (1 + DEFAULT(a)) STORED, +ADD COLUMN c INT AS (1 + DEFAULT(a)) VIRTUAL; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +DROP TABLE t1; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result b/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result new file mode 100644 index 00000000000..f6d0830ee3d --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result @@ -0,0 +1,696 @@ +SET @@session.default_storage_engine = 'MyISAM'; +# +# Section 1. Wrong column definition options +# - DEFAULT +# - AUTO_INCREMENT +# NOT NULL +create table t1 (a int, b int generated always as (a+1) virtual not null); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'not null)' at line 1 +create table t1 (a int, b int generated always as (a+1) stored not null); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'not null)' at line 1 +create table t1 (a int); +alter table t1 add column b int generated always as (a+1) virtual not null; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'not null' at line 1 +drop table t1; +create table t1 (a int, b int generated always as (a+1) virtual null); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'null)' at line 1 +create table t1 (a int); +alter table t1 add column b int generated always as (a+1) virtual null; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'null' at line 1 +drop table t1; +# Added columns mixed with virtual GC and other columns +create table t1 (a int); +insert into t1 values(1); +alter table t1 add column (b int generated always as (a+1) virtual, c int); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +alter table t1 add column (d int, e int generated always as (a+1) virtual); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +alter table t1 add column (f int generated always as (a+1) virtual, g int as(5) stored); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +alter table t1 add column (h int generated always as (a+1) virtual, i int as(5) virtual); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +drop table t1; +# DEFAULT +create table t1 (a int, b int generated always as (a+1) virtual default 0); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'default 0)' at line 1 +create table t1 (a int); +alter table t1 add column b int generated always as (a+1) virtual default 0; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'default 0' at line 1 +drop table t1; +# AUTO_INCREMENT +create table t1 (a int, b int generated always as (a+1) virtual AUTO_INCREMENT); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AUTO_INCREMENT)' at line 1 +create table t1 (a int); +alter table t1 add column b int generated always as (a+1) virtual AUTO_INCREMENT; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AUTO_INCREMENT' at line 1 +drop table t1; +# [PRIMARY] KEY +create table t1 (a int, b int generated always as (a+1) virtual key); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'key)' at line 1 +create table t1 (a int, b int generated always as (a+1) stored key); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'key)' at line 1 +create table t1 (a int, b int generated always as (a+1) virtual primary key); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'primary key)' at line 1 +create table t1 (a int, b int generated always as (a+1) stored primary key); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'primary key)' at line 1 +create table t1 (a int); +alter table t1 add column b int generated always as (a+1) virtual key; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'key' at line 1 +alter table t1 add column b int generated always as (a+1) stored key; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'key' at line 1 +alter table t1 add column c int generated always as (a+2) virtual primary key; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'primary key' at line 1 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +alter table t1 add column c int generated always as (a+2) stored primary key; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'primary key' at line 1 +drop table t1; +# Section 2. Other column definition options +# - COMMENT +# - REFERENCES (only syntax testing here) +# - STORED (only systax testing here) +create table t1 (a int, b int generated always as (a % 2) virtual comment 'my comment'); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL COMMENT 'my comment' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES NULL VIRTUAL GENERATED +drop table t1; +create table t1 (a int, b int generated always as (a % 2) virtual); +alter table t1 modify b int generated always as (a % 2) virtual comment 'my comment'; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL COMMENT 'my comment' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES NULL VIRTUAL GENERATED +insert into t1 (a) values (1); +select * from t1; +a b +1 1 +insert into t1 values (2,default); +select a,b from t1 order by a; +a b +1 1 +2 0 +create table t2 like t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL COMMENT 'my comment' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +describe t2; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES NULL VIRTUAL GENERATED +insert into t2 (a) values (1); +select * from t2; +a b +1 1 +insert into t2 values (2,default); +select a,b from t2 order by a; +a b +1 1 +2 0 +drop table t2; +drop table t1; +create table t1 (a int, b int generated always as (a % 2) stored); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 2) STORED +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES NULL STORED GENERATED +insert into t1 (a) values (1); +select * from t1; +a b +1 1 +insert into t1 values (2,default); +select a,b from t1 order by a; +a b +1 1 +2 0 +drop table t1; +create table t2 (a int); +create table t1 (a int, b int generated always as (a % 2) stored references t2(a)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 2) STORED +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 (a int, b int generated always as (a % 2) virtual); +alter table t1 modify b int generated always as (a % 2) stored references t2(a); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'references t2(a)' at line 1 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +drop table t2; +FK options +create table t1(a int, b int as (a % 2), c int as (a) stored); +create table t2 (a int); +alter table t1 add constraint foreign key fk(d) references t2(a); +ERROR 42000: Key column 'd' doesn't exist in table +alter table t1 add constraint foreign key fk(c) references t2(a) on delete set null; +ERROR HY000: Cannot define foreign key with ON DELETE SET NULL clause on a generated column +alter table t1 add constraint foreign key fk(c) references t2(a) on update set null; +ERROR HY000: Cannot define foreign key with ON UPDATE SET NULL clause on a generated column +alter table t1 add constraint foreign key fk(c) references t2(a) on update cascade; +ERROR HY000: Cannot define foreign key with ON UPDATE CASCADE clause on a generated column +drop table t1; +drop table t2; +Generated always is optional +create table t1 (a int, b int as (a % 2) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES NULL VIRTUAL GENERATED +drop table t1; +create table t1 (a int, b int as (a % 2) stored); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 2) STORED +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES NULL STORED GENERATED +drop table t1; +Default should be non-stored column +create table t1 (a int, b int as (a % 2)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES NULL VIRTUAL GENERATED +drop table t1; +Expression can be constant +create table t1 (a int, b int as (5 * 2)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (5 * 2) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES NULL VIRTUAL GENERATED +drop table t1; +Test generated columns referencing other generated columns +create table t1 (a int unique, b int generated always as(-a) virtual, c int generated always as (b + 1) virtual); +insert into t1 (a) values (1), (2); +select * from t1; +a b c +1 -1 0 +2 -2 -1 +insert into t1(a) values (1) on duplicate key update a=3; +select * from t1; +a b c +2 -2 -1 +3 -3 -2 +update t1 set a=4 where a=2; +select * from t1; +a b c +3 -3 -2 +4 -4 -3 +drop table t1; +create table t1 (a int, b int generated always as(-b) virtual, c int generated always as (b + 1) virtual); +ERROR 01000: Expression for field `b` is refering to uninitialized field `b` +create table t1 (a int, b int generated always as(-c) virtual, c int generated always as (b + 1) virtual); +ERROR 01000: Expression for field `b` is refering to uninitialized field `c` +create table t1 (pk int auto_increment primary key, col_int_nokey int generated always as (pk + col_int_key) stored, col_int_key int); +ERROR 01000: Expression for field `col_int_nokey` is refering to uninitialized field `pk` +# Bug#20339347: FAIL TO USE CREATE ....SELECT STATEMENT TO CREATE A NEW TABLE +create table t1 (a int, b int generated always as(-a) virtual, c int generated always as (b + 1) stored); +insert into t1(a) values(1),(2); +create table tt as select * from t1; +select * from t1 order by a; +a b c +1 -1 0 +2 -2 -1 +select * from tt order by a; +a b c +1 -1 0 +2 -2 -1 +drop table t1,tt; +# Bug#20745142: GENERATED COLUMNS: ASSERTION FAILED: +# THD->CHANGE_LIST.IS_EMPTY() +# +CREATE TABLE t1(a bigint AS (a between 1 and 1)); +ERROR 01000: Expression for field `a` is refering to uninitialized field `a` +# Bug#20757211: GENERATED COLUMNS: ALTER TABLE CRASHES +# IN FIND_FIELD_IN_TABLE +# +CREATE TABLE t1(a int); +ALTER TABLE t1 ADD COLUMN z int GENERATED ALWAYS AS +( 1 NOT IN (SELECT 1 FROM t1 WHERE c0006) ) virtual; +ERROR HY000: Function or expression 'select ...' cannot be used in the GENERATED ALWAYS AS clause of `z` +DROP TABLE t1; +# Bug#20566243: ERROR WHILE DOING CREATE TABLE T1 SELECT (QUERY ON GC COLUMNS) +CREATE TABLE t1(a int, b int as (a + 1), +c varchar(12) as ("aaaabb") stored, d blob as (c)); +INSERT INTO t1(a) VALUES(1),(3); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL, + `c` varchar(12) GENERATED ALWAYS AS ('aaaabb') STORED, + `d` blob GENERATED ALWAYS AS (`c`) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT * FROM t1 order by a; +a b c d +1 2 aaaabb aaaabb +3 4 aaaabb aaaabb +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL, + `c` varchar(12) GENERATED ALWAYS AS ('aaaabb') STORED, + `d` blob GENERATED ALWAYS AS (`c`) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 AS SELECT * FROM t1; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` varchar(12) DEFAULT NULL, + `d` blob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT * FROM t3 order by a; +a b c d +1 2 aaaabb aaaabb +3 4 aaaabb aaaabb +CREATE TABLE t4 AS SELECT b,c,d FROM t1; +SHOW CREATE TABLE t4; +Table Create Table +t4 CREATE TABLE `t4` ( + `b` int(11) DEFAULT NULL, + `c` varchar(12) DEFAULT NULL, + `d` blob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT * FROM t4 order by b; +b c d +2 aaaabb aaaabb +4 aaaabb aaaabb +DROP TABLE t1,t2,t3,t4; +# Bug#21025003:WL8149:ASSERTION `CTX->NUM_TO_DROP_FK +# == HA_ALTER_INFO->ALTER_INFO-> FAILED +# +CREATE TABLE t1 ( +col1 int(11) DEFAULT NULL, +col2 int(11) DEFAULT NULL, +col3 int(11) DEFAULT NULL, +col4 int(11) DEFAULT NULL, +col5 int(11) GENERATED ALWAYS AS (col4 / col2) VIRTUAL, +col6 text +); +INSERT INTO t1(col1,col2,col3,col4,col6) VALUES(NULL,1,4,0,REPEAT(2,1000)); +ALTER TABLE t1 DROP PRIMARY KEY , ADD KEY idx ( col5, col2 ); +ERROR 42000: Can't DROP INDEX `PRIMARY`; check that it exists +DROP TABLE t1; +# Bug#20949226:i CAN ASSIGN NON-DEFAULT() VALUE TO GENERATED COLUMN +# +CREATE TABLE t1 (c1 INT, c2 INT AS (c1 * 2)) SELECT 1 AS c1, 5 AS c2; +Warnings: +Warning 1906 The value specified for generated column 'c2' in table 't1' ignored +CREATE TABLE t2 (a int); +INSERT INTO t2 values(1); +DROP TABLE t1; +CREATE TABLE t1 (c1 INT, c2 INT AS (c1 * 2)) SELECT 1 AS c1, a AS c2 from t2; +Warnings: +Warning 1906 The value specified for generated column 'c2' in table 't1' ignored +DROP TABLE t1; +CREATE TABLE t1 (c1 INT, c2 INT AS (c1 * 2)) SELECT 1 AS c1, 5; +SELECT * FROM t1; +c2 c1 5 +2 1 5 +DROP TABLE t1, t2; +# Bug#21074624:i WL8149:SIG 11 INNOBASE_GET_COMPUTED_VALUE | +# INNOBASE/HANDLER/HA_INNODB.CC:19082 +CREATE TABLE t1 ( +col1 int(11) NOT NULL, +col2 int(11) DEFAULT NULL, +col3 int(11) NOT NULL, +col4 int(11) DEFAULT NULL, +col5 int(11) GENERATED ALWAYS AS (col2 % col4) VIRTUAL, +col6 int(11) GENERATED ALWAYS AS (col3 + col3) VIRTUAL, +col7 int(11) GENERATED ALWAYS AS (col5 / col5) VIRTUAL, +col8 int(11) GENERATED ALWAYS AS (col6 / col5) VIRTUAL, +col9 text, +extra int(11) DEFAULT NULL, +KEY idx (col5) +); +INSERT INTO t1(col1,col2,col3,col4,col9,extra) +VALUES(0,6,3,4,REPEAT(4,1000),0); +ALTER TABLE t1 DROP COLUMN col1; +DROP TABLE t1; +# Bug#21390605:VALGRIND ERROR ON DELETE FROM TABLE CONTAINING +# AN INDEXED VIRTUAL COLUMN +CREATE TABLE t1 ( +a INTEGER, +b INTEGER GENERATED ALWAYS AS (a) VIRTUAL, +c INTEGER GENERATED ALWAYS AS (b) VIRTUAL, +INDEX idx (b,c) +); +INSERT INTO t1 (a) VALUES (42); +DELETE FROM t1 WHERE c = 42; +DROP TABLE t1; +# Bug#20757211: GENERATED COLUMNS: ALTER TABLE CRASHES +# IN FIND_FIELD_IN_TABLE +# +CREATE TABLE t1(a int); +ALTER TABLE t1 ADD COLUMN z int GENERATED ALWAYS AS +( 1 NOT IN (SELECT 1 FROM t1 WHERE c0006) ) virtual; +ERROR HY000: Function or expression 'select ...' cannot be used in the GENERATED ALWAYS AS clause of `z` +CREATE TABLE t2(a int, b int as (1 NOT IN (SELECT 1 FROM t1 WHERE not_exist_col))); +ERROR HY000: Function or expression 'select ...' cannot be used in the GENERATED ALWAYS AS clause of `b` +CREATE TABLE t2(a int, b int as (1 NOT IN (SELECT 1 FROM dual))); +ERROR HY000: Function or expression 'select ...' cannot be used in the GENERATED ALWAYS AS clause of `b` +DROP TABLE t1; +# Bug#21142905: PARTITIONED GENERATED COLS - +# !TABLE || (!TABLE->WRITE_SET || BITMAP_IS_SET +# +CREATE TABLE t1 ( +a int, +b int generated always as (a) virtual, +c int generated always as (b+a) virtual, +d int generated always as (b+a) virtual +) PARTITION BY LINEAR HASH (b); +INSERT INTO t1(a) VALUES(0); +DELETE FROM t1 WHERE c=1; +DROP TABLE t1; +CREATE TABLE t1 (c CHAR(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ("foo bar")); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'GENERATED ALWAYS AS ("foo bar"))' at line 1 +CREATE TABLE t1 (i INT); +ALTER TABLE t1 ADD COLUMN c CHAR(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ("foo bar"); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'GENERATED ALWAYS AS ("foo bar")' at line 1 +DROP TABLE t1; +CREATE TABLE t1 (i INT COLLATE utf8_bin, c INT COLLATE utf8_bin GENERATED ALWAYS AS (10)); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'GENERATED ALWAYS AS (10))' at line 1 +# Check for a charset mismatch processing: +# Bug #21469535: VALGRIND ERROR (CONDITIONAL JUMP) WHEN INSERT +# ROWS INTO A PARTITIONED TABLE +# +CREATE TABLE t1 ( +id INT NOT NULL, +store_id INT NOT NULL, +x INT GENERATED ALWAYS AS (id + store_id) +) +PARTITION BY RANGE (store_id) ( +PARTITION p0 VALUES LESS THAN (6), +PARTITION p1 VALUES LESS THAN (11), +PARTITION p2 VALUES LESS THAN (16), +PARTITION p3 VALUES LESS THAN (21) +); +INSERT INTO t1 VALUES(1, 2, default); +DROP TABLE t1; +# Bug#21465626:ASSERT/CRASH ON DROPPING/ADDING VIRTUAL COLUMN +CREATE TABLE t (a int(11), b int(11), +c int(11) GENERATED ALWAYS AS (a+b) VIRTUAL, +d int(11) GENERATED ALWAYS AS (a+b) VIRTUAL); +INSERT INTO t(a,b) VALUES(1,2); +# Mixed drop/add/rename virtual with non-virtual columns, +# ALGORITHM=INPLACE is not supported for InnoDB +ALTER TABLE t DROP d, ADD e varchar(10); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t ADD d int, ADD f char(10) AS ('aaa'); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t CHANGE d dd int, CHANGE f ff varchar(10) AS ('bbb'); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +# Only drop/add/change virtual, inplace is supported for Innodb +ALTER TABLE t DROP c, DROP ff; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t ADD c int(11) as (a+b), ADD f varchar(10) as ('aaa'); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t CHANGE c c int(11) as (a), CHANGE f f varchar(10) as('bbb'); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Change order should be ALGORITHM=INPLACE on Innodb +ALTER TABLE t CHANGE c c int(11) as (a) after f; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t CHANGE b b int(11) after c; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +# TODO: Changing virtual column type should be ALGORITHM=INPLACE on InnoDB, current it goes only with COPY method +ALTER TABLE t CHANGE c c varchar(10) as ('a'); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +# Changing stored column type is ALGORITHM=COPY +ALTER TABLE t CHANGE dd d varchar(10); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t ADD INDEX idx(c), ADD INDEX idx1(d); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t DROP INDEX idx, DROP INDEX idx1; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +DROP TABLE t; +# Bug#21854004: GCOLS:INNODB: FAILING ASSERTION: I < TABLE->N_DEF +CREATE TABLE t1( +col1 INTEGER PRIMARY KEY, +col2 INTEGER, +col3 INTEGER, +col4 INTEGER, +vgc1 INTEGER AS (col2 + col3) VIRTUAL, +sgc1 INTEGER AS (col2 - col3) STORED +); +INSERT INTO t1(col1, col2, col3) VALUES +(1, 10, 100), (2, 20, 200); +SELECT * FROM t1 order by col1; +col1 col2 col3 col4 vgc1 sgc1 +1 10 100 NULL 110 -90 +2 20 200 NULL 220 -180 +ALTER TABLE t1 MODIFY COLUMN vgc1 INTEGER AS (col2 * col3) VIRTUAL; +SELECT * FROM t1 order by col1; +col1 col2 col3 col4 vgc1 sgc1 +1 10 100 NULL 1000 -90 +2 20 200 NULL 4000 -180 +ALTER TABLE t1 MODIFY COLUMN sgc1 INTEGER AS (col2 / col3) STORED; +SELECT * FROM t1 order by col1; +col1 col2 col3 col4 vgc1 sgc1 +1 10 100 NULL 1000 0 +2 20 200 NULL 4000 0 +ALTER TABLE t1 MODIFY COLUMN vgc1 INTEGER AS (col2 + col3) VIRTUAL; +ALTER TABLE t1 MODIFY COLUMN sgc1 INTEGER AS (col2 - col3) STORED; +ALTER TABLE t1 ADD INDEX vgc1 (vgc1); +ALTER TABLE t1 ADD INDEX sgc1 (sgc1); +ALTER TABLE t1 MODIFY COLUMN vgc1 INTEGER AS (col2 * col3) VIRTUAL; +SELECT * FROM t1 order by col1; +col1 col2 col3 col4 vgc1 sgc1 +1 10 100 NULL 1000 -90 +2 20 200 NULL 4000 -180 +SELECT vgc1 FROM t1 order by vgc1; +vgc1 +1000 +4000 +ALTER TABLE t1 MODIFY COLUMN sgc1 INTEGER AS (col2 / col3) STORED; +SELECT * FROM t1 order by col1; +col1 col2 col3 col4 vgc1 sgc1 +1 10 100 NULL 1000 0 +2 20 200 NULL 4000 0 +SELECT sgc1 FROM t1 order by sgc1; +sgc1 +0 +0 +ALTER TABLE t1 DROP INDEX vgc1; +ALTER TABLE t1 DROP INDEX sgc1; +ALTER TABLE t1 MODIFY COLUMN vgc1 INTEGER AS (col2 + col3) VIRTUAL; +ALTER TABLE t1 ADD UNIQUE INDEX vgc1 (vgc1); +ALTER TABLE t1 MODIFY COLUMN sgc1 INTEGER AS (col2 - col3) STORED; +ALTER TABLE t1 ADD UNIQUE INDEX sgc1 (sgc1); +ALTER TABLE t1 MODIFY COLUMN vgc1 INTEGER AS (col2 / col3) VIRTUAL; +ERROR 23000: Duplicate entry '0' for key 'vgc1' +ALTER TABLE t1 MODIFY COLUMN sgc1 INTEGER AS (col2 / col3) STORED; +ERROR 23000: Duplicate entry '0' for key 'sgc1' +ALTER TABLE t1 MODIFY COLUMN vgc1 INTEGER AS (col2 * col3) VIRTUAL; +SELECT * FROM t1 order by col1; +col1 col2 col3 col4 vgc1 sgc1 +1 10 100 NULL 1000 -90 +2 20 200 NULL 4000 -180 +SELECT vgc1 FROM t1 order by col1; +vgc1 +1000 +4000 +ALTER TABLE t1 MODIFY COLUMN sgc1 INTEGER AS (col2 * col3) STORED; +SELECT * FROM t1 order by col1; +col1 col2 col3 col4 vgc1 sgc1 +1 10 100 NULL 1000 1000 +2 20 200 NULL 4000 4000 +SELECT sgc1 FROM t1 order by sgc1; +sgc1 +1000 +4000 +ALTER TABLE t1 MODIFY COLUMN vgc1 INTEGER AS (col2 * col3) STORED; +ERROR HY000: This is not yet supported for generated columns +ALTER TABLE t1 MODIFY COLUMN sgc1 INTEGER AS (col2 / col3) VIRTUAL; +ERROR HY000: This is not yet supported for generated columns +ALTER TABLE t1 MODIFY COLUMN col4 INTEGER AS (col1 + col2 + col3) STORED; +SELECT * FROM t1 order by col1; +col1 col2 col3 col4 vgc1 sgc1 +1 10 100 111 1000 1000 +2 20 200 222 4000 4000 +ALTER TABLE t1 MODIFY COLUMN col4 INTEGER; +SELECT * FROM t1 order by col1; +col1 col2 col3 col4 vgc1 sgc1 +1 10 100 111 1000 1000 +2 20 200 222 4000 4000 +DROP TABLE t1; +# +# bug#22018979: RECORD NOT FOUND ON UPDATE, +# VIRTUAL COLUMN, ASSERTION 0 +SET @sql_mode_save= @@sql_mode; +SET sql_mode= 'ANSI'; +CREATE TABLE t1 ( +a INT, +b VARCHAR(10), +c CHAR(3) GENERATED ALWAYS AS (substr(b,1,3)) VIRTUAL, +PRIMARY KEY (a), +KEY c(c) +); +INSERT INTO t1(a, b) values(1, 'bbbb'), (2, 'cc'); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" int(11) NOT NULL, + "b" varchar(10) DEFAULT NULL, + "c" char(3) GENERATED ALWAYS AS (substr("b",1,3)) VIRTUAL, + PRIMARY KEY ("a"), + KEY "c" ("c") +) +SELECT * FROM t1 order by a; +a b c +1 bbbb bbb +2 cc cc +SET sql_mode= ''; +FLUSH TABLE t1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(10) DEFAULT NULL, + `c` char(3) GENERATED ALWAYS AS (substr(`b`,1,3)) VIRTUAL, + PRIMARY KEY (`a`), + KEY `c` (`c`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT * FROM t1 order by a; +a b c +1 bbbb bbb +2 cc cc +DELETE FROM t1 where a= 2; +SET sql_mode= @sql_mode_save; +DROP TABLE t1; +# +# Bug#22680839: DEFAULT IS NOT DETERMINISTIC AND SHOULD NOT BE +# ALLOWED IN GENERATED COLUMNS +# +CREATE TABLE tzz(a INT DEFAULT 5, +gc1 INT AS (a+DEFAULT(a)) VIRTUAL, +gc2 INT AS (a+DEFAULT(a)) STORED, +KEY k1(gc1)); +INSERT INTO tzz(A) VALUES (1); +SELECT * FROM tzz; +a gc1 gc2 +1 6 6 +SELECT gc1 FROM tzz; +gc1 +6 +ALTER TABLE tzz MODIFY COLUMN a INT DEFAULT 6; +SELECT * FROM tzz; +a gc1 gc2 +1 7 7 +SELECT gc1 FROM tzz; +gc1 +7 +DROP TABLE tzz; +# Test 1: ALTER DEFAULT +# +CREATE TABLE t1(a INT PRIMARY KEY DEFAULT 5, +b INT AS (1 + DEFAULT(a)) STORED, +c INT AS (1 + DEFAULT(a)) VIRTUAL); +INSERT INTO t1 VALUES (); +ALTER TABLE t1 ALTER COLUMN a SET DEFAULT 7; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 MODIFY COLUMN a INT DEFAULT 8; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 CHANGE COLUMN a a DOUBLE DEFAULT 5; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +DROP TABLE t1; +# Test 2: ALTER DEFAULT + ADD GCOL +# +CREATE TABLE t1(a INT PRIMARY KEY DEFAULT 5); +INSERT INTO t1 VALUES(); +ALTER TABLE t1 ALTER COLUMN a SET DEFAULT 7, +ADD COLUMN b1 INT AS (1 + DEFAULT(a)) STORED; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ALTER COLUMN a SET DEFAULT 7, +ADD COLUMN c1 INT AS (1 + DEFAULT(a)) VIRTUAL; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ALTER COLUMN a SET DEFAULT 7, +ADD COLUMN b INT AS (1 + DEFAULT(a)) STORED, +ADD COLUMN c INT AS (1 + DEFAULT(a)) VIRTUAL; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +DROP TABLE t1; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_csv.result b/mysql-test/suite/gcol/r/gcol_csv.result new file mode 100644 index 00000000000..20708586d51 --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_csv.result @@ -0,0 +1,14 @@ +SET @@session.storage_engine = 'CSV'; +create table t1 (a int, b virtual int as (a+1)); +ERROR HY000: 'Specified storage engine' is not yet supported for generated columns. +create table t1 (a int not null); +alter table t1 add column b virtual int as (a+1); +ERROR HY000: 'Specified storage engine' is not yet supported for generated columns. +drop table t1; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_falcon.result b/mysql-test/suite/gcol/r/gcol_falcon.result new file mode 100644 index 00000000000..2eb558e6b69 --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_falcon.result @@ -0,0 +1,14 @@ +SET @@session.storage_engine = 'falcon'; +create table t1 (a int, b virtual int as (a+1)); +ERROR HY000: 'Specified storage engine' is not yet supported for generated columns. +create table t1 (a int); +alter table t1 add column b virtual int as (a+1); +ERROR HY000: 'Specified storage engine' is not yet supported for generated columns. +drop table t1; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_handler_innodb.result b/mysql-test/suite/gcol/r/gcol_handler_innodb.result new file mode 100644 index 00000000000..6de4c2ae61d --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_handler_innodb.result @@ -0,0 +1,83 @@ +SET @@session.default_storage_engine = 'InnoDB'; +create table t1 (a int, +b int generated always as (-a) virtual, +c int generated always as (-a) stored, +d char(1), +index (a), +index (c)); +insert into t1 (a,d) values (4,'a'), (2,'b'), (1,'c'), (3,'d'); +select * from t1; +a b c d +4 -4 -4 a +2 -2 -2 b +1 -1 -1 c +3 -3 -3 d +# HANDLER tbl_name OPEN +handler t1 open; +# HANDLER tbl_name READ non-gcol_index_name > (value1,value2,...) +handler t1 read a > (2); +a b c d +3 -3 -3 d +# HANDLER tbl_name READ non-gcol_index_name > (value1,value2,...) WHERE non-gcol_field=expr +handler t1 read a > (2) where d='c'; +a b c d +# HANDLER tbl_name READ gcol_index_name = (value1,value2,...) +handler t1 read c = (-2); +a b c d +2 -2 -2 b +# HANDLER tbl_name READ gcol_index_name = (value1,value2,...) WHERE non-gcol_field=expr +handler t1 read c = (-2) where d='c'; +a b c d +# HANDLER tbl_name READ non-gcol_index_name > (value1,value2,...) WHERE gcol_field=expr +handler t1 read a > (2) where b=-3 && c=-3; +a b c d +3 -3 -3 d +# HANDLER tbl_name READ gcol_index_name <= (value1,value2,...) +handler t1 read c <= (-2); +a b c d +2 -2 -2 b +# HANDLER tbl_name READ gcol_index_name > (value1,value2,...) WHERE gcol_field=expr +handler t1 read c <= (-2) where b=-3; +a b c d +3 -3 -3 d +# HANDLER tbl_name READ gcol_index_name FIRST +handler t1 read c first; +a b c d +4 -4 -4 a +# HANDLER tbl_name READ gcol_index_name NEXT +handler t1 read c next; +a b c d +3 -3 -3 d +# HANDLER tbl_name READ gcol_index_name PREV +handler t1 read c prev; +a b c d +4 -4 -4 a +# HANDLER tbl_name READ gcol_index_name LAST +handler t1 read c last; +a b c d +1 -1 -1 c +# HANDLER tbl_name READ FIRST where non-gcol=expr +handler t1 read FIRST where a >= 2; +a b c d +4 -4 -4 a +# HANDLER tbl_name READ FIRST where gcol=expr +handler t1 read FIRST where b >= -2; +a b c d +2 -2 -2 b +# HANDLER tbl_name READ NEXT where non-gcol=expr +handler t1 read NEXT where d='c'; +a b c d +1 -1 -1 c +# HANDLER tbl_name READ NEXT where gcol=expr +handler t1 read NEXT where b<=-4; +a b c d +# HANDLER tbl_name CLOSE +handler t1 close; +drop table t1; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_handler_myisam.result b/mysql-test/suite/gcol/r/gcol_handler_myisam.result new file mode 100644 index 00000000000..3b03fd37cc0 --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_handler_myisam.result @@ -0,0 +1,83 @@ +SET @@session.default_storage_engine = 'MyISAM'; +create table t1 (a int, +b int generated always as (-a) virtual, +c int generated always as (-a) stored, +d char(1), +index (a), +index (c)); +insert into t1 (a,d) values (4,'a'), (2,'b'), (1,'c'), (3,'d'); +select * from t1; +a b c d +4 -4 -4 a +2 -2 -2 b +1 -1 -1 c +3 -3 -3 d +# HANDLER tbl_name OPEN +handler t1 open; +# HANDLER tbl_name READ non-gcol_index_name > (value1,value2,...) +handler t1 read a > (2); +a b c d +3 -3 -3 d +# HANDLER tbl_name READ non-gcol_index_name > (value1,value2,...) WHERE non-gcol_field=expr +handler t1 read a > (2) where d='c'; +a b c d +# HANDLER tbl_name READ gcol_index_name = (value1,value2,...) +handler t1 read c = (-2); +a b c d +2 -2 -2 b +# HANDLER tbl_name READ gcol_index_name = (value1,value2,...) WHERE non-gcol_field=expr +handler t1 read c = (-2) where d='c'; +a b c d +# HANDLER tbl_name READ non-gcol_index_name > (value1,value2,...) WHERE gcol_field=expr +handler t1 read a > (2) where b=-3 && c=-3; +a b c d +3 -3 -3 d +# HANDLER tbl_name READ gcol_index_name <= (value1,value2,...) +handler t1 read c <= (-2); +a b c d +2 -2 -2 b +# HANDLER tbl_name READ gcol_index_name > (value1,value2,...) WHERE gcol_field=expr +handler t1 read c <= (-2) where b=-3; +a b c d +3 -3 -3 d +# HANDLER tbl_name READ gcol_index_name FIRST +handler t1 read c first; +a b c d +4 -4 -4 a +# HANDLER tbl_name READ gcol_index_name NEXT +handler t1 read c next; +a b c d +3 -3 -3 d +# HANDLER tbl_name READ gcol_index_name PREV +handler t1 read c prev; +a b c d +4 -4 -4 a +# HANDLER tbl_name READ gcol_index_name LAST +handler t1 read c last; +a b c d +1 -1 -1 c +# HANDLER tbl_name READ FIRST where non-gcol=expr +handler t1 read FIRST where a >= 2; +a b c d +4 -4 -4 a +# HANDLER tbl_name READ FIRST where gcol=expr +handler t1 read FIRST where b >= -2; +a b c d +2 -2 -2 b +# HANDLER tbl_name READ NEXT where non-gcol=expr +handler t1 read NEXT where d='c'; +a b c d +1 -1 -1 c +# HANDLER tbl_name READ NEXT where gcol=expr +handler t1 read NEXT where b<=-4; +a b c d +# HANDLER tbl_name CLOSE +handler t1 close; +drop table t1; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_ins_upd_innodb.result b/mysql-test/suite/gcol/r/gcol_ins_upd_innodb.result new file mode 100644 index 00000000000..192016ba8df --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_ins_upd_innodb.result @@ -0,0 +1,602 @@ +SET @@session.default_storage_engine = 'InnoDB'; +create table t1 (a int, +b int generated always as (-a) virtual, +c int generated always as (-a) stored); +set sql_warnings = 1; +# +# *** INSERT *** +# +# INSERT INTO tbl_name VALUES... DEFAULT is specified against gcols +insert into t1 values (1,default,default); +select * from t1; +a b c +1 -1 -1 +delete from t1; +select * from t1; +a b c +# INSERT INTO tbl_name VALUES... NULL is specified against gcols +insert into t1 values (1,null,null); +select * from t1; +a b c +1 -1 -1 +delete from t1; +select * from t1; +a b c +# INSERT INTO tbl_name VALUES... a non-NULL value is specified against gcols +insert into t1 values (1,2,3); +Warnings: +Warning 1906 The value specified for generated column 'b' in table 't1' ignored +Warning 1906 The value specified for generated column 'c' in table 't1' ignored +select * from t1; +a b c +1 -1 -1 +delete from t1; +select * from t1; +a b c +# INSERT INTO tbl_name () VALUES... +insert into t1 (a) values (1), (2); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +delete from t1; +select * from t1; +a b c +# INSERT INTO tbl_name () VALUES... DEFAULT is specified +# against gcols +insert into t1 (a,b) values (1,default), (2,default); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +delete from t1; +select * from t1; +a b c +# INSERT INTO tbl_name () VALUES... NULL is specified against gcols +insert into t1 (a,b) values (1,null), (2,null); +select * from t1; +a b c +1 -1 -1 +2 -2 -2 +delete from t1; +select * from t1; +a b c +# INSERT INTO tbl_name () VALUES... a non-NULL value is specified +# against gcols +insert into t1 (a,b) values (1,3), (2,4); +Warnings: +Warning 1906 The value specified for generated column 'b' in table 't1' ignored +Warning 1906 The value specified for generated column 'b' in table 't1' ignored +select * from t1; +a b c +1 -1 -1 +2 -2 -2 +delete from t1; +select * from t1; +a b c +drop table t1; +# Table with UNIQUE non-gcol field. INSERT INTO tbl_name VALUES... ON DUPLICATE +# KEY UPDATE =expr, =expr +create table t1 (a int unique, +b int generated always as (-a) virtual, +c int generated always as (-a) stored); +insert into t1 values (1,default,default); +insert into t1 values (1,default,default) +on duplicate key update a=2, b=default; +select a,b,c from t1; +a b c +2 -2 -2 +delete from t1 where b in (1,2); +select * from t1; +a b c +2 -2 -2 +drop table t1; +# Table with UNIQUE gcol field. INSERT INTO tbl_name VALUES... ON DUPLICATE +# KEY UPDATE =expr, =expr +create table t1 (a int, +b int generated always as (-a) virtual, +c int generated always as (-a) stored unique); +insert into t1 values (1,default,default); +insert into t1 values (1,default,default) +on duplicate key update a=2, b=default; +select a,b,c from t1; +a b c +2 -2 -2 +# CREATE new_table ... LIKE old_table +# INSERT INTO new_table SELECT * from old_table +create table t2 like t1; +insert into t2(a) select a from t1; +select * from t2; +a b c +2 -2 -2 +drop table t2; +# CREATE new_table ... LIKE old_table INSERT INTO new_table (, ) +# SELECT , from old_table +insert into t1 values (1,default,default); +select * from t1; +a b c +2 -2 -2 +1 -1 -1 +create table t2 like t1; +insert into t2 (a) select a from t1; +select * from t2 order by a; +a b c +1 -1 -1 +2 -2 -2 +drop table t2; +drop table t1; +# +# *** UPDATE *** +# +# UPDATE tbl_name SET non-gcol=expr WHERE non-gcol=expr +create table t1 (a int, +b int generated always as (-a) virtual, +c int generated always as (-a) stored); +insert into t1 (a) values (1), (2); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +update t1 set a=3 where a=2; +select * from t1 order by a; +a b c +1 -1 -1 +3 -3 -3 +delete from t1; +select * from t1; +a b c +# UPDATE tbl_name SET gcol=expr WHERE non-gcol=expr +insert into t1 (a) values (1), (2); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +update t1 set c=3 where a=2; +Warnings: +Warning 1906 The value specified for generated column 'c' in table 't1' ignored +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +delete from t1; +select * from t1; +a b c +# UPDATE tbl_name SET non-gcol=expr WHERE gcol=expr +insert into t1 (a) values (1), (2); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +update t1 set a=3 where b=-2; +select * from t1 order by a; +a b c +1 -1 -1 +3 -3 -3 +delete from t1; +select * from t1; +a b c +# UPDATE tbl_name SET gcol=expr WHERE gcol=expr +insert into t1 (a) values (1), (2); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +update t1 set c=3 where b=-2; +Warnings: +Warning 1906 The value specified for generated column 'c' in table 't1' ignored +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +delete from t1; +select * from t1; +a b c +drop table t1; +# INDEX created on gcol +# UPDATE tbl_name SET non-gcol=expr WHERE gcol=const +create table t1 (a int, +b int generated always as (-a) virtual, +c int generated always as (-a) stored unique); +insert into t1 (a) values (1), (2); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +update t1 set a=3 where c=-2; +select * from t1; +a b c +1 -1 -1 +3 -3 -3 +delete from t1; +select * from t1; +a b c +# INDEX created on gcol +# UPDATE tbl_name SET non-gcol=expr WHERE gcol=between const1 and const2 +insert into t1 (a) values (1), (2); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +update t1 set a=3 where c between -3 and -2; +select * from t1 order by a; +a b c +1 -1 -1 +3 -3 -3 +delete from t1; +select * from t1; +a b c +# No INDEX created on gcol +# UPDATE tbl_name SET non-gcol=expr WHERE gcol=between const1 and const2 +insert into t1 (a) values (1), (2); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +update t1 set a=3 where b between -3 and -2; +select * from t1 order by a; +a b c +1 -1 -1 +3 -3 -3 +delete from t1; +select * from t1; +a b c +# INDEX created on gcol +# UPDATE tbl_name SET non-gcol=expr +# WHERE gcol=between const1 and const2 ORDER BY gcol +insert into t1 (a) values (1), (2), (3), (4), (5); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +3 -3 -3 +4 -4 -4 +5 -5 -5 +update t1 set a=6 where c between -1 and 0 +order by c; +select * from t1 order by a; +a b c +2 -2 -2 +3 -3 -3 +4 -4 -4 +5 -5 -5 +6 -6 -6 +delete from t1 where c between -6 and 0; +select * from t1; +a b c +# INDEX created on gcol +# UPDATE tbl_name SET non-gcol=expr +# WHERE gcol=between const1 and const2 ORDER BY gcol LIMIT 2 +insert into t1 (a) values (1), (2), (3), (4), (5); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +3 -3 -3 +4 -4 -4 +5 -5 -5 +update t1 set a=6 where c between -1 and 0 +order by c limit 2; +select * from t1 order by a; +a b c +2 -2 -2 +3 -3 -3 +4 -4 -4 +5 -5 -5 +6 -6 -6 +delete from t1 where c between -2 and 0 order by c; +select * from t1 order by a; +a b c +3 -3 -3 +4 -4 -4 +5 -5 -5 +6 -6 -6 +delete from t1; +# INDEX created on gcol +# UPDATE tbl_name SET non-gcol=expr +# WHERE indexed gcol=between const1 and const2 and non-indexed gcol=const3 +insert into t1 (a) values (1), (2), (3), (4), (5); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +3 -3 -3 +4 -4 -4 +5 -5 -5 +update t1 set a=6 where (c between -2 and 0) and (b=-1); +select * from t1 order by a; +a b c +2 -2 -2 +3 -3 -3 +4 -4 -4 +5 -5 -5 +6 -6 -6 +delete from t1; +# INDEX created on gcol +# UPDATE tbl_name SET non-gcol=expr +# WHERE indexed gcol=between const1 and const2 and non-indexed gcol=const3 +# ORDER BY indexed gcol +insert into t1 (a) values (1), (2), (3), (4), (5); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +3 -3 -3 +4 -4 -4 +5 -5 -5 +update t1 set a=6 where (c between -2 and 0) and (b=-1) order by c; +select * from t1 order by a; +a b c +2 -2 -2 +3 -3 -3 +4 -4 -4 +5 -5 -5 +6 -6 -6 +delete from t1; +drop table t1; +# +# Verify ON UPDATE/DELETE actions of FOREIGN KEYs +create table t2 (a int primary key, name varchar(10)); +create table t1 (a int primary key, b int generated always as (a % 10) stored); +insert into t2 values (1, 'value1'), (2,'value2'), (3,'value3'); +insert into t1 (a) values (1),(2),(3); +select * from t1 order by a; +a b +1 1 +2 2 +3 3 +select * from t2 order by a; +a name +1 value1 +2 value2 +3 value3 +select t1.a, t1.b, t2.name from t1,t2 where t1.b=t2.a order by t1.a; +a b name +1 1 value1 +2 2 value2 +3 3 value3 +# - ON UPDATE RESTRICT +alter table t1 add foreign key (b) references t2(a) on update restrict; +insert into t1 (a) values (4); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t2` (`a`)) +update t2 set a=4 where a=3; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t2` (`a`)) +select t1.a, t1.b, t2.name from t1,t2 where t1.b=t2.a; +a b name +1 1 value1 +2 2 value2 +3 3 value3 +alter table t1 drop foreign key t1_ibfk_1; +# - ON DELETE RESTRICT +alter table t1 add foreign key (b) references t2(a) on delete restrict; +delete from t2 where a=3; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t2` (`a`)) +select t1.a, t1.b, t2.name from t1,t2 where t1.b=t2.a; +a b name +1 1 value1 +2 2 value2 +3 3 value3 +select t1.a, t1.b, t2.name from t1 left outer join t2 on (t1.b=t2.a); +a b name +1 1 value1 +2 2 value2 +3 3 value3 +alter table t1 drop foreign key t1_ibfk_1; +# - ON DELETE CASCADE +alter table t1 add foreign key (b) references t2(a) on delete cascade; +delete from t2 where a=3; +select t1.a, t1.b, t2.name from t1,t2 where t1.b=t2.a; +a b name +1 1 value1 +2 2 value2 +select t1.a, t1.b, t2.name from t1 left outer join t2 on (t1.b=t2.a); +a b name +1 1 value1 +2 2 value2 +alter table t1 drop foreign key t1_ibfk_1; +drop table t1; +drop table t2; +# +# *** REPLACE *** +# +# UNIQUE INDEX on gcol +# REPLACE tbl_name (non-gcols) VALUES (non-gcols); +create table t1 (a int, +b int generated always as (-a) virtual, +c int generated always as (-a) stored unique, +d varchar(16)); +insert into t1 (a,d) values (1,'a'), (2,'b'); +select * from t1 order by a; +a b c d +1 -1 -1 a +2 -2 -2 b +replace t1 (a,d) values (1,'c'); +select * from t1 order by a; +a b c d +1 -1 -1 c +2 -2 -2 b +delete from t1; +select * from t1; +a b c d +set sql_warnings = 0; +drop table t1; +Bug#20170778: WL411:FAILING ASSERTION `!TABLE || (!TABLE->WRITE_SET || +BITMAP_IS_SET(TABLE->WR +# +CREATE TABLE t1 (col1 INT, col2 INT, col3 INT, col4 INT, col5 +INT GENERATED ALWAYS AS (col3 * col2) VIRTUAL, col6 INT GENERATED ALWAYS AS +(col4 * col1) STORED, col7 INT GENERATED ALWAYS AS (col6 + col6) VIRTUAL, +col8 INT GENERATED ALWAYS AS (col6 / col5) STORED, col9 TEXT); +SET @fill_amount = (@@innodb_page_size / 2 ) + 1; +INSERT INTO t1 (col1,col2,col3,col4,col5,col6,col7,col8,col9) VALUES /* 3 */ +(3, 3 / 3, 3 + 3, 3 / 3, DEFAULT, DEFAULT, DEFAULT, DEFAULT ,REPEAT(CAST(3 AS +CHAR(1)),@fill_amount)) , (3, 3 * 3, 3 + 3, 3 / 3, DEFAULT, DEFAULT, DEFAULT, +DEFAULT ,REPEAT(CAST(3 AS CHAR(1)),@fill_amount)); +UPDATE t1 SET col1 = 2; +UPDATE t1 SET col7 = DEFAULT; +UPDATE t1 SET col8 = DEFAULT; +DROP TABLE t1; +# Bug#21081742: ASSERTION !TABLE || (!TABLE->WRITE_SET || +# BITMAP_IS_SET(TABLE->WRITE_SET +# +CREATE TABLE b ( +pk INTEGER AUTO_INCREMENT, +col_varchar_nokey VARCHAR(1), +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)), +PRIMARY KEY (pk) +); +INSERT INTO b (col_varchar_nokey) VALUES ('v'),('v'); +CREATE TABLE d ( +pk INTEGER AUTO_INCREMENT, +col_varchar_nokey VARCHAR(1), +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)), +PRIMARY KEY (pk) +) ; +INSERT INTO d (col_varchar_nokey) VALUES ('q'),('g'),('e'),('l'),(NULL),('v'),('c'),('u'),('x'); +CREATE TABLE bb ( +pk INTEGER AUTO_INCREMENT, +col_varchar_nokey VARCHAR(1) /*! NULL */, +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)), +PRIMARY KEY (pk) +); +INSERT INTO bb (col_varchar_nokey) VALUES ('j'),('h'); +EXPLAIN UPDATE +d AS OUTR1, b AS OUTR2 +SET OUTR1.col_varchar_nokey = NULL +WHERE +( 't', 'b' ) IN +( +SELECT +INNR1.col_varchar_nokey AS x, +INNR1.col_varchar_key AS y +FROM bb AS INNR1 +WHERE OUTR1.pk = 1 +); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY OUTR1 const PRIMARY PRIMARY 4 const 1 +1 PRIMARY INNR1 ALL NULL NULL NULL NULL 2 Using where; FirstMatch(OUTR1) +1 PRIMARY OUTR2 index NULL PRIMARY 4 NULL 2 Using index +DROP TABLE IF EXISTS b,bb,d; +# +# Bug#21216067 ASSERTION FAILED ROW_UPD_SEC_INDEX_ENTRY (INNOBASE/ROW/ROW0UPD.CC:2103) +# +CREATE TABLE t ( +x INT, y INT, gc INT GENERATED ALWAYS AS (x+1) STORED +); +INSERT INTO t VALUES (); +UPDATE t t1, t t2 SET t2.y = 1, t1.x = 2; +SELECT * FROM t; +x y gc +2 1 3 +DROP TABLE t; +# stored +CREATE TABLE C ( +col_varchar_nokey VARCHAR(1), +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)) STORED +); +INSERT INTO C (col_varchar_nokey) VALUES ('c'); +EXPLAIN UPDATE C AS OUTR1, C AS OUTR2 +SET OUTR1.`col_varchar_nokey` = 'f', +OUTR2.`col_varchar_nokey` = "a"; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE OUTR1 ALL NULL NULL NULL NULL 1 +1 SIMPLE OUTR2 ALL NULL NULL NULL NULL 1 +UPDATE C AS OUTR1, C AS OUTR2 +SET OUTR1.`col_varchar_nokey` = 'f', +OUTR2.`col_varchar_nokey` = "a"; +SELECT * from C; +col_varchar_nokey col_varchar_key +a aa +DROP TABLE C; +# stored, indexed +CREATE TABLE C ( +col_varchar_nokey VARCHAR(1), +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)) STORED, +KEY (col_varchar_key, col_varchar_nokey) +); +INSERT INTO C (col_varchar_nokey) VALUES ('c'); +EXPLAIN UPDATE C AS OUTR1, C AS OUTR2 +SET OUTR1.`col_varchar_nokey` = 'f', +OUTR2.`col_varchar_nokey` = "a"; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE OUTR1 ALL NULL NULL NULL NULL 1 +1 SIMPLE OUTR2 ALL NULL NULL NULL NULL 1 +UPDATE C AS OUTR1, C AS OUTR2 +SET OUTR1.`col_varchar_nokey` = 'f', +OUTR2.`col_varchar_nokey` = "a"; +SELECT * from C; +col_varchar_nokey col_varchar_key +a aa +DROP TABLE C; +# virtual +CREATE TABLE C ( +col_varchar_nokey VARCHAR(1), +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)) VIRTUAL +); +INSERT INTO C (col_varchar_nokey) VALUES ('c'); +EXPLAIN UPDATE C AS OUTR1, C AS OUTR2 +SET OUTR1.`col_varchar_nokey` = 'f', +OUTR2.`col_varchar_nokey` = "a"; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE OUTR1 ALL NULL NULL NULL NULL 1 +1 SIMPLE OUTR2 ALL NULL NULL NULL NULL 1 +UPDATE C AS OUTR1, C AS OUTR2 +SET OUTR1.`col_varchar_nokey` = 'f', +OUTR2.`col_varchar_nokey` = "a"; +SELECT * from C; +col_varchar_nokey col_varchar_key +a aa +DROP TABLE C; +#Bug#21929967:GCOLS:GCOL VALUE CHANGES WHEN SESSION CHANGES SQL_MODE +CREATE TABLE t(c1 INT GENERATED ALWAYS AS (1) VIRTUAL, +c2 INT GENERATED ALWAYS AS(2) STORED); +INSERT INTO t VALUES(DEFAULT, DEFAULT); +SELECT * FROM t; +c1 c2 +1 2 +CREATE TABLE t1(c1 INT, c2 INT GENERATED ALWAYS AS(c1 + 1) STORED); +INSERT INTO t1(c2) VALUES(DEFAULT); +SELECT * FROM t1; +c1 c2 +NULL NULL +CREATE TABLE t2(c1 INT DEFAULT 1, c2 INT GENERATED ALWAYS AS(c1 + 1) STORED); +INSERT INTO t2(c2) VALUES(DEFAULT); +SELECT * FROM t2; +c1 c2 +1 2 +DROP TABLE t, t1, t2; +# Bug#22179637: INSERT INTO TABLE FROM SELECT ACCEPTS TO INSERT INTO +# GENERATED COLUMNS +CREATE TABLE t1 ( +i1 INTEGER, +i2 INTEGER GENERATED ALWAYS AS (i1 + i1) +); +INSERT INTO t1 (i1) SELECT 5; +INSERT INTO t1 (i1) SELECT 5 ON DUPLICATE KEY UPDATE i2= DEFAULT; +SELECT * FROM t1; +i1 i2 +5 10 +5 10 +CREATE TABLE t2 ( +i1 INTEGER, +i2 INTEGER GENERATED ALWAYS AS (i1 + i1) STORED +); +INSERT INTO t2 (i1) SELECT 5; +INSERT INTO t2 (i1) SELECT 5 ON DUPLICATE KEY UPDATE i2= DEFAULT; +SELECT * FROM t2; +i1 i2 +5 10 +5 10 +DROP TABLE t1,t2; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_ins_upd_myisam.result b/mysql-test/suite/gcol/r/gcol_ins_upd_myisam.result new file mode 100644 index 00000000000..b30eb709c47 --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_ins_upd_myisam.result @@ -0,0 +1,678 @@ +SET @@session.default_storage_engine = 'MyISAM'; +create table t1 (a int, +b int generated always as (-a) virtual, +c int generated always as (-a) stored); +set sql_warnings = 1; +# +# *** INSERT *** +# +# INSERT INTO tbl_name VALUES... DEFAULT is specified against gcols +insert into t1 values (1,default,default); +select * from t1; +a b c +1 -1 -1 +delete from t1; +select * from t1; +a b c +# INSERT INTO tbl_name VALUES... NULL is specified against gcols +insert into t1 values (1,null,null); +select * from t1; +a b c +1 -1 -1 +delete from t1; +select * from t1; +a b c +# INSERT INTO tbl_name VALUES... a non-NULL value is specified against gcols +insert into t1 values (1,2,3); +Warnings: +Warning 1906 The value specified for generated column 'b' in table 't1' ignored +Warning 1906 The value specified for generated column 'c' in table 't1' ignored +select * from t1; +a b c +1 -1 -1 +delete from t1; +select * from t1; +a b c +# INSERT INTO tbl_name () VALUES... +insert into t1 (a) values (1), (2); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +delete from t1; +select * from t1; +a b c +# INSERT INTO tbl_name () VALUES... DEFAULT is specified +# against gcols +insert into t1 (a,b) values (1,default), (2,default); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +delete from t1; +select * from t1; +a b c +# INSERT INTO tbl_name () VALUES... NULL is specified against gcols +insert into t1 (a,b) values (1,null), (2,null); +select * from t1; +a b c +1 -1 -1 +2 -2 -2 +delete from t1; +select * from t1; +a b c +# INSERT INTO tbl_name () VALUES... a non-NULL value is specified +# against gcols +insert into t1 (a,b) values (1,3), (2,4); +Warnings: +Warning 1906 The value specified for generated column 'b' in table 't1' ignored +Warning 1906 The value specified for generated column 'b' in table 't1' ignored +select * from t1; +a b c +1 -1 -1 +2 -2 -2 +delete from t1; +select * from t1; +a b c +drop table t1; +# Table with UNIQUE non-gcol field. INSERT INTO tbl_name VALUES... ON DUPLICATE +# KEY UPDATE =expr, =expr +create table t1 (a int unique, +b int generated always as (-a) virtual, +c int generated always as (-a) stored); +insert into t1 values (1,default,default); +insert into t1 values (1,default,default) +on duplicate key update a=2, b=default; +select a,b,c from t1; +a b c +2 -2 -2 +delete from t1 where b in (1,2); +select * from t1; +a b c +2 -2 -2 +drop table t1; +# Table with UNIQUE gcol field. INSERT INTO tbl_name VALUES... ON DUPLICATE +# KEY UPDATE =expr, =expr +create table t1 (a int, +b int generated always as (-a) virtual, +c int generated always as (-a) stored unique); +insert into t1 values (1,default,default); +insert into t1 values (1,default,default) +on duplicate key update a=2, b=default; +select a,b,c from t1; +a b c +2 -2 -2 +# CREATE new_table ... LIKE old_table +# INSERT INTO new_table SELECT * from old_table +create table t2 like t1; +insert into t2(a) select a from t1; +select * from t2; +a b c +2 -2 -2 +drop table t2; +# CREATE new_table ... LIKE old_table INSERT INTO new_table (, ) +# SELECT , from old_table +insert into t1 values (1,default,default); +select * from t1; +a b c +2 -2 -2 +1 -1 -1 +create table t2 like t1; +insert into t2 (a) select a from t1; +select * from t2 order by a; +a b c +1 -1 -1 +2 -2 -2 +drop table t2; +drop table t1; +# +# *** UPDATE *** +# +# UPDATE tbl_name SET non-gcol=expr WHERE non-gcol=expr +create table t1 (a int, +b int generated always as (-a) virtual, +c int generated always as (-a) stored); +insert into t1 (a) values (1), (2); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +update t1 set a=3 where a=2; +select * from t1 order by a; +a b c +1 -1 -1 +3 -3 -3 +delete from t1; +select * from t1; +a b c +# UPDATE tbl_name SET gcol=expr WHERE non-gcol=expr +insert into t1 (a) values (1), (2); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +update t1 set c=3 where a=2; +Warnings: +Warning 1906 The value specified for generated column 'c' in table 't1' ignored +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +delete from t1; +select * from t1; +a b c +# UPDATE tbl_name SET non-gcol=expr WHERE gcol=expr +insert into t1 (a) values (1), (2); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +update t1 set a=3 where b=-2; +select * from t1 order by a; +a b c +1 -1 -1 +3 -3 -3 +delete from t1; +select * from t1; +a b c +# UPDATE tbl_name SET gcol=expr WHERE gcol=expr +insert into t1 (a) values (1), (2); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +update t1 set c=3 where b=-2; +Warnings: +Warning 1906 The value specified for generated column 'c' in table 't1' ignored +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +delete from t1; +select * from t1; +a b c +drop table t1; +# INDEX created on gcol +# UPDATE tbl_name SET non-gcol=expr WHERE gcol=const +create table t1 (a int, +b int generated always as (-a) virtual, +c int generated always as (-a) stored unique); +insert into t1 (a) values (1), (2); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +update t1 set a=3 where c=-2; +select * from t1; +a b c +1 -1 -1 +3 -3 -3 +delete from t1; +select * from t1; +a b c +# INDEX created on gcol +# UPDATE tbl_name SET non-gcol=expr WHERE gcol=between const1 and const2 +insert into t1 (a) values (1), (2); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +update t1 set a=3 where c between -3 and -2; +select * from t1 order by a; +a b c +1 -1 -1 +3 -3 -3 +delete from t1; +select * from t1; +a b c +# No INDEX created on gcol +# UPDATE tbl_name SET non-gcol=expr WHERE gcol=between const1 and const2 +insert into t1 (a) values (1), (2); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +update t1 set a=3 where b between -3 and -2; +select * from t1 order by a; +a b c +1 -1 -1 +3 -3 -3 +delete from t1; +select * from t1; +a b c +# INDEX created on gcol +# UPDATE tbl_name SET non-gcol=expr +# WHERE gcol=between const1 and const2 ORDER BY gcol +insert into t1 (a) values (1), (2), (3), (4), (5); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +3 -3 -3 +4 -4 -4 +5 -5 -5 +update t1 set a=6 where c between -1 and 0 +order by c; +select * from t1 order by a; +a b c +2 -2 -2 +3 -3 -3 +4 -4 -4 +5 -5 -5 +6 -6 -6 +delete from t1 where c between -6 and 0; +select * from t1; +a b c +# INDEX created on gcol +# UPDATE tbl_name SET non-gcol=expr +# WHERE gcol=between const1 and const2 ORDER BY gcol LIMIT 2 +insert into t1 (a) values (1), (2), (3), (4), (5); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +3 -3 -3 +4 -4 -4 +5 -5 -5 +update t1 set a=6 where c between -1 and 0 +order by c limit 2; +select * from t1 order by a; +a b c +2 -2 -2 +3 -3 -3 +4 -4 -4 +5 -5 -5 +6 -6 -6 +delete from t1 where c between -2 and 0 order by c; +select * from t1 order by a; +a b c +3 -3 -3 +4 -4 -4 +5 -5 -5 +6 -6 -6 +delete from t1; +# INDEX created on gcol +# UPDATE tbl_name SET non-gcol=expr +# WHERE indexed gcol=between const1 and const2 and non-indexed gcol=const3 +insert into t1 (a) values (1), (2), (3), (4), (5); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +3 -3 -3 +4 -4 -4 +5 -5 -5 +update t1 set a=6 where (c between -2 and 0) and (b=-1); +select * from t1 order by a; +a b c +2 -2 -2 +3 -3 -3 +4 -4 -4 +5 -5 -5 +6 -6 -6 +delete from t1; +# INDEX created on gcol +# UPDATE tbl_name SET non-gcol=expr +# WHERE indexed gcol=between const1 and const2 and non-indexed gcol=const3 +# ORDER BY indexed gcol +insert into t1 (a) values (1), (2), (3), (4), (5); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +3 -3 -3 +4 -4 -4 +5 -5 -5 +update t1 set a=6 where (c between -2 and 0) and (b=-1) order by c; +select * from t1 order by a; +a b c +2 -2 -2 +3 -3 -3 +4 -4 -4 +5 -5 -5 +6 -6 -6 +delete from t1; +drop table t1; +# +# *** REPLACE *** +# +# UNIQUE INDEX on gcol +# REPLACE tbl_name (non-gcols) VALUES (non-gcols); +create table t1 (a int, +b int generated always as (-a) virtual, +c int generated always as (-a) stored unique, +d varchar(16)); +insert into t1 (a,d) values (1,'a'), (2,'b'); +select * from t1 order by a; +a b c d +1 -1 -1 a +2 -2 -2 b +replace t1 (a,d) values (1,'c'); +select * from t1 order by a; +a b c d +1 -1 -1 c +2 -2 -2 b +delete from t1; +select * from t1; +a b c d +set sql_warnings = 0; +drop table t1; +Bug#20797344: WL#8149: ALLOCATED SPACE FOR INDEXED BLOB VGC CAN BE +OVERWRITTEN FOR UPDATE +# +CREATE TABLE t (a varchar(100), b blob, +c blob GENERATED ALWAYS AS (concat(a,b)) VIRTUAL, +d blob GENERATED ALWAYS AS (b) VIRTUAL, +e int(11) GENERATED ALWAYS AS (10) VIRTUAL, +h int(11) NOT NULL, PRIMARY KEY (h), key(c(20))); +INSERT INTO t(a,b,h) VALUES('aaaaaaa','1111111', 11); +INSERT INTO t(a,b,h) VALUES('bbbbbbb','2222222', 22); +SELECT c FROM t; +c +aaaaaaa1111111 +bbbbbbb2222222 +UPDATE t SET a='ccccccc'; +SELECT c FROM t; +c +ccccccc1111111 +ccccccc2222222 +DROP TABLE t; +# Bug#21081742: ASSERTION !TABLE || (!TABLE->WRITE_SET || +# BITMAP_IS_SET(TABLE->WRITE_SET +# +CREATE TABLE b ( +pk INTEGER AUTO_INCREMENT, +col_varchar_nokey VARCHAR(1), +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)), +PRIMARY KEY (pk) +); +INSERT INTO b (col_varchar_nokey) VALUES ('v'),('v'); +CREATE TABLE d ( +pk INTEGER AUTO_INCREMENT, +col_varchar_nokey VARCHAR(1), +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)), +PRIMARY KEY (pk) +) ; +INSERT INTO d (col_varchar_nokey) VALUES ('q'),('g'),('e'),('l'),(NULL),('v'),('c'),('u'),('x'); +CREATE TABLE bb ( +pk INTEGER AUTO_INCREMENT, +col_varchar_nokey VARCHAR(1) /*! NULL */, +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)), +PRIMARY KEY (pk) +); +INSERT INTO bb (col_varchar_nokey) VALUES ('j'),('h'); +EXPLAIN UPDATE +d AS OUTR1, b AS OUTR2 +SET OUTR1.col_varchar_nokey = NULL +WHERE +( 't', 'b' ) IN +( +SELECT +INNR1.col_varchar_nokey AS x, +INNR1.col_varchar_key AS y +FROM bb AS INNR1 +WHERE OUTR1.pk = 1 +); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY OUTR1 const PRIMARY PRIMARY 4 const 1 +1 PRIMARY INNR1 ALL NULL NULL NULL NULL 2 Using where; FirstMatch(OUTR1) +1 PRIMARY OUTR2 index NULL PRIMARY 4 NULL 2 Using index +DROP TABLE IF EXISTS b,bb,d; +# +# Bug#21216067 ASSERTION FAILED ROW_UPD_SEC_INDEX_ENTRY (INNOBASE/ROW/ROW0UPD.CC:2103) +# +CREATE TABLE t ( +x INT, y INT, gc INT GENERATED ALWAYS AS (x+1) STORED +); +INSERT INTO t VALUES (); +UPDATE t t1, t t2 SET t2.y = 1, t1.x = 2; +SELECT * FROM t; +x y gc +2 1 3 +DROP TABLE t; +CREATE TABLE t ( +x INT, y INT, gc INT GENERATED ALWAYS AS (x+1), KEY (x,gc) +); +INSERT INTO t VALUES (); +UPDATE t t1, t t2 SET t1.x = 1, t2.y = 2; +SELECT * FROM t; +x y gc +1 2 2 +SELECT gc FROM t; +gc +2 +CHECK TABLE t; +Table Op Msg_type Msg_text +test.t check status OK +DROP TABLE t; +# stored +CREATE TABLE C ( +col_varchar_nokey VARCHAR(1), +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)) STORED +); +INSERT INTO C (col_varchar_nokey) VALUES ('c'); +EXPLAIN UPDATE C AS OUTR1, C AS OUTR2 +SET OUTR1.`col_varchar_nokey` = 'f', +OUTR2.`col_varchar_nokey` = "a"; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE OUTR1 system NULL NULL NULL NULL 1 +1 SIMPLE OUTR2 system NULL NULL NULL NULL 1 +UPDATE C AS OUTR1, C AS OUTR2 +SET OUTR1.`col_varchar_nokey` = 'f', +OUTR2.`col_varchar_nokey` = "a"; +SELECT * from C; +col_varchar_nokey col_varchar_key +a aa +DROP TABLE C; +# stored, indexed +CREATE TABLE C ( +col_varchar_nokey VARCHAR(1), +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)) STORED, +KEY (col_varchar_key, col_varchar_nokey) +); +INSERT INTO C (col_varchar_nokey) VALUES ('c'); +EXPLAIN UPDATE C AS OUTR1, C AS OUTR2 +SET OUTR1.`col_varchar_nokey` = 'f', +OUTR2.`col_varchar_nokey` = "a"; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE OUTR1 system NULL NULL NULL NULL 1 +1 SIMPLE OUTR2 system NULL NULL NULL NULL 1 +UPDATE C AS OUTR1, C AS OUTR2 +SET OUTR1.`col_varchar_nokey` = 'f', +OUTR2.`col_varchar_nokey` = "a"; +SELECT * from C; +col_varchar_nokey col_varchar_key +a aa +DROP TABLE C; +# virtual +CREATE TABLE C ( +col_varchar_nokey VARCHAR(1), +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)) VIRTUAL +); +INSERT INTO C (col_varchar_nokey) VALUES ('c'); +EXPLAIN UPDATE C AS OUTR1, C AS OUTR2 +SET OUTR1.`col_varchar_nokey` = 'f', +OUTR2.`col_varchar_nokey` = "a"; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE OUTR1 system NULL NULL NULL NULL 1 +1 SIMPLE OUTR2 system NULL NULL NULL NULL 1 +UPDATE C AS OUTR1, C AS OUTR2 +SET OUTR1.`col_varchar_nokey` = 'f', +OUTR2.`col_varchar_nokey` = "a"; +SELECT * from C; +col_varchar_nokey col_varchar_key +a aa +DROP TABLE C; +# virtual, indexed +CREATE TABLE C ( +col_varchar_nokey VARCHAR(1), +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)) VIRTUAL, +KEY (col_varchar_key, col_varchar_nokey) +); +INSERT INTO C (col_varchar_nokey) VALUES ('c'); +EXPLAIN UPDATE C AS OUTR1, C AS OUTR2 +SET OUTR1.`col_varchar_nokey` = 'f', +OUTR2.`col_varchar_nokey` = "a"; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE OUTR1 system NULL NULL NULL NULL 1 +1 SIMPLE OUTR2 system NULL NULL NULL NULL 1 +UPDATE C AS OUTR1, C AS OUTR2 +SET OUTR1.`col_varchar_nokey` = 'f', +OUTR2.`col_varchar_nokey` = "a"; +SELECT * from C; +col_varchar_nokey col_varchar_key +a aa +DROP TABLE C; +# +# Bug #21530366 CRASH/ASSERTION, CORRUPTION WITH INDEXES + +# VIRTUAL COLUMNS, BLOB +# +CREATE TABLE t ( +a INTEGER, +b BLOB GENERATED ALWAYS AS (a) VIRTUAL, +INDEX (b(57)) +); +INSERT INTO t (a) VALUES (9); +UPDATE t SET a = 10; +DELETE FROM t WHERE a = 10; +DROP TABLE t; +# Bug#21807818: Generated columns not updated with empty insert list +CREATE TABLE t ( +a BLOB GENERATED ALWAYS AS ('') VIRTUAL, +b TIMESTAMP(4) GENERATED ALWAYS AS ('') VIRTUAL, +KEY (a(183),b) +); +INSERT INTO t VALUES(), (), (); +Warnings: +Warning 1265 Data truncated for column 'b' at row 1 +Warning 1265 Data truncated for column 'b' at row 2 +Warning 1265 Data truncated for column 'b' at row 3 +DELETE IGNORE FROM t; +DROP TABLE t; +# +# Bug#22195458:GCOLS: ASSERTION 0 AND CORRUPTION... +# +CREATE TABLE t ( +a INT, +b YEAR GENERATED ALWAYS AS ('a') VIRTUAL, +c YEAR GENERATED ALWAYS AS ('aaaa') VIRTUAL, +b1 YEAR GENERATED ALWAYS AS ('a') STORED, +c1 YEAR GENERATED ALWAYS AS ('aaaa') STORED, +UNIQUE(b), +UNIQUE(b1) +); +INSERT INTO t VALUES(); +SELECT b from t; +b +2000 +SELECT b1 from t; +b1 +0000 +SELECT * from t; +a b c b1 c1 +NULL 2000 0000 0000 0000 +DELETE FROM t; +CHECK TABLE t EXTENDED; +Table Op Msg_type Msg_text +test.t check status OK +DROP TABLE t; +# Bug#22195364:GCOLS: FAILING ASSERTION: +# DFIELD_IS_NULL(DFIELD2) || DFIELD2->DATA +CREATE TABLE t ( +a INT, +c BLOB GENERATED ALWAYS AS ('') VIRTUAL, +UNIQUE KEY(c(1),a) +); +INSERT INTO t(a) VALUES(1) ON DUPLICATE KEY UPDATE a=2; +SELECT * FROM t; +a c +1 +INSERT INTO t(a) VALUES(1) ON DUPLICATE KEY UPDATE a=2; +SELECT * FROM t; +a c +2 +SELECT GROUP_CONCAT(c ORDER BY c) FROM t; +GROUP_CONCAT(c ORDER BY c) + +DROP TABLE t; +#Bug#21929967:GCOLS:GCOL VALUE CHANGES WHEN SESSION CHANGES SQL_MODE +CREATE TABLE t(c1 INT GENERATED ALWAYS AS (1) VIRTUAL, +c2 INT GENERATED ALWAYS AS(2) STORED); +INSERT INTO t VALUES(DEFAULT, DEFAULT); +SELECT * FROM t; +c1 c2 +1 2 +CREATE TABLE t1(c1 INT, c2 INT GENERATED ALWAYS AS(c1 + 1) STORED); +INSERT INTO t1(c2) VALUES(DEFAULT); +SELECT * FROM t1; +c1 c2 +NULL NULL +CREATE TABLE t2(c1 INT DEFAULT 1, c2 INT GENERATED ALWAYS AS(c1 + 1) STORED); +INSERT INTO t2(c2) VALUES(DEFAULT); +SELECT * FROM t2; +c1 c2 +1 2 +DROP TABLE t, t1, t2; +# Bug#22179637: INSERT INTO TABLE FROM SELECT ACCEPTS TO INSERT INTO +# GENERATED COLUMNS +CREATE TABLE t1 ( +i1 INTEGER, +i2 INTEGER GENERATED ALWAYS AS (i1 + i1) +); +INSERT INTO t1 (i1) SELECT 5; +INSERT INTO t1 (i1) SELECT 5 ON DUPLICATE KEY UPDATE i2= DEFAULT; +SELECT * FROM t1; +i1 i2 +5 10 +5 10 +CREATE TABLE t2 ( +i1 INTEGER, +i2 INTEGER GENERATED ALWAYS AS (i1 + i1) STORED +); +INSERT INTO t2 (i1) SELECT 5; +INSERT INTO t2 (i1) SELECT 5 ON DUPLICATE KEY UPDATE i2= DEFAULT; +SELECT * FROM t2; +i1 i2 +5 10 +5 10 +DROP TABLE t1,t2; +# +# Bug#22070021 GCOL:ASSERTION `!TABLE || (!TABLE->WRITE_SET || +# BITMAP_IS_SET(TABLE->WRITE_SET, +# +CREATE TABLE t1( +c1 INT, +c2 INT GENERATED ALWAYS AS (c1 + c1) VIRTUAL, +KEY(c2) +); +INSERT INTO t1(c1) VALUES(0); +DELETE O1.* FROM t1 AS O1, t1 AS O2; +SELECT * FROM t1; +c1 c2 +DROP TABLE t1; +# +# Bug#21944199 SIMPLE DELETE QUERY CAUSES INNODB: FAILING ASSERTION: 0 +# & DATA CORRUPTION +# +CREATE TEMPORARY TABLE t1 ( +a INTEGER NOT NULL, +b INTEGER GENERATED ALWAYS AS (a+1) VIRTUAL +); +INSERT INTO t1 (a) VALUES (0), (0), (0); +ALTER TABLE t1 ADD INDEX idx (b); +DELETE FROM t1; +DROP TEMPORARY TABLE t1; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_keys_innodb.result b/mysql-test/suite/gcol/r/gcol_keys_innodb.result new file mode 100644 index 00000000000..80605b8b0b2 --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_keys_innodb.result @@ -0,0 +1,421 @@ +SET @@session.default_storage_engine = 'InnoDB'; +# - UNIQUE KEY +# - INDEX +# - FULLTEXT INDEX +# - SPATIAL INDEX (not supported) +# - FOREIGN INDEX (partially supported) +# - CHECK (allowed but not used) +# UNIQUE +create table t1 (a int, b int generated always as (a*2) stored unique); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, + UNIQUE KEY `b` (`b`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES UNI NULL STORED GENERATED +drop table t1; +create table t1 (a int, b int generated always as (a*2) stored, unique (b)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, + UNIQUE KEY `b` (`b`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES UNI NULL STORED GENERATED +drop table t1; +create table t1 (a int, b int generated always as (a*2) stored); +alter table t1 add unique key (b); +drop table t1; +# Testing data manipulation operations involving UNIQUE keys +# on generated columns can be found in: +# - gcol_ins_upd.inc +# - gcol_select.inc +# +# INDEX +create table t1 (a int, b int generated always as (a*2) stored, index (b)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, + KEY `b` (`b`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES MUL NULL STORED GENERATED +drop table t1; +create table t1 (a int, b int generated always as (a*2) stored, index (a,b)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, + KEY `a` (`a`,`b`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES MUL NULL +b int(11) YES NULL STORED GENERATED +drop table t1; +create table t1 (a int, b int generated always as (a*2) stored); +alter table t1 add index (b); +drop table t1; +create table t1 (a int, b int generated always as (a*2) stored); +alter table t1 add index (a,b); +create table t2 like t1; +drop table t2; +drop table t1; +# Testing data manipulation operations involving INDEX +# on generated columns can be found in: +# - gcol_select.inc +# +# TODO: FULLTEXT INDEX +# SPATIAL INDEX +# FOREIGN KEY +# Rejected FK options. +create table t1 (a int, b int generated always as (a+1) stored, +foreign key (b) references t2(a) on update set null); +ERROR HY000: Cannot define foreign key with ON UPDATE SET NULL clause on a generated column +create table t1 (a int, b int generated always as (a+1) stored, +foreign key (b) references t2(a) on update cascade); +ERROR HY000: Cannot define foreign key with ON UPDATE CASCADE clause on a generated column +create table t1 (a int, b int generated always as (a+1) stored, +foreign key (b) references t2(a) on delete set null); +ERROR HY000: Cannot define foreign key with ON DELETE SET NULL clause on a generated column +create table t1 (a int, b int generated always as (a+1) stored); +alter table t1 add foreign key (b) references t2(a) on update set null; +ERROR HY000: Cannot define foreign key with ON UPDATE SET NULL clause on a generated column +alter table t1 add foreign key (b) references t2(a) on update cascade; +ERROR HY000: Cannot define foreign key with ON UPDATE CASCADE clause on a generated column +alter table t1 add foreign key (b) references t2(a) on delete set null; +ERROR HY000: Cannot define foreign key with ON DELETE SET NULL clause on a generated column +drop table t1; +# Allowed FK options. +create table t2 (a int primary key, b char(5)); +create table t1 (a int, b int generated always as (a % 10) stored, +foreign key (b) references t2(a) on update restrict); +drop table t1; +create table t1 (a int, b int generated always as (a % 10) stored, +foreign key (b) references t2(a) on update no action); +drop table t1; +create table t1 (a int, b int generated always as (a % 10) stored, +foreign key (b) references t2(a) on delete restrict); +drop table t1; +create table t1 (a int, b int generated always as (a % 10) stored, +foreign key (b) references t2(a) on delete cascade); +drop table t1; +create table t1 (a int, b int generated always as (a % 10) stored, +foreign key (b) references t2(a) on delete no action); +drop table t1,t2; + +# Testing data manipulation operations involving FOREIGN KEY +# on generated columns can be found in: +# - gcol_ins_upd.inc +# - gcol_select.inc +# +# TODO: CHECK +# +# Test how optimizer picks indexes defined on a GC +# +CREATE TABLE t1 (f1 int, gc int AS (f1 + 1) STORED, UNIQUE(gc)); +INSERT INTO t1(f1) VALUES (1),(2),(0),(9),(3),(4),(8),(7),(5),(6); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +# Should use index +SELECT * FROM t1 WHERE f1 + 1 > 7; +f1 gc +7 8 +8 9 +9 10 +EXPLAIN SELECT * FROM t1 WHERE f1 + 1 > 7; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where +SELECT * FROM t1 WHERE f1 + 1 = 7; +f1 gc +6 7 +EXPLAIN SELECT * FROM t1 WHERE f1 + 1 = 7; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where +SELECT * FROM t1 WHERE f1 + 1 IN (7,5); +f1 gc +4 5 +6 7 +EXPLAIN SELECT * FROM t1 WHERE f1 + 1 IN(7,5); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where +SELECT * FROM t1 WHERE f1 + 1 BETWEEN 5 AND 7; +f1 gc +4 5 +5 6 +6 7 +EXPLAIN SELECT * FROM t1 WHERE f1 + 1 BETWEEN 5 AND 7; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where +# Check that expression isn't transformed for a disabled key +SELECT * FROM t1 IGNORE KEY (gc) WHERE f1 + 1 BETWEEN 5 AND 7; +f1 gc +4 5 +5 6 +6 7 +EXPLAIN SELECT * FROM t1 IGNORE KEY (gc) WHERE f1 + 1 BETWEEN 5 AND 7; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where +# Check that ORDER BY could be optimized +SELECT * FROM t1 ORDER BY f1 + 1; +f1 gc +0 1 +1 2 +2 3 +3 4 +4 5 +5 6 +6 7 +7 8 +8 9 +9 10 +EXPLAIN SELECT * FROM t1 ORDER BY f1 + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using filesort +EXPLAIN SELECT * FROM t1 IGNORE KEY (gc) ORDER BY f1 + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using filesort +# Check that GROUP BY could be optimized +SELECT f1 + 1, MAX(GC) FROM t1 GROUP BY f1 + 1; +f1 + 1 MAX(GC) +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +10 10 +EXPLAIN SELECT f1 + 1, MAX(GC) FROM t1 GROUP BY f1 + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using temporary; Using filesort +EXPLAIN SELECT f1 + 1, MAX(GC) +FROM t1 IGNORE KEY (gc) GROUP BY f1 + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using temporary; Using filesort +# Shouldn't use index +SELECT * FROM t1 WHERE f1 + 1 > 7.0; +f1 gc +7 8 +8 9 +9 10 +EXPLAIN SELECT * FROM t1 WHERE f1 + 1 > 7.0; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where +DROP TABLE t1; +# Pick index with proper type +CREATE TABLE t1 (f1 int, +gc_int int AS (f1 + 1) STORED, +gc_date DATE AS (f1 + 1) STORED, +KEY gc_int_idx(gc_int), +KEY gc_date_idx(gc_date)); +INSERT INTO t1(f1) VALUES +(030303),(040404), +(050505),(060606), +(010101),(020202), +(030303),(040404), +(050505),(060606), +(010101),(020202), +(090909),(101010), +(010101),(020202), +(070707),(080808); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SELECT * FROM t1 WHERE f1 + 1 > 070707; +f1 gc_int gc_date +101010 101011 2010-10-11 +70707 70708 2007-07-08 +80808 80809 2008-08-09 +90909 90910 2009-09-10 +# INT column & index should be picked +EXPLAIN SELECT * FROM t1 WHERE f1 + 1 > 070707; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 18 Using where +SELECT * FROM t1 WHERE f1 + 1 > CAST(070707 AS DATE); +f1 gc_int gc_date +101010 101011 2010-10-11 +70707 70708 2007-07-08 +80808 80809 2008-08-09 +90909 90910 2009-09-10 +# DATE column & index should be picked +EXPLAIN SELECT * FROM t1 WHERE f1 + 1 > CAST(070707 AS DATE); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 18 Using where +DROP TABLE t1; +# +# BUG#21229846: WL8170: SIGNAL 11 IN JOIN::MAKE_SUM_FUNC_LIST +# +CREATE TABLE t1 ( +pk int primary key auto_increment, +col_int_key INTEGER , +col_int_gc_key INT GENERATED ALWAYS AS (col_int_key + 1) STORED, +KEY col_int_gc_key(col_int_gc_key) +); +INSERT INTO t1 ( col_int_key) VALUES (7); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SELECT table1.col_int_key + 1 AS field1, table2.col_int_key AS field2 +FROM (t1 AS table1 JOIN t1 AS table2 ON (table2.pk = table1.pk)) +ORDER BY field1, field2; +field1 field2 +8 7 +EXPLAIN SELECT table1.col_int_key + 1 AS field1, table2.col_int_key AS field2 +FROM (t1 AS table1 JOIN t1 AS table2 ON (table2.pk = table1.pk)) +ORDER BY field1, field2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE table1 ALL PRIMARY NULL NULL NULL 1 Using temporary; Using filesort +1 SIMPLE table2 eq_ref PRIMARY PRIMARY 4 test.table1.pk 1 +SELECT table1.col_int_key + 1 AS field1, table2.col_int_key AS field2 +FROM (t1 AS table1 JOIN t1 AS table2 ON (table2.pk = table1.pk)) +GROUP BY field1, field2; +field1 field2 +8 7 +EXPLAIN SELECT table1.col_int_key + 1 AS field1, table2.col_int_key AS field2 +FROM (t1 AS table1 JOIN t1 AS table2 ON (table2.pk = table1.pk)) +GROUP BY field1, field2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE table1 ALL PRIMARY NULL NULL NULL 1 Using temporary; Using filesort +1 SIMPLE table2 eq_ref PRIMARY PRIMARY 4 test.table1.pk 1 +DROP TABLE t1; +# +# Bug#21770798 OPTIMIZER DOES NOT USE INDEX FOR GENERATED EXPRESSIONS +# WITH LOGICAL OPERATORS +# +CREATE TABLE t (a INT, b INT, +gc_and INT GENERATED ALWAYS AS (a AND b) STORED, +gc_or INT GENERATED ALWAYS AS (a OR b) STORED, +gc_xor INT GENERATED ALWAYS AS (a XOR b) STORED, +gc_not INT GENERATED ALWAYS AS (NOT a) STORED, +gc_case INT GENERATED ALWAYS AS +(CASE WHEN (a AND b) THEN a ELSE b END) STORED, +INDEX(gc_and), INDEX(gc_or), INDEX(gc_xor), INDEX(gc_not), +INDEX(gc_case)); +INSERT INTO t (a, b) VALUES (0, 0), (0, 1), (1, 0), (1, 1); +ANALYZE TABLE t; +Table Op Msg_type Msg_text +test.t analyze status OK +EXPLAIN SELECT a, b FROM t WHERE (a AND b) = 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t ALL NULL NULL NULL NULL 4 Using where +SELECT a, b FROM t WHERE (a AND b) = 1; +a b +1 1 +EXPLAIN SELECT a, b FROM t WHERE 1 = (a AND b); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t ALL NULL NULL NULL NULL 4 Using where +SELECT a, b FROM t WHERE 1 = (a AND b); +a b +1 1 +EXPLAIN SELECT a, b FROM t WHERE (a AND b) IN (1, 2, 3); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t ALL NULL NULL NULL NULL 4 Using where +SELECT a, b FROM t WHERE (a AND b) IN (1, 2, 3); +a b +1 1 +EXPLAIN SELECT a, b FROM t WHERE (a OR b) = 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t ALL NULL NULL NULL NULL 4 Using where +SELECT a, b FROM t WHERE (a OR b) = 1; +a b +0 1 +1 0 +1 1 +EXPLAIN SELECT a, b FROM t WHERE (a OR b) BETWEEN 1 AND 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t ALL NULL NULL NULL NULL 4 Using where +SELECT a, b FROM t WHERE (a OR b) BETWEEN 1 AND 10; +a b +0 1 +1 0 +1 1 +EXPLAIN SELECT a, b FROM t WHERE (a XOR b) = 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t ALL NULL NULL NULL NULL 4 Using where +SELECT a, b FROM t WHERE (a XOR b) = 1; +a b +0 1 +1 0 +EXPLAIN SELECT a FROM t WHERE (NOT a) = 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t ALL NULL NULL NULL NULL 4 Using where +SELECT a FROM t WHERE (NOT a) = 1; +a +0 +0 +EXPLAIN SELECT a FROM t WHERE (CASE WHEN (a AND b) THEN a ELSE b END) = 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t ALL NULL NULL NULL NULL 4 Using where +SELECT a FROM t WHERE (CASE WHEN (a AND b) THEN a ELSE b END) = 1; +a +0 +1 +EXPLAIN SELECT a, b FROM t WHERE 1 = (b AND a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t ALL NULL NULL NULL NULL 4 Using where +SELECT a, b FROM t WHERE 1 = (b AND a); +a b +1 1 +EXPLAIN SELECT a, b FROM t WHERE 1 = (b OR a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t ALL NULL NULL NULL NULL 4 Using where +SELECT a, b FROM t WHERE 1 = (b OR a); +a b +0 1 +1 0 +1 1 +DROP TABLE t; +# +# Bug#22810883: ASSERTION FAILED: +# !(USED_TABS & (~READ_TABLES & ~FILTER_FOR_TABLE)) +# +CREATE TABLE t1 (a1 INTEGER GENERATED ALWAYS AS (1 AND 0) STORED, +a2 INTEGER, KEY (a1)); +INSERT INTO t1 VALUES (); +CREATE TABLE t2 (b INTEGER); +INSERT INTO t2 VALUES (1); +ANALYZE TABLE t1, t2; +Table Op Msg_type Msg_text +test.t1 analyze status OK +test.t2 analyze status OK +# Used to choose the index on a1 and get wrong results. +EXPLAIN SELECT * FROM t1 WHERE (a2 AND a2) = 0; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using where +SELECT * FROM t1 WHERE (a2 AND a2) = 0; +a1 a2 +# Used to get assertion or wrong results. +EXPLAIN SELECT * FROM t1 STRAIGHT_JOIN t2 ON b WHERE (b AND b) = 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 1 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) +SELECT * FROM t1 STRAIGHT_JOIN t2 ON b WHERE (b AND b) = 1; +a1 a2 b +0 NULL 1 +DROP TABLE t1, t2; +# +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_keys_myisam.result b/mysql-test/suite/gcol/r/gcol_keys_myisam.result new file mode 100644 index 00000000000..a331b1d2154 --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_keys_myisam.result @@ -0,0 +1,850 @@ +SET @@session.default_storage_engine = 'MyISAM'; +# - UNIQUE KEY +# - INDEX +# - FULLTEXT INDEX +# - SPATIAL INDEX (not supported) +# - FOREIGN INDEX (partially supported) +# - CHECK (allowed but not used) +# UNIQUE +create table t1 (a int, b int generated always as (a*2) virtual unique); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` * 2) VIRTUAL, + UNIQUE KEY `b` (`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES UNI NULL VIRTUAL GENERATED +drop table t1; +create table t1 (a int, b int generated always as (a*2) stored unique); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, + UNIQUE KEY `b` (`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES UNI NULL STORED GENERATED +drop table t1; +create table t1 (a int, b int generated always as (a*2) virtual, unique key (b)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` * 2) VIRTUAL, + UNIQUE KEY `b` (`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES UNI NULL VIRTUAL GENERATED +drop table t1; +create table t1 (a int, b int generated always as (a*2) stored, unique (b)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, + UNIQUE KEY `b` (`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES UNI NULL STORED GENERATED +drop table t1; +create table t1 (a int, b int generated always as (a*2) virtual); +alter table t1 add unique key (b); +drop table t1; +create table t1 (a int, b int generated always as (a*2) stored); +alter table t1 add unique key (b); +drop table t1; +# Testing data manipulation operations involving UNIQUE keys +# on generated columns can be found in: +# - gcol_ins_upd.inc +# - gcol_select.inc +# +# INDEX +create table t1 (a int, b int generated always as (a*2) virtual, index (b)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` * 2) VIRTUAL, + KEY `b` (`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES MUL NULL VIRTUAL GENERATED +drop table t1; +create table t1 (a int, b int generated always as (a*2) virtual, index (a,b)); +drop table t1; +create table t1 (a int, b int generated always as (a*2) stored, index (b)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, + KEY `b` (`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES MUL NULL STORED GENERATED +drop table t1; +create table t1 (a int, b int generated always as (a*2) stored, index (a,b)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +describe t1; +Field Type Null Key Default Extra +a int(11) YES MUL NULL +b int(11) YES NULL STORED GENERATED +drop table t1; +create table t1 (a int, b int generated always as (a*2) virtual); +alter table t1 add index (b); +alter table t1 add index (a,b); +drop table t1; +create table t1 (a int, b int generated always as (a*2) stored); +alter table t1 add index (b); +drop table t1; +create table t1 (a int, b int generated always as (a*2) stored); +alter table t1 add index (a,b); +create table t2 like t1; +drop table t2; +drop table t1; +# Testing data manipulation operations involving INDEX +# on generated columns can be found in: +# - gcol_select.inc +# +# TODO: FULLTEXT INDEX +# SPATIAL INDEX +# Error "All parts of a SPATIAL index must be geometrical" +create table t1 (a int, b int generated always as (a+1) stored, spatial index (b)); +ERROR HY000: Incorrect arguments to SPATIAL INDEX +create table t1 (a int, b int generated always as (a+1) stored); +alter table t1 add spatial index (b); +ERROR HY000: Incorrect arguments to SPATIAL INDEX +drop table t1; +# FOREIGN KEY +# Rejected FK options. +create table t1 (a int, b int generated always as (a+1) stored, +foreign key (b) references t2(a) on update set null); +ERROR HY000: Cannot define foreign key with ON UPDATE SET NULL clause on a generated column +create table t1 (a int, b int generated always as (a+1) stored, +foreign key (b) references t2(a) on update cascade); +ERROR HY000: Cannot define foreign key with ON UPDATE CASCADE clause on a generated column +create table t1 (a int, b int generated always as (a+1) stored, +foreign key (b) references t2(a) on delete set null); +ERROR HY000: Cannot define foreign key with ON DELETE SET NULL clause on a generated column +create table t1 (a int, b int generated always as (a+1) stored); +alter table t1 add foreign key (b) references t2(a) on update set null; +ERROR HY000: Cannot define foreign key with ON UPDATE SET NULL clause on a generated column +alter table t1 add foreign key (b) references t2(a) on update cascade; +ERROR HY000: Cannot define foreign key with ON UPDATE CASCADE clause on a generated column +alter table t1 add foreign key (b) references t2(a) on delete set null; +ERROR HY000: Cannot define foreign key with ON DELETE SET NULL clause on a generated column +drop table t1; +# Allowed FK options. +create table t2 (a int primary key, b char(5)); +create table t1 (a int, b int generated always as (a % 10) stored, +foreign key (b) references t2(a) on update restrict); +drop table t1; +create table t1 (a int, b int generated always as (a % 10) stored, +foreign key (b) references t2(a) on update no action); +drop table t1; +create table t1 (a int, b int generated always as (a % 10) stored, +foreign key (b) references t2(a) on delete restrict); +drop table t1; +create table t1 (a int, b int generated always as (a % 10) stored, +foreign key (b) references t2(a) on delete cascade); +drop table t1; +create table t1 (a int, b int generated always as (a % 10) stored, +foreign key (b) references t2(a) on delete no action); +drop table t1,t2; +# +# Bug#20553262: WL8149: ASSERTION `DELSUM+(INT) Y/4-TEMP >= 0' FAILED +# +CREATE TABLE c ( +pk integer AUTO_INCREMENT, +col_datetime_nokey DATETIME /*! NULL */, +col_time_nokey TIME /*! NULL */, +col_datetime_key DATETIME GENERATED ALWAYS AS +(ADDTIME(col_datetime_nokey, col_time_nokey)), +col_time_key TIME GENERATED ALWAYS AS +(ADDTIME(col_datetime_nokey, col_time_nokey)), +col_varchar_nokey VARCHAR(1) /*! NULL */, +PRIMARY KEY (pk), +KEY (col_time_key), +KEY (col_datetime_key)); +INSERT INTO c ( col_time_nokey,col_datetime_nokey,col_varchar_nokey) values +('14:03:03.042673','2001-11-28 00:50:27.051028', 'c'), +('01:46:09.016386','2007-10-09 19:53:04.008332', NULL), +('16:21:18.052408','2001-11-08 21:02:12.009395', 'x'), +('18:56:33.027423','2003-04-01 00:00:00', 'i'); +Warnings: +Note 1265 Data truncated for column 'col_time_key' at row 1 +Note 1265 Data truncated for column 'col_time_key' at row 2 +Note 1265 Data truncated for column 'col_time_key' at row 3 +Note 1265 Data truncated for column 'col_time_key' at row 4 +EXPLAIN SELECT +outr.col_time_key AS x +FROM c as outr +WHERE +outr.col_varchar_nokey in ('c', 'x', 'i') +AND (outr.col_time_key IS NULL OR +outr.col_datetime_key = '2009-09-27'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE outr ALL col_time_key,col_datetime_key NULL NULL NULL 4 x +SELECT +outr.col_time_key AS x +FROM c AS outr +WHERE +outr.col_varchar_nokey in ('c', 'x', 'i') +AND (outr.col_time_key IS NULL OR +outr.col_datetime_key = '2009-09-27'); +x +DROP TABLE c; +# +# Bug#20913803: WL8149: SIG 11 IN DFIELD_DUP | +# INNOBASE/INCLUDE/DATA0DATA.IC:253 +# +CREATE TABLE A ( +col_varchar_nokey TEXT , +col_varchar_key TEXT GENERATED ALWAYS AS (REPEAT(col_varchar_nokey, 1000)), +KEY (col_varchar_key(50)) +); +INSERT INTO A (col_varchar_nokey) VALUES (''); +CREATE TABLE D ( +pk INTEGER AUTO_INCREMENT, +col_date_nokey BLOB, +col_date_key BLOB GENERATED ALWAYS AS (REPEAT(col_date_nokey,1000)) VIRTUAL, +col_datetime_nokey LONGBLOB, +col_time_nokey LONGTEXT, +col_datetime_key LONGBLOB GENERATED ALWAYS AS (REPEAT(col_datetime_nokey, 1000)), +col_time_key LONGTEXT GENERATED ALWAYS AS (REPEAT(col_datetime_nokey, 1000)), +col_varchar_nokey TEXT, +col_varchar_key TEXT GENERATED ALWAYS AS (REPEAT(col_varchar_nokey, 1000)), +PRIMARY KEY (pk), +KEY (col_varchar_key(50)), +KEY (col_date_key(20)), +KEY (col_time_key(20)), +KEY (col_datetime_key(20)), +KEY (col_varchar_key(10), col_date_key(10), col_time_key(5), col_datetime_key(5)) +); +INSERT INTO D ( +col_date_nokey, +col_time_nokey, +col_datetime_nokey, +col_varchar_nokey +) VALUES ('', '', '', ''),('', '', '', ''); +DELETE FROM OUTR1.* USING D AS OUTR1 RIGHT JOIN A AS OUTR2 ON +( OUTR1 . `col_varchar_nokey` = OUTR2 . `col_varchar_nokey` ); +DROP TABLE IF EXISTS A,D; +# +# Bug#21024896: SIG 11 INNOBASE_ADD_ONE_VIRTUAL | +# INNOBASE/HANDLER/HANDLER0ALTER.CC +# +CREATE TABLE t1 ( +col1 int(11) DEFAULT NULL, +col2 int(11) DEFAULT NULL, +col3 int(11) NOT NULL, +col4 int(11) DEFAULT NULL, +col5 int(11) GENERATED ALWAYS AS (col2 / col2) VIRTUAL, +col7 int(11) GENERATED ALWAYS AS (col5 + col5) VIRTUAL, +col8 int(11) GENERATED ALWAYS AS (col5 * col5) VIRTUAL, +col9 text, +col6 int(11) DEFAULT NULL, +PRIMARY KEY (`col3`), +UNIQUE KEY uidx (`col2`), +KEY idx (`col5`) +); +INSERT INTO t1(col1,col2,col3,col4,col9,col6) +VALUES(1,1,0,1,REPEAT(col1,1000),0), (3,2,1,1,REPEAT(col1,1000),NULL); +ALTER TABLE t1 ADD COLUMN extra INT; +DROP TABLE t1; +# +# Bug#21316860: WL8149:INNODB: FAILING ASSERTION: +# TEMPL->CLUST_REC_FIELD_NO != ULINT_UNDEFINED +# +CREATE TABLE t1 ( +pk int(11) NOT NULL, +col_int_nokey int(11), +col_int_key int(11) GENERATED ALWAYS AS (col_int_nokey) VIRTUAL, +col_date_nokey date, +col_date_key date GENERATED ALWAYS AS (col_date_nokey) VIRTUAL, +PRIMARY KEY (pk), +UNIQUE KEY col_int_key (col_int_key) +); +ALTER TABLE t1 DROP COLUMN pk; +DROP TABLE t1; +# Remove the impact on PK choose by index on virtual generated column +CREATE TABLE t1 ( +pk int(11) NOT NULL, +col_int_nokey int(11) DEFAULT NULL, +col_int_key int(11) GENERATED ALWAYS AS (col_int_nokey) VIRTUAL, +UNIQUE KEY col_int_key (col_int_key) +); +ALTER TABLE t1 add unique index idx(pk); +DESC t1; +Field Type Null Key Default Extra +pk int(11) NO PRI NULL +col_int_nokey int(11) YES NULL +col_int_key int(11) YES UNI NULL VIRTUAL GENERATED +DROP TABLE t1; +# +# Bug#21346132: WL8149:INNODB: FAILING ASSERTION: +# PRIMARY_KEY_NO == -1 || PRIMARY_KEY_NO == 0 +# +CREATE TABLE t1 ( +col_int_nokey int(11) NOT NULL, +col_int_key int(11) GENERATED ALWAYS AS (col_int_nokey), +col_varchar_nokey varchar(1) NOT NULL, +col_varchar_key varchar(2) GENERATED ALWAYS AS (col_varchar_nokey), +UNIQUE KEY col_int_key (col_int_key), +UNIQUE KEY col_varchar_key (col_varchar_key), +UNIQUE KEY col_int_key_2 (col_int_key,col_varchar_key), +UNIQUE KEY col_varchar_key_2 (col_varchar_key,col_varchar_nokey), +KEY col_int_key_3 (col_int_key,col_int_nokey) +); +ALTER TABLE t1 DROP COLUMN col_varchar_key; +DROP TABLE t1; +# +# Bug#21320151 WL8149: WRONG RESULT WITH INDEX SCAN +# +CREATE TABLE t1 ( +id INTEGER NOT NULL, +b INTEGER GENERATED ALWAYS AS (id+1) VIRTUAL, +UNIQUE KEY (b) +); +INSERT INTO t1 (id) VALUES (2),(3),(4),(5),(6),(7),(8),(9),(10); +EXPLAIN SELECT b FROM t1 FORCE INDEX(b); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL b 5 NULL 9 Using index +SELECT b FROM t1 FORCE INDEX(b); +b +3 +4 +5 +6 +7 +8 +9 +10 +11 +EXPLAIN SELECT b FROM t1 FORCE INDEX(b) WHERE b BETWEEN 1 AND 5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range b b 5 NULL 3 Using where; Using index +SELECT b FROM t1 FORCE INDEX(b) WHERE b BETWEEN 1 AND 5; +b +3 +4 +5 +DROP TABLE t1; + +# Testing data manipulation operations involving FOREIGN KEY +# on generated columns can be found in: +# - gcol_ins_upd.inc +# - gcol_select.inc +# +# TODO: CHECK +# +# Test how optimizer picks indexes defined on a GC +# +CREATE TABLE t1 (f1 int, gc int AS (f1 + 1) STORED, UNIQUE(gc)); +INSERT INTO t1(f1) VALUES (1),(2),(0),(9),(3),(4),(8),(7),(5),(6); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +# Should use index +SELECT * FROM t1 WHERE f1 + 1 > 7; +f1 gc +7 8 +8 9 +9 10 +EXPLAIN SELECT * FROM t1 WHERE f1 + 1 > 7; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where +SELECT * FROM t1 WHERE f1 + 1 = 7; +f1 gc +6 7 +EXPLAIN SELECT * FROM t1 WHERE f1 + 1 = 7; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where +SELECT * FROM t1 WHERE f1 + 1 IN (7,5); +f1 gc +4 5 +6 7 +EXPLAIN SELECT * FROM t1 WHERE f1 + 1 IN(7,5); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where +SELECT * FROM t1 WHERE f1 + 1 BETWEEN 5 AND 7; +f1 gc +4 5 +5 6 +6 7 +EXPLAIN SELECT * FROM t1 WHERE f1 + 1 BETWEEN 5 AND 7; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where +# Check that expression isn't transformed for a disabled key +SELECT * FROM t1 IGNORE KEY (gc) WHERE f1 + 1 BETWEEN 5 AND 7; +f1 gc +4 5 +5 6 +6 7 +EXPLAIN SELECT * FROM t1 IGNORE KEY (gc) WHERE f1 + 1 BETWEEN 5 AND 7; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where +# Check that ORDER BY could be optimized +SELECT * FROM t1 ORDER BY f1 + 1; +f1 gc +0 1 +1 2 +2 3 +3 4 +4 5 +5 6 +6 7 +7 8 +8 9 +9 10 +EXPLAIN SELECT * FROM t1 ORDER BY f1 + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using filesort +EXPLAIN SELECT * FROM t1 IGNORE KEY (gc) ORDER BY f1 + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using filesort +# Check that GROUP BY could be optimized +SELECT f1 + 1, MAX(GC) FROM t1 GROUP BY f1 + 1; +f1 + 1 MAX(GC) +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +10 10 +EXPLAIN SELECT f1 + 1, MAX(GC) FROM t1 GROUP BY f1 + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using temporary; Using filesort +EXPLAIN SELECT f1 + 1, MAX(GC) +FROM t1 IGNORE KEY (gc) GROUP BY f1 + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using temporary; Using filesort +# Shouldn't use index +SELECT * FROM t1 WHERE f1 + 1 > 7.0; +f1 gc +7 8 +8 9 +9 10 +EXPLAIN SELECT * FROM t1 WHERE f1 + 1 > 7.0; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where +DROP TABLE t1; +# Pick index with proper type +CREATE TABLE t1 (f1 int, +gc_int int AS (f1 + 1) STORED, +gc_date DATE AS (f1 + 1) STORED, +KEY gc_int_idx(gc_int), +KEY gc_date_idx(gc_date)); +INSERT INTO t1(f1) VALUES +(030303),(040404), +(050505),(060606), +(010101),(020202), +(030303),(040404), +(050505),(060606), +(010101),(020202), +(090909),(101010), +(010101),(020202), +(070707),(080808); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SELECT * FROM t1 WHERE f1 + 1 > 070707; +f1 gc_int gc_date +101010 101011 2010-10-11 +70707 70708 2007-07-08 +80808 80809 2008-08-09 +90909 90910 2009-09-10 +# INT column & index should be picked +EXPLAIN SELECT * FROM t1 WHERE f1 + 1 > 070707; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 18 Using where +SELECT * FROM t1 WHERE f1 + 1 > CAST(070707 AS DATE); +f1 gc_int gc_date +101010 101011 2010-10-11 +70707 70708 2007-07-08 +80808 80809 2008-08-09 +90909 90910 2009-09-10 +# DATE column & index should be picked +EXPLAIN SELECT * FROM t1 WHERE f1 + 1 > CAST(070707 AS DATE); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 18 Using where +DROP TABLE t1; +# +# BUG#21229846: WL8170: SIGNAL 11 IN JOIN::MAKE_SUM_FUNC_LIST +# +CREATE TABLE t1 ( +pk int primary key auto_increment, +col_int_key INTEGER , +col_int_gc_key INT GENERATED ALWAYS AS (col_int_key + 1) STORED, +KEY col_int_gc_key(col_int_gc_key) +); +INSERT INTO t1 ( col_int_key) VALUES (7); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SELECT table1.col_int_key + 1 AS field1, table2.col_int_key AS field2 +FROM (t1 AS table1 JOIN t1 AS table2 ON (table2.pk = table1.pk)) +ORDER BY field1, field2; +field1 field2 +8 7 +EXPLAIN SELECT table1.col_int_key + 1 AS field1, table2.col_int_key AS field2 +FROM (t1 AS table1 JOIN t1 AS table2 ON (table2.pk = table1.pk)) +ORDER BY field1, field2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE table1 system PRIMARY NULL NULL NULL 1 +1 SIMPLE table2 system PRIMARY NULL NULL NULL 1 +SELECT table1.col_int_key + 1 AS field1, table2.col_int_key AS field2 +FROM (t1 AS table1 JOIN t1 AS table2 ON (table2.pk = table1.pk)) +GROUP BY field1, field2; +field1 field2 +8 7 +EXPLAIN SELECT table1.col_int_key + 1 AS field1, table2.col_int_key AS field2 +FROM (t1 AS table1 JOIN t1 AS table2 ON (table2.pk = table1.pk)) +GROUP BY field1, field2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE table1 system PRIMARY NULL NULL NULL 1 +1 SIMPLE table2 system PRIMARY NULL NULL NULL 1 +DROP TABLE t1; +# +# Bug#21391781 ASSERT WHEN RUNNING ALTER TABLE ON A TABLE WITH INDEX +# ON VIRTUAL COLUMN +# +CREATE TABLE t1 ( +col1 INTEGER NOT NULL, +col2 INTEGER NOT NULL, +gcol1 INTEGER GENERATED ALWAYS AS (col1 + col2) VIRTUAL, +col3 INTEGER NOT NULL, +col4 INTEGER NOT NULL, +col5 INTEGER DEFAULT NULL, +col6 INTEGER DEFAULT NULL, +col7 INTEGER DEFAULT NULL, +col8 INTEGER DEFAULT NULL, +col9 INTEGER DEFAULT NULL, +col10 INTEGER DEFAULT NULL, +col11 INTEGER DEFAULT NULL, +col12 INTEGER DEFAULT NULL, +col13 INTEGER DEFAULT NULL, +col14 INTEGER DEFAULT NULL, +col15 INTEGER DEFAULT NULL, +col16 INTEGER DEFAULT NULL, +col17 INTEGER DEFAULT NULL, +col18 INTEGER DEFAULT NULL, +col19 INTEGER DEFAULT NULL, +col20 INTEGER DEFAULT NULL, +col21 INTEGER DEFAULT NULL, +col22 INTEGER DEFAULT NULL, +col23 INTEGER DEFAULT NULL, +col24 INTEGER DEFAULT NULL, +col25 INTEGER DEFAULT NULL, +col26 INTEGER DEFAULT NULL, +col27 INTEGER DEFAULT NULL, +col28 INTEGER DEFAULT NULL, +col29 INTEGER DEFAULT NULL, +col30 INTEGER DEFAULT NULL, +col31 INTEGER DEFAULT NULL, +col32 INTEGER DEFAULT NULL, +col33 INTEGER DEFAULT NULL, +col34 INTEGER DEFAULT NULL, +col35 INTEGER DEFAULT NULL, +col36 INTEGER DEFAULT NULL, +col37 INTEGER DEFAULT NULL, +col38 INTEGER DEFAULT NULL, +col39 INTEGER DEFAULT NULL, +col40 INTEGER DEFAULT NULL, +col41 INTEGER DEFAULT NULL, +col42 INTEGER DEFAULT NULL, +col43 INTEGER DEFAULT NULL, +col44 INTEGER DEFAULT NULL, +col45 INTEGER DEFAULT NULL, +col46 INTEGER DEFAULT NULL, +col47 INTEGER DEFAULT NULL, +col48 INTEGER DEFAULT NULL, +col49 INTEGER DEFAULT NULL, +col50 INTEGER DEFAULT NULL, +col51 INTEGER DEFAULT NULL, +col52 INTEGER DEFAULT NULL, +col53 INTEGER DEFAULT NULL, +col54 INTEGER DEFAULT NULL, +col55 INTEGER DEFAULT NULL, +col56 INTEGER DEFAULT NULL, +col57 INTEGER DEFAULT NULL, +col58 INTEGER DEFAULT NULL, +col59 INTEGER DEFAULT NULL, +col60 INTEGER DEFAULT NULL, +col61 INTEGER DEFAULT NULL, +col62 INTEGER DEFAULT NULL, +col63 INTEGER DEFAULT NULL, +col64 INTEGER DEFAULT NULL, +col65 INTEGER DEFAULT NULL, +gcol2 INTEGER GENERATED ALWAYS AS (col3 / col4) VIRTUAL, +KEY idx1 (gcol1) +); +INSERT INTO t1 (col1, col2, col3, col4) +VALUES (1,1,1,1), (2,2,2,2), (3,3,3,3), (4,4,4,4), (5,5,5,5); +ALTER TABLE t1 ADD COLUMN extra INTEGER; +SELECT gcol1 FROM t1 FORCE INDEX(idx1); +gcol1 +2 +4 +6 +8 +10 +DROP TABLE t1; +CREATE TABLE t1 ( +col1 INTEGER NOT NULL, +col2 INTEGER NOT NULL, +gcol1 INTEGER GENERATED ALWAYS AS (col1 + col2) VIRTUAL, +col3 INTEGER NOT NULL, +col4 INTEGER NOT NULL, +col5 INTEGER DEFAULT NULL, +col6 INTEGER DEFAULT NULL, +col7 INTEGER DEFAULT NULL, +col8 INTEGER DEFAULT NULL, +col9 INTEGER DEFAULT NULL, +col10 INTEGER DEFAULT NULL, +col11 INTEGER DEFAULT NULL, +col12 INTEGER DEFAULT NULL, +col13 INTEGER DEFAULT NULL, +col14 INTEGER DEFAULT NULL, +col15 INTEGER DEFAULT NULL, +col16 INTEGER DEFAULT NULL, +col17 INTEGER DEFAULT NULL, +col18 INTEGER DEFAULT NULL, +col19 INTEGER DEFAULT NULL, +col20 INTEGER DEFAULT NULL, +col21 INTEGER DEFAULT NULL, +col22 INTEGER DEFAULT NULL, +col23 INTEGER DEFAULT NULL, +col24 INTEGER DEFAULT NULL, +col25 INTEGER DEFAULT NULL, +col26 INTEGER DEFAULT NULL, +col27 INTEGER DEFAULT NULL, +col28 INTEGER DEFAULT NULL, +col29 INTEGER DEFAULT NULL, +col30 INTEGER DEFAULT NULL, +col31 INTEGER DEFAULT NULL, +col32 INTEGER DEFAULT NULL, +col33 INTEGER DEFAULT NULL, +col34 INTEGER DEFAULT NULL, +col35 INTEGER DEFAULT NULL, +col36 INTEGER DEFAULT NULL, +col37 INTEGER DEFAULT NULL, +col38 INTEGER DEFAULT NULL, +col39 INTEGER DEFAULT NULL, +col40 INTEGER DEFAULT NULL, +col41 INTEGER DEFAULT NULL, +col42 INTEGER DEFAULT NULL, +col43 INTEGER DEFAULT NULL, +col44 INTEGER DEFAULT NULL, +col45 INTEGER DEFAULT NULL, +col46 INTEGER DEFAULT NULL, +col47 INTEGER DEFAULT NULL, +col48 INTEGER DEFAULT NULL, +col49 INTEGER DEFAULT NULL, +col50 INTEGER DEFAULT NULL, +col51 INTEGER DEFAULT NULL, +col52 INTEGER DEFAULT NULL, +col53 INTEGER DEFAULT NULL, +col54 INTEGER DEFAULT NULL, +col55 INTEGER DEFAULT NULL, +col56 INTEGER DEFAULT NULL, +col57 INTEGER DEFAULT NULL, +col58 INTEGER DEFAULT NULL, +col59 INTEGER DEFAULT NULL, +col60 INTEGER DEFAULT NULL, +col61 INTEGER DEFAULT NULL, +col62 INTEGER DEFAULT NULL, +col63 INTEGER DEFAULT NULL, +col64 INTEGER DEFAULT NULL, +col65 INTEGER DEFAULT NULL, +gcol2 INTEGER GENERATED ALWAYS AS (col3 / col4) VIRTUAL, +KEY idx1 (gcol2) +); +INSERT INTO t1 (col1, col2, col3, col4) +VALUES (1,1,1,1), (2,2,2,2), (3,3,3,3), (4,4,4,4), (5,5,5,5); +ALTER TABLE t1 ADD COLUMN extra INTEGER; +SELECT gcol2 FROM t1 FORCE INDEX(idx1); +gcol2 +1 +1 +1 +1 +1 +DROP TABLE t1; +# +# Bug#21628161 CRASH/MEMORY CORRUPTION ADDING INDEXES TO VIRTUAL COLUMN +# +CREATE TABLE t (a INT, +b BOOLEAN GENERATED ALWAYS AS (a+10000) VIRTUAL, +c BLOB GENERATED ALWAYS AS (b=2) VIRTUAL); +INSERT INTO t(a) VALUES (1); +SELECT * FROM t WHERE c = '0'; +a b c +1 127 0 +ALTER TABLE t ADD UNIQUE INDEX (c(1)); +Warnings: +Warning 1264 Out of range value for column 'b' at row 1 +SELECT * FROM t WHERE c = '0'; +a b c +1 127 0 +DROP TABLE t; +# +# Bug#21688115 VIRTUAL COLUMN COMPUTATION SAVE_IN_FIELD() +# DID NOT RETURN TRUE WITH DIVIDE 0 +# +CREATE TABLE t (a INT, b INT, h VARCHAR(10)); +INSERT INTO t VALUES (12, 3, "ss"); +INSERT INTO t VALUES (13, 4, "ss"); +INSERT INTO t VALUES (14, 0, "ss"); +ALTER TABLE t ADD c INT GENERATED ALWAYS AS (a/b) VIRTUAL; +CREATE INDEX idx ON t(c); +CALL mtr.add_suppression("\\[Warning\\] InnoDB: Compute virtual column values failed"); +DROP TABLE t; +# +# Bug#21770798 OPTIMIZER DOES NOT USE INDEX FOR GENERATED EXPRESSIONS +# WITH LOGICAL OPERATORS +# +CREATE TABLE t (a INT, b INT, +gc_and INT GENERATED ALWAYS AS (a AND b) STORED, +gc_or INT GENERATED ALWAYS AS (a OR b) STORED, +gc_xor INT GENERATED ALWAYS AS (a XOR b) STORED, +gc_not INT GENERATED ALWAYS AS (NOT a) STORED, +gc_case INT GENERATED ALWAYS AS +(CASE WHEN (a AND b) THEN a ELSE b END) STORED, +INDEX(gc_and), INDEX(gc_or), INDEX(gc_xor), INDEX(gc_not), +INDEX(gc_case)); +INSERT INTO t (a, b) VALUES (0, 0), (0, 1), (1, 0), (1, 1); +ANALYZE TABLE t; +Table Op Msg_type Msg_text +test.t analyze status OK +EXPLAIN SELECT a, b FROM t WHERE (a AND b) = 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t ALL NULL NULL NULL NULL 4 Using where +SELECT a, b FROM t WHERE (a AND b) = 1; +a b +1 1 +EXPLAIN SELECT a, b FROM t WHERE 1 = (a AND b); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t ALL NULL NULL NULL NULL 4 Using where +SELECT a, b FROM t WHERE 1 = (a AND b); +a b +1 1 +EXPLAIN SELECT a, b FROM t WHERE (a AND b) IN (1, 2, 3); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t ALL NULL NULL NULL NULL 4 Using where +SELECT a, b FROM t WHERE (a AND b) IN (1, 2, 3); +a b +1 1 +EXPLAIN SELECT a, b FROM t WHERE (a OR b) = 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t ALL NULL NULL NULL NULL 4 Using where +SELECT a, b FROM t WHERE (a OR b) = 1; +a b +0 1 +1 0 +1 1 +EXPLAIN SELECT a, b FROM t WHERE (a OR b) BETWEEN 1 AND 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t ALL NULL NULL NULL NULL 4 Using where +SELECT a, b FROM t WHERE (a OR b) BETWEEN 1 AND 10; +a b +0 1 +1 0 +1 1 +EXPLAIN SELECT a, b FROM t WHERE (a XOR b) = 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t ALL NULL NULL NULL NULL 4 Using where +SELECT a, b FROM t WHERE (a XOR b) = 1; +a b +0 1 +1 0 +EXPLAIN SELECT a FROM t WHERE (NOT a) = 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t ALL NULL NULL NULL NULL 4 Using where +SELECT a FROM t WHERE (NOT a) = 1; +a +0 +0 +EXPLAIN SELECT a FROM t WHERE (CASE WHEN (a AND b) THEN a ELSE b END) = 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t ALL NULL NULL NULL NULL 4 Using where +SELECT a FROM t WHERE (CASE WHEN (a AND b) THEN a ELSE b END) = 1; +a +0 +1 +EXPLAIN SELECT a, b FROM t WHERE 1 = (b AND a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t ALL NULL NULL NULL NULL 4 Using where +SELECT a, b FROM t WHERE 1 = (b AND a); +a b +1 1 +EXPLAIN SELECT a, b FROM t WHERE 1 = (b OR a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t ALL NULL NULL NULL NULL 4 Using where +SELECT a, b FROM t WHERE 1 = (b OR a); +a b +0 1 +1 0 +1 1 +DROP TABLE t; +# +# Bug#22810883: ASSERTION FAILED: +# !(USED_TABS & (~READ_TABLES & ~FILTER_FOR_TABLE)) +# +CREATE TABLE t1 (a1 INTEGER GENERATED ALWAYS AS (1 AND 0) STORED, +a2 INTEGER, KEY (a1)); +INSERT INTO t1 VALUES (); +CREATE TABLE t2 (b INTEGER); +INSERT INTO t2 VALUES (1); +ANALYZE TABLE t1, t2; +Table Op Msg_type Msg_text +test.t1 analyze status OK +test.t2 analyze status OK +# Used to choose the index on a1 and get wrong results. +EXPLAIN SELECT * FROM t1 WHERE (a2 AND a2) = 0; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +SELECT * FROM t1 WHERE (a2 AND a2) = 0; +a1 a2 +# Used to get assertion or wrong results. +EXPLAIN SELECT * FROM t1 STRAIGHT_JOIN t2 ON b WHERE (b AND b) = 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 system NULL NULL NULL NULL 1 +SELECT * FROM t1 STRAIGHT_JOIN t2 ON b WHERE (b AND b) = 1; +a1 a2 b +0 NULL 1 +DROP TABLE t1, t2; +# +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_memory.result b/mysql-test/suite/gcol/r/gcol_memory.result new file mode 100644 index 00000000000..b7ce08b6376 --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_memory.result @@ -0,0 +1,14 @@ +SET @@session.default_storage_engine = 'memory'; +create table t1 (a int, b int generated always as (a+1) virtual); +ERROR HY000: MEMORY storage engine does not support generated columns +create table t1 (a int); +alter table t1 add column b int generated always as (a+1) virtual; +ERROR HY000: MEMORY storage engine does not support generated columns +drop table t1; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_merge.result b/mysql-test/suite/gcol/r/gcol_merge.result new file mode 100644 index 00000000000..bffe62655a1 --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_merge.result @@ -0,0 +1,15 @@ +drop table if exists t1, t2, t3; +create table t1 (a int, b int generated always as (a % 10) virtual); +create table t2 (a int, b int generated always as (a % 10) virtual); +insert into t1 values (1,default); +insert into t2 values (2,default); +create table t3 (a int, b int generated always as (a % 10) virtual) engine=MERGE UNION=(t1,t2); +ERROR HY000: MRG_MyISAM storage engine does not support generated columns +drop table t1,t2; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_ndb.result b/mysql-test/suite/gcol/r/gcol_ndb.result new file mode 100644 index 00000000000..4c1c2a446e9 --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_ndb.result @@ -0,0 +1,14 @@ +SET @@session.default_storage_engine = 'ndbcluster'; +create table t1 (a int, b int generated always as (a+1) virtual); +ERROR HY000: 'Specified storage engine' is not supported for generated columns. +create table t1 (a int); +alter table t1 add column b int generated always as (a+1) virtual; +ERROR HY000: 'Specified storage engine' is not supported for generated columns. +drop table t1; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_non_stored_columns_innodb.result b/mysql-test/suite/gcol/r/gcol_non_stored_columns_innodb.result new file mode 100644 index 00000000000..d0a00b6221e --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_non_stored_columns_innodb.result @@ -0,0 +1,237 @@ +SET @@session.default_storage_engine = 'InnoDB'; +# Case 1. All non-stored columns. +create table t1 (a int generated always as (2+3) virtual); +insert into t1 values (default); +select * from t1; +a +5 +insert into t1 values (default); +select * from t1; +a +5 +5 +drop table t1; +# Case 2. CREATE +# - Column1: "real" +# - Column 2: virtual non-stored +create table t1 (a int, b int generated always as (-a) virtual); +insert into t1 values (1,default); +select * from t1; +a b +1 -1 +insert into t1 values (2,default); +select * from t1 order by a; +a b +1 -1 +2 -2 +drop table t1; +# Case 3. CREATE +# - Column1: "real" +# - Column 2: virtual stored +create table t1 (a int, b int generated always as (-a) stored); +insert into t1 values (1,default); +select * from t1; +a b +1 -1 +insert into t1 values (2,default); +select * from t1 order by a; +a b +1 -1 +2 -2 +drop table t1; +# Case 4. CREATE +# - Column1: virtual non-stored +# - Column2: "real" +create table t1 (a int generated always as (-b) virtual, b int); +insert into t1 values (default,1); +select * from t1; +a b +-1 1 +insert into t1 values (default,2); +select * from t1 order by a; +a b +-2 2 +-1 1 +drop table t1; +# Case 5. CREATE +# - Column1: virtual stored +# - Column2: "real" +create table t1 (a int generated always as (-b) stored, b int); +insert into t1 values (default,1); +select * from t1; +a b +-1 1 +insert into t1 values (default,2); +select * from t1 order by a; +a b +-2 2 +-1 1 +drop table t1; +# Case 6. CREATE +# - Column1: "real" +# - Column2: virtual non-stored +# - Column3: virtual stored +create table t1 (a int, b int generated always as (-a), c int generated always as (-a) stored); +insert into t1 values (1,default,default); +select * from t1; +a b c +1 -1 -1 +insert into t1 values (2,default,default); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +drop table t1; +# Case 7. ALTER. Modify virtual stored -> virtual non-stored +create table t1 (a int, b int generated always as (a % 2) stored); +alter table t1 modify b int generated always as (a % 2) virtual; +ERROR HY000: This is not yet supported for generated columns +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 2) STORED +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1; +# Case 8. ALTER. Modify virtual non-stored -> virtual stored +create table t1 (a int, b int generated always as (a % 2) virtual); +alter table t1 modify b int generated always as (a % 2) stored; +ERROR HY000: This is not yet supported for generated columns +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1; +# Case 9. CREATE LIKE +# - Column1: "real" +# - Column2: virtual non-stored +# - Column3: virtual stored +create table t1 (a int, b int generated always as (-a), c int generated always as (-a) stored); +create table t2 like t1; +insert into t2 values (1,default,default); +select * from t2; +a b c +1 -1 -1 +insert into t2 values (2,default,default); +select * from t2 order by a; +a b c +1 -1 -1 +2 -2 -2 +drop table t2; +drop table t1; +# Case 10. ALTER. Dropping a virtual non-stored column. +# - Column1: virtual non-stored +# - Column2: "real" +create table t1 (a int generated always as (-b) virtual, b int, c varchar(5)); +insert into t1 values (default,1,'v1'); +insert into t1 values (default,2,'v2'); +select * from t1 order by b; +a b c +-1 1 v1 +-2 2 v2 +alter table t1 drop column a; +select * from t1 order by b; +b c +1 v1 +2 v2 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `c` varchar(5) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1; +# Case 11. ALTER. Dropping a virtual stored column. +# - Column1: virtual stored +# - Column2: "real" +create table t1 (a int generated always as (-b) stored, b int, c char(5)); +insert into t1 values (default,1,'v1'); +insert into t1 values (default,2,'v2'); +select * from t1 order by b; +a b c +-1 1 v1 +-2 2 v2 +alter table t1 drop column a; +select * from t1 order by b; +b c +1 v1 +2 v2 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `c` char(5) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1; +# Case 12. ALTER. Adding a new virtual non-stored column. +create table t1 (a int, b datetime); +insert into t1 values (1,'2008-09-04'); +insert into t1 values (2,'2008-09-05'); +select * from t1 order by a; +a b +1 2008-09-04 00:00:00 +2 2008-09-05 00:00:00 +alter table t1 add column c int generated always as (dayofyear(b)) virtual after a; +select * from t1 order by a; +a c b +1 248 2008-09-04 00:00:00 +2 249 2008-09-05 00:00:00 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (dayofyear(`b`)) VIRTUAL, + `b` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1; +# Case 13. ALTER. Adding a new virtual stored column. +create table t1 (a int, b datetime); +insert into t1 values (1,'2008-09-04'); +insert into t1 values (2,'2008-09-05'); +select * from t1 order by a; +a b +1 2008-09-04 00:00:00 +2 2008-09-05 00:00:00 +alter table t1 add column c int generated always as (dayofyear(b)) stored after a; +select * from t1 order by a; +a c b +1 248 2008-09-04 00:00:00 +2 249 2008-09-05 00:00:00 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (dayofyear(`b`)) STORED, + `b` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1; +# Case 15. ALTER. Changing the expression of a virtual non-stored column. +create table t1 (a int, b datetime, c int generated always as (week(b)) virtual); +insert into t1 values (1,'2008-09-04',default); +insert into t1 values (2,'2008-09-05',default); +select * from t1 order by a; +a b c +1 2008-09-04 00:00:00 35 +2 2008-09-05 00:00:00 35 +alter table t1 change column c c int generated always as (week(b,1)) virtual; +select * from t1 order by a; +a b c +1 2008-09-04 00:00:00 36 +2 2008-09-05 00:00:00 36 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` datetime DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (week(`b`,1)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_non_stored_columns_myisam.result b/mysql-test/suite/gcol/r/gcol_non_stored_columns_myisam.result new file mode 100644 index 00000000000..1ed96d0345b --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_non_stored_columns_myisam.result @@ -0,0 +1,237 @@ +SET @@session.default_storage_engine = 'MyISAM'; +# Case 1. All non-stored columns. +create table t1 (a int generated always as (2+3) virtual); +insert into t1 values (default); +select * from t1; +a +5 +insert into t1 values (default); +select * from t1; +a +5 +5 +drop table t1; +# Case 2. CREATE +# - Column1: "real" +# - Column 2: virtual non-stored +create table t1 (a int, b int generated always as (-a) virtual); +insert into t1 values (1,default); +select * from t1; +a b +1 -1 +insert into t1 values (2,default); +select * from t1 order by a; +a b +1 -1 +2 -2 +drop table t1; +# Case 3. CREATE +# - Column1: "real" +# - Column 2: virtual stored +create table t1 (a int, b int generated always as (-a) stored); +insert into t1 values (1,default); +select * from t1; +a b +1 -1 +insert into t1 values (2,default); +select * from t1 order by a; +a b +1 -1 +2 -2 +drop table t1; +# Case 4. CREATE +# - Column1: virtual non-stored +# - Column2: "real" +create table t1 (a int generated always as (-b) virtual, b int); +insert into t1 values (default,1); +select * from t1; +a b +-1 1 +insert into t1 values (default,2); +select * from t1 order by a; +a b +-2 2 +-1 1 +drop table t1; +# Case 5. CREATE +# - Column1: virtual stored +# - Column2: "real" +create table t1 (a int generated always as (-b) stored, b int); +insert into t1 values (default,1); +select * from t1; +a b +-1 1 +insert into t1 values (default,2); +select * from t1 order by a; +a b +-2 2 +-1 1 +drop table t1; +# Case 6. CREATE +# - Column1: "real" +# - Column2: virtual non-stored +# - Column3: virtual stored +create table t1 (a int, b int generated always as (-a), c int generated always as (-a) stored); +insert into t1 values (1,default,default); +select * from t1; +a b c +1 -1 -1 +insert into t1 values (2,default,default); +select * from t1 order by a; +a b c +1 -1 -1 +2 -2 -2 +drop table t1; +# Case 7. ALTER. Modify virtual stored -> virtual non-stored +create table t1 (a int, b int generated always as (a % 2) stored); +alter table t1 modify b int generated always as (a % 2) virtual; +ERROR HY000: This is not yet supported for generated columns +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 2) STORED +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +# Case 8. ALTER. Modify virtual non-stored -> virtual stored +create table t1 (a int, b int generated always as (a % 2) virtual); +alter table t1 modify b int generated always as (a % 2) stored; +ERROR HY000: This is not yet supported for generated columns +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +# Case 9. CREATE LIKE +# - Column1: "real" +# - Column2: virtual non-stored +# - Column3: virtual stored +create table t1 (a int, b int generated always as (-a), c int generated always as (-a) stored); +create table t2 like t1; +insert into t2 values (1,default,default); +select * from t2; +a b c +1 -1 -1 +insert into t2 values (2,default,default); +select * from t2 order by a; +a b c +1 -1 -1 +2 -2 -2 +drop table t2; +drop table t1; +# Case 10. ALTER. Dropping a virtual non-stored column. +# - Column1: virtual non-stored +# - Column2: "real" +create table t1 (a int generated always as (-b) virtual, b int, c varchar(5)); +insert into t1 values (default,1,'v1'); +insert into t1 values (default,2,'v2'); +select * from t1 order by b; +a b c +-1 1 v1 +-2 2 v2 +alter table t1 drop column a; +select * from t1 order by b; +b c +1 v1 +2 v2 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `c` varchar(5) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +# Case 11. ALTER. Dropping a virtual stored column. +# - Column1: virtual stored +# - Column2: "real" +create table t1 (a int generated always as (-b) stored, b int, c char(5)); +insert into t1 values (default,1,'v1'); +insert into t1 values (default,2,'v2'); +select * from t1 order by b; +a b c +-1 1 v1 +-2 2 v2 +alter table t1 drop column a; +select * from t1 order by b; +b c +1 v1 +2 v2 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `c` char(5) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +# Case 12. ALTER. Adding a new virtual non-stored column. +create table t1 (a int, b datetime); +insert into t1 values (1,'2008-09-04'); +insert into t1 values (2,'2008-09-05'); +select * from t1 order by a; +a b +1 2008-09-04 00:00:00 +2 2008-09-05 00:00:00 +alter table t1 add column c int generated always as (dayofyear(b)) virtual after a; +select * from t1 order by a; +a c b +1 248 2008-09-04 00:00:00 +2 249 2008-09-05 00:00:00 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (dayofyear(`b`)) VIRTUAL, + `b` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +# Case 13. ALTER. Adding a new virtual stored column. +create table t1 (a int, b datetime); +insert into t1 values (1,'2008-09-04'); +insert into t1 values (2,'2008-09-05'); +select * from t1 order by a; +a b +1 2008-09-04 00:00:00 +2 2008-09-05 00:00:00 +alter table t1 add column c int generated always as (dayofyear(b)) stored after a; +select * from t1 order by a; +a c b +1 248 2008-09-04 00:00:00 +2 249 2008-09-05 00:00:00 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (dayofyear(`b`)) STORED, + `b` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +# Case 15. ALTER. Changing the expression of a virtual non-stored column. +create table t1 (a int, b datetime, c int generated always as (week(b)) virtual); +insert into t1 values (1,'2008-09-04',default); +insert into t1 values (2,'2008-09-05',default); +select * from t1 order by a; +a b c +1 2008-09-04 00:00:00 35 +2 2008-09-05 00:00:00 35 +alter table t1 change column c c int generated always as (week(b,1)) virtual; +select * from t1 order by a; +a b c +1 2008-09-04 00:00:00 36 +2 2008-09-05 00:00:00 36 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` datetime DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (week(`b`,1)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_partition_innodb.result b/mysql-test/suite/gcol/r/gcol_partition_innodb.result new file mode 100644 index 00000000000..9a0e676e76f --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_partition_innodb.result @@ -0,0 +1,95 @@ +SET @@session.default_storage_engine = 'InnoDB'; +drop table if exists t1; +# Case 1. Partitioning by RANGE based on a non-stored generated column. +CREATE TABLE t1 ( +a DATE NOT NULL, +b int generated always as (year(a)) virtual +) +PARTITION BY RANGE( b ) ( +PARTITION p0 VALUES LESS THAN (2006), +PARTITION p2 VALUES LESS THAN (2008) +); +insert into t1 values ('2006-01-01',default); +insert into t1 values ('2007-01-01',default); +insert into t1 values ('2005-01-01',default); +select * from t1; +a b +2005-01-01 2005 +2006-01-01 2006 +2007-01-01 2007 +# Modify the expression of generated column b +ALTER TABLE t1 modify b int generated always as (year(a)-1) virtual; +select * from t1; +a b +2005-01-01 2004 +2006-01-01 2005 +2007-01-01 2006 +drop table t1; +# Case 2. Partitioning by LIST based on a stored generated column. +CREATE TABLE t1 (a int, b int generated always as (a % 3 ) stored) +PARTITION BY LIST (a+1) +(PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2)); +insert into t1 values (1,default); +select * from t1; +a b +1 1 +select * from t1; +a b +1 1 +drop table t1; +# Case 3. Partitioning by HASH based on a non-stored generated column. +CREATE TABLE t1 ( +a DATE NOT NULL, +b int generated always as (year(a)) virtual +) +PARTITION BY HASH( b % 3 ) PARTITIONS 3; +insert into t1 values ('2005-01-01',default); +insert into t1 values ('2006-01-01',default); +select * from t1; +a b +2005-01-01 2005 +2006-01-01 2006 +# Modify the expression of generated column b +ALTER TABLE t1 modify b int generated always as (year(a)-1) virtual; +select * from t1; +a b +2005-01-01 2004 +2006-01-01 2005 +drop table t1; +# +# Bug#21779011 INVALID READS AND SENDING RANDOM SERVER MEMORY BACK +# TO CLIENT +# +CREATE TABLE t ( +c INTEGER GENERATED ALWAYS AS (2) VIRTUAL, +d INTEGER, +KEY (d) +) PARTITION BY KEY (d) PARTITIONS 2; +INSERT INTO t (d) VALUES (1),(1),(2),(2); +SELECT c FROM t WHERE d >= 1 GROUP BY d LIMIT 2; +c +2 +2 +DROP TABLE t; +# +# Bug#21779554: CHECK_MISPLACED_ROWS BOGUS "FOUND A MISPLACED ROW" +# AND CRASHES +# +CREATE TABLE t(a INT,b INT GENERATED ALWAYS AS (1) VIRTUAL,c INT) +PARTITION BY KEY (b)PARTITIONS 6; +INSERT INTO t VALUES(); +CHECK TABLE t EXTENDED; +Table Op Msg_type Msg_text +test.t check status OK +FLUSH TABLES; +CHECK TABLE t EXTENDED; +Table Op Msg_type Msg_text +test.t check status OK +DROP TABLE t; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_partition_myisam.result b/mysql-test/suite/gcol/r/gcol_partition_myisam.result new file mode 100644 index 00000000000..81324da6fcd --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_partition_myisam.result @@ -0,0 +1,95 @@ +SET @@session.default_storage_engine = 'MyISAM'; +drop table if exists t1; +# Case 1. Partitioning by RANGE based on a non-stored generated column. +CREATE TABLE t1 ( +a DATE NOT NULL, +b int generated always as (year(a)) virtual +) +PARTITION BY RANGE( b ) ( +PARTITION p0 VALUES LESS THAN (2006), +PARTITION p2 VALUES LESS THAN (2008) +); +insert into t1 values ('2006-01-01',default); +insert into t1 values ('2007-01-01',default); +insert into t1 values ('2005-01-01',default); +select * from t1; +a b +2005-01-01 2005 +2006-01-01 2006 +2007-01-01 2007 +# Modify the expression of generated column b +ALTER TABLE t1 modify b int generated always as (year(a)-1) virtual; +select * from t1; +a b +2005-01-01 2004 +2006-01-01 2005 +2007-01-01 2006 +drop table t1; +# Case 2. Partitioning by LIST based on a stored generated column. +CREATE TABLE t1 (a int, b int generated always as (a % 3 ) stored) +PARTITION BY LIST (a+1) +(PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2)); +insert into t1 values (1,default); +select * from t1; +a b +1 1 +select * from t1; +a b +1 1 +drop table t1; +# Case 3. Partitioning by HASH based on a non-stored generated column. +CREATE TABLE t1 ( +a DATE NOT NULL, +b int generated always as (year(a)) virtual +) +PARTITION BY HASH( b % 3 ) PARTITIONS 3; +insert into t1 values ('2005-01-01',default); +insert into t1 values ('2006-01-01',default); +select * from t1; +a b +2005-01-01 2005 +2006-01-01 2006 +# Modify the expression of generated column b +ALTER TABLE t1 modify b int generated always as (year(a)-1) virtual; +select * from t1; +a b +2005-01-01 2004 +2006-01-01 2005 +drop table t1; +# +# Bug#21779011 INVALID READS AND SENDING RANDOM SERVER MEMORY BACK +# TO CLIENT +# +CREATE TABLE t ( +c INTEGER GENERATED ALWAYS AS (2) VIRTUAL, +d INTEGER, +KEY (d) +) PARTITION BY KEY (d) PARTITIONS 2; +INSERT INTO t (d) VALUES (1),(1),(2),(2); +SELECT c FROM t WHERE d >= 1 GROUP BY d LIMIT 2; +c +2 +2 +DROP TABLE t; +# +# Bug#21779554: CHECK_MISPLACED_ROWS BOGUS "FOUND A MISPLACED ROW" +# AND CRASHES +# +CREATE TABLE t(a INT,b INT GENERATED ALWAYS AS (1) VIRTUAL,c INT) +PARTITION BY KEY (b)PARTITIONS 6; +INSERT INTO t VALUES(); +CHECK TABLE t EXTENDED; +Table Op Msg_type Msg_text +test.t check status OK +FLUSH TABLES; +CHECK TABLE t EXTENDED; +Table Op Msg_type Msg_text +test.t check status OK +DROP TABLE t; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_rejected_innodb.result b/mysql-test/suite/gcol/r/gcol_rejected_innodb.result new file mode 100644 index 00000000000..b8d0db567ca --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_rejected_innodb.result @@ -0,0 +1,8 @@ +SET @@session.default_storage_engine = 'InnoDB'; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_rollback.result b/mysql-test/suite/gcol/r/gcol_rollback.result new file mode 100644 index 00000000000..3fe40d1eccd --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_rollback.result @@ -0,0 +1,87 @@ +CREATE TABLE t ( +a INTEGER, +b BLOB GENERATED ALWAYS AS (a) VIRTUAL, +INDEX (b(57)) +)ENGINE=INNODB; +INSERT INTO t (a) VALUES (9); +BEGIN; +SAVEPOINT a; +UPDATE t set a = 12; +DELETE FROM t where a = 12; +ROLLBACK TO SAVEPOINT a; +COMMIT; +CHECK TABLE t; +Table Op Msg_type Msg_text +test.t check status OK +SELECT * FROM t; +a b +9 9 +BEGIN; +INSERT INTO t (a) VALUES (10); +SELECT * FROM t; +a b +9 9 +DROP TABLE t; +CREATE TABLE t ( +a INTEGER, +b BLOB GENERATED ALWAYS AS (a) VIRTUAL, +c INTEGER +)ENGINE=INNODB; +INSERT INTO t (a,c) VALUES (9, 10); +SELECT * FROM t; +a b c +9 9 10 +connect con1,localhost,root,,; +connection con1; +SET DEBUG_SYNC = 'row_log_apply_after SIGNAL created WAIT_FOR dml_done'; +ALTER TABLE t ADD KEY(b(57)), ALGORITHM=INPLACE; +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR created'; +BEGIN; +INSERT INTO t (a,c) VALUES (10, 12); +SELECT * FROM t; +a b c +9 9 10 +10 10 12 +ROLLBACK; +SET DEBUG_SYNC = 'now SIGNAL dml_done'; +connection con1; +disconnect con1; +connection default; +SELECT * FROM t; +a b c +9 9 10 +DROP TABLE t; +CREATE TABLE t ( +a INT, +b INT, +c INT GENERATED ALWAYS AS(a+b), +d INT GENERATED ALWAYS AS(a+b+b), +KEY(c, d) +)ENGINE=INNODB; +INSERT INTO t (a,b) VALUES (9, 10); +SELECT * FROM t; +a b c d +9 10 19 29 +connect con1,localhost,root,,; +connection con1; +SET DEBUG_SYNC = 'row_log_apply_after SIGNAL created WAIT_FOR dml_done'; +ALTER TABLE t DROP COLUMN c, ALGORITHM=INPLACE; +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR created'; +BEGIN; +INSERT INTO t (a,b) VALUES (10, 12); +SELECT * FROM t; +a b c d +9 10 19 29 +10 12 22 34 +ROLLBACK; +SET DEBUG_SYNC = 'now SIGNAL dml_done'; +connection con1; +disconnect con1; +connection default; +SELECT * FROM t; +a b d +9 10 29 +DROP TABLE t; +SET DEBUG_SYNC = 'RESET'; diff --git a/mysql-test/suite/gcol/r/gcol_select_innodb.result b/mysql-test/suite/gcol/r/gcol_select_innodb.result new file mode 100644 index 00000000000..24daadb0d5b --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_select_innodb.result @@ -0,0 +1,978 @@ +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; +SET @@session.default_storage_engine = 'InnoDB'; +SET optimizer_switch='derived_merge=off'; +create table t1 (a int, +b int generated always as (-a) virtual, +c int generated always as (-a) stored, +index (c)); +insert into t1 (a) values (2), (1), (1), (3), (NULL); +create table t2 like t1; +insert into t2 (a) values (1); +create table t3 (a int primary key, +b int generated always as (-a) virtual, +c int generated always as (-a) stored unique); +insert into t3 (a) values (2),(1),(3); +analyze table t1,t2,t3; +Table Op Msg_type Msg_text +test.t1 analyze status OK +test.t2 analyze status OK +test.t3 analyze status OK +# select_type=SIMPLE, type=system +select * from t2; +a b c +1 -1 -1 +explain select * from t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 1 +select * from t2 where c=-1; +a b c +1 -1 -1 +explain select * from t2 where c=-1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref c c 5 const 1 +# select_type=SIMPLE, type=ALL +select * from t1 where b=-1; +a b c +1 -1 -1 +1 -1 -1 +explain select * from t1 where b=-1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +# select_type=SIMPLE, type=const +select * from t3 where a=1; +a b c +1 -1 -1 +explain select * from t3 where a=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 const PRIMARY PRIMARY 4 const 1 +# select_type=SIMPLE, type=range +select * from t3 where c>=-1; +a b c +1 -1 -1 +explain select * from t3 where c>=-1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 range c c 5 NULL 1 Using index condition +# select_type=SIMPLE, type=ref +select * from t1,t3 where t1.c=t3.c and t3.c=-1; +a b c a b c +1 -1 -1 1 -1 -1 +1 -1 -1 1 -1 -1 +explain select * from t1,t3 where t1.c=t3.c and t3.c=-1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 const c c 5 const 1 +1 SIMPLE t1 ref c c 5 const 2 +# select_type=PRIMARY, type=index,ALL +select * from t1 where b in (select c from t3); +a b c +1 -1 -1 +1 -1 -1 +2 -2 -2 +3 -3 -3 +explain select * from t1 where b in (select c from t3); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t3 index c c 5 NULL 3 Using index +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +# select_type=PRIMARY, type=range,ref +select * from t1 where c in (select c from t3 where c between -2 and -1); +a b c +1 -1 -1 +1 -1 -1 +2 -2 -2 +explain select * from t1 where c in (select c from t3 where c between -2 and -1); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t3 index c c 5 NULL 3 Using where; Using index +1 PRIMARY t1 ALL c NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +# select_type=UNION, type=system +# select_type=UNION RESULT, type= +select * from t1 union select * from t2; +a b c +1 -1 -1 +2 -2 -2 +3 -3 -3 +NULL NULL NULL +explain select * from t1 union select * from t2; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 +2 UNION t2 ALL NULL NULL NULL NULL 1 +NULL UNION RESULT ALL NULL NULL NULL NULL NULL +# select_type=DERIVED, type=system +select * from (select a,b,c from t1) as t11; +a b c +1 -1 -1 +1 -1 -1 +2 -2 -2 +3 -3 -3 +NULL NULL NULL +explain select * from (select a,b,c from t1) as t11; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 5 +2 DERIVED t1 ALL NULL NULL NULL NULL 5 +### +### Using aggregate functions with/without DISTINCT +### +# SELECT COUNT(*) FROM tbl_name +select count(*) from t1; +count(*) +5 +explain select count(*) from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL c 5 NULL 5 Using index +# SELECT COUNT(DISTINCT ) FROM tbl_name +select count(distinct a) from t1; +count(distinct a) +3 +explain select count(distinct a) from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 +# SELECT COUNT(DISTINCT ) FROM tbl_name +select count(distinct b) from t1; +count(distinct b) +3 +explain select count(distinct b) from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 +# SELECT COUNT(DISTINCT ) FROM tbl_name +select count(distinct c) from t1; +count(distinct c) +3 +explain select count(distinct c) from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range NULL c 5 NULL 6 Using index for group-by (scanning) +### +### filesort & range-based utils +### +# SELECT * FROM tbl_name WHERE +select * from t3 where c >= -2; +a b c +1 -1 -1 +2 -2 -2 +explain select * from t3 where c >= -2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 range c c 5 NULL 2 Using index condition +# SELECT * FROM tbl_name WHERE +select * from t3 where a between 1 and 2; +a b c +1 -1 -1 +2 -2 -2 +explain select * from t3 where a between 1 and 2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using where +# SELECT * FROM tbl_name WHERE +select * from t3 where b between -2 and -1; +a b c +1 -1 -1 +2 -2 -2 +explain select * from t3 where b between -2 and -1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where +# SELECT * FROM tbl_name WHERE +select * from t3 where c between -2 and -1; +a b c +1 -1 -1 +2 -2 -2 +explain select * from t3 where c between -2 and -1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 range c c 5 NULL 2 Using index condition +# SELECT * FROM tbl_name WHERE ORDER BY +select * from t3 where a between 1 and 2 order by b; +a b c +2 -2 -2 +1 -1 -1 +explain select * from t3 where a between 1 and 2 order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using where; Using filesort +# bug#20022189: WL411:DEBUG ASSERT AT FIELD_LONG::VAL_INT IN SQL/FIELD.CC +# SELECT * FROM tbl_name WHERE ORDER BY +select * from t3 where a between 1 and 2 order by c; +a b c +2 -2 -2 +1 -1 -1 +explain select * from t3 where a between 1 and 2 order by c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using where; Using filesort +# bug#20022189: WL411:DEBUG ASSERT AT FIELD_LONG::VAL_INT IN SQL/FIELD.CC +CREATE TABLE t4 ( +`pk` int(11) NOT NULL , +`col_int_nokey` int(11) GENERATED ALWAYS AS (pk + col_int_key) STORED, +`col_int_key` int(11) DEFAULT NULL, +`col_date_nokey` date DEFAULT NULL, +`col_datetime_key` datetime DEFAULT NULL, +PRIMARY KEY (`pk`), +KEY `col_int_key` (`col_int_key`), +KEY `col_datetime_key` (`col_datetime_key`) +); +INSERT INTO t4 VALUES +(1,default,4,'2008-12-05','1900-01-01 00:00:00'); +SELECT +SQL_BIG_RESULT +GRANDPARENT1 . `col_int_nokey` AS g1 +FROM t4 AS GRANDPARENT1 LEFT JOIN t4 AS GRANDPARENT2 ON ( GRANDPARENT2 . +`col_datetime_key` <= GRANDPARENT1 . `col_date_nokey` ) +GROUP BY GRANDPARENT1 . `pk`; +g1 +5 +DROP TABLE t4; +# SELECT * FROM tbl_name WHERE ORDER BY +select * from t3 where a between 1 and 2 order by c; +a b c +2 -2 -2 +1 -1 -1 +explain select * from t3 where a between 1 and 2 order by c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using where; Using filesort +# SELECT * FROM tbl_name WHERE ORDER BY +select * from t3 where b between -2 and -1 order by a; +a b c +1 -1 -1 +2 -2 -2 +explain select * from t3 where b between -2 and -1 order by a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 index NULL PRIMARY 4 NULL 3 Using where +# SELECT * FROM tbl_name WHERE ORDER BY +select * from t3 where b between -2 and -1 order by b; +a b c +2 -2 -2 +1 -1 -1 +explain select * from t3 where b between -2 and -1 order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Using filesort +# SELECT * FROM tbl_name WHERE ORDER BY +select * from t3 where c between -2 and -1 order by b; +a b c +2 -2 -2 +1 -1 -1 +explain select * from t3 where c between -2 and -1 order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 range c c 5 NULL 2 Using index condition; Using filesort +# SELECT * FROM tbl_name WHERE ORDER BY +select * from t3 where b between -2 and -1 order by c; +a b c +2 -2 -2 +1 -1 -1 +explain select * from t3 where b between -2 and -1 order by c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Using filesort +# SELECT * FROM tbl_name WHERE ORDER BY +select * from t3 where c between -2 and -1 order by c; +a b c +2 -2 -2 +1 -1 -1 +explain select * from t3 where c between -2 and -1 order by c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 range c c 5 NULL 2 Using index condition +# SELECT sum() FROM tbl_name GROUP BY +select sum(b) from t1 group by b; +sum(b) +NULL +-3 +-2 +-2 +explain select sum(b) from t1 group by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +# SELECT sum() FROM tbl_name GROUP BY +select sum(c) from t1 group by c; +sum(c) +NULL +-3 +-2 +-2 +explain select sum(c) from t1 group by c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL c 5 NULL 5 Using index +# SELECT sum() FROM tbl_name GROUP BY +select sum(b) from t1 group by c; +sum(b) +NULL +-3 +-2 +-2 +explain select sum(b) from t1 group by c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL c 5 NULL 5 +# SELECT sum() FROM tbl_name GROUP BY +select sum(c) from t1 group by b; +sum(c) +NULL +-3 +-2 +-2 +explain select sum(c) from t1 group by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +drop table t1; +# +# Bug#20241655: WL411:FAILING ASSERTION ASSERTION +# +CREATE TABLE BB ( +col_time_key time NOT NULL, +col_time_nokey time GENERATED ALWAYS AS (ADDTIME(col_datetime_key, col_time_key)) VIRTUAL, +col_datetime_key datetime NOT NULL); +INSERT INTO BB VALUES('23:28:02', default, '2005-03-15 22:48:25'); +Warnings: +Note 1265 Data truncated for column 'col_time_nokey' at row 1 +CREATE TABLE CC ( +col_time_key time NOT NULL, +col_time_nokey time GENERATED ALWAYS AS (ADDTIME(col_datetime_key, col_time_key)) VIRTUAL, +col_datetime_key datetime NOT NULL +); +INSERT INTO CC VALUES('16:22:51', default, '1900-01-01 00:00:00'); +Warnings: +Note 1265 Data truncated for column 'col_time_nokey' at row 1 +SELECT 1 AS g1 FROM BB AS gp1 LEFT JOIN BB AS gp2 USING ( col_time_nokey); +g1 +1 +DROP TABLE BB, CC; +# +# Bug#20328786: WL411:VALGRIND WARNINGS OF CONDITIONAL +# JUMP WHILE SELECTING FROM VIEW +# +CREATE TABLE A ( +pk INTEGER AUTO_INCREMENT, +col_int_nokey INTEGER, +col_int_key INTEGER GENERATED ALWAYS AS (2 + 2 + col_int_nokey) STORED, +PRIMARY KEY (pk) +); +CREATE TABLE C ( +pk INTEGER AUTO_INCREMENT, +col_int_nokey INTEGER, +col_int_key INTEGER GENERATED ALWAYS AS (2 + 2 + col_int_nokey) STORED, +col_varchar_nokey VARCHAR(1), +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)) STORED, +PRIMARY KEY (pk), +KEY (col_int_key), +KEY (col_varchar_key, col_int_key) +); +INSERT INTO C ( +col_int_nokey, +col_varchar_nokey +) VALUES (4, 'v'),(62, 'v'),(7, 'c'),(1, NULL),(0, 'x'),(7, 'i'),(7, 'e'),(1, 'p'),(7, 's'),(1, 'j'),(5, 'z'),(2, 'c'),(0, 'a'),(1, 'q'),(8, 'y'),(1, NULL),(1, 'r'),(9, 'v'),(1, NULL),(5, 'r'); +CREATE OR REPLACE ALGORITHM=MERGE VIEW V1 AS SELECT alias1. +col_varchar_key AS field1 , alias1.pk AS field2, alias2. +col_int_nokey AS field3 FROM C AS alias1 LEFT JOIN A AS alias2 ON +alias1.pk = alias2.col_int_key WHERE alias1.pk > 8 AND alias1 +.pk < ( 9 + 2 ) AND alias1.col_int_key <> 1 OR alias1.col_int_key +> 0 AND alias1.col_int_key <= ( 3 + 2 ) ORDER BY field1, field2, field3 +LIMIT 100 OFFSET 6; +Warnings: +Warning 1354 View merge algorithm can't be used here for now (assumed undefined algorithm) +SELECT * FROM V1; +field1 field2 field3 +qq 14 NULL +rr 17 NULL +ss 9 NULL +xx 5 NULL +DROP VIEW V1; +DROP TABLE A,C; +# +# Bug#20406510: WL411:VALGRIND WARNINGS WITH +# COUNT DISTINCT QUERY ON VIRTUAL GC VARCHAR COLUMN +# +CREATE TABLE A ( +pk INTEGER AUTO_INCREMENT, +col_time_key TIME NOT NULL, +col_datetime_key DATETIME NOT NULL, +PRIMARY KEY (pk), +KEY (col_time_key), +KEY (col_datetime_key) +); +CREATE TABLE C ( +pk INTEGER AUTO_INCREMENT, +col_int_key INTEGER NOT NULL, +col_varchar_key VARCHAR(1) NOT NULL, +col_varchar_nokey VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_key, col_varchar_key)), +PRIMARY KEY (pk), +KEY (col_int_key), +KEY (col_varchar_key, col_int_key) +); +INSERT INTO C (col_int_key,col_varchar_key) VALUES (0, 'j'),(8, 'v'),(1, 'c'),(8, 'm'),(9, 'd'); +SELECT MIN( alias2 . col_int_key ) AS field1, +COUNT( DISTINCT alias2 . col_varchar_nokey ) AS field2 +FROM ( A AS alias1 , C AS alias2 ) +ORDER BY alias1.col_time_key, alias1.col_datetime_key, alias1.pk ASC; +field1 field2 +NULL 0 +DROP TABLE A,C; +# +# Bug#20566325: WL8149: INNODB: FAILING ASSERTION: +# COL_NR < TABLE->N_DEF +# +CREATE TABLE A ( +pk INTEGER AUTO_INCREMENT, +col_varchar_nokey VARCHAR(1) NOT NULL, +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)), +PRIMARY KEY (pk) +); +INSERT /*! IGNORE */ INTO A (col_varchar_nokey) VALUES ('k'); +CREATE TABLE CC ( +pk INTEGER AUTO_INCREMENT, +col_datetime_nokey DATETIME /*! NULL */, +col_time_nokey TIME /*! NULL */, +col_time_key TIME GENERATED ALWAYS AS +(ADDTIME(col_datetime_nokey, col_time_nokey)), +col_varchar_nokey VARCHAR(1) /*! NULL */, +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)), +PRIMARY KEY (pk)); +INSERT INTO CC (col_time_nokey,col_datetime_nokey,col_varchar_nokey) VALUES +('13:06:13.033877','1900-01-01 00:00:00', 'p'), +(NULL, '2007-05-25 11:58:54.015689', 'g'); +SELECT +table1.col_time_key AS field1, +'z' AS field2 +FROM +(CC AS table1 LEFT OUTER JOIN (A AS table2 STRAIGHT_JOIN CC AS table3 ON +(table3.col_varchar_key = table2.col_varchar_nokey)) ON +(table3.col_varchar_key = table2.col_varchar_nokey)) +WHERE +table2.pk != 6 +AND table1.col_varchar_key IN ('l', 's' , 'b' ) +AND table3.col_varchar_key != table1.col_varchar_key +ORDER BY table1.col_varchar_key , field1 , field2; +field1 field2 +DROP TABLE A,CC; +CREATE TABLE cc ( +pk int(11) NOT NULL AUTO_INCREMENT, +col_int_nokey int(11) NOT NULL, +col_int_key int(11) GENERATED ALWAYS AS (col_int_nokey) STORED, +col_date_nokey date NOT NULL, +col_date_key date GENERATED ALWAYS AS (col_date_nokey) STORED, +col_datetime_nokey datetime NOT NULL, +col_time_nokey time NOT NULL, +col_datetime_key datetime GENERATED ALWAYS AS (col_datetime_nokey)STORED, +col_time_key time GENERATED ALWAYS AS (col_time_nokey) STORED, +col_varchar_nokey varchar(1) NOT NULL, +col_varchar_key varchar(1) GENERATED ALWAYS AS (col_varchar_nokey)STORED, +PRIMARY KEY (pk), +KEY gc_idx1 (col_int_key), +KEY gc_idx2 (col_varchar_key), +KEY gc_idx3 (col_date_key), +KEY gc_idx4 (col_time_key), +KEY gc_idx5 (col_datetime_key), +KEY gc_idx6 (col_varchar_key,col_int_key), +KEY gc_idx7 (col_date_key,col_datetime_key,col_time_key), +KEY gc_idx8(col_int_key,col_varchar_key,col_date_key,col_time_key, +col_datetime_key) +); +INSERT INTO cc ( +col_int_nokey, +col_date_nokey, +col_time_nokey, +col_datetime_nokey, +col_varchar_nokey +) VALUES (1, '2009-12-01', '00:21:38.058143', '2007-05-28 00:00:00', 'c'), +(8, '2004-12-17', '04:08:02.046897', '2009-07-25 09:21:20.064099', 'm'), +(9, '2000-03-14', '16:25:11.040240', '2002-01-16 00:00:00', 'd'), +(24, '2000-10-08', '10:14:58.018534', '2006-10-12 04:32:53.031976', 'd'), +(6, '2006-05-25', '19:47:59.011283', '2001-02-15 03:08:38.035426', 'y'), +(1, '2008-01-23', '11:14:24.032949', '2004-10-02 20:31:15.022553', 't'); +SET @save_old_sql_mode= @@sql_mode; +SET sql_mode=""; +SELECT DISTINCT alias1.col_varchar_key AS field1 +FROM ( cc AS alias1 STRAIGHT_JOIN +(( cc AS alias2 STRAIGHT_JOIN cc AS alias3 ON +(alias3.col_varchar_key > alias2.col_varchar_key ) ) ) ON +(( alias3 .pk >= alias2.col_int_nokey ) AND +(alias3 .pk >= alias2.col_int_nokey ) )) +WHERE alias1.col_varchar_key <= 'v' +GROUP BY field1 HAVING field1 = 91 +ORDER BY field1, alias1.col_date_key, field1 ASC, field1 DESC, +alias1.col_time_key ASC, field1; +field1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'c' +Warning 1292 Truncated incorrect DOUBLE value: 't' +Warning 1292 Truncated incorrect DOUBLE value: 'm' +Warning 1292 Truncated incorrect DOUBLE value: 'd' +DROP TABLE cc; +SET sql_mode=@save_old_sql_mode; +# +# Bug#20797941: WL8149:ASSERTION !TABLE || +# (!TABLE->READ_SET || BITMAP_IS_SET(TABLE->READ_SET +# +CREATE TABLE t(a int, b int as(a+1)); +INSERT INTO t(a) values(1),(2); +SELECT * FROM t ORDER BY b; +a b +1 2 +2 3 +DROP TABLE t; +DROP TABLE t2, t3; +# +# Bug#21317507:GC: STORED COLUMN REJECTED, BUT VIRTUAL IS ACCEPTED +# +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(2147483647); +ALTER TABLE t1 ADD COLUMN b SMALLINT AS (a) VIRTUAL; +ALTER TABLE t1 DROP COLUMN b; +ALTER TABLE t1 ADD COLUMN c SMALLINT AS (a) VIRTUAL; +ALTER TABLE t1 DROP COLUMN c; +ALTER TABLE t1 ADD COLUMN d SMALLINT AS (a) VIRTUAL; +ALTER TABLE t1 DROP COLUMN d; +ALTER TABLE t1 ADD COLUMN c INT AS(a) VIRTUAL; +ALTER TABLE t1 CHANGE c c SMALLINT AS(a) VIRTUAL; +Warnings: +Warning 1264 Out of range value for column 'c' at row 1 +ALTER TABLE t1 MODIFY c TINYINT AS(a) VIRTUAL; +Warnings: +Warning 1264 Out of range value for column 'c' at row 1 +SELECT * FROM t1; +a c +2147483647 127 +DROP TABLE t1; +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(2147483647); +ALTER TABLE t1 ADD COLUMN h INT AS (a) VIRTUAL; +ALTER TABLE t1 CHANGE h i INT AS (a) VIRTUAL, ALGORITHM=COPY; +ALTER TABLE t1 ADD COLUMN b SMALLINT AS (a) VIRTUAL, ALGORITHM=COPY, LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED +ALTER TABLE t1 ADD COLUMN e SMALLINT AS (a) VIRTUAL, ALGORITHM=COPY, LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED +ALTER TABLE t1 ADD COLUMN f SMALLINT AS (a) VIRTUAL, ALGORITHM=COPY, LOCK=SHARED; +Warnings: +Warning 1264 Out of range value for column 'f' at row 1 +ALTER TABLE t1 ADD COLUMN g SMALLINT AS (a) VIRTUAL, ALGORITHM=COPY, LOCK=EXCLUSIVE; +Warnings: +Warning 1264 Out of range value for column 'f' at row 1 +Warning 1264 Out of range value for column 'g' at row 1 +DROP TABLE t1; +# +# Bug#21980430 GCOLS: CRASHING +# +CREATE TABLE t ( +a INT, +b BLOB, +c BLOB GENERATED ALWAYS AS (a+b) VIRTUAL, +UNIQUE KEY i0008 (a) +); +INSERT INTO t(a,b) VALUES(1,'cccc'); +EXPLAIN SELECT /*+ bka() */ 1 AS c FROM t AS b RIGHT JOIN t AS c ON b.a > c.c +WHERE b.b>c.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE b ALL i0008 NULL NULL NULL 1 +1 SIMPLE c ALL i0008 NULL NULL NULL 1 Range checked for each record (index map: 0x1) +SELECT /*+ bka() */ 1 AS c FROM t AS b RIGHT JOIN t AS c ON b.a > c.c +WHERE b.b>c.a; +c +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'cccc' +DROP TABLE t; +set @optimizer_switch_save = @@optimizer_switch; +set optimizer_switch='mrr_cost_based=off'; +set @read_rnd_buffer_size_save= @@read_rnd_buffer_size; +set read_rnd_buffer_size=32; +CREATE TABLE t0 ( +i1 INTEGER NOT NULL +); +INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +CREATE TABLE t1 ( +pk INTEGER NOT NULL, +i1 INTEGER NOT NULL, +i2 INTEGER NOT NULL, +v1 INTEGER GENERATED ALWAYS AS (i2 + 1) VIRTUAL, +v2 INTEGER GENERATED ALWAYS AS (i1 / (i1 - i2 + 57)) VIRTUAL, +PRIMARY KEY (pk), +INDEX idx(i1) +); +INSERT INTO t1 (pk, i1, i2) +SELECT a0.i1 + a1.i1*10 + a2.i1*100, +a0.i1 + a1.i1*10, +a0.i1 + a1.i1*10 +FROM t0 AS a0, t0 AS a1, t0 AS a2; +EXPLAIN SELECT * FROM t1 +WHERE i1 > 41 AND i1 <= 43; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range idx idx 4 NULL 20 Using index condition +SELECT * FROM t1 +WHERE i1 > 41 AND i1 <= 43; +pk i1 i2 v1 v2 +142 42 42 43 1 +143 43 43 44 1 +242 42 42 43 1 +243 43 43 44 1 +342 42 42 43 1 +343 43 43 44 1 +42 42 42 43 1 +43 43 43 44 1 +442 42 42 43 1 +443 43 43 44 1 +542 42 42 43 1 +543 43 43 44 1 +642 42 42 43 1 +643 43 43 44 1 +742 42 42 43 1 +743 43 43 44 1 +842 42 42 43 1 +843 43 43 44 1 +942 42 42 43 1 +943 43 43 44 1 +EXPLAIN SELECT * FROM t1 +WHERE v1 > 41 AND v1 <= 43; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where +SELECT * FROM t1 +WHERE v1 > 41 AND v1 <= 43; +pk i1 i2 v1 v2 +141 41 41 42 1 +142 42 42 43 1 +241 41 41 42 1 +242 42 42 43 1 +341 41 41 42 1 +342 42 42 43 1 +41 41 41 42 1 +42 42 42 43 1 +441 41 41 42 1 +442 42 42 43 1 +541 41 41 42 1 +542 42 42 43 1 +641 41 41 42 1 +642 42 42 43 1 +741 41 41 42 1 +742 42 42 43 1 +841 41 41 42 1 +842 42 42 43 1 +941 41 41 42 1 +942 42 42 43 1 +DROP TABLE t0, t1; +set optimizer_switch= @optimizer_switch_save; +set @@read_rnd_buffer_size= @read_rnd_buffer_size_save; +# +# Bug#21872184 CONDITIONAL JUMP AT JOIN_CACHE::WRITE_RECORD_DATA IN +# SQL_JOIN_BUFFER.CC +# +# +# Test 1: Dynamic range scan with one covering index +# +CREATE TABLE t1 ( +i1 INTEGER NOT NULL, +c1 VARCHAR(1) NOT NULL +); +INSERT INTO t1 +VALUES (10, 'c'), (10, 'i'), (2, 't'), (4, 'g'); +CREATE TABLE t2 ( +i1 INTEGER NOT NULL, +c1 VARCHAR(1) NOT NULL +); +INSERT INTO t2 +VALUES (2, 'k'), (9, 'k'), (7, 'o'), (5, 'n'), (7, 'e'); +CREATE TABLE t3 ( +pk INTEGER NOT NULL, +i1 INTEGER, +i2_key INTEGER GENERATED ALWAYS AS (i1 + i1) VIRTUAL, +PRIMARY KEY (pk) +); +INSERT INTO t3 (pk, i1) +VALUES (1, 1), (2, 48), (3, 228), (4, 3), (5, 5), +(6, 39), (7, 6), (8, 8), (9, 3); +CREATE TABLE t4 ( +i1 INTEGER NOT NULL, +c1 VARCHAR(1) NOT NULL +); +INSERT INTO t4 +VALUES (1, 'j'), (2, 'c'), (0, 'a'); +ANALYZE TABLE t1, t2, t3, t4; +Table Op Msg_type Msg_text +test.t1 analyze status OK +test.t2 analyze status OK +test.t3 analyze status OK +test.t4 analyze status OK +EXPLAIN SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN +( +SELECT /*+ QB_NAME(subq1) */ t4.i1 +FROM t4 +WHERE t4.c1 < 'o' + ) +) +AND t1.i1 <= t3.i2_key; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL distinct_key NULL NULL NULL 3 +1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) +1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t4.i1 1 Using where +1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) +2 MATERIALIZED t4 ALL NULL NULL NULL NULL 3 Using where +SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN +( +SELECT /*+ QB_NAME(subq1) */ t4.i1 +FROM t4 +WHERE t4.c1 < 'o' + ) +) +AND t1.i1 <= t3.i2_key; +c1 i1 +c 2 +c 5 +c 7 +c 7 +c 9 +g 2 +g 5 +g 7 +g 7 +g 9 +i 2 +i 5 +i 7 +i 7 +i 9 +t 2 +t 2 +t 5 +t 5 +t 7 +t 7 +t 7 +t 7 +t 9 +t 9 +# +# Test 2: Two alternative covering indexes for the range scan +# +EXPLAIN SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN +( +SELECT /*+ QB_NAME(subq1) */ t4.i1 +FROM t4 +WHERE t4.c1 < 'o' + ) +) +AND t1.i1 <= t3.i2_key; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL distinct_key NULL NULL NULL 3 +1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) +1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t4.i1 1 Using where +1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) +2 MATERIALIZED t4 ALL NULL NULL NULL NULL 3 Using where +SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN +( +SELECT /*+ QB_NAME(subq1) */ t4.i1 +FROM t4 +WHERE t4.c1 < 'o' + ) +) +AND t1.i1 <= t3.i2_key; +c1 i1 +c 2 +c 5 +c 7 +c 7 +c 9 +g 2 +g 5 +g 7 +g 7 +g 9 +i 2 +i 5 +i 7 +i 7 +i 9 +t 2 +t 2 +t 5 +t 5 +t 7 +t 7 +t 7 +t 7 +t 9 +t 9 +# +# Test 3: One covering index including the base column for the virtual +# column +# +EXPLAIN SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN +( +SELECT /*+ QB_NAME(subq1) */ t4.i1 +FROM t4 +WHERE t4.c1 < 'o' + ) +) +AND t1.i1 <= t3.i2_key; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL distinct_key NULL NULL NULL 3 +1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) +1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t4.i1 1 Using where +1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) +2 MATERIALIZED t4 ALL NULL NULL NULL NULL 3 Using where +SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN +( +SELECT /*+ QB_NAME(subq1) */ t4.i1 +FROM t4 +WHERE t4.c1 < 'o' + ) +) +AND t1.i1 <= t3.i2_key; +c1 i1 +c 2 +c 5 +c 7 +c 7 +c 9 +g 2 +g 5 +g 7 +g 7 +g 9 +i 2 +i 5 +i 7 +i 7 +i 9 +t 2 +t 2 +t 5 +t 5 +t 7 +t 7 +t 7 +t 7 +t 9 +t 9 +# +# Test 4: One non-covering index +# +# Add more data to the table so that it will run the dynamic range scan +# as both table scan and range scan (the purpose of this is to make the +# table scan more expensive). +INSERT INTO t3 (pk, i1) +VALUES (10,1), (11,1), (12,1), (13,1), (14,1),(15,1), (16,1),(17,1), (18,1), +(19,1), (20,1), (21,1), (22,1), (23,1), (24,1),(25,1),(26,1),(27,1), +(28,1), (29,1); +# Change the query to read an extra column (t3.i1) making the index +# non-covering. +EXPLAIN SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1, t3.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN +( +SELECT /*+ QB_NAME(subq1) */ t4.i1 +FROM t4 +WHERE t4.c1 < 'o' + ) +) +AND t1.i1 <= t3.i2_key; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL distinct_key NULL NULL NULL 3 +1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) +1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t4.i1 1 Using where +1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) +2 MATERIALIZED t4 ALL NULL NULL NULL NULL 3 Using where +SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1, t3.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN +( +SELECT /*+ QB_NAME(subq1) */ t4.i1 +FROM t4 +WHERE t4.c1 < 'o' + ) +) +AND t1.i1 <= t3.i2_key; +c1 i1 i1 +c 2 48 +c 5 48 +c 7 48 +c 7 48 +c 9 48 +g 2 48 +g 5 48 +g 7 48 +g 7 48 +g 9 48 +i 2 48 +i 5 48 +i 7 48 +i 7 48 +i 9 48 +t 2 1 +t 2 48 +t 5 1 +t 5 48 +t 7 1 +t 7 1 +t 7 48 +t 7 48 +t 9 1 +t 9 48 +# +# Test 5: Test where the added primary key to secondary indexes is +# used after it has been included in the join buffer +# +EXPLAIN SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN +( +SELECT /*+ QB_NAME(subq1) */ t4.i1 +FROM t4 +WHERE t4.c1 < 'o' and t4.i1 < (t2.i1 + 1) +) +) +AND t1.i1 <= t3.i2_key; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t4 ALL NULL NULL NULL NULL 3 Using where; Start temporary +1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) +1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t4.i1 1 Using where +1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where; End temporary; Using join buffer (flat, BNL join) +SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN +( +SELECT /*+ QB_NAME(subq1) */ t4.i1 +FROM t4 +WHERE t4.c1 < 'o' and t4.i1 < (t2.i1 + 1) +) +) +AND t1.i1 <= t3.i2_key; +c1 i1 +c 2 +c 5 +c 7 +c 7 +c 9 +g 2 +g 5 +g 7 +g 7 +g 9 +i 2 +i 5 +i 7 +i 7 +i 9 +t 2 +t 2 +t 5 +t 5 +t 7 +t 7 +t 7 +t 7 +t 9 +t 9 +DROP TABLE t1, t2, t3, t4; +SET optimizer_switch='derived_merge=default'; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_select_myisam.result b/mysql-test/suite/gcol/r/gcol_select_myisam.result new file mode 100644 index 00000000000..d5e4bdabb38 --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_select_myisam.result @@ -0,0 +1,1606 @@ +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; +SET @@session.default_storage_engine = 'MyISAM'; +SET optimizer_switch='derived_merge=off'; +create table t1 (a int, +b int generated always as (-a) virtual, +c int generated always as (-a) stored, +index (c)); +insert into t1 (a) values (2), (1), (1), (3), (NULL); +create table t2 like t1; +insert into t2 (a) values (1); +create table t3 (a int primary key, +b int generated always as (-a) virtual, +c int generated always as (-a) stored unique); +insert into t3 (a) values (2),(1),(3); +analyze table t1,t2,t3; +Table Op Msg_type Msg_text +test.t1 analyze status OK +test.t2 analyze status OK +test.t3 analyze status OK +# select_type=SIMPLE, type=system +select * from t2; +a b c +1 -1 -1 +explain select * from t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 system NULL NULL NULL NULL 1 +select * from t2 where c=-1; +a b c +1 -1 -1 +explain select * from t2 where c=-1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 system c NULL NULL NULL 1 +# select_type=SIMPLE, type=ALL +select * from t1 where b=-1; +a b c +1 -1 -1 +1 -1 -1 +explain select * from t1 where b=-1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +# select_type=SIMPLE, type=const +select * from t3 where a=1; +a b c +1 -1 -1 +explain select * from t3 where a=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 const PRIMARY PRIMARY 4 const 1 +# select_type=SIMPLE, type=range +select * from t3 where c>=-1; +a b c +1 -1 -1 +explain select * from t3 where c>=-1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 range c c 5 NULL 2 Using index condition +# select_type=SIMPLE, type=ref +select * from t1,t3 where t1.c=t3.c and t3.c=-1; +a b c a b c +1 -1 -1 1 -1 -1 +1 -1 -1 1 -1 -1 +explain select * from t1,t3 where t1.c=t3.c and t3.c=-1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 const c c 5 const 1 +1 SIMPLE t1 ref c c 5 const 2 +# select_type=PRIMARY, type=index,ALL +select * from t1 where b in (select c from t3); +a b c +1 -1 -1 +1 -1 -1 +2 -2 -2 +3 -3 -3 +explain select * from t1 where b in (select c from t3); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t3 index c c 5 NULL 3 Using index +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +# select_type=PRIMARY, type=range,ref +select * from t1 where c in (select c from t3 where c between -2 and -1); +a b c +1 -1 -1 +1 -1 -1 +2 -2 -2 +explain select * from t1 where c in (select c from t3 where c between -2 and -1); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t3 index c c 5 NULL 3 Using where; Using index +1 PRIMARY t1 ref c c 5 test.t3.c 1 +# select_type=UNION, type=system +# select_type=UNION RESULT, type= +select * from t1 union select * from t2; +a b c +1 -1 -1 +2 -2 -2 +3 -3 -3 +NULL NULL NULL +explain select * from t1 union select * from t2; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 +2 UNION t2 system NULL NULL NULL NULL 1 +NULL UNION RESULT ALL NULL NULL NULL NULL NULL +# select_type=DERIVED, type=system +select * from (select a,b,c from t1) as t11; +a b c +1 -1 -1 +1 -1 -1 +2 -2 -2 +3 -3 -3 +NULL NULL NULL +explain select * from (select a,b,c from t1) as t11; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 5 +2 DERIVED t1 ALL NULL NULL NULL NULL 5 +### +### Using aggregate functions with/without DISTINCT +### +# SELECT COUNT(*) FROM tbl_name +select count(*) from t1; +count(*) +5 +explain select count(*) from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +# SELECT COUNT(DISTINCT ) FROM tbl_name +select count(distinct a) from t1; +count(distinct a) +3 +explain select count(distinct a) from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 +# SELECT COUNT(DISTINCT ) FROM tbl_name +select count(distinct b) from t1; +count(distinct b) +3 +explain select count(distinct b) from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 +# SELECT COUNT(DISTINCT ) FROM tbl_name +select count(distinct c) from t1; +count(distinct c) +3 +explain select count(distinct c) from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range NULL c 5 NULL 6 Using index for group-by (scanning) +### +### filesort & range-based utils +### +# SELECT * FROM tbl_name WHERE +select * from t3 where c >= -2; +a b c +1 -1 -1 +2 -2 -2 +explain select * from t3 where c >= -2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 range c c 5 NULL 2 Using index condition +# SELECT * FROM tbl_name WHERE +select * from t3 where a between 1 and 2; +a b c +1 -1 -1 +2 -2 -2 +explain select * from t3 where a between 1 and 2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 1 Using index condition +# SELECT * FROM tbl_name WHERE +select * from t3 where b between -2 and -1; +a b c +1 -1 -1 +2 -2 -2 +explain select * from t3 where b between -2 and -1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where +# SELECT * FROM tbl_name WHERE +select * from t3 where c between -2 and -1; +a b c +1 -1 -1 +2 -2 -2 +explain select * from t3 where c between -2 and -1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 range c c 5 NULL 1 Using index condition +# bug#20022189: WL411:DEBUG ASSERT AT FIELD_LONG::VAL_INT IN SQL/FIELD.CC +CREATE TABLE t4 ( +`pk` int(11) NOT NULL , +`col_int_nokey` int(11) GENERATED ALWAYS AS (pk + col_int_key) STORED, +`col_int_key` int(11) DEFAULT NULL, +`col_date_nokey` date DEFAULT NULL, +`col_datetime_key` datetime DEFAULT NULL, +PRIMARY KEY (`pk`), +KEY `col_int_key` (`col_int_key`), +KEY `col_datetime_key` (`col_datetime_key`) +); +INSERT INTO t4 VALUES +(1,default,4,'2008-12-05','1900-01-01 00:00:00'); +SELECT +SQL_BIG_RESULT +GRANDPARENT1 . `col_int_nokey` AS g1 +FROM t4 AS GRANDPARENT1 LEFT JOIN t4 AS GRANDPARENT2 ON ( GRANDPARENT2 . +`col_datetime_key` <= GRANDPARENT1 . `col_date_nokey` ) +GROUP BY GRANDPARENT1 . `pk`; +g1 +5 +DROP TABLE t4; +# SELECT * FROM tbl_name WHERE ORDER BY +select * from t3 where a between 1 and 2 order by c; +a b c +2 -2 -2 +1 -1 -1 +explain select * from t3 where a between 1 and 2 order by c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Using filesort +# SELECT * FROM tbl_name WHERE ORDER BY +select * from t3 where b between -2 and -1 order by a; +a b c +1 -1 -1 +2 -2 -2 +explain select * from t3 where b between -2 and -1 order by a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Using filesort +# SELECT * FROM tbl_name WHERE ORDER BY +select * from t3 where c between -2 and -1 order by a; +a b c +1 -1 -1 +2 -2 -2 +explain select * from t3 where c between -2 and -1 order by a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 range c c 5 NULL 1 Using index condition; Using filesort +# SELECT * FROM tbl_name WHERE ORDER BY +select * from t3 where b between -2 and -1 order by b; +a b c +2 -2 -2 +1 -1 -1 +explain select * from t3 where b between -2 and -1 order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Using filesort +# SELECT * FROM tbl_name WHERE ORDER BY +select * from t3 where c between -2 and -1 order by b; +a b c +2 -2 -2 +1 -1 -1 +explain select * from t3 where c between -2 and -1 order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 range c c 5 NULL 1 Using index condition; Using filesort +# SELECT * FROM tbl_name WHERE ORDER BY +select * from t3 where b between -2 and -1 order by c; +a b c +2 -2 -2 +1 -1 -1 +explain select * from t3 where b between -2 and -1 order by c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Using filesort +# SELECT * FROM tbl_name WHERE ORDER BY +select * from t3 where c between -2 and -1 order by c; +a b c +2 -2 -2 +1 -1 -1 +explain select * from t3 where c between -2 and -1 order by c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 range c c 5 NULL 1 Using index condition +# SELECT sum() FROM tbl_name GROUP BY +select sum(b) from t1 group by b; +sum(b) +NULL +-3 +-2 +-2 +explain select sum(b) from t1 group by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +# SELECT sum() FROM tbl_name GROUP BY +select sum(c) from t1 group by c; +sum(c) +NULL +-3 +-2 +-2 +explain select sum(c) from t1 group by c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL c 5 NULL 5 Using index +# SELECT sum() FROM tbl_name GROUP BY +select sum(b) from t1 group by c; +sum(b) +NULL +-3 +-2 +-2 +explain select sum(b) from t1 group by c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +# SELECT sum() FROM tbl_name GROUP BY +select sum(c) from t1 group by b; +sum(c) +NULL +-3 +-2 +-2 +explain select sum(c) from t1 group by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +drop table t1; +# +# Bug#20241655: WL411:FAILING ASSERTION ASSERTION +# +CREATE TABLE BB ( +col_time_key time NOT NULL, +col_time_nokey time GENERATED ALWAYS AS (ADDTIME(col_datetime_key, col_time_key)) VIRTUAL, +col_datetime_key datetime NOT NULL); +INSERT INTO BB VALUES('23:28:02', default, '2005-03-15 22:48:25'); +Warnings: +Note 1265 Data truncated for column 'col_time_nokey' at row 1 +CREATE TABLE CC ( +col_time_key time NOT NULL, +col_time_nokey time GENERATED ALWAYS AS (ADDTIME(col_datetime_key, col_time_key)) VIRTUAL, +col_datetime_key datetime NOT NULL +); +INSERT INTO CC VALUES('16:22:51', default, '1900-01-01 00:00:00'); +Warnings: +Note 1265 Data truncated for column 'col_time_nokey' at row 1 +SELECT 1 AS g1 FROM BB AS gp1 LEFT JOIN BB AS gp2 USING ( col_time_nokey); +g1 +1 +DROP TABLE BB, CC; +# +# Bug#20328786: WL411:VALGRIND WARNINGS OF CONDITIONAL +# JUMP WHILE SELECTING FROM VIEW +# +CREATE TABLE A ( +pk INTEGER AUTO_INCREMENT, +col_int_nokey INTEGER, +col_int_key INTEGER GENERATED ALWAYS AS (2 + 2 + col_int_nokey) STORED, +PRIMARY KEY (pk) +); +CREATE TABLE C ( +pk INTEGER AUTO_INCREMENT, +col_int_nokey INTEGER, +col_int_key INTEGER GENERATED ALWAYS AS (2 + 2 + col_int_nokey) STORED, +col_varchar_nokey VARCHAR(1), +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)) STORED, +PRIMARY KEY (pk), +KEY (col_int_key), +KEY (col_varchar_key, col_int_key) +); +INSERT INTO C ( +col_int_nokey, +col_varchar_nokey +) VALUES (4, 'v'),(62, 'v'),(7, 'c'),(1, NULL),(0, 'x'),(7, 'i'),(7, 'e'),(1, 'p'),(7, 's'),(1, 'j'),(5, 'z'),(2, 'c'),(0, 'a'),(1, 'q'),(8, 'y'),(1, NULL),(1, 'r'),(9, 'v'),(1, NULL),(5, 'r'); +CREATE OR REPLACE ALGORITHM=MERGE VIEW V1 AS SELECT alias1. +col_varchar_key AS field1 , alias1.pk AS field2, alias2. +col_int_nokey AS field3 FROM C AS alias1 LEFT JOIN A AS alias2 ON +alias1.pk = alias2.col_int_key WHERE alias1.pk > 8 AND alias1 +.pk < ( 9 + 2 ) AND alias1.col_int_key <> 1 OR alias1.col_int_key +> 0 AND alias1.col_int_key <= ( 3 + 2 ) ORDER BY field1, field2, field3 +LIMIT 100 OFFSET 6; +Warnings: +Warning 1354 View merge algorithm can't be used here for now (assumed undefined algorithm) +SELECT * FROM V1; +field1 field2 field3 +qq 14 NULL +rr 17 NULL +ss 9 NULL +xx 5 NULL +DROP VIEW V1; +DROP TABLE A,C; +# +# Bug#20406510: WL411:VALGRIND WARNINGS WITH +# COUNT DISTINCT QUERY ON VIRTUAL GC VARCHAR COLUMN +# +CREATE TABLE A ( +pk INTEGER AUTO_INCREMENT, +col_time_key TIME NOT NULL, +col_datetime_key DATETIME NOT NULL, +PRIMARY KEY (pk), +KEY (col_time_key), +KEY (col_datetime_key) +); +CREATE TABLE C ( +pk INTEGER AUTO_INCREMENT, +col_int_key INTEGER NOT NULL, +col_varchar_key VARCHAR(1) NOT NULL, +col_varchar_nokey VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_key, col_varchar_key)), +PRIMARY KEY (pk), +KEY (col_int_key), +KEY (col_varchar_key, col_int_key) +); +INSERT INTO C (col_int_key,col_varchar_key) VALUES (0, 'j'),(8, 'v'),(1, 'c'),(8, 'm'),(9, 'd'); +SELECT MIN( alias2 . col_int_key ) AS field1, +COUNT( DISTINCT alias2 . col_varchar_nokey ) AS field2 +FROM ( A AS alias1 , C AS alias2 ) +ORDER BY alias1.col_time_key, alias1.col_datetime_key, alias1.pk ASC; +field1 field2 +NULL 0 +DROP TABLE A,C; +# +# Bug#20566325: WL8149: INNODB: FAILING ASSERTION: +# COL_NR < TABLE->N_DEF +# +CREATE TABLE A ( +pk INTEGER AUTO_INCREMENT, +col_varchar_nokey VARCHAR(1) NOT NULL, +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)), +PRIMARY KEY (pk) +); +INSERT /*! IGNORE */ INTO A (col_varchar_nokey) VALUES ('k'); +CREATE TABLE CC ( +pk INTEGER AUTO_INCREMENT, +col_datetime_nokey DATETIME /*! NULL */, +col_time_nokey TIME /*! NULL */, +col_time_key TIME GENERATED ALWAYS AS +(ADDTIME(col_datetime_nokey, col_time_nokey)), +col_varchar_nokey VARCHAR(1) /*! NULL */, +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)), +PRIMARY KEY (pk)); +INSERT INTO CC (col_time_nokey,col_datetime_nokey,col_varchar_nokey) VALUES +('13:06:13.033877','1900-01-01 00:00:00', 'p'), +(NULL, '2007-05-25 11:58:54.015689', 'g'); +SELECT +table1.col_time_key AS field1, +'z' AS field2 +FROM +(CC AS table1 LEFT OUTER JOIN (A AS table2 STRAIGHT_JOIN CC AS table3 ON +(table3.col_varchar_key = table2.col_varchar_nokey)) ON +(table3.col_varchar_key = table2.col_varchar_nokey)) +WHERE +table2.pk != 6 +AND table1.col_varchar_key IN ('l', 's' , 'b' ) +AND table3.col_varchar_key != table1.col_varchar_key +ORDER BY table1.col_varchar_key , field1 , field2; +field1 field2 +DROP TABLE A,CC; +# +# Bug#20573302: WL8149: SEGV IN HA_INNOBASE:: +# BUILD_TEMPLATE AT INNOBASE/HANDLER/HA_INNODB.CC:665 +# +CREATE TABLE c ( +pk INTEGER AUTO_INCREMENT, +col_int_nokey INTEGER NOT NULL, +col_int_key INTEGER GENERATED ALWAYS AS (col_int_nokey) VIRTUAL, +col_date_nokey DATE NOT NULL, +col_date_key DATE GENERATED ALWAYS AS (DATE_ADD(col_date_nokey,interval 30 day)) VIRTUAL, +col_datetime_nokey DATETIME NOT NULL, +col_time_nokey TIME NOT NULL, +col_datetime_key DATETIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)), +col_time_key TIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)), +col_varchar_nokey VARCHAR(1) NOT NULL, +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS (CONCAT(col_varchar_nokey, col_varchar_nokey)), +PRIMARY KEY (pk), +KEY (col_int_key), +KEY (col_varchar_key), +KEY (col_date_key), +KEY (col_time_key), +KEY (col_datetime_key), +KEY (col_int_key, col_varchar_key), +KEY (col_int_key, col_varchar_key, col_date_key, +col_time_key, col_datetime_key)); +INSERT /*! IGNORE */ INTO c ( +col_int_nokey, +col_date_nokey, +col_time_nokey, +col_datetime_nokey, +col_varchar_nokey +) VALUES +(1, '2009-12-01', '00:21:38.058143', '2007-05-28 00:00:00', 'c'), +(8, '2004-12-17', '04:08:02.046897', '2009-07-25 09:21:20.064099', 'm'), +(9, '2000-03-14', '16:25:11.040240', '2002-01-16 00:00:00', 'd'), +(24, '2000-10-08', '10:14:58.018534', '2006-10-12 04:32:53.031976', 'd'), +(6, '2006-05-25', '19:47:59.011283', '2001-02-15 03:08:38.035426', 'y'), +(1, '2008-01-23', '11:14:24.032949', '2004-10-02 20:31:15.022553', 't'), +(6, '2007-06-18', NULL, '2002-08-20 22:48:00.035785', 'd'), +(2, '2002-10-13', '00:00:00', '1900-01-01 00:00:00', 's'), +(4, '1900-01-01', '15:57:25.019666', '2005-08-15 00:00:00', 'r'), +(8, NULL, '07:05:51.006712', '1900-01-01 00:00:00', 'm'), +(4, '2006-03-09', '19:22:21.057406', '2008-05-16 08:09:06.002924', 'b'), +(4, '2001-06-05', '03:53:16.001370', '2001-01-20 12:47:23.022022', 'x'), +(7, '2006-05-28', '09:16:38.034570', '2008-07-02 00:00:00', 'g'), +(4, '2001-04-19', '15:37:26.028315', '1900-01-01 00:00:00', 'p'), +(1, '1900-01-01', '00:00:00', '2002-12-08 11:34:58.001571', 'q'), +(9, '2004-08-20', '05:03:03.047452', '1900-01-01 00:00:00', 'w'), +(4, '2004-10-10', '02:59:24.063764', '1900-01-01 00:00:00', 'd'), +(8, '2000-04-02', '00:01:58.064243', '2002-08-25 20:35:06.064634', 'e'), +(4, '2006-11-02', '00:00:00', '2001-10-22 11:13:24.048128', 'b'), +(8, '2009-01-28', '02:20:16.024931', '2003-03-12 02:00:34.029335', 'y'); +Warnings: +Note 1265 Data truncated for column 'col_time_key' at row 1 +Note 1265 Data truncated for column 'col_time_key' at row 2 +Note 1265 Data truncated for column 'col_time_key' at row 3 +Note 1265 Data truncated for column 'col_time_key' at row 4 +Note 1265 Data truncated for column 'col_time_key' at row 5 +Note 1265 Data truncated for column 'col_time_key' at row 6 +Warning 1048 Column 'col_time_nokey' cannot be null +Note 1265 Data truncated for column 'col_time_key' at row 7 +Note 1265 Data truncated for column 'col_time_key' at row 8 +Note 1265 Data truncated for column 'col_time_key' at row 9 +Warning 1048 Column 'col_date_nokey' cannot be null +Warning 1292 Incorrect datetime value: '0000-00-00' +Note 1265 Data truncated for column 'col_time_key' at row 10 +Note 1265 Data truncated for column 'col_time_key' at row 11 +Note 1265 Data truncated for column 'col_time_key' at row 12 +Note 1265 Data truncated for column 'col_time_key' at row 13 +Note 1265 Data truncated for column 'col_time_key' at row 14 +Note 1265 Data truncated for column 'col_time_key' at row 15 +Note 1265 Data truncated for column 'col_time_key' at row 16 +Note 1265 Data truncated for column 'col_time_key' at row 17 +Note 1265 Data truncated for column 'col_time_key' at row 18 +Note 1265 Data truncated for column 'col_time_key' at row 19 +Note 1265 Data truncated for column 'col_time_key' at row 20 +CREATE TABLE cc ( +pk INTEGER AUTO_INCREMENT, +col_int_nokey INTEGER NOT NULL, +col_int_key INTEGER GENERATED ALWAYS AS (col_int_nokey) VIRTUAL, +col_date_nokey DATE NOT NULL, +col_date_key DATE GENERATED ALWAYS AS (DATE_ADD(col_date_nokey,interval 30 day)) VIRTUAL, +col_datetime_nokey DATETIME NOT NULL, +col_time_nokey TIME NOT NULL, +col_datetime_key DATETIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)), +col_time_key TIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)), +col_varchar_nokey VARCHAR(1) NOT NULL, +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS (CONCAT(col_varchar_nokey, col_varchar_nokey)), +PRIMARY KEY (pk), +KEY (col_int_key), +KEY (col_varchar_key), +KEY (col_date_key), +KEY (col_time_key), +KEY (col_datetime_key), +KEY (col_int_key, col_varchar_key), +KEY (col_int_key, col_varchar_key, col_date_key, +col_time_key, col_datetime_key)); +INSERT /*! IGNORE */ INTO cc ( +col_int_nokey, +col_date_nokey, +col_time_nokey, +col_datetime_nokey, +col_varchar_nokey +) VALUES +(0, '2003-02-06', '22:02:09.059926', '2003-08-07 14:43:09.011144', 'x'), +(0, '2005-04-16', '19:33:15.014160', '2005-12-11 00:00:00', 'n'), +(1, '2005-07-23', '22:03:16.058787', '2005-12-26 20:48:07.043628', 'w'), +(7, '2001-11-15', '06:31:23.027263', '2008-06-12 06:41:21.012493', 's'), +(0, '2006-03-24', '02:19:08.013275', '2007-10-11 18:46:28.030000', 'a'), +(4, '2008-07-10', NULL, '2006-04-04 22:22:40.057947', 'd'), +(1, '2009-12-07', NULL, '2002-08-10 20:52:58.035137', 'w'), +(1, '2008-05-01', '10:28:01.038587', '2008-10-03 11:17:23.005299', 'j'), +(1, '2008-06-22', '00:00:00', '2009-01-06 20:11:01.034339', 'm'), +(4, '2001-11-11', '15:02:50.048785', '2009-09-19 00:00:00', 'k'), +(7, '2000-12-21', '05:29:13.012729', '2007-09-02 12:14:27.029187', 't'), +(4, '2007-09-03', '23:45:33.048507', '2003-09-26 00:00:00', 'k'), +(2, '2003-02-18', '19:10:53.057455', '2001-11-18 18:10:16.063189', 'e'), +(0, '2008-12-01', '01:45:27.037313', '2005-02-15 04:08:17.015554', 'i'), +(1, '2008-10-18', '03:56:03.060218', '2009-06-13 23:04:40.013006', 't'), +(91, '2004-08-28', '12:43:17.023797', '1900-01-01 00:00:00', 'm'), +(6, '2006-10-05', '13:33:46.053634', '2005-03-20 02:48:24.045653', 'z'), +(3, '2003-05-16', NULL, '2002-03-16 11:47:27.045297', 'c'), +(6, '2008-10-10', NULL, '2000-05-22 00:00:00', 'i'), +(8, '2002-01-19', '05:18:40.006865', '2009-02-12 00:00:00', 'v'); +Warnings: +Note 1265 Data truncated for column 'col_time_key' at row 1 +Note 1265 Data truncated for column 'col_time_key' at row 2 +Note 1265 Data truncated for column 'col_time_key' at row 3 +Note 1265 Data truncated for column 'col_time_key' at row 4 +Note 1265 Data truncated for column 'col_time_key' at row 5 +Warning 1048 Column 'col_time_nokey' cannot be null +Note 1265 Data truncated for column 'col_time_key' at row 6 +Warning 1048 Column 'col_time_nokey' cannot be null +Note 1265 Data truncated for column 'col_time_key' at row 7 +Note 1265 Data truncated for column 'col_time_key' at row 8 +Note 1265 Data truncated for column 'col_time_key' at row 9 +Note 1265 Data truncated for column 'col_time_key' at row 10 +Note 1265 Data truncated for column 'col_time_key' at row 11 +Note 1265 Data truncated for column 'col_time_key' at row 12 +Note 1265 Data truncated for column 'col_time_key' at row 13 +Note 1265 Data truncated for column 'col_time_key' at row 14 +Note 1265 Data truncated for column 'col_time_key' at row 15 +Note 1265 Data truncated for column 'col_time_key' at row 16 +Note 1265 Data truncated for column 'col_time_key' at row 17 +Warning 1048 Column 'col_time_nokey' cannot be null +Note 1265 Data truncated for column 'col_time_key' at row 18 +Warning 1048 Column 'col_time_nokey' cannot be null +Note 1265 Data truncated for column 'col_time_key' at row 19 +Note 1265 Data truncated for column 'col_time_key' at row 20 +EXPLAIN +SELECT subquery2_t2.col_int_key AS subquery2_field1 +FROM (c AS subquery2_t1 RIGHT JOIN +(c AS subquery2_t2 LEFT JOIN cc AS subquery2_t3 ON +(subquery2_t3.col_int_nokey = subquery2_t2.col_int_key )) ON +(subquery2_t3.col_varchar_key = subquery2_t2.col_varchar_key)) +ORDER BY subquery2_field1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE subquery2_t2 index NULL col_int_key_2 10 NULL 20 # +1 SIMPLE subquery2_t3 ALL NULL NULL NULL NULL 20 # +1 SIMPLE subquery2_t1 index NULL PRIMARY 4 NULL 20 # +SELECT subquery2_t2.col_int_key AS subquery2_field1 +FROM (c AS subquery2_t1 RIGHT JOIN +(c AS subquery2_t2 LEFT JOIN cc AS subquery2_t3 ON +(subquery2_t3.col_int_nokey = subquery2_t2.col_int_key )) ON +(subquery2_t3.col_varchar_key = subquery2_t2.col_varchar_key)) +ORDER BY subquery2_field1; +subquery2_field1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +2 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +6 +6 +6 +6 +7 +7 +8 +8 +8 +8 +9 +9 +24 +SELECT subquery2_t2.col_int_key AS subquery2_field1 +FROM (c AS subquery2_t1 RIGHT JOIN +(c AS subquery2_t2 LEFT JOIN cc AS subquery2_t3 ON +(subquery2_t3.col_int_nokey = subquery2_t2.col_int_key )) ON +(subquery2_t3.col_varchar_key = subquery2_t2.col_varchar_key)) +ORDER BY subquery2_field1; +subquery2_field1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +2 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +6 +6 +6 +6 +7 +7 +8 +8 +8 +8 +9 +9 +24 +DROP TABLE c,cc; +# +# Bug#2081065: WL8149:RESULT DIFF SEEN FOR SIMPLE +# RANGE QUERIES WITH ORDER BY +# +CREATE TABLE cc ( +pk INTEGER AUTO_INCREMENT, +col_int_nokey INTEGER NOT NULL, +col_int_key INTEGER GENERATED ALWAYS AS +(col_int_nokey + col_int_nokey) VIRTUAL, +PRIMARY KEY (pk), +KEY (col_int_key) +); +INSERT INTO cc (col_int_nokey) VALUES (0),(1),(7),(0),(4),(5); +EXPLAIN SELECT pk FROM cc WHERE col_int_key > 3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE cc ALL col_int_key NULL NULL NULL 6 # +SELECT pk FROM cc WHERE col_int_key > 3; +pk +3 +5 +6 +EXPLAIN SELECT pk FROM cc WHERE col_int_key > 3 ORDER BY 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE cc ALL col_int_key NULL NULL NULL 6 # +SELECT pk FROM cc WHERE col_int_key > 3 ORDER BY 1; +pk +3 +5 +6 +DROP TABLE cc; +# +# Bug#20849676 :WL8149:ASSERTION `!TABLE || (!TABLE->READ_SET +# || BITMAP_IS_SET(TABLE->READ_SET +# +CREATE TABLE c ( +pk INTEGER AUTO_INCREMENT, +col_int_nokey INTEGER NOT NULL, +col_int_key INTEGER GENERATED ALWAYS AS +(col_int_nokey + col_int_nokey) VIRTUAL, +col_varchar_nokey VARCHAR(1) NOT NULL, +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)), +PRIMARY KEY (pk), +KEY (col_int_key), +KEY (col_varchar_key), +KEY (col_int_key, col_varchar_key) +) ; +INSERT INTO c (col_int_nokey, col_varchar_nokey) VALUES +(1, 'c'),(8, 'm'),(9, 'd'),(24, 'd'),(6, 'y'),(1, 't'),(6, 'd'), +(2, 'r'),(8, 'm'),(4, 'b'),(4, 'x'),(7, 'g'),(4, 'p'),(1, 'q'), +(9, 'w'),(4, 'd'),(8, 'e'),(4, 'b'),(8, 'y'); +CREATE TABLE a ( +pk INTEGER AUTO_INCREMENT, +col_datetime_nokey DATETIME NOT NULL, +col_time_nokey TIME NOT NULL, +col_datetime_key DATETIME GENERATED ALWAYS AS +(ADDTIME(col_datetime_nokey, col_time_nokey)), +col_time_key TIME GENERATED ALWAYS AS +(ADDTIME(col_datetime_nokey, col_time_nokey)), +col_varchar_nokey VARCHAR(1) NOT NULL, +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)), +PRIMARY KEY (pk), +KEY (col_varchar_key), +KEY (col_time_key), +KEY (col_datetime_key), +KEY (col_varchar_key, col_time_key, col_datetime_key) +); +INSERT INTO a ( +col_time_nokey, +col_datetime_nokey, +col_varchar_nokey) VALUES +('04:08:02.046897', '2001-11-04 19:07:55.051133', 'k'); +Warnings: +Note 1265 Data truncated for column 'col_time_key' at row 1 +ANALYZE TABLE a, c; +Table Op Msg_type Msg_text +test.a analyze status OK +test.c analyze status OK +EXPLAIN +SELECT +table1.pk AS field1 , +table1.col_datetime_key AS field2 +FROM +( a AS table1 LEFT JOIN ( ( c AS table2 STRAIGHT_JOIN ( SELECT +SUBQUERY1_t1.* FROM ( c AS SUBQUERY1_t1 INNER JOIN ( c AS SUBQUERY1_t2 +STRAIGHT_JOIN c AS SUBQUERY1_t3 ON (SUBQUERY1_t3.col_varchar_key = +SUBQUERY1_t2.col_varchar_key ) ) +ON (SUBQUERY1_t3.pk = SUBQUERY1_t2.col_int_key +OR SUBQUERY1_t1.col_int_key <> 1 ) ) +WHERE SUBQUERY1_t2.pk >= 9 ) AS table3 +ON (table3.col_int_key = table2.col_int_key ) ) ) +ON (table3.col_int_nokey = table2.pk ) ) +GROUP BY field1, field2; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY table1 system NULL NULL NULL NULL 1 # +1 PRIMARY table2 ALL PRIMARY,col_int_key,col_int_key_2 NULL NULL NULL 19 # +1 PRIMARY ref key0 key0 9 test.table2.pk,test.table2.col_int_key 10 # +2 DERIVED SUBQUERY1_t2 ALL PRIMARY,col_int_key,col_varchar_key,col_int_key_2 NULL NULL NULL 19 # +2 DERIVED SUBQUERY1_t3 ref PRIMARY,col_varchar_key col_varchar_key 5 test.SUBQUERY1_t2.col_varchar_key 1 # +2 DERIVED SUBQUERY1_t1 ALL col_int_key,col_int_key_2 NULL NULL NULL 19 # +SELECT +table1.pk AS field1 , +table1.col_datetime_key AS field2 +FROM +( a AS table1 LEFT JOIN ( ( c AS table2 STRAIGHT_JOIN ( SELECT +SUBQUERY1_t1.* FROM ( c AS SUBQUERY1_t1 INNER JOIN ( c AS SUBQUERY1_t2 +STRAIGHT_JOIN c AS SUBQUERY1_t3 ON (SUBQUERY1_t3.col_varchar_key = +SUBQUERY1_t2.col_varchar_key ) ) +ON (SUBQUERY1_t3.pk = SUBQUERY1_t2.col_int_key +OR SUBQUERY1_t1.col_int_key <> 1 ) ) +WHERE SUBQUERY1_t2.pk >= 9 ) AS table3 +ON (table3.col_int_key = table2.col_int_key ) ) ) +ON (table3.col_int_nokey = table2.pk ) ) +GROUP BY field1, field2; +field1 field2 +1 2001-11-04 23:15:57 +DROP TABLE IF EXISTS c,a; +CREATE TABLE c ( +col_int_nokey INTEGER NOT NULL, +col_int_key INTEGER GENERATED ALWAYS AS +(col_int_nokey + col_int_nokey) VIRTUAL, +col_varchar_nokey VARCHAR(1) NOT NULL, +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)), +KEY (col_int_key), +KEY (col_int_key, col_varchar_key) +) ; +INSERT INTO c ( +col_int_nokey, +col_varchar_nokey +) VALUES (1, 'c'),(8, 'm'),(9, 'd'),(24, 'd'),(6, 'y'),(1, 't'), +(6, 'd'),(2, 's'),(4, 'r'),(8, 'm'),(4, 'b'),(4, 'x'),(7, 'g'),(4, 'p'), +(1, 'q'),(9, 'w'),(4, 'd'),(8, 'e'),(4, 'b'),(8, 'y'); +CREATE TABLE cc ( +col_int_nokey INTEGER, +col_int_key INTEGER GENERATED ALWAYS AS +(col_int_nokey + col_int_nokey) VIRTUAL, +col_varchar_nokey VARCHAR(1), +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS +(CONCAT(col_varchar_nokey, col_varchar_nokey)), +KEY (col_int_key), +KEY (col_varchar_key), +KEY (col_int_key, col_varchar_key), +KEY (col_int_key, col_int_nokey), +KEY (col_varchar_key, col_varchar_nokey) +); +INSERT INTO cc ( +col_int_nokey, +col_varchar_nokey +) VALUES (8, 'p'),(9, 'g'),(9, 'i'),(4, 'p'),(7, 'h'),(1, 'e'),(8, 'e'),(6, 'u'), +(6, 'j'),(6, 'e'),(1, 'z'),(227, 'w'),(NULL, 't'),(9, 'i'),(1, 'i'),(8, 'i'), +(5, 'b'),(8,'m'),(7, 'j'),(2, 'v'); +ANALYZE TABLE c, cc; +Table Op Msg_type Msg_text +test.c analyze status OK +test.cc analyze status OK +EXPLAIN SELECT +alias2 . col_varchar_key AS field1 +FROM ( cc AS alias1 , cc AS alias2 ) +WHERE +( alias2 . col_int_key , alias1 . col_int_nokey ) +NOT IN +( +SELECT +DISTINCT SQ1_alias2 . col_int_nokey AS SQ1_field1 , +SQ1_alias1 . col_int_key AS SQ1_field2 +FROM ( cc AS SQ1_alias1 , c AS SQ1_alias2 ) +GROUP BY SQ1_field1 , SQ1_field2 +) +GROUP BY field1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 index NULL col_int_key_3 10 NULL 20 # +1 PRIMARY alias2 index NULL col_int_key_2 10 NULL 20 # +2 MATERIALIZED SQ1_alias1 index col_int_key,col_int_key_2,col_int_key_3 col_int_key 5 NULL 20 # +2 MATERIALIZED SQ1_alias2 ALL NULL NULL NULL NULL 20 # +SELECT +alias2 . col_varchar_key AS field1 +FROM ( cc AS alias1 , cc AS alias2 ) +WHERE +( alias2 . col_int_key , alias1 . col_int_nokey ) +NOT IN +( +SELECT +DISTINCT SQ1_alias2 . col_int_nokey AS SQ1_field1 , +SQ1_alias1 . col_int_key AS SQ1_field2 +FROM ( cc AS SQ1_alias1 , c AS SQ1_alias2 ) +GROUP BY SQ1_field1 , SQ1_field2 +) +GROUP BY field1; +field1 +bb +ee +gg +hh +ii +jj +mm +pp +uu +ww +DROP TABLE IF EXISTS c,cc; +SET @save_old_sql_mode= @@sql_mode; +SET sql_mode=""; +CREATE TABLE d ( +col_int int(11) DEFAULT NULL, +col_varchar_10_utf8 varchar(10) CHARACTER SET utf8 DEFAULT NULL, +pk int(11) NOT NULL AUTO_INCREMENT, +col_int_key int(11) GENERATED ALWAYS AS (col_int+col_int) VIRTUAL, +col_varchar_10_utf8_key varchar(10) CHARACTER SET utf8 GENERATED ALWAYS AS (REPEAT(SUBSTRING(col_varchar_10_utf8, -1), 5)) VIRTUAL, +PRIMARY KEY (pk), +KEY col_int_key (col_int_key), +KEY col_varchar_10_utf8_key (col_varchar_10_utf8_key), +KEY cover_key1 (col_int_key, col_varchar_10_utf8_key) +); +INSERT INTO d (col_int, col_varchar_10_utf8) VALUES ('qhlhtrovam',1),('how',2),('htrovamzqr',3),('rovamzqrdc',4),('well',5),('g',6),('rdcenchyhu',7),('want',8); +SELECT table1.pk AS field1 FROM d AS table1 LEFT JOIN d AS table2 ON table1.col_varchar_10_utf8_key = table2.col_varchar_10_utf8_key WHERE table1.col_int_key IS NULL GROUP BY table1.pk ; +field1 +DROP TABLE d; +# +# Bug#21153237: WL8149: QUERIES USING FILESORT +# ON VIRTUAL GC HAVING INDEX GIVES WRONG RESULTS +# +CREATE TABLE j ( +col_int int(11), +pk int(11) NOT NULL, +col_varchar_10_utf8 varchar(10) CHARACTER SET utf8 DEFAULT NULL, +col_varchar_255_utf8_key varchar(255) CHARACTER SET utf8 GENERATED ALWAYS AS +(col_varchar_10_utf8) VIRTUAL, +PRIMARY KEY (pk), +KEY cover_key1 (col_int, col_varchar_255_utf8_key)); +INSERT INTO j(col_int, pk, col_varchar_10_utf8) VALUES(9, 1, '951910400'), +(-1934295040, 2, '1235025920'),(-584581120, 3, '-1176633344'),(3, 4, '1074462720'); +EXPLAIN SELECT col_varchar_255_utf8_key FROM j ORDER BY 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE j index NULL cover_key1 773 NULL 4 # +SELECT col_varchar_255_utf8_key FROM j ORDER BY col_varchar_255_utf8_key; +col_varchar_255_utf8_key +-117663334 +1074462720 +1235025920 +951910400 +DROP TABLE j; +set sql_mode= @save_old_sql_mode; +CREATE TABLE cc ( +pk int(11) NOT NULL AUTO_INCREMENT, +col_int_nokey int(11) NOT NULL, +col_int_key int(11) GENERATED ALWAYS AS (col_int_nokey) STORED, +col_date_nokey date NOT NULL, +col_date_key date GENERATED ALWAYS AS (col_date_nokey) STORED, +col_datetime_nokey datetime NOT NULL, +col_time_nokey time NOT NULL, +col_datetime_key datetime GENERATED ALWAYS AS (col_datetime_nokey)STORED, +col_time_key time GENERATED ALWAYS AS (col_time_nokey) STORED, +col_varchar_nokey varchar(1) NOT NULL, +col_varchar_key varchar(1) GENERATED ALWAYS AS (col_varchar_nokey)STORED, +PRIMARY KEY (pk), +KEY gc_idx1 (col_int_key), +KEY gc_idx2 (col_varchar_key), +KEY gc_idx3 (col_date_key), +KEY gc_idx4 (col_time_key), +KEY gc_idx5 (col_datetime_key), +KEY gc_idx6 (col_varchar_key,col_int_key), +KEY gc_idx7 (col_date_key,col_datetime_key,col_time_key), +KEY gc_idx8(col_int_key,col_varchar_key,col_date_key,col_time_key, +col_datetime_key) +); +INSERT INTO cc ( +col_int_nokey, +col_date_nokey, +col_time_nokey, +col_datetime_nokey, +col_varchar_nokey +) VALUES (1, '2009-12-01', '00:21:38.058143', '2007-05-28 00:00:00', 'c'), +(8, '2004-12-17', '04:08:02.046897', '2009-07-25 09:21:20.064099', 'm'), +(9, '2000-03-14', '16:25:11.040240', '2002-01-16 00:00:00', 'd'), +(24, '2000-10-08', '10:14:58.018534', '2006-10-12 04:32:53.031976', 'd'), +(6, '2006-05-25', '19:47:59.011283', '2001-02-15 03:08:38.035426', 'y'), +(1, '2008-01-23', '11:14:24.032949', '2004-10-02 20:31:15.022553', 't'); +SET @save_old_sql_mode= @@sql_mode; +SET sql_mode=""; +SELECT DISTINCT alias1.col_varchar_key AS field1 +FROM ( cc AS alias1 STRAIGHT_JOIN +(( cc AS alias2 STRAIGHT_JOIN cc AS alias3 ON +(alias3.col_varchar_key > alias2.col_varchar_key ) ) ) ON +(( alias3 .pk >= alias2.col_int_nokey ) AND +(alias3 .pk >= alias2.col_int_nokey ) )) +WHERE alias1.col_varchar_key <= 'v' +GROUP BY field1 HAVING field1 = 91 +ORDER BY field1, alias1.col_date_key, field1 ASC, field1 DESC, +alias1.col_time_key ASC, field1; +field1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'c' +Warning 1292 Truncated incorrect DOUBLE value: 't' +Warning 1292 Truncated incorrect DOUBLE value: 'm' +Warning 1292 Truncated incorrect DOUBLE value: 'd' +DROP TABLE cc; +SET sql_mode=@save_old_sql_mode; +# +# Bug#20797941: WL8149:ASSERTION !TABLE || +# (!TABLE->READ_SET || BITMAP_IS_SET(TABLE->READ_SET +# +CREATE TABLE t(a int, b int as(a+1)); +INSERT INTO t(a) values(1),(2); +SELECT * FROM t ORDER BY b; +a b +1 2 +2 3 +DROP TABLE t; +# +# Testing a few index-based accesses on the virtual column +# +CREATE TABLE t1 ( +id int(11) NOT NULL, +b int(11) GENERATED ALWAYS AS (id+1) VIRTUAL, +UNIQUE KEY (b) ); +INSERT INTO t1 (id) VALUES(NULL); +ERROR 23000: Column 'id' cannot be null +INSERT INTO t1 (id) VALUES(2),(3); +EXPLAIN SELECT * FROM t1 FORCE INDEX(b) WHERE b=3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 const b b 5 const 1 +EXPLAIN SELECT * FROM t1 AS t2 STRAIGHT_JOIN t1 FORCE INDEX(b) WHERE t1.b=t2.b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL b NULL NULL NULL 2 Using where +1 SIMPLE t1 ref b b 5 test.t2.b 2 +EXPLAIN SELECT b FROM t1 FORCE INDEX(b); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL b 5 NULL 2 Using index +INSERT INTO t1 (id) VALUES(4),(5),(6),(7),(8),(9),(10); +EXPLAIN SELECT b FROM t1 FORCE INDEX(b) WHERE b BETWEEN 1 AND 5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range b b 5 NULL 3 Using where; Using index +EXPLAIN SELECT * FROM t2 AS t1 WHERE b NOT IN (SELECT b FROM t1 FORCE INDEX(b)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 system NULL NULL NULL NULL 1 +2 SUBQUERY t1 index_subquery b b 5 func 2 Using index; Full scan on NULL key +DROP TABLE t1; +DROP TABLE t2, t3; +# +# Bug#21317507:GC: STORED COLUMN REJECTED, BUT VIRTUAL IS ACCEPTED +# +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(2147483647); +ALTER TABLE t1 ADD COLUMN b SMALLINT AS (a) VIRTUAL; +Warnings: +Warning 1264 Out of range value for column 'b' at row 1 +ALTER TABLE t1 DROP COLUMN b; +ALTER TABLE t1 ADD COLUMN c SMALLINT AS (a) VIRTUAL; +Warnings: +Warning 1264 Out of range value for column 'c' at row 1 +ALTER TABLE t1 DROP COLUMN c; +ALTER TABLE t1 ADD COLUMN d SMALLINT AS (a) VIRTUAL; +Warnings: +Warning 1264 Out of range value for column 'd' at row 1 +ALTER TABLE t1 DROP COLUMN d; +ALTER TABLE t1 ADD COLUMN c INT AS(a) VIRTUAL; +ALTER TABLE t1 CHANGE c c SMALLINT AS(a) VIRTUAL; +Warnings: +Warning 1264 Out of range value for column 'c' at row 1 +ALTER TABLE t1 MODIFY c TINYINT AS(a) VIRTUAL; +Warnings: +Warning 1264 Out of range value for column 'c' at row 1 +SELECT * FROM t1; +a c +2147483647 127 +DROP TABLE t1; +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(2147483647); +ALTER TABLE t1 ADD COLUMN h INT AS (a) VIRTUAL; +ALTER TABLE t1 CHANGE h i INT AS (a) VIRTUAL, ALGORITHM=COPY; +ALTER TABLE t1 ADD COLUMN b SMALLINT AS (a) VIRTUAL, ALGORITHM=COPY, LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED +ALTER TABLE t1 ADD COLUMN e SMALLINT AS (a) VIRTUAL, ALGORITHM=COPY, LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED +ALTER TABLE t1 ADD COLUMN f SMALLINT AS (a) VIRTUAL, ALGORITHM=COPY, LOCK=SHARED; +Warnings: +Warning 1264 Out of range value for column 'f' at row 1 +ALTER TABLE t1 ADD COLUMN g SMALLINT AS (a) VIRTUAL, ALGORITHM=COPY, LOCK=EXCLUSIVE; +Warnings: +Warning 1264 Out of range value for column 'f' at row 1 +Warning 1264 Out of range value for column 'g' at row 1 +DROP TABLE t1; +# +# Bug#21980430 GCOLS: CRASHING +# +CREATE TABLE t ( +a INT, +b BLOB, +c BLOB GENERATED ALWAYS AS (a+b) VIRTUAL, +UNIQUE KEY i0008 (a) +); +INSERT INTO t(a,b) VALUES(1,'cccc'); +EXPLAIN SELECT /*+ bka() */ 1 AS c FROM t AS b RIGHT JOIN t AS c ON b.a > c.c +WHERE b.b>c.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'cccc' +Warning 1292 Truncated incorrect DOUBLE value: 'cccc' +SELECT /*+ bka() */ 1 AS c FROM t AS b RIGHT JOIN t AS c ON b.a > c.c +WHERE b.b>c.a; +c +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'cccc' +Warning 1292 Truncated incorrect DOUBLE value: 'cccc' +DROP TABLE t; +set @optimizer_switch_save = @@optimizer_switch; +set optimizer_switch='mrr_cost_based=off'; +set @read_rnd_buffer_size_save= @@read_rnd_buffer_size; +set read_rnd_buffer_size=32; +CREATE TABLE t0 ( +i1 INTEGER NOT NULL +); +INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +CREATE TABLE t1 ( +pk INTEGER NOT NULL, +i1 INTEGER NOT NULL, +i2 INTEGER NOT NULL, +v1 INTEGER GENERATED ALWAYS AS (i2 + 1) VIRTUAL, +v2 INTEGER GENERATED ALWAYS AS (i1 / (i1 - i2 + 57)) VIRTUAL, +PRIMARY KEY (pk), +INDEX idx(i1) +); +INSERT INTO t1 (pk, i1, i2) +SELECT a0.i1 + a1.i1*10 + a2.i1*100, +a0.i1 + a1.i1*10, +a0.i1 + a1.i1*10 +FROM t0 AS a0, t0 AS a1, t0 AS a2; +EXPLAIN SELECT * FROM t1 +WHERE i1 > 41 AND i1 <= 43; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range idx idx 4 NULL 19 Using index condition +SELECT * FROM t1 +WHERE i1 > 41 AND i1 <= 43; +pk i1 i2 v1 v2 +142 42 42 43 1 +143 43 43 44 1 +242 42 42 43 1 +243 43 43 44 1 +342 42 42 43 1 +343 43 43 44 1 +42 42 42 43 1 +43 43 43 44 1 +442 42 42 43 1 +443 43 43 44 1 +542 42 42 43 1 +543 43 43 44 1 +642 42 42 43 1 +643 43 43 44 1 +742 42 42 43 1 +743 43 43 44 1 +842 42 42 43 1 +843 43 43 44 1 +942 42 42 43 1 +943 43 43 44 1 +ALTER TABLE t1 ADD INDEX idx2(v1); +EXPLAIN SELECT * FROM t1 +WHERE v1 > 41 AND v1 <= 43; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range idx2 idx2 5 NULL # Using index condition +SELECT * FROM t1 +WHERE v1 > 41 AND v1 <= 43; +pk i1 i2 v1 v2 +141 41 41 42 1 +142 42 42 43 1 +241 41 41 42 1 +242 42 42 43 1 +341 41 41 42 1 +342 42 42 43 1 +41 41 41 42 1 +42 42 42 43 1 +441 41 41 42 1 +442 42 42 43 1 +541 41 41 42 1 +542 42 42 43 1 +641 41 41 42 1 +642 42 42 43 1 +741 41 41 42 1 +742 42 42 43 1 +841 41 41 42 1 +842 42 42 43 1 +941 41 41 42 1 +942 42 42 43 1 +DROP TABLE t0, t1; +set optimizer_switch= @optimizer_switch_save; +set @@read_rnd_buffer_size= @read_rnd_buffer_size_save; +# +# Bug#21872184 CONDITIONAL JUMP AT JOIN_CACHE::WRITE_RECORD_DATA IN +# SQL_JOIN_BUFFER.CC +# +# +# Test 1: Dynamic range scan with one covering index +# +CREATE TABLE t1 ( +i1 INTEGER NOT NULL, +c1 VARCHAR(1) NOT NULL +); +INSERT INTO t1 +VALUES (10, 'c'), (10, 'i'), (2, 't'), (4, 'g'); +CREATE TABLE t2 ( +i1 INTEGER NOT NULL, +c1 VARCHAR(1) NOT NULL +); +INSERT INTO t2 +VALUES (2, 'k'), (9, 'k'), (7, 'o'), (5, 'n'), (7, 'e'); +CREATE TABLE t3 ( +pk INTEGER NOT NULL, +i1 INTEGER, +i2_key INTEGER GENERATED ALWAYS AS (i1 + i1) VIRTUAL, +PRIMARY KEY (pk) +); +# Add a covering index. The reason for this index being covering is that +# secondary indexes in InnoDB include the primary key. +ALTER TABLE t3 ADD INDEX v_idx (i2_key); +INSERT INTO t3 (pk, i1) +VALUES (1, 1), (2, 48), (3, 228), (4, 3), (5, 5), +(6, 39), (7, 6), (8, 8), (9, 3); +CREATE TABLE t4 ( +i1 INTEGER NOT NULL, +c1 VARCHAR(1) NOT NULL +); +INSERT INTO t4 +VALUES (1, 'j'), (2, 'c'), (0, 'a'); +ANALYZE TABLE t1, t2, t3, t4; +Table Op Msg_type Msg_text +test.t1 analyze status OK +test.t2 analyze status OK +test.t3 analyze status OK +test.t4 analyze status OK +EXPLAIN SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN +( +SELECT /*+ QB_NAME(subq1) */ t4.i1 +FROM t4 +WHERE t4.c1 < 'o' + ) +) +AND t1.i1 <= t3.i2_key; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL distinct_key NULL NULL NULL 3 +1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) +1 PRIMARY t3 eq_ref PRIMARY,v_idx PRIMARY 4 test.t4.i1 1 Using where +1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) +2 MATERIALIZED t4 ALL NULL NULL NULL NULL 3 Using where +SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN +( +SELECT /*+ QB_NAME(subq1) */ t4.i1 +FROM t4 +WHERE t4.c1 < 'o' + ) +) +AND t1.i1 <= t3.i2_key; +c1 i1 +c 2 +c 5 +c 7 +c 7 +c 9 +g 2 +g 5 +g 7 +g 7 +g 9 +i 2 +i 5 +i 7 +i 7 +i 9 +t 2 +t 2 +t 5 +t 5 +t 7 +t 7 +t 7 +t 7 +t 9 +t 9 +# +# Test 2: Two alternative covering indexes for the range scan +# +ALTER TABLE t3 ADD INDEX v_idx2 (i2_key, i1); +EXPLAIN SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN +( +SELECT /*+ QB_NAME(subq1) */ t4.i1 +FROM t4 +WHERE t4.c1 < 'o' + ) +) +AND t1.i1 <= t3.i2_key; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL distinct_key NULL NULL NULL 3 +1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) +1 PRIMARY t3 eq_ref PRIMARY,v_idx,v_idx2 PRIMARY 4 test.t4.i1 1 Using where +1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) +2 MATERIALIZED t4 ALL NULL NULL NULL NULL 3 Using where +SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN +( +SELECT /*+ QB_NAME(subq1) */ t4.i1 +FROM t4 +WHERE t4.c1 < 'o' + ) +) +AND t1.i1 <= t3.i2_key; +c1 i1 +c 2 +c 5 +c 7 +c 7 +c 9 +g 2 +g 5 +g 7 +g 7 +g 9 +i 2 +i 5 +i 7 +i 7 +i 9 +t 2 +t 2 +t 5 +t 5 +t 7 +t 7 +t 7 +t 7 +t 9 +t 9 +# +# Test 3: One covering index including the base column for the virtual +# column +# +# Drop the index with only the virtual column +ALTER TABLE t3 DROP INDEX v_idx; +EXPLAIN SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN +( +SELECT /*+ QB_NAME(subq1) */ t4.i1 +FROM t4 +WHERE t4.c1 < 'o' + ) +) +AND t1.i1 <= t3.i2_key; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL distinct_key NULL NULL NULL 3 +1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) +1 PRIMARY t3 eq_ref PRIMARY,v_idx2 PRIMARY 4 test.t4.i1 1 Using where +1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) +2 MATERIALIZED t4 ALL NULL NULL NULL NULL 3 Using where +SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN +( +SELECT /*+ QB_NAME(subq1) */ t4.i1 +FROM t4 +WHERE t4.c1 < 'o' + ) +) +AND t1.i1 <= t3.i2_key; +c1 i1 +c 2 +c 5 +c 7 +c 7 +c 9 +g 2 +g 5 +g 7 +g 7 +g 9 +i 2 +i 5 +i 7 +i 7 +i 9 +t 2 +t 2 +t 5 +t 5 +t 7 +t 7 +t 7 +t 7 +t 9 +t 9 +# +# Test 4: One non-covering index +# +# Drop the index on two columns, add index on just one virtual column +ALTER TABLE t3 DROP INDEX v_idx2; +ALTER TABLE t3 ADD INDEX v_idx (i2_key); +# Add more data to the table so that it will run the dynamic range scan +# as both table scan and range scan (the purpose of this is to make the +# table scan more expensive). +INSERT INTO t3 (pk, i1) +VALUES (10,1), (11,1), (12,1), (13,1), (14,1),(15,1), (16,1),(17,1), (18,1), +(19,1), (20,1), (21,1), (22,1), (23,1), (24,1),(25,1),(26,1),(27,1), +(28,1), (29,1); +# Change the query to read an extra column (t3.i1) making the index +# non-covering. +EXPLAIN SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1, t3.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN +( +SELECT /*+ QB_NAME(subq1) */ t4.i1 +FROM t4 +WHERE t4.c1 < 'o' + ) +) +AND t1.i1 <= t3.i2_key; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL distinct_key NULL NULL NULL 3 +1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) +1 PRIMARY t3 eq_ref PRIMARY,v_idx PRIMARY 4 test.t4.i1 1 Using where +1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) +2 MATERIALIZED t4 ALL NULL NULL NULL NULL 3 Using where +SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1, t3.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN +( +SELECT /*+ QB_NAME(subq1) */ t4.i1 +FROM t4 +WHERE t4.c1 < 'o' + ) +) +AND t1.i1 <= t3.i2_key; +c1 i1 i1 +c 2 48 +c 5 48 +c 7 48 +c 7 48 +c 9 48 +g 2 48 +g 5 48 +g 7 48 +g 7 48 +g 9 48 +i 2 48 +i 5 48 +i 7 48 +i 7 48 +i 9 48 +t 2 1 +t 2 48 +t 5 1 +t 5 48 +t 7 1 +t 7 1 +t 7 48 +t 7 48 +t 9 1 +t 9 48 +# +# Test 5: Test where the added primary key to secondary indexes is +# used after it has been included in the join buffer +# +EXPLAIN SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN +( +SELECT /*+ QB_NAME(subq1) */ t4.i1 +FROM t4 +WHERE t4.c1 < 'o' and t4.i1 < (t2.i1 + 1) +) +) +AND t1.i1 <= t3.i2_key; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t4 ALL NULL NULL NULL NULL 3 Using where; Start temporary +1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) +1 PRIMARY t3 eq_ref PRIMARY,v_idx PRIMARY 4 test.t4.i1 1 Using where +1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where; End temporary; Using join buffer (flat, BNL join) +SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 +FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 +WHERE ( t3.pk IN +( +SELECT /*+ QB_NAME(subq1) */ t4.i1 +FROM t4 +WHERE t4.c1 < 'o' and t4.i1 < (t2.i1 + 1) +) +) +AND t1.i1 <= t3.i2_key; +c1 i1 +c 2 +c 5 +c 7 +c 7 +c 9 +g 2 +g 5 +g 7 +g 7 +g 9 +i 2 +i 5 +i 7 +i 7 +i 9 +t 2 +t 2 +t 5 +t 5 +t 7 +t 7 +t 7 +t 7 +t 9 +t 9 +DROP TABLE t1, t2, t3, t4; +SET optimizer_switch='derived_merge=default'; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_supported_sql_funcs_innodb.result b/mysql-test/suite/gcol/r/gcol_supported_sql_funcs_innodb.result new file mode 100644 index 00000000000..25e07e450d9 --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_supported_sql_funcs_innodb.result @@ -0,0 +1,3000 @@ +SET @@session.default_storage_engine = 'InnoDB'; +set time_zone="+03:00"; +# +# NUMERIC FUNCTIONS +# +# ABS() +set sql_warnings = 1; +create table t1 (a int, b int generated always as (abs(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (abs(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (-1, default); +select * from t1; +a b +-1 1 +drop table t1; +set sql_warnings = 0; +# ACOS() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(acos(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(acos(`a`),6)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1, default); +insert into t1 values (1.0001,default); +insert into t1 values (0,default); +select * from t1; +a b +0 1.570796 +1 0 +1.0001 NULL +drop table t1; +set sql_warnings = 0; +# ASIN() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(asin(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(asin(`a`),6)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (0.2, default); +insert into t1 values (1.0001,default); +select * from t1; +a b +0.2 0.201358 +1.0001 NULL +drop table t1; +set sql_warnings = 0; +#ATAN +set sql_warnings = 1; +create table t1 (a double, b double, c double generated always as (format(atan(a,b),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double DEFAULT NULL, + `c` double GENERATED ALWAYS AS (format(atan(`a`,`b`),6)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (-2,2,default); +insert into t1 values (format(PI(),6),0,default); +select * from t1; +a b c +-2 2 -0.785398 +3.141593 0 1.570796 +drop table t1; +set sql_warnings = 0; +set sql_warnings = 1; +create table t1 (a double, c double generated always as (format(atan(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `c` double GENERATED ALWAYS AS (format(atan(`a`),6)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (-2,default); +insert into t1 values (format(PI(),6),default); +select * from t1; +a c +-2 -1.107149 +3.141593 1.262627 +drop table t1; +set sql_warnings = 0; +# ATAN2 +set sql_warnings = 1; +create table t1 (a double, b double, c double generated always as (format(atan2(a,b),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double DEFAULT NULL, + `c` double GENERATED ALWAYS AS (format(atan(`a`,`b`),6)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (-2,2,default); +insert into t1 values (format(PI(),6),0,default); +select * from t1; +a b c +-2 2 -0.785398 +3.141593 0 1.570796 +drop table t1; +set sql_warnings = 0; +# CEIL() +set sql_warnings = 1; +create table t1 (a double, b int generated always as (ceil(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (ceiling(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1.23,default); +insert into t1 values (-1.23,default); +select * from t1; +a b +-1.23 -1 +1.23 2 +drop table t1; +set sql_warnings = 0; +# CONV() +set sql_warnings = 1; +create table t1 (a varchar(10), b int, c int, d varchar(10) generated always as (conv(a,b,c)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` varchar(10) GENERATED ALWAYS AS (conv(`a`,`b`,`c`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('a',16,2,default); +insert into t1 values ('6e',18,8,default); +insert into t1 values (-17,10,-18,default); +insert into t1 values (10+'10'+'10'+0xa,10,10,default); +select * from t1; +a b c d +-17 10 -18 -H +40 10 10 40 +6e 18 8 172 +a 16 2 1010 +drop table t1; +set sql_warnings = 0; +# COS() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(cos(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(cos(`a`),6)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (format(PI(),6),default); +select * from t1; +a b +3.141593 -1 +drop table t1; +set sql_warnings = 0; +# COT() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(cot(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(cot(`a`),6)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (0,default); +insert into t1 values (12,default); +select * from t1; +a b +12 -1.572673 +drop table t1; +set sql_warnings = 0; +# CRC32() +set sql_warnings = 1; +create table t1 (a varchar(10), b bigint generated always as (crc32(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` bigint(20) GENERATED ALWAYS AS (crc32(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +insert into t1 values ('mysql',default); +select * from t1; +a b +MySQL 3259397556 +mysql 2501908538 +drop table t1; +set sql_warnings = 0; +# DEGREES() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(degrees(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(degrees(`a`),6)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (format(PI(),6),default); +insert into t1 values (format(PI()/2,6),default); +select * from t1; +a b +1.570796 89.999981 +3.141593 180.00002 +drop table t1; +set sql_warnings = 0; +# / +set sql_warnings = 1; +create table t1 (a double, b double generated always as (a/2) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (`a` / 2) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (2,default); +select * from t1; +a b +2 1 +drop table t1; +set sql_warnings = 0; +# EXP() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(exp(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(exp(`a`),6)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (2,default); +insert into t1 values (-2,default); +insert into t1 values (0,default); +select * from t1; +a b +-2 0.135335 +0 1 +2 7.389056 +drop table t1; +set sql_warnings = 0; +# FLOOR() +set sql_warnings = 1; +create table t1 (a double, b bigint generated always as (floor(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` bigint(20) GENERATED ALWAYS AS (floor(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1.23,default); +insert into t1 values (-1.23,default); +select * from t1; +a b +-1.23 -2 +1.23 1 +drop table t1; +set sql_warnings = 0; +# LN() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(ln(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(ln(`a`),6)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (2,default); +insert into t1 values (-2,default); +select * from t1; +a b +-2 NULL +2 0.693147 +drop table t1; +set sql_warnings = 0; +# LOG() +set sql_warnings = 1; +create table t1 (a double, b double, c double generated always as (format(log(a,b),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double DEFAULT NULL, + `c` double GENERATED ALWAYS AS (format(log(`a`,`b`),6)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (2,65536,default); +insert into t1 values (10,100,default); +insert into t1 values (1,100,default); +select * from t1; +a b c +1 100 NULL +10 100 2 +2 65536 16 +drop table t1; +set sql_warnings = 0; +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(log(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(log(`a`),6)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (2,default); +insert into t1 values (-2,default); +select * from t1; +a b +-2 NULL +2 0.693147 +drop table t1; +set sql_warnings = 0; +# LOG2() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(log2(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(log2(`a`),6)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (65536,default); +insert into t1 values (-100,default); +select * from t1; +a b +-100 NULL +65536 16 +drop table t1; +set sql_warnings = 0; +# LOG10() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(log10(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(log10(`a`),6)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (2,default); +insert into t1 values (100,default); +insert into t1 values (-100,default); +select * from t1; +a b +-100 NULL +100 2 +2 0.30103 +drop table t1; +set sql_warnings = 0; +# - +set sql_warnings = 1; +create table t1 (a double, b double generated always as (a-1) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (`a` - 1) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (2,default); +select * from t1; +a b +2 1 +drop table t1; +set sql_warnings = 0; +# MOD() +set sql_warnings = 1; +create table t1 (a int, b int generated always as (mod(a,10)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 10) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (11,default); +select * from t1; +a b +1 1 +11 1 +drop table t1; +set sql_warnings = 0; +# % +set sql_warnings = 1; +create table t1 (a int, b int generated always as (a % 10) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 10) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (11,default); +select * from t1; +a b +1 1 +11 1 +drop table t1; +set sql_warnings = 0; +# OCT() +set sql_warnings = 1; +create table t1 (a double, b varchar(10) generated always as (oct(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (conv(`a`,10,8)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (12,default); +select * from t1; +a b +12 14 +drop table t1; +set sql_warnings = 0; +# PI() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(PI()*a*a,6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(pi() * `a` * `a`,6)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +select * from t1; +a b +1 3.141593 +drop table t1; +set sql_warnings = 0; +# + +set sql_warnings = 1; +create table t1 (a int, b int generated always as (a+1) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +select * from t1; +a b +1 2 +drop table t1; +set sql_warnings = 0; +# POW, POWER +set sql_warnings = 1; +create table t1 (a int, b int generated always as (pow(a,2)) virtual, c int generated always as (power(a,2)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (pow(`a`,2)) VIRTUAL, + `c` int(11) GENERATED ALWAYS AS (pow(`a`,2)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1,default,default); +insert into t1 values (2,default,default); +select * from t1; +a b c +1 1 1 +2 4 4 +drop table t1; +set sql_warnings = 0; +# RADIANS() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(radians(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(radians(`a`),6)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (90,default); +select * from t1; +a b +90 1.570796 +drop table t1; +set sql_warnings = 0; +# ROUND() +set sql_warnings = 1; +create table t1 (a double, b int generated always as (round(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (round(`a`,0)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (-1.23,default); +insert into t1 values (-1.58,default); +insert into t1 values (1.58,default); +select * from t1; +a b +-1.23 -1 +-1.58 -2 +1.58 2 +drop table t1; +set sql_warnings = 0; +set sql_warnings = 1; +create table t1 (a double, b double, c int generated always as (round(a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (round(`a`,`b`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1.298,1,default); +insert into t1 values (1.298,0,default); +insert into t1 values (23.298,-1,default); +select * from t1; +a b c +1.298 0 1 +1.298 1 1 +23.298 -1 20 +drop table t1; +set sql_warnings = 0; +# SIGN() +set sql_warnings = 1; +create table t1 (a double, b int generated always as (sign(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (sign(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (-32,default); +insert into t1 values (0,default); +insert into t1 values (234,default); +select * from t1; +a b +-32 -1 +0 0 +234 1 +drop table t1; +set sql_warnings = 0; +# SIN() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(sin(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(sin(`a`),6)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (format(PI()/2,6),default); +select * from t1; +a b +1.570796 1 +drop table t1; +set sql_warnings = 0; +# SQRT() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(sqrt(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(sqrt(`a`),6)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (4,default); +insert into t1 values (20,default); +insert into t1 values (-16,default); +select * from t1; +a b +-16 NULL +20 4.472136 +4 2 +drop table t1; +set sql_warnings = 0; +# TAN() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(tan(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(tan(`a`),6)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (format(PI(),6),default); +insert into t1 values (format(PI()+1,6),default); +select * from t1; +a b +3.141593 0 +4.141593 1.557409 +drop table t1; +set sql_warnings = 0; +# * +set sql_warnings = 1; +create table t1 (a double, b double generated always as (a*3) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (`a` * 3) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (0,default); +insert into t1 values (1,default); +insert into t1 values (2,default); +select * from t1; +a b +0 0 +1 3 +2 6 +drop table t1; +set sql_warnings = 0; +# TRUNCATE() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (truncate(a,4)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (truncate(`a`,4)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1.223,default); +insert into t1 values (1.999,default); +insert into t1 values (1.999,default); +insert into t1 values (122,default); +select * from t1; +a b +1.223 1.223 +1.999 1.999 +1.999 1.999 +122 122 +drop table t1; +set sql_warnings = 0; +# Unary - +set sql_warnings = 1; +create table t1 (a double, b double generated always as (-a) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (-`a`) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (-1,default); +select * from t1; +a b +-1 1 +1 -1 +drop table t1; +set sql_warnings = 0; +# +# STRING FUNCTIONS +# +# ASCII() +set sql_warnings = 1; +create table t1 (a char(2), b int generated always as (ascii(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(2) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (ascii(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2',default); +insert into t1 values (2,default); +insert into t1 values ('dx',default); +select * from t1; +a b +2 50 +2 50 +dx 100 +drop table t1; +set sql_warnings = 0; +# BIN() +set sql_warnings = 1; +create table t1 (a int, b varchar(10) generated always as (bin(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (conv(`a`,10,2)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (12,default); +select * from t1; +a b +12 1100 +drop table t1; +set sql_warnings = 0; +# BIT_LENGTH() +set sql_warnings = 1; +create table t1 (a varchar(10), b bigint generated always as (bit_length(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` bigint(20) GENERATED ALWAYS AS (bit_length(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('text',default); +select * from t1; +a b +text 32 +drop table t1; +set sql_warnings = 0; +# CHAR_LENGTH() +set sql_warnings = 1; +create table t1 (a varchar(10), b bigint generated always as (char_length(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` bigint(20) GENERATED ALWAYS AS (char_length(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('text',default); +select * from t1; +a b +text 4 +drop table t1; +set sql_warnings = 0; +# CHAR() +set sql_warnings = 1; +create table t1 (a int, b int, c varbinary(10) generated always as (char(a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` varbinary(10) GENERATED ALWAYS AS (char(`a`,`b`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (77,121,default); +select * from t1; +a b c +77 121 My +drop table t1; +set sql_warnings = 0; +# CHARACTER_LENGTH() +set sql_warnings = 1; +create table t1 (a varchar(10), b bigint generated always as (character_length(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` bigint(20) GENERATED ALWAYS AS (char_length(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('text',default); +select * from t1; +a b +text 4 +drop table t1; +set sql_warnings = 0; +# CONCAT_WS() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c varchar(20) generated always as (concat_ws(',',a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` varchar(20) GENERATED ALWAYS AS (concat_ws(',',`a`,`b`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('value1','value2',default); +select * from t1; +a b c +value1 value2 value1,value2 +drop table t1; +set sql_warnings = 0; +# CONCAT() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c varchar(20) generated always as (concat(a,',',b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` varchar(20) GENERATED ALWAYS AS (concat(`a`,',',`b`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('value1','value2',default); +select * from t1; +a b c +value1 value2 value1,value2 +drop table t1; +set sql_warnings = 0; +# ELT() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c int, d varchar(10) generated always as (elt(c,a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` varchar(10) GENERATED ALWAYS AS (elt(`c`,`a`,`b`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('value1','value2',1,default); +insert into t1 values ('value1','value2',2,default); +select * from t1; +a b c d +value1 value2 1 value1 +value1 value2 2 value2 +drop table t1; +set sql_warnings = 0; +# EXPORT_SET() +set sql_warnings = 1; +create table t1 (a int, b varchar(10) generated always as (export_set(a,'1','0','',10)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (export_set(`a`,'1','0','',10)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (6,default); +select * from t1; +a b +6 0110000000 +drop table t1; +set sql_warnings = 0; +# FIELD() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c int generated always as (field('aa',a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (field('aa',`a`,`b`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('aa','bb',default); +insert into t1 values ('bb','aa',default); +select * from t1; +a b c +aa bb 1 +bb aa 2 +drop table t1; +set sql_warnings = 0; +# FIND_IN_SET() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c int generated always as (find_in_set(a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (find_in_set(`a`,`b`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('aa','aa,bb,cc',default); +insert into t1 values ('aa','bb,aa,cc',default); +select * from t1; +a b c +aa aa,bb,cc 1 +aa bb,aa,cc 2 +drop table t1; +set sql_warnings = 0; +# FORMAT() +set sql_warnings = 1; +create table t1 (a double, b varchar(20) generated always as (format(a,2)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` varchar(20) GENERATED ALWAYS AS (format(`a`,2)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (12332.123456,default); +select * from t1; +a b +12332.123456 12,332.12 +drop table t1; +set sql_warnings = 0; +# HEX() +set sql_warnings = 1; +create table t1 (a int, b varchar(10) generated always as (hex(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (hex(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (17,default); +select * from t1; +a b +17 11 +drop table t1; +set sql_warnings = 0; +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (hex(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (hex(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('abc',default); +select * from t1; +a b +abc 616263 +drop table t1; +set sql_warnings = 0; +# INSERT() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c varchar(20) generated always as (insert(a,length(a),length(b),b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` varchar(20) GENERATED ALWAYS AS (insert(`a`,length(`a`),length(`b`),`b`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('start,','end',default); +select * from t1; +a b c +start, end startend +drop table t1; +set sql_warnings = 0; +# INSTR() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c int generated always as (instr(a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (locate(`b`,`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('foobarbar,','bar',default); +insert into t1 values ('xbar,','foobar',default); +select * from t1; +a b c +foobarbar, bar 4 +xbar, foobar 0 +drop table t1; +set sql_warnings = 0; +# LCASE() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (lcase(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (lcase(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +select * from t1; +a b +MySQL mysql +drop table t1; +set sql_warnings = 0; +# LEFT() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(5) generated always as (left(a,5)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(5) GENERATED ALWAYS AS (left(`a`,5)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('foobarbar',default); +select * from t1; +a b +foobarbar fooba +drop table t1; +set sql_warnings = 0; +# LENGTH() +set sql_warnings = 1; +create table t1 (a varchar(10), b int generated always as (length(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (length(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('text',default); +select * from t1; +a b +text 4 +drop table t1; +set sql_warnings = 0; +# LIKE +set sql_warnings = 1; +create table t1 (a varchar(10), b bool generated always as (a like 'H%o') virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` tinyint(1) GENERATED ALWAYS AS (`a` like 'H%o') VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('Hello',default); +insert into t1 values ('MySQL',default); +select * from t1; +a b +Hello 1 +MySQL 0 +drop table t1; +set sql_warnings = 0; +# LOCATE() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (locate('bar',a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (locate('bar',`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('foobarbar',default); +select * from t1; +a b +foobarbar 4 +drop table t1; +set sql_warnings = 0; +# LOWER() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (lower(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (lcase(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +select * from t1; +a b +MySQL mysql +drop table t1; +set sql_warnings = 0; +# LPAD() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (lpad(a,4,' ')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (lpad(`a`,4,' ')) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +insert into t1 values ('M',default); +select * from t1; +a b +M M +MySQL MySQ +drop table t1; +set sql_warnings = 0; +# LTRIM() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (ltrim(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (ltrim(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (' MySQL',default); +insert into t1 values ('MySQL',default); +select * from t1; +a b + MySQL MySQL +MySQL MySQL +drop table t1; +set sql_warnings = 0; +# MAKE_SET() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c int, d varchar(30) generated always as (make_set(c,a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` varchar(30) GENERATED ALWAYS AS (make_set(`c`,`a`,`b`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('a','b',1,default); +insert into t1 values ('a','b',3,default); +select * from t1; +a b c d +a b 1 a +a b 3 a,b +drop table t1; +set sql_warnings = 0; +# MID() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (mid(a,1,2)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (substr(`a`,1,2)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('foobarbar',default); +select * from t1; +a b +foobarbar fo +drop table t1; +set sql_warnings = 0; +# NOT LIKE +set sql_warnings = 1; +create table t1 (a varchar(10), b bool generated always as (a not like 'H%o') virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` tinyint(1) GENERATED ALWAYS AS (`a` not like 'H%o') VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('Hello',default); +insert into t1 values ('MySQL',default); +select * from t1; +a b +Hello 0 +MySQL 1 +drop table t1; +set sql_warnings = 0; +# NOT REGEXP +set sql_warnings = 1; +create table t1 (a varchar(10), b bool generated always as (a not regexp 'H.+o') virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` tinyint(1) GENERATED ALWAYS AS (!(`a` regexp 'H.+o')) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('Hello',default); +insert into t1 values ('hello',default); +select * from t1; +a b +Hello 0 +hello 0 +drop table t1; +set sql_warnings = 0; +# OCTET_LENGTH() +set sql_warnings = 1; +create table t1 (a varchar(10), b int generated always as (octet_length(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (length(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('text',default); +select * from t1; +a b +text 4 +drop table t1; +set sql_warnings = 0; +# ORD() +set sql_warnings = 1; +create table t1 (a varchar(10), b bigint generated always as (ord(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` bigint(20) GENERATED ALWAYS AS (ord(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2',default); +select * from t1; +a b +2 50 +drop table t1; +set sql_warnings = 0; +# POSITION() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (position('bar' in a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (locate('bar',`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('foobarbar',default); +select * from t1; +a b +foobarbar 4 +drop table t1; +set sql_warnings = 0; +# QUOTE() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (quote(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (quote(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('Don\'t',default); +select * from t1; +a b +Don't 'Don\'t' +drop table t1; +set sql_warnings = 0; +# REGEXP() +set sql_warnings = 1; +create table t1 (a varchar(10), b bool generated always as (a regexp 'H.+o') virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` tinyint(1) GENERATED ALWAYS AS (`a` regexp 'H.+o') VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('Hello',default); +insert into t1 values ('hello',default); +select * from t1; +a b +Hello 1 +hello 1 +drop table t1; +set sql_warnings = 0; +# REPEAT() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(30) generated always as (repeat(a,3)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(30) GENERATED ALWAYS AS (repeat(`a`,3)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +select * from t1; +a b +MySQL MySQLMySQLMySQL +drop table t1; +set sql_warnings = 0; +# REPLACE() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(30) generated always as (replace(a,'aa','bb')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(30) GENERATED ALWAYS AS (replace(`a`,'aa','bb')) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('maa',default); +select * from t1; +a b +maa mbb +drop table t1; +set sql_warnings = 0; +# REVERSE() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(30) generated always as (reverse(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(30) GENERATED ALWAYS AS (reverse(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('maa',default); +select * from t1; +a b +maa aam +drop table t1; +set sql_warnings = 0; +# RIGHT() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (right(a,4)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (right(`a`,4)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('foobarbar',default); +select * from t1; +a b +foobarbar rbar +drop table t1; +set sql_warnings = 0; +# RLIKE() +set sql_warnings = 1; +create table t1 (a varchar(10), b bool generated always as (a rlike 'H.+o') virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` tinyint(1) GENERATED ALWAYS AS (`a` regexp 'H.+o') VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('Hello',default); +insert into t1 values ('MySQL',default); +select * from t1; +a b +Hello 1 +MySQL 0 +drop table t1; +set sql_warnings = 0; +# RPAD() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (rpad(a,4,'??')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (rpad(`a`,4,'??')) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('He',default); +select * from t1; +a b +He He?? +drop table t1; +set sql_warnings = 0; +# RTRIM(); +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (rtrim(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (rtrim(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('Hello ',default); +select * from t1; +a b +Hello Hello +drop table t1; +set sql_warnings = 0; +# SOUNDEX() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(20) generated always as (soundex(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(20) GENERATED ALWAYS AS (soundex(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('Hello',default); +select * from t1; +a b +Hello H400 +drop table t1; +set sql_warnings = 0; +# SOUNDS LIKE +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c bool generated always as (a sounds like b) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` tinyint(1) GENERATED ALWAYS AS (soundex(`a`) = soundex(`b`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('Hello','Hello',default); +insert into t1 values ('Hello','MySQL',default); +insert into t1 values ('Hello','hello',default); +select * from t1; +a b c +Hello Hello 1 +Hello MySQL 0 +Hello hello 1 +drop table t1; +set sql_warnings = 0; +# SPACE() +set sql_warnings = 1; +create table t1 (a varchar(5), b varchar(10) generated always as (concat(a,space(5))) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(5) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (concat(`a`,space(5))) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('Hello', default); +select * from t1; +a b +Hello Hello +drop table t1; +set sql_warnings = 0; +# STRCMP() +set sql_warnings = 1; +create table t1 (a varchar(9), b varchar(9), c tinyint(1) generated always as (strcmp(a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(9) DEFAULT NULL, + `b` varchar(9) DEFAULT NULL, + `c` tinyint(1) GENERATED ALWAYS AS (strcmp(`a`,`b`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('Hello','Hello', default); +insert into t1 values ('Hello','Hello1', default); +select * from t1; +a b c +Hello Hello 0 +Hello Hello1 -1 +drop table t1; +set sql_warnings = 0; +# SUBSTR() +set sql_warnings = 1; +create table t1 (a varchar(5), b varchar(10) generated always as (substr(a,2)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(5) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (substr(`a`,2)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('Hello',default); +select * from t1; +a b +Hello ello +drop table t1; +set sql_warnings = 0; +# SUBSTRING_INDEX() +set sql_warnings = 1; +create table t1 (a varchar(15), b varchar(10) generated always as (substring_index(a,'.',2)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(15) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (substring_index(`a`,'.',2)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('www.mysql.com',default); +select * from t1; +a b +www.mysql.com www.mysql +drop table t1; +set sql_warnings = 0; +# SUBSTRING() +set sql_warnings = 1; +create table t1 (a varchar(5), b varchar(10) generated always as (substring(a from 2 for 2)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(5) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (substr(`a`,2,2)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('Hello',default); +select * from t1; +a b +Hello el +drop table t1; +set sql_warnings = 0; +# TRIM() +set sql_warnings = 1; +create table t1 (a varchar(15), b varchar(10) generated always as (trim(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(15) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (trim(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (' aa ',default); +select * from t1; +a b + aa aa +drop table t1; +set sql_warnings = 0; +# UCASE() +set sql_warnings = 1; +create table t1 (a varchar(5), b varchar(10) generated always as (ucase(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(5) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (ucase(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +select * from t1; +a b +MySQL MYSQL +drop table t1; +set sql_warnings = 0; +# UNHEX() +set sql_warnings = 1; +create table t1 (a varchar(15), b varchar(10) generated always as (unhex(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(15) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (unhex(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('4D7953514C',default); +select * from t1; +a b +4D7953514C MySQL +drop table t1; +set sql_warnings = 0; +# UPPER() +set sql_warnings = 1; +create table t1 (a varchar(5), b varchar(10) generated always as (upper(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(5) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (ucase(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +select * from t1; +a b +MySQL MYSQL +drop table t1; +set sql_warnings = 0; +# WEIGHT_STRING() +set sql_warnings = 1; +create table t1 (a varchar(5), b varchar(10) generated always as (weight_string(a as char(4))) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(5) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (weight_string(`a`,0,4,65)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +select * from t1; +a b +MySQL MYSQ +drop table t1; +set sql_warnings = 0; +# +# CONTROL FLOW FUNCTIONS +# +# CASE +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(16) generated always as (case a when NULL then 'asd' when 'b' then 'B' else a end) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(16) GENERATED ALWAYS AS (case `a` when NULL then 'asd' when 'b' then 'B' else `a` end) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (NULL,default); +insert into t1 values ('b',default); +insert into t1 values ('c',default); +select * from t1; +a b +NULL NULL +b B +c c +drop table t1; +set sql_warnings = 0; +# IF +set sql_warnings = 1; +create table t1 (a int, b int, c int generated always as (if(a=1,a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (if(`a` = 1,`a`,`b`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1,2,default); +insert into t1 values (3,4,default); +select * from t1; +a b c +1 2 1 +3 4 4 +drop table t1; +set sql_warnings = 0; +# IFNULL +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c varchar(10) generated always as (ifnull(a,'DEFAULT')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` varchar(10) GENERATED ALWAYS AS (ifnull(`a`,'DEFAULT')) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (NULL,'adf',default); +insert into t1 values ('a','adf',default); +select * from t1; +a b c +NULL adf DEFAULT +a adf a +drop table t1; +set sql_warnings = 0; +# NULLIF +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (nullif(a,'DEFAULT')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (nullif(`a`,'DEFAULT')) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('DEFAULT',default); +insert into t1 values ('a',default); +select * from t1; +a b +DEFAULT NULL +a a +drop table t1; +set sql_warnings = 0; +# +# OPERATORS +# +# AND, && +set sql_warnings = 1; +create table t1 (a int, b bool generated always as (a>0 && a<2) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` tinyint(1) GENERATED ALWAYS AS (`a` > 0 and `a` < 2) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (-1,default); +insert into t1 values (1,default); +select * from t1; +a b +-1 0 +1 1 +drop table t1; +set sql_warnings = 0; +# BETWEEN ... AND ... +set sql_warnings = 1; +create table t1 (a int, b bool generated always as (a between 0 and 2) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` tinyint(1) GENERATED ALWAYS AS (`a` between 0 and 2) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (-1,default); +insert into t1 values (1,default); +select * from t1; +a b +-1 0 +1 1 +drop table t1; +set sql_warnings = 0; +# BINARY +set sql_warnings = 1; +create table t1 (a varchar(10), b varbinary(10) generated always as (binary a) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varbinary(10) GENERATED ALWAYS AS (cast(`a` as char charset binary)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('11',default); +insert into t1 values (1,default); +select * from t1; +a b +1 1 +11 11 +drop table t1; +set sql_warnings = 0; +# & +set sql_warnings = 1; +create table t1 (a int, b int generated always as (a & 5) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` & 5) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (0,default); +select * from t1; +a b +0 0 +1 1 +drop table t1; +set sql_warnings = 0; +# ~ +set sql_warnings = 1; +create table t1 (a int, b int generated always as (~a) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (~`a`) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +Warnings: +Warning 1264 Out of range value for column 'b' at row 1 +select * from t1; +a b +1 2147483647 +drop table t1; +set sql_warnings = 0; +# | +set sql_warnings = 1; +create table t1 (a int, b int generated always as (a | 5) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` | 5) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (0,default); +insert into t1 values (2,default); +select * from t1; +a b +0 5 +1 5 +2 7 +drop table t1; +set sql_warnings = 0; +# ^ +set sql_warnings = 1; +create table t1 (a int, b int generated always as (a ^ 5) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` ^ 5) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (0,default); +insert into t1 values (2,default); +select * from t1; +a b +0 5 +1 4 +2 7 +drop table t1; +set sql_warnings = 0; +# DIV +set sql_warnings = 1; +create table t1 (a int, b int generated always as (a div 5) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` DIV 5) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (7,default); +select * from t1; +a b +1 0 +7 1 +drop table t1; +set sql_warnings = 0; +# <=> +set sql_warnings = 1; +create table t1 (a int, b int, c bool generated always as (a <=> b) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` tinyint(1) GENERATED ALWAYS AS (`a` <=> `b`) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1,1,default); +insert into t1 values (NULL,NULL,default); +insert into t1 values (1,NULL,default); +select * from t1; +a b c +1 1 1 +1 NULL 0 +NULL NULL 1 +drop table t1; +set sql_warnings = 0; +# = +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c bool generated always as (a=b) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` tinyint(1) GENERATED ALWAYS AS (`a` = `b`) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('a','b',default); +insert into t1 values ('a','a',default); +select * from t1; +a b c +a a 1 +a b 0 +drop table t1; +set sql_warnings = 0; +# >= +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c bool generated always as (a >= b) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` tinyint(1) GENERATED ALWAYS AS (`a` >= `b`) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('a','b',default); +insert into t1 values ('a','a',default); +select * from t1; +a b c +a a 1 +a b 0 +drop table t1; +set sql_warnings = 0; +# > +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c bool generated always as (a > b) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` tinyint(1) GENERATED ALWAYS AS (`a` > `b`) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('a','b',default); +insert into t1 values ('a','a',default); +select * from t1; +a b c +a a 0 +a b 0 +drop table t1; +set sql_warnings = 0; +# IS NOT NULL +set sql_warnings = 1; +create table t1 (a int, b bool generated always as (a is not null) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` tinyint(1) GENERATED ALWAYS AS (`a` is not null) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (NULL,default); +select * from t1; +a b +1 1 +NULL 0 +drop table t1; +set sql_warnings = 0; +# IS NULL +set sql_warnings = 1; +create table t1 (a int, b bool generated always as (a is null) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` tinyint(1) GENERATED ALWAYS AS (`a` is null) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (NULL,default); +select * from t1; +a b +1 0 +NULL 1 +drop table t1; +set sql_warnings = 0; +# << +set sql_warnings = 1; +create table t1 (a int, b int generated always as (a << 2) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` << 2) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (3,default); +select * from t1; +a b +1 4 +3 12 +drop table t1; +set sql_warnings = 0; +# <= +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c bool generated always as (a <= b) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` tinyint(1) GENERATED ALWAYS AS (`a` <= `b`) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('b','a',default); +insert into t1 values ('b','b',default); +insert into t1 values ('b','c',default); +select * from t1; +a b c +b a 0 +b b 1 +b c 1 +drop table t1; +set sql_warnings = 0; +# < +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c bool generated always as (a < b) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` tinyint(1) GENERATED ALWAYS AS (`a` < `b`) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('b','a',default); +insert into t1 values ('b','b',default); +insert into t1 values ('b','c',default); +select * from t1; +a b c +b a 0 +b b 0 +b c 1 +drop table t1; +set sql_warnings = 0; +# NOT BETWEEN ... AND ... +set sql_warnings = 1; +create table t1 (a int, b bool generated always as (a not between 0 and 2) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` tinyint(1) GENERATED ALWAYS AS (`a` not between 0 and 2) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (-1,default); +insert into t1 values (1,default); +select * from t1; +a b +-1 1 +1 0 +drop table t1; +set sql_warnings = 0; +# <> +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c bool generated always as (a <> b) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` tinyint(1) GENERATED ALWAYS AS (`a` <> `b`) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('b','a',default); +insert into t1 values ('b','b',default); +insert into t1 values ('b','c',default); +select * from t1; +a b c +b a 1 +b b 0 +b c 1 +drop table t1; +set sql_warnings = 0; +# != +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c bool generated always as (a != b) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` tinyint(1) GENERATED ALWAYS AS (`a` <> `b`) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('b','a',default); +insert into t1 values ('b','b',default); +insert into t1 values ('b','c',default); +select * from t1; +a b c +b a 1 +b b 0 +b c 1 +drop table t1; +set sql_warnings = 0; +# ||, OR +set sql_warnings = 1; +create table t1 (a int, b int generated always as (a>5 || a<3) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` > 5 or `a` < 3) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (4,default); +select * from t1; +a b +1 1 +4 0 +drop table t1; +set sql_warnings = 0; +# >> +set sql_warnings = 1; +create table t1 (a int, b int generated always as (a >> 2) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` >> 2) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (8,default); +insert into t1 values (3,default); +select * from t1; +a b +3 0 +8 2 +drop table t1; +set sql_warnings = 0; +# XOR +set sql_warnings = 1; +create table t1 (a int, b int generated always as (a xor 5) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` xor 5) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (0,default); +insert into t1 values (1,default); +insert into t1 values (2,default); +select * from t1; +a b +0 1 +1 0 +2 0 +drop table t1; +set sql_warnings = 0; +# +# DATE AND TIME FUNCTIONS +# +# ADDDATE() +set sql_warnings = 1; +create table t1 (a datetime, b datetime generated always as (adddate(a,interval 1 month)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (`a` + interval 1 month) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 2008-09-30 00:00:00 +drop table t1; +set sql_warnings = 0; +# ADDTIME() +set sql_warnings = 1; +create table t1 (a datetime, b datetime generated always as (addtime(a,'02:00:00')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (addtime(`a`,'02:00:00')) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 2008-08-31 02:00:00 +drop table t1; +set sql_warnings = 0; +# CONVERT_TZ() +set sql_warnings = 1; +create table t1 (a datetime, b datetime generated always as (convert_tz(a,'MET','UTC')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (convert_tz(`a`,'MET','UTC')) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 2008-08-30 22:00:00 +drop table t1; +set sql_warnings = 0; +# DATE_ADD() +set sql_warnings = 1; +create table t1 (a datetime, b datetime generated always as (date_add(a,interval 1 month)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (`a` + interval 1 month) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 2008-09-30 00:00:00 +drop table t1; +set sql_warnings = 0; +# DATE_FORMAT() +set sql_warnings = 1; +create table t1 (a datetime, b varchar(64) generated always as (date_format(a,'%W %M %D')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` varchar(64) GENERATED ALWAYS AS (date_format(`a`,'%W %M %D')) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 Sunday August 31st +drop table t1; +set sql_warnings = 0; +# DATE_SUB() +set sql_warnings = 1; +create table t1 (a datetime, b datetime generated always as (date_sub(a,interval 1 month)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (`a` - interval 1 month) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 2008-07-31 00:00:00 +drop table t1; +set sql_warnings = 0; +# DATE() +set sql_warnings = 1; +create table t1 (a datetime, b datetime generated always as (date(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (cast(`a` as date)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31 02:00:00',default); +select * from t1; +a b +2008-08-31 02:00:00 2008-08-31 00:00:00 +drop table t1; +set sql_warnings = 0; +# DATEDIFF() +set sql_warnings = 1; +create table t1 (a datetime, b bigint generated always as (datediff(a,'2000-01-01')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` bigint(20) GENERATED ALWAYS AS (to_days(`a`) - to_days('2000-01-01')) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 3165 +drop table t1; +set sql_warnings = 0; +# DAY() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (day(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (dayofmonth(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 31 +drop table t1; +set sql_warnings = 0; +# DAYNAME() +set sql_warnings = 1; +create table t1 (a datetime, b varchar(10) generated always as (dayname(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (dayname(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 Sunday +drop table t1; +set sql_warnings = 0; +# DAYOFMONTH() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (dayofmonth(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (dayofmonth(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 31 +drop table t1; +set sql_warnings = 0; +# DAYOFWEEK() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (dayofweek(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (dayofweek(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 1 +drop table t1; +set sql_warnings = 0; +# DAYOFYEAR() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (dayofyear(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (dayofyear(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 244 +drop table t1; +set sql_warnings = 0; +# EXTRACT +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (extract(year from a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (extract(year from `a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 2008 +drop table t1; +set sql_warnings = 0; +# FROM_DAYS() +set sql_warnings = 1; +create table t1 (a bigint, b datetime generated always as (from_days(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (from_days(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (730669,default); +select * from t1; +a b +730669 2000-07-03 00:00:00 +drop table t1; +set sql_warnings = 0; +# FROM_UNIXTIME() +set sql_warnings = 1; +create table t1 (a bigint, b datetime generated always as (from_unixtime(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (from_unixtime(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1196440219,default); +select * from t1; +a b +1196440219 2007-11-30 19:30:19 +drop table t1; +set sql_warnings = 0; +# GET_FORMAT() +set sql_warnings = 1; +create table t1 (a datetime, b varchar(32) generated always as (date_format(a,get_format(DATE,'EUR'))) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` varchar(32) GENERATED ALWAYS AS (date_format(`a`,get_format(DATE, 'EUR'))) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 31.08.2008 +drop table t1; +set sql_warnings = 0; +# HOUR() +set sql_warnings = 1; +create table t1 (a time, b bigint generated always as (hour(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` time DEFAULT NULL, + `b` bigint(20) GENERATED ALWAYS AS (hour(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('10:05:03',default); +select * from t1; +a b +10:05:03 10 +drop table t1; +set sql_warnings = 0; +# LAST_DAY() +set sql_warnings = 1; +create table t1 (a datetime, b datetime generated always as (last_day(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (last_day(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2003-02-05',default); +insert into t1 values ('2003-02-32',default); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +select * from t1; +a b +0000-00-00 00:00:00 NULL +2003-02-05 00:00:00 2003-02-28 00:00:00 +drop table t1; +set sql_warnings = 0; +# MAKEDATE() +set sql_warnings = 1; +create table t1 (a int, b datetime generated always as (makedate(a,1)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (makedate(`a`,1)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (2001,default); +select * from t1; +a b +2001 2001-01-01 00:00:00 +drop table t1; +set sql_warnings = 0; +# MAKETIME() +set sql_warnings = 1; +create table t1 (a int, b time generated always as (maketime(a,1,3)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` time GENERATED ALWAYS AS (maketime(`a`,1,3)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (12,default); +select * from t1; +a b +12 12:01:03 +drop table t1; +set sql_warnings = 0; +# MICROSECOND() +set sql_warnings = 1; +create table t1 (a datetime, b bigint generated always as (microsecond(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` bigint(20) GENERATED ALWAYS AS (microsecond(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2009-12-31 12:00:00.123456',default); +insert into t1 values ('2009-12-31 23:59:59.000010',default); +select * from t1; +a b +2009-12-31 12:00:00 0 +2009-12-31 23:59:59 0 +drop table t1; +set sql_warnings = 0; +# MINUTE() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (minute(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (minute(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2009-12-31 23:59:59.000010',default); +select * from t1; +a b +2009-12-31 23:59:59 59 +drop table t1; +set sql_warnings = 0; +# MONTH() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (month(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (month(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2009-12-31 23:59:59.000010',default); +select * from t1; +a b +2009-12-31 23:59:59 12 +drop table t1; +set sql_warnings = 0; +# MONTHNAME() +set sql_warnings = 1; +create table t1 (a datetime, b varchar(16) generated always as (monthname(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` varchar(16) GENERATED ALWAYS AS (monthname(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2009-12-31 23:59:59.000010',default); +select * from t1; +a b +2009-12-31 23:59:59 December +drop table t1; +set sql_warnings = 0; +# PERIOD_ADD() +set sql_warnings = 1; +create table t1 (a int, b int generated always as (period_add(a,2)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (period_add(`a`,2)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (200801,default); +select * from t1; +a b +200801 200803 +drop table t1; +set sql_warnings = 0; +# PERIOD_DIFF() +set sql_warnings = 1; +create table t1 (a int, b int, c int generated always as (period_diff(a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (period_diff(`a`,`b`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (200802,200703,default); +select * from t1; +a b c +200802 200703 11 +drop table t1; +set sql_warnings = 0; +# QUARTER() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (quarter(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (quarter(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 3 +drop table t1; +set sql_warnings = 0; +# SEC_TO_TIME() +set sql_warnings = 1; +create table t1 (a bigint, b time generated always as (sec_to_time(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) DEFAULT NULL, + `b` time GENERATED ALWAYS AS (sec_to_time(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (2378,default); +select * from t1; +a b +2378 00:39:38 +drop table t1; +set sql_warnings = 0; +# SECOND() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (second(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (second(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('10:05:03',default); +select * from t1; +a b +2010-05-03 00:00:00 0 +drop table t1; +set sql_warnings = 0; +# STR_TO_DATE() +set sql_warnings = 1; +create table t1 (a varchar(64), b datetime generated always as (str_to_date(a,'%m/%d/%Y')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(64) DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (str_to_date(`a`,'%m/%d/%Y')) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('04/30/2004',default); +select * from t1; +a b +04/30/2004 2004-04-30 00:00:00 +drop table t1; +set sql_warnings = 0; +# SUBDATE() +set sql_warnings = 1; +create table t1 (a datetime, b datetime generated always as (subdate(a,interval 1 month)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (`a` - interval 1 month) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 2008-07-31 00:00:00 +drop table t1; +set sql_warnings = 0; +# SUBTIME() +set sql_warnings = 1; +create table t1 (a datetime, b datetime generated always as (subtime(a,'02:00:00')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (subtime(`a`,'02:00:00')) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 2008-08-30 22:00:00 +drop table t1; +set sql_warnings = 0; +# TIME_FORMAT() +set sql_warnings = 1; +create table t1 (a datetime, b varchar(32) generated always as (time_format(a,'%r')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` varchar(32) GENERATED ALWAYS AS (time_format(`a`,'%r')) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31 02:03:04',default); +select * from t1; +a b +2008-08-31 02:03:04 02:03:04 AM +drop table t1; +set sql_warnings = 0; +# TIME_TO_SEC() +set sql_warnings = 1; +create table t1 (a time, b bigint generated always as (time_to_sec(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` time DEFAULT NULL, + `b` bigint(20) GENERATED ALWAYS AS (time_to_sec(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('22:23:00',default); +select * from t1; +a b +22:23:00 80580 +drop table t1; +set sql_warnings = 0; +# TIME() +set sql_warnings = 1; +create table t1 (a datetime, b time generated always as (time(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` time GENERATED ALWAYS AS (cast(`a` as time)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31 02:03:04',default); +select * from t1; +a b +2008-08-31 02:03:04 02:03:04 +drop table t1; +set sql_warnings = 0; +# TIMEDIFF() +set sql_warnings = 1; +create table t1 (a datetime, b datetime, c time generated always as (timediff(a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` datetime DEFAULT NULL, + `c` time GENERATED ALWAYS AS (timediff(`a`,`b`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-12-31 23:59:59.000001','2008-12-30 01:01:01.000002',default); +select * from t1; +a b c +2008-12-31 23:59:59 2008-12-30 01:01:01 46:58:58 +drop table t1; +set sql_warnings = 0; +# TIMESTAMP() +set sql_warnings = 1; +create table t1 (a datetime, b timestamp generated always as (timestamp(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` timestamp GENERATED ALWAYS AS (cast(`a` as datetime)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-12-31',default); +select * from t1; +a b +2008-12-31 00:00:00 2008-12-31 00:00:00 +drop table t1; +set sql_warnings = 0; +# TIMESTAMPADD() +set sql_warnings = 1; +create table t1 (a datetime, b timestamp generated always as (timestampadd(minute,1,a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` timestamp GENERATED ALWAYS AS (`a` + interval 1 minute) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2003-01-02',default); +select * from t1; +a b +2003-01-02 00:00:00 2003-01-02 00:01:00 +drop table t1; +set sql_warnings = 0; +# TIMESTAMPDIFF() +set sql_warnings = 1; +create table t1 (a timestamp, c bigint generated always as (timestampdiff(MONTH, a, a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `c` bigint(20) GENERATED ALWAYS AS (timestampdiff(MONTH,`a`,`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2003-02-01',default); +select * from t1; +a c +2003-02-01 00:00:00 0 +drop table t1; +set sql_warnings = 0; +# TO_DAYS() +set sql_warnings = 1; +create table t1 (a datetime, b bigint generated always as (to_days(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` bigint(20) GENERATED ALWAYS AS (to_days(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2007-10-07',default); +select * from t1; +a b +2007-10-07 00:00:00 733321 +drop table t1; +set sql_warnings = 0; +# WEEK() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (week(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (week(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-09-01',default); +select * from t1; +a b +2008-09-01 00:00:00 35 +drop table t1; +set sql_warnings = 0; +# WEEKDAY() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (weekday(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (weekday(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-09-01',default); +select * from t1; +a b +2008-09-01 00:00:00 0 +drop table t1; +set sql_warnings = 0; +# WEEKOFYEAR() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (weekofyear(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (week(`a`,3)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-09-01',default); +select * from t1; +a b +2008-09-01 00:00:00 36 +drop table t1; +set sql_warnings = 0; +# YEAR() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (year(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (year(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-09-01',default); +select * from t1; +a b +2008-09-01 00:00:00 2008 +drop table t1; +set sql_warnings = 0; +# YEARWEEK() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (yearweek(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (yearweek(`a`,0)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('2008-09-01',default); +select * from t1; +a b +2008-09-01 00:00:00 200835 +drop table t1; +set sql_warnings = 0; +# +# FULL TEXT SEARCH FUNCTIONS +# +# None. +# +# CAST FUNCTIONS AND OPERATORS +# +# CAST() +set sql_warnings = 1; +create table t1 (a int, b bigint unsigned generated always as (cast(a as unsigned)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` bigint(20) unsigned GENERATED ALWAYS AS (cast(`a` as unsigned)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (-1,default); +Warnings: +Note 1105 Cast to unsigned converted negative integer to it's positive complement +select * from t1; +a b +-1 18446744073709551615 +1 1 +Note 1105 Cast to unsigned converted negative integer to it's positive complement +Warnings: +drop table t1; +set sql_warnings = 0; +# Convert() +set sql_warnings = 1; +create table t1 (a int, b bigint unsigned generated always as (convert(a,unsigned)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` bigint(20) unsigned GENERATED ALWAYS AS (cast(`a` as unsigned)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (-1,default); +Warnings: +Note 1105 Cast to unsigned converted negative integer to it's positive complement +select * from t1; +a b +-1 18446744073709551615 +1 1 +Note 1105 Cast to unsigned converted negative integer to it's positive complement +Warnings: +drop table t1; +set sql_warnings = 0; +# +# XML FUNCTIONS +# +# ExtractValue() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varchar(1024) generated always as (ExtractValue(a,'/b')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (extractvalue(`a`,'/b')) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('text',default); +select * from t1; +a b +text text +drop table t1; +set sql_warnings = 0; +# None. +# +# OTHER FUNCTIONS +# +# AES_DECRYPT(), AES_ENCRYPT() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varchar(1024) generated always as (aes_encrypt(aes_decrypt(a,'adf'),'adf')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (aes_encrypt(aes_decrypt(`a`,'adf'),'adf')) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +select * from t1; +a b +MySQL NULL +drop table t1; +set sql_warnings = 0; +# BIT_COUNT() +set sql_warnings = 1; +create table t1 (a int, b int generated always as (bit_count(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (bit_count(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (5,default); +select * from t1; +a b +5 2 +drop table t1; +set sql_warnings = 0; +# CHARSET() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varchar(1024) generated always as (charset(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (charset(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('abc',default); +select * from t1; +a b +abc latin1 +drop table t1; +set sql_warnings = 0; +# COERCIBILITY() +set sql_warnings = 1; +create table t1 (a varchar(1024), b int generated always as (coercibility(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (coercibility(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('abc',default); +select * from t1; +a b +abc 2 +drop table t1; +set sql_warnings = 0; +# COLLATION() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varchar(1024) generated always as (collation(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (collation(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('abc',default); +select * from t1; +a b +abc latin1_swedish_ci +drop table t1; +set sql_warnings = 0; +# COMPRESS(), UNCOMPRESS() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varchar(1024) generated always as (uncompress(compress(a))) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (uncompress(compress(`a`))) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +select * from t1; +a b +MySQL MySQL +drop table t1; +set sql_warnings = 0; +# ENCODE(), DECODE() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varchar(1024) generated always as (decode(encode(a,'abc'),'abc')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (decode(encode(`a`,'abc'),'abc')) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +select * from t1; +a b +MySQL MySQL +drop table t1; +set sql_warnings = 0; +# DEFAULT() +set sql_warnings = 1; +create table t1 (a varchar(1024) default 'aaa', b varchar(1024) generated always as (ifnull(a,default(a))) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT 'aaa', + `b` varchar(1024) GENERATED ALWAYS AS (ifnull(`a`,default(`a`))) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('any value',default); +select * from t1; +a b +any value any value +drop table t1; +set sql_warnings = 0; +# DES_ENCRYPT(), DES_DECRYPT() +create table t1 (a varchar(1024), b varchar(1024) generated always as (des_encrypt(des_decrypt(a,'adf'),'adf')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (des_encrypt(des_decrypt(`a`,'adf'),'adf')) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +select * from t1; +a b +MySQL ÿw2¥ð +èõÁ +drop table t1; +# INET_ATON(), INET_NTOA() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varchar(1024) generated always as (inet_ntoa(inet_aton(a))) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (inet_ntoa(inet_aton(`a`))) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('127.0.0.1',default); +select * from t1; +a b +127.0.0.1 127.0.0.1 +drop table t1; +set sql_warnings = 0; +# MD5() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varbinary(32) generated always as (md5(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varbinary(32) GENERATED ALWAYS AS (md5(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('testing',default); +select * from t1; +a b +testing ae2b1fca515949e5d54fb22b8ed95575 +drop table t1; +set sql_warnings = 0; +# PASSWORD() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varchar(1024) generated always as (password(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (password(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('badpwd',default); +select * from t1; +a b +badpwd *AAB3E285149C0135D51A520E1940DD3263DC008C +drop table t1; +set sql_warnings = 0; +# SHA1() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varchar(1024) generated always as (sha1(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (sha(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('abc',default); +select * from t1; +a b +abc a9993e364706816aba3e25717850c26c9cd0d89d +drop table t1; +set sql_warnings = 0; +# SHA() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varchar(1024) generated always as (sha(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (sha(`a`)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('abc',default); +select * from t1; +a b +abc a9993e364706816aba3e25717850c26c9cd0d89d +drop table t1; +set sql_warnings = 0; +# SHA2() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varchar(1024) generated always as (sha2(a,224)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (sha2(`a`,224)) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('abc',default); +select * from t1; +a b +abc 23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 +drop table t1; +set sql_warnings = 0; +# UNCOMPRESSED_LENGTH() +set sql_warnings = 1; +create table t1 (a char, b varchar(1024) generated always as (uncompressed_length(compress(repeat(a,30)))) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(1) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (uncompressed_length(compress(repeat(`a`,30)))) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('a',default); +select * from t1; +a b +a 30 +drop table t1; +set sql_warnings = 0; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_supported_sql_funcs_myisam.result b/mysql-test/suite/gcol/r/gcol_supported_sql_funcs_myisam.result new file mode 100644 index 00000000000..03be01c3229 --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_supported_sql_funcs_myisam.result @@ -0,0 +1,3000 @@ +SET @@session.default_storage_engine = 'MyISAM'; +set time_zone="+03:00"; +# +# NUMERIC FUNCTIONS +# +# ABS() +set sql_warnings = 1; +create table t1 (a int, b int generated always as (abs(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (abs(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (-1, default); +select * from t1; +a b +-1 1 +drop table t1; +set sql_warnings = 0; +# ACOS() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(acos(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(acos(`a`),6)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1, default); +insert into t1 values (1.0001,default); +insert into t1 values (0,default); +select * from t1; +a b +0 1.570796 +1 0 +1.0001 NULL +drop table t1; +set sql_warnings = 0; +# ASIN() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(asin(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(asin(`a`),6)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (0.2, default); +insert into t1 values (1.0001,default); +select * from t1; +a b +0.2 0.201358 +1.0001 NULL +drop table t1; +set sql_warnings = 0; +#ATAN +set sql_warnings = 1; +create table t1 (a double, b double, c double generated always as (format(atan(a,b),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double DEFAULT NULL, + `c` double GENERATED ALWAYS AS (format(atan(`a`,`b`),6)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (-2,2,default); +insert into t1 values (format(PI(),6),0,default); +select * from t1; +a b c +-2 2 -0.785398 +3.141593 0 1.570796 +drop table t1; +set sql_warnings = 0; +set sql_warnings = 1; +create table t1 (a double, c double generated always as (format(atan(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `c` double GENERATED ALWAYS AS (format(atan(`a`),6)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (-2,default); +insert into t1 values (format(PI(),6),default); +select * from t1; +a c +-2 -1.107149 +3.141593 1.262627 +drop table t1; +set sql_warnings = 0; +# ATAN2 +set sql_warnings = 1; +create table t1 (a double, b double, c double generated always as (format(atan2(a,b),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double DEFAULT NULL, + `c` double GENERATED ALWAYS AS (format(atan(`a`,`b`),6)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (-2,2,default); +insert into t1 values (format(PI(),6),0,default); +select * from t1; +a b c +-2 2 -0.785398 +3.141593 0 1.570796 +drop table t1; +set sql_warnings = 0; +# CEIL() +set sql_warnings = 1; +create table t1 (a double, b int generated always as (ceil(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (ceiling(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1.23,default); +insert into t1 values (-1.23,default); +select * from t1; +a b +-1.23 -1 +1.23 2 +drop table t1; +set sql_warnings = 0; +# CONV() +set sql_warnings = 1; +create table t1 (a varchar(10), b int, c int, d varchar(10) generated always as (conv(a,b,c)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` varchar(10) GENERATED ALWAYS AS (conv(`a`,`b`,`c`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('a',16,2,default); +insert into t1 values ('6e',18,8,default); +insert into t1 values (-17,10,-18,default); +insert into t1 values (10+'10'+'10'+0xa,10,10,default); +select * from t1; +a b c d +-17 10 -18 -H +40 10 10 40 +6e 18 8 172 +a 16 2 1010 +drop table t1; +set sql_warnings = 0; +# COS() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(cos(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(cos(`a`),6)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (format(PI(),6),default); +select * from t1; +a b +3.141593 -1 +drop table t1; +set sql_warnings = 0; +# COT() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(cot(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(cot(`a`),6)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (0,default); +insert into t1 values (12,default); +select * from t1; +a b +12 -1.572673 +drop table t1; +set sql_warnings = 0; +# CRC32() +set sql_warnings = 1; +create table t1 (a varchar(10), b bigint generated always as (crc32(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` bigint(20) GENERATED ALWAYS AS (crc32(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +insert into t1 values ('mysql',default); +select * from t1; +a b +MySQL 3259397556 +mysql 2501908538 +drop table t1; +set sql_warnings = 0; +# DEGREES() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(degrees(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(degrees(`a`),6)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (format(PI(),6),default); +insert into t1 values (format(PI()/2,6),default); +select * from t1; +a b +1.570796 89.999981 +3.141593 180.00002 +drop table t1; +set sql_warnings = 0; +# / +set sql_warnings = 1; +create table t1 (a double, b double generated always as (a/2) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (`a` / 2) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (2,default); +select * from t1; +a b +2 1 +drop table t1; +set sql_warnings = 0; +# EXP() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(exp(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(exp(`a`),6)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (2,default); +insert into t1 values (-2,default); +insert into t1 values (0,default); +select * from t1; +a b +-2 0.135335 +0 1 +2 7.389056 +drop table t1; +set sql_warnings = 0; +# FLOOR() +set sql_warnings = 1; +create table t1 (a double, b bigint generated always as (floor(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` bigint(20) GENERATED ALWAYS AS (floor(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1.23,default); +insert into t1 values (-1.23,default); +select * from t1; +a b +-1.23 -2 +1.23 1 +drop table t1; +set sql_warnings = 0; +# LN() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(ln(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(ln(`a`),6)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (2,default); +insert into t1 values (-2,default); +select * from t1; +a b +-2 NULL +2 0.693147 +drop table t1; +set sql_warnings = 0; +# LOG() +set sql_warnings = 1; +create table t1 (a double, b double, c double generated always as (format(log(a,b),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double DEFAULT NULL, + `c` double GENERATED ALWAYS AS (format(log(`a`,`b`),6)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (2,65536,default); +insert into t1 values (10,100,default); +insert into t1 values (1,100,default); +select * from t1; +a b c +1 100 NULL +10 100 2 +2 65536 16 +drop table t1; +set sql_warnings = 0; +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(log(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(log(`a`),6)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (2,default); +insert into t1 values (-2,default); +select * from t1; +a b +-2 NULL +2 0.693147 +drop table t1; +set sql_warnings = 0; +# LOG2() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(log2(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(log2(`a`),6)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (65536,default); +insert into t1 values (-100,default); +select * from t1; +a b +-100 NULL +65536 16 +drop table t1; +set sql_warnings = 0; +# LOG10() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(log10(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(log10(`a`),6)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (2,default); +insert into t1 values (100,default); +insert into t1 values (-100,default); +select * from t1; +a b +-100 NULL +100 2 +2 0.30103 +drop table t1; +set sql_warnings = 0; +# - +set sql_warnings = 1; +create table t1 (a double, b double generated always as (a-1) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (`a` - 1) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (2,default); +select * from t1; +a b +2 1 +drop table t1; +set sql_warnings = 0; +# MOD() +set sql_warnings = 1; +create table t1 (a int, b int generated always as (mod(a,10)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 10) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (11,default); +select * from t1; +a b +1 1 +11 1 +drop table t1; +set sql_warnings = 0; +# % +set sql_warnings = 1; +create table t1 (a int, b int generated always as (a % 10) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` % 10) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (11,default); +select * from t1; +a b +1 1 +11 1 +drop table t1; +set sql_warnings = 0; +# OCT() +set sql_warnings = 1; +create table t1 (a double, b varchar(10) generated always as (oct(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (conv(`a`,10,8)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (12,default); +select * from t1; +a b +12 14 +drop table t1; +set sql_warnings = 0; +# PI() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(PI()*a*a,6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(pi() * `a` * `a`,6)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +select * from t1; +a b +1 3.141593 +drop table t1; +set sql_warnings = 0; +# + +set sql_warnings = 1; +create table t1 (a int, b int generated always as (a+1) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +select * from t1; +a b +1 2 +drop table t1; +set sql_warnings = 0; +# POW, POWER +set sql_warnings = 1; +create table t1 (a int, b int generated always as (pow(a,2)) virtual, c int generated always as (power(a,2)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (pow(`a`,2)) VIRTUAL, + `c` int(11) GENERATED ALWAYS AS (pow(`a`,2)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1,default,default); +insert into t1 values (2,default,default); +select * from t1; +a b c +1 1 1 +2 4 4 +drop table t1; +set sql_warnings = 0; +# RADIANS() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(radians(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(radians(`a`),6)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (90,default); +select * from t1; +a b +90 1.570796 +drop table t1; +set sql_warnings = 0; +# ROUND() +set sql_warnings = 1; +create table t1 (a double, b int generated always as (round(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (round(`a`,0)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (-1.23,default); +insert into t1 values (-1.58,default); +insert into t1 values (1.58,default); +select * from t1; +a b +-1.23 -1 +-1.58 -2 +1.58 2 +drop table t1; +set sql_warnings = 0; +set sql_warnings = 1; +create table t1 (a double, b double, c int generated always as (round(a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (round(`a`,`b`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1.298,1,default); +insert into t1 values (1.298,0,default); +insert into t1 values (23.298,-1,default); +select * from t1; +a b c +1.298 0 1 +1.298 1 1 +23.298 -1 20 +drop table t1; +set sql_warnings = 0; +# SIGN() +set sql_warnings = 1; +create table t1 (a double, b int generated always as (sign(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (sign(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (-32,default); +insert into t1 values (0,default); +insert into t1 values (234,default); +select * from t1; +a b +-32 -1 +0 0 +234 1 +drop table t1; +set sql_warnings = 0; +# SIN() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(sin(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(sin(`a`),6)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (format(PI()/2,6),default); +select * from t1; +a b +1.570796 1 +drop table t1; +set sql_warnings = 0; +# SQRT() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(sqrt(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(sqrt(`a`),6)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (4,default); +insert into t1 values (20,default); +insert into t1 values (-16,default); +select * from t1; +a b +-16 NULL +20 4.472136 +4 2 +drop table t1; +set sql_warnings = 0; +# TAN() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (format(tan(a),6)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (format(tan(`a`),6)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (format(PI(),6),default); +insert into t1 values (format(PI()+1,6),default); +select * from t1; +a b +3.141593 0 +4.141593 1.557409 +drop table t1; +set sql_warnings = 0; +# * +set sql_warnings = 1; +create table t1 (a double, b double generated always as (a*3) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (`a` * 3) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (0,default); +insert into t1 values (1,default); +insert into t1 values (2,default); +select * from t1; +a b +0 0 +1 3 +2 6 +drop table t1; +set sql_warnings = 0; +# TRUNCATE() +set sql_warnings = 1; +create table t1 (a double, b double generated always as (truncate(a,4)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (truncate(`a`,4)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1.223,default); +insert into t1 values (1.999,default); +insert into t1 values (1.999,default); +insert into t1 values (122,default); +select * from t1; +a b +1.223 1.223 +1.999 1.999 +1.999 1.999 +122 122 +drop table t1; +set sql_warnings = 0; +# Unary - +set sql_warnings = 1; +create table t1 (a double, b double generated always as (-a) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` double GENERATED ALWAYS AS (-`a`) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (-1,default); +select * from t1; +a b +-1 1 +1 -1 +drop table t1; +set sql_warnings = 0; +# +# STRING FUNCTIONS +# +# ASCII() +set sql_warnings = 1; +create table t1 (a char(2), b int generated always as (ascii(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(2) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (ascii(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2',default); +insert into t1 values (2,default); +insert into t1 values ('dx',default); +select * from t1; +a b +2 50 +2 50 +dx 100 +drop table t1; +set sql_warnings = 0; +# BIN() +set sql_warnings = 1; +create table t1 (a int, b varchar(10) generated always as (bin(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (conv(`a`,10,2)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (12,default); +select * from t1; +a b +12 1100 +drop table t1; +set sql_warnings = 0; +# BIT_LENGTH() +set sql_warnings = 1; +create table t1 (a varchar(10), b bigint generated always as (bit_length(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` bigint(20) GENERATED ALWAYS AS (bit_length(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('text',default); +select * from t1; +a b +text 32 +drop table t1; +set sql_warnings = 0; +# CHAR_LENGTH() +set sql_warnings = 1; +create table t1 (a varchar(10), b bigint generated always as (char_length(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` bigint(20) GENERATED ALWAYS AS (char_length(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('text',default); +select * from t1; +a b +text 4 +drop table t1; +set sql_warnings = 0; +# CHAR() +set sql_warnings = 1; +create table t1 (a int, b int, c varbinary(10) generated always as (char(a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` varbinary(10) GENERATED ALWAYS AS (char(`a`,`b`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (77,121,default); +select * from t1; +a b c +77 121 My +drop table t1; +set sql_warnings = 0; +# CHARACTER_LENGTH() +set sql_warnings = 1; +create table t1 (a varchar(10), b bigint generated always as (character_length(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` bigint(20) GENERATED ALWAYS AS (char_length(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('text',default); +select * from t1; +a b +text 4 +drop table t1; +set sql_warnings = 0; +# CONCAT_WS() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c varchar(20) generated always as (concat_ws(',',a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` varchar(20) GENERATED ALWAYS AS (concat_ws(',',`a`,`b`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('value1','value2',default); +select * from t1; +a b c +value1 value2 value1,value2 +drop table t1; +set sql_warnings = 0; +# CONCAT() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c varchar(20) generated always as (concat(a,',',b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` varchar(20) GENERATED ALWAYS AS (concat(`a`,',',`b`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('value1','value2',default); +select * from t1; +a b c +value1 value2 value1,value2 +drop table t1; +set sql_warnings = 0; +# ELT() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c int, d varchar(10) generated always as (elt(c,a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` varchar(10) GENERATED ALWAYS AS (elt(`c`,`a`,`b`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('value1','value2',1,default); +insert into t1 values ('value1','value2',2,default); +select * from t1; +a b c d +value1 value2 1 value1 +value1 value2 2 value2 +drop table t1; +set sql_warnings = 0; +# EXPORT_SET() +set sql_warnings = 1; +create table t1 (a int, b varchar(10) generated always as (export_set(a,'1','0','',10)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (export_set(`a`,'1','0','',10)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (6,default); +select * from t1; +a b +6 0110000000 +drop table t1; +set sql_warnings = 0; +# FIELD() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c int generated always as (field('aa',a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (field('aa',`a`,`b`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('aa','bb',default); +insert into t1 values ('bb','aa',default); +select * from t1; +a b c +aa bb 1 +bb aa 2 +drop table t1; +set sql_warnings = 0; +# FIND_IN_SET() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c int generated always as (find_in_set(a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (find_in_set(`a`,`b`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('aa','aa,bb,cc',default); +insert into t1 values ('aa','bb,aa,cc',default); +select * from t1; +a b c +aa aa,bb,cc 1 +aa bb,aa,cc 2 +drop table t1; +set sql_warnings = 0; +# FORMAT() +set sql_warnings = 1; +create table t1 (a double, b varchar(20) generated always as (format(a,2)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double DEFAULT NULL, + `b` varchar(20) GENERATED ALWAYS AS (format(`a`,2)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (12332.123456,default); +select * from t1; +a b +12332.123456 12,332.12 +drop table t1; +set sql_warnings = 0; +# HEX() +set sql_warnings = 1; +create table t1 (a int, b varchar(10) generated always as (hex(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (hex(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (17,default); +select * from t1; +a b +17 11 +drop table t1; +set sql_warnings = 0; +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (hex(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (hex(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('abc',default); +select * from t1; +a b +abc 616263 +drop table t1; +set sql_warnings = 0; +# INSERT() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c varchar(20) generated always as (insert(a,length(a),length(b),b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` varchar(20) GENERATED ALWAYS AS (insert(`a`,length(`a`),length(`b`),`b`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('start,','end',default); +select * from t1; +a b c +start, end startend +drop table t1; +set sql_warnings = 0; +# INSTR() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c int generated always as (instr(a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (locate(`b`,`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('foobarbar,','bar',default); +insert into t1 values ('xbar,','foobar',default); +select * from t1; +a b c +foobarbar, bar 4 +xbar, foobar 0 +drop table t1; +set sql_warnings = 0; +# LCASE() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (lcase(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (lcase(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +select * from t1; +a b +MySQL mysql +drop table t1; +set sql_warnings = 0; +# LEFT() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(5) generated always as (left(a,5)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(5) GENERATED ALWAYS AS (left(`a`,5)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('foobarbar',default); +select * from t1; +a b +foobarbar fooba +drop table t1; +set sql_warnings = 0; +# LENGTH() +set sql_warnings = 1; +create table t1 (a varchar(10), b int generated always as (length(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (length(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('text',default); +select * from t1; +a b +text 4 +drop table t1; +set sql_warnings = 0; +# LIKE +set sql_warnings = 1; +create table t1 (a varchar(10), b bool generated always as (a like 'H%o') virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` tinyint(1) GENERATED ALWAYS AS (`a` like 'H%o') VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('Hello',default); +insert into t1 values ('MySQL',default); +select * from t1; +a b +Hello 1 +MySQL 0 +drop table t1; +set sql_warnings = 0; +# LOCATE() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (locate('bar',a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (locate('bar',`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('foobarbar',default); +select * from t1; +a b +foobarbar 4 +drop table t1; +set sql_warnings = 0; +# LOWER() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (lower(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (lcase(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +select * from t1; +a b +MySQL mysql +drop table t1; +set sql_warnings = 0; +# LPAD() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (lpad(a,4,' ')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (lpad(`a`,4,' ')) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +insert into t1 values ('M',default); +select * from t1; +a b +M M +MySQL MySQ +drop table t1; +set sql_warnings = 0; +# LTRIM() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (ltrim(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (ltrim(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (' MySQL',default); +insert into t1 values ('MySQL',default); +select * from t1; +a b + MySQL MySQL +MySQL MySQL +drop table t1; +set sql_warnings = 0; +# MAKE_SET() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c int, d varchar(30) generated always as (make_set(c,a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` varchar(30) GENERATED ALWAYS AS (make_set(`c`,`a`,`b`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('a','b',1,default); +insert into t1 values ('a','b',3,default); +select * from t1; +a b c d +a b 1 a +a b 3 a,b +drop table t1; +set sql_warnings = 0; +# MID() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (mid(a,1,2)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (substr(`a`,1,2)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('foobarbar',default); +select * from t1; +a b +foobarbar fo +drop table t1; +set sql_warnings = 0; +# NOT LIKE +set sql_warnings = 1; +create table t1 (a varchar(10), b bool generated always as (a not like 'H%o') virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` tinyint(1) GENERATED ALWAYS AS (`a` not like 'H%o') VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('Hello',default); +insert into t1 values ('MySQL',default); +select * from t1; +a b +Hello 0 +MySQL 1 +drop table t1; +set sql_warnings = 0; +# NOT REGEXP +set sql_warnings = 1; +create table t1 (a varchar(10), b bool generated always as (a not regexp 'H.+o') virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` tinyint(1) GENERATED ALWAYS AS (!(`a` regexp 'H.+o')) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('Hello',default); +insert into t1 values ('hello',default); +select * from t1; +a b +Hello 0 +hello 0 +drop table t1; +set sql_warnings = 0; +# OCTET_LENGTH() +set sql_warnings = 1; +create table t1 (a varchar(10), b int generated always as (octet_length(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (length(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('text',default); +select * from t1; +a b +text 4 +drop table t1; +set sql_warnings = 0; +# ORD() +set sql_warnings = 1; +create table t1 (a varchar(10), b bigint generated always as (ord(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` bigint(20) GENERATED ALWAYS AS (ord(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2',default); +select * from t1; +a b +2 50 +drop table t1; +set sql_warnings = 0; +# POSITION() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (position('bar' in a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (locate('bar',`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('foobarbar',default); +select * from t1; +a b +foobarbar 4 +drop table t1; +set sql_warnings = 0; +# QUOTE() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (quote(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (quote(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('Don\'t',default); +select * from t1; +a b +Don't 'Don\'t' +drop table t1; +set sql_warnings = 0; +# REGEXP() +set sql_warnings = 1; +create table t1 (a varchar(10), b bool generated always as (a regexp 'H.+o') virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` tinyint(1) GENERATED ALWAYS AS (`a` regexp 'H.+o') VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('Hello',default); +insert into t1 values ('hello',default); +select * from t1; +a b +Hello 1 +hello 1 +drop table t1; +set sql_warnings = 0; +# REPEAT() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(30) generated always as (repeat(a,3)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(30) GENERATED ALWAYS AS (repeat(`a`,3)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +select * from t1; +a b +MySQL MySQLMySQLMySQL +drop table t1; +set sql_warnings = 0; +# REPLACE() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(30) generated always as (replace(a,'aa','bb')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(30) GENERATED ALWAYS AS (replace(`a`,'aa','bb')) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('maa',default); +select * from t1; +a b +maa mbb +drop table t1; +set sql_warnings = 0; +# REVERSE() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(30) generated always as (reverse(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(30) GENERATED ALWAYS AS (reverse(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('maa',default); +select * from t1; +a b +maa aam +drop table t1; +set sql_warnings = 0; +# RIGHT() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (right(a,4)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (right(`a`,4)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('foobarbar',default); +select * from t1; +a b +foobarbar rbar +drop table t1; +set sql_warnings = 0; +# RLIKE() +set sql_warnings = 1; +create table t1 (a varchar(10), b bool generated always as (a rlike 'H.+o') virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` tinyint(1) GENERATED ALWAYS AS (`a` regexp 'H.+o') VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('Hello',default); +insert into t1 values ('MySQL',default); +select * from t1; +a b +Hello 1 +MySQL 0 +drop table t1; +set sql_warnings = 0; +# RPAD() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (rpad(a,4,'??')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (rpad(`a`,4,'??')) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('He',default); +select * from t1; +a b +He He?? +drop table t1; +set sql_warnings = 0; +# RTRIM(); +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (rtrim(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (rtrim(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('Hello ',default); +select * from t1; +a b +Hello Hello +drop table t1; +set sql_warnings = 0; +# SOUNDEX() +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(20) generated always as (soundex(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(20) GENERATED ALWAYS AS (soundex(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('Hello',default); +select * from t1; +a b +Hello H400 +drop table t1; +set sql_warnings = 0; +# SOUNDS LIKE +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c bool generated always as (a sounds like b) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` tinyint(1) GENERATED ALWAYS AS (soundex(`a`) = soundex(`b`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('Hello','Hello',default); +insert into t1 values ('Hello','MySQL',default); +insert into t1 values ('Hello','hello',default); +select * from t1; +a b c +Hello Hello 1 +Hello MySQL 0 +Hello hello 1 +drop table t1; +set sql_warnings = 0; +# SPACE() +set sql_warnings = 1; +create table t1 (a varchar(5), b varchar(10) generated always as (concat(a,space(5))) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(5) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (concat(`a`,space(5))) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('Hello', default); +select * from t1; +a b +Hello Hello +drop table t1; +set sql_warnings = 0; +# STRCMP() +set sql_warnings = 1; +create table t1 (a varchar(9), b varchar(9), c tinyint(1) generated always as (strcmp(a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(9) DEFAULT NULL, + `b` varchar(9) DEFAULT NULL, + `c` tinyint(1) GENERATED ALWAYS AS (strcmp(`a`,`b`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('Hello','Hello', default); +insert into t1 values ('Hello','Hello1', default); +select * from t1; +a b c +Hello Hello 0 +Hello Hello1 -1 +drop table t1; +set sql_warnings = 0; +# SUBSTR() +set sql_warnings = 1; +create table t1 (a varchar(5), b varchar(10) generated always as (substr(a,2)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(5) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (substr(`a`,2)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('Hello',default); +select * from t1; +a b +Hello ello +drop table t1; +set sql_warnings = 0; +# SUBSTRING_INDEX() +set sql_warnings = 1; +create table t1 (a varchar(15), b varchar(10) generated always as (substring_index(a,'.',2)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(15) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (substring_index(`a`,'.',2)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('www.mysql.com',default); +select * from t1; +a b +www.mysql.com www.mysql +drop table t1; +set sql_warnings = 0; +# SUBSTRING() +set sql_warnings = 1; +create table t1 (a varchar(5), b varchar(10) generated always as (substring(a from 2 for 2)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(5) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (substr(`a`,2,2)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('Hello',default); +select * from t1; +a b +Hello el +drop table t1; +set sql_warnings = 0; +# TRIM() +set sql_warnings = 1; +create table t1 (a varchar(15), b varchar(10) generated always as (trim(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(15) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (trim(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (' aa ',default); +select * from t1; +a b + aa aa +drop table t1; +set sql_warnings = 0; +# UCASE() +set sql_warnings = 1; +create table t1 (a varchar(5), b varchar(10) generated always as (ucase(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(5) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (ucase(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +select * from t1; +a b +MySQL MYSQL +drop table t1; +set sql_warnings = 0; +# UNHEX() +set sql_warnings = 1; +create table t1 (a varchar(15), b varchar(10) generated always as (unhex(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(15) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (unhex(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('4D7953514C',default); +select * from t1; +a b +4D7953514C MySQL +drop table t1; +set sql_warnings = 0; +# UPPER() +set sql_warnings = 1; +create table t1 (a varchar(5), b varchar(10) generated always as (upper(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(5) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (ucase(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +select * from t1; +a b +MySQL MYSQL +drop table t1; +set sql_warnings = 0; +# WEIGHT_STRING() +set sql_warnings = 1; +create table t1 (a varchar(5), b varchar(10) generated always as (weight_string(a as char(4))) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(5) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (weight_string(`a`,0,4,65)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +select * from t1; +a b +MySQL MYSQ +drop table t1; +set sql_warnings = 0; +# +# CONTROL FLOW FUNCTIONS +# +# CASE +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(16) generated always as (case a when NULL then 'asd' when 'b' then 'B' else a end) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(16) GENERATED ALWAYS AS (case `a` when NULL then 'asd' when 'b' then 'B' else `a` end) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (NULL,default); +insert into t1 values ('b',default); +insert into t1 values ('c',default); +select * from t1; +a b +NULL NULL +b B +c c +drop table t1; +set sql_warnings = 0; +# IF +set sql_warnings = 1; +create table t1 (a int, b int, c int generated always as (if(a=1,a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (if(`a` = 1,`a`,`b`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1,2,default); +insert into t1 values (3,4,default); +select * from t1; +a b c +1 2 1 +3 4 4 +drop table t1; +set sql_warnings = 0; +# IFNULL +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c varchar(10) generated always as (ifnull(a,'DEFAULT')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` varchar(10) GENERATED ALWAYS AS (ifnull(`a`,'DEFAULT')) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (NULL,'adf',default); +insert into t1 values ('a','adf',default); +select * from t1; +a b c +NULL adf DEFAULT +a adf a +drop table t1; +set sql_warnings = 0; +# NULLIF +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10) generated always as (nullif(a,'DEFAULT')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (nullif(`a`,'DEFAULT')) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('DEFAULT',default); +insert into t1 values ('a',default); +select * from t1; +a b +DEFAULT NULL +a a +drop table t1; +set sql_warnings = 0; +# +# OPERATORS +# +# AND, && +set sql_warnings = 1; +create table t1 (a int, b bool generated always as (a>0 && a<2) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` tinyint(1) GENERATED ALWAYS AS (`a` > 0 and `a` < 2) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (-1,default); +insert into t1 values (1,default); +select * from t1; +a b +-1 0 +1 1 +drop table t1; +set sql_warnings = 0; +# BETWEEN ... AND ... +set sql_warnings = 1; +create table t1 (a int, b bool generated always as (a between 0 and 2) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` tinyint(1) GENERATED ALWAYS AS (`a` between 0 and 2) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (-1,default); +insert into t1 values (1,default); +select * from t1; +a b +-1 0 +1 1 +drop table t1; +set sql_warnings = 0; +# BINARY +set sql_warnings = 1; +create table t1 (a varchar(10), b varbinary(10) generated always as (binary a) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varbinary(10) GENERATED ALWAYS AS (cast(`a` as char charset binary)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('11',default); +insert into t1 values (1,default); +select * from t1; +a b +1 1 +11 11 +drop table t1; +set sql_warnings = 0; +# & +set sql_warnings = 1; +create table t1 (a int, b int generated always as (a & 5) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` & 5) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (0,default); +select * from t1; +a b +0 0 +1 1 +drop table t1; +set sql_warnings = 0; +# ~ +set sql_warnings = 1; +create table t1 (a int, b int generated always as (~a) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (~`a`) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +Warnings: +Warning 1264 Out of range value for column 'b' at row 1 +select * from t1; +a b +1 2147483647 +drop table t1; +set sql_warnings = 0; +# | +set sql_warnings = 1; +create table t1 (a int, b int generated always as (a | 5) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` | 5) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (0,default); +insert into t1 values (2,default); +select * from t1; +a b +0 5 +1 5 +2 7 +drop table t1; +set sql_warnings = 0; +# ^ +set sql_warnings = 1; +create table t1 (a int, b int generated always as (a ^ 5) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` ^ 5) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (0,default); +insert into t1 values (2,default); +select * from t1; +a b +0 5 +1 4 +2 7 +drop table t1; +set sql_warnings = 0; +# DIV +set sql_warnings = 1; +create table t1 (a int, b int generated always as (a div 5) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` DIV 5) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (7,default); +select * from t1; +a b +1 0 +7 1 +drop table t1; +set sql_warnings = 0; +# <=> +set sql_warnings = 1; +create table t1 (a int, b int, c bool generated always as (a <=> b) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` tinyint(1) GENERATED ALWAYS AS (`a` <=> `b`) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1,1,default); +insert into t1 values (NULL,NULL,default); +insert into t1 values (1,NULL,default); +select * from t1; +a b c +1 1 1 +1 NULL 0 +NULL NULL 1 +drop table t1; +set sql_warnings = 0; +# = +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c bool generated always as (a=b) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` tinyint(1) GENERATED ALWAYS AS (`a` = `b`) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('a','b',default); +insert into t1 values ('a','a',default); +select * from t1; +a b c +a a 1 +a b 0 +drop table t1; +set sql_warnings = 0; +# >= +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c bool generated always as (a >= b) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` tinyint(1) GENERATED ALWAYS AS (`a` >= `b`) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('a','b',default); +insert into t1 values ('a','a',default); +select * from t1; +a b c +a a 1 +a b 0 +drop table t1; +set sql_warnings = 0; +# > +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c bool generated always as (a > b) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` tinyint(1) GENERATED ALWAYS AS (`a` > `b`) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('a','b',default); +insert into t1 values ('a','a',default); +select * from t1; +a b c +a a 0 +a b 0 +drop table t1; +set sql_warnings = 0; +# IS NOT NULL +set sql_warnings = 1; +create table t1 (a int, b bool generated always as (a is not null) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` tinyint(1) GENERATED ALWAYS AS (`a` is not null) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (NULL,default); +select * from t1; +a b +1 1 +NULL 0 +drop table t1; +set sql_warnings = 0; +# IS NULL +set sql_warnings = 1; +create table t1 (a int, b bool generated always as (a is null) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` tinyint(1) GENERATED ALWAYS AS (`a` is null) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (NULL,default); +select * from t1; +a b +1 0 +NULL 1 +drop table t1; +set sql_warnings = 0; +# << +set sql_warnings = 1; +create table t1 (a int, b int generated always as (a << 2) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` << 2) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (3,default); +select * from t1; +a b +1 4 +3 12 +drop table t1; +set sql_warnings = 0; +# <= +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c bool generated always as (a <= b) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` tinyint(1) GENERATED ALWAYS AS (`a` <= `b`) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('b','a',default); +insert into t1 values ('b','b',default); +insert into t1 values ('b','c',default); +select * from t1; +a b c +b a 0 +b b 1 +b c 1 +drop table t1; +set sql_warnings = 0; +# < +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c bool generated always as (a < b) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` tinyint(1) GENERATED ALWAYS AS (`a` < `b`) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('b','a',default); +insert into t1 values ('b','b',default); +insert into t1 values ('b','c',default); +select * from t1; +a b c +b a 0 +b b 0 +b c 1 +drop table t1; +set sql_warnings = 0; +# NOT BETWEEN ... AND ... +set sql_warnings = 1; +create table t1 (a int, b bool generated always as (a not between 0 and 2) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` tinyint(1) GENERATED ALWAYS AS (`a` not between 0 and 2) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (-1,default); +insert into t1 values (1,default); +select * from t1; +a b +-1 1 +1 0 +drop table t1; +set sql_warnings = 0; +# <> +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c bool generated always as (a <> b) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` tinyint(1) GENERATED ALWAYS AS (`a` <> `b`) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('b','a',default); +insert into t1 values ('b','b',default); +insert into t1 values ('b','c',default); +select * from t1; +a b c +b a 1 +b b 0 +b c 1 +drop table t1; +set sql_warnings = 0; +# != +set sql_warnings = 1; +create table t1 (a varchar(10), b varchar(10), c bool generated always as (a != b) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, + `c` tinyint(1) GENERATED ALWAYS AS (`a` <> `b`) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('b','a',default); +insert into t1 values ('b','b',default); +insert into t1 values ('b','c',default); +select * from t1; +a b c +b a 1 +b b 0 +b c 1 +drop table t1; +set sql_warnings = 0; +# ||, OR +set sql_warnings = 1; +create table t1 (a int, b int generated always as (a>5 || a<3) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` > 5 or `a` < 3) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (4,default); +select * from t1; +a b +1 1 +4 0 +drop table t1; +set sql_warnings = 0; +# >> +set sql_warnings = 1; +create table t1 (a int, b int generated always as (a >> 2) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` >> 2) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (8,default); +insert into t1 values (3,default); +select * from t1; +a b +3 0 +8 2 +drop table t1; +set sql_warnings = 0; +# XOR +set sql_warnings = 1; +create table t1 (a int, b int generated always as (a xor 5) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` xor 5) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (0,default); +insert into t1 values (1,default); +insert into t1 values (2,default); +select * from t1; +a b +0 1 +1 0 +2 0 +drop table t1; +set sql_warnings = 0; +# +# DATE AND TIME FUNCTIONS +# +# ADDDATE() +set sql_warnings = 1; +create table t1 (a datetime, b datetime generated always as (adddate(a,interval 1 month)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (`a` + interval 1 month) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 2008-09-30 00:00:00 +drop table t1; +set sql_warnings = 0; +# ADDTIME() +set sql_warnings = 1; +create table t1 (a datetime, b datetime generated always as (addtime(a,'02:00:00')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (addtime(`a`,'02:00:00')) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 2008-08-31 02:00:00 +drop table t1; +set sql_warnings = 0; +# CONVERT_TZ() +set sql_warnings = 1; +create table t1 (a datetime, b datetime generated always as (convert_tz(a,'MET','UTC')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (convert_tz(`a`,'MET','UTC')) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 2008-08-30 22:00:00 +drop table t1; +set sql_warnings = 0; +# DATE_ADD() +set sql_warnings = 1; +create table t1 (a datetime, b datetime generated always as (date_add(a,interval 1 month)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (`a` + interval 1 month) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 2008-09-30 00:00:00 +drop table t1; +set sql_warnings = 0; +# DATE_FORMAT() +set sql_warnings = 1; +create table t1 (a datetime, b varchar(64) generated always as (date_format(a,'%W %M %D')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` varchar(64) GENERATED ALWAYS AS (date_format(`a`,'%W %M %D')) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 Sunday August 31st +drop table t1; +set sql_warnings = 0; +# DATE_SUB() +set sql_warnings = 1; +create table t1 (a datetime, b datetime generated always as (date_sub(a,interval 1 month)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (`a` - interval 1 month) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 2008-07-31 00:00:00 +drop table t1; +set sql_warnings = 0; +# DATE() +set sql_warnings = 1; +create table t1 (a datetime, b datetime generated always as (date(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (cast(`a` as date)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31 02:00:00',default); +select * from t1; +a b +2008-08-31 02:00:00 2008-08-31 00:00:00 +drop table t1; +set sql_warnings = 0; +# DATEDIFF() +set sql_warnings = 1; +create table t1 (a datetime, b bigint generated always as (datediff(a,'2000-01-01')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` bigint(20) GENERATED ALWAYS AS (to_days(`a`) - to_days('2000-01-01')) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 3165 +drop table t1; +set sql_warnings = 0; +# DAY() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (day(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (dayofmonth(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 31 +drop table t1; +set sql_warnings = 0; +# DAYNAME() +set sql_warnings = 1; +create table t1 (a datetime, b varchar(10) generated always as (dayname(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` varchar(10) GENERATED ALWAYS AS (dayname(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 Sunday +drop table t1; +set sql_warnings = 0; +# DAYOFMONTH() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (dayofmonth(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (dayofmonth(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 31 +drop table t1; +set sql_warnings = 0; +# DAYOFWEEK() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (dayofweek(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (dayofweek(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 1 +drop table t1; +set sql_warnings = 0; +# DAYOFYEAR() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (dayofyear(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (dayofyear(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 244 +drop table t1; +set sql_warnings = 0; +# EXTRACT +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (extract(year from a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (extract(year from `a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 2008 +drop table t1; +set sql_warnings = 0; +# FROM_DAYS() +set sql_warnings = 1; +create table t1 (a bigint, b datetime generated always as (from_days(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (from_days(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (730669,default); +select * from t1; +a b +730669 2000-07-03 00:00:00 +drop table t1; +set sql_warnings = 0; +# FROM_UNIXTIME() +set sql_warnings = 1; +create table t1 (a bigint, b datetime generated always as (from_unixtime(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (from_unixtime(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1196440219,default); +select * from t1; +a b +1196440219 2007-11-30 19:30:19 +drop table t1; +set sql_warnings = 0; +# GET_FORMAT() +set sql_warnings = 1; +create table t1 (a datetime, b varchar(32) generated always as (date_format(a,get_format(DATE,'EUR'))) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` varchar(32) GENERATED ALWAYS AS (date_format(`a`,get_format(DATE, 'EUR'))) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 31.08.2008 +drop table t1; +set sql_warnings = 0; +# HOUR() +set sql_warnings = 1; +create table t1 (a time, b bigint generated always as (hour(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` time DEFAULT NULL, + `b` bigint(20) GENERATED ALWAYS AS (hour(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('10:05:03',default); +select * from t1; +a b +10:05:03 10 +drop table t1; +set sql_warnings = 0; +# LAST_DAY() +set sql_warnings = 1; +create table t1 (a datetime, b datetime generated always as (last_day(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (last_day(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2003-02-05',default); +insert into t1 values ('2003-02-32',default); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +select * from t1; +a b +0000-00-00 00:00:00 NULL +2003-02-05 00:00:00 2003-02-28 00:00:00 +drop table t1; +set sql_warnings = 0; +# MAKEDATE() +set sql_warnings = 1; +create table t1 (a int, b datetime generated always as (makedate(a,1)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (makedate(`a`,1)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (2001,default); +select * from t1; +a b +2001 2001-01-01 00:00:00 +drop table t1; +set sql_warnings = 0; +# MAKETIME() +set sql_warnings = 1; +create table t1 (a int, b time generated always as (maketime(a,1,3)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` time GENERATED ALWAYS AS (maketime(`a`,1,3)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (12,default); +select * from t1; +a b +12 12:01:03 +drop table t1; +set sql_warnings = 0; +# MICROSECOND() +set sql_warnings = 1; +create table t1 (a datetime, b bigint generated always as (microsecond(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` bigint(20) GENERATED ALWAYS AS (microsecond(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2009-12-31 12:00:00.123456',default); +insert into t1 values ('2009-12-31 23:59:59.000010',default); +select * from t1; +a b +2009-12-31 12:00:00 0 +2009-12-31 23:59:59 0 +drop table t1; +set sql_warnings = 0; +# MINUTE() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (minute(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (minute(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2009-12-31 23:59:59.000010',default); +select * from t1; +a b +2009-12-31 23:59:59 59 +drop table t1; +set sql_warnings = 0; +# MONTH() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (month(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (month(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2009-12-31 23:59:59.000010',default); +select * from t1; +a b +2009-12-31 23:59:59 12 +drop table t1; +set sql_warnings = 0; +# MONTHNAME() +set sql_warnings = 1; +create table t1 (a datetime, b varchar(16) generated always as (monthname(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` varchar(16) GENERATED ALWAYS AS (monthname(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2009-12-31 23:59:59.000010',default); +select * from t1; +a b +2009-12-31 23:59:59 December +drop table t1; +set sql_warnings = 0; +# PERIOD_ADD() +set sql_warnings = 1; +create table t1 (a int, b int generated always as (period_add(a,2)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (period_add(`a`,2)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (200801,default); +select * from t1; +a b +200801 200803 +drop table t1; +set sql_warnings = 0; +# PERIOD_DIFF() +set sql_warnings = 1; +create table t1 (a int, b int, c int generated always as (period_diff(a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (period_diff(`a`,`b`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (200802,200703,default); +select * from t1; +a b c +200802 200703 11 +drop table t1; +set sql_warnings = 0; +# QUARTER() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (quarter(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (quarter(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 3 +drop table t1; +set sql_warnings = 0; +# SEC_TO_TIME() +set sql_warnings = 1; +create table t1 (a bigint, b time generated always as (sec_to_time(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) DEFAULT NULL, + `b` time GENERATED ALWAYS AS (sec_to_time(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (2378,default); +select * from t1; +a b +2378 00:39:38 +drop table t1; +set sql_warnings = 0; +# SECOND() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (second(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (second(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('10:05:03',default); +select * from t1; +a b +2010-05-03 00:00:00 0 +drop table t1; +set sql_warnings = 0; +# STR_TO_DATE() +set sql_warnings = 1; +create table t1 (a varchar(64), b datetime generated always as (str_to_date(a,'%m/%d/%Y')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(64) DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (str_to_date(`a`,'%m/%d/%Y')) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('04/30/2004',default); +select * from t1; +a b +04/30/2004 2004-04-30 00:00:00 +drop table t1; +set sql_warnings = 0; +# SUBDATE() +set sql_warnings = 1; +create table t1 (a datetime, b datetime generated always as (subdate(a,interval 1 month)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (`a` - interval 1 month) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 2008-07-31 00:00:00 +drop table t1; +set sql_warnings = 0; +# SUBTIME() +set sql_warnings = 1; +create table t1 (a datetime, b datetime generated always as (subtime(a,'02:00:00')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` datetime GENERATED ALWAYS AS (subtime(`a`,'02:00:00')) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31',default); +select * from t1; +a b +2008-08-31 00:00:00 2008-08-30 22:00:00 +drop table t1; +set sql_warnings = 0; +# TIME_FORMAT() +set sql_warnings = 1; +create table t1 (a datetime, b varchar(32) generated always as (time_format(a,'%r')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` varchar(32) GENERATED ALWAYS AS (time_format(`a`,'%r')) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31 02:03:04',default); +select * from t1; +a b +2008-08-31 02:03:04 02:03:04 AM +drop table t1; +set sql_warnings = 0; +# TIME_TO_SEC() +set sql_warnings = 1; +create table t1 (a time, b bigint generated always as (time_to_sec(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` time DEFAULT NULL, + `b` bigint(20) GENERATED ALWAYS AS (time_to_sec(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('22:23:00',default); +select * from t1; +a b +22:23:00 80580 +drop table t1; +set sql_warnings = 0; +# TIME() +set sql_warnings = 1; +create table t1 (a datetime, b time generated always as (time(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` time GENERATED ALWAYS AS (cast(`a` as time)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-08-31 02:03:04',default); +select * from t1; +a b +2008-08-31 02:03:04 02:03:04 +drop table t1; +set sql_warnings = 0; +# TIMEDIFF() +set sql_warnings = 1; +create table t1 (a datetime, b datetime, c time generated always as (timediff(a,b)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` datetime DEFAULT NULL, + `c` time GENERATED ALWAYS AS (timediff(`a`,`b`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-12-31 23:59:59.000001','2008-12-30 01:01:01.000002',default); +select * from t1; +a b c +2008-12-31 23:59:59 2008-12-30 01:01:01 46:58:58 +drop table t1; +set sql_warnings = 0; +# TIMESTAMP() +set sql_warnings = 1; +create table t1 (a datetime, b timestamp generated always as (timestamp(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` timestamp GENERATED ALWAYS AS (cast(`a` as datetime)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-12-31',default); +select * from t1; +a b +2008-12-31 00:00:00 2008-12-31 00:00:00 +drop table t1; +set sql_warnings = 0; +# TIMESTAMPADD() +set sql_warnings = 1; +create table t1 (a datetime, b timestamp generated always as (timestampadd(minute,1,a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` timestamp GENERATED ALWAYS AS (`a` + interval 1 minute) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2003-01-02',default); +select * from t1; +a b +2003-01-02 00:00:00 2003-01-02 00:01:00 +drop table t1; +set sql_warnings = 0; +# TIMESTAMPDIFF() +set sql_warnings = 1; +create table t1 (a timestamp, c bigint generated always as (timestampdiff(MONTH, a, a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `c` bigint(20) GENERATED ALWAYS AS (timestampdiff(MONTH,`a`,`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2003-02-01',default); +select * from t1; +a c +2003-02-01 00:00:00 0 +drop table t1; +set sql_warnings = 0; +# TO_DAYS() +set sql_warnings = 1; +create table t1 (a datetime, b bigint generated always as (to_days(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` bigint(20) GENERATED ALWAYS AS (to_days(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2007-10-07',default); +select * from t1; +a b +2007-10-07 00:00:00 733321 +drop table t1; +set sql_warnings = 0; +# WEEK() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (week(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (week(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-09-01',default); +select * from t1; +a b +2008-09-01 00:00:00 35 +drop table t1; +set sql_warnings = 0; +# WEEKDAY() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (weekday(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (weekday(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-09-01',default); +select * from t1; +a b +2008-09-01 00:00:00 0 +drop table t1; +set sql_warnings = 0; +# WEEKOFYEAR() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (weekofyear(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (week(`a`,3)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-09-01',default); +select * from t1; +a b +2008-09-01 00:00:00 36 +drop table t1; +set sql_warnings = 0; +# YEAR() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (year(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (year(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-09-01',default); +select * from t1; +a b +2008-09-01 00:00:00 2008 +drop table t1; +set sql_warnings = 0; +# YEARWEEK() +set sql_warnings = 1; +create table t1 (a datetime, b int generated always as (yearweek(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (yearweek(`a`,0)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('2008-09-01',default); +select * from t1; +a b +2008-09-01 00:00:00 200835 +drop table t1; +set sql_warnings = 0; +# +# FULL TEXT SEARCH FUNCTIONS +# +# None. +# +# CAST FUNCTIONS AND OPERATORS +# +# CAST() +set sql_warnings = 1; +create table t1 (a int, b bigint unsigned generated always as (cast(a as unsigned)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` bigint(20) unsigned GENERATED ALWAYS AS (cast(`a` as unsigned)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (-1,default); +Warnings: +Note 1105 Cast to unsigned converted negative integer to it's positive complement +select * from t1; +a b +-1 18446744073709551615 +1 1 +Note 1105 Cast to unsigned converted negative integer to it's positive complement +Warnings: +drop table t1; +set sql_warnings = 0; +# Convert() +set sql_warnings = 1; +create table t1 (a int, b bigint unsigned generated always as (convert(a,unsigned)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` bigint(20) unsigned GENERATED ALWAYS AS (cast(`a` as unsigned)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (-1,default); +Warnings: +Note 1105 Cast to unsigned converted negative integer to it's positive complement +select * from t1; +a b +-1 18446744073709551615 +1 1 +Note 1105 Cast to unsigned converted negative integer to it's positive complement +Warnings: +drop table t1; +set sql_warnings = 0; +# +# XML FUNCTIONS +# +# ExtractValue() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varchar(1024) generated always as (ExtractValue(a,'/b')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (extractvalue(`a`,'/b')) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('text',default); +select * from t1; +a b +text text +drop table t1; +set sql_warnings = 0; +# None. +# +# OTHER FUNCTIONS +# +# AES_DECRYPT(), AES_ENCRYPT() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varchar(1024) generated always as (aes_encrypt(aes_decrypt(a,'adf'),'adf')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (aes_encrypt(aes_decrypt(`a`,'adf'),'adf')) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +select * from t1; +a b +MySQL NULL +drop table t1; +set sql_warnings = 0; +# BIT_COUNT() +set sql_warnings = 1; +create table t1 (a int, b int generated always as (bit_count(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (bit_count(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (5,default); +select * from t1; +a b +5 2 +drop table t1; +set sql_warnings = 0; +# CHARSET() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varchar(1024) generated always as (charset(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (charset(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('abc',default); +select * from t1; +a b +abc latin1 +drop table t1; +set sql_warnings = 0; +# COERCIBILITY() +set sql_warnings = 1; +create table t1 (a varchar(1024), b int generated always as (coercibility(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (coercibility(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('abc',default); +select * from t1; +a b +abc 2 +drop table t1; +set sql_warnings = 0; +# COLLATION() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varchar(1024) generated always as (collation(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (collation(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('abc',default); +select * from t1; +a b +abc latin1_swedish_ci +drop table t1; +set sql_warnings = 0; +# COMPRESS(), UNCOMPRESS() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varchar(1024) generated always as (uncompress(compress(a))) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (uncompress(compress(`a`))) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +select * from t1; +a b +MySQL MySQL +drop table t1; +set sql_warnings = 0; +# ENCODE(), DECODE() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varchar(1024) generated always as (decode(encode(a,'abc'),'abc')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (decode(encode(`a`,'abc'),'abc')) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +select * from t1; +a b +MySQL MySQL +drop table t1; +set sql_warnings = 0; +# DEFAULT() +set sql_warnings = 1; +create table t1 (a varchar(1024) default 'aaa', b varchar(1024) generated always as (ifnull(a,default(a))) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT 'aaa', + `b` varchar(1024) GENERATED ALWAYS AS (ifnull(`a`,default(`a`))) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('any value',default); +select * from t1; +a b +any value any value +drop table t1; +set sql_warnings = 0; +# DES_ENCRYPT(), DES_DECRYPT() +create table t1 (a varchar(1024), b varchar(1024) generated always as (des_encrypt(des_decrypt(a,'adf'),'adf')) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (des_encrypt(des_decrypt(`a`,'adf'),'adf')) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('MySQL',default); +select * from t1; +a b +MySQL ÿw2¥ð +èõÁ +drop table t1; +# INET_ATON(), INET_NTOA() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varchar(1024) generated always as (inet_ntoa(inet_aton(a))) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (inet_ntoa(inet_aton(`a`))) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('127.0.0.1',default); +select * from t1; +a b +127.0.0.1 127.0.0.1 +drop table t1; +set sql_warnings = 0; +# MD5() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varbinary(32) generated always as (md5(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varbinary(32) GENERATED ALWAYS AS (md5(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('testing',default); +select * from t1; +a b +testing ae2b1fca515949e5d54fb22b8ed95575 +drop table t1; +set sql_warnings = 0; +# PASSWORD() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varchar(1024) generated always as (password(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (password(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('badpwd',default); +select * from t1; +a b +badpwd *AAB3E285149C0135D51A520E1940DD3263DC008C +drop table t1; +set sql_warnings = 0; +# SHA1() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varchar(1024) generated always as (sha1(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (sha(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('abc',default); +select * from t1; +a b +abc a9993e364706816aba3e25717850c26c9cd0d89d +drop table t1; +set sql_warnings = 0; +# SHA() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varchar(1024) generated always as (sha(a)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (sha(`a`)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('abc',default); +select * from t1; +a b +abc a9993e364706816aba3e25717850c26c9cd0d89d +drop table t1; +set sql_warnings = 0; +# SHA2() +set sql_warnings = 1; +create table t1 (a varchar(1024), b varchar(1024) generated always as (sha2(a,224)) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1024) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (sha2(`a`,224)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('abc',default); +select * from t1; +a b +abc 23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 +drop table t1; +set sql_warnings = 0; +# UNCOMPRESSED_LENGTH() +set sql_warnings = 1; +create table t1 (a char, b varchar(1024) generated always as (uncompressed_length(compress(repeat(a,30)))) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(1) DEFAULT NULL, + `b` varchar(1024) GENERATED ALWAYS AS (uncompressed_length(compress(repeat(`a`,30)))) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('a',default); +select * from t1; +a b +a 30 +drop table t1; +set sql_warnings = 0; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_trigger_sp_innodb.result b/mysql-test/suite/gcol/r/gcol_trigger_sp_innodb.result new file mode 100644 index 00000000000..60dce012b78 --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_trigger_sp_innodb.result @@ -0,0 +1,94 @@ +SET @@session.default_storage_engine = 'InnoDB'; +create table t1 (a int, +b int generated always as (a/10) virtual, +c int generated always as (a/10) stored); +create table t2 (a timestamp); +create trigger trg1 before insert on t1 for each row +begin +if (new.b < 10) then +set new.a:= 100; +set new.b:= 9; +set new.c:= 9; +end if; +if (new.c > 50) then +set new.a:= 500; +end if; +end| +create trigger trg2 after insert on t1 for each row +begin +if (new.b >= 60) then +insert into t2 values (now()); +end if; +end| +create function f1() +returns int +begin +declare sum1 int default '0'; +declare cur1 cursor for select sum(b) from t1; +open cur1; +fetch cur1 into sum1; +close cur1; +return sum1; +end| +set sql_warnings = 1; +insert into t1 (a) values (200); +select * from t1; +a b c +200 20 20 +select * from t2; +a +insert into t1 (a) values (10); +select * from t1; +a b c +100 10 10 +200 20 20 +select * from t2; +a +insert into t1 (a) values (600); +select * from t1; +a b c +100 10 10 +200 20 20 +500 50 50 +select * from t2; +a +select f1(); +f1() +80 +set sql_warnings = 0; +drop trigger trg1; +drop trigger trg2; +drop table t2; +create procedure p1() +begin +declare i int default '0'; +create table t2 like t1; +insert into t2 (a) values (100), (200); +begin +declare cur1 cursor for select sum(c) from t2; +open cur1; +fetch cur1 into i; +close cur1; +if (i=30) then +insert into t1 values (300,default,default); +end if; +end; +end| +delete from t1; +call p1(); +select * from t2; +a b c +100 10 10 +200 20 20 +select * from t1; +a b c +300 30 30 +drop table t1,t2; +drop procedure p1; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_trigger_sp_myisam.result b/mysql-test/suite/gcol/r/gcol_trigger_sp_myisam.result new file mode 100644 index 00000000000..a5e3bda2a0e --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_trigger_sp_myisam.result @@ -0,0 +1,94 @@ +SET @@session.default_storage_engine = 'MyISAM'; +create table t1 (a int, +b int generated always as (a/10) virtual, +c int generated always as (a/10) stored); +create table t2 (a timestamp); +create trigger trg1 before insert on t1 for each row +begin +if (new.b < 10) then +set new.a:= 100; +set new.b:= 9; +set new.c:= 9; +end if; +if (new.c > 50) then +set new.a:= 500; +end if; +end| +create trigger trg2 after insert on t1 for each row +begin +if (new.b >= 60) then +insert into t2 values (now()); +end if; +end| +create function f1() +returns int +begin +declare sum1 int default '0'; +declare cur1 cursor for select sum(b) from t1; +open cur1; +fetch cur1 into sum1; +close cur1; +return sum1; +end| +set sql_warnings = 1; +insert into t1 (a) values (200); +select * from t1; +a b c +200 20 20 +select * from t2; +a +insert into t1 (a) values (10); +select * from t1; +a b c +100 10 10 +200 20 20 +select * from t2; +a +insert into t1 (a) values (600); +select * from t1; +a b c +100 10 10 +200 20 20 +500 50 50 +select * from t2; +a +select f1(); +f1() +80 +set sql_warnings = 0; +drop trigger trg1; +drop trigger trg2; +drop table t2; +create procedure p1() +begin +declare i int default '0'; +create table t2 like t1; +insert into t2 (a) values (100), (200); +begin +declare cur1 cursor for select sum(c) from t2; +open cur1; +fetch cur1 into i; +close cur1; +if (i=30) then +insert into t1 values (300,default,default); +end if; +end; +end| +delete from t1; +call p1(); +select * from t2; +a b c +100 10 10 +200 20 20 +select * from t1; +a b c +300 30 30 +drop table t1,t2; +drop procedure p1; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_update.result b/mysql-test/suite/gcol/r/gcol_update.result new file mode 100644 index 00000000000..380d1c1efef --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_update.result @@ -0,0 +1,30 @@ +set global innodb_purge_stop_now = 1; +create table t1(f1 int not null, f2 blob not null, f3 blob not null, +vchar char(2) as (substr(f3,2,2)) virtual, +primary key(f1, f3(5)), index(vchar))engine=innodb; +insert into t1(f1,f2,f3) values(1, repeat('a',8000), repeat('b', 9000)); +update t1 set f1=5 where f1=1; +delete from t1 where f1=5; +set global innodb_purge_run_now=1; +set global innodb_fast_shutdown=0; +set global innodb_purge_stop_now = 1; +drop table t1; +create table t1(f1 int not null, f2 blob not null, f3 blob not null, +vchar char(2) as (substr(f3,2,2)) virtual, +primary key(f1, f3(5)), index(vchar, f3(2)))engine=innodb; +insert into t1(f1,f2,f3) values(1, repeat('a',8000), repeat('b', 9000)); +update t1 set f1=5 where f1=1; +delete from t1 where f1=5; +set global innodb_purge_run_now=1; +set global innodb_fast_shutdown=0; +set global innodb_purge_stop_now = 1; +drop table t1; +create table t1(f1 int not null, f2 blob not null, f3 blob not null, +vchar blob as (f3) virtual, +primary key(f1, f3(5)), index(vchar(3)))engine=innodb; +insert into t1(f1,f2,f3) values(1, repeat('a',8000), repeat('b', 9000)); +update t1 set f1=5 where f1=1; +delete from t1 where f1=5; +set global innodb_purge_run_now=1; +set global innodb_fast_shutdown=0; +drop table t1; diff --git a/mysql-test/suite/gcol/r/gcol_view_innodb.result b/mysql-test/suite/gcol/r/gcol_view_innodb.result new file mode 100644 index 00000000000..ec82c792493 --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_view_innodb.result @@ -0,0 +1,280 @@ +SET @@session.default_storage_engine = 'InnoDB'; +create table t1 (a int not null, +b int generated always as (-a) virtual, +c int generated always as (-a) stored); +insert into t1 (a) values (1), (1), (2), (2), (3); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +create view v1 (d,e) as select abs(b), abs(c) from t1; +select d,e from v1; +d e +1 1 +1 1 +2 2 +2 2 +3 3 +select is_updatable from information_schema.views where table_name='v1'; +is_updatable +NO +explain select d,e from v1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 X +create algorithm=temptable view v2 (d,e) as select abs(b), abs(c) from t1; +show create view v2; +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select abs(`t1`.`b`) AS `d`,abs(`t1`.`c`) AS `e` from `t1` latin1 latin1_swedish_ci +select d,e from v2; +d e +1 1 +1 1 +2 2 +2 2 +3 3 +explain select d,e from v2; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 5 X +2 DERIVED t1 ALL NULL NULL NULL NULL 5 X +create view v3 (d,e) as select d*2, e*2 from v1; +select * from v3; +d e +2 2 +2 2 +4 4 +4 4 +6 6 +explain select * from v3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 X +drop view v1,v2,v3; +drop table t1; +create table t1 (a int not null, +b int generated always as (-a) virtual, +c int generated always as (-a) stored); +insert into t1 (a) values (1), (2), (3), (1), (2), (3); +create view v1 as select distinct b from t1; +select * from v1; +b +-1 +-2 +-3 +explain select * from v1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 6 X +2 DERIVED t1 ALL NULL NULL NULL NULL 6 X +select * from t1; +a b c +1 -1 -1 +1 -1 -1 +2 -2 -2 +2 -2 -2 +3 -3 -3 +3 -3 -3 +drop view v1; +create view v1 as select distinct c from t1; +select * from v1; +c +-1 +-2 +-3 +explain select * from v1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 6 X +2 DERIVED t1 ALL NULL NULL NULL NULL 6 X +select * from t1; +a b c +1 -1 -1 +1 -1 -1 +2 -2 -2 +2 -2 -2 +3 -3 -3 +3 -3 -3 +drop view v1; +drop table t1; +create table t1 (a int not null, +b int generated always as (-a) virtual, +c int generated always as (-a) stored); +insert into t1 (a) values (1), (2), (3), (4); +create view v1 as select b+1 from t1 order by 1 desc limit 2; +select * from v1; +b+1 +0 +-1 +explain select * from v1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 2 X +2 DERIVED t1 ALL NULL NULL NULL NULL 4 X +drop view v1; +create view v1 as select c+1 from t1 order by 1 desc limit 2; +select * from v1; +c+1 +-1 +0 +explain select * from v1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 2 X +2 DERIVED t1 ALL NULL NULL NULL NULL 4 X +drop view v1; +drop table t1; +create table t1 (a int, +b int, +c int generated always as (-a) virtual, +d int generated always as (-a) stored, +primary key(a)); +insert into t1 (a,b) values (10,2), (20,3), (30,4), (40,5), (50,10); +create view v1 (a,e,f,g) as select a, b+1,c+1,d+1 from t1; +update v1 set a=a+e; +select * from v1 order by a; +a e f g +13 3 -12 -12 +24 4 -23 -23 +35 5 -34 -34 +46 6 -45 -45 +61 11 -60 -60 +select * from t1 order by a; +a b c d +13 2 -13 -13 +24 3 -24 -24 +35 4 -35 -35 +46 5 -46 -46 +61 10 -61 -61 +delete from v1; +select * from v1; +a e f g +select * from t1; +a b c d +insert into v1 (a,e) values (60,15); +ERROR HY000: The target table v1 of the INSERT is not insertable-into +drop table t1; +drop view v1; +create table t1 (a int, +b int generated always as (-a) virtual, +c int generated always as (-a) stored, +primary key(a)); +insert into t1 (a) values (1), (2), (3); +create view v1 (x,y,z) as select a,b,c from t1 where b < -1; +select t1.a, v1.x, v1.y, v1.z from t1 left join v1 on (t1.b= v1.y); +a x y z +1 NULL NULL NULL +2 2 -2 -2 +3 3 -3 -3 +drop view v1; +create view v1 (x,y,z) as select a,b,c from t1 where c < -1; +select t1.a, v1.x, v1.y, v1.z from t1 left join v1 on (t1.c= v1.z); +a x y z +1 NULL NULL NULL +2 2 -2 -2 +3 3 -3 -3 +drop view v1; +drop table t1; +create table t1 (a1 int, +b1 int generated always as (-a1) virtual, +c1 int generated always as (-a1) stored); +create table t2 (a2 int, +b2 int generated always as (-a2) virtual, +c2 int generated always as (-a2) stored); +insert into t1 (a1) values (1), (2); +insert into t2 (a2) values (2), (3); +create view v1 as select * from t1,t2 union all select * from t1,t2; +select * from v1; +a1 b1 c1 a2 b2 c2 +1 -1 -1 2 -2 -2 +1 -1 -1 2 -2 -2 +1 -1 -1 3 -3 -3 +1 -1 -1 3 -3 -3 +2 -2 -2 2 -2 -2 +2 -2 -2 2 -2 -2 +2 -2 -2 3 -3 -3 +2 -2 -2 3 -3 -3 +drop view v1; +drop table t1, t2; +create table t1 (a int, +b int generated always as (-a) virtual, +c int generated always as (-a) stored); +create table t2 like t1; +create view v1 as select a,b,c from t1; +create view v2 as select a,b,c from t2 where b in (select b from v1); +show create view v2; +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t2`.`a` AS `a`,`t2`.`b` AS `b`,`t2`.`c` AS `c` from `t2` where `t2`.`b` in (select `v1`.`b` from `v1`) latin1 latin1_swedish_ci +drop view v2, v1; +drop table t1, t2; +create table t1 (a int, +b int generated always as (-a) virtual, +c int generated always as (-a) stored); +insert into t1 (a) values (1),(1),(2),(2),(3),(3); +create view v1 as select b from t1; +select distinct b from v1; +b +-1 +-2 +-3 +select distinct b from v1 order by b limit 2; +b +-3 +-2 +select distinct b from t1 order by b limit 2; +b +-3 +-2 +prepare stmt1 from "select distinct b from v1 order by b limit 2"; +execute stmt1; +b +-3 +-2 +execute stmt1; +b +-3 +-2 +deallocate prepare stmt1; +drop view v1; +create view v1 as select c from t1; +select distinct c from v1; +c +-1 +-2 +-3 +select distinct c from v1 order by c limit 2; +c +-3 +-2 +select distinct c from t1 order by c limit 2; +c +-3 +-2 +prepare stmt1 from "select distinct c from v1 order by c limit 2"; +execute stmt1; +c +-3 +-2 +execute stmt1; +c +-3 +-2 +deallocate prepare stmt1; +drop view v1; +drop table t1; +create table t1 (a int, +b int generated always as (-a) virtual, +c int generated always as (-a) stored); +create view v1 as select * from t1 where b > -2 && c >-2 with check option; +insert into v1 (a) values (1); +insert into v1 (a) values (3); +ERROR 44000: CHECK OPTION failed `test`.`v1` +insert ignore into v1 (a) values (2),(3),(0); +Warnings: +Warning 1369 CHECK OPTION failed `test`.`v1` +Warning 1369 CHECK OPTION failed `test`.`v1` +select * from t1; +a b c +0 0 0 +1 -1 -1 +drop view v1; +drop table t1; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/gcol_view_myisam.result b/mysql-test/suite/gcol/r/gcol_view_myisam.result new file mode 100644 index 00000000000..13cb74ebcb5 --- /dev/null +++ b/mysql-test/suite/gcol/r/gcol_view_myisam.result @@ -0,0 +1,280 @@ +SET @@session.default_storage_engine = 'MyISAM'; +create table t1 (a int not null, +b int generated always as (-a) virtual, +c int generated always as (-a) stored); +insert into t1 (a) values (1), (1), (2), (2), (3); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +create view v1 (d,e) as select abs(b), abs(c) from t1; +select d,e from v1; +d e +1 1 +1 1 +2 2 +2 2 +3 3 +select is_updatable from information_schema.views where table_name='v1'; +is_updatable +NO +explain select d,e from v1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 X +create algorithm=temptable view v2 (d,e) as select abs(b), abs(c) from t1; +show create view v2; +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select abs(`t1`.`b`) AS `d`,abs(`t1`.`c`) AS `e` from `t1` latin1 latin1_swedish_ci +select d,e from v2; +d e +1 1 +1 1 +2 2 +2 2 +3 3 +explain select d,e from v2; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 5 X +2 DERIVED t1 ALL NULL NULL NULL NULL 5 X +create view v3 (d,e) as select d*2, e*2 from v1; +select * from v3; +d e +2 2 +2 2 +4 4 +4 4 +6 6 +explain select * from v3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 X +drop view v1,v2,v3; +drop table t1; +create table t1 (a int not null, +b int generated always as (-a) virtual, +c int generated always as (-a) stored); +insert into t1 (a) values (1), (2), (3), (1), (2), (3); +create view v1 as select distinct b from t1; +select * from v1; +b +-1 +-2 +-3 +explain select * from v1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 6 X +2 DERIVED t1 ALL NULL NULL NULL NULL 6 X +select * from t1; +a b c +1 -1 -1 +1 -1 -1 +2 -2 -2 +2 -2 -2 +3 -3 -3 +3 -3 -3 +drop view v1; +create view v1 as select distinct c from t1; +select * from v1; +c +-1 +-2 +-3 +explain select * from v1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 6 X +2 DERIVED t1 ALL NULL NULL NULL NULL 6 X +select * from t1; +a b c +1 -1 -1 +1 -1 -1 +2 -2 -2 +2 -2 -2 +3 -3 -3 +3 -3 -3 +drop view v1; +drop table t1; +create table t1 (a int not null, +b int generated always as (-a) virtual, +c int generated always as (-a) stored); +insert into t1 (a) values (1), (2), (3), (4); +create view v1 as select b+1 from t1 order by 1 desc limit 2; +select * from v1; +b+1 +0 +-1 +explain select * from v1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 2 X +2 DERIVED t1 ALL NULL NULL NULL NULL 4 X +drop view v1; +create view v1 as select c+1 from t1 order by 1 desc limit 2; +select * from v1; +c+1 +-1 +0 +explain select * from v1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 2 X +2 DERIVED t1 ALL NULL NULL NULL NULL 4 X +drop view v1; +drop table t1; +create table t1 (a int, +b int, +c int generated always as (-a) virtual, +d int generated always as (-a) stored, +primary key(a)); +insert into t1 (a,b) values (10,2), (20,3), (30,4), (40,5), (50,10); +create view v1 (a,e,f,g) as select a, b+1,c+1,d+1 from t1; +update v1 set a=a+e; +select * from v1 order by a; +a e f g +13 3 -12 -12 +24 4 -23 -23 +35 5 -34 -34 +46 6 -45 -45 +61 11 -60 -60 +select * from t1 order by a; +a b c d +13 2 -13 -13 +24 3 -24 -24 +35 4 -35 -35 +46 5 -46 -46 +61 10 -61 -61 +delete from v1; +select * from v1; +a e f g +select * from t1; +a b c d +insert into v1 (a,e) values (60,15); +ERROR HY000: The target table v1 of the INSERT is not insertable-into +drop table t1; +drop view v1; +create table t1 (a int, +b int generated always as (-a) virtual, +c int generated always as (-a) stored, +primary key(a)); +insert into t1 (a) values (1), (2), (3); +create view v1 (x,y,z) as select a,b,c from t1 where b < -1; +select t1.a, v1.x, v1.y, v1.z from t1 left join v1 on (t1.b= v1.y); +a x y z +1 NULL NULL NULL +2 2 -2 -2 +3 3 -3 -3 +drop view v1; +create view v1 (x,y,z) as select a,b,c from t1 where c < -1; +select t1.a, v1.x, v1.y, v1.z from t1 left join v1 on (t1.c= v1.z); +a x y z +1 NULL NULL NULL +2 2 -2 -2 +3 3 -3 -3 +drop view v1; +drop table t1; +create table t1 (a1 int, +b1 int generated always as (-a1) virtual, +c1 int generated always as (-a1) stored); +create table t2 (a2 int, +b2 int generated always as (-a2) virtual, +c2 int generated always as (-a2) stored); +insert into t1 (a1) values (1), (2); +insert into t2 (a2) values (2), (3); +create view v1 as select * from t1,t2 union all select * from t1,t2; +select * from v1; +a1 b1 c1 a2 b2 c2 +1 -1 -1 2 -2 -2 +1 -1 -1 2 -2 -2 +1 -1 -1 3 -3 -3 +1 -1 -1 3 -3 -3 +2 -2 -2 2 -2 -2 +2 -2 -2 2 -2 -2 +2 -2 -2 3 -3 -3 +2 -2 -2 3 -3 -3 +drop view v1; +drop table t1, t2; +create table t1 (a int, +b int generated always as (-a) virtual, +c int generated always as (-a) stored); +create table t2 like t1; +create view v1 as select a,b,c from t1; +create view v2 as select a,b,c from t2 where b in (select b from v1); +show create view v2; +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t2`.`a` AS `a`,`t2`.`b` AS `b`,`t2`.`c` AS `c` from `t2` where `t2`.`b` in (select `v1`.`b` from `v1`) latin1 latin1_swedish_ci +drop view v2, v1; +drop table t1, t2; +create table t1 (a int, +b int generated always as (-a) virtual, +c int generated always as (-a) stored); +insert into t1 (a) values (1),(1),(2),(2),(3),(3); +create view v1 as select b from t1; +select distinct b from v1; +b +-1 +-2 +-3 +select distinct b from v1 order by b limit 2; +b +-3 +-2 +select distinct b from t1 order by b limit 2; +b +-3 +-2 +prepare stmt1 from "select distinct b from v1 order by b limit 2"; +execute stmt1; +b +-3 +-2 +execute stmt1; +b +-3 +-2 +deallocate prepare stmt1; +drop view v1; +create view v1 as select c from t1; +select distinct c from v1; +c +-1 +-2 +-3 +select distinct c from v1 order by c limit 2; +c +-3 +-2 +select distinct c from t1 order by c limit 2; +c +-3 +-2 +prepare stmt1 from "select distinct c from v1 order by c limit 2"; +execute stmt1; +c +-3 +-2 +execute stmt1; +c +-3 +-2 +deallocate prepare stmt1; +drop view v1; +drop table t1; +create table t1 (a int, +b int generated always as (-a) virtual, +c int generated always as (-a) stored); +create view v1 as select * from t1 where b > -2 && c >-2 with check option; +insert into v1 (a) values (1); +insert into v1 (a) values (3); +ERROR 44000: CHECK OPTION failed `test`.`v1` +insert ignore into v1 (a) values (2),(3),(0); +Warnings: +Warning 1369 CHECK OPTION failed `test`.`v1` +Warning 1369 CHECK OPTION failed `test`.`v1` +select * from t1; +a b c +0 0 0 +1 -1 -1 +drop view v1; +drop table t1; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; diff --git a/mysql-test/suite/gcol/r/innodb_partition.result b/mysql-test/suite/gcol/r/innodb_partition.result new file mode 100644 index 00000000000..8cdf8d41a7a --- /dev/null +++ b/mysql-test/suite/gcol/r/innodb_partition.result @@ -0,0 +1,26 @@ +# +# Bug#22444530 - GCOLS + PARTITIONED TABLE, CRASH IN +# +set sql_mode=''; +create table t ( +a int not null, +b int generated always as (1) virtual, +c int generated always as (1) virtual, +key (c) +) engine=innodb partition by key (a) partitions 2; +insert into t(a) values(1); +select b from t group by c; +b +1 +drop table t; +create table t ( +a int not null, +b blob generated always as ("a") virtual, +c int generated always as (1) virtual, +key (c) +) engine=innodb partition by key (a) partitions 2; +insert into t(a) values(1); +select b from t group by c; +b +a +drop table t; diff --git a/mysql-test/suite/gcol/r/innodb_prefix_index_check.result b/mysql-test/suite/gcol/r/innodb_prefix_index_check.result new file mode 100644 index 00000000000..01dbe4a6592 --- /dev/null +++ b/mysql-test/suite/gcol/r/innodb_prefix_index_check.result @@ -0,0 +1,15 @@ +#Bug #22445211 GCOLS: SIMPLE DML, FAILING ASSERTION: +#!CURSOR->INDEX->IS_COMMITTED() +#Create and alter table examples for virtual column for full +#column index followed by prefix index. +CREATE TABLE t1( +f1 INT DEFAULT NULL, +f2 CHAR(2) GENERATED ALWAYS AS ('11') VIRTUAL, +f3 INT, +UNIQUE KEY(f1), +UNIQUE KEY(f3,f1), +KEY(f2,f1), +key(f1,f2(1)) +)ENGINE=INNODB; +REPLACE INTO t1(f3) VALUES (1),(1); +DROP TABLE t1; diff --git a/mysql-test/suite/gcol/r/innodb_virtual_basic.result b/mysql-test/suite/gcol/r/innodb_virtual_basic.result new file mode 100644 index 00000000000..06a307fc761 --- /dev/null +++ b/mysql-test/suite/gcol/r/innodb_virtual_basic.result @@ -0,0 +1,1564 @@ +call mtr.add_suppression("\\[Warning\\] InnoDB: Compute virtual"); +set default_storage_engine=innodb; +CREATE TABLE t (a INT, b INT GENERATED ALWAYS AS (a), c CHAR(10), d CHAR(20), e CHAR(10) GENERATED ALWAYS AS (c), g INT); +INSERT INTO t VALUES(10, DEFAULT, "aa", "bb", DEFAULT, 20); +INSERT INTO t VALUES(11, DEFAULT, "jj", "kk", DEFAULT, 21); +CREATE INDEX idx ON t(e) algorithm=inplace; +INSERT INTO t VALUES(12, DEFAULT, 'mm', "nn", DEFAULT, 22); +SELECT e FROM t; +e +aa +jj +mm +DROP TABLE t; +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); +INSERT INTO t VALUES (11, 3, DEFAULT, 'mm'); +INSERT INTO t VALUES (18, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (28, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (null, null, DEFAULT, 'mm'); +CREATE INDEX idx ON t(c); +SELECT c FROM t; +c +NULL +14 +19 +29 +UPDATE t SET a = 10 WHERE a = 11; +SELECT c FROM t; +c +NULL +13 +19 +29 +SELECT * FROM t; +a b c h +10 3 13 mm +18 1 19 mm +28 1 29 mm +NULL NULL NULL mm +DELETE FROM t WHERE a = 18; +SELECT c FROM t; +c +NULL +13 +29 +START TRANSACTION; +INSERT INTO t VALUES (128, 22, DEFAULT, "xx"); +INSERT INTO t VALUES (1290, 212, DEFAULT, "xmx"); +ROLLBACK; +SELECT c FROM t; +c +NULL +13 +29 +SELECT * FROM t; +a b c h +10 3 13 mm +28 1 29 mm +NULL NULL NULL mm +DROP TABLE t; +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10), j INT, m INT GENERATED ALWAYS AS(b + j), n VARCHAR(10), p VARCHAR(20) GENERATED ALWAYS AS(CONCAT(n, h)), INDEX idx1(c), INDEX idx2 (m), INDEX idx3(p)); +INSERT INTO t VALUES(11, 22, DEFAULT, "AAA", 8, DEFAULT, "XXX", DEFAULT); +INSERT INTO t VALUES(1, 2, DEFAULT, "uuu", 9, DEFAULT, "uu", DEFAULT); +INSERT INTO t VALUES(3, 4, DEFAULT, "uooo", 1, DEFAULT, "umm", DEFAULT); +SELECT c FROM t; +c +3 +7 +33 +SELECT m FROM t; +m +5 +11 +30 +SELECT p FROM t; +p +ummuooo +uuuuu +XXXAAA +SELECT * FROM t; +a b c h j m n p +11 22 33 AAA 8 30 XXX XXXAAA +1 2 3 uuu 9 11 uu uuuuu +3 4 7 uooo 1 5 umm ummuooo +update t set a = 13 where a =11; +delete from t where a =13; +DROP INDEX idx1 ON t; +DROP INDEX idx2 ON t; +DROP TABLE t; +/* Test large BLOB data */ +CREATE TABLE `t` ( +`a` BLOB, +`b` BLOB, +`c` BLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, +`h` VARCHAR(10) DEFAULT NULL +) ENGINE=InnoDB; +INSERT INTO t VALUES (REPEAT('g', 16000), REPEAT('x', 16000), DEFAULT, "kk"); +CREATE INDEX idx ON t(c(100)); +SELECT length(c) FROM t; +length(c) +32000 +START TRANSACTION; +INSERT INTO t VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, 'mm'); +ROLLBACK; +INSERT INTO t VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, 'mm'); +START TRANSACTION; +UPDATE t SET a = REPEAT('m', 16000) WHERE a like "aaa%"; +ROLLBACK; +SELECT COUNT(*) FROM t WHERE c like "aaa%"; +COUNT(*) +1 +DROP TABLE t; +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); +INSERT INTO t VALUES (11, 3, DEFAULT, 'mm'); +INSERT INTO t VALUES (18, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (28, 1, DEFAULT, 'mm'); +CREATE INDEX idx ON t(c); +START TRANSACTION; +UPDATE t SET a = 100 WHERE a = 11; +UPDATE t SET a =22 WHERE a = 18; +UPDATE t SET a = 33 WHERE a = 22; +SELECT c FROM t; +c +29 +34 +103 +ROLLBACK; +SELECT c FROM t; +c +14 +19 +29 +DROP TABLE t; +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); +INSERT INTO t VALUES (11, 3, DEFAULT, 'mm'); +INSERT INTO t VALUES (18, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (28, 1, DEFAULT, 'mm'); +CREATE INDEX idx ON t(c); +SELECT c FROM t; +c +14 +19 +29 +connect con1,localhost,root,,test; +START TRANSACTION; +SELECT c FROM t; +c +14 +19 +29 +connection default; +UPDATE t SET a = 19 WHERE a = 11; +connection con1; +SELECT c FROM t; +c +14 +19 +29 +ROLLBACK; +SELECT c FROM t; +c +19 +22 +29 +connection default; +disconnect con1; +DROP TABLE t; +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10), j INT, m INT GENERATED ALWAYS AS(b + x), n VARCHAR(10), p VARCHAR(20) GENERATED ALWAYS AS(CONCAT(n, y)), x INT, y CHAR(20), z INT, INDEX idx1(c), INDEX idx2 (m), INDEX idx3(p)); +INSERT INTO t VALUES(1, 2, DEFAULT, "hhh", 3, DEFAULT, "nnn", DEFAULT, 4, "yyy", 5); +INSERT INTO t VALUES(2, 3, DEFAULT, "hhha", 4, DEFAULT, "nnna", DEFAULT, 5, "yyya", 6); +INSERT INTO t VALUES(12, 13, DEFAULT, "hhhb", 14, DEFAULT, "nnnb", DEFAULT, 15, "yyyb", 16); +CREATE INDEX idx6 ON t(p, c); +SELECT p, c FROM t; +p c +nnnayyya 5 +nnnbyyyb 25 +nnnyyy 3 +START TRANSACTION; +INSERT INTO t VALUES(32, 33, DEFAULT, "hhhb", 34, DEFAULT, "nnnb", DEFAULT, 35, "yyyb", 36); +ROLLBACK; +UPDATE t SET a = 100 WHERE a = 1; +START TRANSACTION; +UPDATE t SET a = 1 WHERE a = 100; +ROLLBACK; +DROP TABLE t; +CREATE TABLE t1(a INT); +ALTER TABLE t1 add COLUMN (b INT generated always as (a+1) virtual, c INT as(5) virtual); +ALTER TABLE t1 add COLUMN (d INT generated always as (a+1) virtual, e INT as(5) virtual); +SELECT pos, base_pos FROM informatiON_schema.innodb_sys_virtual; +pos base_pos +65537 0 +196611 0 +ALTER TABLE t1 add COLUMN (f INT generated always as (a+1) virtual, g INT as(5) virtual), DROP COLUMN e; +SELECT pos, base_pos FROM informatiON_schema.innodb_sys_virtual; +pos base_pos +65537 0 +196611 0 +262148 0 +DROP TABLE t1; +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(1); +ALTER TABLE t1 add COLUMN (f INT generated always as (a+1) virtual, g INT ); +ALTER TABLE t1 add COLUMN (h INT generated always as (a+1) virtual), add INDEX idx (h), algorithm=inplace; +ALTER TABLE t1 add COLUMN (h1 INT generated always as (a+1) virtual), add INDEX idx1 (h1); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 DROP COLUMN h1, DROP INDEX idx; +DROP TABLE t1; +CREATE TABLE t1(a INT); +CREATE INDEX idx ON t1(a); +CREATE TABLE t3(a INT, b INT , INDEX(b), CONSTRAINT x FOREIGN KEY(b) REFERENCES t1(a)); +CREATE TABLE t2(a INT, b INT generated always as (a+1) virtual, INDEX(b), CONSTRAINT x FOREIGN KEY(b) REFERENCES t1(a)); +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +CREATE TABLE t2(a INT, b INT generated always as (a+1) virtual, INDEX(b)); +DROP TABLE t3; +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1(a INT); +ALTER TABLE t1 add COLUMN (b INT generated always as (a+1) virtual, c INT as(5) virtual); +ALTER TABLE t1 change b x INT generated always as (a+1) virtual; +SELECT pos, base_pos FROM informatiON_schema.innodb_sys_virtual; +pos base_pos +65537 0 +DROP TABLE t1; +CREATE TABLE t (a TEXT, b TEXT GENERATED ALWAYS AS (a), fulltext INDEX idx (b)); +ERROR HY000: This is not yet supported for generated columns +CREATE TABLE t (a TEXT, b TEXT GENERATED ALWAYS AS (a)); +ALTER TABLE t ADD FULLTEXT INDEX (b); +ERROR HY000: This is not yet supported for generated columns +DROP TABLE t; +CREATE TABLE t (a geometry not null, b geometry GENERATED ALWAYS AS (a), spatial INDEX idx (b)); +ERROR 42000: All parts of a SPATIAL index must be NOT NULL +CREATE TABLE t (a geometry not null, b geometry GENERATED ALWAYS AS (a)); +ALTER TABLE t ADD SPATIAL INDEX (b); +ERROR 42000: All parts of a SPATIAL index must be NOT NULL +DROP TABLE t; +CREATE TABLE t (a INT DEFAULT 1, b INT DEFAULT 2, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); +CREATE INDEX idx ON t(c); +INSERT INTO t(h)VALUES ('mm'); +SELECT c FROM t; +c +3 +CREATE unique INDEX idx1 ON t(c); +INSERT INTO t(h)VALUES ('mm'); +ERROR 23000: Duplicate entry '3' for key 'idx1' +DROP TABLE t; +CREATE TABLE `t1` ( `a` INT(11) DEFAULT NULL, `b` INT(11) DEFAULT NULL, `c` INT(11) GENERATED ALWAYS AS (a+b) VIRTUAL, `x` INT(11) NOT NULL, `h` VARCHAR(10) DEFAULT NULL, PRIMARY KEY (`x`), KEY `idx` (`c`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1, 2, DEFAULT, 3, 'mm'); +INSERT INTO t1 VALUES (11, 22, DEFAULT, 23, 'mm'); +connect con1,localhost,root,,test; +UPDATE t1 SET x = 4 WHERE x =3; +DROP TABLE t1; +CREATE TABLE `t1` ( `a` INT(11) DEFAULT NULL, `b` INT(11) DEFAULT NULL, `c` INT(11) GENERATED ALWAYS AS (a+b) VIRTUAL, `x` INT(11) NOT NULL, `h` VARCHAR(10) DEFAULT NULL, KEY `idx` (`c`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1, 2, DEFAULT, 3, 'mm'); +INSERT INTO t1 VALUES (11, 22, DEFAULT, 23, 'mm'); +START TRANSACTION; +SELECT * FROM t1; +a b c x h +1 2 3 3 mm +11 22 33 23 mm +connection con1; +START TRANSACTION; +UPDATE t1 SET x = 15 WHERE x = 3; +UPDATE t1 SET b = 10 WHERE b=2; +ROLLBACK; +connection default; +SELECT c FROM t1; +c +3 +33 +disconnect con1; +DROP TABLE t1; +CREATE TABLE `t` ( +`a` INT(11) DEFAULT NULL, +`b` INT(11) DEFAULT NULL, +`c` INT(11) GENERATED ALWAYS AS (a+b) VIRTUAL, +`d` INT(11) GENERATED ALWAYS AS (a) VIRTUAL, +`h` INT(11) NOT NULL, +PRIMARY KEY (`h`), +KEY `idx` (`c`) +) ENGINE=InnoDB; +INSERT INTO t VALUES (11, 3, DEFAULT, DEFAULT, 1); +INSERT INTO t VALUES (18, 1, DEFAULT, DEFAULT, 2); +INSERT INTO t VALUES (28, 1, DEFAULT, DEFAULT, 3); +INSERT INTO t VALUES (null, null, DEFAULT, DEFAULT, 4); +CREATE PROCEDURE UPDATE_t() +begin +DECLARE i INT DEFAULT 1; +WHILE (i <= 2000) DO +UPDATE t SET a = 100 + i WHERE h = 1; +SET i = i + 1; +END WHILE; +END| +CREATE PROCEDURE DELETE_insert_t() +begin +DECLARE i INT DEFAULT 1; +WHILE (i <= 2000) DO +UPDATE t SET a = 100 + i WHERE h = 1; +SET i = i + 1; +END WHILE; +END| +CALL UPDATE_t(); +SELECT c FROM t; +c +NULL +19 +29 +2103 +CALL DELETE_insert_t(); +SELECT c FROM t; +c +NULL +19 +29 +2103 +DROP INDEX idx ON t; +CALL UPDATE_t(); +SELECT c FROM t; +c +2103 +19 +29 +NULL +DROP PROCEDURE DELETE_insert_t; +DROP PROCEDURE UPDATE_t; +DROP TABLE t; +# Bug#20767937: WL8149:ASSERTION FAILED IN ROW_UPD_SEC_INDEX_ENTRY +CREATE TABLE b ( +col_INT_nokey INTEGER NOT NULL, +col_INT_key INTEGER GENERATED ALWAYS AS (col_INT_nokey) VIRTUAL, +col_date_nokey DATE, +col_date_key DATE GENERATED ALWAYS AS (DATE_ADD(col_date_nokey, +INTerval 30 day)) VIRTUAL, +col_datetime_nokey DATETIME NOT NULL, +col_time_nokey TIME NOT NULL, +col_datetime_key DATETIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, +col_time_nokey)), +col_time_key TIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, +col_time_nokey)), +col_VARCHAR_nokey VARCHAR(1) NOT NULL, +col_VARCHAR_key VARCHAR(2) GENERATED ALWAYS AS(CONCAT(col_VARCHAR_nokey, +col_VARCHAR_nokey)), +KEY (col_INT_key), +KEY (col_VARCHAR_key), +KEY (col_date_key), +KEY (col_time_key), +KEY (col_datetime_key), +KEY (col_INT_key, col_VARCHAR_key), +KEY (col_INT_key, col_VARCHAR_key, col_date_key, +col_time_key, col_datetime_key) +); +INSERT INTO b ( +col_INT_nokey, +col_date_nokey, +col_time_nokey, +col_datetime_nokey, +col_VARCHAR_nokey +) VALUES +(0, NULL, '21:22:34.025509', '2002-02-13 17:30:06.013935', 'j'), +(8, '2004-09-18', '10:50:38.059966', '2008-09-27 +00:34:58.026613', 'v'); +Warnings: +Note 1265 Data truncated for column 'col_time_key' at row 1 +Note 1265 Data truncated for column 'col_time_key' at row 2 +EXPLAIN SELECT col_INT_key FROM b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE b index NULL col_INT_key 5 NULL 2 Using index +SELECT col_INT_key FROM b; +col_INT_key +0 +8 +SELECT col_INT_nokey, col_INT_key FROM b; +col_INT_nokey col_INT_key +0 0 +8 8 +DELETE FROM b; +DROP TABLE b; +CREATE TABLE `t` ( +`a` VARCHAR(10000), `b` VARCHAR(3000), +`c` VARCHAR(14000) GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, +`d` VARCHAR(5000) GENERATED ALWAYS AS (b) VIRTUAL, +`e` INT(11) GENERATED ALWAYS AS (10) VIRTUAL, +`h` INT(11) NOT NULL, +PRIMARY KEY (`h`) ) ROW_FORMAT=COMPACT ENGINE=InnoDB; +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` varchar(10000) DEFAULT NULL, + `b` varchar(3000) DEFAULT NULL, + `c` varchar(14000) GENERATED ALWAYS AS (concat(`a`,`b`)) VIRTUAL, + `d` varchar(5000) GENERATED ALWAYS AS (`b`) VIRTUAL, + `e` int(11) GENERATED ALWAYS AS (10) VIRTUAL, + `h` int(11) NOT NULL, + PRIMARY KEY (`h`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +INSERT INTO t VALUES (REPEAT('g', 10000), REPEAT('x', 2800), DEFAULT, DEFAULT, DEFAULT, 1); +INSERT INTO t VALUES (REPEAT('a', 9000), REPEAT('b', 2000), DEFAULT, DEFAULT, DEFAULT, 2); +INSERT INTO t VALUES (REPEAT('m', 8000), REPEAT('n', 3000), DEFAULT, DEFAULT, DEFAULT, 3); +CREATE INDEX idx ON t(c(100), d(20)); +UPDATE t SET a = REPEAT(CAST(1 AS CHAR), 2000) WHERE h = 1; +CREATE PROCEDURE UPDATE_t() +begin +DECLARE i INT DEFAULT 1; +WHILE (i <= 100) DO +UPDATE t SET a = REPEAT(CAST(i AS CHAR), 2000) WHERE h = 1; +SET i = i + 1; +END WHILE; +END| +CREATE PROCEDURE DELETE_insert_t() +begin +DECLARE i INT DEFAULT 1; +WHILE (i <= 100) DO +DELETE FROM t WHERE h = 1; +INSERT INTO t VALUES (REPEAT(CAST(i AS CHAR), 2000) , REPEAT('b', 2000), DEFAULT, DEFAULT, DEFAULT, 1); +SET i = i + 1; +END WHILE; +END| +CALL UPDATE_t(); +CALL DELETE_insert_t(); +UPDATE t SET a = NULL WHERE h=1; +START TRANSACTION; +CALL UPDATE_t(); +ROLLBACK; +DROP PROCEDURE DELETE_insert_t; +DROP PROCEDURE UPDATE_t; +DROP TABLE t; +CREATE TABLE `t` ( +`a` BLOB, +`b` BLOB, +`c` BLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, +`d` BLOB GENERATED ALWAYS AS (b) VIRTUAL, +`e` INT(11) GENERATED ALWAYS AS (10) VIRTUAL, +`h` INT(11) NOT NULL, +PRIMARY KEY (`h`) +) ENGINE=InnoDB; +INSERT INTO t VALUES (REPEAT('g', 16000), REPEAT('x', 16000), DEFAULT, DEFAULT, DEFAULT, 1); +INSERT INTO t VALUES (REPEAT('a', 32000), REPEAT('b', 11000), DEFAULT, DEFAULT, DEFAULT, 2); +INSERT INTO t VALUES (REPEAT('m', 18000), REPEAT('n', 46000), DEFAULT, DEFAULT, DEFAULT, 3); +CREATE INDEX idx ON t(c(100), d(20)); +UPDATE t SET a = NULL WHERE h=1; +UPDATE t SET a = REPEAT(CAST(1 AS CHAR), 2000) WHERE h = 1; +UPDATE t SET a = REPEAT(CAST(1 AS CHAR), 1000) WHERE h = 1; +CREATE PROCEDURE UPDATE_t() +begin +DECLARE i INT DEFAULT 1; +WHILE (i <= 200) DO +UPDATE t SET a = REPEAT(CAST(i AS CHAR), 2000) WHERE h = 1; +SET i = i + 1; +END WHILE; +END| +CREATE PROCEDURE DELETE_insert_t() +begin +DECLARE i INT DEFAULT 1; +WHILE (i <= 200) DO +DELETE FROM t WHERE h = 1; +INSERT INTO t VALUES (REPEAT(CAST(i AS CHAR), 2000) , REPEAT('b', 2000), DEFAULT, DEFAULT, DEFAULT, 1); +SET i = i + 1; +END WHILE; +END| +CALL UPDATE_t(); +CALL DELETE_insert_t(); +UPDATE t SET a = NULL WHERE h=1; +DROP PROCEDURE DELETE_insert_t; +DROP PROCEDURE UPDATE_t; +DROP TABLE t; +CREATE TABLE `t` ( +`m1` INT(11) DEFAULT NULL, +`m2` INT(11) DEFAULT NULL, +`m3` INT(11) GENERATED ALWAYS AS (m1 + m2) VIRTUAL, +`m4` INT(11) DEFAULT NULL, +`m5` CHAR(10) DEFAULT NULL, +`m6` CHAR(12) GENERATED ALWAYS AS (m5) VIRTUAL, +`a` VARCHAR(10000) DEFAULT NULL, +`b` VARCHAR(3000) DEFAULT NULL, +`c` VARCHAR(14000) GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, +`d` VARCHAR(5000) GENERATED ALWAYS AS (b) VIRTUAL, +`e` INT(11) GENERATED ALWAYS AS (10) VIRTUAL, +`h` INT(11) NOT NULL, +PRIMARY KEY (`h`), +KEY `m3` (`m3`), +KEY `c` (`c`(100)), +KEY `e` (`e`,`d`(20)) +) ENGINE=InnoDB; +INSERT INTO t VALUES (1, 2, DEFAULT, 3, "aaa", DEFAULT, REPEAT('g', 10000), REPEAT('x', 2800), DEFAULT, DEFAULT, DEFAULT, 1); +INSERT INTO t VALUES (11, 21, DEFAULT, 31, "bbb", DEFAULT, REPEAT('a', 9000), REPEAT('b', 2000), DEFAULT, DEFAULT, DEFAULT, 2); +INSERT INTO t VALUES (21, 31, DEFAULT, 41, "zzz", DEFAULT, REPEAT('m', 8000), REPEAT('n', 3000), DEFAULT, DEFAULT, DEFAULT, 3); +ALTER TABLE t DROP COLUMN c; +DELETE FROM t; +DROP TABLE t; +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); +INSERT INTO t VALUES (11, 3, DEFAULT, 'mm'); +INSERT INTO t VALUES (18, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (28, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (null, null, DEFAULT, 'mm'); +CREATE INDEX idx ON t(a, c); +SELECT a, c FROM t; +a c +NULL NULL +11 14 +18 19 +28 29 +START TRANSACTION; +UPDATE t SET a = 13 where a = 11; +ROLLBACK; +DELETE FROM t; +DROP TABLE t; +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10), m int); +INSERT INTO t VALUES (11, 3, DEFAULT, "a", 1); +INSERT INTO t VALUES (18, 1, DEFAULT, "b", 2); +INSERT INTO t VALUES (28, 1, DEFAULT, "c", 3 ); +INSERT INTO t VALUES (null, null, DEFAULT, "d", 4); +CREATE INDEX idx ON t(a, c, h); +SELECT a, c FROM t; +a c +NULL NULL +11 14 +18 19 +28 29 +START TRANSACTION; +UPDATE t SET m =10 WHERE m = 1; +UPDATE t SET h = "e" WHERE h="a"; +ROLLBACK; +SELECT a, c, h FROM t; +a c h +NULL NULL d +11 14 a +18 19 b +28 29 c +DROP TABLE t; +CREATE TABLE `t1` ( +`col1` int(11) NOT NULL, +`col2` int(11) NOT NULL, +`col3` int(11) NOT NULL, +`col4` int(11) DEFAULT NULL, +`col5` int(11) GENERATED ALWAYS AS (col2 % col3) VIRTUAL, +`col7` int(11) GENERATED ALWAYS AS (col5 * col5) VIRTUAL, +`col8` int(11) GENERATED ALWAYS AS (col5 % col5) VIRTUAL, +`col9` text, +`extra` int(11) DEFAULT NULL, +UNIQUE KEY `uidx` (`col5`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +ALTER TABLE t1 CHANGE COLUMN extra col6 INT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `col1` int(11) NOT NULL, + `col2` int(11) NOT NULL, + `col3` int(11) NOT NULL, + `col4` int(11) DEFAULT NULL, + `col5` int(11) GENERATED ALWAYS AS (`col2` % `col3`) VIRTUAL, + `col7` int(11) GENERATED ALWAYS AS (`col5` * `col5`) VIRTUAL, + `col8` int(11) GENERATED ALWAYS AS (`col5` % `col5`) VIRTUAL, + `col9` text DEFAULT NULL, + `col6` int(11) DEFAULT NULL, + UNIQUE KEY `uidx` (`col5`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t (a INT, b INT GENERATED ALWAYS AS (a), c point, d point GENERATED ALWAYS AS (c), spatial index idx (d)); +ERROR 42000: All parts of a SPATIAL index must be NOT NULL +CREATE TABLE t (a INT, b INT GENERATED ALWAYS AS (a), c CHAR(10), d char(20) GENERATED ALWAYS AS (c), fulltext index idx (d)); +ERROR HY000: This is not yet supported for generated columns +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10), j INT, m INT GENERATED ALWAYS AS(b + j), n VARCHAR(10), p VARCHAR(20) GENERATED ALWAYS AS(CONCAT(n, h)), INDEX idx1(c), INDEX idx2 (m), INDEX idx3(p)); +INSERT INTO t VALUES(11, 22, DEFAULT, "AAA", 8, DEFAULT, "XXX", DEFAULT); +INSERT INTO t VALUES(1, 2, DEFAULT, "uuu", 9, DEFAULT, "uu", DEFAULT); +INSERT INTO t VALUES(3, 4, DEFAULT, "uooo", 1, DEFAULT, "umm", DEFAULT); +alter table t add x int, add xx int generated ALWAYS AS(x); +DROP TABLE t; +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10), j INT, m INT GENERATED ALWAYS AS(b + j), n VARCHAR(10), p VARCHAR(20) GENERATED ALWAYS AS(CONCAT(n, h)), INDEX idx1(c), INDEX idx2 (m), INDEX idx3(p)); +INSERT INTO t VALUES(11, 22, DEFAULT, "AAA", 8, DEFAULT, "XXX", DEFAULT); +INSERT INTO t VALUES(1, 2, DEFAULT, "uuu", 9, DEFAULT, "uu", DEFAULT); +INSERT INTO t VALUES(3, 4, DEFAULT, "uooo", 1, DEFAULT, "umm", DEFAULT); +ALTER TABLE t DROP COLUMN c, algorithm=inplace; +ALTER TABLE t DROP COLUMN p, ADD COLUMN s VARCHAR(20) GENERATED ALWAYS AS(CONCAT(n, h)), algorithm=inplace; +SELECT s FROM t; +s +XXXAAA +uuuuu +ummuooo +ALTER TABLE t ADD x VARCHAR(20) GENERATED ALWAYS AS(CONCAT(n, h)), ADD INDEX idx (x), algorithm=inplace; +DROP TABLE t; +CREATE TABLE `t1` ( +`col1` int(11) DEFAULT NULL, +`col2` int(11) DEFAULT NULL, +`col3` int(11) DEFAULT NULL, +`col4` int(11) DEFAULT NULL, +`col5` int(11) GENERATED ALWAYS AS (col4 * col2) VIRTUAL, +`col6` int(11) GENERATED ALWAYS AS (col2 % col4) VIRTUAL, +`col7` int(11) GENERATED ALWAYS AS (col5 / col6) VIRTUAL, +`col8` int(11) GENERATED ALWAYS AS (col5 + col5) VIRTUAL, +`col9` text, +`extra` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +ALTER TABLE t1 DROP COLUMN col7; +DROP TABLE t1; +CREATE TABLE t1 ( +col1 INTEGER NOT NULL, +gv_col INTEGER GENERATED ALWAYS AS (col1) VIRTUAL, +txt1 TEXT, +FULLTEXT INDEX fi(txt1) +); +select * from t1; +col1 gv_col txt1 +DROP TABLE t1; +CREATE TABLE t1 ( +col1 INTEGER NOT NULL, +col2 INTEGER NOT NULL, +col3 INTEGER DEFAULT NULL, +col4 INTEGER DEFAULT NULL, +col5 INTEGER DEFAULT NULL, +col6 INTEGER DEFAULT NULL, +col7 INTEGER DEFAULT NULL, +col8 INTEGER DEFAULT NULL, +col9 INTEGER DEFAULT NULL, +col10 INTEGER DEFAULT NULL, +col11 INTEGER DEFAULT NULL, +col12 INTEGER DEFAULT NULL, +col13 INTEGER DEFAULT NULL, +col14 INTEGER DEFAULT NULL, +col15 INTEGER DEFAULT NULL, +col16 INTEGER DEFAULT NULL, +col17 INTEGER DEFAULT NULL, +col18 INTEGER DEFAULT NULL, +col19 INTEGER DEFAULT NULL, +col20 INTEGER DEFAULT NULL, +col21 INTEGER DEFAULT NULL, +col22 INTEGER DEFAULT NULL, +col23 INTEGER DEFAULT NULL, +col24 INTEGER DEFAULT NULL, +col25 INTEGER DEFAULT NULL, +col26 INTEGER DEFAULT NULL, +col27 INTEGER DEFAULT NULL, +col28 INTEGER DEFAULT NULL, +col29 INTEGER DEFAULT NULL, +col30 INTEGER DEFAULT NULL, +col31 INTEGER DEFAULT NULL, +col32 INTEGER DEFAULT NULL, +col33 INTEGER DEFAULT NULL, +gcol1 INTEGER GENERATED ALWAYS AS (col1 + col2) VIRTUAL, +KEY idx1 (gcol1) +); +INSERT INTO t1 (col1, col2) +VALUES (0,1), (1,2), (2,3), (3,4), (4,5); +SELECT gcol1 FROM t1 FORCE INDEX(idx1); +gcol1 +1 +3 +5 +7 +9 +ALTER TABLE t1 ADD COLUMN extra INTEGER; +SELECT gcol1 FROM t1 FORCE INDEX(idx1); +gcol1 +1 +3 +5 +7 +9 +DROP TABLE t1; +CREATE TABLE t1 ( +id INT NOT NULL, +store_id INT NOT NULL, +x INT GENERATED ALWAYS AS (id + store_id) +) +PARTITION BY RANGE (store_id) ( +PARTITION p0 VALUES LESS THAN (6), +PARTITION p1 VALUES LESS THAN (11), +PARTITION p2 VALUES LESS THAN (16), +PARTITION p3 VALUES LESS THAN (21) +); +INSERT INTO t1 VALUES(1, 2, default); +INSERT INTO t1 VALUES(3, 4, default); +INSERT INTO t1 VALUES(3, 12, default); +INSERT INTO t1 VALUES(4, 18, default); +CREATE INDEX idx ON t1(x); +SELECT x FROM t1; +x +3 +7 +15 +22 +DROP TABLE t1; +CREATE TABLE t1 ( +id INT NOT NULL, +store_id INT NOT NULL, +x INT GENERATED ALWAYS AS (id + store_id) +) +PARTITION BY RANGE (x) ( +PARTITION p0 VALUES LESS THAN (6), +PARTITION p1 VALUES LESS THAN (11), +PARTITION p2 VALUES LESS THAN (16), +PARTITION p3 VALUES LESS THAN (21) +); +insert into t1 values(1, 2, default); +insert into t1 values(3, 4, default); +insert into t1 values(3, 12, default); +insert into t1 values(4, 18, default); +ERROR HY000: Table has no partition for value 22 +CREATE INDEX idx ON t1(x); +SELECT x FROM t1; +x +3 +7 +15 +DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT GENERATED ALWAYS AS (a+1) ,c int) PARTITION BY RANGE (b) ( +PARTITION p0 VALUES LESS THAN (6), +PARTITION p1 VALUES LESS THAN (11), +PARTITION p2 VALUES LESS THAN (16), +PARTITION p3 VALUES LESS THAN (21) ); +INSERT INTO t1 VALUES (10,DEFAULT,2); +INSERT INTO t1 VALUES (19,DEFAULT,8); +CREATE INDEX idx ON t1 (b); +INSERT INTO t1 VALUES (5,DEFAULT,9); +SELECT * FROM t1; +a b c +5 6 9 +10 11 2 +19 20 8 +ALTER TABLE t1 REMOVE PARTITIONING; +DROP TABLE t1; +CREATE TABLE `t#P#1` (a INT, bt INT GENERATED ALWAYS AS (a+1) ,c int) +PARTITION BY RANGE (bt) +subpartition by hash (bt) +( +PARTITION p0 VALUES LESS THAN (6) ( +SUBPARTITION s0, +SUBPARTITION s1), +PARTITION p1 VALUES LESS THAN (11) ( +SUBPARTITION s2, +SUBPARTITION s3), +PARTITION p2 VALUES LESS THAN (16) ( +SUBPARTITION s4, +SUBPARTITION s5), +PARTITION p3 VALUES LESS THAN (21) ( +SUBPARTITION s6, +SUBPARTITION s7) +); +insert into `t#P#1` values (10,DEFAULT,2); +insert into `t#P#1` values (19,DEFAULT,8); +create index idx on `t#P#1` (bt); +insert into `t#P#1` values (5,DEFAULT,9); +select * from `t#P#1`; +a bt c +5 6 9 +10 11 2 +19 20 8 +alter table `t#P#1` remove partitioning; +drop table `t#P#1`; +CREATE TABLE `t` ( +`a` VARCHAR(10000), `b` VARCHAR(3000), +`c` VARCHAR(14000) GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, +`d` VARCHAR(5000) GENERATED ALWAYS AS (b) VIRTUAL, +`e` INT(11) GENERATED ALWAYS AS (10) VIRTUAL, +`h` INT(11) NOT NULL, +PRIMARY KEY (`h`) ) ROW_FORMAT=DYNAMIC ENGINE=InnoDB; +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` varchar(10000) DEFAULT NULL, + `b` varchar(3000) DEFAULT NULL, + `c` varchar(14000) GENERATED ALWAYS AS (concat(`a`,`b`)) VIRTUAL, + `d` varchar(5000) GENERATED ALWAYS AS (`b`) VIRTUAL, + `e` int(11) GENERATED ALWAYS AS (10) VIRTUAL, + `h` int(11) NOT NULL, + PRIMARY KEY (`h`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +INSERT INTO t VALUES (REPEAT('g', 10000), REPEAT('x', 2800), DEFAULT, DEFAULT, DEFAULT, 1); +INSERT INTO t VALUES (REPEAT('a', 9000), REPEAT('b', 2000), DEFAULT, DEFAULT, DEFAULT, 2); +INSERT INTO t VALUES (REPEAT('m', 8000), REPEAT('n', 3000), DEFAULT, DEFAULT, DEFAULT, 3); +CREATE INDEX idx ON t(c(100), d(20)); +UPDATE t SET a = REPEAT(CAST(1 AS CHAR), 2000) WHERE h = 1; +CREATE PROCEDURE UPDATE_t() +begin +DECLARE i INT DEFAULT 1; +WHILE (i <= 100) DO +UPDATE t SET a = REPEAT(CAST(i AS CHAR), 2000) WHERE h = 1; +SET i = i + 1; +END WHILE; +END| +CREATE PROCEDURE DELETE_insert_t() +begin +DECLARE i INT DEFAULT 1; +WHILE (i <= 100) DO +DELETE FROM t WHERE h = 1; +INSERT INTO t VALUES (REPEAT(CAST(i AS CHAR), 2000) , REPEAT('b', 2000), DEFAULT, DEFAULT, DEFAULT, 1); +SET i = i + 1; +END WHILE; +END| +CALL UPDATE_t(); +CALL DELETE_insert_t(); +UPDATE t SET a = NULL WHERE h=1; +START TRANSACTION; +CALL UPDATE_t(); +ROLLBACK; +DROP PROCEDURE DELETE_insert_t; +DROP PROCEDURE UPDATE_t; +DROP TABLE t; +CREATE TABLE `t` ( +`a` VARCHAR(10000), `b` VARCHAR(3000), +`c` VARCHAR(14000) GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, +`d` VARCHAR(5000) GENERATED ALWAYS AS (b) VIRTUAL, +`e` INT(11) GENERATED ALWAYS AS (10) VIRTUAL, +`h` INT(11) NOT NULL, +PRIMARY KEY (`h`) ) ROW_FORMAT=REDUNDANT ENGINE=InnoDB; +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` varchar(10000) DEFAULT NULL, + `b` varchar(3000) DEFAULT NULL, + `c` varchar(14000) GENERATED ALWAYS AS (concat(`a`,`b`)) VIRTUAL, + `d` varchar(5000) GENERATED ALWAYS AS (`b`) VIRTUAL, + `e` int(11) GENERATED ALWAYS AS (10) VIRTUAL, + `h` int(11) NOT NULL, + PRIMARY KEY (`h`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +INSERT INTO t VALUES (REPEAT('g', 10000), REPEAT('x', 2800), DEFAULT, DEFAULT, DEFAULT, 1); +INSERT INTO t VALUES (REPEAT('a', 9000), REPEAT('b', 2000), DEFAULT, DEFAULT, DEFAULT, 2); +INSERT INTO t VALUES (REPEAT('m', 8000), REPEAT('n', 3000), DEFAULT, DEFAULT, DEFAULT, 3); +CREATE INDEX idx ON t(c(100), d(20)); +UPDATE t SET a = REPEAT(CAST(1 AS CHAR), 2000) WHERE h = 1; +CREATE PROCEDURE UPDATE_t() +begin +DECLARE i INT DEFAULT 1; +WHILE (i <= 100) DO +UPDATE t SET a = REPEAT(CAST(i AS CHAR), 2000) WHERE h = 1; +SET i = i + 1; +END WHILE; +END| +CREATE PROCEDURE DELETE_insert_t() +begin +DECLARE i INT DEFAULT 1; +WHILE (i <= 100) DO +DELETE FROM t WHERE h = 1; +INSERT INTO t VALUES (REPEAT(CAST(i AS CHAR), 2000) , REPEAT('b', 2000), DEFAULT, DEFAULT, DEFAULT, 1); +SET i = i + 1; +END WHILE; +END| +CALL UPDATE_t(); +CALL DELETE_insert_t(); +UPDATE t SET a = NULL WHERE h=1; +START TRANSACTION; +CALL UPDATE_t(); +ROLLBACK; +DROP PROCEDURE DELETE_insert_t; +DROP PROCEDURE UPDATE_t; +DROP TABLE t; +CREATE TABLE `t` ( +`a` VARCHAR(10000), `b` VARCHAR(3000), +`c` VARCHAR(14000) GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, +`d` VARCHAR(5000) GENERATED ALWAYS AS (b) VIRTUAL, +`e` INT(11) GENERATED ALWAYS AS (10) VIRTUAL, +`h` INT(11) NOT NULL, +PRIMARY KEY (`h`) ) ROW_FORMAT=COMPRESSED ENGINE=InnoDB; +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` varchar(10000) DEFAULT NULL, + `b` varchar(3000) DEFAULT NULL, + `c` varchar(14000) GENERATED ALWAYS AS (concat(`a`,`b`)) VIRTUAL, + `d` varchar(5000) GENERATED ALWAYS AS (`b`) VIRTUAL, + `e` int(11) GENERATED ALWAYS AS (10) VIRTUAL, + `h` int(11) NOT NULL, + PRIMARY KEY (`h`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +INSERT INTO t VALUES (REPEAT('g', 10000), REPEAT('x', 2800), DEFAULT, DEFAULT, DEFAULT, 1); +INSERT INTO t VALUES (REPEAT('a', 9000), REPEAT('b', 2000), DEFAULT, DEFAULT, DEFAULT, 2); +INSERT INTO t VALUES (REPEAT('m', 8000), REPEAT('n', 3000), DEFAULT, DEFAULT, DEFAULT, 3); +CREATE INDEX idx ON t(c(100), d(20)); +UPDATE t SET a = REPEAT(CAST(1 AS CHAR), 2000) WHERE h = 1; +CREATE PROCEDURE UPDATE_t() +begin +DECLARE i INT DEFAULT 1; +WHILE (i <= 100) DO +UPDATE t SET a = REPEAT(CAST(i AS CHAR), 2000) WHERE h = 1; +SET i = i + 1; +END WHILE; +END| +CREATE PROCEDURE DELETE_insert_t() +begin +DECLARE i INT DEFAULT 1; +WHILE (i <= 100) DO +DELETE FROM t WHERE h = 1; +INSERT INTO t VALUES (REPEAT(CAST(i AS CHAR), 2000) , REPEAT('b', 2000), DEFAULT, DEFAULT, DEFAULT, 1); +SET i = i + 1; +END WHILE; +END| +CALL UPDATE_t(); +CALL DELETE_insert_t(); +UPDATE t SET a = NULL WHERE h=1; +START TRANSACTION; +CALL UPDATE_t(); +ROLLBACK; +DROP PROCEDURE DELETE_insert_t; +DROP PROCEDURE UPDATE_t; +DROP TABLE t; +CREATE TABLE t(a TEXT CHARSET UTF8)ENGINE=INNODB; +ALTER TABLE t ADD COLUMN b BLOB GENERATED ALWAYS AS (a) VIRTUAL ; +ALTER TABLE t ADD FULLTEXT INDEX (a) ; +Warnings: +Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID +ALTER TABLE t ADD INDEX (b(1)) ; +DROP TABLE t; +CREATE TABLE t(a TEXT CHARSET UTF8, FULLTEXT INDEX(a))ENGINE=INNODB; +ALTER TABLE t ADD COLUMN b BLOB GENERATED ALWAYS AS (a) VIRTUAL ; +ALTER TABLE t ADD INDEX (b(1)) ; +DROP TABLE t; +CREATE TABLE t(a TEXT CHARSET UTF8)ENGINE=INNODB; +ALTER TABLE t ADD COLUMN FTS_DOC_ID BLOB GENERATED ALWAYS AS (a) VIRTUAL ; +ALTER TABLE t ADD FULLTEXT INDEX (a) ; +ERROR HY000: Column 'FTS_DOC_ID' is of wrong type for an InnoDB FULLTEXT index +DROP TABLE t; +create table t (a int,b int,c int,d int,e int, +f int generated always as (a+b) virtual, +g int,h blob,i int,unique key (d,h(25))) engine=innodb; +select h from t where d is null; +h +drop table t; +create table t(a blob not null) engine=innodb; +alter table t add column b int; +alter table t add column c varbinary (1000) generated always as (a) virtual; +alter table t add unique index (c(39)); +replace into t set a = 'a',b =1; +replace into t set a = 'a',b =1; +drop table t; +CREATE TABLE t (a INT, b INT, h VARCHAR(10)); +INSERT INTO t VALUES (12, 3, "ss"); +INSERT INTO t VALUES (13, 4, "ss"); +INSERT INTO t VALUES (14, 0, "ss"); +alter table t add c INT GENERATED ALWAYS AS(a/b); +create index idx on t(c); +DROP TABLE t; +CREATE TABLE t ( +pk INTEGER AUTO_INCREMENT, +col_int_nokey INTEGER /*! NULL */, +col_int INT GENERATED ALWAYS AS (col_int_nokey + col_int_nokey) STORED, +col_int_key INTEGER GENERATED ALWAYS AS (col_int + col_int_nokey) VIRTUAL, +col_date_nokey DATE /*! NULL */, +col_date DATE GENERATED ALWAYS AS (DATE_ADD(col_date_nokey,interval 30 day)) STORED, +col_date_key DATE GENERATED ALWAYS AS (DATE_ADD(col_date,interval 30 day)) VIRTUAL, +col_datetime_nokey DATETIME /*! NULL */, +col_time_nokey TIME /*! NULL */, +col_datetime DATETIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)) STORED, +col_time TIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)) STORED, +col_datetime_key DATETIME GENERATED ALWAYS AS (ADDTIME(col_datetime, col_time_nokey)) VIRTUAL, +col_time_key TIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time)) VIRTUAL, +col_varchar_nokey VARCHAR(1) /*! NULL */, +col_varchar VARCHAR(2) GENERATED ALWAYS AS (CONCAT(col_varchar_nokey,col_varchar_nokey)) STORED, +col_varchar_key VARCHAR(2) GENERATED ALWAYS AS (CONCAT(col_varchar, 'x')) VIRTUAL, +unique KEY (pk,col_int_key), +KEY(col_int), +KEY(col_date), +KEY(col_datetime), +KEY(col_time), +KEY(col_varchar), +UNIQUE KEY (col_int_key), +KEY (col_time_key), +KEY (col_datetime_key), +UNIQUE KEY (col_int_key, col_varchar_key), +KEY (col_int_key, col_int_nokey), +KEY(col_int_key,col_date_key), +KEY(col_int_key, col_time_key), +KEY(col_int_key, col_datetime_key), +KEY(col_date_key,col_time_key,col_datetime_key), +KEY (col_varchar_key, col_varchar_nokey), +UNIQUE KEY (col_int_key, col_varchar_key, col_date_key, col_time_key, col_datetime_key) +) AUTO_INCREMENT=10 ENGINE=INNODB PARTITION BY KEY(col_int_key) PARTITIONS 3; +ALTER TABLE t DROP COLUMN `pk`; +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `col_int_nokey` int(11) DEFAULT NULL, + `col_int` int(11) GENERATED ALWAYS AS (`col_int_nokey` + `col_int_nokey`) STORED, + `col_int_key` int(11) GENERATED ALWAYS AS (`col_int` + `col_int_nokey`) VIRTUAL, + `col_date_nokey` date DEFAULT NULL, + `col_date` date GENERATED ALWAYS AS (`col_date_nokey` + interval 30 day) STORED, + `col_date_key` date GENERATED ALWAYS AS (`col_date` + interval 30 day) VIRTUAL, + `col_datetime_nokey` datetime DEFAULT NULL, + `col_time_nokey` time DEFAULT NULL, + `col_datetime` datetime GENERATED ALWAYS AS (addtime(`col_datetime_nokey`,`col_time_nokey`)) STORED, + `col_time` time GENERATED ALWAYS AS (addtime(`col_datetime_nokey`,`col_time_nokey`)) STORED, + `col_datetime_key` datetime GENERATED ALWAYS AS (addtime(`col_datetime`,`col_time_nokey`)) VIRTUAL, + `col_time_key` time GENERATED ALWAYS AS (addtime(`col_datetime_nokey`,`col_time`)) VIRTUAL, + `col_varchar_nokey` varchar(1) DEFAULT NULL, + `col_varchar` varchar(2) GENERATED ALWAYS AS (concat(`col_varchar_nokey`,`col_varchar_nokey`)) STORED, + `col_varchar_key` varchar(2) GENERATED ALWAYS AS (concat(`col_varchar`,'x')) VIRTUAL, + UNIQUE KEY `pk` (`col_int_key`), + UNIQUE KEY `col_int_key` (`col_int_key`), + UNIQUE KEY `col_int_key_2` (`col_int_key`,`col_varchar_key`), + UNIQUE KEY `col_int_key_7` (`col_int_key`,`col_varchar_key`,`col_date_key`,`col_time_key`,`col_datetime_key`), + KEY `col_int` (`col_int`), + KEY `col_date` (`col_date`), + KEY `col_datetime` (`col_datetime`), + KEY `col_time` (`col_time`), + KEY `col_varchar` (`col_varchar`), + KEY `col_time_key` (`col_time_key`), + KEY `col_datetime_key` (`col_datetime_key`), + KEY `col_int_key_3` (`col_int_key`,`col_int_nokey`), + KEY `col_int_key_4` (`col_int_key`,`col_date_key`), + KEY `col_int_key_5` (`col_int_key`,`col_time_key`), + KEY `col_int_key_6` (`col_int_key`,`col_datetime_key`), + KEY `col_date_key` (`col_date_key`,`col_time_key`,`col_datetime_key`), + KEY `col_varchar_key` (`col_varchar_key`,`col_varchar_nokey`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 + PARTITION BY KEY (col_int_key) +PARTITIONS 3 +DROP TABLE t; +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); +INSERT INTO t VALUES (11, 3, DEFAULT, 'mm'); +INSERT INTO t VALUES (18, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (28, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (null, null, DEFAULT, 'mm'); +ALTER TABLE t ADD COLUMN xs INT GENERATED ALWAYS AS(a+b), ADD COLUMN mm INT +GENERATED ALWAYS AS(a+b) STORED, ALGORITHM = INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY +ALTER TABLE t ADD COLUMN x INT GENERATED ALWAYS AS(a+b), ALGORITHM = INPLACE; +ALTER TABLE t DROP COLUMN x, ALGORITHM = INPLACE; +ALTER TABLE t ADD COLUMN x1 INT GENERATED ALWAYS AS(a+b), DROP COLUMN c, +ALGORITHM = INPLACE; +DROP TABLE t; +CREATE TABLE t (a INT GENERATED ALWAYS AS(1) VIRTUAL,KEY(a)) ENGINE=INNODB; +INSERT INTO t VALUES(default); +SELECT a FROM t FOR UPDATE; +a +1 +DROP TABLE t; +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); +INSERT INTO t VALUES (11, 3, DEFAULT, 'mm'); +INSERT INTO t VALUES (18, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (28, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (null, null, DEFAULT, 'mm'); +ALTER TABLE t ADD COLUMN x INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (x); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT x FROM t; +x +NULL +14 +19 +29 +DROP TABLE t; +CREATE TABLE t1 (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); +INSERT INTO t1 VALUES (11, 3, DEFAULT, 'mm'); +INSERT INTO t1 VALUES (18, 1, DEFAULT, 'mm'); +INSERT INTO t1 VALUES (28, 1, DEFAULT, 'mm'); +ALTER TABLE t1 ADD INDEX idx12 (c) , FORCE, LOCK=NONE; +ALTER TABLE t1 DROP COLUMN h, ADD INDEX idx (c) , FORCE, LOCK=NONE; +Warnings: +Note 1831 Duplicate index `idx`. This is deprecated and will be disallowed in a future release +DROP TABLE t1 ; +CREATE TABLE t1 (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), d INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); +INSERT INTO t1 VALUES (11, 3, DEFAULT, DEFAULT, 'mm'); +INSERT INTO t1 VALUES (18, 1, DEFAULT, DEFAULT, 'mm'); +INSERT INTO t1 VALUES (28, 1, DEFAULT, DEFAULT, 'mm'); +ALTER TABLE t1 CHANGE d d INT GENERATED ALWAYS AS(a+b) FIRST, ALGORITHM = INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY +ALTER TABLE t1 CHANGE d d VARCHAR(10) GENERATED ALWAYS AS(h), ALGORITHM = INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY +ALTER TABLE t1 CHANGE d d INT GENERATED ALWAYS AS(a+b) FIRST; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d` int(11) GENERATED ALWAYS AS (`a` + `b`) VIRTUAL, + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (`a` + `b`) VIRTUAL, + `h` varchar(10) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE parent (id INT PRIMARY KEY) ENGINE=INNODB; +CREATE TABLE child ( +id INT, +parent_id INT, +x int(11) GENERATED ALWAYS AS (parent_id+1), +INDEX par_ind (parent_id), +FOREIGN KEY (parent_id) +REFERENCES parent(id) +ON DELETE CASCADE +) ENGINE=INNODB; +ALTER TABLE child ADD INDEX `i1` (x); +CREATE TABLE child_1 ( +id INT, +parent_id INT, +x int(11) GENERATED ALWAYS AS (parent_id+1), +INDEX par_ind (parent_id), +FOREIGN KEY (parent_id) +REFERENCES parent(id) +) ENGINE=INNODB; +ALTER TABLE child_1 ADD INDEX `i1` (x); +DROP TABLE child_1; +DROP TABLE child; +CREATE TABLE child ( +id INT, +parent_id INT, +x int(11) GENERATED ALWAYS AS (parent_id+1), +INDEX par_ind (parent_id), +INDEX i1 (x), +FOREIGN KEY (parent_id) +REFERENCES parent(id) +ON DELETE CASCADE +) ENGINE=INNODB; +DROP TABLE child; +CREATE TABLE child ( +id INT, +parent_id INT, +x int(11) GENERATED ALWAYS AS (parent_id+1), +INDEX par_ind (parent_id), +INDEX `i1` (x) +) ENGINE=INNODB; +ALTER TABLE child ADD FOREIGN KEY (parent_id) +REFERENCES parent(id) +ON DELETE CASCADE; +SET foreign_key_checks = 0; +ALTER TABLE child ADD FOREIGN KEY (parent_id) +REFERENCES parent(id) +ON DELETE CASCADE; +ALTER TABLE child ADD FOREIGN KEY (parent_id) +REFERENCES parent(id) +ON DELETE SET NULL; +ALTER TABLE child ADD FOREIGN KEY (parent_id) +REFERENCES parent(id) +ON UPDATE CASCADE; +ALTER TABLE child ADD FOREIGN KEY (parent_id) +REFERENCES parent(id); +SET foreign_key_checks = 1; +DROP TABLE child; +DROP TABLE parent; +CREATE TABLE `ibstd_16` ( +`a` int(11) DEFAULT NULL, +`d` int(11) DEFAULT NULL, +`b` varchar(198) DEFAULT NULL, +`c` char(179) DEFAULT NULL, +`vadcol` int(11) GENERATED ALWAYS AS (a+length(d)) STORED, +`vbcol` char(2) GENERATED ALWAYS AS (substr(b,2,2)) VIRTUAL, +`vbidxcol` char(3) GENERATED ALWAYS AS (substr(b,1,3)) VIRTUAL, +UNIQUE KEY `b` (`b`(10),`d`), +KEY `d` (`d`), +KEY `a` (`a`), +KEY `c` (`c`(99),`b`(33)), +KEY `b_2` (`b`(5),`c`(10),`a`), +KEY `vbidxcol` (`vbidxcol`), +KEY `a_2` (`a`,`vbidxcol`), +KEY `vbidxcol_2` (`vbidxcol`,`d`) +) ENGINE=INNODB; +CREATE TABLE `ibstd_16_fk` ( +`a` int(11) DEFAULT NULL, +`d` int(11) DEFAULT NULL, +`b` varchar(198) DEFAULT NULL, +`c` char(179) DEFAULT NULL, +`vadcol` int(11) GENERATED ALWAYS AS (a+length(d)) STORED, +`vbcol` char(2) GENERATED ALWAYS AS (substr(b,2,2)) VIRTUAL, +`vbidxcol` char(3) GENERATED ALWAYS AS (substr(b,1,3)) VIRTUAL, +UNIQUE KEY `b` (`b`(10),`a`,`d`), +KEY `d` (`d`), +KEY `a` (`a`), +KEY `c` (`c`(99),`b`(33)), +KEY `b_2` (`b`(5),`c`(10),`a`), +KEY `vbidxcol` (`vbidxcol`), +KEY `a_2` (`a`,`vbidxcol`), +KEY `vbidxcol_2` (`vbidxcol`,`d`), +CONSTRAINT `fk_16` FOREIGN KEY (`a`) REFERENCES `ibstd_16` (`a`) ON DELETE SET NULL +) ENGINE=InnoDB; +DROP TABLE ibstd_16_fk; +CREATE TABLE `ibstd_16_fk` ( +`a` int(11) DEFAULT NULL, +`d` int(11) DEFAULT NULL, +`b` varchar(198) DEFAULT NULL, +`c` char(179) DEFAULT NULL, +`vbcol` char(2) GENERATED ALWAYS AS (substr(b,2,2)) VIRTUAL, +`vbidxcol` char(3) GENERATED ALWAYS AS (substr(b,1,3)) VIRTUAL, +UNIQUE KEY `b` (`b`(10),`a`,`d`), +KEY `d` (`d`), +KEY `a` (`a`), +KEY `c` (`c`(99),`b`(33)), +KEY `b_2` (`b`(5),`c`(10),`a`), +KEY `vbidxcol` (`vbidxcol`), +KEY `vbidxcol_2` (`vbidxcol`,`d`), +CONSTRAINT `fk_16` FOREIGN KEY (`a`) REFERENCES `ibstd_16` (`a`) ON DELETE SET NULL +) ENGINE=InnoDB; +ALTER TABLE ibstd_16_fk ADD INDEX `a_2` (`a`,`vbidxcol`); +DROP TABLE ibstd_16_fk; +CREATE TABLE `ibstd_16_fk` ( +`a` int(11) DEFAULT NULL, +`d` int(11) DEFAULT NULL, +`b` varchar(198) DEFAULT NULL, +`c` char(179) DEFAULT NULL, +`vbcol` char(2) GENERATED ALWAYS AS (substr(b,2,2)) VIRTUAL, +`vbidxcol` char(3) GENERATED ALWAYS AS (substr(b,1,3)) VIRTUAL, +UNIQUE KEY `b` (`b`(10),`a`,`d`), +KEY `d` (`d`), +KEY `a` (`a`), +KEY `c` (`c`(99),`b`(33)), +KEY `b_2` (`b`(5),`c`(10),`a`), +KEY `vbidxcol` (`vbidxcol`), +KEY `a_2` (`a`,`vbidxcol`), +KEY `vbidxcol_2` (`vbidxcol`,`d`) +) ENGINE=InnoDB; +ALTER TABLE `ibstd_16_fk` ADD CONSTRAINT `fk_16` FOREIGN KEY (`a`) REFERENCES `ibstd_16` (`a`) ON DELETE SET NULL; +DROP INDEX a_2 ON ibstd_16_fk; +INSERT INTO ibstd_16 VALUES (1, 2, "aaa", "bbb", default, default, default); +INSERT INTO ibstd_16_fk VALUES(1, 3, "mmm", "SSS", default, default); +DELETE FROM ibstd_16 WHERE a = 1; +DROP TABLE ibstd_16_fk; +DROP TABLE ibstd_16; +create table t(a int) engine=innodb; +insert into t set a=1; +alter table t add column c int generated always as (1) virtual; +insert into t set a=2; +alter table t add unique index(c); +ERROR 23000: Duplicate entry '1' for key 'c' +insert into t set a=1; +drop table t; +create table t ( +x int, +a int generated always as (x) virtual, +b int generated always as (1) stored, +c int not null, +unique (b), +unique (a,b) +) engine=innodb; +insert into t(x, c) values(1, 3); +replace into t(x, c) values(1, 0); +drop table t; +CREATE TABLE t( +c7c CHAR(1)GENERATED ALWAYS AS (c3) VIRTUAL, +c1 int(1), +c2 int(1), +c3 int(1), +c4 int(1), +c5 int(1)GENERATED ALWAYS AS ((c2 - c4)) VIRTUAL, +UNIQUE KEY c5_9(c5) +)ENGINE=InnoDB DEFAULT CHARSET=latin1; +ALTER TABLE t CHANGE COLUMN c5 c5 INT(1) GENERATED ALWAYS AS(c2 - +c4)VIRTUAL AFTER c3,ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY +ALTER TABLE t CHANGE COLUMN c7c c7c INT(1) GENERATED ALWAYS AS(c3) +VIRTUAL AFTER c5,ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY +ALTER TABLE t DROP COLUMN c7c,ADD COLUMN c5c INT GENERATED ALWAYS AS(c4/ +c3)VIRTUAL AFTER c3,ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY +DROP TABLE t; +CREATE TABLE `t` ( +`col1` int(11) DEFAULT NULL, +`col2` int(11) DEFAULT NULL, +`col4` int(11) DEFAULT NULL, +`col5` int(11) GENERATED ALWAYS AS ((`col2` % `col4`)) VIRTUAL, +`col6` int(11) GENERATED ALWAYS AS ((`col2` - `col2`)) VIRTUAL, +`col5x` int(11) GENERATED ALWAYS AS ((`col1` / `col1`)) VIRTUAL, +`col6x` int(11) GENERATED ALWAYS AS ((`col2` / `col4`)) VIRTUAL, +`col7x` int(11) GENERATED ALWAYS AS ((`col6` % `col6x`)) VIRTUAL, +`col8x` int(11) GENERATED ALWAYS AS ((`col6` / `col6`)) VIRTUAL, +`col9` text, +`col7c` int(11) GENERATED ALWAYS AS ((`col6x` % `col6x`)) VIRTUAL, +`col1b` varchar(20) GENERATED ALWAYS AS (`col1`) VIRTUAL, +`col3` int(11) DEFAULT NULL, +`col7` int(11) DEFAULT NULL, +`col5c` int(11) GENERATED ALWAYS AS ((`col5x` * `col6`)) VIRTUAL, +`col6c` varchar(20) GENERATED ALWAYS AS (`col5x`) VIRTUAL, +`col3b` bigint(20) GENERATED ALWAYS AS ((`col6x` * `col6`)) VIRTUAL, +`col1a` varchar(20) GENERATED ALWAYS AS (`col1`) VIRTUAL, +`col8` int(11) DEFAULT NULL, +UNIQUE KEY `col5` (`col5`), +UNIQUE KEY `col6x` (`col6x`), +UNIQUE KEY `col5_2` (`col5`), +KEY `idx2` (`col9`(10)), +KEY `idx4` (`col2`), +KEY `idx8` (`col9`(10),`col5`), +KEY `idx9` (`col6`), +KEY `idx6` (`col6`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +Warnings: +Note 1831 Duplicate index `col5_2`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `idx6`. This is deprecated and will be disallowed in a future release +ALTER TABLE t CHANGE COLUMN col3b col8a BIGINT GENERATED ALWAYS AS +(col6x * col6) VIRTUAL, ADD UNIQUE KEY uidx ( col8a ); +DROP TABLE t; +# +# Bug 22141031 - GCOLS: PURGED THREAD DIES: TRIED TO PURGE +# NON-DELETE-MARKED RECORD IN INDEX +# +create table t ( +a int,b int,c text,d int,e int,f int,g int, +h text generated always as ('1') virtual, +i int,j int,k int,l int,m int, +primary key (c(1)),unique key (c(1)), +key (i),key (h(1)) +) engine=innodb default charset latin1; +replace into t(c) values (''); +replace into t(c) values (''); +alter table t drop column d ; +drop table t; +# +# Bug 22139917 - ASSERTION: DICT_TABLE_GET_NTH_COL(USER_TABLE, NTH_COL) +# ->LEN < NEW_LEN +# +create table t ( +a int generated always as (1) virtual, +b varbinary(1), +c varbinary(1) generated always as (b) virtual +) engine=innodb; +alter table t change column b b varbinary(2), algorithm=inplace; +alter table t change column c c varbinary(2) generated always as (b) virtual, algorithm=inplace; +drop table t; +SET @@SESSION.sql_mode=0; +CREATE TABLE t( +c1 INT AUTO_INCREMENT, +c2 INT, +c3 INT GENERATED ALWAYS AS(c2 + c2)VIRTUAL, +c3k INT GENERATED ALWAYS AS(c2 + c3)VIRTUAL, +c4 DATE, +c5 DATE GENERATED ALWAYS AS(DATE_ADD(c4,interval 30 day)) VIRTUAL, +c5k DATE GENERATED ALWAYS AS(DATE_ADD(c4,interval 30 day)) VIRTUAL, +c5time_gckey DATE, +c6 TIME, +c5time DATE GENERATED ALWAYS AS(ADDTIME(c5time_gckey,c6)) VIRTUAL, +c7 TIME GENERATED ALWAYS AS(ADDTIME(c5time_gckey,c6)) VIRTUAL, +c5timek DATE GENERATED ALWAYS AS(ADDTIME(c5time_gckey,c7)) VIRTUAL, +c7k TIME GENERATED ALWAYS AS(ADDTIME(c5time,c6)) VIRTUAL, +c8 CHAR(10), +c9 CHAR(20)GENERATED ALWAYS AS (CONCAT(c8,c8)) VIRTUAL, +c9k CHAR(15)GENERATED ALWAYS AS (CONCAT(c8,0)) VIRTUAL, +PRIMARY KEY(c1), +KEY(c3), +KEY(c9(10)), +UNIQUE KEY(c9k), +UNIQUE KEY(c3k,c9k(5),c5k,c7k,c5timek,c3,c9(5),c5,c7,c5time) +)ENGINE=INNODB; +INSERT INTO +t(c2,c4,c6,c5time_gckey,c8)VALUES(1,0,0,0,0),(0,0,0,0,'ityzg'),(0,0,1,0,'tyzgk +t'),(0,1,0,1,'yzgktb'),(0,0,0,0,'zgktb'),(0,0,0,0,'gktbkj'),(0,0,0,0,0),(0,0,1 +,0,1),(0,0,0,0,1),(0,0,0,0,'tbkjrkm'),(0,0,0,0,'bkjr'),(0,0,0,0,0),(0,0,0,0,0) +,(0,0,0,0,'rk'),(0,0,0,0,'kmqmknbtoe'),(1,0,0,0,'mqmknbt'),(0,1,0,0,'qmknb'),( +0,0,0,0,'mkn'),(0,0,0,0,'knbtoervql'),(0,0,1,0,1),(0,0,0,0,'nbtoerv'),(0,0,0,0 +,'btoerv'),(0,0,1,0,'toer'),(1,0,0,0,0),(0,0,0,0,'ervq'),(0,0,0,0,'rvqlzsvasu' +),(0,0,0,0,'vqlzs'),(0,0,0,0,0),(0,1,0,0,'lzsvasu'),(0,0,0,0,'zsvasurq'); +ERROR 23000: Duplicate entry '00' for key 'c9k' +SELECT +DISTINCT * FROM t +FORCE KEY(PRIMARY,c3k,c3,c9k,c9) +WHERE +(c9 IS NULL AND (c9=0)) +OR( +(c9k NOT IN ('ixfq','xfq','New Mexico','fq')OR c9 IS NULL) +) +OR(c9 BETWEEN 'hwstqua' AND 'wstquadcji' OR (c9k=0)) +AND(c3 IS NULL OR c3 IN (0,0,0)); +c1 c2 c3 c3k c4 c5 c5k c5time_gckey c6 c5time c7 c5timek c7k c8 c9 c9k +drop table t; +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), d INT +GENERATED ALWAYS AS(a+b+b), e INT GENERATED ALWAYS AS(a), h VARCHAR(10)); +INSERT INTO t VALUES (11, 3, DEFAULT, DEFAULT, DEFAULT, 'mm'); +INSERT INTO t VALUES (18, 1, DEFAULT, DEFAULT, DEFAULT, 'mm'); +INSERT INTO t VALUES (28, 1, DEFAULT, DEFAULT, DEFAULT, 'mm'); +INSERT INTO t VALUES (null, null, DEFAULT, DEFAULT, DEFAULT, 'mm'); +CREATE INDEX idx ON t(c, d); +CREATE INDEX idx1 ON t(c); +CREATE INDEX idx2 ON t(e, c, d); +ALTER TABLE t DROP COLUMN c, ALGORITHM=INPLACE; +SELECT d FROM t; +d +NULL +17 +20 +30 +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `d` int(11) GENERATED ALWAYS AS (`a` + `b` + `b`) VIRTUAL, + `e` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL, + `h` varchar(10) DEFAULT NULL, + KEY `idx` (`d`), + KEY `idx2` (`e`,`d`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +ALTER TABLE t DROP COLUMN d, ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (c), ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY +ALTER TABLE t DROP COLUMN d, ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (e), ALGORITHM=INPLACE, LOCK=NONE; +Warnings: +Note 1831 Duplicate index `idx`. This is deprecated and will be disallowed in a future release +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `e` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL, + `h` varchar(10) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (`a` + `b`) VIRTUAL, + KEY `idx2` (`e`), + KEY `idx` (`e`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +ALTER TABLE t ADD INDEX idx4(c, e), ADD COLUMN x VARCHAR(10) GENERATED ALWAYS AS(h), DROP INDEX idx, ALGORITHM=INPLACE, LOCK=NONE; +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `e` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL, + `h` varchar(10) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (`a` + `b`) VIRTUAL, + `x` varchar(10) GENERATED ALWAYS AS (`h`) VIRTUAL, + KEY `idx2` (`e`), + KEY `idx4` (`c`,`e`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +ALTER TABLE t ADD COLUMN i INT GENERATED ALWAYS AS(a+a+b), ADD COLUMN j INT, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY +ALTER TABLE t ADD INDEX (x), ADD COLUMN j INT, ALGORITHM=INPLACE, LOCK=NONE; +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `e` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL, + `h` varchar(10) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (`a` + `b`) VIRTUAL, + `x` varchar(10) GENERATED ALWAYS AS (`h`) VIRTUAL, + `j` int(11) DEFAULT NULL, + KEY `idx2` (`e`), + KEY `idx4` (`c`,`e`), + KEY `x` (`x`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +ALTER TABLE t ADD COLUMN i INT GENERATED ALWAYS AS(a+a+b), ADD INDEX (i), ALGORITHM=INPLACE, LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try LOCK=SHARED +ALTER TABLE t ADD COLUMN i INT GENERATED ALWAYS AS(a+a+b), ADD INDEX (i), ALGORITHM=INPLACE, LOCK=SHARED; +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `e` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL, + `h` varchar(10) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (`a` + `b`) VIRTUAL, + `x` varchar(10) GENERATED ALWAYS AS (`h`) VIRTUAL, + `j` int(11) DEFAULT NULL, + `i` int(11) GENERATED ALWAYS AS (`a` + `a` + `b`) VIRTUAL, + KEY `idx2` (`e`), + KEY `idx4` (`c`,`e`), + KEY `x` (`x`), + KEY `i` (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT i FROM t; +i +NULL +25 +37 +57 +SELECT * FROM t; +a b e h c x j i +11 3 11 mm 14 mm NULL 25 +18 1 18 mm 19 mm NULL 37 +28 1 28 mm 29 mm NULL 57 +NULL NULL NULL mm NULL mm NULL NULL +DROP TABLE t; +CREATE TABLE t ( +a INT, +b INT, +c INT GENERATED ALWAYS AS(a+b), +d INT GENERATED ALWAYS AS(a+b+b), +KEY vidx (c, d) +)ENGINE=INNODB; +INSERT INTO t (a,b) VALUES (0, 0), (1, NULL), (NULL, 2), (NULL, NULL); +SELECT c, d FROM t; +c d +NULL NULL +NULL NULL +NULL NULL +0 0 +SELECT * FROM t; +a b c d +0 0 0 0 +1 NULL NULL NULL +NULL 2 NULL NULL +NULL NULL NULL NULL +ALTER TABLE t DROP COLUMN c, ALGORITHM=INPLACE; +SELECT d FROM t; +d +NULL +NULL +NULL +0 +SELECT * FROM t; +a b d +0 0 0 +1 NULL NULL +NULL 2 NULL +NULL NULL NULL +DROP TABLE t; +CREATE TABLE t ( +a INT, +b INT, +c INT GENERATED ALWAYS AS(a+b), +d INT GENERATED ALWAYS AS(a+b+b) +)ENGINE=INNODB; +INSERT INTO t (a,b) VALUES (0, 0), (1, NULL), (NULL, 2), (NULL, NULL); +SELECT * FROM t; +a b c d +0 0 0 0 +1 NULL NULL NULL +NULL 2 NULL NULL +NULL NULL NULL NULL +ALTER TABLE t DROP COLUMN c, ADD INDEX vidx(d), ALGORITHM=INPLACE; +SELECT d FROM t; +d +NULL +NULL +NULL +0 +SELECT * FROM t WHERE d > 0; +a b d +SELECT * FROM t; +a b d +0 0 0 +1 NULL NULL +NULL 2 NULL +NULL NULL NULL +DROP TABLE t; +# +# Bug #22162200 MEMORY LEAK IN HA_INNOPART_SHARE +# ::SET_V_TEMPL PARTITIONED ON VIRTUAL COLUMN +# +create table t ( +c tinyint, +d longblob generated always as (c) virtual +) engine=innodb partition by key (c) partitions 2; +select d in(select d from t)from t group by d; +d in(select d from t) +drop table t; +# +# BUG#23052231 - ASSERTION FAILURE: ROW0MERGE.CC:2100:ADD_AUTOINC +# < DICT_TABLE_GET_N_USER_COLS +# +CREATE TABLE `t` ( +`a` int(11) NOT NULL, +`d` int(11) NOT NULL, +`b` varchar(198) NOT NULL, +`c` char(177) DEFAULT NULL, +`vadcol` int(11) GENERATED ALWAYS AS ((`a` + length(`d`))) STORED, +`vbcol` char(2) GENERATED ALWAYS AS (substr(`b`,2,2)) VIRTUAL, +`vbidxcol` char(3) GENERATED ALWAYS AS (substr(`b`,1,3)) VIRTUAL, +PRIMARY KEY (`b`(10),`a`,`d`), +KEY `d` (`d`), +KEY `a` (`a`), +KEY `c_renamed` (`c`(99),`b`(35)), +KEY `b` (`b`(5),`c`(10),`a`), +KEY `vbidxcol` (`vbidxcol`), +KEY `a_2` (`a`,`vbidxcol`), +KEY `vbidxcol_2` (`vbidxcol`,`d`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t values (11, 1, "11", "aa", default, default, default); +ALTER TABLE t ADD COLUMN nc01128 BIGINT AUTO_INCREMENT NOT NULL, ADD KEY auto_nc01128(nc01128); +DROP TABLE t; +# +#Bug #22965271 NEEDS REBUILD FOR COLUMN LENGTH CHANGE THAT IS +#PART OF VIRTUAL INDEX. +# +CREATE TABLE t1( +a VARCHAR(45) CHARACTER SET LATIN1, +b VARCHAR(115) CHARACTER SET UTF8 GENERATED ALWAYS AS ('f1') VIRTUAL, +UNIQUE KEY (b,a))ENGINE=INNODB; +INSERT INTO t1(a) VALUES (''); +ALTER TABLE t1 CHANGE COLUMN a a VARCHAR(85); +SELECT * FROM t1; +a b + f1 +DROP TABLE t1; diff --git a/mysql-test/suite/gcol/r/innodb_virtual_blob.result b/mysql-test/suite/gcol/r/innodb_virtual_blob.result new file mode 100644 index 00000000000..f44716ea04f --- /dev/null +++ b/mysql-test/suite/gcol/r/innodb_virtual_blob.result @@ -0,0 +1,12 @@ +# +# Bug#22046353 ALTER: ASSERT PAGE_SIZE.EQUALS_TO(SPACE_PAGE_SIZE), +# BTR_COPY_BLOB_PREFIX +# +CREATE TABLE t1 +( f1 int primary key, f2 blob, +f3 blob generated always as (f2)) +row_format=compressed, engine=innodb; +insert into t1 (f1, f2) values (1, repeat('&', 50000)); +alter table t1 add index i1 (f3(200)) ; +alter table t1 row_format=compact; +drop table t1; diff --git a/mysql-test/suite/gcol/r/innodb_virtual_debug.result b/mysql-test/suite/gcol/r/innodb_virtual_debug.result new file mode 100644 index 00000000000..a80ec95a2ca --- /dev/null +++ b/mysql-test/suite/gcol/r/innodb_virtual_debug.result @@ -0,0 +1,227 @@ +set default_storage_engine=innodb; +CREATE TABLE `t` ( +`a` VARCHAR(100), +`b` VARCHAR(100), +`c` VARCHAR(200) GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, +`h` VARCHAR(10) DEFAULT NULL, +`i` int +) ENGINE=InnoDB; +INSERT INTO t VALUES (REPEAT('g', 100), REPEAT('x', 10), DEFAULT, "kk", 1); +INSERT INTO t VALUES (REPEAT('a', 100), REPEAT('b', 100), DEFAULT, "mm", 2); +CREATE INDEX idx ON t(c(100)); +SET session debug_dbug="+d,ib_alter_add_virtual_fail"; +ALTER TABLE t ADD COLUMN x VARCHAR(200) GENERATED ALWAYS AS (a) VIRTUAL, +ALGORITHM = INPLACE; +ERROR 42000: The storage engine InnoDB can't index column `x` +ALTER TABLE t DROP COLUMN c, ALGORITHM = INPLACE; +ERROR 42000: The storage engine InnoDB can't index column `c` +SET session debug_dbug=""; +DROP TABLE t; +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); +INSERT INTO t VALUES (11, 3, DEFAULT, 'mm'); +INSERT INTO t VALUES (18, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (28, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (null, null, DEFAULT, "mx"); +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead'; +CREATE INDEX idx ON t(c); +connect con1,localhost,root,,; +SET DEBUG_SYNC = 'now WAIT_FOR start_create'; +update t set a=0 where a = 11; +start transaction; +update t set a=1 where a = 0; +ROLLBACK; +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; +connection default; +SELECT c FROM t; +c +NULL +3 +19 +29 +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (`a` + `b`) VIRTUAL, + `h` varchar(10) DEFAULT NULL, + KEY `idx` (`c`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t; +a b c h +0 3 3 mm +18 1 19 mm +28 1 29 mm +NULL NULL NULL mx +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead'; +ALTER TABLE t ADD COLUMN x INT; +connection con1; +SET DEBUG_SYNC = 'now WAIT_FOR start_create'; +start transaction; +update t set a=1 where a = 0; +rollback; +start transaction; +delete from t; +insert into t values(1,null,default,null); +rollback; +start transaction; +update t set b=b+1; +rollback; +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; +connection default; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +SELECT c FROM t; +c +NULL +3 +19 +29 +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead'; +ALTER TABLE t ADD COLUMN x2 INT; +connection con1; +SET DEBUG_SYNC = 'now WAIT_FOR start_create'; +start transaction; +DELETE FROM t WHERE a = 0; +ROLLBACK; +DELETE FROM t WHERE a = 0; +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; +connection default; +SELECT c FROM t; +c +NULL +19 +29 +disconnect con1; +DROP TABLE t; +SET DEBUG_SYNC = 'RESET'; +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); +INSERT INTO t VALUES (11, 3, DEFAULT, 'mm'); +INSERT INTO t VALUES (18, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (28, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (null, null, DEFAULT, 'mm'); +CREATE INDEX idx_1 on t(c); +SET SESSION debug_dbug="+d,create_index_fail"; +ALTER TABLE t ADD COLUMN x INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (x); +ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +SET SESSION debug_dbug=""; +affected rows: 0 +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (`a` + `b`) VIRTUAL, + `h` varchar(10) DEFAULT NULL, + KEY `idx_1` (`c`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT c FROM t; +c +NULL +14 +19 +29 +DROP TABLE t; +# +# Bug#22018532 ASSERTION WHEN ONLINE REAPPLY REBUILD LOG ON +# MULTIPLE INDEXED VIRTUAL COLUMNS +# +create table t ( +a int as (1) virtual, +b int, +c int as (1) virtual, +unique(b), +unique(c), +key(a) +) engine=innodb; +insert ignore into t values(); +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead'; +optimize table t; +connect con1,localhost,root,,; +SET DEBUG_SYNC = 'now WAIT_FOR start_create'; +insert ignore into t values(); +Warnings: +Warning 1062 Duplicate entry '1' for key 'c' +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; +connection default; +/* connection default */ optimize table t; +Table Op Msg_type Msg_text +test.t optimize note Table does not support optimize, doing recreate + analyze instead +test.t optimize error Duplicate entry '1' for key 'a' +test.t optimize status Operation failed +Warnings: +Error 1062 Duplicate entry '1' for key 'a' +SELECT c FROM t; +c +1 +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) GENERATED ALWAYS AS (1) VIRTUAL, + `b` int(11) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (1) VIRTUAL, + UNIQUE KEY `b` (`b`), + UNIQUE KEY `c` (`c`), + KEY `a` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t; +a b c +1 NULL 1 +DROP TABLE t; +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); +INSERT INTO t VALUES (11, 3, DEFAULT, 'mm'); +INSERT INTO t VALUES (18, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (28, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (null, null, DEFAULT, 'mm'); +CREATE INDEX idx ON t(c); +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_rebuild WAIT_FOR go_ahead'; +optimize table t; +connection con1; +SET DEBUG_SYNC = 'now WAIT_FOR start_rebuild'; +INSERT INTO t VALUES (48, 2, DEFAULT, 'xx'); +INSERT INTO t VALUES (68, 3, DEFAULT, 'sx'); +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; +connection default; +/* connection default */ optimize table t; +Table Op Msg_type Msg_text +test.t optimize note Table does not support optimize, doing recreate + analyze instead +test.t optimize status OK +SELECT c FROM t; +c +NULL +14 +19 +29 +50 +71 +disconnect con1; +DROP TABLE t; +# +# Bug#22951879 - ASSERTS RELATED TO ONLINE DDL AND GCOL +# +create table ibstd_14 (a int not null, d int not null, b varchar(198) not null, c char(181), vadcol int as (a+length(d)) stored, vbcol char(2) as (substr(b,2,2)) virtual, vbidxcol char(3) as (substr(b,1,3)) virtual , index(d), index(a), index(vbidxcol), index(a,vbidxcol), index(vbidxcol,d), unique key (b(10), a, d), index(c(99), b(31)), index(b(5), c(10), a) , index(a,d)) engine=InnoDB stats_persistent=1 row_format=dynamic; +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead'; +alter table ibstd_14 row_format=compressed key_block_size=4,add key kn3 (d,c,vbcol,b); +connect con1,localhost,root; +SET DEBUG_SYNC = 'now WAIT_FOR start_create'; +insert into ibstd_14 (a,d,b,c, vbidxcol, vbcol) values ('118','6',repeat('oacolaarlruoacuroauurloraarucoooarcooauoolacalllaulrruarrrucruuooclacuoouccarrcoocloccorrrrarourcooalloocooccouruolaorlcaocualolc','1'),repeat('lolrrlalcocroraaulauclaaucolcorcuooaolruaooooluooooouaoorlarucorullalcrrloccououaooaorluorraclrcooouuolocoaolcocaaculruoocucoocoooauuolarcoraraocaoolulolarru','1'),default,default); +insert into ibstd_14 (a,d,b,c, vbidxcol, vbcol) values ('118','6', 'aaaa', 'lll', default, default); +update ibstd_14 set b='11111' where b='aaaa'; +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; +connection default; +select * from ibstd_14; +a d b c vadcol vbcol vbidxcol +118 6 oacolaarlruoacuroauurloraarucoooarcooauoolacalllaulrruarrrucruuooclacuoouccarrcoocloccorrrrarourcooalloocooccouruolaorlcaocualolc lolrrlalcocroraaulauclaaucolcorcuooaolruaooooluooooouaoorlarucorullalcrrloccououaooaorluorraclrcooouuolocoaolcocaaculruoocucoocoooauuolarcoraraocaoolulolarru 119 ac oac +118 6 11111 lll 119 11 111 +select d,c,vbcol,b from ibstd_14; +d c vbcol b +6 lll 11 11111 +6 lolrrlalcocroraaulauclaaucolcorcuooaolruaooooluooooouaoorlarucorullalcrrloccououaooaorluorraclrcooouuolocoaolcocaaculruoocucoocoooauuolarcoraraocaoolulolarru ac oacolaarlruoacuroauurloraarucoooarcooauoolacalllaulrruarrrucruuooclacuoouccarrcoocloccorrrrarourcooalloocooccouruolaorlcaocualolc +select vbcol from ibstd_14; +vbcol +11 +ac +drop table ibstd_14; +disconnect con1; +SET DEBUG_SYNC = 'RESET'; diff --git a/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result b/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result new file mode 100644 index 00000000000..e09d52d6dd1 --- /dev/null +++ b/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result @@ -0,0 +1,160 @@ +set default_storage_engine=innodb; +set @old_dbug=@@global.debug_dbug; +CREATE TABLE `t` ( +`a` BLOB, +`b` BLOB, +`c` BLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, +`h` VARCHAR(10) DEFAULT NULL, +`i` int +) ENGINE=InnoDB; +INSERT INTO t VALUES (REPEAT('g', 16000), REPEAT('x', 16000), DEFAULT, "kk", 1); +INSERT INTO t VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, "mm", 2); +CREATE INDEX idx ON t(c(100)); +SET global debug_dbug="+d,ib_purge_virtual_index_callback"; +UPDATE t SET a = REPEAT('m', 16000) WHERE a like "aaa%"; +select sleep(3); +sleep(3) +0 +SET global debug_dbug=@old_dbug; +DROP TABLE t; +CREATE TABLE t ( +a TINYBLOB, +b TINYBLOB, +c TINYBLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, +h VARCHAR(10) DEFAULT NULL, +i INT +) ROW_FORMAT=COMPACT ENGINE=InnoDB; +INSERT INTO t VALUES (REPEAT('g', 100), REPEAT('x', 100), DEFAULT, "kk", 1); +INSERT INTO t VALUES (REPEAT('a', 100), REPEAT('b', 100), DEFAULT, "mm", 2); +CREATE INDEX idx ON t(c(100)); +SET global debug_dbug="+d,ib_purge_virtual_index_callback"; +UPDATE t SET a = REPEAT('m', 100) WHERE a like "aaa%"; +select sleep(3); +sleep(3) +0 +SET global debug_dbug=@old_dbug; +DROP TABLE t; +CREATE TABLE t1 ( +id INT NOT NULL, +store_id INT NOT NULL, +x INT GENERATED ALWAYS AS (id + store_id) +) +PARTITION BY RANGE (store_id) ( +PARTITION p0 VALUES LESS THAN (6), +PARTITION p1 VALUES LESS THAN (11), +PARTITION p2 VALUES LESS THAN (16), +PARTITION p3 VALUES LESS THAN (21) +); +insert into t1 values(1, 2, default); +insert into t1 values(3, 4, default); +insert into t1 values(3, 12, default); +insert into t1 values(4, 18, default); +CREATE INDEX idx ON t1(x); +SET global debug_dbug="+d,ib_purge_virtual_index_callback"; +UPDATE t1 SET id = 10 WHERE id = 1; +select sleep(3); +sleep(3) +0 +SET global debug_dbug=@old_dbug; +DROP TABLE t1; +connect con1,localhost,root,,; +connection default; +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1(a, b) VALUES (1, 1), (2, 2), (3, 3); +connection con1; +# disable purge +CREATE TABLE t0 (a INT) ENGINE=InnoDB; +BEGIN; +SELECT * FROM t0; +a +connection default; +DELETE FROM t1 WHERE a = 1; +UPDATE t1 SET a = 4, b = 4 WHERE a = 3; +INSERT INTO t1(a, b) VALUES (5, 5); +SET DEBUG_SYNC= 'inplace_after_index_build SIGNAL uncommitted WAIT_FOR purged'; +ALTER TABLE t1 ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try LOCK=SHARED +ALTER TABLE t1 ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=SHARED; +connection con1; +SET DEBUG_SYNC= 'now WAIT_FOR uncommitted'; +# enable purge +COMMIT; +# wait for purge to process the deleted records. +Timeout in wait_innodb_all_purged.inc for INNODB_PURGE_TRX_ID_AGE = 3 +SET DEBUG_SYNC= 'now SIGNAL purged'; +connection default; +/* connection default */ ALTER TABLE t1 ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=SHARED; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (`a` + `b`) VIRTUAL, + KEY `idx` (`c`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t1; +a b c +2 2 4 +4 4 8 +5 5 10 +DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT, c INT GENERATED ALWAYS AS(a+b)); +INSERT INTO t1(a, b) VALUES (1, 1), (2, 2), (3, 3), (4, 4); +connection con1; +# disable purge +BEGIN; +SELECT * FROM t0; +a +connection default; +DELETE FROM t1 WHERE a = 1; +UPDATE t1 SET a = 2, b = 2 WHERE a = 5; +INSERT INTO t1(a, b) VALUES (6, 6); +SET DEBUG_SYNC= 'inplace_after_index_build SIGNAL uncommitted WAIT_FOR purged'; +ALTER TABLE t1 ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=NONE; +connection con1; +SET DEBUG_SYNC= 'now WAIT_FOR uncommitted'; +DELETE FROM t1 WHERE a = 3; +UPDATE t1 SET a = 7, b = 7 WHERE a = 4; +INSERT INTO t1(a, b) VALUES (8, 8); +# enable purge +COMMIT; +# wait for purge to process the deleted/updated records. +SET DEBUG_SYNC= 'now SIGNAL purged'; +disconnect con1; +connection default; +/* connection default */ ALTER TABLE t1 ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=NONE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (`a` + `b`) VIRTUAL, + KEY `idx` (`c`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t1; +a b c +2 2 4 +7 7 14 +6 6 12 +8 8 16 +DROP TABLE t0, t1; +create table t (a blob, b blob, c blob as (concat(a,b)), h varchar(10), index (c(100))); +insert t(a,b,h) values (repeat('g', 16000), repeat('x', 16000), "kk"); +insert t(a,b,h) values (repeat('a', 16000), repeat('b', 16000), "mm"); +set global innodb_purge_stop_now = 1; +set global debug_dbug="+d,ib_purge_virtual_index_callback"; +update t set a = repeat('m', 16000) where a like "aaa%"; +connect con1, localhost, root; +lock table t write; +connection default; +set global innodb_purge_run_now=1; +select variable_value>1 from information_schema.global_status where variable_name='innodb_purge_trx_id_age'; +variable_value>1 +1 +disconnect con1; +select variable_value>1 from information_schema.global_status where variable_name='innodb_purge_trx_id_age'; +variable_value>1 +0 +set global debug_dbug=@old_dbug; +drop table t; +set debug_sync=reset; diff --git a/mysql-test/suite/gcol/r/innodb_virtual_fk.result b/mysql-test/suite/gcol/r/innodb_virtual_fk.result new file mode 100644 index 00000000000..38a13edd8fa --- /dev/null +++ b/mysql-test/suite/gcol/r/innodb_virtual_fk.result @@ -0,0 +1,590 @@ +set default_storage_engine=innodb; +# +# Bug#22469130: FOREIGN KEY ON DELETE CASCADE NOT ALLOWED +# WHEN A VIRTUAL INDEX EXISTS. +# UPDATE CASCADE +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT AS (fld1) VIRTUAL, KEY(fld2), +FOREIGN KEY(fld1) REFERENCES t1(fld1) ON UPDATE CASCADE); +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +fld2 +2 +SELECT * FROM t2; +fld1 fld2 +2 2 +DROP TABLE t2, t1; +# UPDATE SET NULL +CREATE TABLE t1(fld1 INT NOT NULL, fld2 INT NOT NULL PRIMARY KEY, +KEY(fld1)); +CREATE TABLE t2(fld1 INT, fld2 INT AS (fld1) VIRTUAL, KEY(fld2), +FOREIGN KEY(fld1) REFERENCES t1(fld1) ON UPDATE SET NULL); +INSERT INTO t1 VALUES(1, 2); +INSERT INTO t2 VALUES(1, DEFAULT); +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +fld2 +NULL +SELECT * FROM t2; +fld1 fld2 +NULL NULL +DROP TABLE t2, t1; +# DELETE CASCADE +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT, fld2 INT AS (fld1) VIRTUAL, KEY(fld2), +FOREIGN KEY(fld1) REFERENCES t1(fld1) ON DELETE CASCADE); +INSERT INTO t1 VALUES(1); +INSERT INTO t1 VALUES(2); +INSERT INTO t2 VALUES(1, DEFAULT); +INSERT INTO t2 VALUES(2, DEFAULT); +DELETE FROM t1 WHERE fld1= 1; +SELECT fld2 FROM t2; +fld2 +2 +SELECT * FROM t2; +fld1 fld2 +2 2 +DROP TABLE t2, t1; +# DELETE SET NULL +CREATE TABLE t1(fld1 INT NOT NULL, fld2 INT NOT NULL PRIMARY KEY, KEY(fld1)); +CREATE TABLE t2(fld1 INT, fld2 INT AS (fld1) VIRTUAL, KEY(fld2), +FOREIGN KEY(fld1) REFERENCES t1(fld1) ON DELETE SET NULL); +INSERT INTO t1 VALUES(1, 1); +INSERT INTO t1 VALUES(2, 2); +INSERT INTO t2 VALUES(1, DEFAULT); +INSERT INTO t2 VALUES(2, DEFAULT); +DELETE FROM t1 WHERE fld1= 1; +SELECT fld2 FROM t2; +fld2 +NULL +2 +SELECT * FROM t2; +fld1 fld2 +NULL NULL +2 2 +DROP TABLE t2, t1; +# VIRTUAL INDEX CONTAINS FK CONSTRAINT COLUMN +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT, fld3 INT AS (fld2) VIRTUAL, +KEY(fld3, fld1), +FOREIGN KEY(fld1) REFERENCES t1(fld1) ON UPDATE CASCADE); +INSERT INTO t1(fld1) VALUES(1); +INSERT INTO t2(fld1, fld2) VALUES(1, 3); +UPDATE t1 SET fld1= 2; +SELECT fld3, fld1 FROM t2; +fld3 fld1 +3 2 +SELECT * FROM t2; +fld1 fld2 fld3 +2 3 3 +DROP TABLE t2, t1; +# Multiple level of VIRTUAL columns. +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT AS (fld1) VIRTUAL, +fld3 INT AS (fld2) VIRTUAL, KEY(fld3), KEY(fld2), +FOREIGN KEY(fld1) REFERENCES t1(fld1) ON UPDATE CASCADE); +INSERT INTO t1(fld1) VALUES(1); +INSERT INTO t2(fld1) VALUES(1); +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +fld2 +2 +SELECT fld3 FROM t2; +fld3 +2 +SELECT * FROM t2; +fld1 fld2 fld3 +2 2 2 +DROP TABLE t2, t1; +# Drop the VIRTUAL INDEX using alter copy ALGORITHM +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT AS (fld1) VIRTUAL, KEY vk(fld2), +KEY(fld1), FOREIGN KEY(fld1) REFERENCES t1(fld1) +ON UPDATE CASCADE); +INSERT INTO t1(fld1) VALUES(1); +INSERT INTO t2(fld1) VALUES(1); +UPDATE t1 SET fld1= 2; +SELECT fld2, fld1 FROM t2; +fld2 fld1 +2 2 +ALTER TABLE t2 DROP INDEX vk, ALGORITHM= COPY; +UPDATE t1 SET fld1= 3; +SELECT fld2, fld1 FROM t2; +fld2 fld1 +3 3 +DROP TABLE t2, t1; +# Drop the VIRTUAL INDEX using INPLACE alter ALGORITHM +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT AS (fld1) VIRTUAL, +KEY vk(fld2), KEY(fld1), FOREIGN KEY(fld1) REFERENCES t1(fld1) +ON UPDATE CASCADE); +INSERT INTO t1(fld1) VALUES(1); +INSERT INTO t2(fld1) VALUES(1); +UPDATE t1 SET fld1= 2; +SELECT fld2, fld1 FROM t2; +fld2 fld1 +2 2 +ALTER TABLE t2 DROP INDEX vk, ALGORITHM= COPY; +UPDATE t1 SET fld1= 3; +SELECT fld2, fld1 FROM t2; +fld2 fld1 +3 3 +DROP TABLE t2, t1; +# Add the VIRTUAL INDEX using COPY alter ALGORITHM +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT AS (fld1) VIRTUAL, +KEY(fld1), FOREIGN KEY(fld1) REFERENCES t1(fld1) +ON UPDATE CASCADE); +INSERT INTO t1(fld1) VALUES(1); +INSERT INTO t2(fld1) VALUES(1); +UPDATE t1 SET fld1= 2; +SELECT fld2, fld1 FROM t2; +fld2 fld1 +2 2 +ALTER TABLE t2 ADD INDEX vk(fld2), ALGORITHM= COPY; +UPDATE t1 SET fld1= 3; +SELECT fld2, fld1 FROM t2; +fld2 fld1 +3 3 +DROP TABLE t2, t1; +# Add the VIRTUAL INDEX using INPLACE alter ALGORITHM +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL,fld2 INT AS (fld1) VIRTUAL, +KEY(fld1), FOREIGN KEY(fld1) REFERENCES t1(fld1) +ON UPDATE CASCADE); +INSERT INTO t1(fld1) VALUES(1); +INSERT INTO t2(fld1) VALUES(1); +UPDATE t1 SET fld1= 2; +SELECT fld2, fld1 FROM t2; +fld2 fld1 +2 2 +ALTER TABLE t2 ADD INDEX vk(fld2), ALGORITHM= INPLACE; +UPDATE t1 SET fld1= 3; +SELECT fld2, fld1 FROM t2; +fld2 fld1 +3 3 +DROP TABLE t2, t1; +# Drop the VIRTUAL INDEX contains fk constraint column +# using alter copy ALGORITHM +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT NOT NULL, +fld3 INT AS (fld2) VIRTUAL, KEY vk(fld3, fld1), +KEY(fld1), FOREIGN KEY(fld1) REFERENCES t1(fld1) +ON UPDATE CASCADE); +INSERT INTO t1(fld1) VALUES(1); +INSERT INTO t2(fld1, fld2) VALUES(1, 2); +UPDATE t1 SET fld1= 2; +SELECT fld3, fld1 FROM t2; +fld3 fld1 +2 2 +ALTER TABLE t2 DROP INDEX vk, ALGORITHM= COPY; +UPDATE t1 SET fld1= 3; +SELECT fld3, fld1 FROM t2; +fld3 fld1 +2 3 +DROP TABLE t2, t1; +# Drop the VIRTUAL INDEX which contains fk constraint column +# using INPLACE alter operation +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT NOT NULL, +fld3 INT AS (fld2) VIRTUAL, KEY vk(fld3, fld1), +KEY(fld1), FOREIGN KEY(fld1) REFERENCES t1(fld1) +ON UPDATE CASCADE); +INSERT INTO t1(fld1) VALUES(1); +INSERT INTO t2(fld1, fld2) VALUES(1, 2); +UPDATE t1 SET fld1= 2; +SELECT fld3, fld1 FROM t2; +fld3 fld1 +2 2 +alter TABLE t2 DROP INDEX vk, ALGORITHM= INPLACE; +UPDATE t1 SET fld1= 3; +SELECT fld3, fld1 FROM t2; +fld3 fld1 +2 3 +DROP TABLE t2, t1; +# Add the VIRTUAL INDEX contains fk constraint column +# using copy alter operatiON +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT NOT NULL, +fld3 INT AS (fld2) VIRTUAL, KEY(fld1), +FOREIGN KEY(fld1) REFERENCES t1(fld1) ON UPDATE CASCADE); +INSERT INTO t1(fld1) VALUES(1); +INSERT INTO t2(fld1, fld2) VALUES(1, 2); +UPDATE t1 SET fld1= 2; +SELECT fld3, fld1 FROM t2; +fld3 fld1 +2 2 +alter TABLE t2 ADD INDEX vk(fld3, fld1), ALGORITHM= COPY; +UPDATE t1 SET fld1= 3; +SELECT fld3, fld1 FROM t2; +fld3 fld1 +2 3 +DROP TABLE t2, t1; +# Cascading UPDATEs and DELETEs for the multiple +# fk dependent TABLEs +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT AS (fld1) VIRTUAL, +KEY(fld1), KEY(fld2, fld1), +FOREIGN KEY(fld1) REFERENCES t1(fld1) ON UPDATE CASCADE); +CREATE TABLE t3(fld1 INT NOT NULL, fld2 INT AS (fld1) VIRTUAL, +KEY(fld2, fld1), +FOREIGN KEY(fld1) REFERENCES t2(fld1) ON UPDATE CASCADE); +INSERT INTO t1 VALUES(1), (2); +INSERT INTO t2(fld1) VALUES(1), (2); +INSERT INTO t3(fld1) VALUES(1), (2); +UPDATE t1 SET fld1= 4 WHERE fld1= 1; +SELECT fld2, fld1 FROM t2; +fld2 fld1 +2 2 +4 4 +SELECT fld2, fld1 FROM t3; +fld2 fld1 +2 2 +4 4 +DROP TABLE t3, t2, t1; +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT NOT NULL, +fld3 INT AS (fld2) VIRTUAL, KEY(fld3, fld1), KEY(fld1), +FOREIGN KEY(fld1) REFERENCES t1(fld1) ON UPDATE CASCADE); +CREATE TABLE t3(fld1 INT NOT NULL, fld2 INT NOT NULL, +fld3 INT AS (fld2) VIRTUAL, KEY(fld3, fld1), +FOREIGN KEY(fld1) REFERENCES t2(fld1) ON UPDATE CASCADE); +INSERT INTO t1 VALUES(1), (2); +INSERT INTO t2 VALUES(1, 1, DEFAULT), (2, 2, default); +INSERT INTO t3 VALUES(1, 1, DEFAULT), (2, 2, default); +UPDATE t1 SET fld1= 4 WHERE fld1= 1; +SELECT fld3, fld1 FROM t2; +fld3 fld1 +1 4 +2 2 +SELECT fld3, fld1 FROM t3; +fld3 fld1 +1 4 +2 2 +DROP TABLE t3, t2, t1; +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT AS (fld1) VIRTUAL, +KEY(fld1), KEY(fld2, fld1), +FOREIGN KEY(fld1) REFERENCES t1(fld1) ON DELETE CASCADE); +CREATE TABLE t3(fld1 INT NOT NULL, fld2 INT AS (fld1) VIRTUAL, +KEY(fld2, fld1), FOREIGN KEY(fld1) REFERENCES t2(fld1) +ON DELETE CASCADE); +INSERT INTO t1 VALUES(1), (2); +INSERT INTO t2(fld1) VALUES(1), (2); +INSERT INTO t3(fld1) VALUES(1), (2); +DELETE FROM t1 WHERE fld1= 1; +SELECT fld2, fld1 FROM t2; +fld2 fld1 +2 2 +SELECT fld2, fld1 FROM t3; +fld2 fld1 +2 2 +DROP TABLE t3, t2, t1; +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT NOT NULL, +fld3 INT AS (fld2) VIRTUAL, +KEY(fld3, fld1), KEY(fld1), +FOREIGN KEY(fld1) REFERENCES t1(fld1) +ON DELETE CASCADE); +CREATE TABLE t3(fld1 INT NOT NULL, fld2 INT NOT NULL, +fld3 INT AS (fld2) VIRTUAL, KEY(fld3, fld1), +FOREIGN KEY(fld1) REFERENCES t2(fld1) +ON DELETE CASCADE); +INSERT INTO t1 VALUES(1), (2); +INSERT INTO t2 VALUES(1, 1, DEFAULT), (2, 2, default); +INSERT INTO t3 VALUES(1, 1, DEFAULT), (2, 2, default); +DELETE FROM t1 WHERE fld1= 1; +SELECT fld3, fld1 FROM t2; +fld3 fld1 +2 2 +SELECT fld3, fld1 FROM t3; +fld3 fld1 +2 2 +DROP TABLE t3, t2, t1; +# RENAME TABLE +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, +fld2 INT AS (fld1) VIRTUAL, +KEY(fld2, fld1), +FOREIGN KEY(fld1) REFERENCES t1(fld1) +ON DELETE CASCADE); +INSERT INTO t1 VALUES(1), (2); +INSERT INTO t2 VALUES(1, DEFAULT), (2, default); +RENAME TABLE t2 to t3; +DELETE FROM t1 WHERE fld1= 1; +SELECT fld2, fld1 FROM t3; +fld2 fld1 +2 2 +DROP TABLE t3, t1; +# FOREIGN_KEY_CHECKS disabled DURING INPLACE ALTER +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, +fld2 INT AS (fld1) VIRTUAL, +FOREIGN KEY(fld1) REFERENCES t1(fld1) +ON UPDATE CASCADE); +INSERT INTO t1 VALUES(1), (2); +INSERT INTO t2 VALUES(1, DEFAULT), (2, default); +SET foreign_key_checks = 0; +ALTER TABLE t2 ADD INDEX vk(fld2), ALGORITHM=INPLACE; +SET foreign_key_checks = 1; +UPDATE t1 SET fld1= 3 WHERE fld1= 2; +SELECT fld2 FROM t2; +fld2 +1 +3 +DROP TABLE t2, t1; +# GENERATED COLUMN COMPUTATION FAILS when SQL_MODE +# is set to ERROR_FOR_DIVISION_BY_ZERO +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, +fld2 INT AS (100/fld1) VIRTUAL, +KEY(fld2), +FOREIGN KEY(fld1) REFERENCES t1(fld1) +ON UPDATE CASCADE); +INSERT INTO t1 VALUES(1), (2); +INSERT INTO t2 VALUES(1, DEFAULT), (2, default); +UPDATE t1 SET fld1= 0 WHERE fld1= 2; +SELECT fld2 FROM t2; +fld2 +NULL +100 +DROP TABLE t2, t1; +# CHANGE SQL_MODE and try the ERROR_FOR_DIVISION_BY_ZERO +SET sql_mode = STRICT_ALL_TABLES; +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, +fld2 INT AS (100/fld1) VIRTUAL, +KEY(fld2), +FOREIGN KEY(fld1) REFERENCES t1(fld1) +ON UPDATE CASCADE); +INSERT INTO t1 VALUES(1), (2); +INSERT INTO t2 VALUES(1, DEFAULT), (2, default); +UPDATE t1 SET fld1= 0 WHERE fld1= 2; +SELECT fld2 FROM t2; +fld2 +NULL +100 +SELECT * FROM t2; +fld1 fld2 +1 100 +0 NULL +DROP TABLE t2, t1; +SET sql_mode = default; +# ADD FOREIGN CONSTRAINT USING COPY +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, +fld2 INT AS (fld1) VIRTUAL, KEY(fld2)); +ALTER TABLE t2 ADD FOREIGN KEY (fld1) +REFERENCES t1(fld1) ON UPDATE CASCADE, +ALGORITHM=copy; +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +fld2 +2 +SELECT * FROM t2; +fld1 fld2 +2 2 +DROP TABLE t2, t1; +# ADD FOREIGN CONSTRAINT USING INPLACE +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, +fld2 INT AS (fld1) VIRTUAL, KEY(fld2)); +SET foreign_key_checks = 0; +ALTER TABLE t2 ADD FOREIGN KEY (fld1) +REFERENCES t1(fld1) ON UPDATE CASCADE, +ALGORITHM=inplace; +SET foreign_key_checks = 1; +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +fld2 +2 +SELECT * FROM t2; +fld1 fld2 +2 2 +DROP TABLE t2, t1; +# DROP FOREIGN CONSTRAINT USING COPY +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, +fld2 INT AS (fld1) VIRTUAL, KEY(fld2), +CONSTRAINT fidx FOREIGN KEY (fld1) REFERENCES t1(fld1) +ON UPDATE CASCADE); +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +ALTER TABLE t2 DROP FOREIGN KEY fidx, ALGORITHM=COPY; +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +fld2 +1 +SELECT * FROM t2; +fld1 fld2 +1 1 +DROP TABLE t2, t1; +# DROP FOREIGN CONSTRAINT USING INPLACE +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, +fld2 INT AS (fld1) VIRTUAL, KEY(fld2), +CONSTRAINT fidx FOREIGN KEY (fld1) REFERENCES t1(fld1) +ON UPDATE CASCADE); +SET foreign_key_checks = 0; +ALTER TABLE t2 DROP FOREIGN KEY fidx, ALGORITHM=INPLACE; +SET foreign_key_checks = 1; +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +fld2 +1 +SELECT * FROM t2; +fld1 fld2 +1 1 +DROP TABLE t2, t1; +# ADD VC INDEX and ADD FK IN SAME COPY ALTER +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, +fld2 INT AS (fld1) VIRTUAL); +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +ALTER TABLE t2 ADD INDEX(fld2), ADD FOREIGN KEY (fld1) REFERENCES t1(fld1) +ON UPDATE CASCADE, ALGORITHM=copy; +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +fld2 +2 +SELECT * FROM t2; +fld1 fld2 +2 2 +DROP TABLE t2, t1; +# ADD VC INDEX and ADD FK IN SAME INPLACE ALTER +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, +fld2 INT AS (fld1) VIRTUAL); +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +SET foreign_key_checks = 0; +ALTER TABLE t2 ADD INDEX(fld2), ADD FOREIGN KEY (fld1) REFERENCES t1(fld1) +ON UPDATE CASCADE, ALGORITHM=inplace; +SET foreign_key_checks = 1; +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +fld2 +2 +SELECT * FROM t2; +fld1 fld2 +2 2 +DROP TABLE t2, t1; +# ADD VC INDEX and DROP FK IN SAME COPY ALTER +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, +fld2 INT AS (fld1) VIRTUAL, +CONSTRAINT fidx FOREIGN KEY(fld1) REFERENCES t1(fld1) +ON UPDATE CASCADE); +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +ALTER TABLE t2 ADD INDEX(fld2), DROP FOREIGN KEY fidx, ALGORITHM=copy; +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +fld2 +1 +SELECT * FROM t2; +fld1 fld2 +1 1 +DROP TABLE t2, t1; +# ADD VC INDEX and DROP FK IN SAME INPLACE ALTER +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, +fld2 INT AS (fld1) VIRTUAL, +CONSTRAINT fidx FOREIGN KEY(fld1) REFERENCES t1(fld1) +ON UPDATE CASCADE); +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +SET foreign_key_checks = 0; +ALTER TABLE t2 ADD INDEX(fld2), DROP FOREIGN KEY fidx, ALGORITHM=inplace; +SET foreign_key_checks = 1; +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +fld2 +1 +SELECT * FROM t2; +fld1 fld2 +1 1 +DROP TABLE t2, t1; +# DROP VC INDEX and ADD FK IN SAME COPY ALTER +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, +fld2 INT AS (fld1) VIRTUAL, +KEY idx(fld2)); +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +ALTER TABLE t2 DROP INDEX idx, ADD FOREIGN KEY (fld1) REFERENCES t1(fld1) +ON UPDATE CASCADE, ALGORITHM=COPY; +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +fld2 +2 +SELECT * FROM t2; +fld1 fld2 +2 2 +DROP TABLE t2, t1; +# DROP VC INDEX and ADD FK IN SAME INPLACE ALTER +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, +fld2 INT AS (fld1) VIRTUAL, +KEY idx(fld2)); +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +SET foreign_key_checks = 0; +ALTER TABLE t2 DROP INDEX idx, ADD FOREIGN KEY (fld1) REFERENCES t1(fld1) +ON UPDATE CASCADE, ALGORITHM=INPLACE; +SET foreign_key_checks = 1; +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +fld2 +2 +SELECT * FROM t2; +fld1 fld2 +2 2 +DROP TABLE t2, t1; +# DROP VC INDEX and DROP FK IN SAME COPY ALTER +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, +fld2 INT AS (fld1) VIRTUAL, +KEY idx(fld2), +CONSTRAINT fidx FOREIGN KEY(fld1) REFERENCES t1(fld1) +ON UPDATE CASCADE); +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +ALTER TABLE t2 DROP KEY idx, DROP FOREIGN KEY fidx, ALGORITHM=COPY; +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +fld2 +1 +SELECT * FROM t2; +fld1 fld2 +1 1 +DROP TABLE t2, t1; +# DROP VC INDEX and DROP FK IN SAME INPLACE ALTER +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, +fld2 INT AS (fld1) VIRTUAL, +KEY idx(fld2), +CONSTRAINT fidx FOREIGN KEY(fld1) REFERENCES t1(fld1) +ON UPDATE CASCADE); +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +SET foreign_key_checks = 0; +ALTER TABLE t2 DROP KEY idx, DROP FOREIGN KEY fidx, ALGORITHM=INPLACE; +SET foreign_key_checks = 1; +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +fld2 +1 +SELECT * FROM t2; +fld1 fld2 +1 1 +DROP TABLE t2, t1; diff --git a/mysql-test/suite/gcol/r/innodb_virtual_fk_restart.result b/mysql-test/suite/gcol/r/innodb_virtual_fk_restart.result new file mode 100644 index 00000000000..25faeaf4e84 --- /dev/null +++ b/mysql-test/suite/gcol/r/innodb_virtual_fk_restart.result @@ -0,0 +1,44 @@ +# +# Bug#22469130: FOREIGN KEY ON DELETE CASCADE NOT ALLOWED +# WHEN A VIRTUAL INDEX EXISTS. +# Add the VIRTUAL INDEX contains fk constraINT column +# using INPLACE alter operatiON +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY) engine=innodb; +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT NOT NULL, +fld3 INT AS (fld2) VIRTUAL, KEY(fld1), +FOREIGN KEY(fld1) REFERENCES t1(fld1) ON UPDATE CASCADE) engine=innodb; +INSERT INTO t1(fld1) VALUES(1); +INSERT INTO t2(fld1, fld2) VALUES(1, 2); +UPDATE t1 SET fld1= 2; +SELECT fld3, fld1 FROM t2; +fld3 fld1 +2 2 +alter TABLE t2 ADD INDEX vk(fld3, fld1), ALGORITHM=INPLACE; +UPDATE t1 SET fld1=3; +SELECT fld3, fld1 FROM t2; +fld3 fld1 +2 3 +DROP TABLE t2, t1; +# TEMPORARY TABLE NAME and CHILD TABLE NAME are same +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY) engine=innodb; +CREATE TABLE t2(fld1 INT NOT NULL, +fld2 INT AS (fld1) VIRTUAL, +KEY(fld2), +FOREIGN KEY(fld1) REFERENCES t1(fld1) +ON UPDATE CASCADE) engine=innodb; +INSERT INTO t1 VALUES(1), (2); +INSERT INTO t2 VALUES(1, DEFAULT), (2, default); +CREATE TEMPORARY TABLE t2 (fld1 INT NOT NULL)ENGINE=INNODB; +UPDATE t1 SET fld1= 3 WHERE fld1= 2; +connect con1,localhost,root,,test; +SELECT fld2 FROM t2; +fld2 +1 +3 +CHECK TABLE t2; +Table Op Msg_type Msg_text +test.t2 check status OK +connection default; +disconnect con1; +DROP TABLE t2; +DROP TABLE t2, t1; diff --git a/mysql-test/suite/gcol/r/innodb_virtual_index.result b/mysql-test/suite/gcol/r/innodb_virtual_index.result new file mode 100644 index 00000000000..375c62bd173 --- /dev/null +++ b/mysql-test/suite/gcol/r/innodb_virtual_index.result @@ -0,0 +1,196 @@ +# +# Bug 21922176 - PREBUILT->SEARCH_TUPLE CREATED WITHOUT INCLUDING +# THE NUMBER OF VIRTUAL COLUMNS +# +CREATE TABLE t1 (a INT, a1 INT GENERATED ALWAYS AS (a) VIRTUAL, a2 INT +GENERATED ALWAYS AS (a) VIRTUAL, a3 INT GENERATED ALWAYS AS (a) VIRTUAL, a4 +INT GENERATED ALWAYS AS (a) VIRTUAL, a5 INT GENERATED ALWAYS AS (a) VIRTUAL, +a6 INT GENERATED ALWAYS AS (a) VIRTUAL, a7 INT GENERATED ALWAYS AS (a) +VIRTUAL, a8 INT GENERATED ALWAYS AS (a) VIRTUAL, a9 INT GENERATED ALWAYS AS +(a) VIRTUAL, INDEX(a1, a2, a3, a4, a5, a6, a7, a8, a9)) ; +INSERT INTO t1(a) VALUES(10); +SELECT * FROM t1 WHERE a1=10 AND a2 = 10 AND a3 =10 AND a4 = 10 AND a5=10 AND +a6=10 AND a7=10 AND a8=10 AND a9=10; +a a1 a2 a3 a4 a5 a6 a7 a8 a9 +10 10 10 10 10 10 10 10 10 10 +DROP TABLE t1; +# +# Bug 22572997 - GCOL:INNODB: FAILING ASSERTION: N < REC_OFFS_N_FIELDS( +# OFFSETS) +# +SET @@SESSION.sql_mode=0; +CREATE TABLE t1( +c1 int(1)AUTO_INCREMENT, +c2 int(1), +c3 int(1)GENERATED ALWAYS AS ((c2 + c2)) VIRTUAL, +c4 int(1)GENERATED ALWAYS AS ((c3 + c2)) VIRTUAL, +c5 date, +c6 date GENERATED ALWAYS AS((c5 + interval 30 day)) VIRTUAL, +c7 DATE, +c8 time, +c9 DATE GENERATED ALWAYS AS(addtime(c7,c8)) VIRTUAL, +c10 time GENERATED ALWAYS AS(addtime(c7,c8)) VIRTUAL, +c11 DATE GENERATED ALWAYS AS(addtime(c9,c8)) VIRTUAL, +c12 CHAR(1), +c13 CHAR(1)GENERATED ALWAYS AS (concat(c12,c12)) VIRTUAL, +c14 CHAR(2)GENERATED ALWAYS AS (concat(c13,'x')) VIRTUAL, +PRIMARY KEY(c1), +KEY c4_6(c4,c11) +)ENGINE=InnoDB DEFAULT CHARSET=latin1; +CREATE TABLE t2( +c1 int(1)AUTO_INCREMENT, +c2 int(1), +c3 int(1)GENERATED ALWAYS AS ((c2 + c2)) VIRTUAL, +c4 int(1)GENERATED ALWAYS AS ((c3 + c2)) VIRTUAL, +c5 date, +c6 date GENERATED ALWAYS AS((c5 + interval 30 day)) VIRTUAL, +c6a date GENERATED ALWAYS AS((c6 + interval 30 day)) VIRTUAL, +c7 DATE, +c8 time, +c9 DATE GENERATED ALWAYS AS(addtime(c7,c8)) VIRTUAL, +c10 time GENERATED ALWAYS AS(addtime(c7,c8)) VIRTUAL, +c11 DATE GENERATED ALWAYS AS(addtime(c9,c8)) VIRTUAL, +c11a time GENERATED ALWAYS AS(addtime(c7,c10)) VIRTUAL, +c12 CHAR(1), +c13 CHAR(2)GENERATED ALWAYS AS (concat(c12,c12)) VIRTUAL, +c14 CHAR(4)GENERATED ALWAYS AS (concat(c13,'x')) VIRTUAL, +PRIMARY KEY(c1), +KEY c13(c13), +KEY c4_6(c4,c11) +)ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t2(c1,c2,c5,c7,c8,c12)VALUES (0,0,0,0,0,'v'); +CREATE TABLE t3( +c1 int(1)AUTO_INCREMENT, +c2 int(1), +c3 int(1)GENERATED ALWAYS AS ((c2 + c2)) VIRTUAL, +c4 int(1)GENERATED ALWAYS AS ((c3 + c2)) VIRTUAL, +c5 date, +c7 DATE, +c8 time, +c9 DATE GENERATED ALWAYS AS(addtime(c7,c8)) VIRTUAL, +c11 DATE GENERATED ALWAYS AS(addtime(c9,c8)) VIRTUAL, +c12 CHAR(1), +PRIMARY KEY(c1), +KEY c4_6(c4,c11) +)ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t3(c1,c2,c5,c7,c8,c12)VALUES +(0,0,0,0,0,'q'),(0,0,0,0,0,'g'),(0,0,0,0,0,'l'),(0,0,0,0,0,1),(0,0,0,0,0,'v'), +(0,1,0,0,0,'c'),(0,0,0,0,0,'x'); +UPDATE +t2 AS O1,t3 AS O2 +SET O1.c12=1 +WHERE O1.c14 NOT IN +( +SELECT +DISTINCT I1.c14 AS y +FROM t1 AS I1 +ORDER BY I1.c14); +SET @@SESSION.sql_mode=default; +DROP TABLE t1, t2, t3; +# +# Bug 22650296 - ASSERTION IN INNOBASE_BUILD_COL_MAP, ALTER +# +CREATE TABLE `ibstd_08` ( +`nc00577` tinyint(4) DEFAULT NULL, +`nc07844` varchar(41) DEFAULT NULL, +`gc01908` point NOT NULL, +`nc04156` char(17) DEFAULT NULL, +`nc09536` longblob NOT NULL, +`nc09231` decimal(10,0) NOT NULL, +`a` int(11) NOT NULL, +`b` varchar(198) NOT NULL, +`nc04560` mediumtext, +`c` char(187) DEFAULT NULL, +`vbidxcol` char(3) GENERATED ALWAYS AS (substr(`b`,1,3)) VIRTUAL, +`gc00881` polygon NOT NULL, +`nc05121` int(11) NOT NULL DEFAULT '85941481', +KEY `a` (`a`), +KEY `b` (`b`(3),`a`), +KEY `c` (`c`(99),`b`(25)), +KEY `b_2` (`b`(5),`c`(10),`a`), +KEY `vbidxcol` (`vbidxcol`), +KEY `a_2` (`a`,`vbidxcol`), +KEY `vbidxcol_2` (`vbidxcol`), +FULLTEXT KEY `ftsic` (`c`,`b`) +) ENGINE=InnoDB; +Warnings: +Note 1831 Duplicate index `vbidxcol_2`. This is deprecated and will be disallowed in a future release +ALTER TABLE ibstd_08 ADD COLUMN nc07006 BIGINT AUTO_INCREMENT NOT NULL , ADD KEY auto_nc07006(nc07006); +Warnings: +Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID +DROP TABLE ibstd_08; +# +# Bug 22899305 - GCOLS: FAILING ASSERTION: !(COL->PRTYPE & 256) +# AND SEGFAULT +# +set sql_mode=""; +create table t (a int) engine=innodb; +create table s ( +b int generated always as (1) virtual, +c int, +d int generated always as (1) virtual, +key (d) +) engine=innodb; +insert into t(a) values ((select d from s for update)); +insert into s(c) values (''); +Warnings: +Warning 1366 Incorrect integer value: '' for column 'c' at row 1 +SET sql_mode = default; +drop table if exists t,s; +# +# Bug 23014521 - GCOL:INNODB: FAILING ASSERTION: !IS_V +# +CREATE TABLE t1 ( +col1 int(11) NOT NULL, +col2 int(11) DEFAULT NULL, +col3 int(11) NOT NULL, +col4 int(11) DEFAULT NULL, +col5 int(11) GENERATED ALWAYS AS ((col1 % col4)) VIRTUAL, +col6 int(11) GENERATED ALWAYS AS ((col2 - col4)) VIRTUAL, +col5x int(11) GENERATED ALWAYS AS ((col3 / col2)) VIRTUAL, +col6b varchar(20) GENERATED ALWAYS AS (col2) VIRTUAL, +col6x int(11) GENERATED ALWAYS AS ((col2 % col1)) VIRTUAL, +col7 int(11) GENERATED ALWAYS AS ((col6x + col5x)) VIRTUAL, +col8 int(11) GENERATED ALWAYS AS ((col5x / col5)) VIRTUAL, +col7x int(11) GENERATED ALWAYS AS ((col5x + col5)) VIRTUAL, +col8x int(11) GENERATED ALWAYS AS ((col5 / col5x)) VIRTUAL, +col9 text, +col2b varchar(20) GENERATED ALWAYS AS (col4) VIRTUAL, +col8a int(11) GENERATED ALWAYS AS (col2) VIRTUAL, +col4b varchar(20) GENERATED ALWAYS AS (col4) VIRTUAL, +col1c int(11) GENERATED ALWAYS AS ((col2 * col1)) VIRTUAL, +extra int(11) DEFAULT NULL, +col5c int(11) GENERATED ALWAYS AS ((col1 / col1)) VIRTUAL, +col6a bigint(20) GENERATED ALWAYS AS ((col3 / col1)) VIRTUAL, +col1a varchar(20) GENERATED ALWAYS AS (col6) VIRTUAL, +col6c int(11) GENERATED ALWAYS AS ((col2 % col2)) VIRTUAL, +col7c bigint(20) GENERATED ALWAYS AS ((col2 / col1)) VIRTUAL, +col2c int(11) GENERATED ALWAYS AS ((col5 % col5)) VIRTUAL, +col1b int(11) GENERATED ALWAYS AS ((col1 / col2)) VIRTUAL, +col3b bigint(20) GENERATED ALWAYS AS ((col6x % col6)) VIRTUAL, +UNIQUE KEY idx7 (col1,col3,col2), +UNIQUE KEY uidx (col9(10)), +KEY idx15 (col9(10) DESC,col2 DESC), +KEY idx10 (col9(10) DESC,col1 DESC), +KEY idx11 (col6x DESC), +KEY idx6 (col9(10) DESC,col7 DESC), +KEY idx14 (col6 DESC) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +ALTER TABLE t1 ADD COLUMN col7a INT GENERATED ALWAYS AS (col5x % col6x) +VIRTUAL, ADD FULLTEXT KEY ftidx ( col9 ), algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY +CREATE FULLTEXT INDEX idx ON t1(col9); +Warnings: +Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID +ALTER TABLE t1 ADD COLUMN col7a INT GENERATED ALWAYS AS (col5x % col6x) +VIRTUAL, ADD FULLTEXT KEY ftidx ( col9 ), algorithm=inplace; +DROP TABLE t1; +CREATE TABLE t1 ( +col1 int(11) NOT NULL, +col2 int(11) DEFAULT NULL, +col3 int(11) NOT NULL, +col4 int(11) DEFAULT NULL) engine=innodb; +ALTER TABLE t1 ADD COLUMN col7a INT GENERATED ALWAYS AS (col1 % col2) +VIRTUAL, ADD UNIQUE index idx (col1), algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY +DROP TABLE t1; diff --git a/mysql-test/suite/gcol/r/innodb_virtual_purge.result b/mysql-test/suite/gcol/r/innodb_virtual_purge.result new file mode 100644 index 00000000000..658f49b4b31 --- /dev/null +++ b/mysql-test/suite/gcol/r/innodb_virtual_purge.result @@ -0,0 +1,140 @@ +# +# Bug#21869656 UNDO LOG DOES NOT CONTAIN ENOUGH INFORMATION +# ON INDEXED VIRTUAL COLUMNS +# +CREATE TABLE t1 (a INT, b INT, +a1 INT GENERATED ALWAYS AS (a) VIRTUAL, INDEX(a1) +) ENGINE=InnoDB; +INSERT INTO t1 (a,b) VALUES(1,1); +connect con1,localhost,root,,; +CREATE TABLE t0 (a INT) ENGINE=InnoDB; +BEGIN; +SELECT * FROM t0; +a +connection default; +UPDATE t1 SET a=0; +ALTER TABLE t1 DROP COLUMN a1, ALGORITHM=INPLACE; +ALTER TABLE t1 ADD COLUMN b1 INT GENERATED ALWAYS AS (b) VIRTUAL, ADD +INDEX(b1), +ALGORITHM=INPLACE; +connection con1; +COMMIT; +UPDATE t1 SET a=1; +connection default; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT b1 FROM t1; +b1 +1 +ALTER TABLE t1 +ADD COLUMN a1 INT GENERATED ALWAYS AS (a) VIRTUAL, +ADD COLUMN a2 INT GENERATED ALWAYS AS (a + b) VIRTUAL, +ADD COLUMN a3 INT GENERATED ALWAYS AS (a - b) VIRTUAL, +ADD COLUMN a4 INT GENERATED ALWAYS AS (a - b) VIRTUAL, +ADD INDEX(a1), ADD INDEX(a2), ADD INDEX(a3), ALGORITHM=INPLACE; +CREATE TABLE t2 ( +a BLOB, +b BLOB, +c BLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, +h VARCHAR(10) DEFAULT NULL +) ENGINE=InnoDB; +INSERT INTO t2 VALUES (REPEAT('g', 16000), REPEAT('x', 16000), DEFAULT, 'kk'); +INSERT INTO t2 VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, 'mm'); +CREATE INDEX idx ON t2(c(100)); +INSERT INTO t1 (a, b) VALUES(1,1); +connection con1; +BEGIN; +SELECT * FROM t0; +a +connection default; +UPDATE t1 SET a=0; +affected rows: 2 +info: Rows matched: 2 Changed: 2 Warnings: 0 +UPDATE t1 SET b=0; +affected rows: 2 +info: Rows matched: 2 Changed: 2 Warnings: 0 +ALTER TABLE t1 DROP COLUMN a3, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +UPDATE t1 SET a=2; +affected rows: 2 +info: Rows matched: 2 Changed: 2 Warnings: 0 +ALTER TABLE t1 DROP COLUMN a2, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +UPDATE t1 SET b=3; +affected rows: 2 +info: Rows matched: 2 Changed: 2 Warnings: 0 +ALTER TABLE t1 ADD COLUMN b2 INT GENERATED ALWAYS AS (b) VIRTUAL, +ADD INDEX(b2), ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +UPDATE t1 SET b=9; +affected rows: 2 +info: Rows matched: 2 Changed: 2 Warnings: 0 +ALTER TABLE t1 ADD COLUMN b3 INT GENERATED ALWAYS AS (a) VIRTUAL, +ADD INDEX(b3), ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +UPDATE t1 SET b=10; +affected rows: 2 +info: Rows matched: 2 Changed: 2 Warnings: 0 +ALTER TABLE t2 DROP COLUMN c; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +UPDATE t2 SET a = REPEAT('s', 6000) WHERE a like 'aaa%'; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +ALTER TABLE t2 ADD COLUMN x1 BLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, +ADD COLUMN x2 BLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, +ADD INDEX(x1(100), x2(120)), ADD INDEX (x1(20)); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +UPDATE t1 SET a=5; +affected rows: 2 +info: Rows matched: 2 Changed: 2 Warnings: 0 +UPDATE t2 SET a = REPEAT('m', 16000) WHERE a like 'sss%'; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +ALTER TABLE t1 DROP COLUMN b2, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +UPDATE t1 SET a=6; +affected rows: 2 +info: Rows matched: 2 Changed: 2 Warnings: 0 +ALTER TABLE t2 DROP COLUMN x1, DROP COLUMN x2, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +UPDATE t2 SET a = REPEAT('x', 1000) WHERE a like 'mmm%'; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +ALTER TABLE t1 DROP INDEX b3; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +UPDATE t1 SET a=100; +affected rows: 2 +info: Rows matched: 2 Changed: 2 Warnings: 0 +connection con1; +COMMIT; +disconnect con1; +connection default; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT b1 FROM t1; +b1 +10 +10 +SELECT * FROM t1; +a b b1 a1 a4 b3 +100 10 10 100 90 100 +100 10 10 100 90 100 +CHECK TABLE t2; +Table Op Msg_type Msg_text +test.t2 check status OK +DROP TABLE t2, t1, t0; +CREATE TABLE t1 (a VARCHAR(30), b INT, a2 VARCHAR(30) GENERATED ALWAYS AS (a) VIRTUAL); +CREATE INDEX idx ON t1(a2(10), b, a2(20)); +ERROR 42S21: Duplicate column name 'a2' +DROP TABLE t1; diff --git a/mysql-test/suite/gcol/r/innodb_wl8114.result b/mysql-test/suite/gcol/r/innodb_wl8114.result new file mode 100644 index 00000000000..42e65101365 --- /dev/null +++ b/mysql-test/suite/gcol/r/innodb_wl8114.result @@ -0,0 +1,52 @@ +CREATE TABLE t_8114 (a int) ENGINE = INNODB; +ALTER TABLE t_8114 ADD b INT GENERATED ALWAYS AS (a) VIRTUAL; +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE "%t_8114"; +NAME +test/t_8114 +SELECT NAME, POS, MTYPE, PRTYPE, LEN FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS WHERE TABLE_ID IN (SELECT TABLE_ID FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE "%t_8114"); +NAME POS MTYPE PRTYPE LEN +a 0 6 1027 4 +b 65537 6 9219 4 +INSERT INTO t_8114 VALUES (9, default); +INSERT INTO t_8114 VALUES (3, default); +INSERT INTO t_8114 VALUES (1, default); +INSERT INTO t_8114 VALUES (5, default); +SELECT * FROM t_8114; +a b +9 9 +3 3 +1 1 +5 5 +DROP TABLE t_8114; +CREATE TABLE t_8114 (Column_1 CHAR(5) GENERATED ALWAYS AS (PI()+5), Column_2 CHAR(5)) engine=innodb; +SELECT NAME, FLAG, N_COLS FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE "%t_8114"; +NAME FLAG N_COLS +test/t_8114 33 4 +SELECT NAME, POS, MTYPE, PRTYPE, LEN FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS WHERE TABLE_ID IN (SELECT TABLE_ID FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE "%t_8114"); +NAME POS MTYPE PRTYPE LEN +Column_2 0 2 524542 5 +Column_1 65536 2 532734 5 +INSERT INTO t_8114 VALUES (default, "aa"); +INSERT INTO t_8114 VALUES (default, "bb"); +INSERT INTO t_8114 VALUES (default, "ee"); +INSERT INTO t_8114 VALUES (default, "pp"); +SELECT * FROM t_8114; +Column_1 Column_2 +8.142 aa +8.142 bb +8.142 ee +8.142 pp +ALTER TABLE t_8114 DROP Column_1; +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE "%t_8114"; +NAME +test/t_8114 +SELECT NAME, POS, MTYPE, PRTYPE, LEN FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS WHERE TABLE_ID IN (SELECT TABLE_ID FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE "%t_8114"); +NAME POS MTYPE PRTYPE LEN +Column_2 0 2 524542 5 +SELECT * FROM t_8114; +Column_2 +aa +bb +ee +pp +DROP TABLE t_8114; diff --git a/mysql-test/suite/gcol/r/main_alter_table.result b/mysql-test/suite/gcol/r/main_alter_table.result new file mode 100644 index 00000000000..864169ee16c --- /dev/null +++ b/mysql-test/suite/gcol/r/main_alter_table.result @@ -0,0 +1,52 @@ +# +# Bug#22017616: ASSERTION FAILED: TABLE_SHARE->IS_MISSING_PRIMARY_KEY() +# == M_PREBUILT->CLUST_IND +# +# Ensure that adding indexes with virtual columns are not promoted to +# primary keys +# +# Base line with normal column - should be promoted +CREATE TABLE t0(a INT NOT NULL) ENGINE=INNODB; +ALTER TABLE t0 ADD UNIQUE INDEX (a); +# Case a: Create table with virtual unique not null column +CREATE TABLE t1(a POINT GENERATED ALWAYS AS (POINT(1,1)) VIRTUAL UNIQUE) ENGINE=INNODB; +SELECT * FROM t1; +a +# Case b: Create table with index on virtual point column +CREATE TABLE t2(a POINT GENERATED ALWAYS AS (POINT(1,1)) VIRTUAL, UNIQUE INDEX no_pk(a(1))) ENGINE=INNODB; +SELECT * FROM t2; +a +# Case c: Add unique index on virtual point column +CREATE TABLE t3(a POINT GENERATED ALWAYS AS (POINT(1,1)) VIRTUAL) +ENGINE=INNODB; +ALTER TABLE t3 ADD UNIQUE INDEX (a(1)); +SELECT * FROM t3; +a +# Case d: Add unique index on virtual blob column +CREATE TABLE t4 (a BLOB, b BLOB GENERATED ALWAYS AS (a) VIRTUAL) ENGINE=INNODB; +ALTER TABLE t4 ADD UNIQUE INDEX (b(1)); +SELECT * FROM t4; +a b +# Query I_S to verify that 'a' is promoted to pk only when it +# isn't virtual +SELECT T.NAME AS TABLE_NAME, I.NAME AS INDEX_NAME, +CASE (I.TYPE & 3) +WHEN 3 THEN "yes" + ELSE "no" END AS IS_PRIMARY_KEY, +F.NAME AS FIELD_NAME, F.POS AS FIELD_POS FROM +INFORMATION_SCHEMA.INNODB_SYS_TABLES AS T JOIN +INFORMATION_SCHEMA.INNODB_SYS_INDEXES AS I JOIN +INFORMATION_SCHEMA.INNODB_SYS_FIELDS AS F +ON I.INDEX_ID = F.INDEX_ID AND I.TABLE_ID = T.TABLE_ID +WHERE T.NAME LIKE 'test/%'; +TABLE_NAME INDEX_NAME IS_PRIMARY_KEY FIELD_NAME FIELD_POS +test/t0 a yes a 0 +test/t1 a no a 0 +test/t2 no_pk no a 0 +test/t3 a no a 0 +test/t4 b no b 0 +DROP TABLE t0; +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +DROP TABLE t4; diff --git a/mysql-test/suite/gcol/r/main_mysqldump.result b/mysql-test/suite/gcol/r/main_mysqldump.result new file mode 100644 index 00000000000..78d99a0bdb0 --- /dev/null +++ b/mysql-test/suite/gcol/r/main_mysqldump.result @@ -0,0 +1,49 @@ +CREATE DATABASE dump_generated; +USE dump_generated; +CREATE TABLE t1 (pk INTEGER, a INTEGER, b INTEGER, c VARCHAR(16), +sum INTEGER GENERATED ALWAYS AS (a+b), +sub VARCHAR(4) GENERATED ALWAYS AS (SUBSTRING(c, 1, 4)), +key k1(sum), +key k2(sub) +) engine=innodb; +INSERT INTO t1(pk, a, b, c) VALUES (1, 11, 12, 'oneone'), (2, 21, 22, 'twotwo'); +SELECT * FROM t1; +pk a b c sum sub +1 11 12 oneone 23 oneo +2 21 22 twotwo 43 twot +DELETE FROM t1; +SELECT * FROM t1; +pk a b c sum sub +1 11 12 oneone 23 oneo +2 21 22 twotwo 43 twot +DELETE FROM t1; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t1; +SELECT * FROM t1; +pk a b c sum sub +1 11 12 oneone 23 oneo +2 21 22 twotwo 43 twot +DROP TABLE t1; +# A table with regular columns after generated +CREATE TABLE t2 (pk INTEGER, a INTEGER, b INTEGER, +sum INTEGER GENERATED ALWAYS AS (a+b), +c VARCHAR(16), +key k1(sum) +) engine=innodb; +INSERT INTO t2(pk, a, b, c) VALUES (1, 11, 12, 'oneone'), (2, 21, 22, 'twotwo'); +SELECT * FROM t2; +pk a b sum c +1 11 12 23 oneone +2 21 22 43 twotwo +DELETE FROM t2; +SELECT * FROM t2; +pk a b sum c +1 11 12 23 oneone +2 21 22 43 twotwo +DELETE FROM t2; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t2.txt' INTO TABLE t2; +SELECT * FROM t2; +pk a b sum c +1 11 12 23 oneone +2 21 22 43 twotwo +DROP TABLE t2; +DROP DATABASE dump_generated; diff --git a/mysql-test/suite/gcol/r/rpl_gcol.result b/mysql-test/suite/gcol/r/rpl_gcol.result new file mode 100644 index 00000000000..a7950b75bd0 --- /dev/null +++ b/mysql-test/suite/gcol/r/rpl_gcol.result @@ -0,0 +1,33 @@ +SET @@session.default_storage_engine = 'InnoDB'; +include/master-slave.inc +[connection master] +connection master; +create table t1 (a int, b int generated always as (a+1) virtual); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (1,default); +insert into t1 values (2,default); +select * from t1; +a b +1 2 +2 3 +connection slave; +select * from t1; +a b +1 2 +2 3 +connection master; +drop table t1; +connection slave; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2,t3; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS trg1; +DROP TRIGGER IF EXISTS trg2; +set sql_warnings = 0; +include/rpl_end.inc diff --git a/mysql-test/suite/gcol/t/gcol_archive.test b/mysql-test/suite/gcol/t/gcol_archive.test new file mode 100644 index 00000000000..6dce34e1d6e --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_archive.test @@ -0,0 +1,44 @@ +################################################################################ +# t/gcol_archive.test # +# # +# Purpose: # +# ARCHIVE branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-02 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +--source include/have_archive.inc +SET @@session.default_storage_engine = 'archive'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests +--source suite/gcol/inc/gcol_unsupported_storage_engines.inc + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_blackhole.test b/mysql-test/suite/gcol/t/gcol_blackhole.test new file mode 100644 index 00000000000..bf0d3fb3022 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_blackhole.test @@ -0,0 +1,44 @@ +################################################################################ +# t/gcol_blackhole.test # +# # +# Purpose: # +# BLACKHOLE branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-02 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +--source include/have_blackhole.inc +SET @@session.default_storage_engine = 'blackhole'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests +--source suite/gcol/inc/gcol_unsupported_storage_engines.inc + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_blocked_sql_funcs_innodb.test b/mysql-test/suite/gcol/t/gcol_blocked_sql_funcs_innodb.test new file mode 100644 index 00000000000..a1024b33ad6 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_blocked_sql_funcs_innodb.test @@ -0,0 +1,47 @@ +################################################################################ +# t/gcol_supported_sql_funcs.test # +# # +# Purpose: # +# Test SQL functions not allowed for generated columns # +# InnoDB branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-08-31 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +--source include/have_innodb.inc +eval SET @@session.default_storage_engine = 'InnoDB'; + +let $skip_full_text_check = 1; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +--source suite/gcol/inc/gcol_blocked_sql_funcs_main.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_blocked_sql_funcs_myisam.test b/mysql-test/suite/gcol/t/gcol_blocked_sql_funcs_myisam.test new file mode 100644 index 00000000000..0f967ee85d0 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_blocked_sql_funcs_myisam.test @@ -0,0 +1,44 @@ +################################################################################ +# t/gcol_supported_sql_funcs.test # +# # +# Purpose: # +# Test SQL functions not allowed for generated columns # +# MyISAM branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-08-31 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +eval SET @@session.default_storage_engine = 'MyISAM'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +--source suite/gcol/inc/gcol_blocked_sql_funcs_main.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_bug20746926.test b/mysql-test/suite/gcol/t/gcol_bug20746926.test new file mode 100644 index 00000000000..8028823f9a7 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_bug20746926.test @@ -0,0 +1,28 @@ +--echo #Bug #20746926: GENERATED COLUMNS: INVALID READ OF THD WHEN WARNINGS +--echo # +--echo # Testing cmp_item_datetime +connect(con1,localhost,root,,); +--disable_warnings +set sql_mode=''; +--enable_warnings +create table t1 ( +a date not null, +b mediumtext generated always as ((a not in (a,a))) virtual, +c timestamp generated always as ((a not in (b,b))) stored +); +insert t1(a) values(7777777777); +show warnings; +disconnect con1; +--source include/wait_until_disconnected.inc + +connect(con2,localhost,root,,); +--disable_warnings +set sql_mode=''; +--enable_warnings +insert t1(a) values(6666666666); +show warnings; + +drop table t1; +disconnect con2; +--source include/wait_until_disconnected.inc +connection default; diff --git a/mysql-test/suite/gcol/t/gcol_bugfixes.test b/mysql-test/suite/gcol/t/gcol_bugfixes.test new file mode 100644 index 00000000000..7ca50e62a7b --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_bugfixes.test @@ -0,0 +1,538 @@ +################################################################################ +# t/gcol_bugfixes.test # +# # +# Purpose: # +# Bug fixes that only need one storage engine # +# # +################################################################################ + +--source include/have_innodb.inc +--echo # Bug#21230709: Alter table statement fails with division by zero + +CREATE TABLE t1 ( + col1 INTEGER NOT NULL, + col2 INTEGER NOT NULL, + col3 INTEGER NOT NULL, + gcol1 INTEGER GENERATED ALWAYS AS (col3 + col3) VIRTUAL, + col4 INTEGER DEFAULT NULL, + col5 INTEGER DEFAULT NULL, + col6 INTEGER DEFAULT NULL, + col7 INTEGER DEFAULT NULL, + col8 INTEGER DEFAULT NULL, + col9 INTEGER DEFAULT NULL, + col10 INTEGER DEFAULT NULL, + col11 INTEGER DEFAULT NULL, + col12 INTEGER DEFAULT NULL, + col13 INTEGER DEFAULT NULL, + col14 INTEGER DEFAULT NULL, + col15 INTEGER DEFAULT NULL, + col16 INTEGER DEFAULT NULL, + col17 INTEGER DEFAULT NULL, + col18 INTEGER DEFAULT NULL, + col19 INTEGER DEFAULT NULL, + col20 INTEGER DEFAULT NULL, + col21 INTEGER DEFAULT NULL, + col22 INTEGER DEFAULT NULL, + col23 INTEGER DEFAULT NULL, + col24 INTEGER DEFAULT NULL, + col25 INTEGER DEFAULT NULL, + col26 INTEGER DEFAULT NULL, + col27 INTEGER DEFAULT NULL, + col28 INTEGER DEFAULT NULL, + col29 INTEGER DEFAULT NULL, + col30 INTEGER DEFAULT NULL, + col31 INTEGER DEFAULT NULL, + col32 INTEGER DEFAULT NULL, + col33 INTEGER DEFAULT NULL, + gcol2 INTEGER GENERATED ALWAYS AS (col2 + col2) VIRTUAL, + gcol3 INTEGER GENERATED ALWAYS AS (gcol2 / gcol2) VIRTUAL, + PRIMARY KEY (col1), + KEY idx1 (gcol1) +) engine=innodb; + +INSERT INTO t1 (col1, col2, col3) + VALUES (0,1,2), (1,2,3), (2,3,4), (3,4,5), (4,5,6); + +# This is likely needed to ensure we allocate a new record buffer that +# contains zero in the mis-used field +FLUSH TABLE t1; + +ALTER TABLE t1 ADD COLUMN extra INTEGER; + +DROP TABLE t1; + +--echo # +--echo # Bug 21340801 WL8149:ASSERTION `IS_VIRTUAL_GCOL()' FAILED +--echo # + +CREATE TABLE t1 ( + c_blob BLOB, + c_blob_key BLOB GENERATED ALWAYS AS (REPEAT(c_blob,15)) STORED, + KEY (c_blob_key(200)) +); + +INSERT INTO t1 (c_blob) VALUES ('xceks'); + +DROP TABLE t1; + +--echo # +--echo # Bug#21345972 WL8149:JOIN_CACHE::FILTER_VIRTUAL_GCOL_BASE_COLS(): ASSERTION `FALSE' FAILED. +--echo # + +CREATE TABLE c ( + pk INTEGER AUTO_INCREMENT, + col_int_nokey INTEGER, + gcol_int_key INTEGER GENERATED ALWAYS AS (col_int_nokey + col_int_nokey) VIRTUAL, + col_date_nokey DATE, + gcol_date_key DATE GENERATED ALWAYS AS (DATE_ADD(col_date_nokey,interval 30 day)) VIRTUAL, + col_datetime_nokey DATETIME, + col_time_nokey TIME, + gcol_datetime_key DATETIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL, + gcol_time_key TIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL, + col_varchar_nokey VARCHAR(1), + gcol_varchar_key VARCHAR(2) GENERATED ALWAYS AS (CONCAT(col_varchar_nokey, col_varchar_nokey)) VIRTUAL, + PRIMARY KEY (pk), + UNIQUE KEY (gcol_int_key), + UNIQUE KEY (gcol_varchar_key), + UNIQUE KEY (gcol_date_key), + KEY (gcol_time_key), + KEY (gcol_datetime_key), + UNIQUE KEY (gcol_int_key, gcol_varchar_key), + KEY (gcol_int_key, col_int_nokey), + KEY(gcol_int_key,gcol_date_key), + KEY(gcol_int_key, gcol_time_key), + KEY(gcol_int_key, gcol_datetime_key), + UNIQUE KEY(gcol_date_key,gcol_time_key,gcol_datetime_key), + UNIQUE KEY (gcol_varchar_key, col_varchar_nokey), + UNIQUE KEY (gcol_int_key, gcol_varchar_key, gcol_date_key, gcol_time_key, gcol_datetime_key) +) ENGINE=INNODB; + +INSERT IGNORE INTO c ( col_int_nokey, col_date_nokey, col_time_nokey, col_datetime_nokey, col_varchar_nokey) +VALUES (7, '2004-04-09', '14:03:03.042673', '2001-11-28 00:50:27.051028', 'c'), + (1, '2006-05-13', '01:46:09.016386', '2007-10-09 19:53:04.008332', NULL); + +CREATE TABLE bb ( + pk INTEGER AUTO_INCREMENT, + col_int_nokey INTEGER, + gcol_int_key INTEGER GENERATED ALWAYS AS (col_int_nokey + col_int_nokey) VIRTUAL, + col_date_nokey DATE, + gcol_date_key DATE GENERATED ALWAYS AS (DATE_ADD(col_date_nokey,interval 30 day)) VIRTUAL, + col_datetime_nokey DATETIME, + col_time_nokey TIME, + gcol_datetime_key DATETIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL, + gcol_time_key TIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL, + col_varchar_nokey VARCHAR(1), + gcol_varchar_key VARCHAR(2) GENERATED ALWAYS AS (CONCAT(col_varchar_nokey, col_varchar_nokey)) VIRTUAL, + PRIMARY KEY (pk), + UNIQUE KEY (gcol_int_key), + UNIQUE KEY (gcol_varchar_key), + UNIQUE KEY (gcol_date_key), + KEY (gcol_time_key), + KEY (gcol_datetime_key), + UNIQUE KEY (gcol_int_key, gcol_varchar_key), + KEY (gcol_int_key, col_int_nokey), + KEY(gcol_int_key,gcol_date_key), + KEY(gcol_int_key, gcol_time_key), + KEY(gcol_int_key, gcol_datetime_key), + UNIQUE KEY(gcol_date_key,gcol_time_key,gcol_datetime_key), + UNIQUE KEY (gcol_varchar_key, col_varchar_nokey), + UNIQUE KEY (gcol_int_key, gcol_varchar_key, gcol_date_key, gcol_time_key, gcol_datetime_key) +) AUTO_INCREMENT=10 ENGINE=INNODB; + +INSERT IGNORE INTO bb ( col_int_nokey, col_date_nokey, col_time_nokey, col_datetime_nokey, col_varchar_nokey) + VALUES (0, '2003-08-04', '01:48:05.048577', '2006-11-03 00:00:00', 'p'), + (2, '2007-11-06', '00:00:00', '2009-11-26 19:28:11.005115', 'n'); + +CREATE TABLE cc ( + pk INTEGER AUTO_INCREMENT, + col_int_nokey INTEGER, + gcol_int_key INTEGER GENERATED ALWAYS AS (col_int_nokey + col_int_nokey) VIRTUAL, + col_date_nokey DATE, + gcol_date_key DATE GENERATED ALWAYS AS (DATE_ADD(col_date_nokey,interval 30 day)) VIRTUAL, + col_datetime_nokey DATETIME, + col_time_nokey TIME, + gcol_datetime_key DATETIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL, + gcol_time_key TIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL, + col_varchar_nokey VARCHAR(1), + gcol_varchar_key VARCHAR(2) GENERATED ALWAYS AS (CONCAT(col_varchar_nokey, col_varchar_nokey)) VIRTUAL, + PRIMARY KEY (pk), + UNIQUE KEY (gcol_int_key), + UNIQUE KEY (gcol_varchar_key), + UNIQUE KEY (gcol_date_key), + KEY (gcol_time_key), + KEY (gcol_datetime_key), + UNIQUE KEY (gcol_int_key, gcol_varchar_key), + KEY (gcol_int_key, col_int_nokey), + KEY(gcol_int_key,gcol_date_key), + KEY(gcol_int_key, gcol_time_key), + KEY(gcol_int_key, gcol_datetime_key), + UNIQUE KEY(gcol_date_key,gcol_time_key,gcol_datetime_key), + UNIQUE KEY (gcol_varchar_key, col_varchar_nokey), + UNIQUE KEY (gcol_int_key, gcol_varchar_key, gcol_date_key, gcol_time_key, gcol_datetime_key) +) AUTO_INCREMENT=10 ENGINE=INNODB; + +INSERT IGNORE INTO cc (col_int_nokey, col_date_nokey, col_time_nokey, col_datetime_nokey, col_varchar_nokey) + VALUES (172, '2009-04-23', '00:00:00', '2000-12-07 10:17:40.013275', 'h'), + (NULL, '2002-10-06', '00:50:49.017545', NULL, 'm'); + +let $query= +SELECT +gp1 . gcol_datetime_key AS g1 +FROM cc AS gp1 LEFT JOIN c AS gp2 ON ( gp2 . gcol_datetime_key <> gp1 . +col_time_nokey ) +WHERE +gp1 . col_varchar_nokey IN +( +SELECT +DISTINCT p1 . gcol_varchar_key AS p1 +FROM bb AS p1 LEFT JOIN bb AS p2 +ON ( p1 . gcol_int_key = p2 . pk ) +) +AND gp1 . col_varchar_nokey = 'b' +HAVING g1 > 6; + +eval EXPLAIN $query; +eval $query; +DROP TABLE bb, c, cc; + +--echo # Bug#21284646: Assertion !(table || table->read_set || bitmap_is_set()) + +CREATE TABLE c ( + pk INTEGER AUTO_INCREMENT, + col_int_nokey INTEGER NOT NULL, + col_int_key INTEGER GENERATED ALWAYS AS (col_int_nokey + col_int_nokey) VIRTUAL, + col_date_nokey DATE NOT NULL, + col_date_key DATE GENERATED ALWAYS AS (DATE_ADD(col_date_nokey,interval 30 day)) VIRTUAL, + col_datetime_nokey DATETIME NOT NULL, + col_time_nokey TIME NOT NULL, + col_datetime_key DATETIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL, + col_time_key TIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL, + col_varchar_nokey VARCHAR(1) NOT NULL, + col_varchar_key VARCHAR(2) GENERATED ALWAYS AS (CONCAT(col_varchar_nokey, col_varchar_nokey)) VIRTUAL, + PRIMARY KEY (pk,col_int_nokey), + UNIQUE KEY (col_int_key), + UNIQUE KEY (col_varchar_key), + UNIQUE KEY (col_date_key), + KEY (col_time_key), + KEY (col_datetime_key), + UNIQUE KEY (col_int_key, col_varchar_key), + KEY (col_int_key, col_int_nokey), + KEY(col_int_key,col_date_key), + KEY(col_int_key, col_time_key), + KEY(col_int_key, col_datetime_key), + UNIQUE KEY (col_date_key,col_time_key,col_datetime_key), + UNIQUE KEY (col_varchar_key, col_varchar_nokey), + UNIQUE KEY (col_int_key, col_varchar_key, col_date_key, col_time_key, col_datetime_key) +) ENGINE=INNODB; + +INSERT INTO c (col_int_nokey, col_date_nokey, col_time_nokey, col_datetime_nokey, col_varchar_nokey) VALUES +(1, '2009-12-01', '00:21:38.058143', '2007-05-28 00:00:00', 'c'), +(8, '2004-12-17', '04:08:02.046897', '2009-07-25 09:21:20.064099', 'm'), +(9, '2000-03-14', '16:25:11.040240', '2002-01-16 00:00:00', 'd'), +(6, '2006-05-25', '19:47:59.011283', '2001-02-15 03:08:38.035426', 'y'), +(2, '2002-10-13', '00:00:00', '1900-01-01 00:00:00', 's'), +(4, '1900-01-01', '15:57:25.019666', '2005-08-15 00:00:00', 'r'); + +ANALYZE TABLE c; +let $query= +SELECT COUNT(DISTINCT col_varchar_key) AS x +FROM c +WHERE col_varchar_key IN ('rr', 'rr') OR + col_int_nokey <> 9 AND + pk >= 8 +HAVING x > '2000-02-06' +ORDER BY col_time_nokey, pk; + +eval explain $query; +eval $query; + +DROP TABLE c; + +--echo # Bug#21341044: Conditional jump at sort_param::make_sort_key + +CREATE TABLE t1 ( + pk INTEGER AUTO_INCREMENT, + col_int_nokey INTEGER, + col_int_key INTEGER GENERATED ALWAYS AS (col_int_nokey + col_int_nokey) VIRTUAL, + col_blob_nokey BLOB, + col_blob_key BLOB GENERATED ALWAYS AS (REPEAT(col_blob_nokey,15)) VIRTUAL, + col_longblob_nokey LONGBLOB, + col_longtext_nokey LONGTEXT, + col_longblob_key LONGBLOB GENERATED ALWAYS AS (REPEAT(col_longblob_nokey, 20)) VIRTUAL, + col_longtext_key LONGTEXT GENERATED ALWAYS AS (REPEAT(col_longblob_nokey, 18)) VIRTUAL, + col_text_nokey TEXT, + col_text_key TEXT GENERATED ALWAYS AS (REPEAT(col_text_nokey, 30)) VIRTUAL, + PRIMARY KEY (pk), + KEY (col_int_key), + KEY (col_text_key(50)), + KEY (col_blob_key(200)), + KEY (col_longtext_key(200)), + KEY (col_longblob_key(200)), + KEY (col_int_key, col_text_key(100)), + KEY (col_int_key, col_longtext_key(100)), + KEY (col_int_key, col_blob_key(100)), + KEY (col_int_key, col_longblob_key(100)), + KEY (col_longtext_key(10), col_longblob_key(100)), + KEY (col_int_key, col_text_key(10), col_blob_key(100), col_longtext_key(50), col_longblob_key(50)) +) engine=innodb; + +INSERT INTO t1 (col_int_nokey,col_blob_nokey,col_longtext_nokey,col_longblob_nokey,col_text_nokey) +VALUES +(0, 'ijcszxw', 'ijcszxw', 'ijcszxw', 'ijcszxw'), +(5, 'jcszxwb', 'jcszxwb', 'jcszxwb', 'jcszxwb'), +(4, 'cszxwbjjvv', 'cszxwbjjvv', 'cszxwbjjvv', 'cszxwbjjvv'), +(3, 'szxw', 'szxw', 'szxw', 'szxw'), +(7, 'zxwb', 'zxwb', 'zxwb', 'zxwb'), +(42, 'xwbjjvvky', 'xwbjjvvky', 'xwbjjvvky', 'xwbjjvvky'), +(142, 'wbjj', 'wbjj', 'wbjj', 'wbjj'), +(5, 'bjjv', 'bjjv', 'bjjv', 'bjjv'), +(0, 'jjvvkymalu', 'jjvvkymalu', 'jjvvkymalu', 'jjvvkymalu'), +(3, 'j', 'j', 'j', 'j'); +SELECT alias1.pk AS field1 +FROM t1 AS alias1 LEFT OUTER JOIN t1 AS alias2 + ON alias1.col_int_key = alias2.col_int_key +WHERE alias2.col_int_key BETWEEN 8 AND (8 + 1 ) OR + alias2.col_int_key BETWEEN 8 AND (8 + 5 ) AND + alias2.col_int_key != 20 OR + alias2.col_int_key IN (8, 5, 8) AND + alias2.col_int_key >= 0 AND + alias2.col_int_key <= ( 8 + 75 ) AND + alias1.pk IS NOT NULL +ORDER BY field1; + +DROP TABLE t1; +--echo # bug#21487651: gcols: memory leak after failed alter table +CREATE TABLE t(a int); +ALTER TABLE t ADD COLUMN b int GENERATED ALWAYS AS ( +date_sub(a,interval a month)) VIRTUAL; +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +ALTER TABLE t ADD COLUMN c int GENERATED ALWAYS AS (sum(a)); +DROP TABLE t; + +--echo # +--echo # Bug#21628840: CRASH/MEMORY CORRUPTION ADDING INDEXES TO VIRTUAL COLUMN +--echo # (II) +--echo # +CREATE TABLE t1( a INT ) ENGINE = INNODB; +INSERT INTO t1( a ) VALUES ( 1 ), ( 2 ), ( 3 ), ( 4 ), ( 5 ); + +ALTER TABLE t1 ADD COLUMN b INT GENERATED ALWAYS AS (a - 1) STORED; +ALTER TABLE t1 ADD COLUMN c INT GENERATED ALWAYS AS (b + 1) VIRTUAL; + +--echo # Used to cause valgrind warning. +ALTER TABLE t1 ADD INDEX( c ); + +ANALYZE TABLE t1; + +--echo # Make sure the index is correct. That's kinda important. +EXPLAIN +SELECT c FROM t1; +SELECT c FROM t1; + +DROP TABLE t1; + +--echo # +--echo # Bug#21797776 ASSERTION `BIT < MAP->N_BITS' FAILED. +--echo # + +CREATE TABLE C ( +col_int_1 INT, +col_int_2 INT GENERATED ALWAYS AS (col_int_1 + col_int_1) STORED, +col_int_3 INT GENERATED ALWAYS AS (col_int_2 + col_int_1) VIRTUAL +); + +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS + SELECT + col_int_2 AS field1, col_int_2 AS field2, + col_int_3 AS field3, col_int_3 AS field4 + FROM C; + +SELECT * FROM v1; + +DROP TABLE C; +DROP VIEW v1; + +--echo # +--echo # Bug#21613615 GCOLS: ASSERTION FAILED: !TABLE || (!TABLE->READ_SET || BITMAP_IS_SET +--echo # + +CREATE TABLE t (a INT); +CREATE TABLE v ( +a INT, +c INT, +b CHAR(2) GENERATED ALWAYS AS (a IN (1)) VIRTUAL, +KEY(c,b(1))); +INSERT INTO v (a,c) VALUES (1,1); + +let $query= +SELECT 1 FROM t WHERE ( SELECT 1 FROM t ) >=ANY( SELECT c FROM v ); +eval EXPLAIN $query; +eval $query; + +# A similar one: +let $query= +SELECT (SELECT MAX(c) FROM v); +eval EXPLAIN $query; +eval $query; + +DROP TABLE t, v; + +CREATE TABLE v ( +a INT, +c INT, +b CHAR(2) GENERATED ALWAYS AS (a IN (1)) VIRTUAL, KEY(c,b(1))); +INSERT INTO v (a,c) VALUES (1,1); +SELECT MAX(c), COUNT(b) FROM v; +DROP TABLE v; + +# Using PK suffix of secondary index +CREATE TABLE v ( +a INT PRIMARY KEY, +b INT, KEY(b)); +INSERT INTO v (a,b) VALUES (1,1); +SELECT MAX(a) FROM v WHERE b=1; +DROP TABLE v; + +--echo # +--echo # Bug#21824519: ASSERTION IN DROP TRIGGER WHEN TABLE HAS +--echo # VIRTUAL GENERATED COLUMN +--echo # +CREATE TABLE t (a INT, b INT GENERATED ALWAYS AS (a) VIRTUAL); +CREATE TRIGGER tr BEFORE INSERT ON t FOR EACH ROW BEGIN END; +INSERT INTO t (a) VALUES (1); +SELECT * FROM t; +# DROP TRIGGER used to hit a DBUG_ASSERT. +DROP TRIGGER tr; +SELECT * FROM t; +CREATE FUNCTION f() RETURNS INT RETURN (SELECT COUNT(*) FROM t); +# And this function call hit the same DBUG_ASSERT. +SELECT f(); +DROP FUNCTION f; +SELECT * FROM t; +DROP TABLE t; + +--echo # +--echo # Bug#21833760 CALC_DAYNR: ASSERTION `DELSUM+(INT) Y/4-TEMP >= 0' FAILED. +--echo # + +CREATE TABLE C( +c1 INT AUTO_INCREMENT, +c8 DATETIME, +c9 TIME, +c11 TIME GENERATED ALWAYS AS(ADDTIME(c8,c9)) VIRTUAL, +c13 TIME GENERATED ALWAYS AS(ADDTIME(c8,c11)) VIRTUAL, +PRIMARY KEY(c1), +UNIQUE KEY(c13) +); + +INSERT INTO C (c8,c9) VALUES('1970-01-01',0),('1970-01-01',1); + +CREATE VIEW view_C AS SELECT * FROM C; + +SELECT /*+ NO_BNL(t1) */ t1.c13 FROM C AS t2 STRAIGHT_JOIN C AS t1 FORCE INDEX(c13); +SELECT DISTINCT t1.c13 FROM C AS t1, view_C AS t2; + +DROP TABLE C; +DROP VIEW view_C; + +--echo # +--echo # Bug#21810529: CRASH IN ITEM_FUNC::WALK WHEN CODE JUMPS TO GARBAGE +--echo # LOCATION +--echo # +CREATE TABLE t (a TIME,b INT GENERATED ALWAYS AS (a=1) VIRTUAL); +--error ER_BAD_FIELD_ERROR +ALTER TABLE t CHANGE COLUMN q w INT; +--error ER_BAD_FIELD_ERROR +ALTER TABLE t CHANGE COLUMN q w INT; +--error ER_BAD_FIELD_ERROR +ALTER TABLE t CHANGE COLUMN q w INT; +--error ER_BAD_FIELD_ERROR +ALTER TABLE t CHANGE COLUMN q w INT; +DROP TABLE t; + +--echo # +--echo # Bug#21940542 TOO MUCH SPAM: INNODB: COMPUTE VIRTUAL COLUMN VALUES FAILED +--echo # + +CREATE TABLE t(b BLOB); +--error ER_OPERAND_COLUMNS +ALTER TABLE t ADD COLUMN c INT GENERATED ALWAYS AS ((1,1)) VIRTUAL; +DROP TABLE t; +--error ER_OPERAND_COLUMNS +CREATE TABLE t(b BLOB, c INT GENERATED ALWAYS AS ((1,1)) VIRTUAL); + +--echo # +--echo # Bug#21929967 GCOLS: GCOL VALUE CHANGES WHEN SESSION CHANGES SQL_MODE +--echo # + +CREATE TABLE t1(a CHAR(1), b CHAR(1), c CHAR(2) AS (a || b)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a,b) VALUES('1','1'); +SELECT * FROM t1; +SET SQL_MODE=PIPES_AS_CONCAT; +SELECT * FROM t1; +FLUSH TABLES; +SELECT * FROM t1; +DROP TABLE t1; +# The other way around: +CREATE TABLE t1(a CHAR(1), b CHAR(1), c CHAR(2) AS (a || b)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a,b) VALUES('1','1'); +SELECT * FROM t1; +SET SQL_MODE=DEFAULT; +SELECT * FROM t1; +FLUSH TABLES; +SELECT * FROM t1; +DROP TABLE t1; + +--echo # Bug#22018999: gcols: assertion failed: !error + +SET @save_old_sql_mode= @@sql_mode; +SET sql_mode=""; + +CREATE TABLE t (a INTEGER AS (SUBSTR('','a',1))) engine=innodb; +DROP TABLE t; + +CREATE TABLE t (a INTEGER) engine=innodb; + +ALTER TABLE t ADD b INTEGER AS (SUBSTR('','a',1)); + +DROP TABLE t; + +set sql_mode= @save_old_sql_mode; + +--echo # Bug#21875520 Problems with virtual column indexes + +CREATE TABLE t( + a TIMESTAMP, + b BLOB, + c TIMESTAMP GENERATED ALWAYS AS (GREATEST(a, '2000-01-01 00:00:00')) VIRTUAL, + UNIQUE KEY(c) +); +INSERT INTO t(b) VALUES (''); +UPDATE t SET a='2001-01-01 00:00:00'; +SELECT c FROM t; +SELECT c, a FROM t; +UPDATE t SET b='xyz'; +DO (SELECT @c1:= c FROM t); +DO (SELECT (@c2:= c) - a FROM t); +SELECT @c2 - @c1; + +DROP TABLE t; + +--echo # +--echo # Bug#22133710 GCOLS: READ UNCOMMITTED: ASSERT !TABLE || (!TABLE->WRITE_SET || BITMAP_IS_SET(TA +--echo # + +CREATE TABLE t ( + a INT, + b INT GENERATED ALWAYS AS (1) VIRTUAL, + c INT GENERATED ALWAYS AS (1) VIRTUAL, + d INT GENERATED ALWAYS AS (1) VIRTUAL, + KEY (b,d) +) ENGINE=INNODB; +INSERT INTO t VALUES(); +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ; +SELECT 1 FROM t WHERE c GROUP BY b; +COMMIT; +DROP TABLE t; diff --git a/mysql-test/suite/gcol/t/gcol_column_def_options_innodb.test b/mysql-test/suite/gcol/t/gcol_column_def_options_innodb.test new file mode 100644 index 00000000000..68931cd0706 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_column_def_options_innodb.test @@ -0,0 +1,47 @@ +################################################################################ +# t/gcol_column_def_options_innodb.test # +# # +# Purpose: # +# Testing different optional parameters of generated columns. # +# # +# InnoDB branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-02 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +--source include/have_innodb.inc +eval SET @@session.default_storage_engine = 'InnoDB'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +let $support_virtual_index= 1; +--source suite/gcol/inc/gcol_column_def_options.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_column_def_options_myisam.test b/mysql-test/suite/gcol/t/gcol_column_def_options_myisam.test new file mode 100644 index 00000000000..6f04ecf3865 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_column_def_options_myisam.test @@ -0,0 +1,46 @@ +################################################################################ +# t/gcol_column_def_options_myisam.test # +# # +# Purpose: # +# Testing different optional parameters of generated columns. # +# # +# MyISAM branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-02 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +eval SET @@session.default_storage_engine = 'MyISAM'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +let $support_virtual_index= 1; +--source suite/gcol/inc/gcol_column_def_options.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_handler_innodb.test b/mysql-test/suite/gcol/t/gcol_handler_innodb.test new file mode 100644 index 00000000000..50f72135497 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_handler_innodb.test @@ -0,0 +1,46 @@ +################################################################################ +# t/gcol_handler_innodb.test # +# # +# Purpose: # +# Testing HANDLER. +# # +# InnoDB branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-04 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +--source include/have_innodb.inc +eval SET @@session.default_storage_engine = 'InnoDB'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +--source suite/gcol/inc/gcol_handler.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_handler_myisam.test b/mysql-test/suite/gcol/t/gcol_handler_myisam.test new file mode 100644 index 00000000000..219235478a7 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_handler_myisam.test @@ -0,0 +1,45 @@ +################################################################################ +# t/gcol_handler_myisam.test # +# # +# Purpose: # +# Testing HANDLER. +# # +# MyISAM branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-04 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +eval SET @@session.default_storage_engine = 'MyISAM'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +--source suite/gcol/inc/gcol_handler.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_ins_upd_innodb.test b/mysql-test/suite/gcol/t/gcol_ins_upd_innodb.test new file mode 100644 index 00000000000..23d97a797e0 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_ins_upd_innodb.test @@ -0,0 +1,47 @@ +################################################################################ +# t/gcol_ins_upd_innodb.test # +# # +# Purpose: # +# Testing DDL operations such as INSERT, UPDATE, REPLACE and DELETE. # +# # +# InnoDB branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-04 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +--source include/have_innodb.inc +eval SET @@session.default_storage_engine = 'InnoDB'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +let $support_virtual_index= 0; +--source suite/gcol/inc/gcol_ins_upd.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_ins_upd_myisam.test b/mysql-test/suite/gcol/t/gcol_ins_upd_myisam.test new file mode 100644 index 00000000000..d54a6ae6f02 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_ins_upd_myisam.test @@ -0,0 +1,46 @@ +################################################################################ +# t/gcol_ins_upd_myisam.test # +# # +# Purpose: # +# Testing DDL operations such as INSERT, UPDATE, REPLACE and DELETE. # +# # +# MyISAM branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-04 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +eval SET @@session.default_storage_engine = 'MyISAM'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +let $support_virtual_index= 1; +--source suite/gcol/inc/gcol_ins_upd.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_keys_innodb.test b/mysql-test/suite/gcol/t/gcol_keys_innodb.test new file mode 100644 index 00000000000..3fe1ee4ff61 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_keys_innodb.test @@ -0,0 +1,89 @@ +################################################################################ +# t/gcol_keys_innodb.test # +# # +# Purpose: # +# Testing keys, indexes defined upon generated columns. # +# # +# InnoDB branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-04 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +--source include/have_innodb.inc +eval SET @@session.default_storage_engine = 'InnoDB'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +let $skip_spatial_index_check = 1; +let $support_virtual_index= 0; +--source suite/gcol/inc/gcol_keys.inc + +if ($support_virtual_index) { +#------------------------------------------------------------------------------# +# Execute storage engine specific tests +--echo # +--echo # BUG#21365158 WL8149:ASSERTION `!TABLE || (!TABLE->WRITE_SET +--echo # +CREATE TABLE t1 ( + pk INTEGER AUTO_INCREMENT, + col_int_nokey INTEGER NOT NULL, + col_varchar_nokey VARCHAR(1), + col_varchar_key VARCHAR(2) GENERATED ALWAYS AS + (CONCAT(col_varchar_nokey, col_varchar_nokey)) VIRTUAL, + PRIMARY KEY (pk) +); + +INSERT INTO t1 ( col_int_nokey, col_varchar_nokey) +VALUES (4, 'b'),(9, 'o'),(4, 'k'),(5, 'a'),(5, 'f'), +(9, 't'),(3, 'c'),(8, 'c'),(0, 'r'),(98, 'k'); + +CREATE TABLE t2 ( + pk INTEGER AUTO_INCREMENT, + col_int_nokey INTEGER NOT NULL, + col_varchar_nokey VARCHAR(1) NOT NULL, + col_varchar_key VARCHAR(2) GENERATED ALWAYS AS + (CONCAT(col_varchar_nokey, col_varchar_nokey)) VIRTUAL, + PRIMARY KEY (pk), + UNIQUE KEY (col_varchar_key) +); + +INSERT INTO t2 ( col_int_nokey, col_varchar_nokey) +VALUES (1, 'c'),(8, 'm'),(9, 'd'), (6, 'y'),(1, 't'), +(2, 's'),(4, 'r'); + +SELECT + CONCAT( t2.col_varchar_nokey , t2.col_varchar_nokey ) AS f2, + t1.col_varchar_key AS f5 +FROM + t2 LEFT JOIN t1 ON t2.col_int_nokey > t1.col_int_nokey +ORDER BY f2, f5; +DROP TABLE t1,t2; + +--echo # + +} +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_keys_myisam.test b/mysql-test/suite/gcol/t/gcol_keys_myisam.test new file mode 100644 index 00000000000..9cd89107126 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_keys_myisam.test @@ -0,0 +1,47 @@ +################################################################################ +# t/gcol_keys_myisam.test # +# # +# Purpose: # +# Testing keys, indexes defined upon generated columns. # +# # +# MyISAM branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-04 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +eval SET @@session.default_storage_engine = 'MyISAM'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +let $support_virtual_index= 1; +let $skip_foreign_key_check=1; +--source suite/gcol/inc/gcol_keys.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_memory.test b/mysql-test/suite/gcol/t/gcol_memory.test new file mode 100644 index 00000000000..a7d9235da02 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_memory.test @@ -0,0 +1,43 @@ +################################################################################ +# t/gcol_memory.test # +# # +# Purpose: # +# MEMORY branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-02 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +SET @@session.default_storage_engine = 'memory'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests +--source suite/gcol/inc/gcol_unsupported_storage_engines.inc + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_merge.test b/mysql-test/suite/gcol/t/gcol_merge.test new file mode 100644 index 00000000000..8e3ba476ae4 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_merge.test @@ -0,0 +1,52 @@ +################################################################################ +# t/gcol_merge.test # +# # +# Purpose: # +# MERGE branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-03 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (a int, b int generated always as (a % 10) virtual); +create table t2 (a int, b int generated always as (a % 10) virtual); +insert into t1 values (1,default); +insert into t2 values (2,default); +--error ER_UNSUPPORTED_ENGINE_FOR_GENERATED_COLUMNS +create table t3 (a int, b int generated always as (a % 10) virtual) engine=MERGE UNION=(t1,t2); +drop table t1,t2; + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_non_stored_columns_innodb.test b/mysql-test/suite/gcol/t/gcol_non_stored_columns_innodb.test new file mode 100644 index 00000000000..ed0d255bfd8 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_non_stored_columns_innodb.test @@ -0,0 +1,48 @@ +################################################################################ +# t/gcol_non_stored_columns_innodb.test # +# # +# Purpose: # +# Ensure that MySQL behaviour is consistent irrelevant of # +# - the place of a non-stored column among other columns, # +# - the total number of non-stored fields. # +# # +# InnoDB branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-04 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +--source include/have_innodb.inc +eval SET @@session.default_storage_engine = 'InnoDB'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +--source suite/gcol/inc/gcol_non_stored_columns.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_non_stored_columns_myisam.test b/mysql-test/suite/gcol/t/gcol_non_stored_columns_myisam.test new file mode 100644 index 00000000000..9784071e126 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_non_stored_columns_myisam.test @@ -0,0 +1,47 @@ +################################################################################ +# t/gcol_non_stored_columns_myisam.test # +# # +# Purpose: # +# Ensure that MySQL behaviour is consistent irrelevant of # +# - the place of a non-stored column among other columns, # +# - the total number of non-stored fields. # +# # +# MyISAM branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-04 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +eval SET @@session.default_storage_engine = 'MyISAM'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +--source suite/gcol/inc/gcol_non_stored_columns.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_partition_innodb.test b/mysql-test/suite/gcol/t/gcol_partition_innodb.test new file mode 100644 index 00000000000..06e6ccc1ba4 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_partition_innodb.test @@ -0,0 +1,46 @@ +################################################################################ +# t/gcol_partition_innodb.test # +# # +# Purpose: # +# Testing partitioning tables with generated columns. # +# # +# InnoDB branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-04 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +--source include/have_innodb.inc +eval SET @@session.default_storage_engine = 'InnoDB'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +--source suite/gcol/inc/gcol_partition.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_partition_myisam.test b/mysql-test/suite/gcol/t/gcol_partition_myisam.test new file mode 100644 index 00000000000..0a0cd9f9e86 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_partition_myisam.test @@ -0,0 +1,45 @@ +################################################################################ +# t/gcol_partition_myisam.test # +# # +# Purpose: # +# Testing partitioning tables with generated columns. # +# # +# MyISAM branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-04 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +eval SET @@session.default_storage_engine = 'MyISAM'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +--source suite/gcol/inc/gcol_partition.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_rejected_innodb.test b/mysql-test/suite/gcol/t/gcol_rejected_innodb.test new file mode 100644 index 00000000000..1780fdf8c19 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_rejected_innodb.test @@ -0,0 +1,41 @@ +################################################################################ +# t/gcol_handler_innodb.test # +# # +# Purpose: # +# Testing rejected generated column additions. +# # +# InnoDB branch # +# # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT INNODB SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +--source include/have_innodb.inc +eval SET @@session.default_storage_engine = 'InnoDB'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +# @todo This test is broken for all VIRTUAL columns +#--source suite/gcol/inc/gcol_rejected.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_rollback.test b/mysql-test/suite/gcol/t/gcol_rollback.test new file mode 100644 index 00000000000..4cd1fcc46ac --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_rollback.test @@ -0,0 +1,110 @@ +--source include/have_debug.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/not_embedded.inc + +# Save the initial number of concurrent sessions. +--source include/count_sessions.inc + +CREATE TABLE t ( + a INTEGER, + b BLOB GENERATED ALWAYS AS (a) VIRTUAL, + INDEX (b(57)) +)ENGINE=INNODB; + +INSERT INTO t (a) VALUES (9); +BEGIN; +SAVEPOINT a; +UPDATE t set a = 12; +DELETE FROM t where a = 12; +ROLLBACK TO SAVEPOINT a; +COMMIT; + +CHECK TABLE t; + +SELECT * FROM t; + +BEGIN; +INSERT INTO t (a) VALUES (10); +--let $shutdown_timeout= 0 +--source include/restart_mysqld.inc +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t ( + a INTEGER, + b BLOB GENERATED ALWAYS AS (a) VIRTUAL, + c INTEGER +)ENGINE=INNODB; + +INSERT INTO t (a,c) VALUES (9, 10); +SELECT * FROM t; + +connect (con1,localhost,root,,); +connection con1; + +# This DEBUG_SYNC should not kick in yet, because the duplicate key will be +# detected before we get a chance to apply the online log. + +SET DEBUG_SYNC = 'row_log_apply_after SIGNAL created WAIT_FOR dml_done'; +--send +ALTER TABLE t ADD KEY(b(57)), ALGORITHM=INPLACE; + +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR created'; +BEGIN; +INSERT INTO t (a,c) VALUES (10, 12); +SELECT * FROM t; +ROLLBACK; +SET DEBUG_SYNC = 'now SIGNAL dml_done'; + +connection con1; +reap; +disconnect con1; +connection default; + +SELECT * FROM t; +DROP TABLE t; + +# drop virtual column and alter index +CREATE TABLE t ( + a INT, + b INT, + c INT GENERATED ALWAYS AS(a+b), + d INT GENERATED ALWAYS AS(a+b+b), + KEY(c, d) +)ENGINE=INNODB; + +INSERT INTO t (a,b) VALUES (9, 10); +SELECT * FROM t; + +connect (con1,localhost,root,,); +connection con1; + +# This DEBUG_SYNC should not kick in yet, because the duplicate key will be +# detected before we get a chance to apply the online log. + +SET DEBUG_SYNC = 'row_log_apply_after SIGNAL created WAIT_FOR dml_done'; +--send +ALTER TABLE t DROP COLUMN c, ALGORITHM=INPLACE; + +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR created'; +BEGIN; +INSERT INTO t (a,b) VALUES (10, 12); +SELECT * FROM t; +ROLLBACK; +SET DEBUG_SYNC = 'now SIGNAL dml_done'; + +connection con1; +reap; +disconnect con1; +connection default; + +SELECT * FROM t; + +DROP TABLE t; +SET DEBUG_SYNC = 'RESET'; + +# Wait till all disconnects are completed +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/gcol/t/gcol_select_innodb.test b/mysql-test/suite/gcol/t/gcol_select_innodb.test new file mode 100644 index 00000000000..18c170413a0 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_select_innodb.test @@ -0,0 +1,53 @@ +################################################################################ +# t/gcol_select_innodb.test # +# # +# Purpose: # +# Testing different SELECTs. # +# # +# InnoDB branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-18 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +--source include/have_innodb.inc +eval SET @@session.default_storage_engine = 'InnoDB'; +eval SET optimizer_switch='derived_merge=off'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +let $support_virtual_index= 0; +--source suite/gcol/inc/gcol_select.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +eval SET optimizer_switch='derived_merge=default'; +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_select_myisam.test b/mysql-test/suite/gcol/t/gcol_select_myisam.test new file mode 100644 index 00000000000..e078efbad0c --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_select_myisam.test @@ -0,0 +1,52 @@ +################################################################################ +# t/gcol_select.test # +# # +# Purpose: # +# Testing different SELECTs. # +# # +# MyISAM branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-18 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +eval SET @@session.default_storage_engine = 'MyISAM'; +eval SET optimizer_switch='derived_merge=off'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +let $support_virtual_index= 1; +--source suite/gcol/inc/gcol_select.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +eval SET optimizer_switch='derived_merge=default'; +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_supported_sql_funcs_innodb.test b/mysql-test/suite/gcol/t/gcol_supported_sql_funcs_innodb.test new file mode 100644 index 00000000000..2e91093681c --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_supported_sql_funcs_innodb.test @@ -0,0 +1,45 @@ +################################################################################ +# t/gcol_supported_sql_funcs.test # +# # +# Purpose: # +# Test SQL functions allowed for generated columns # +# InnoDB branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-08-31 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +--source include/have_innodb.inc +SET @@session.default_storage_engine = 'InnoDB'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +--source suite/gcol/inc/gcol_supported_sql_funcs_main.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_supported_sql_funcs_myisam.test b/mysql-test/suite/gcol/t/gcol_supported_sql_funcs_myisam.test new file mode 100644 index 00000000000..a9dee4c76b0 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_supported_sql_funcs_myisam.test @@ -0,0 +1,44 @@ +################################################################################ +# t/gcol_supported_sql_funcs.test # +# # +# Purpose: # +# Test SQL functions allowed for generated columns # +# MyISAM branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-08-31 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +eval SET @@session.default_storage_engine = 'MyISAM'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +--source suite/gcol/inc/gcol_supported_sql_funcs_main.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_trigger_sp_innodb.test b/mysql-test/suite/gcol/t/gcol_trigger_sp_innodb.test new file mode 100644 index 00000000000..4478cbe23fe --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_trigger_sp_innodb.test @@ -0,0 +1,47 @@ +################################################################################ +# t/gcol_trigger_sp_innodb.test # +# # +# Purpose: # +# Testing triggers, stored procedures and functions # +# defined on tables with generated columns. # +# # +# InnoDB branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-04 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +--source include/have_innodb.inc +eval SET @@session.default_storage_engine = 'InnoDB'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +--source suite/gcol/inc/gcol_trigger_sp.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_trigger_sp_myisam.test b/mysql-test/suite/gcol/t/gcol_trigger_sp_myisam.test new file mode 100644 index 00000000000..1a39d921c11 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_trigger_sp_myisam.test @@ -0,0 +1,46 @@ +################################################################################ +# t/gcol_trigger_sp_myisam.test # +# # +# Purpose: # +# Testing triggers, stored procedures and functions # +# defined on tables with generated columns. # +# # +# MyISAM branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-04 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +eval SET @@session.default_storage_engine = 'MyISAM'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +--source suite/gcol/inc/gcol_trigger_sp.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_update.test b/mysql-test/suite/gcol/t/gcol_update.test new file mode 100644 index 00000000000..0a7265bebac --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_update.test @@ -0,0 +1,56 @@ +--source include/have_debug.inc +--source include/have_innodb.inc +# The embedded server does not support restarting. +--source include/not_embedded.inc + +set global innodb_purge_stop_now = 1; + +# Index on virtual column + +create table t1(f1 int not null, f2 blob not null, f3 blob not null, + vchar char(2) as (substr(f3,2,2)) virtual, + primary key(f1, f3(5)), index(vchar))engine=innodb; + +insert into t1(f1,f2,f3) values(1, repeat('a',8000), repeat('b', 9000)); + +update t1 set f1=5 where f1=1; +delete from t1 where f1=5; + +set global innodb_purge_run_now=1; +set global innodb_fast_shutdown=0; +--source include/restart_mysqld.inc +set global innodb_purge_stop_now = 1; +drop table t1; + +# Index on virtual column and blob + +create table t1(f1 int not null, f2 blob not null, f3 blob not null, + vchar char(2) as (substr(f3,2,2)) virtual, + primary key(f1, f3(5)), index(vchar, f3(2)))engine=innodb; + +insert into t1(f1,f2,f3) values(1, repeat('a',8000), repeat('b', 9000)); + +update t1 set f1=5 where f1=1; +delete from t1 where f1=5; + +set global innodb_purge_run_now=1; +set global innodb_fast_shutdown=0; +--source include/restart_mysqld.inc +set global innodb_purge_stop_now = 1; +drop table t1; + +# Index on virtual column of blob type + +create table t1(f1 int not null, f2 blob not null, f3 blob not null, + vchar blob as (f3) virtual, + primary key(f1, f3(5)), index(vchar(3)))engine=innodb; + +insert into t1(f1,f2,f3) values(1, repeat('a',8000), repeat('b', 9000)); + +update t1 set f1=5 where f1=1; +delete from t1 where f1=5; + +set global innodb_purge_run_now=1; +set global innodb_fast_shutdown=0; +--source include/restart_mysqld.inc +drop table t1; diff --git a/mysql-test/suite/gcol/t/gcol_view_innodb.test b/mysql-test/suite/gcol/t/gcol_view_innodb.test new file mode 100644 index 00000000000..06ded123776 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_view_innodb.test @@ -0,0 +1,46 @@ +################################################################################ +# t/gcol_view_innodb.test # +# # +# Purpose: # +# Testing views defined on tables with generated columns. # +# # +# InnoDB branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-04 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +--source include/have_innodb.inc +eval SET @@session.default_storage_engine = 'InnoDB'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +--source suite/gcol/inc/gcol_view.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/gcol_view_myisam.test b/mysql-test/suite/gcol/t/gcol_view_myisam.test new file mode 100644 index 00000000000..3779f0bb045 --- /dev/null +++ b/mysql-test/suite/gcol/t/gcol_view_myisam.test @@ -0,0 +1,45 @@ +################################################################################ +# t/gcol_view_myisam.test # +# # +# Purpose: # +# Testing views defined on tables with generated columns. # +# # +# MyISAM branch # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-04 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +eval SET @@session.default_storage_engine = 'MyISAM'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +--source suite/gcol/inc/gcol_view.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc diff --git a/mysql-test/suite/gcol/t/innodb_partition.test b/mysql-test/suite/gcol/t/innodb_partition.test new file mode 100644 index 00000000000..268a8c7c083 --- /dev/null +++ b/mysql-test/suite/gcol/t/innodb_partition.test @@ -0,0 +1,30 @@ +--source include/have_innodb.inc +--source include/have_partition.inc + +--echo # +--echo # Bug#22444530 - GCOLS + PARTITIONED TABLE, CRASH IN +--echo # +set sql_mode=''; +create table t ( + a int not null, + b int generated always as (1) virtual, + c int generated always as (1) virtual, + key (c) +) engine=innodb partition by key (a) partitions 2; +insert into t(a) values(1); +select b from t group by c; + +drop table t; + +# Make column b a BLOB +create table t ( + a int not null, + b blob generated always as ("a") virtual, + c int generated always as (1) virtual, + key (c) +) engine=innodb partition by key (a) partitions 2; +insert into t(a) values(1); +select b from t group by c; + +drop table t; + diff --git a/mysql-test/suite/gcol/t/innodb_prefix_index_check.test b/mysql-test/suite/gcol/t/innodb_prefix_index_check.test new file mode 100644 index 00000000000..4923ead91ac --- /dev/null +++ b/mysql-test/suite/gcol/t/innodb_prefix_index_check.test @@ -0,0 +1,22 @@ +--source include/have_innodb.inc + +--echo #Bug #22445211 GCOLS: SIMPLE DML, FAILING ASSERTION: +--echo #!CURSOR->INDEX->IS_COMMITTED() + +--echo #Create and alter table examples for virtual column for full +--echo #column index followed by prefix index. + +CREATE TABLE t1( +f1 INT DEFAULT NULL, +f2 CHAR(2) GENERATED ALWAYS AS ('11') VIRTUAL, +f3 INT, +UNIQUE KEY(f1), +UNIQUE KEY(f3,f1), +KEY(f2,f1), +key(f1,f2(1)) +)ENGINE=INNODB; + +REPLACE INTO t1(f3) VALUES (1),(1); + +DROP TABLE t1; + diff --git a/mysql-test/suite/gcol/t/innodb_virtual_basic.test b/mysql-test/suite/gcol/t/innodb_virtual_basic.test new file mode 100644 index 00000000000..4f88fb7f8f6 --- /dev/null +++ b/mysql-test/suite/gcol/t/innodb_virtual_basic.test @@ -0,0 +1,1476 @@ +--source include/have_innodb.inc +--source include/have_partition.inc + +call mtr.add_suppression("\\[Warning\\] InnoDB: Compute virtual"); + +set default_storage_engine=innodb; + +CREATE TABLE t (a INT, b INT GENERATED ALWAYS AS (a), c CHAR(10), d CHAR(20), e CHAR(10) GENERATED ALWAYS AS (c), g INT); +INSERT INTO t VALUES(10, DEFAULT, "aa", "bb", DEFAULT, 20); +INSERT INTO t VALUES(11, DEFAULT, "jj", "kk", DEFAULT, 21); + +CREATE INDEX idx ON t(e) algorithm=inplace; +INSERT INTO t VALUES(12, DEFAULT, 'mm', "nn", DEFAULT, 22); + +SELECT e FROM t; + +DROP TABLE t; + +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); + +INSERT INTO t VALUES (11, 3, DEFAULT, 'mm'); +INSERT INTO t VALUES (18, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (28, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (null, null, DEFAULT, 'mm'); + +CREATE INDEX idx ON t(c); +SELECT c FROM t; + +UPDATE t SET a = 10 WHERE a = 11; +SELECT c FROM t; + +SELECT * FROM t; + +DELETE FROM t WHERE a = 18; + +SELECT c FROM t; + +START TRANSACTION; + +INSERT INTO t VALUES (128, 22, DEFAULT, "xx"); +INSERT INTO t VALUES (1290, 212, DEFAULT, "xmx"); +ROLLBACK; + +SELECT c FROM t; +SELECT * FROM t; + +DROP TABLE t; + +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10), j INT, m INT GENERATED ALWAYS AS(b + j), n VARCHAR(10), p VARCHAR(20) GENERATED ALWAYS AS(CONCAT(n, h)), INDEX idx1(c), INDEX idx2 (m), INDEX idx3(p)); + +INSERT INTO t VALUES(11, 22, DEFAULT, "AAA", 8, DEFAULT, "XXX", DEFAULT); +INSERT INTO t VALUES(1, 2, DEFAULT, "uuu", 9, DEFAULT, "uu", DEFAULT); +INSERT INTO t VALUES(3, 4, DEFAULT, "uooo", 1, DEFAULT, "umm", DEFAULT); + +SELECT c FROM t; +SELECT m FROM t; +SELECT p FROM t; +SELECT * FROM t; + +update t set a = 13 where a =11; + +delete from t where a =13; + +DROP INDEX idx1 ON t; +DROP INDEX idx2 ON t; +DROP TABLE t; + +/* Test large BLOB data */ +CREATE TABLE `t` ( + `a` BLOB, + `b` BLOB, + `c` BLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, + `h` VARCHAR(10) DEFAULT NULL +) ENGINE=InnoDB; + +INSERT INTO t VALUES (REPEAT('g', 16000), REPEAT('x', 16000), DEFAULT, "kk"); + +CREATE INDEX idx ON t(c(100)); + +SELECT length(c) FROM t; + +START TRANSACTION; + +INSERT INTO t VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, 'mm'); + +ROLLBACK; + +INSERT INTO t VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, 'mm'); + +START TRANSACTION; + +UPDATE t SET a = REPEAT('m', 16000) WHERE a like "aaa%"; + +ROLLBACK; + +# This SELECT did not give correct answer, even though InnoDB return +# all qualified rows +SELECT COUNT(*) FROM t WHERE c like "aaa%"; + +DROP TABLE t; + +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); + +INSERT INTO t VALUES (11, 3, DEFAULT, 'mm'); +INSERT INTO t VALUES (18, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (28, 1, DEFAULT, 'mm'); +CREATE INDEX idx ON t(c); + +START TRANSACTION; + +UPDATE t SET a = 100 WHERE a = 11; + +UPDATE t SET a =22 WHERE a = 18; + +UPDATE t SET a = 33 WHERE a = 22; + +SELECT c FROM t; + +ROLLBACK; + +SELECT c FROM t; +DROP TABLE t; + +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); + +INSERT INTO t VALUES (11, 3, DEFAULT, 'mm'); +INSERT INTO t VALUES (18, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (28, 1, DEFAULT, 'mm'); +CREATE INDEX idx ON t(c); +SELECT c FROM t; + +connect(con1,localhost,root,,test); +START TRANSACTION; +SELECT c FROM t; + +connection default; +UPDATE t SET a = 19 WHERE a = 11; + +# this should report the same value as previous one (14, 19, 29). +connection con1; +SELECT c FROM t; + +ROLLBACK; + +SELECT c FROM t; + +connection default; +disconnect con1; + +DROP TABLE t; + +# CREATE a more complex TABLE +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10), j INT, m INT GENERATED ALWAYS AS(b + x), n VARCHAR(10), p VARCHAR(20) GENERATED ALWAYS AS(CONCAT(n, y)), x INT, y CHAR(20), z INT, INDEX idx1(c), INDEX idx2 (m), INDEX idx3(p)); + +INSERT INTO t VALUES(1, 2, DEFAULT, "hhh", 3, DEFAULT, "nnn", DEFAULT, 4, "yyy", 5); + +INSERT INTO t VALUES(2, 3, DEFAULT, "hhha", 4, DEFAULT, "nnna", DEFAULT, 5, "yyya", 6); + +INSERT INTO t VALUES(12, 13, DEFAULT, "hhhb", 14, DEFAULT, "nnnb", DEFAULT, 15, "yyyb", 16); + +# CREATE an INDEX ON multiple virtual COLUMN +CREATE INDEX idx6 ON t(p, c); + +SELECT p, c FROM t; + +START TRANSACTION; +INSERT INTO t VALUES(32, 33, DEFAULT, "hhhb", 34, DEFAULT, "nnnb", DEFAULT, 35, "yyyb", 36); +ROLLBACK; + +UPDATE t SET a = 100 WHERE a = 1; + +START TRANSACTION; +UPDATE t SET a = 1 WHERE a = 100; +ROLLBACK; + +DROP TABLE t; + +CREATE TABLE t1(a INT); +ALTER TABLE t1 add COLUMN (b INT generated always as (a+1) virtual, c INT as(5) virtual); +ALTER TABLE t1 add COLUMN (d INT generated always as (a+1) virtual, e INT as(5) virtual); + +SELECT pos, base_pos FROM informatiON_schema.innodb_sys_virtual; + +#--error ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN +ALTER TABLE t1 add COLUMN (f INT generated always as (a+1) virtual, g INT as(5) virtual), DROP COLUMN e; + +SELECT pos, base_pos FROM informatiON_schema.innodb_sys_virtual; + +DROP TABLE t1; + +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(1); + +ALTER TABLE t1 add COLUMN (f INT generated always as (a+1) virtual, g INT ); + +# Inplace ADD/DROP virtual COLUMNs can only go with their own for +# inplace algorithm, not to combine with other operations, except create index +ALTER TABLE t1 add COLUMN (h INT generated always as (a+1) virtual), add INDEX idx (h), algorithm=inplace; + +--enable_info +ALTER TABLE t1 add COLUMN (h1 INT generated always as (a+1) virtual), add INDEX idx1 (h1); +--disable_info + +ALTER TABLE t1 DROP COLUMN h1, DROP INDEX idx; + +DROP TABLE t1; + +# Virtual COLUMN cannot be INDEXed +CREATE TABLE t1(a INT); +CREATE INDEX idx ON t1(a); +CREATE TABLE t3(a INT, b INT , INDEX(b), CONSTRAINT x FOREIGN KEY(b) REFERENCES t1(a)); +--error ER_CANT_CREATE_TABLE +CREATE TABLE t2(a INT, b INT generated always as (a+1) virtual, INDEX(b), CONSTRAINT x FOREIGN KEY(b) REFERENCES t1(a)); +CREATE TABLE t2(a INT, b INT generated always as (a+1) virtual, INDEX(b)); +DROP TABLE t3; +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1(a INT); +ALTER TABLE t1 add COLUMN (b INT generated always as (a+1) virtual, c INT as(5) virtual); + +ALTER TABLE t1 change b x INT generated always as (a+1) virtual; + +SELECT pos, base_pos FROM informatiON_schema.innodb_sys_virtual; + +DROP TABLE t1; + +# We do not support Fulltext or Spatial INDEX ON Virtual Columns +--error ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN +CREATE TABLE t (a TEXT, b TEXT GENERATED ALWAYS AS (a), fulltext INDEX idx (b)); +CREATE TABLE t (a TEXT, b TEXT GENERATED ALWAYS AS (a)); +--error ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN +ALTER TABLE t ADD FULLTEXT INDEX (b); +DROP TABLE t; + +--error ER_SPATIAL_CANT_HAVE_NULL +CREATE TABLE t (a geometry not null, b geometry GENERATED ALWAYS AS (a), spatial INDEX idx (b)); +CREATE TABLE t (a geometry not null, b geometry GENERATED ALWAYS AS (a)); +--error ER_SPATIAL_CANT_HAVE_NULL +ALTER TABLE t ADD SPATIAL INDEX (b); +DROP TABLE t; + +#test DEFAULT value +CREATE TABLE t (a INT DEFAULT 1, b INT DEFAULT 2, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); +CREATE INDEX idx ON t(c); +INSERT INTO t(h)VALUES ('mm'); +SELECT c FROM t; + +CREATE unique INDEX idx1 ON t(c); + +--error ER_DUP_ENTRY +INSERT INTO t(h)VALUES ('mm'); + +DROP TABLE t; + +CREATE TABLE `t1` ( `a` INT(11) DEFAULT NULL, `b` INT(11) DEFAULT NULL, `c` INT(11) GENERATED ALWAYS AS (a+b) VIRTUAL, `x` INT(11) NOT NULL, `h` VARCHAR(10) DEFAULT NULL, PRIMARY KEY (`x`), KEY `idx` (`c`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +INSERT INTO t1 VALUES (1, 2, DEFAULT, 3, 'mm'); +INSERT INTO t1 VALUES (11, 22, DEFAULT, 23, 'mm'); + +connect(con1,localhost,root,,test); +UPDATE t1 SET x = 4 WHERE x =3; +DROP TABLE t1; + +CREATE TABLE `t1` ( `a` INT(11) DEFAULT NULL, `b` INT(11) DEFAULT NULL, `c` INT(11) GENERATED ALWAYS AS (a+b) VIRTUAL, `x` INT(11) NOT NULL, `h` VARCHAR(10) DEFAULT NULL, KEY `idx` (`c`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +INSERT INTO t1 VALUES (1, 2, DEFAULT, 3, 'mm'); +INSERT INTO t1 VALUES (11, 22, DEFAULT, 23, 'mm'); + +START TRANSACTION; +SELECT * FROM t1; + +connection con1; +START TRANSACTION; +UPDATE t1 SET x = 15 WHERE x = 3; + +UPDATE t1 SET b = 10 WHERE b=2; +ROLLBACK; + +connection default; +SELECT c FROM t1; + +disconnect con1; + +DROP TABLE t1; + +CREATE TABLE `t` ( + `a` INT(11) DEFAULT NULL, + `b` INT(11) DEFAULT NULL, + `c` INT(11) GENERATED ALWAYS AS (a+b) VIRTUAL, + `d` INT(11) GENERATED ALWAYS AS (a) VIRTUAL, + `h` INT(11) NOT NULL, + PRIMARY KEY (`h`), + KEY `idx` (`c`) +) ENGINE=InnoDB; + +INSERT INTO t VALUES (11, 3, DEFAULT, DEFAULT, 1); +INSERT INTO t VALUES (18, 1, DEFAULT, DEFAULT, 2); +INSERT INTO t VALUES (28, 1, DEFAULT, DEFAULT, 3); +INSERT INTO t VALUES (null, null, DEFAULT, DEFAULT, 4); + +delimiter |; +CREATE PROCEDURE UPDATE_t() +begin + DECLARE i INT DEFAULT 1; + WHILE (i <= 2000) DO + UPDATE t SET a = 100 + i WHERE h = 1; + SET i = i + 1; + END WHILE; +END| + +CREATE PROCEDURE DELETE_insert_t() +begin + DECLARE i INT DEFAULT 1; + WHILE (i <= 2000) DO + UPDATE t SET a = 100 + i WHERE h = 1; + SET i = i + 1; + END WHILE; +END| +delimiter ;| + +CALL UPDATE_t(); +SELECT c FROM t; + +CALL DELETE_insert_t(); +SELECT c FROM t; + +DROP INDEX idx ON t; +CALL UPDATE_t(); +SELECT c FROM t; + +DROP PROCEDURE DELETE_insert_t; +DROP PROCEDURE UPDATE_t; + +DROP TABLE t; + +--echo # Bug#20767937: WL8149:ASSERTION FAILED IN ROW_UPD_SEC_INDEX_ENTRY +CREATE TABLE b ( +col_INT_nokey INTEGER NOT NULL, +col_INT_key INTEGER GENERATED ALWAYS AS (col_INT_nokey) VIRTUAL, +col_date_nokey DATE, +col_date_key DATE GENERATED ALWAYS AS (DATE_ADD(col_date_nokey, + INTerval 30 day)) VIRTUAL, + +col_datetime_nokey DATETIME NOT NULL, +col_time_nokey TIME NOT NULL, + +col_datetime_key DATETIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, + col_time_nokey)), +col_time_key TIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, + col_time_nokey)), + +col_VARCHAR_nokey VARCHAR(1) NOT NULL, +col_VARCHAR_key VARCHAR(2) GENERATED ALWAYS AS(CONCAT(col_VARCHAR_nokey, + col_VARCHAR_nokey)), + +KEY (col_INT_key), +KEY (col_VARCHAR_key), +KEY (col_date_key), +KEY (col_time_key), +KEY (col_datetime_key), +KEY (col_INT_key, col_VARCHAR_key), +KEY (col_INT_key, col_VARCHAR_key, col_date_key, +col_time_key, col_datetime_key) +); +INSERT INTO b ( + col_INT_nokey, + col_date_nokey, + col_time_nokey, + col_datetime_nokey, + col_VARCHAR_nokey +) VALUES +(0, NULL, '21:22:34.025509', '2002-02-13 17:30:06.013935', 'j'), +(8, '2004-09-18', '10:50:38.059966', '2008-09-27 +00:34:58.026613', 'v'); + +EXPLAIN SELECT col_INT_key FROM b; +SELECT col_INT_key FROM b; +SELECT col_INT_nokey, col_INT_key FROM b; +DELETE FROM b; + +DROP TABLE b; + +let $row_format=COMPACT; +--source inc/innodb_v_large_col.inc + +CREATE TABLE `t` ( + `a` BLOB, + `b` BLOB, + `c` BLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, + `d` BLOB GENERATED ALWAYS AS (b) VIRTUAL, + `e` INT(11) GENERATED ALWAYS AS (10) VIRTUAL, + `h` INT(11) NOT NULL, + PRIMARY KEY (`h`) +) ENGINE=InnoDB; + +INSERT INTO t VALUES (REPEAT('g', 16000), REPEAT('x', 16000), DEFAULT, DEFAULT, DEFAULT, 1); +INSERT INTO t VALUES (REPEAT('a', 32000), REPEAT('b', 11000), DEFAULT, DEFAULT, DEFAULT, 2); +INSERT INTO t VALUES (REPEAT('m', 18000), REPEAT('n', 46000), DEFAULT, DEFAULT, DEFAULT, 3); + +CREATE INDEX idx ON t(c(100), d(20)); + +UPDATE t SET a = NULL WHERE h=1; + +UPDATE t SET a = REPEAT(CAST(1 AS CHAR), 2000) WHERE h = 1; + +UPDATE t SET a = REPEAT(CAST(1 AS CHAR), 1000) WHERE h = 1; + +delimiter |; + +CREATE PROCEDURE UPDATE_t() +begin + DECLARE i INT DEFAULT 1; + WHILE (i <= 200) DO + UPDATE t SET a = REPEAT(CAST(i AS CHAR), 2000) WHERE h = 1; + SET i = i + 1; + END WHILE; +END| + +CREATE PROCEDURE DELETE_insert_t() +begin + DECLARE i INT DEFAULT 1; + WHILE (i <= 200) DO + DELETE FROM t WHERE h = 1; + INSERT INTO t VALUES (REPEAT(CAST(i AS CHAR), 2000) , REPEAT('b', 2000), DEFAULT, DEFAULT, DEFAULT, 1); + SET i = i + 1; + END WHILE; +END| +delimiter ;| + +CALL UPDATE_t(); +CALL DELETE_insert_t(); + +UPDATE t SET a = NULL WHERE h=1; + +DROP PROCEDURE DELETE_insert_t; +DROP PROCEDURE UPDATE_t; +DROP TABLE t; + +CREATE TABLE `t` ( + `m1` INT(11) DEFAULT NULL, + `m2` INT(11) DEFAULT NULL, + `m3` INT(11) GENERATED ALWAYS AS (m1 + m2) VIRTUAL, + `m4` INT(11) DEFAULT NULL, + `m5` CHAR(10) DEFAULT NULL, + `m6` CHAR(12) GENERATED ALWAYS AS (m5) VIRTUAL, + `a` VARCHAR(10000) DEFAULT NULL, + `b` VARCHAR(3000) DEFAULT NULL, + `c` VARCHAR(14000) GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, + `d` VARCHAR(5000) GENERATED ALWAYS AS (b) VIRTUAL, + `e` INT(11) GENERATED ALWAYS AS (10) VIRTUAL, + `h` INT(11) NOT NULL, + PRIMARY KEY (`h`), + KEY `m3` (`m3`), + KEY `c` (`c`(100)), + KEY `e` (`e`,`d`(20)) +) ENGINE=InnoDB; + +INSERT INTO t VALUES (1, 2, DEFAULT, 3, "aaa", DEFAULT, REPEAT('g', 10000), REPEAT('x', 2800), DEFAULT, DEFAULT, DEFAULT, 1); + +INSERT INTO t VALUES (11, 21, DEFAULT, 31, "bbb", DEFAULT, REPEAT('a', 9000), REPEAT('b', 2000), DEFAULT, DEFAULT, DEFAULT, 2); + +INSERT INTO t VALUES (21, 31, DEFAULT, 41, "zzz", DEFAULT, REPEAT('m', 8000), REPEAT('n', 3000), DEFAULT, DEFAULT, DEFAULT, 3); + +ALTER TABLE t DROP COLUMN c; + +DELETE FROM t; + +DROP TABLE t; + +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); + +INSERT INTO t VALUES (11, 3, DEFAULT, 'mm'); +INSERT INTO t VALUES (18, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (28, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (null, null, DEFAULT, 'mm'); + +CREATE INDEX idx ON t(a, c); +SELECT a, c FROM t; + +START TRANSACTION; + +UPDATE t SET a = 13 where a = 11; + +ROLLBACK; +DELETE FROM t; + +DROP TABLE t; + +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10), m int); + +INSERT INTO t VALUES (11, 3, DEFAULT, "a", 1); +INSERT INTO t VALUES (18, 1, DEFAULT, "b", 2); +INSERT INTO t VALUES (28, 1, DEFAULT, "c", 3 ); +INSERT INTO t VALUES (null, null, DEFAULT, "d", 4); + +CREATE INDEX idx ON t(a, c, h); +SELECT a, c FROM t; + +START TRANSACTION; +UPDATE t SET m =10 WHERE m = 1; +UPDATE t SET h = "e" WHERE h="a"; +ROLLBACK; +SELECT a, c, h FROM t; + +DROP TABLE t; + +# bug#21065137 - WL8149:FAILING ASSERTION: NAME_OFS < FULL_LEN +CREATE TABLE `t1` ( + `col1` int(11) NOT NULL, + `col2` int(11) NOT NULL, + `col3` int(11) NOT NULL, + `col4` int(11) DEFAULT NULL, + `col5` int(11) GENERATED ALWAYS AS (col2 % col3) VIRTUAL, + `col7` int(11) GENERATED ALWAYS AS (col5 * col5) VIRTUAL, + `col8` int(11) GENERATED ALWAYS AS (col5 % col5) VIRTUAL, + `col9` text, + `extra` int(11) DEFAULT NULL, + UNIQUE KEY `uidx` (`col5`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +ALTER TABLE t1 CHANGE COLUMN extra col6 INT; + +SHOW CREATE TABLE t1; +DROP TABLE t1; + +# No spatial and FTS index on virtual columns +--error ER_SPATIAL_CANT_HAVE_NULL +CREATE TABLE t (a INT, b INT GENERATED ALWAYS AS (a), c point, d point GENERATED ALWAYS AS (c), spatial index idx (d)); + +--error ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN +CREATE TABLE t (a INT, b INT GENERATED ALWAYS AS (a), c CHAR(10), d char(20) GENERATED ALWAYS AS (c), fulltext index idx (d)); + +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10), j INT, m INT GENERATED ALWAYS AS(b + j), n VARCHAR(10), p VARCHAR(20) GENERATED ALWAYS AS(CONCAT(n, h)), INDEX idx1(c), INDEX idx2 (m), INDEX idx3(p)); + +INSERT INTO t VALUES(11, 22, DEFAULT, "AAA", 8, DEFAULT, "XXX", DEFAULT); +INSERT INTO t VALUES(1, 2, DEFAULT, "uuu", 9, DEFAULT, "uu", DEFAULT); +INSERT INTO t VALUES(3, 4, DEFAULT, "uooo", 1, DEFAULT, "umm", DEFAULT); + +alter table t add x int, add xx int generated ALWAYS AS(x); + +DROP TABLE t; + +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10), j INT, m INT GENERATED ALWAYS AS(b + j), n VARCHAR(10), p VARCHAR(20) GENERATED ALWAYS AS(CONCAT(n, h)), INDEX idx1(c), INDEX idx2 (m), INDEX idx3(p)); + +INSERT INTO t VALUES(11, 22, DEFAULT, "AAA", 8, DEFAULT, "XXX", DEFAULT); +INSERT INTO t VALUES(1, 2, DEFAULT, "uuu", 9, DEFAULT, "uu", DEFAULT); +INSERT INTO t VALUES(3, 4, DEFAULT, "uooo", 1, DEFAULT, "umm", DEFAULT); + +ALTER TABLE t DROP COLUMN c, algorithm=inplace; +ALTER TABLE t DROP COLUMN p, ADD COLUMN s VARCHAR(20) GENERATED ALWAYS AS(CONCAT(n, h)), algorithm=inplace; + +# This should fail +#ALTER TABLE t ADD x INT, DROP COLUMN m, algorithm=inplace; +SELECT s FROM t; + +ALTER TABLE t ADD x VARCHAR(20) GENERATED ALWAYS AS(CONCAT(n, h)), ADD INDEX idx (x), algorithm=inplace; +DROP TABLE t; + +CREATE TABLE `t1` ( + `col1` int(11) DEFAULT NULL, + `col2` int(11) DEFAULT NULL, + `col3` int(11) DEFAULT NULL, + `col4` int(11) DEFAULT NULL, + `col5` int(11) GENERATED ALWAYS AS (col4 * col2) VIRTUAL, + `col6` int(11) GENERATED ALWAYS AS (col2 % col4) VIRTUAL, + `col7` int(11) GENERATED ALWAYS AS (col5 / col6) VIRTUAL, + `col8` int(11) GENERATED ALWAYS AS (col5 + col5) VIRTUAL, + `col9` text, + `extra` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +ALTER TABLE t1 DROP COLUMN col7; + +DROP TABLE t1; + +CREATE TABLE t1 ( + col1 INTEGER NOT NULL, + gv_col INTEGER GENERATED ALWAYS AS (col1) VIRTUAL, + txt1 TEXT, + FULLTEXT INDEX fi(txt1) +); + +select * from t1; + +DROP TABLE t1; + +CREATE TABLE t1 ( + col1 INTEGER NOT NULL, + col2 INTEGER NOT NULL, + col3 INTEGER DEFAULT NULL, + col4 INTEGER DEFAULT NULL, + col5 INTEGER DEFAULT NULL, + col6 INTEGER DEFAULT NULL, + col7 INTEGER DEFAULT NULL, + col8 INTEGER DEFAULT NULL, + col9 INTEGER DEFAULT NULL, + col10 INTEGER DEFAULT NULL, + col11 INTEGER DEFAULT NULL, + col12 INTEGER DEFAULT NULL, + col13 INTEGER DEFAULT NULL, + col14 INTEGER DEFAULT NULL, + col15 INTEGER DEFAULT NULL, + col16 INTEGER DEFAULT NULL, + col17 INTEGER DEFAULT NULL, + col18 INTEGER DEFAULT NULL, + col19 INTEGER DEFAULT NULL, + col20 INTEGER DEFAULT NULL, + col21 INTEGER DEFAULT NULL, + col22 INTEGER DEFAULT NULL, + col23 INTEGER DEFAULT NULL, + col24 INTEGER DEFAULT NULL, + col25 INTEGER DEFAULT NULL, + col26 INTEGER DEFAULT NULL, + col27 INTEGER DEFAULT NULL, + col28 INTEGER DEFAULT NULL, + col29 INTEGER DEFAULT NULL, + col30 INTEGER DEFAULT NULL, + col31 INTEGER DEFAULT NULL, + col32 INTEGER DEFAULT NULL, + col33 INTEGER DEFAULT NULL, + gcol1 INTEGER GENERATED ALWAYS AS (col1 + col2) VIRTUAL, + KEY idx1 (gcol1) +); + +INSERT INTO t1 (col1, col2) + VALUES (0,1), (1,2), (2,3), (3,4), (4,5); + +SELECT gcol1 FROM t1 FORCE INDEX(idx1); + +ALTER TABLE t1 ADD COLUMN extra INTEGER; + +SELECT gcol1 FROM t1 FORCE INDEX(idx1); + +DROP TABLE t1; + +CREATE TABLE t1 ( + id INT NOT NULL, + store_id INT NOT NULL, + x INT GENERATED ALWAYS AS (id + store_id) +) +PARTITION BY RANGE (store_id) ( + PARTITION p0 VALUES LESS THAN (6), + PARTITION p1 VALUES LESS THAN (11), + PARTITION p2 VALUES LESS THAN (16), + PARTITION p3 VALUES LESS THAN (21) +); + +INSERT INTO t1 VALUES(1, 2, default); +INSERT INTO t1 VALUES(3, 4, default); + +INSERT INTO t1 VALUES(3, 12, default); +INSERT INTO t1 VALUES(4, 18, default); + +CREATE INDEX idx ON t1(x); + +SELECT x FROM t1; + +DROP TABLE t1; + +CREATE TABLE t1 ( + id INT NOT NULL, + store_id INT NOT NULL, + x INT GENERATED ALWAYS AS (id + store_id) +) +PARTITION BY RANGE (x) ( + PARTITION p0 VALUES LESS THAN (6), + PARTITION p1 VALUES LESS THAN (11), + PARTITION p2 VALUES LESS THAN (16), + PARTITION p3 VALUES LESS THAN (21) +); + +insert into t1 values(1, 2, default); +insert into t1 values(3, 4, default); + +insert into t1 values(3, 12, default); +--error ER_NO_PARTITION_FOR_GIVEN_VALUE +insert into t1 values(4, 18, default); + +CREATE INDEX idx ON t1(x); +SELECT x FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a INT, b INT GENERATED ALWAYS AS (a+1) ,c int) PARTITION BY RANGE (b) ( +PARTITION p0 VALUES LESS THAN (6), +PARTITION p1 VALUES LESS THAN (11), +PARTITION p2 VALUES LESS THAN (16), +PARTITION p3 VALUES LESS THAN (21) ); + +INSERT INTO t1 VALUES (10,DEFAULT,2); +INSERT INTO t1 VALUES (19,DEFAULT,8); + +CREATE INDEX idx ON t1 (b); + +INSERT INTO t1 VALUES (5,DEFAULT,9); + +SELECT * FROM t1; + +ALTER TABLE t1 REMOVE PARTITIONING; + +DROP TABLE t1; + +CREATE TABLE `t#P#1` (a INT, bt INT GENERATED ALWAYS AS (a+1) ,c int) +PARTITION BY RANGE (bt) +subpartition by hash (bt) + ( + PARTITION p0 VALUES LESS THAN (6) ( + SUBPARTITION s0, + SUBPARTITION s1), + PARTITION p1 VALUES LESS THAN (11) ( + SUBPARTITION s2, + SUBPARTITION s3), + PARTITION p2 VALUES LESS THAN (16) ( + SUBPARTITION s4, + SUBPARTITION s5), + PARTITION p3 VALUES LESS THAN (21) ( + SUBPARTITION s6, + SUBPARTITION s7) + ); +insert into `t#P#1` values (10,DEFAULT,2); +insert into `t#P#1` values (19,DEFAULT,8); +create index idx on `t#P#1` (bt); +insert into `t#P#1` values (5,DEFAULT,9); +select * from `t#P#1`; +alter table `t#P#1` remove partitioning; +drop table `t#P#1`; + +let $row_format=DYNAMIC; +--source inc/innodb_v_large_col.inc + +let $row_format=REDUNDANT; +--source inc/innodb_v_large_col.inc + +let $row_format=COMPRESSED; +--source inc/innodb_v_large_col.inc + +# Make sure FTS_DOC_ID for FULLTEXT index set with correct column id with +# virtual columns +CREATE TABLE t(a TEXT CHARSET UTF8)ENGINE=INNODB; +ALTER TABLE t ADD COLUMN b BLOB GENERATED ALWAYS AS (a) VIRTUAL ; +ALTER TABLE t ADD FULLTEXT INDEX (a) ; +ALTER TABLE t ADD INDEX (b(1)) ; + +DROP TABLE t; + +CREATE TABLE t(a TEXT CHARSET UTF8, FULLTEXT INDEX(a))ENGINE=INNODB; +ALTER TABLE t ADD COLUMN b BLOB GENERATED ALWAYS AS (a) VIRTUAL ; +ALTER TABLE t ADD INDEX (b(1)) ; +DROP TABLE t; + +# Virtual column cannot be used as DOC ID column for FULLTEXT index +CREATE TABLE t(a TEXT CHARSET UTF8)ENGINE=INNODB; +ALTER TABLE t ADD COLUMN FTS_DOC_ID BLOB GENERATED ALWAYS AS (a) VIRTUAL ; +--error ER_INNODB_FT_WRONG_DOCID_COLUMN +ALTER TABLE t ADD FULLTEXT INDEX (a) ; +DROP TABLE t; + +# Test uses ICP on column h and d +create table t (a int,b int,c int,d int,e int, +f int generated always as (a+b) virtual, +g int,h blob,i int,unique key (d,h(25))) engine=innodb; + +select h from t where d is null; +drop table t; + +# Test Add virtual column of MySQL long true type +create table t(a blob not null) engine=innodb; +alter table t add column b int; +alter table t add column c varbinary (1000) generated always as (a) virtual; +alter table t add unique index (c(39)); +replace into t set a = 'a',b =1; +replace into t set a = 'a',b =1; +drop table t; + +CREATE TABLE t (a INT, b INT, h VARCHAR(10)); +INSERT INTO t VALUES (12, 3, "ss"); +INSERT INTO t VALUES (13, 4, "ss"); +INSERT INTO t VALUES (14, 0, "ss"); +alter table t add c INT GENERATED ALWAYS AS(a/b); +create index idx on t(c); +DROP TABLE t; + +CREATE TABLE t ( + pk INTEGER AUTO_INCREMENT, + col_int_nokey INTEGER /*! NULL */, + col_int INT GENERATED ALWAYS AS (col_int_nokey + col_int_nokey) STORED, + col_int_key INTEGER GENERATED ALWAYS AS (col_int + col_int_nokey) VIRTUAL, + col_date_nokey DATE /*! NULL */, + col_date DATE GENERATED ALWAYS AS (DATE_ADD(col_date_nokey,interval 30 day)) STORED, + col_date_key DATE GENERATED ALWAYS AS (DATE_ADD(col_date,interval 30 day)) VIRTUAL, + col_datetime_nokey DATETIME /*! NULL */, + col_time_nokey TIME /*! NULL */, + col_datetime DATETIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)) STORED, + col_time TIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)) STORED, + col_datetime_key DATETIME GENERATED ALWAYS AS (ADDTIME(col_datetime, col_time_nokey)) VIRTUAL, + col_time_key TIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time)) VIRTUAL, + col_varchar_nokey VARCHAR(1) /*! NULL */, + col_varchar VARCHAR(2) GENERATED ALWAYS AS (CONCAT(col_varchar_nokey,col_varchar_nokey)) STORED, + col_varchar_key VARCHAR(2) GENERATED ALWAYS AS (CONCAT(col_varchar, 'x')) VIRTUAL, + unique KEY (pk,col_int_key), + KEY(col_int), + KEY(col_date), + KEY(col_datetime), + KEY(col_time), + KEY(col_varchar), + UNIQUE KEY (col_int_key), + KEY (col_time_key), + KEY (col_datetime_key), + UNIQUE KEY (col_int_key, col_varchar_key), + KEY (col_int_key, col_int_nokey), + KEY(col_int_key,col_date_key), + KEY(col_int_key, col_time_key), + KEY(col_int_key, col_datetime_key), + KEY(col_date_key,col_time_key,col_datetime_key), + KEY (col_varchar_key, col_varchar_nokey), + UNIQUE KEY (col_int_key, col_varchar_key, col_date_key, col_time_key, col_datetime_key) +) AUTO_INCREMENT=10 ENGINE=INNODB PARTITION BY KEY(col_int_key) PARTITIONS 3; + +ALTER TABLE t DROP COLUMN `pk`; + +SHOW CREATE TABLE t; + +DROP TABLE t; + +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); + +INSERT INTO t VALUES (11, 3, DEFAULT, 'mm'); +INSERT INTO t VALUES (18, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (28, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (null, null, DEFAULT, 'mm'); + +--error ER_ALTER_OPERATION_NOT_SUPPORTED +ALTER TABLE t ADD COLUMN xs INT GENERATED ALWAYS AS(a+b), ADD COLUMN mm INT +GENERATED ALWAYS AS(a+b) STORED, ALGORITHM = INPLACE; + +ALTER TABLE t ADD COLUMN x INT GENERATED ALWAYS AS(a+b), ALGORITHM = INPLACE; + +ALTER TABLE t DROP COLUMN x, ALGORITHM = INPLACE; + +ALTER TABLE t ADD COLUMN x1 INT GENERATED ALWAYS AS(a+b), DROP COLUMN c, +ALGORITHM = INPLACE; + +DROP TABLE t; + +if (0) { +# Some test on virtual/stored column numbering for spatial indexing +CREATE TABLE `t` ( + `a` INT GENERATED ALWAYS AS (1) VIRTUAL, + `b` INT GENERATED ALWAYS AS (1) VIRTUAL, + `c` INT GENERATED ALWAYS AS (1) VIRTUAL, + `d` INT GENERATED ALWAYS AS (1) VIRTUAL, + `e` POINT GENERATED ALWAYS AS (1) STORED +) ENGINE=INNODB; +ALTER TABLE t ADD SPATIAL INDEX (`e`); +DROP TABLE t; +CREATE TABLE `t` ( + `a` INT GENERATED ALWAYS AS (1) VIRTUAL, + `b` INT GENERATED ALWAYS AS (1) VIRTUAL, + `c` INT GENERATED ALWAYS AS (1) VIRTUAL, + `d` INT GENERATED ALWAYS AS (1) VIRTUAL, + `e` POINT GENERATED ALWAYS AS (1) STORED, + SPATIAL INDEX (`e`) +) ENGINE=INNODB; +DROP TABLE t; +CREATE TABLE `t` ( + `a` INT GENERATED ALWAYS AS (1) VIRTUAL, + `b` INT GENERATED ALWAYS AS (1) VIRTUAL, + `c` INT GENERATED ALWAYS AS (1) VIRTUAL, + `d` INT GENERATED ALWAYS AS (1) VIRTUAL, + `e2` POINT GENERATED ALWAYS AS (1) STORED, + `e` POINT GENERATED ALWAYS AS (1) STORED +) ENGINE=INNODB; +ALTER TABLE t ADD SPATIAL INDEX (`e`); +DROP TABLE t; +CREATE TABLE `t` ( + `a` INT GENERATED ALWAYS AS (1) VIRTUAL, + `b` INT GENERATED ALWAYS AS (1) VIRTUAL, + `c` INT GENERATED ALWAYS AS (1) VIRTUAL, + `d` INT GENERATED ALWAYS AS (1) VIRTUAL, + `e2` POINT GENERATED ALWAYS AS (1) STORED, + `d2` INT GENERATED ALWAYS AS (1) VIRTUAL, + `e` POINT GENERATED ALWAYS AS (1) STORED +) ENGINE=INNODB; +ALTER TABLE t ADD SPATIAL INDEX (`e`); +DROP TABLE t; +CREATE TABLE `t` ( + `a` INT GENERATED ALWAYS AS (1) VIRTUAL, + `b` INT GENERATED ALWAYS AS (1) VIRTUAL, + `c` INT GENERATED ALWAYS AS (1) VIRTUAL, + `d` INT GENERATED ALWAYS AS (1) VIRTUAL, + `e2` POINT GENERATED ALWAYS AS (1) STORED, + `d2` INT GENERATED ALWAYS AS (1) VIRTUAL, + `e` int +) ENGINE=INNODB; +ALTER TABLE t ADD INDEX (`e`); +DROP TABLE t; +} + +CREATE TABLE t (a INT GENERATED ALWAYS AS(1) VIRTUAL,KEY(a)) ENGINE=INNODB; +INSERT INTO t VALUES(default); +SELECT a FROM t FOR UPDATE; +DROP TABLE t; + +# Test add virtual column and add index at the same time +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); + +INSERT INTO t VALUES (11, 3, DEFAULT, 'mm'); + +INSERT INTO t VALUES (18, 1, DEFAULT, 'mm'); + +INSERT INTO t VALUES (28, 1, DEFAULT, 'mm'); + +INSERT INTO t VALUES (null, null, DEFAULT, 'mm'); + +--enable_info +ALTER TABLE t ADD COLUMN x INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (x); +--disable_info + +SELECT x FROM t; + +DROP TABLE t; + +CREATE TABLE t1 (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); + +INSERT INTO t1 VALUES (11, 3, DEFAULT, 'mm'); + +INSERT INTO t1 VALUES (18, 1, DEFAULT, 'mm'); + +INSERT INTO t1 VALUES (28, 1, DEFAULT, 'mm'); + +ALTER TABLE t1 ADD INDEX idx12 (c) , FORCE, LOCK=NONE; +ALTER TABLE t1 DROP COLUMN h, ADD INDEX idx (c) , FORCE, LOCK=NONE; + +DROP TABLE t1 ; + +# Check ALTER TABLE CHANGE VIRTUAL COLUMN TYPE and ORDER +CREATE TABLE t1 (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), d INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); + +INSERT INTO t1 VALUES (11, 3, DEFAULT, DEFAULT, 'mm'); + +INSERT INTO t1 VALUES (18, 1, DEFAULT, DEFAULT, 'mm'); + +INSERT INTO t1 VALUES (28, 1, DEFAULT, DEFAULT, 'mm'); + +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t1 CHANGE d d INT GENERATED ALWAYS AS(a+b) FIRST, ALGORITHM = INPLACE; + +# Change column type is not allow for inplace also +--error ER_ALTER_OPERATION_NOT_SUPPORTED +ALTER TABLE t1 CHANGE d d VARCHAR(10) GENERATED ALWAYS AS(h), ALGORITHM = INPLACE; + +ALTER TABLE t1 CHANGE d d INT GENERATED ALWAYS AS(a+b) FIRST; + +SHOW CREATE TABLE t1; + +DROP TABLE t1; + +# Test foreign key which could be a base column of indexed virtual column +CREATE TABLE parent (id INT PRIMARY KEY) ENGINE=INNODB; + +CREATE TABLE child ( + id INT, + parent_id INT, + x int(11) GENERATED ALWAYS AS (parent_id+1), + INDEX par_ind (parent_id), + FOREIGN KEY (parent_id) + REFERENCES parent(id) + ON DELETE CASCADE +) ENGINE=INNODB; + +ALTER TABLE child ADD INDEX `i1` (x); + +# If foreign constrain does not have cascade clause, or with "no action" clause +# the index can still be created +CREATE TABLE child_1 ( + id INT, + parent_id INT, + x int(11) GENERATED ALWAYS AS (parent_id+1), + INDEX par_ind (parent_id), + FOREIGN KEY (parent_id) + REFERENCES parent(id) +) ENGINE=INNODB; + +# This should be successful +ALTER TABLE child_1 ADD INDEX `i1` (x); + +DROP TABLE child_1; + +DROP TABLE child; + +CREATE TABLE child ( + id INT, + parent_id INT, + x int(11) GENERATED ALWAYS AS (parent_id+1), + INDEX par_ind (parent_id), + INDEX i1 (x), + + FOREIGN KEY (parent_id) + REFERENCES parent(id) + ON DELETE CASCADE +) ENGINE=INNODB; + +DROP TABLE child; + +CREATE TABLE child ( + id INT, + parent_id INT, + x int(11) GENERATED ALWAYS AS (parent_id+1), + INDEX par_ind (parent_id), + INDEX `i1` (x) +) ENGINE=INNODB; + +ALTER TABLE child ADD FOREIGN KEY (parent_id) +REFERENCES parent(id) +ON DELETE CASCADE; + +# Check inplace option +SET foreign_key_checks = 0; + +ALTER TABLE child ADD FOREIGN KEY (parent_id) +REFERENCES parent(id) +ON DELETE CASCADE; + +ALTER TABLE child ADD FOREIGN KEY (parent_id) +REFERENCES parent(id) +ON DELETE SET NULL; + +ALTER TABLE child ADD FOREIGN KEY (parent_id) +REFERENCES parent(id) +ON UPDATE CASCADE; + +# this should be successful +ALTER TABLE child ADD FOREIGN KEY (parent_id) +REFERENCES parent(id); + +SET foreign_key_checks = 1; + +DROP TABLE child; + +DROP TABLE parent; + +# Test for Bug 21890816 - ASSERT UPDATE->OLD_VROW, VIRTUAL COLUMNS +CREATE TABLE `ibstd_16` ( + `a` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + `b` varchar(198) DEFAULT NULL, + `c` char(179) DEFAULT NULL, + `vadcol` int(11) GENERATED ALWAYS AS (a+length(d)) STORED, + `vbcol` char(2) GENERATED ALWAYS AS (substr(b,2,2)) VIRTUAL, + `vbidxcol` char(3) GENERATED ALWAYS AS (substr(b,1,3)) VIRTUAL, + UNIQUE KEY `b` (`b`(10),`d`), + KEY `d` (`d`), + KEY `a` (`a`), + KEY `c` (`c`(99),`b`(33)), + KEY `b_2` (`b`(5),`c`(10),`a`), + KEY `vbidxcol` (`vbidxcol`), + KEY `a_2` (`a`,`vbidxcol`), + KEY `vbidxcol_2` (`vbidxcol`,`d`) +) ENGINE=INNODB; + +# Block when FK constraint on base column of stored column. +#--error ER_CANNOT_ADD_FOREIGN +CREATE TABLE `ibstd_16_fk` ( + `a` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + `b` varchar(198) DEFAULT NULL, + `c` char(179) DEFAULT NULL, + `vadcol` int(11) GENERATED ALWAYS AS (a+length(d)) STORED, + `vbcol` char(2) GENERATED ALWAYS AS (substr(b,2,2)) VIRTUAL, + `vbidxcol` char(3) GENERATED ALWAYS AS (substr(b,1,3)) VIRTUAL, + UNIQUE KEY `b` (`b`(10),`a`,`d`), + KEY `d` (`d`), + KEY `a` (`a`), + KEY `c` (`c`(99),`b`(33)), + KEY `b_2` (`b`(5),`c`(10),`a`), + KEY `vbidxcol` (`vbidxcol`), + KEY `a_2` (`a`,`vbidxcol`), + KEY `vbidxcol_2` (`vbidxcol`,`d`), + CONSTRAINT `fk_16` FOREIGN KEY (`a`) REFERENCES `ibstd_16` (`a`) ON DELETE SET NULL +) ENGINE=InnoDB; +DROP TABLE ibstd_16_fk; + +# Take out "KEY `a_2` (`a`,`vbidxcol`)", this should then be successful +CREATE TABLE `ibstd_16_fk` ( + `a` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + `b` varchar(198) DEFAULT NULL, + `c` char(179) DEFAULT NULL, + `vbcol` char(2) GENERATED ALWAYS AS (substr(b,2,2)) VIRTUAL, + `vbidxcol` char(3) GENERATED ALWAYS AS (substr(b,1,3)) VIRTUAL, + UNIQUE KEY `b` (`b`(10),`a`,`d`), + KEY `d` (`d`), + KEY `a` (`a`), + KEY `c` (`c`(99),`b`(33)), + KEY `b_2` (`b`(5),`c`(10),`a`), + KEY `vbidxcol` (`vbidxcol`), + KEY `vbidxcol_2` (`vbidxcol`,`d`), + CONSTRAINT `fk_16` FOREIGN KEY (`a`) REFERENCES `ibstd_16` (`a`) ON DELETE SET NULL +) ENGINE=InnoDB; + +ALTER TABLE ibstd_16_fk ADD INDEX `a_2` (`a`,`vbidxcol`); + +# Now try to add a table with virtual index, and then add constraint +DROP TABLE ibstd_16_fk; + +# Create a table without constraint +CREATE TABLE `ibstd_16_fk` ( + `a` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + `b` varchar(198) DEFAULT NULL, + `c` char(179) DEFAULT NULL, + `vbcol` char(2) GENERATED ALWAYS AS (substr(b,2,2)) VIRTUAL, + `vbidxcol` char(3) GENERATED ALWAYS AS (substr(b,1,3)) VIRTUAL, + UNIQUE KEY `b` (`b`(10),`a`,`d`), + KEY `d` (`d`), + KEY `a` (`a`), + KEY `c` (`c`(99),`b`(33)), + KEY `b_2` (`b`(5),`c`(10),`a`), + KEY `vbidxcol` (`vbidxcol`), + KEY `a_2` (`a`,`vbidxcol`), + KEY `vbidxcol_2` (`vbidxcol`,`d`) +) ENGINE=InnoDB; + +ALTER TABLE `ibstd_16_fk` ADD CONSTRAINT `fk_16` FOREIGN KEY (`a`) REFERENCES `ibstd_16` (`a`) ON DELETE SET NULL; + +# DROP the index +DROP INDEX a_2 ON ibstd_16_fk; + +INSERT INTO ibstd_16 VALUES (1, 2, "aaa", "bbb", default, default, default); +INSERT INTO ibstd_16_fk VALUES(1, 3, "mmm", "SSS", default, default); + +# Cascading delete/update on column non-related to virtual column or virtual +# index will be fine +DELETE FROM ibstd_16 WHERE a = 1; + +DROP TABLE ibstd_16_fk; +DROP TABLE ibstd_16; + +# Bug 21941320 - GCOLS: FAILING ASSERTION: N_IDX > 0 +create table t(a int) engine=innodb; +insert into t set a=1; +alter table t add column c int generated always as (1) virtual; +insert into t set a=2; + +# Following will cause create index fail, we need to make sure the column +# ord_part is reset +--error ER_DUP_ENTRY +alter table t add unique index(c); +insert into t set a=1; +drop table t; + +# Bug 21875974 - VCOL : READ OF FREED MEMORY IN DTUPLE_GET_N_FIELDS +# CAUSE CRASH + +create table t ( + x int, + a int generated always as (x) virtual, + b int generated always as (1) stored, + c int not null, + unique (b), + unique (a,b) +) engine=innodb; + +insert into t(x, c) values(1, 3); + +# This will exercise row_vers_impl_x_locked_low() for virtual columns +replace into t(x, c) values(1, 0); + +drop table t; + +# Bug22123674 VCOL:INNODB: FAILING ASSERTION: !UT_STRCMP(NAME, +# FIELD->FIELD_NAME) + +CREATE TABLE t( +c7c CHAR(1)GENERATED ALWAYS AS (c3) VIRTUAL, +c1 int(1), +c2 int(1), +c3 int(1), +c4 int(1), +c5 int(1)GENERATED ALWAYS AS ((c2 - c4)) VIRTUAL, +UNIQUE KEY c5_9(c5) +)ENGINE=InnoDB DEFAULT CHARSET=latin1; + +--error ER_ALTER_OPERATION_NOT_SUPPORTED +ALTER TABLE t CHANGE COLUMN c5 c5 INT(1) GENERATED ALWAYS AS(c2 - +c4)VIRTUAL AFTER c3,ALGORITHM=INPLACE; + +--error ER_ALTER_OPERATION_NOT_SUPPORTED +ALTER TABLE t CHANGE COLUMN c7c c7c INT(1) GENERATED ALWAYS AS(c3) +VIRTUAL AFTER c5,ALGORITHM=INPLACE; + +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t DROP COLUMN c7c,ADD COLUMN c5c INT GENERATED ALWAYS AS(c4/ +c3)VIRTUAL AFTER c3,ALGORITHM=INPLACE; + +DROP TABLE t; + +# Bug22111464 VCOL:INNODB: FAILING ASSERTION: I < TABLE->N_DEF + +CREATE TABLE `t` ( + `col1` int(11) DEFAULT NULL, + `col2` int(11) DEFAULT NULL, + `col4` int(11) DEFAULT NULL, + `col5` int(11) GENERATED ALWAYS AS ((`col2` % `col4`)) VIRTUAL, + `col6` int(11) GENERATED ALWAYS AS ((`col2` - `col2`)) VIRTUAL, + `col5x` int(11) GENERATED ALWAYS AS ((`col1` / `col1`)) VIRTUAL, + `col6x` int(11) GENERATED ALWAYS AS ((`col2` / `col4`)) VIRTUAL, + `col7x` int(11) GENERATED ALWAYS AS ((`col6` % `col6x`)) VIRTUAL, + `col8x` int(11) GENERATED ALWAYS AS ((`col6` / `col6`)) VIRTUAL, + `col9` text, + `col7c` int(11) GENERATED ALWAYS AS ((`col6x` % `col6x`)) VIRTUAL, + `col1b` varchar(20) GENERATED ALWAYS AS (`col1`) VIRTUAL, + `col3` int(11) DEFAULT NULL, + `col7` int(11) DEFAULT NULL, + `col5c` int(11) GENERATED ALWAYS AS ((`col5x` * `col6`)) VIRTUAL, + `col6c` varchar(20) GENERATED ALWAYS AS (`col5x`) VIRTUAL, + `col3b` bigint(20) GENERATED ALWAYS AS ((`col6x` * `col6`)) VIRTUAL, + `col1a` varchar(20) GENERATED ALWAYS AS (`col1`) VIRTUAL, + `col8` int(11) DEFAULT NULL, + UNIQUE KEY `col5` (`col5`), + UNIQUE KEY `col6x` (`col6x`), + UNIQUE KEY `col5_2` (`col5`), + KEY `idx2` (`col9`(10)), + KEY `idx4` (`col2`), + KEY `idx8` (`col9`(10),`col5`), + KEY `idx9` (`col6`), + KEY `idx6` (`col6`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +ALTER TABLE t CHANGE COLUMN col3b col8a BIGINT GENERATED ALWAYS AS +(col6x * col6) VIRTUAL, ADD UNIQUE KEY uidx ( col8a ); + +DROP TABLE t; + +--echo # +--echo # Bug 22141031 - GCOLS: PURGED THREAD DIES: TRIED TO PURGE +--echo # NON-DELETE-MARKED RECORD IN INDEX +--echo # +create table t ( + a int,b int,c text,d int,e int,f int,g int, + h text generated always as ('1') virtual, + i int,j int,k int,l int,m int, + primary key (c(1)),unique key (c(1)), + key (i),key (h(1)) +) engine=innodb default charset latin1; + +replace into t(c) values (''); +replace into t(c) values (''); +alter table t drop column d ; + +drop table t; + +--echo # +--echo # Bug 22139917 - ASSERTION: DICT_TABLE_GET_NTH_COL(USER_TABLE, NTH_COL) +--echo # ->LEN < NEW_LEN +--echo # + +create table t ( + a int generated always as (1) virtual, + b varbinary(1), + c varbinary(1) generated always as (b) virtual +) engine=innodb; +alter table t change column b b varbinary(2), algorithm=inplace; +alter table t change column c c varbinary(2) generated always as (b) virtual, algorithm=inplace; + +drop table t; + +# Bug22202788 GCOL:ASSERTION:0 IN ROW_SEL_GET_CLUST_REC_FOR_MYSQL AT +# ROW0SEL.CC +SET @@SESSION.sql_mode=0; + +CREATE TABLE t( + c1 INT AUTO_INCREMENT, + c2 INT, + c3 INT GENERATED ALWAYS AS(c2 + c2)VIRTUAL, + c3k INT GENERATED ALWAYS AS(c2 + c3)VIRTUAL, + c4 DATE, + c5 DATE GENERATED ALWAYS AS(DATE_ADD(c4,interval 30 day)) VIRTUAL, + c5k DATE GENERATED ALWAYS AS(DATE_ADD(c4,interval 30 day)) VIRTUAL, + c5time_gckey DATE, + c6 TIME, + c5time DATE GENERATED ALWAYS AS(ADDTIME(c5time_gckey,c6)) VIRTUAL, + c7 TIME GENERATED ALWAYS AS(ADDTIME(c5time_gckey,c6)) VIRTUAL, + c5timek DATE GENERATED ALWAYS AS(ADDTIME(c5time_gckey,c7)) VIRTUAL, + c7k TIME GENERATED ALWAYS AS(ADDTIME(c5time,c6)) VIRTUAL, + c8 CHAR(10), + c9 CHAR(20)GENERATED ALWAYS AS (CONCAT(c8,c8)) VIRTUAL, + c9k CHAR(15)GENERATED ALWAYS AS (CONCAT(c8,0)) VIRTUAL, + PRIMARY KEY(c1), + KEY(c3), + KEY(c9(10)), + UNIQUE KEY(c9k), + UNIQUE KEY(c3k,c9k(5),c5k,c7k,c5timek,c3,c9(5),c5,c7,c5time) +)ENGINE=INNODB; + +--error ER_DUP_ENTRY +INSERT INTO +t(c2,c4,c6,c5time_gckey,c8)VALUES(1,0,0,0,0),(0,0,0,0,'ityzg'),(0,0,1,0,'tyzgk +t'),(0,1,0,1,'yzgktb'),(0,0,0,0,'zgktb'),(0,0,0,0,'gktbkj'),(0,0,0,0,0),(0,0,1 +,0,1),(0,0,0,0,1),(0,0,0,0,'tbkjrkm'),(0,0,0,0,'bkjr'),(0,0,0,0,0),(0,0,0,0,0) +,(0,0,0,0,'rk'),(0,0,0,0,'kmqmknbtoe'),(1,0,0,0,'mqmknbt'),(0,1,0,0,'qmknb'),( +0,0,0,0,'mkn'),(0,0,0,0,'knbtoervql'),(0,0,1,0,1),(0,0,0,0,'nbtoerv'),(0,0,0,0 +,'btoerv'),(0,0,1,0,'toer'),(1,0,0,0,0),(0,0,0,0,'ervq'),(0,0,0,0,'rvqlzsvasu' +),(0,0,0,0,'vqlzs'),(0,0,0,0,0),(0,1,0,0,'lzsvasu'),(0,0,0,0,'zsvasurq'); + +SELECT +DISTINCT * FROM t +FORCE KEY(PRIMARY,c3k,c3,c9k,c9) +WHERE +(c9 IS NULL AND (c9=0)) +OR( +(c9k NOT IN ('ixfq','xfq','New Mexico','fq')OR c9 IS NULL) +) +OR(c9 BETWEEN 'hwstqua' AND 'wstquadcji' OR (c9k=0)) +AND(c3 IS NULL OR c3 IN (0,0,0)); + +drop table t; + +# +# BUG#22082762 RE-ENABLE SUPPORT FOR ADDING VIRTUAL INDEX WHILE DROPPING VIRTUAL COLUMN +# + +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), d INT +GENERATED ALWAYS AS(a+b+b), e INT GENERATED ALWAYS AS(a), h VARCHAR(10)); + +INSERT INTO t VALUES (11, 3, DEFAULT, DEFAULT, DEFAULT, 'mm'); +INSERT INTO t VALUES (18, 1, DEFAULT, DEFAULT, DEFAULT, 'mm'); +INSERT INTO t VALUES (28, 1, DEFAULT, DEFAULT, DEFAULT, 'mm'); +INSERT INTO t VALUES (null, null, DEFAULT, DEFAULT, DEFAULT, 'mm'); +CREATE INDEX idx ON t(c, d); +CREATE INDEX idx1 ON t(c); +CREATE INDEX idx2 ON t(e, c, d); + +# This will drop column c, drop index idx1 on column c, and build index +# idx and idx2, so they become idx(d) and idx2(e, d) respectively. +ALTER TABLE t DROP COLUMN c, ALGORITHM=INPLACE; + +SELECT d FROM t; + +SHOW CREATE TABLE t; + +# Drop a column, adding a new column and also adding a index on this new column +# is not allowed for INPLACE algorithm +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t DROP COLUMN d, ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (c), ALGORITHM=INPLACE; + +# Add an index on existing column along with dropping a column is allowed +ALTER TABLE t DROP COLUMN d, ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (e), ALGORITHM=INPLACE, LOCK=NONE; +SHOW CREATE TABLE t; + +# Add an index on existing column along with adding a virtual column and droping a virtual index +ALTER TABLE t ADD INDEX idx4(c, e), ADD COLUMN x VARCHAR(10) GENERATED ALWAYS AS(h), DROP INDEX idx, ALGORITHM=INPLACE, LOCK=NONE; +SHOW CREATE TABLE t; + +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t ADD COLUMN i INT GENERATED ALWAYS AS(a+a+b), ADD COLUMN j INT, ALGORITHM=INPLACE; + +# Add an index along with adding a regular column is allowed. +ALTER TABLE t ADD INDEX (x), ADD COLUMN j INT, ALGORITHM=INPLACE, LOCK=NONE; +SHOW CREATE TABLE t; + +# Online add an index on newly added virtual column is not allowed. +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t ADD COLUMN i INT GENERATED ALWAYS AS(a+a+b), ADD INDEX (i), ALGORITHM=INPLACE, LOCK=NONE; + +ALTER TABLE t ADD COLUMN i INT GENERATED ALWAYS AS(a+a+b), ADD INDEX (i), ALGORITHM=INPLACE, LOCK=SHARED; +SHOW CREATE TABLE t; + +SELECT i FROM t; + +SELECT * FROM t; + +DROP TABLE t; + +# +# BUG#22469459 WRONG VALUES IN ADDED INDEX WHILE DROPPING VIRTUAL COLUMN +# + +# Drop column with existing index on it. +CREATE TABLE t ( + a INT, + b INT, + c INT GENERATED ALWAYS AS(a+b), + d INT GENERATED ALWAYS AS(a+b+b), + KEY vidx (c, d) +)ENGINE=INNODB; + +INSERT INTO t (a,b) VALUES (0, 0), (1, NULL), (NULL, 2), (NULL, NULL); + +SELECT c, d FROM t; + +SELECT * FROM t; + +ALTER TABLE t DROP COLUMN c, ALGORITHM=INPLACE; + +SELECT d FROM t; + +SELECT * FROM t; + +DROP TABLE t; + +# Drop column with a new index. +CREATE TABLE t ( + a INT, + b INT, + c INT GENERATED ALWAYS AS(a+b), + d INT GENERATED ALWAYS AS(a+b+b) +)ENGINE=INNODB; + +INSERT INTO t (a,b) VALUES (0, 0), (1, NULL), (NULL, 2), (NULL, NULL); + +SELECT * FROM t; + +ALTER TABLE t DROP COLUMN c, ADD INDEX vidx(d), ALGORITHM=INPLACE; + +SELECT d FROM t; + +SELECT * FROM t WHERE d > 0; + +SELECT * FROM t; + +DROP TABLE t; + +--echo # +--echo # Bug #22162200 MEMORY LEAK IN HA_INNOPART_SHARE +--echo # ::SET_V_TEMPL PARTITIONED ON VIRTUAL COLUMN +--echo # +create table t ( + c tinyint, + d longblob generated always as (c) virtual +) engine=innodb partition by key (c) partitions 2; + +select d in(select d from t)from t group by d; +drop table t; + +--echo # +--echo # BUG#23052231 - ASSERTION FAILURE: ROW0MERGE.CC:2100:ADD_AUTOINC +--echo # < DICT_TABLE_GET_N_USER_COLS +--echo # +CREATE TABLE `t` ( + `a` int(11) NOT NULL, + `d` int(11) NOT NULL, + `b` varchar(198) NOT NULL, + `c` char(177) DEFAULT NULL, + `vadcol` int(11) GENERATED ALWAYS AS ((`a` + length(`d`))) STORED, + `vbcol` char(2) GENERATED ALWAYS AS (substr(`b`,2,2)) VIRTUAL, + `vbidxcol` char(3) GENERATED ALWAYS AS (substr(`b`,1,3)) VIRTUAL, + PRIMARY KEY (`b`(10),`a`,`d`), + KEY `d` (`d`), + KEY `a` (`a`), + KEY `c_renamed` (`c`(99),`b`(35)), + KEY `b` (`b`(5),`c`(10),`a`), + KEY `vbidxcol` (`vbidxcol`), + KEY `a_2` (`a`,`vbidxcol`), + KEY `vbidxcol_2` (`vbidxcol`,`d`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +INSERT INTO t values (11, 1, "11", "aa", default, default, default); + +ALTER TABLE t ADD COLUMN nc01128 BIGINT AUTO_INCREMENT NOT NULL, ADD KEY auto_nc01128(nc01128); + +DROP TABLE t; + +--echo # +--echo #Bug #22965271 NEEDS REBUILD FOR COLUMN LENGTH CHANGE THAT IS +--echo #PART OF VIRTUAL INDEX. +--echo # + +CREATE TABLE t1( +a VARCHAR(45) CHARACTER SET LATIN1, +b VARCHAR(115) CHARACTER SET UTF8 GENERATED ALWAYS AS ('f1') VIRTUAL, +UNIQUE KEY (b,a))ENGINE=INNODB; +INSERT INTO t1(a) VALUES (''); +ALTER TABLE t1 CHANGE COLUMN a a VARCHAR(85); +SELECT * FROM t1; +DROP TABLE t1; diff --git a/mysql-test/suite/gcol/t/innodb_virtual_blob.test b/mysql-test/suite/gcol/t/innodb_virtual_blob.test new file mode 100644 index 00000000000..a97992d81e7 --- /dev/null +++ b/mysql-test/suite/gcol/t/innodb_virtual_blob.test @@ -0,0 +1,16 @@ +--source include/have_innodb.inc + +--echo # +--echo # Bug#22046353 ALTER: ASSERT PAGE_SIZE.EQUALS_TO(SPACE_PAGE_SIZE), +--echo # BTR_COPY_BLOB_PREFIX +--echo # + +CREATE TABLE t1 +( f1 int primary key, f2 blob, + f3 blob generated always as (f2)) + row_format=compressed, engine=innodb; +insert into t1 (f1, f2) values (1, repeat('&', 50000)); +alter table t1 add index i1 (f3(200)) ; +alter table t1 row_format=compact; +drop table t1; + diff --git a/mysql-test/suite/gcol/t/innodb_virtual_debug.test b/mysql-test/suite/gcol/t/innodb_virtual_debug.test new file mode 100644 index 00000000000..72be27775ed --- /dev/null +++ b/mysql-test/suite/gcol/t/innodb_virtual_debug.test @@ -0,0 +1,240 @@ +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/have_debug.inc +--source include/count_sessions.inc + +set default_storage_engine=innodb; +CREATE TABLE `t` ( + `a` VARCHAR(100), + `b` VARCHAR(100), + `c` VARCHAR(200) GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, + `h` VARCHAR(10) DEFAULT NULL, + `i` int +) ENGINE=InnoDB; + +INSERT INTO t VALUES (REPEAT('g', 100), REPEAT('x', 10), DEFAULT, "kk", 1); +INSERT INTO t VALUES (REPEAT('a', 100), REPEAT('b', 100), DEFAULT, "mm", 2); + +CREATE INDEX idx ON t(c(100)); + +SET session debug_dbug="+d,ib_alter_add_virtual_fail"; +--error ER_WRONG_KEY_COLUMN +ALTER TABLE t ADD COLUMN x VARCHAR(200) GENERATED ALWAYS AS (a) VIRTUAL, +ALGORITHM = INPLACE; +--error ER_WRONG_KEY_COLUMN +ALTER TABLE t DROP COLUMN c, ALGORITHM = INPLACE; +SET session debug_dbug=""; +DROP TABLE t; + +#online test +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); + +INSERT INTO t VALUES (11, 3, DEFAULT, 'mm'); +INSERT INTO t VALUES (18, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (28, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (null, null, DEFAULT, "mx"); + +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead'; +--send CREATE INDEX idx ON t(c) + +connect (con1,localhost,root,,); + +SET DEBUG_SYNC = 'now WAIT_FOR start_create'; +update t set a=0 where a = 11; +start transaction; +update t set a=1 where a = 0; +ROLLBACK; +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; + +connection default; +reap; + +SELECT c FROM t; +SHOW CREATE TABLE t; +SELECT * FROM t; + +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead'; +--send ALTER TABLE t ADD COLUMN x INT + +connection con1; + +SET DEBUG_SYNC = 'now WAIT_FOR start_create'; +start transaction; +update t set a=1 where a = 0; +rollback; +start transaction; +delete from t; +insert into t values(1,null,default,null); +rollback; +start transaction; +update t set b=b+1; +rollback; +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; + +connection default; +reap; + +check table t; +SELECT c FROM t; + +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead'; +--send ALTER TABLE t ADD COLUMN x2 INT + +connection con1; + +SET DEBUG_SYNC = 'now WAIT_FOR start_create'; +start transaction; +DELETE FROM t WHERE a = 0; +ROLLBACK; +DELETE FROM t WHERE a = 0; +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; + +connection default; +reap; + +SELECT c FROM t; + +disconnect con1; +DROP TABLE t; + +SET DEBUG_SYNC = 'RESET'; + + +# Test add virtual column and add index at the same time +# introduce some error + +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); + +INSERT INTO t VALUES (11, 3, DEFAULT, 'mm'); + +INSERT INTO t VALUES (18, 1, DEFAULT, 'mm'); + +INSERT INTO t VALUES (28, 1, DEFAULT, 'mm'); + +INSERT INTO t VALUES (null, null, DEFAULT, 'mm'); + +CREATE INDEX idx_1 on t(c); + +SET SESSION debug_dbug="+d,create_index_fail"; + +--enable_info +--error ER_DUP_ENTRY +ALTER TABLE t ADD COLUMN x INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (x); +SET SESSION debug_dbug=""; +--disable_info + +SHOW CREATE TABLE t; + +SELECT c FROM t; + +DROP TABLE t; + + +--echo # +--echo # Bug#22018532 ASSERTION WHEN ONLINE REAPPLY REBUILD LOG ON +--echo # MULTIPLE INDEXED VIRTUAL COLUMNS +--echo # + +create table t ( + a int as (1) virtual, + b int, + c int as (1) virtual, + unique(b), + unique(c), + key(a) +) engine=innodb; + +insert ignore into t values(); + +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead'; +--send optimize table t + +connect (con1,localhost,root,,); + +SET DEBUG_SYNC = 'now WAIT_FOR start_create'; +insert ignore into t values(); +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; + +connection default; +--echo /* connection default */ optimize table t; +reap; +SELECT c FROM t; +SHOW CREATE TABLE t; +SELECT * FROM t; +DROP TABLE t; + +# Do another test without duplicate error + +CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); + +INSERT INTO t VALUES (11, 3, DEFAULT, 'mm'); +INSERT INTO t VALUES (18, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (28, 1, DEFAULT, 'mm'); +INSERT INTO t VALUES (null, null, DEFAULT, 'mm'); + +CREATE INDEX idx ON t(c); + +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_rebuild WAIT_FOR go_ahead'; +--send optimize table t + +connection con1; +SET DEBUG_SYNC = 'now WAIT_FOR start_rebuild'; +INSERT INTO t VALUES (48, 2, DEFAULT, 'xx'); +INSERT INTO t VALUES (68, 3, DEFAULT, 'sx'); +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; + +connection default; +--echo /* connection default */ optimize table t; +reap; + +SELECT c FROM t; + +disconnect con1; + +DROP TABLE t; + +--echo # +--echo # Bug#22951879 - ASSERTS RELATED TO ONLINE DDL AND GCOL +--echo # + +# Create a table with 2 virtual column, one (vbidxcol) is indexed and +# the other one (vbcol) is not +create table ibstd_14 (a int not null, d int not null, b varchar(198) not null, c char(181), vadcol int as (a+length(d)) stored, vbcol char(2) as (substr(b,2,2)) virtual, vbidxcol char(3) as (substr(b,1,3)) virtual , index(d), index(a), index(vbidxcol), index(a,vbidxcol), index(vbidxcol,d), unique key (b(10), a, d), index(c(99), b(31)), index(b(5), c(10), a) , index(a,d)) engine=InnoDB stats_persistent=1 row_format=dynamic; + +# Do an alter table rebuild table and also create a new index on this +# non-indexed virtual column +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead'; +--send alter table ibstd_14 row_format=compressed key_block_size=4,add key kn3 (d,c,vbcol,b) + +# Do a concurrent insert, and make sure this newly indexed virtual column +# is also logged +connect (con1,localhost,root); +SET DEBUG_SYNC = 'now WAIT_FOR start_create'; +insert into ibstd_14 (a,d,b,c, vbidxcol, vbcol) values ('118','6',repeat('oacolaarlruoacuroauurloraarucoooarcooauoolacalllaulrruarrrucruuooclacuoouccarrcoocloccorrrrarourcooalloocooccouruolaorlcaocualolc','1'),repeat('lolrrlalcocroraaulauclaaucolcorcuooaolruaooooluooooouaoorlarucorullalcrrloccououaooaorluorraclrcooouuolocoaolcocaaculruoocucoocoooauuolarcoraraocaoolulolarru','1'),default,default); + +insert into ibstd_14 (a,d,b,c, vbidxcol, vbcol) values ('118','6', 'aaaa', 'lll', default, default); + +# Also do an concurrent update, make sure this is performed +update ibstd_14 set b='11111' where b='aaaa'; + +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; + +connection default; +reap; + +select * from ibstd_14; + +# This will use the newly added "kn3" index, to check materialized vbcol +# after log reapply +select d,c,vbcol,b from ibstd_14; + +# check the value is inserted into the index +select vbcol from ibstd_14; + +drop table ibstd_14; + +disconnect con1; + +SET DEBUG_SYNC = 'RESET'; + +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test new file mode 100644 index 00000000000..1e6cd44d0aa --- /dev/null +++ b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test @@ -0,0 +1,194 @@ +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/have_debug.inc +--source include/have_partition.inc + +set default_storage_engine=innodb; +set @old_dbug=@@global.debug_dbug; + +CREATE TABLE `t` ( + `a` BLOB, + `b` BLOB, + `c` BLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, + `h` VARCHAR(10) DEFAULT NULL, + `i` int +) ENGINE=InnoDB; + +INSERT INTO t VALUES (REPEAT('g', 16000), REPEAT('x', 16000), DEFAULT, "kk", 1); +INSERT INTO t VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, "mm", 2); + +CREATE INDEX idx ON t(c(100)); + +SET global debug_dbug="+d,ib_purge_virtual_index_callback"; +UPDATE t SET a = REPEAT('m', 16000) WHERE a like "aaa%"; +select sleep(3); +SET global debug_dbug=@old_dbug; +DROP TABLE t; + + +CREATE TABLE t ( + a TINYBLOB, + b TINYBLOB, + c TINYBLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, + h VARCHAR(10) DEFAULT NULL, + i INT +) ROW_FORMAT=COMPACT ENGINE=InnoDB; + +INSERT INTO t VALUES (REPEAT('g', 100), REPEAT('x', 100), DEFAULT, "kk", 1); +INSERT INTO t VALUES (REPEAT('a', 100), REPEAT('b', 100), DEFAULT, "mm", 2); + +CREATE INDEX idx ON t(c(100)); + +SET global debug_dbug="+d,ib_purge_virtual_index_callback"; +UPDATE t SET a = REPEAT('m', 100) WHERE a like "aaa%"; +select sleep(3); +SET global debug_dbug=@old_dbug; +DROP TABLE t; + + +CREATE TABLE t1 ( + id INT NOT NULL, + store_id INT NOT NULL, + x INT GENERATED ALWAYS AS (id + store_id) +) +PARTITION BY RANGE (store_id) ( + PARTITION p0 VALUES LESS THAN (6), + PARTITION p1 VALUES LESS THAN (11), + PARTITION p2 VALUES LESS THAN (16), + PARTITION p3 VALUES LESS THAN (21) +); + +insert into t1 values(1, 2, default); +insert into t1 values(3, 4, default); + +insert into t1 values(3, 12, default); +insert into t1 values(4, 18, default); + +CREATE INDEX idx ON t1(x); + +SET global debug_dbug="+d,ib_purge_virtual_index_callback"; +UPDATE t1 SET id = 10 WHERE id = 1; +select sleep(3); +SET global debug_dbug=@old_dbug; +DROP TABLE t1; + +# +# BUG#22082762 RE-ENABLE SUPPORT FOR ADDING VIRTUAL INDEX WHILE DROPPING VIRTUAL COLUMN +# +--source include/count_sessions.inc + +connect (con1,localhost,root,,); +connection default; + +# Test adding virtual index on newly added virtual column +CREATE TABLE t1 (a INT, b INT); + +INSERT INTO t1(a, b) VALUES (1, 1), (2, 2), (3, 3); + +connection con1; +--echo # disable purge +CREATE TABLE t0 (a INT) ENGINE=InnoDB; +BEGIN; SELECT * FROM t0; + +connection default; +DELETE FROM t1 WHERE a = 1; + +UPDATE t1 SET a = 4, b = 4 WHERE a = 3; + +INSERT INTO t1(a, b) VALUES (5, 5); + +SET DEBUG_SYNC= 'inplace_after_index_build SIGNAL uncommitted WAIT_FOR purged'; +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t1 ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=NONE; +send ALTER TABLE t1 ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=SHARED; + +connection con1; +SET DEBUG_SYNC= 'now WAIT_FOR uncommitted'; + +--echo # enable purge +COMMIT; + +--echo # wait for purge to process the deleted records. +--source include/wait_innodb_all_purged.inc + +SET DEBUG_SYNC= 'now SIGNAL purged'; + +connection default; +--echo /* connection default */ ALTER TABLE t1 ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=SHARED; +--reap +SHOW CREATE TABLE t1; + +SELECT * FROM t1; + +DROP TABLE t1; + +# Test adding virutal index on existing virtual column +CREATE TABLE t1 (a INT, b INT, c INT GENERATED ALWAYS AS(a+b)); + +INSERT INTO t1(a, b) VALUES (1, 1), (2, 2), (3, 3), (4, 4); + +connection con1; +--echo # disable purge +BEGIN; SELECT * FROM t0; + +connection default; +DELETE FROM t1 WHERE a = 1; + +UPDATE t1 SET a = 2, b = 2 WHERE a = 5; + +INSERT INTO t1(a, b) VALUES (6, 6); + +SET DEBUG_SYNC= 'inplace_after_index_build SIGNAL uncommitted WAIT_FOR purged'; +send ALTER TABLE t1 ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=NONE; + +connection con1; +SET DEBUG_SYNC= 'now WAIT_FOR uncommitted'; + +DELETE FROM t1 WHERE a = 3; + +UPDATE t1 SET a = 7, b = 7 WHERE a = 4; + +INSERT INTO t1(a, b) VALUES (8, 8); + +--echo # enable purge +COMMIT; + +--echo # wait for purge to process the deleted/updated records. +--source include/wait_innodb_all_purged.inc + +SET DEBUG_SYNC= 'now SIGNAL purged'; + +disconnect con1; + +connection default; +--echo /* connection default */ ALTER TABLE t1 ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=NONE; +--reap +SHOW CREATE TABLE t1; + +SELECT * FROM t1; + +DROP TABLE t0, t1; + +# +# test MDLs with purge +# +create table t (a blob, b blob, c blob as (concat(a,b)), h varchar(10), index (c(100))); +insert t(a,b,h) values (repeat('g', 16000), repeat('x', 16000), "kk"); +insert t(a,b,h) values (repeat('a', 16000), repeat('b', 16000), "mm"); +set global innodb_purge_stop_now = 1; +set global debug_dbug="+d,ib_purge_virtual_index_callback"; +update t set a = repeat('m', 16000) where a like "aaa%"; +connect(con1, localhost, root); +lock table t write; +connection default; +set global innodb_purge_run_now=1; +sleep 3; +select variable_value>1 from information_schema.global_status where variable_name='innodb_purge_trx_id_age'; +disconnect con1; +sleep 3; +select variable_value>1 from information_schema.global_status where variable_name='innodb_purge_trx_id_age'; +set global debug_dbug=@old_dbug; +drop table t; + +--source include/wait_until_count_sessions.inc +set debug_sync=reset; diff --git a/mysql-test/suite/gcol/t/innodb_virtual_fk.test b/mysql-test/suite/gcol/t/innodb_virtual_fk.test new file mode 100644 index 00000000000..bd8f3664839 --- /dev/null +++ b/mysql-test/suite/gcol/t/innodb_virtual_fk.test @@ -0,0 +1,492 @@ +-- source include/have_innodb.inc + +set default_storage_engine=innodb; + +--echo # +--echo # Bug#22469130: FOREIGN KEY ON DELETE CASCADE NOT ALLOWED +--echo # WHEN A VIRTUAL INDEX EXISTS. + + +--echo # UPDATE CASCADE +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT AS (fld1) VIRTUAL, KEY(fld2), + FOREIGN KEY(fld1) REFERENCES t1(fld1) ON UPDATE CASCADE); +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +SELECT * FROM t2; +DROP TABLE t2, t1; + +--echo # UPDATE SET NULL +CREATE TABLE t1(fld1 INT NOT NULL, fld2 INT NOT NULL PRIMARY KEY, + KEY(fld1)); +CREATE TABLE t2(fld1 INT, fld2 INT AS (fld1) VIRTUAL, KEY(fld2), + FOREIGN KEY(fld1) REFERENCES t1(fld1) ON UPDATE SET NULL); +INSERT INTO t1 VALUES(1, 2); +INSERT INTO t2 VALUES(1, DEFAULT); +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +SELECT * FROM t2; +DROP TABLE t2, t1; + +--echo # DELETE CASCADE +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT, fld2 INT AS (fld1) VIRTUAL, KEY(fld2), + FOREIGN KEY(fld1) REFERENCES t1(fld1) ON DELETE CASCADE); +INSERT INTO t1 VALUES(1); +INSERT INTO t1 VALUES(2); +INSERT INTO t2 VALUES(1, DEFAULT); +INSERT INTO t2 VALUES(2, DEFAULT); +DELETE FROM t1 WHERE fld1= 1; +SELECT fld2 FROM t2; +SELECT * FROM t2; +DROP TABLE t2, t1; + +--echo # DELETE SET NULL +CREATE TABLE t1(fld1 INT NOT NULL, fld2 INT NOT NULL PRIMARY KEY, KEY(fld1)); +CREATE TABLE t2(fld1 INT, fld2 INT AS (fld1) VIRTUAL, KEY(fld2), + FOREIGN KEY(fld1) REFERENCES t1(fld1) ON DELETE SET NULL); +INSERT INTO t1 VALUES(1, 1); +INSERT INTO t1 VALUES(2, 2); +INSERT INTO t2 VALUES(1, DEFAULT); +INSERT INTO t2 VALUES(2, DEFAULT); +DELETE FROM t1 WHERE fld1= 1; +SELECT fld2 FROM t2; +SELECT * FROM t2; +DROP TABLE t2, t1; + +--echo # VIRTUAL INDEX CONTAINS FK CONSTRAINT COLUMN +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT, fld3 INT AS (fld2) VIRTUAL, + KEY(fld3, fld1), + FOREIGN KEY(fld1) REFERENCES t1(fld1) ON UPDATE CASCADE); +INSERT INTO t1(fld1) VALUES(1); +INSERT INTO t2(fld1, fld2) VALUES(1, 3); +UPDATE t1 SET fld1= 2; +SELECT fld3, fld1 FROM t2; +SELECT * FROM t2; +DROP TABLE t2, t1; + +--echo # Multiple level of VIRTUAL columns. + +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT AS (fld1) VIRTUAL, + fld3 INT AS (fld2) VIRTUAL, KEY(fld3), KEY(fld2), + FOREIGN KEY(fld1) REFERENCES t1(fld1) ON UPDATE CASCADE); +INSERT INTO t1(fld1) VALUES(1); +INSERT INTO t2(fld1) VALUES(1); +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +SELECT fld3 FROM t2; +SELECT * FROM t2; +DROP TABLE t2, t1; + +--echo # Drop the VIRTUAL INDEX using alter copy ALGORITHM +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT AS (fld1) VIRTUAL, KEY vk(fld2), + KEY(fld1), FOREIGN KEY(fld1) REFERENCES t1(fld1) + ON UPDATE CASCADE); +INSERT INTO t1(fld1) VALUES(1); +INSERT INTO t2(fld1) VALUES(1); +UPDATE t1 SET fld1= 2; +SELECT fld2, fld1 FROM t2; +ALTER TABLE t2 DROP INDEX vk, ALGORITHM= COPY; +UPDATE t1 SET fld1= 3; +SELECT fld2, fld1 FROM t2; +DROP TABLE t2, t1; + +--echo # Drop the VIRTUAL INDEX using INPLACE alter ALGORITHM +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT AS (fld1) VIRTUAL, + KEY vk(fld2), KEY(fld1), FOREIGN KEY(fld1) REFERENCES t1(fld1) + ON UPDATE CASCADE); +INSERT INTO t1(fld1) VALUES(1); +INSERT INTO t2(fld1) VALUES(1); +UPDATE t1 SET fld1= 2; +SELECT fld2, fld1 FROM t2; +ALTER TABLE t2 DROP INDEX vk, ALGORITHM= COPY; +UPDATE t1 SET fld1= 3; +SELECT fld2, fld1 FROM t2; +DROP TABLE t2, t1; + +--echo # Add the VIRTUAL INDEX using COPY alter ALGORITHM +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT AS (fld1) VIRTUAL, + KEY(fld1), FOREIGN KEY(fld1) REFERENCES t1(fld1) + ON UPDATE CASCADE); +INSERT INTO t1(fld1) VALUES(1); +INSERT INTO t2(fld1) VALUES(1); +UPDATE t1 SET fld1= 2; +SELECT fld2, fld1 FROM t2; +ALTER TABLE t2 ADD INDEX vk(fld2), ALGORITHM= COPY; +UPDATE t1 SET fld1= 3; +SELECT fld2, fld1 FROM t2; +DROP TABLE t2, t1; + +--echo # Add the VIRTUAL INDEX using INPLACE alter ALGORITHM +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL,fld2 INT AS (fld1) VIRTUAL, + KEY(fld1), FOREIGN KEY(fld1) REFERENCES t1(fld1) + ON UPDATE CASCADE); +INSERT INTO t1(fld1) VALUES(1); +INSERT INTO t2(fld1) VALUES(1); +UPDATE t1 SET fld1= 2; +SELECT fld2, fld1 FROM t2; +ALTER TABLE t2 ADD INDEX vk(fld2), ALGORITHM= INPLACE; +UPDATE t1 SET fld1= 3; +SELECT fld2, fld1 FROM t2; +DROP TABLE t2, t1; + +--echo # Drop the VIRTUAL INDEX contains fk constraint column +--echo # using alter copy ALGORITHM +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT NOT NULL, + fld3 INT AS (fld2) VIRTUAL, KEY vk(fld3, fld1), + KEY(fld1), FOREIGN KEY(fld1) REFERENCES t1(fld1) + ON UPDATE CASCADE); +INSERT INTO t1(fld1) VALUES(1); +INSERT INTO t2(fld1, fld2) VALUES(1, 2); +UPDATE t1 SET fld1= 2; +SELECT fld3, fld1 FROM t2; +ALTER TABLE t2 DROP INDEX vk, ALGORITHM= COPY; +UPDATE t1 SET fld1= 3; +SELECT fld3, fld1 FROM t2; +DROP TABLE t2, t1; + +--echo # Drop the VIRTUAL INDEX which contains fk constraint column +--echo # using INPLACE alter operation +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT NOT NULL, + fld3 INT AS (fld2) VIRTUAL, KEY vk(fld3, fld1), + KEY(fld1), FOREIGN KEY(fld1) REFERENCES t1(fld1) + ON UPDATE CASCADE); +INSERT INTO t1(fld1) VALUES(1); +INSERT INTO t2(fld1, fld2) VALUES(1, 2); +UPDATE t1 SET fld1= 2; +SELECT fld3, fld1 FROM t2; +alter TABLE t2 DROP INDEX vk, ALGORITHM= INPLACE; +UPDATE t1 SET fld1= 3; +SELECT fld3, fld1 FROM t2; +DROP TABLE t2, t1; + +--echo # Add the VIRTUAL INDEX contains fk constraint column +--echo # using copy alter operatiON +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT NOT NULL, + fld3 INT AS (fld2) VIRTUAL, KEY(fld1), + FOREIGN KEY(fld1) REFERENCES t1(fld1) ON UPDATE CASCADE); +INSERT INTO t1(fld1) VALUES(1); +INSERT INTO t2(fld1, fld2) VALUES(1, 2); +UPDATE t1 SET fld1= 2; +SELECT fld3, fld1 FROM t2; +alter TABLE t2 ADD INDEX vk(fld3, fld1), ALGORITHM= COPY; +UPDATE t1 SET fld1= 3; +SELECT fld3, fld1 FROM t2; +DROP TABLE t2, t1; + +--echo # Cascading UPDATEs and DELETEs for the multiple +--echo # fk dependent TABLEs + +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT AS (fld1) VIRTUAL, + KEY(fld1), KEY(fld2, fld1), + FOREIGN KEY(fld1) REFERENCES t1(fld1) ON UPDATE CASCADE); +CREATE TABLE t3(fld1 INT NOT NULL, fld2 INT AS (fld1) VIRTUAL, + KEY(fld2, fld1), + FOREIGN KEY(fld1) REFERENCES t2(fld1) ON UPDATE CASCADE); +INSERT INTO t1 VALUES(1), (2); +INSERT INTO t2(fld1) VALUES(1), (2); +INSERT INTO t3(fld1) VALUES(1), (2); +UPDATE t1 SET fld1= 4 WHERE fld1= 1; +SELECT fld2, fld1 FROM t2; +SELECT fld2, fld1 FROM t3; +DROP TABLE t3, t2, t1; + +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT NOT NULL, + fld3 INT AS (fld2) VIRTUAL, KEY(fld3, fld1), KEY(fld1), + FOREIGN KEY(fld1) REFERENCES t1(fld1) ON UPDATE CASCADE); +CREATE TABLE t3(fld1 INT NOT NULL, fld2 INT NOT NULL, + fld3 INT AS (fld2) VIRTUAL, KEY(fld3, fld1), + FOREIGN KEY(fld1) REFERENCES t2(fld1) ON UPDATE CASCADE); +INSERT INTO t1 VALUES(1), (2); +INSERT INTO t2 VALUES(1, 1, DEFAULT), (2, 2, default); +INSERT INTO t3 VALUES(1, 1, DEFAULT), (2, 2, default); +UPDATE t1 SET fld1= 4 WHERE fld1= 1; +SELECT fld3, fld1 FROM t2; +SELECT fld3, fld1 FROM t3; +DROP TABLE t3, t2, t1; + +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT AS (fld1) VIRTUAL, + KEY(fld1), KEY(fld2, fld1), + FOREIGN KEY(fld1) REFERENCES t1(fld1) ON DELETE CASCADE); +CREATE TABLE t3(fld1 INT NOT NULL, fld2 INT AS (fld1) VIRTUAL, + KEY(fld2, fld1), FOREIGN KEY(fld1) REFERENCES t2(fld1) + ON DELETE CASCADE); +INSERT INTO t1 VALUES(1), (2); +INSERT INTO t2(fld1) VALUES(1), (2); +INSERT INTO t3(fld1) VALUES(1), (2); +DELETE FROM t1 WHERE fld1= 1; +SELECT fld2, fld1 FROM t2; +SELECT fld2, fld1 FROM t3; +DROP TABLE t3, t2, t1; + +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT NOT NULL, + fld3 INT AS (fld2) VIRTUAL, + KEY(fld3, fld1), KEY(fld1), + FOREIGN KEY(fld1) REFERENCES t1(fld1) + ON DELETE CASCADE); +CREATE TABLE t3(fld1 INT NOT NULL, fld2 INT NOT NULL, + fld3 INT AS (fld2) VIRTUAL, KEY(fld3, fld1), + FOREIGN KEY(fld1) REFERENCES t2(fld1) + ON DELETE CASCADE); +INSERT INTO t1 VALUES(1), (2); +INSERT INTO t2 VALUES(1, 1, DEFAULT), (2, 2, default); +INSERT INTO t3 VALUES(1, 1, DEFAULT), (2, 2, default); +DELETE FROM t1 WHERE fld1= 1; +SELECT fld3, fld1 FROM t2; +SELECT fld3, fld1 FROM t3; +DROP TABLE t3, t2, t1; + +--echo # RENAME TABLE +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, + fld2 INT AS (fld1) VIRTUAL, + KEY(fld2, fld1), + FOREIGN KEY(fld1) REFERENCES t1(fld1) + ON DELETE CASCADE); +INSERT INTO t1 VALUES(1), (2); +INSERT INTO t2 VALUES(1, DEFAULT), (2, default); +RENAME TABLE t2 to t3; +DELETE FROM t1 WHERE fld1= 1; +SELECT fld2, fld1 FROM t3; +DROP TABLE t3, t1; + +--echo # FOREIGN_KEY_CHECKS disabled DURING INPLACE ALTER +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, + fld2 INT AS (fld1) VIRTUAL, + FOREIGN KEY(fld1) REFERENCES t1(fld1) + ON UPDATE CASCADE); +INSERT INTO t1 VALUES(1), (2); +INSERT INTO t2 VALUES(1, DEFAULT), (2, default); +SET foreign_key_checks = 0; +ALTER TABLE t2 ADD INDEX vk(fld2), ALGORITHM=INPLACE; +SET foreign_key_checks = 1; +UPDATE t1 SET fld1= 3 WHERE fld1= 2; +SELECT fld2 FROM t2; +DROP TABLE t2, t1; + +--echo # GENERATED COLUMN COMPUTATION FAILS when SQL_MODE +--echo # is set to ERROR_FOR_DIVISION_BY_ZERO +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, + fld2 INT AS (100/fld1) VIRTUAL, + KEY(fld2), + FOREIGN KEY(fld1) REFERENCES t1(fld1) + ON UPDATE CASCADE); +INSERT INTO t1 VALUES(1), (2); +INSERT INTO t2 VALUES(1, DEFAULT), (2, default); +#--error ER_DIVISION_BY_ZERO +UPDATE t1 SET fld1= 0 WHERE fld1= 2; +SELECT fld2 FROM t2; +DROP TABLE t2, t1; + +--echo # CHANGE SQL_MODE and try the ERROR_FOR_DIVISION_BY_ZERO +SET sql_mode = STRICT_ALL_TABLES; +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, + fld2 INT AS (100/fld1) VIRTUAL, + KEY(fld2), + FOREIGN KEY(fld1) REFERENCES t1(fld1) + ON UPDATE CASCADE); +INSERT INTO t1 VALUES(1), (2); +INSERT INTO t2 VALUES(1, DEFAULT), (2, default); +UPDATE t1 SET fld1= 0 WHERE fld1= 2; +SELECT fld2 FROM t2; +SELECT * FROM t2; +DROP TABLE t2, t1; +SET sql_mode = default; + +--echo # ADD FOREIGN CONSTRAINT USING COPY +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, + fld2 INT AS (fld1) VIRTUAL, KEY(fld2)); +ALTER TABLE t2 ADD FOREIGN KEY (fld1) + REFERENCES t1(fld1) ON UPDATE CASCADE, + ALGORITHM=copy; +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +SELECT * FROM t2; +DROP TABLE t2, t1; + +--echo # ADD FOREIGN CONSTRAINT USING INPLACE +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, + fld2 INT AS (fld1) VIRTUAL, KEY(fld2)); +SET foreign_key_checks = 0; +ALTER TABLE t2 ADD FOREIGN KEY (fld1) + REFERENCES t1(fld1) ON UPDATE CASCADE, + ALGORITHM=inplace; +SET foreign_key_checks = 1; +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +SELECT * FROM t2; +DROP TABLE t2, t1; + +--echo # DROP FOREIGN CONSTRAINT USING COPY +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, + fld2 INT AS (fld1) VIRTUAL, KEY(fld2), + CONSTRAINT fidx FOREIGN KEY (fld1) REFERENCES t1(fld1) + ON UPDATE CASCADE); +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +ALTER TABLE t2 DROP FOREIGN KEY fidx, ALGORITHM=COPY; +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +SELECT * FROM t2; +DROP TABLE t2, t1; + +--echo # DROP FOREIGN CONSTRAINT USING INPLACE +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, + fld2 INT AS (fld1) VIRTUAL, KEY(fld2), + CONSTRAINT fidx FOREIGN KEY (fld1) REFERENCES t1(fld1) + ON UPDATE CASCADE); +SET foreign_key_checks = 0; +ALTER TABLE t2 DROP FOREIGN KEY fidx, ALGORITHM=INPLACE; +SET foreign_key_checks = 1; +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +SELECT * FROM t2; +DROP TABLE t2, t1; + +--echo # ADD VC INDEX and ADD FK IN SAME COPY ALTER +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, + fld2 INT AS (fld1) VIRTUAL); +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +ALTER TABLE t2 ADD INDEX(fld2), ADD FOREIGN KEY (fld1) REFERENCES t1(fld1) + ON UPDATE CASCADE, ALGORITHM=copy; +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +SELECT * FROM t2; +DROP TABLE t2, t1; + +--echo # ADD VC INDEX and ADD FK IN SAME INPLACE ALTER +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, + fld2 INT AS (fld1) VIRTUAL); +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +SET foreign_key_checks = 0; +ALTER TABLE t2 ADD INDEX(fld2), ADD FOREIGN KEY (fld1) REFERENCES t1(fld1) + ON UPDATE CASCADE, ALGORITHM=inplace; +SET foreign_key_checks = 1; +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +SELECT * FROM t2; +DROP TABLE t2, t1; + +--echo # ADD VC INDEX and DROP FK IN SAME COPY ALTER +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, + fld2 INT AS (fld1) VIRTUAL, + CONSTRAINT fidx FOREIGN KEY(fld1) REFERENCES t1(fld1) + ON UPDATE CASCADE); +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +ALTER TABLE t2 ADD INDEX(fld2), DROP FOREIGN KEY fidx, ALGORITHM=copy; +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +SELECT * FROM t2; +DROP TABLE t2, t1; + +--echo # ADD VC INDEX and DROP FK IN SAME INPLACE ALTER +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, + fld2 INT AS (fld1) VIRTUAL, + CONSTRAINT fidx FOREIGN KEY(fld1) REFERENCES t1(fld1) + ON UPDATE CASCADE); +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +SET foreign_key_checks = 0; +ALTER TABLE t2 ADD INDEX(fld2), DROP FOREIGN KEY fidx, ALGORITHM=inplace; +SET foreign_key_checks = 1; +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +SELECT * FROM t2; +DROP TABLE t2, t1; + +--echo # DROP VC INDEX and ADD FK IN SAME COPY ALTER +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, + fld2 INT AS (fld1) VIRTUAL, + KEY idx(fld2)); +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +ALTER TABLE t2 DROP INDEX idx, ADD FOREIGN KEY (fld1) REFERENCES t1(fld1) + ON UPDATE CASCADE, ALGORITHM=COPY; +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +SELECT * FROM t2; +DROP TABLE t2, t1; + +--echo # DROP VC INDEX and ADD FK IN SAME INPLACE ALTER +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, + fld2 INT AS (fld1) VIRTUAL, + KEY idx(fld2)); +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +SET foreign_key_checks = 0; +ALTER TABLE t2 DROP INDEX idx, ADD FOREIGN KEY (fld1) REFERENCES t1(fld1) + ON UPDATE CASCADE, ALGORITHM=INPLACE; +SET foreign_key_checks = 1; +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +SELECT * FROM t2; +DROP TABLE t2, t1; + +--echo # DROP VC INDEX and DROP FK IN SAME COPY ALTER +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, + fld2 INT AS (fld1) VIRTUAL, + KEY idx(fld2), + CONSTRAINT fidx FOREIGN KEY(fld1) REFERENCES t1(fld1) + ON UPDATE CASCADE); +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +ALTER TABLE t2 DROP KEY idx, DROP FOREIGN KEY fidx, ALGORITHM=COPY; +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +SELECT * FROM t2; +DROP TABLE t2, t1; + +--echo # DROP VC INDEX and DROP FK IN SAME INPLACE ALTER +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY); +CREATE TABLE t2(fld1 INT NOT NULL, + fld2 INT AS (fld1) VIRTUAL, + KEY idx(fld2), + CONSTRAINT fidx FOREIGN KEY(fld1) REFERENCES t1(fld1) + ON UPDATE CASCADE); +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, DEFAULT); +SET foreign_key_checks = 0; +ALTER TABLE t2 DROP KEY idx, DROP FOREIGN KEY fidx, ALGORITHM=INPLACE; +SET foreign_key_checks = 1; +UPDATE t1 SET fld1= 2; +SELECT fld2 FROM t2; +SELECT * FROM t2; +DROP TABLE t2, t1; diff --git a/mysql-test/suite/gcol/t/innodb_virtual_fk_restart.test b/mysql-test/suite/gcol/t/innodb_virtual_fk_restart.test new file mode 100644 index 00000000000..61d330036ea --- /dev/null +++ b/mysql-test/suite/gcol/t/innodb_virtual_fk_restart.test @@ -0,0 +1,42 @@ +-- source include/have_innodb.inc +-- source include/not_embedded.inc + +--echo # +--echo # Bug#22469130: FOREIGN KEY ON DELETE CASCADE NOT ALLOWED +--echo # WHEN A VIRTUAL INDEX EXISTS. + +--echo # Add the VIRTUAL INDEX contains fk constraINT column +--echo # using INPLACE alter operatiON +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY) engine=innodb; +CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT NOT NULL, + fld3 INT AS (fld2) VIRTUAL, KEY(fld1), + FOREIGN KEY(fld1) REFERENCES t1(fld1) ON UPDATE CASCADE) engine=innodb; +INSERT INTO t1(fld1) VALUES(1); +INSERT INTO t2(fld1, fld2) VALUES(1, 2); +--source include/restart_mysqld.inc +UPDATE t1 SET fld1= 2; +SELECT fld3, fld1 FROM t2; +alter TABLE t2 ADD INDEX vk(fld3, fld1), ALGORITHM=INPLACE; +UPDATE t1 SET fld1=3; +SELECT fld3, fld1 FROM t2; +DROP TABLE t2, t1; + +--echo # TEMPORARY TABLE NAME and CHILD TABLE NAME are same +CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY) engine=innodb; +CREATE TABLE t2(fld1 INT NOT NULL, + fld2 INT AS (fld1) VIRTUAL, + KEY(fld2), + FOREIGN KEY(fld1) REFERENCES t1(fld1) + ON UPDATE CASCADE) engine=innodb; +INSERT INTO t1 VALUES(1), (2); +INSERT INTO t2 VALUES(1, DEFAULT), (2, default); +--source include/restart_mysqld.inc +CREATE TEMPORARY TABLE t2 (fld1 INT NOT NULL)ENGINE=INNODB; +UPDATE t1 SET fld1= 3 WHERE fld1= 2; +--connect(con1,localhost,root,,test) +SELECT fld2 FROM t2; +CHECK TABLE t2; +connection default; +disconnect con1; +DROP TABLE t2; +DROP TABLE t2, t1; diff --git a/mysql-test/suite/gcol/t/innodb_virtual_index.test b/mysql-test/suite/gcol/t/innodb_virtual_index.test new file mode 100644 index 00000000000..4c4cb2a2d05 --- /dev/null +++ b/mysql-test/suite/gcol/t/innodb_virtual_index.test @@ -0,0 +1,220 @@ +--source include/have_innodb.inc + +--echo # +--echo # Bug 21922176 - PREBUILT->SEARCH_TUPLE CREATED WITHOUT INCLUDING +--echo # THE NUMBER OF VIRTUAL COLUMNS +--echo # + +CREATE TABLE t1 (a INT, a1 INT GENERATED ALWAYS AS (a) VIRTUAL, a2 INT +GENERATED ALWAYS AS (a) VIRTUAL, a3 INT GENERATED ALWAYS AS (a) VIRTUAL, a4 +INT GENERATED ALWAYS AS (a) VIRTUAL, a5 INT GENERATED ALWAYS AS (a) VIRTUAL, +a6 INT GENERATED ALWAYS AS (a) VIRTUAL, a7 INT GENERATED ALWAYS AS (a) +VIRTUAL, a8 INT GENERATED ALWAYS AS (a) VIRTUAL, a9 INT GENERATED ALWAYS AS +(a) VIRTUAL, INDEX(a1, a2, a3, a4, a5, a6, a7, a8, a9)) ; + +INSERT INTO t1(a) VALUES(10); + +SELECT * FROM t1 WHERE a1=10 AND a2 = 10 AND a3 =10 AND a4 = 10 AND a5=10 AND +a6=10 AND a7=10 AND a8=10 AND a9=10; + +DROP TABLE t1; + +--echo # +--echo # Bug 22572997 - GCOL:INNODB: FAILING ASSERTION: N < REC_OFFS_N_FIELDS( +--echo # OFFSETS) +--echo # +SET @@SESSION.sql_mode=0; + +CREATE TABLE t1( +c1 int(1)AUTO_INCREMENT, + c2 int(1), + c3 int(1)GENERATED ALWAYS AS ((c2 + c2)) VIRTUAL, + c4 int(1)GENERATED ALWAYS AS ((c3 + c2)) VIRTUAL, + c5 date, + c6 date GENERATED ALWAYS AS((c5 + interval 30 day)) VIRTUAL, + c7 DATE, + c8 time, + c9 DATE GENERATED ALWAYS AS(addtime(c7,c8)) VIRTUAL, + c10 time GENERATED ALWAYS AS(addtime(c7,c8)) VIRTUAL, + c11 DATE GENERATED ALWAYS AS(addtime(c9,c8)) VIRTUAL, + c12 CHAR(1), + c13 CHAR(1)GENERATED ALWAYS AS (concat(c12,c12)) VIRTUAL, + c14 CHAR(2)GENERATED ALWAYS AS (concat(c13,'x')) VIRTUAL, + PRIMARY KEY(c1), + KEY c4_6(c4,c11) +)ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE t2( + c1 int(1)AUTO_INCREMENT, + c2 int(1), + c3 int(1)GENERATED ALWAYS AS ((c2 + c2)) VIRTUAL, + c4 int(1)GENERATED ALWAYS AS ((c3 + c2)) VIRTUAL, + c5 date, + c6 date GENERATED ALWAYS AS((c5 + interval 30 day)) VIRTUAL, + c6a date GENERATED ALWAYS AS((c6 + interval 30 day)) VIRTUAL, + c7 DATE, + c8 time, + c9 DATE GENERATED ALWAYS AS(addtime(c7,c8)) VIRTUAL, + c10 time GENERATED ALWAYS AS(addtime(c7,c8)) VIRTUAL, + c11 DATE GENERATED ALWAYS AS(addtime(c9,c8)) VIRTUAL, + c11a time GENERATED ALWAYS AS(addtime(c7,c10)) VIRTUAL, + c12 CHAR(1), + c13 CHAR(2)GENERATED ALWAYS AS (concat(c12,c12)) VIRTUAL, + c14 CHAR(4)GENERATED ALWAYS AS (concat(c13,'x')) VIRTUAL, + PRIMARY KEY(c1), + KEY c13(c13), + KEY c4_6(c4,c11) +)ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t2(c1,c2,c5,c7,c8,c12)VALUES (0,0,0,0,0,'v'); + +CREATE TABLE t3( + c1 int(1)AUTO_INCREMENT, + c2 int(1), + c3 int(1)GENERATED ALWAYS AS ((c2 + c2)) VIRTUAL, + c4 int(1)GENERATED ALWAYS AS ((c3 + c2)) VIRTUAL, + c5 date, + c7 DATE, + c8 time, + c9 DATE GENERATED ALWAYS AS(addtime(c7,c8)) VIRTUAL, + c11 DATE GENERATED ALWAYS AS(addtime(c9,c8)) VIRTUAL, + c12 CHAR(1), + PRIMARY KEY(c1), + KEY c4_6(c4,c11) +)ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t3(c1,c2,c5,c7,c8,c12)VALUES +(0,0,0,0,0,'q'),(0,0,0,0,0,'g'),(0,0,0,0,0,'l'),(0,0,0,0,0,1),(0,0,0,0,0,'v'), +(0,1,0,0,0,'c'),(0,0,0,0,0,'x'); + +UPDATE +t2 AS O1,t3 AS O2 +SET O1.c12=1 +WHERE O1.c14 NOT IN +( +SELECT +DISTINCT I1.c14 AS y +FROM t1 AS I1 +ORDER BY I1.c14); + +SET @@SESSION.sql_mode=default; + +DROP TABLE t1, t2, t3; + +--echo # +--echo # Bug 22650296 - ASSERTION IN INNOBASE_BUILD_COL_MAP, ALTER +--echo # +CREATE TABLE `ibstd_08` ( + `nc00577` tinyint(4) DEFAULT NULL, + `nc07844` varchar(41) DEFAULT NULL, + `gc01908` point NOT NULL, + `nc04156` char(17) DEFAULT NULL, + `nc09536` longblob NOT NULL, + `nc09231` decimal(10,0) NOT NULL, + `a` int(11) NOT NULL, + `b` varchar(198) NOT NULL, + `nc04560` mediumtext, + `c` char(187) DEFAULT NULL, + `vbidxcol` char(3) GENERATED ALWAYS AS (substr(`b`,1,3)) VIRTUAL, + `gc00881` polygon NOT NULL, + `nc05121` int(11) NOT NULL DEFAULT '85941481', + KEY `a` (`a`), + KEY `b` (`b`(3),`a`), + KEY `c` (`c`(99),`b`(25)), + KEY `b_2` (`b`(5),`c`(10),`a`), + KEY `vbidxcol` (`vbidxcol`), + KEY `a_2` (`a`,`vbidxcol`), + KEY `vbidxcol_2` (`vbidxcol`), + FULLTEXT KEY `ftsic` (`c`,`b`) +) ENGINE=InnoDB; + + +ALTER TABLE ibstd_08 ADD COLUMN nc07006 BIGINT AUTO_INCREMENT NOT NULL , ADD KEY auto_nc07006(nc07006); + +DROP TABLE ibstd_08; + +--echo # +--echo # Bug 22899305 - GCOLS: FAILING ASSERTION: !(COL->PRTYPE & 256) +--echo # AND SEGFAULT +--echo # +set sql_mode=""; +create table t (a int) engine=innodb; +create table s ( +b int generated always as (1) virtual, +c int, +d int generated always as (1) virtual, +key (d) +) engine=innodb; + +insert into t(a) values ((select d from s for update)); +insert into s(c) values (''); + +SET sql_mode = default; +drop table if exists t,s; + +--echo # +--echo # Bug 23014521 - GCOL:INNODB: FAILING ASSERTION: !IS_V +--echo # +CREATE TABLE t1 ( + col1 int(11) NOT NULL, + col2 int(11) DEFAULT NULL, + col3 int(11) NOT NULL, + col4 int(11) DEFAULT NULL, + col5 int(11) GENERATED ALWAYS AS ((col1 % col4)) VIRTUAL, + col6 int(11) GENERATED ALWAYS AS ((col2 - col4)) VIRTUAL, + col5x int(11) GENERATED ALWAYS AS ((col3 / col2)) VIRTUAL, + col6b varchar(20) GENERATED ALWAYS AS (col2) VIRTUAL, + col6x int(11) GENERATED ALWAYS AS ((col2 % col1)) VIRTUAL, + col7 int(11) GENERATED ALWAYS AS ((col6x + col5x)) VIRTUAL, + col8 int(11) GENERATED ALWAYS AS ((col5x / col5)) VIRTUAL, + col7x int(11) GENERATED ALWAYS AS ((col5x + col5)) VIRTUAL, + col8x int(11) GENERATED ALWAYS AS ((col5 / col5x)) VIRTUAL, + col9 text, + col2b varchar(20) GENERATED ALWAYS AS (col4) VIRTUAL, + col8a int(11) GENERATED ALWAYS AS (col2) VIRTUAL, + col4b varchar(20) GENERATED ALWAYS AS (col4) VIRTUAL, + col1c int(11) GENERATED ALWAYS AS ((col2 * col1)) VIRTUAL, + extra int(11) DEFAULT NULL, + col5c int(11) GENERATED ALWAYS AS ((col1 / col1)) VIRTUAL, + col6a bigint(20) GENERATED ALWAYS AS ((col3 / col1)) VIRTUAL, + col1a varchar(20) GENERATED ALWAYS AS (col6) VIRTUAL, + col6c int(11) GENERATED ALWAYS AS ((col2 % col2)) VIRTUAL, + col7c bigint(20) GENERATED ALWAYS AS ((col2 / col1)) VIRTUAL, + col2c int(11) GENERATED ALWAYS AS ((col5 % col5)) VIRTUAL, + col1b int(11) GENERATED ALWAYS AS ((col1 / col2)) VIRTUAL, + col3b bigint(20) GENERATED ALWAYS AS ((col6x % col6)) VIRTUAL, + UNIQUE KEY idx7 (col1,col3,col2), + UNIQUE KEY uidx (col9(10)), + KEY idx15 (col9(10) DESC,col2 DESC), + KEY idx10 (col9(10) DESC,col1 DESC), + KEY idx11 (col6x DESC), + KEY idx6 (col9(10) DESC,col7 DESC), + KEY idx14 (col6 DESC) + ) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +# Cannot add virtual column along with create FULLTEXT index with +# adding a hidden FTS_DOC_ID column (which require a table rebuild) +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t1 ADD COLUMN col7a INT GENERATED ALWAYS AS (col5x % col6x) +VIRTUAL, ADD FULLTEXT KEY ftidx ( col9 ), algorithm=inplace; + +# This will add a hidden FTS_DOC_ID column +CREATE FULLTEXT INDEX idx ON t1(col9); + +# Since there is no table rebuild needed, now the alter would be sucessful +ALTER TABLE t1 ADD COLUMN col7a INT GENERATED ALWAYS AS (col5x % col6x) +VIRTUAL, ADD FULLTEXT KEY ftidx ( col9 ), algorithm=inplace; + +DROP TABLE t1; + +CREATE TABLE t1 ( + col1 int(11) NOT NULL, + col2 int(11) DEFAULT NULL, + col3 int(11) NOT NULL, + col4 int(11) DEFAULT NULL) engine=innodb; + +# This secondary key idx will be coverted to a new Primary Key, thus a table +# rebuild. It is blocked since there is an adding of virtual columns +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t1 ADD COLUMN col7a INT GENERATED ALWAYS AS (col1 % col2) +VIRTUAL, ADD UNIQUE index idx (col1), algorithm=inplace; + +DROP TABLE t1; diff --git a/mysql-test/suite/gcol/t/innodb_virtual_purge.test b/mysql-test/suite/gcol/t/innodb_virtual_purge.test new file mode 100644 index 00000000000..f9fd02d970b --- /dev/null +++ b/mysql-test/suite/gcol/t/innodb_virtual_purge.test @@ -0,0 +1,138 @@ +--source include/have_innodb.inc +--source include/count_sessions.inc + +--echo # +--echo # Bug#21869656 UNDO LOG DOES NOT CONTAIN ENOUGH INFORMATION +--echo # ON INDEXED VIRTUAL COLUMNS +--echo # + +CREATE TABLE t1 (a INT, b INT, + a1 INT GENERATED ALWAYS AS (a) VIRTUAL, INDEX(a1) +) ENGINE=InnoDB; + +INSERT INTO t1 (a,b) VALUES(1,1); + +connect (con1,localhost,root,,); +# disable purge +CREATE TABLE t0 (a INT) ENGINE=InnoDB; +BEGIN; SELECT * FROM t0; + +connection default; +# write the problematic update_undo log record +UPDATE t1 SET a=0; + +ALTER TABLE t1 DROP COLUMN a1, ALGORITHM=INPLACE; +ALTER TABLE t1 ADD COLUMN b1 INT GENERATED ALWAYS AS (b) VIRTUAL, ADD +INDEX(b1), +ALGORITHM=INPLACE; + +connection con1; +# enable purge +COMMIT; +UPDATE t1 SET a=1; + +connection default; +# wait for purge to process the update_undo record. +--source include/wait_innodb_all_purged.inc + +CHECK TABLE t1; +SELECT b1 FROM t1; + + +# Create multi-virtual column, more ADD/DROP to test it +ALTER TABLE t1 +ADD COLUMN a1 INT GENERATED ALWAYS AS (a) VIRTUAL, +ADD COLUMN a2 INT GENERATED ALWAYS AS (a + b) VIRTUAL, +ADD COLUMN a3 INT GENERATED ALWAYS AS (a - b) VIRTUAL, +ADD COLUMN a4 INT GENERATED ALWAYS AS (a - b) VIRTUAL, +ADD INDEX(a1), ADD INDEX(a2), ADD INDEX(a3), ALGORITHM=INPLACE; + +CREATE TABLE t2 ( + a BLOB, + b BLOB, + c BLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, + h VARCHAR(10) DEFAULT NULL +) ENGINE=InnoDB; + +INSERT INTO t2 VALUES (REPEAT('g', 16000), REPEAT('x', 16000), DEFAULT, 'kk'); + +INSERT INTO t2 VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, 'mm'); + +CREATE INDEX idx ON t2(c(100)); + +INSERT INTO t1 (a, b) VALUES(1,1); + +connection con1; +# disable purge +BEGIN; SELECT * FROM t0; + +connection default; +--enable_info + +# write the problematic update_undo log record +UPDATE t1 SET a=0; +UPDATE t1 SET b=0; + +ALTER TABLE t1 DROP COLUMN a3, ALGORITHM=INPLACE; + +UPDATE t1 SET a=2; +ALTER TABLE t1 DROP COLUMN a2, ALGORITHM=INPLACE; +UPDATE t1 SET b=3; + +ALTER TABLE t1 ADD COLUMN b2 INT GENERATED ALWAYS AS (b) VIRTUAL, +ADD INDEX(b2), ALGORITHM=INPLACE; +UPDATE t1 SET b=9; + +ALTER TABLE t1 ADD COLUMN b3 INT GENERATED ALWAYS AS (a) VIRTUAL, +ADD INDEX(b3), ALGORITHM=INPLACE; + +UPDATE t1 SET b=10; + +ALTER TABLE t2 DROP COLUMN c; + +UPDATE t2 SET a = REPEAT('s', 6000) WHERE a like 'aaa%'; + +ALTER TABLE t2 ADD COLUMN x1 BLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, +ADD COLUMN x2 BLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, +ADD INDEX(x1(100), x2(120)), ADD INDEX (x1(20)); + +UPDATE t1 SET a=5; + +UPDATE t2 SET a = REPEAT('m', 16000) WHERE a like 'sss%'; + +ALTER TABLE t1 DROP COLUMN b2, ALGORITHM=INPLACE; + +UPDATE t1 SET a=6; + +ALTER TABLE t2 DROP COLUMN x1, DROP COLUMN x2, ALGORITHM=INPLACE; + +UPDATE t2 SET a = REPEAT('x', 1000) WHERE a like 'mmm%'; + +ALTER TABLE t1 DROP INDEX b3; +UPDATE t1 SET a=100; +--disable_info + +connection con1; +# enable purge +COMMIT; +disconnect con1; + +connection default; +# wait for purge to process the update_undo record. +--source include/wait_innodb_all_purged.inc + +CHECK TABLE t1; +SELECT b1 FROM t1; + +SELECT * FROM t1; +CHECK TABLE t2; +DROP TABLE t2, t1, t0; + +CREATE TABLE t1 (a VARCHAR(30), b INT, a2 VARCHAR(30) GENERATED ALWAYS AS (a) VIRTUAL); + +--error ER_DUP_FIELDNAME +CREATE INDEX idx ON t1(a2(10), b, a2(20)); + +DROP TABLE t1; + +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/gcol/t/innodb_wl8114.test b/mysql-test/suite/gcol/t/innodb_wl8114.test new file mode 100644 index 00000000000..bed8375328c --- /dev/null +++ b/mysql-test/suite/gcol/t/innodb_wl8114.test @@ -0,0 +1,42 @@ +--source include/have_innodb.inc + +# Test alter table add column +CREATE TABLE t_8114 (a int) ENGINE = INNODB; + +ALTER TABLE t_8114 ADD b INT GENERATED ALWAYS AS (a) VIRTUAL; + +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE "%t_8114"; + +SELECT NAME, POS, MTYPE, PRTYPE, LEN FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS WHERE TABLE_ID IN (SELECT TABLE_ID FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE "%t_8114"); + +INSERT INTO t_8114 VALUES (9, default); +INSERT INTO t_8114 VALUES (3, default); +INSERT INTO t_8114 VALUES (1, default); +INSERT INTO t_8114 VALUES (5, default); + +SELECT * FROM t_8114; + +DROP TABLE t_8114; + +CREATE TABLE t_8114 (Column_1 CHAR(5) GENERATED ALWAYS AS (PI()+5), Column_2 CHAR(5)) engine=innodb; + +SELECT NAME, FLAG, N_COLS FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE "%t_8114"; + +SELECT NAME, POS, MTYPE, PRTYPE, LEN FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS WHERE TABLE_ID IN (SELECT TABLE_ID FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE "%t_8114"); + +INSERT INTO t_8114 VALUES (default, "aa"); +INSERT INTO t_8114 VALUES (default, "bb"); +INSERT INTO t_8114 VALUES (default, "ee"); +INSERT INTO t_8114 VALUES (default, "pp"); + +SELECT * FROM t_8114; + +ALTER TABLE t_8114 DROP Column_1; + +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE "%t_8114"; + +SELECT NAME, POS, MTYPE, PRTYPE, LEN FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS WHERE TABLE_ID IN (SELECT TABLE_ID FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE "%t_8114"); + +SELECT * FROM t_8114; + +DROP TABLE t_8114; diff --git a/mysql-test/suite/gcol/t/main_alter_table.test b/mysql-test/suite/gcol/t/main_alter_table.test new file mode 100644 index 00000000000..bbd87350cb1 --- /dev/null +++ b/mysql-test/suite/gcol/t/main_alter_table.test @@ -0,0 +1,50 @@ +--source include/have_innodb.inc + +--echo # +--echo # Bug#22017616: ASSERTION FAILED: TABLE_SHARE->IS_MISSING_PRIMARY_KEY() +--echo # == M_PREBUILT->CLUST_IND +--echo # +--echo # Ensure that adding indexes with virtual columns are not promoted to +--echo # primary keys +--echo # +--echo # Base line with normal column - should be promoted +CREATE TABLE t0(a INT NOT NULL) ENGINE=INNODB; +ALTER TABLE t0 ADD UNIQUE INDEX (a); + +--echo # Case a: Create table with virtual unique not null column +CREATE TABLE t1(a POINT GENERATED ALWAYS AS (POINT(1,1)) VIRTUAL UNIQUE) ENGINE=INNODB; +SELECT * FROM t1; + +--echo # Case b: Create table with index on virtual point column +CREATE TABLE t2(a POINT GENERATED ALWAYS AS (POINT(1,1)) VIRTUAL, UNIQUE INDEX no_pk(a(1))) ENGINE=INNODB; +SELECT * FROM t2; + +--echo # Case c: Add unique index on virtual point column +CREATE TABLE t3(a POINT GENERATED ALWAYS AS (POINT(1,1)) VIRTUAL) +ENGINE=INNODB; +ALTER TABLE t3 ADD UNIQUE INDEX (a(1)); +SELECT * FROM t3; + +--echo # Case d: Add unique index on virtual blob column +CREATE TABLE t4 (a BLOB, b BLOB GENERATED ALWAYS AS (a) VIRTUAL) ENGINE=INNODB; +ALTER TABLE t4 ADD UNIQUE INDEX (b(1)); +SELECT * FROM t4; + +--echo # Query I_S to verify that 'a' is promoted to pk only when it +--echo # isn't virtual +SELECT T.NAME AS TABLE_NAME, I.NAME AS INDEX_NAME, + CASE (I.TYPE & 3) + WHEN 3 THEN "yes" + ELSE "no" END AS IS_PRIMARY_KEY, + F.NAME AS FIELD_NAME, F.POS AS FIELD_POS FROM + INFORMATION_SCHEMA.INNODB_SYS_TABLES AS T JOIN + INFORMATION_SCHEMA.INNODB_SYS_INDEXES AS I JOIN + INFORMATION_SCHEMA.INNODB_SYS_FIELDS AS F + ON I.INDEX_ID = F.INDEX_ID AND I.TABLE_ID = T.TABLE_ID + WHERE T.NAME LIKE 'test/%'; + +DROP TABLE t0; +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +DROP TABLE t4; diff --git a/mysql-test/suite/gcol/t/main_mysqldump.test b/mysql-test/suite/gcol/t/main_mysqldump.test new file mode 100644 index 00000000000..c2b4efd09c3 --- /dev/null +++ b/mysql-test/suite/gcol/t/main_mysqldump.test @@ -0,0 +1,44 @@ +--source include/have_innodb.inc +--source include/not_embedded.inc + +CREATE DATABASE dump_generated; +USE dump_generated; +CREATE TABLE t1 (pk INTEGER, a INTEGER, b INTEGER, c VARCHAR(16), + sum INTEGER GENERATED ALWAYS AS (a+b), + sub VARCHAR(4) GENERATED ALWAYS AS (SUBSTRING(c, 1, 4)), + key k1(sum), + key k2(sub) +) engine=innodb; +INSERT INTO t1(pk, a, b, c) VALUES (1, 11, 12, 'oneone'), (2, 21, 22, 'twotwo'); +SELECT * FROM t1; +--exec $MYSQL_DUMP dump_generated t1 > $MYSQLTEST_VARDIR/tmp/t1.sql +DELETE FROM t1; +--exec $MYSQL dump_generated < $MYSQLTEST_VARDIR/tmp/t1.sql +SELECT * FROM t1; +--exec $MYSQL_DUMP dump_generated t1 --tab=$MYSQLTEST_VARDIR/tmp/ +DELETE FROM t1; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t1 +SELECT * FROM t1; +DROP TABLE t1; + +--echo # A table with regular columns after generated +CREATE TABLE t2 (pk INTEGER, a INTEGER, b INTEGER, + sum INTEGER GENERATED ALWAYS AS (a+b), + c VARCHAR(16), + key k1(sum) +) engine=innodb; +INSERT INTO t2(pk, a, b, c) VALUES (1, 11, 12, 'oneone'), (2, 21, 22, 'twotwo'); +SELECT * FROM t2; +--exec $MYSQL_DUMP dump_generated t2 > $MYSQLTEST_VARDIR/tmp/t2.sql +DELETE FROM t2; +--exec $MYSQL dump_generated < $MYSQLTEST_VARDIR/tmp/t2.sql +SELECT * FROM t2; +--exec $MYSQL_DUMP dump_generated t2 --tab=$MYSQLTEST_VARDIR/tmp/ +DELETE FROM t2; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/t2.txt' INTO TABLE t2 +SELECT * FROM t2; +DROP TABLE t2; + +DROP DATABASE dump_generated; diff --git a/mysql-test/suite/gcol/t/rpl_gcol.test b/mysql-test/suite/gcol/t/rpl_gcol.test new file mode 100644 index 00000000000..6193d944101 --- /dev/null +++ b/mysql-test/suite/gcol/t/rpl_gcol.test @@ -0,0 +1,65 @@ +################################################################################ +# t/gcol_rpl.test # +# # +# Purpose: # +# Test replication of tables with generated columns. # +# # +#------------------------------------------------------------------------------# +# Original Author: Andrey Zhakov # +# Original Date: 2008-09-04 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +# Set the session storage engine +--source include/have_innodb.inc +SET @@session.default_storage_engine = 'InnoDB'; + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +--source include/master-slave.inc + +connection master; +create table t1 (a int, b int generated always as (a+1) virtual); +show create table t1; +insert into t1 values (1,default); +insert into t1 values (2,default); +select * from t1; +save_master_pos; + +connection slave; +sync_with_master; +select * from t1; + +connection master; +drop table t1; +save_master_pos; + +connection slave; +sync_with_master; + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/gcol/inc/gcol_cleanup.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/handler/aria.result b/mysql-test/suite/handler/aria.result index b8ed1fd98c8..6b02ac9b085 100644 --- a/mysql-test/suite/handler/aria.result +++ b/mysql-test/suite/handler/aria.result @@ -545,7 +545,6 @@ optimize table t1; connection default; handler t1 read next; c1 -1 handler t1 close; connection con2; Table Op Msg_type Msg_text @@ -1296,19 +1295,27 @@ commit; # an open HANDLER, ER_LOCK_DEADLOCK is reported. # create table t1 (a int, key a(a)); -create table t2 like t1; handler t1 open; connection con1; -lock table t1 write, t2 write; +select get_lock('lock1', 10); +get_lock('lock1', 10) +1 connection default; -drop table t2; +select get_lock('lock1', 10); connection con2; -# Waiting for 'drop table t2' to get blocked... +# Waiting for 'select get_lock('lock1', 10)' to get blocked... connection con1; drop table t1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -unlock tables; +select release_lock('lock1'); +release_lock('lock1') +1 connection default; +get_lock('lock1', 10) +1 +select release_lock('lock1'); +release_lock('lock1') +1 # Demonstrate that there is no deadlock with FLUSH TABLE, # even though it is waiting for the other table to go away create table t2 like t1; @@ -1347,6 +1354,10 @@ handler t1 read a next; a 1 # Unblock 'lock tables t1 write'. +select * from t1; +a +1 +2 commit; connection con1; # Reap 'lock tables t1 write'. @@ -1516,10 +1527,6 @@ handler t1 read a last; a b 7 7 commit; -connection con1; -# Demonstrate that the HANDLER doesn't hold MDL_SHARED_WRITE. -lock table t1 write; -unlock tables; connection default; handler t1 read a prev; a b diff --git a/mysql-test/suite/handler/handler.inc b/mysql-test/suite/handler/handler.inc index a4ab5f1ed32..2432ff13e55 100644 --- a/mysql-test/suite/handler/handler.inc +++ b/mysql-test/suite/handler/handler.inc @@ -1054,24 +1054,24 @@ commit; --echo # an open HANDLER, ER_LOCK_DEADLOCK is reported. --echo # create table t1 (a int, key a(a)); -create table t2 like t1; handler t1 open; connection con1; -lock table t1 write, t2 write; +select get_lock('lock1', 10); connection default; -send drop table t2; +send select get_lock('lock1', 10); connection con2; ---echo # Waiting for 'drop table t2' to get blocked... +--echo # Waiting for 'select get_lock('lock1', 10)' to get blocked... let $wait_condition=select count(*)=1 from information_schema.processlist - where state='Waiting for table metadata lock' and - info='drop table t2'; + where state='User lock' and + info='select get_lock(\'lock1\', 10)'; --source include/wait_condition.inc connection con1; --error ER_LOCK_DEADLOCK drop table t1; -unlock tables; +select release_lock('lock1'); connection default; reap; +select release_lock('lock1'); --echo # Demonstrate that there is no deadlock with FLUSH TABLE, --echo # even though it is waiting for the other table to go away @@ -1118,6 +1118,7 @@ connection default; handler t1 read a next; --echo # Unblock 'lock tables t1 write'. +select * from t1; # Release MDL_SHARED_READ held by HANDLER commit; connection con1; @@ -1132,7 +1133,7 @@ connection con1; --echo # Waiting for 'handler t1 read a next' to get blocked... let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table level lock" and + where state = "Waiting for table metadata lock" and info = "handler t1 read a next"; --source include/wait_condition.inc @@ -1259,10 +1260,6 @@ handler t1 read a last; insert into t1 (a, b) values (7, 7); handler t1 read a last; commit; -connection con1; ---echo # Demonstrate that the HANDLER doesn't hold MDL_SHARED_WRITE. -lock table t1 write; -unlock tables; connection default; handler t1 read a prev; handler t1 close; diff --git a/mysql-test/suite/handler/heap.result b/mysql-test/suite/handler/heap.result index 70dcefe4ff3..fc42e43f710 100644 --- a/mysql-test/suite/handler/heap.result +++ b/mysql-test/suite/handler/heap.result @@ -545,7 +545,6 @@ optimize table t1; connection default; handler t1 read next; c1 -1 handler t1 close; connection con2; Table Op Msg_type Msg_text @@ -1296,19 +1295,27 @@ commit; # an open HANDLER, ER_LOCK_DEADLOCK is reported. # create table t1 (a int, key a(a)); -create table t2 like t1; handler t1 open; connection con1; -lock table t1 write, t2 write; +select get_lock('lock1', 10); +get_lock('lock1', 10) +1 connection default; -drop table t2; +select get_lock('lock1', 10); connection con2; -# Waiting for 'drop table t2' to get blocked... +# Waiting for 'select get_lock('lock1', 10)' to get blocked... connection con1; drop table t1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -unlock tables; +select release_lock('lock1'); +release_lock('lock1') +1 connection default; +get_lock('lock1', 10) +1 +select release_lock('lock1'); +release_lock('lock1') +1 # Demonstrate that there is no deadlock with FLUSH TABLE, # even though it is waiting for the other table to go away create table t2 like t1; @@ -1347,6 +1354,10 @@ handler t1 read a next; a 1 # Unblock 'lock tables t1 write'. +select * from t1; +a +1 +2 commit; connection con1; # Reap 'lock tables t1 write'. @@ -1516,10 +1527,6 @@ handler t1 read a last; a b 7 7 commit; -connection con1; -# Demonstrate that the HANDLER doesn't hold MDL_SHARED_WRITE. -lock table t1 write; -unlock tables; connection default; handler t1 read a prev; a b diff --git a/mysql-test/suite/handler/innodb.result b/mysql-test/suite/handler/innodb.result index 102237617fd..80e8ed679a9 100644 --- a/mysql-test/suite/handler/innodb.result +++ b/mysql-test/suite/handler/innodb.result @@ -1299,19 +1299,27 @@ commit; # an open HANDLER, ER_LOCK_DEADLOCK is reported. # create table t1 (a int, key a(a)); -create table t2 like t1; handler t1 open; connection con1; -lock table t1 write, t2 write; +select get_lock('lock1', 10); +get_lock('lock1', 10) +1 connection default; -drop table t2; +select get_lock('lock1', 10); connection con2; -# Waiting for 'drop table t2' to get blocked... +# Waiting for 'select get_lock('lock1', 10)' to get blocked... connection con1; drop table t1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -unlock tables; +select release_lock('lock1'); +release_lock('lock1') +1 connection default; +get_lock('lock1', 10) +1 +select release_lock('lock1'); +release_lock('lock1') +1 # Demonstrate that there is no deadlock with FLUSH TABLE, # even though it is waiting for the other table to go away create table t2 like t1; @@ -1350,6 +1358,10 @@ handler t1 read a next; a 1 # Unblock 'lock tables t1 write'. +select * from t1; +a +1 +2 commit; connection con1; # Reap 'lock tables t1 write'. @@ -1519,10 +1531,6 @@ handler t1 read a last; a b 7 7 commit; -connection con1; -# Demonstrate that the HANDLER doesn't hold MDL_SHARED_WRITE. -lock table t1 write; -unlock tables; connection default; handler t1 read a prev; a b diff --git a/mysql-test/suite/handler/interface.result b/mysql-test/suite/handler/interface.result index 4d5a385df0f..a4ac32c16b4 100644 --- a/mysql-test/suite/handler/interface.result +++ b/mysql-test/suite/handler/interface.result @@ -272,24 +272,6 @@ handler t1 read a next; ERROR 42S02: Unknown table 't1' in HANDLER connect con1,localhost,root,,; connect con2,localhost,root,,; -connection default; -drop table if exists t1; -# First test case which is supposed trigger the execution -# path on which problem was discovered. -create table t1 (a int not null); -insert into t1 values (1); -handler t1 open; -connection con1; -lock table t1 write; -alter table t1 engine=csv; -connection con2; -connection default; -handler t1 read a next; -ERROR HY000: Storage engine CSV of the table `test`.`t1` doesn't have this option -handler t1 close; -connection con1; -unlock tables; -drop table t1; # Now test case which was reported originally but which no longer # triggers execution path which has caused the problem. connection default; diff --git a/mysql-test/suite/handler/interface.test b/mysql-test/suite/handler/interface.test index a82412799eb..2f576c9b291 100644 --- a/mysql-test/suite/handler/interface.test +++ b/mysql-test/suite/handler/interface.test @@ -298,32 +298,6 @@ handler t1 read a next; connect(con1,localhost,root,,); connect(con2,localhost,root,,); -connection default; ---disable_warnings -drop table if exists t1; ---enable_warnings ---echo # First test case which is supposed trigger the execution ---echo # path on which problem was discovered. -create table t1 (a int not null); -insert into t1 values (1); -handler t1 open; -connection con1; -lock table t1 write; -send alter table t1 engine=csv; -connection con2; -let $wait_condition= - select count(*) = 1 from information_schema.processlist - where state = "Waiting for table metadata lock" and - info = "alter table t1 engine=csv"; ---source include/wait_condition.inc -connection default; ---error ER_ILLEGAL_HA -handler t1 read a next; -handler t1 close; -connection con1; ---reap -unlock tables; -drop table t1; --echo # Now test case which was reported originally but which no longer --echo # triggers execution path which has caused the problem. connection default; diff --git a/mysql-test/suite/handler/myisam.result b/mysql-test/suite/handler/myisam.result index fca75f3b7a6..90e1767a1f3 100644 --- a/mysql-test/suite/handler/myisam.result +++ b/mysql-test/suite/handler/myisam.result @@ -545,7 +545,6 @@ optimize table t1; connection default; handler t1 read next; c1 -1 handler t1 close; connection con2; Table Op Msg_type Msg_text @@ -1296,19 +1295,27 @@ commit; # an open HANDLER, ER_LOCK_DEADLOCK is reported. # create table t1 (a int, key a(a)); -create table t2 like t1; handler t1 open; connection con1; -lock table t1 write, t2 write; +select get_lock('lock1', 10); +get_lock('lock1', 10) +1 connection default; -drop table t2; +select get_lock('lock1', 10); connection con2; -# Waiting for 'drop table t2' to get blocked... +# Waiting for 'select get_lock('lock1', 10)' to get blocked... connection con1; drop table t1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -unlock tables; +select release_lock('lock1'); +release_lock('lock1') +1 connection default; +get_lock('lock1', 10) +1 +select release_lock('lock1'); +release_lock('lock1') +1 # Demonstrate that there is no deadlock with FLUSH TABLE, # even though it is waiting for the other table to go away create table t2 like t1; @@ -1347,6 +1354,10 @@ handler t1 read a next; a 1 # Unblock 'lock tables t1 write'. +select * from t1; +a +1 +2 commit; connection con1; # Reap 'lock tables t1 write'. @@ -1516,10 +1527,6 @@ handler t1 read a last; a b 7 7 commit; -connection con1; -# Demonstrate that the HANDLER doesn't hold MDL_SHARED_WRITE. -lock table t1 write; -unlock tables; connection default; handler t1 read a prev; a b diff --git a/mysql-test/suite/innodb/disabled.def b/mysql-test/suite/innodb/disabled.def index 1580474de29..9f8de75ae14 100644 --- a/mysql-test/suite/innodb/disabled.def +++ b/mysql-test/suite/innodb/disabled.def @@ -10,4 +10,5 @@ # ############################################################################## -innodb_defragment_fill_factor : MDEV-10771 \ No newline at end of file +innodb_defragment_fill_factor : MDEV-10771 + diff --git a/mysql-test/suite/innodb/include/autoinc_persist_alter.inc b/mysql-test/suite/innodb/include/autoinc_persist_alter.inc new file mode 100644 index 00000000000..bbf5f265085 --- /dev/null +++ b/mysql-test/suite/innodb/include/autoinc_persist_alter.inc @@ -0,0 +1,57 @@ + +eval CREATE TABLE $table LIKE $template; + +eval INSERT INTO $table SELECT * FROM $template; + +eval SELECT * FROM $table; + +eval SHOW CREATE TABLE $table; + +--echo # This will keep the autoinc counter +eval ALTER TABLE $table AUTO_INCREMENT = 250, ALGORITHM = $algorithm; +--echo # We expect the counter to be 250 +eval SHOW CREATE TABLE $table; + +--echo # This should keep the autoinc counter as well +eval ALTER TABLE $table ADD COLUMN b INT, ALGORITHM = $algorithm; +--echo # We expect the counter to be 250 +eval SHOW CREATE TABLE $table; + +eval DELETE FROM $table WHERE a > 150; + +eval SELECT * FROM $table; + +--echo # This should reset the autoinc counter to the one specified +--echo # Since it's smaller than current one but bigger than existing +--echo # biggest counter in the table +eval ALTER TABLE $table AUTO_INCREMENT = 180, ALGORITHM = $algorithm; +--echo # We expect the counter to be 180 +eval SHOW CREATE TABLE $table; + +--echo # This should reset the autoinc counter to the next value of +--echo # current max counter in the table, since the specified value +--echo # is smaller than the existing biggest value(50 < 123) +eval ALTER TABLE $table DROP COLUMN b, AUTO_INCREMENT = 50, ALGORITHM = $algorithm; +--echo # We expect the counter to be 123 +eval SHOW CREATE TABLE $table; + +eval INSERT INTO $table VALUES(0), (0); + +eval SELECT MAX(a) AS `Expect 124` FROM $table; + +eval OPTIMIZE TABLE $table; + +eval DELETE FROM $table WHERE a >= 123; + +eval CREATE TABLE i$table(a INT AUTO_INCREMENT, INDEX(a)) AUTO_INCREMENT=125 ENGINE=InnoDB; +eval CREATE UNIQUE INDEX idx_aa ON i$table(a); + +--source include/restart_mysqld.inc + +eval INSERT INTO $table VALUES(0), (0); +eval INSERT INTO i$table VALUES(0), (0); + +eval SELECT MAX(a) AS `Expect 126` FROM $table; +eval SELECT MAX(a) AS `Expect 126` FROM i$table; + +eval DROP TABLE $table, i$table; diff --git a/mysql-test/suite/innodb/include/no_checkpoint_end.inc b/mysql-test/suite/innodb/include/no_checkpoint_end.inc new file mode 100644 index 00000000000..7ca81f8ade0 --- /dev/null +++ b/mysql-test/suite/innodb/include/no_checkpoint_end.inc @@ -0,0 +1,35 @@ +# Check that the latest checkpoint in the redo log files +# is not newer than the checkpoint sampled by no_checkpoint_start.inc + +--source include/kill_mysqld.inc + +perl; +my $cp = $ENV{CHECKPOINT_LSN}; +$cp =~ s/^InnoDB\t\t//; +my $log = "$ENV{MYSQLD_DATADIR}ib_logfile0"; +open(LOG, "<$log") || die "Unable to open $log"; +seek(LOG, 512, 0) || die "Unable to seek $log"; +die unless read(LOG, $_, 16) == 16; +my ($no1hi,$no1lo,$cp1hi,$cp1lo) = unpack("N*", $_); +seek(LOG, 3 * 512, 0) || die "Unable to seek $log"; +die unless read(LOG, $_, 16) == 16; +my ($no2hi,$no2lo,$cp2hi,$cp2lo) = unpack("N*", $_); +close(LOG); + +my $cp1 = $cp1hi << 32 | $cp1lo; +my $cp2 = $cp2hi << 32 | $cp2lo; + +open(OUT, ">$ENV{MYSQLTEST_VARDIR}/log/check.txt") || die; + +if ($cp1 > $cp || $cp2 > $cp) { + print OUT "--source include/start_mysqld.inc\n"; + print OUT "$ENV{CLEANUP_IF_CHECKPOINT}\n"; + print OUT "--skip Extra checkpoint 1 after $cp"; + print OUT " ($no1hi:$no1lo=$cp1,$no2hi:$no2lo=$cp2)\n"; +} + +close(OUT); +EOF + +--source $MYSQLTEST_VARDIR/log/check.txt +--remove_file $MYSQLTEST_VARDIR/log/check.txt diff --git a/mysql-test/suite/innodb/include/no_checkpoint_start.inc b/mysql-test/suite/innodb/include/no_checkpoint_start.inc new file mode 100644 index 00000000000..a903fee67d4 --- /dev/null +++ b/mysql-test/suite/innodb/include/no_checkpoint_start.inc @@ -0,0 +1,5 @@ +# Preparation for using no_checkpoint_end.inc + +let MYSQLD_DATADIR= `select @@datadir`; +--replace_regex /.*Last checkpoint at[ ]*([0-9]+).*/\1/ +let CHECKPOINT_LSN=`SHOW ENGINE INNODB STATUS`; diff --git a/mysql-test/suite/innodb/include/show_i_s_tables.inc b/mysql-test/suite/innodb/include/show_i_s_tables.inc new file mode 100644 index 00000000000..cb4dffdd4c4 --- /dev/null +++ b/mysql-test/suite/innodb/include/show_i_s_tables.inc @@ -0,0 +1,20 @@ +--echo === information_schema.innodb_sys_tables and innodb_sys_tablespaces === +--disable_query_log +--replace_result #P# #p# #SP# #sp# +--replace_regex /FTS_([0-9a-f_]+)([A-Z0-9_]+)/FTS_AUX_\2/ + +SELECT t.name 'Table Name', + s.name 'Tablespace', + t.flag 'Table Flags', + t.n_cols 'Columns', + t.row_format 'Row Format', + t.zip_page_size 'Zip Size', + t.space_type 'Space Type' + FROM information_schema.innodb_sys_tables t LEFT JOIN + information_schema.innodb_sys_tablespaces s + ON t.space = s.space + WHERE t.name not like 'SYS_%' + AND t.name NOT LIKE 'mysql/%' + AND t.name NOT LIKE 'sys/%' + ORDER BY t.name; +--enable_query_log diff --git a/mysql-test/suite/innodb/include/show_i_s_tablespaces.inc b/mysql-test/suite/innodb/include/show_i_s_tablespaces.inc index a79bc3c01a8..90288bb2913 100644 --- a/mysql-test/suite/innodb/include/show_i_s_tablespaces.inc +++ b/mysql-test/suite/innodb/include/show_i_s_tablespaces.inc @@ -17,22 +17,4 @@ SELECT s.name 'Space_Name', AND s.name NOT LIKE 'mysql/%' AND s.name NOT LIKE 'sys/%' ORDER BY s.space; - -# This SELECT will not show UNDO or TEMPORARY tablespaces since -# they are only in FILES, not SYS_TABLESPACES. ---echo === information_schema.files === ---replace_regex /innodb_file_per_table.[0-9]+/innodb_file_per_table.##/ /#P#/#p#/ /#SP#/#sp#/ ---replace_result ./ MYSQLD_DATADIR/ $MYSQLD_DATADIR/ MYSQLD_DATADIR/ $MYSQLD_DATADIR MYSQLD_DATADIR/ $MYSQL_TMP_DIR MYSQL_TMP_DIR $INNODB_PAGE_SIZE DEFAULT -SELECT s.name 'Space_Name', - f.file_type 'File_Type', - f.engine 'Engine', - f.status 'Status', - f.tablespace_name 'Tablespace_Name', - f.file_name 'Path' - FROM information_schema.files f, - information_schema.innodb_sys_tablespaces s - WHERE f.file_id = s.space - AND s.name NOT LIKE 'mysql/%' - AND s.name NOT LIKE 'sys/%' - ORDER BY f.file_id; --enable_query_log diff --git a/mysql-test/suite/innodb/r/autoinc_persist.result b/mysql-test/suite/innodb/r/autoinc_persist.result new file mode 100644 index 00000000000..814f3d32e60 --- /dev/null +++ b/mysql-test/suite/innodb/r/autoinc_persist.result @@ -0,0 +1,964 @@ +# +# MDEV-6076 Persistent AUTO_INCREMENT for InnoDB +# +# WL#6204 InnoDB persistent max value for autoinc columns +# +# Most of this test case is copied from the test innodb.autoinc_persist +# that was introduced in MySQL 8.0.0. The observable behaviour +# of MDEV-6076 is equivalent to WL#6204, with the exception that +# there is less buffering taking place and redo log checkpoints +# are not being treated specially. +# Due to less buffering, there is no debug instrumentation testing +# for MDEV-6076. +# +# Pre-create several tables +SET SQL_MODE='STRICT_ALL_TABLES'; +CREATE TABLE t1(a TINYINT AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t1 VALUES(0), (0), (0), (0), (-1), (-10), (0), +(20), (30), (31); +SELECT * FROM t1; +a +-10 +-1 +1 +2 +3 +4 +5 +20 +30 +31 +CREATE TABLE t2(a TINYINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t2 VALUES(-5); +ERROR 22003: Out of range value for column 'a' at row 1 +INSERT INTO t2 VALUES(0), (0), (0), (0), (8), (10), (0), +(20), (30), (31); +SELECT * FROM t2; +a +1 +2 +3 +4 +8 +10 +11 +20 +30 +31 +CREATE TABLE t3(a SMALLINT AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t3 VALUES(0), (0), (0), (0), (-1), (-10), (0), +(20), (30), (31), (1024), (4096); +SELECT * FROM t3; +a +-10 +-1 +1 +2 +3 +4 +5 +20 +30 +31 +1024 +4096 +CREATE TABLE t4(a SMALLINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t4 VALUES(-5); +ERROR 22003: Out of range value for column 'a' at row 1 +INSERT INTO t4 VALUES(0), (0), (0), (0), (8), (10), (0), +(20), (30), (31), (1024), (4096); +SELECT * FROM t4; +a +1 +2 +3 +4 +8 +10 +11 +20 +30 +31 +1024 +4096 +CREATE TABLE t5(a MEDIUMINT AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t5 VALUES(0), (0), (0), (0), (-1), (-10), (0), +(20), (30), (31), (1000000), (1000005); +SELECT * FROM t5; +a +-10 +-1 +1 +2 +3 +4 +5 +20 +30 +31 +1000000 +1000005 +CREATE TABLE t6(a MEDIUMINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t6 VALUES(-5); +ERROR 22003: Out of range value for column 'a' at row 1 +INSERT INTO t6 VALUES(0), (0), (0), (0), (8), (10), (0), +(20), (30), (31), (1000000), (1000005); +SELECT * FROM t6; +a +1 +2 +3 +4 +8 +10 +11 +20 +30 +31 +1000000 +1000005 +CREATE TABLE t7(a INT AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t7 VALUES(0), (0), (0), (0), (-1), (-10), (0), +(20), (30), (31), (100000000), (100000008); +SELECT * FROM t7; +a +-10 +-1 +1 +2 +3 +4 +5 +20 +30 +31 +100000000 +100000008 +CREATE TABLE t8(a INT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t8 VALUES(-5); +ERROR 22003: Out of range value for column 'a' at row 1 +INSERT INTO t8 VALUES(0), (0), (0), (0), (8), (10), (0), +(20), (30), (31), (100000000), (100000008); +SELECT * FROM t8; +a +1 +2 +3 +4 +8 +10 +11 +20 +30 +31 +100000000 +100000008 +CREATE TABLE t9(a BIGINT AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t9 VALUES(0), (0), (0), (0), (-1), (-10), (0), +(20), (30), (31), (100000000000), (100000000006); +SELECT * FROM t9; +a +-10 +-1 +1 +2 +3 +4 +5 +20 +30 +31 +100000000000 +100000000006 +CREATE TABLE t10(a BIGINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t10 VALUES(-5); +ERROR 22003: Out of range value for column 'a' at row 1 +INSERT INTO t10 VALUES(0), (0), (0), (0), (8), (10), (0), +(20), (30), (31), (100000000000), (100000000006); +SELECT * FROM t10; +a +1 +2 +3 +4 +8 +10 +11 +20 +30 +31 +100000000000 +100000000006 +CREATE TABLE t11(a FLOAT AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t11 VALUES(0), (0), (0), (0), (-1), (-10), (0), +(20), (30), (31); +SELECT * FROM t11; +a +-10 +-1 +1 +2 +3 +4 +5 +20 +30 +31 +CREATE TABLE t12(a DOUBLE AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t12 VALUES(0), (0), (0), (0), (-1), (-10), (0), +(20), (30), (31); +SELECT * FROM t12; +a +-10 +-1 +1 +2 +3 +4 +5 +20 +30 +31 +# Scenario 1: Normal restart, to test if the counters are persisted +# Scenario 2: Delete some values, to test the counters should not be the +# one which is the largest in current table +DELETE FROM t1 WHERE a > 30; +SELECT MAX(a) AS `Expect 30` FROM t1; +Expect 30 +30 +DELETE FROM t3 WHERE a > 2000; +SELECT MAX(a) AS `Expect 2000` FROM t3; +Expect 2000 +1024 +DELETE FROM t5 WHERE a > 1000000; +SELECT MAX(a) AS `Expect 1000000` FROM t5; +Expect 1000000 +1000000 +DELETE FROM t7 WHERE a > 100000000; +SELECT MAX(a) AS `Expect 100000000` FROM t7; +Expect 100000000 +100000000 +DELETE FROM t9 WHERE a > 100000000000; +SELECT MAX(a) AS `Expect 100000000000` FROM t9; +Expect 100000000000 +100000000000 +CREATE TABLE t13(a INT AUTO_INCREMENT PRIMARY KEY) ENGINE = InnoDB, +AUTO_INCREMENT = 1234; +SHOW CREATE TABLE t13; +Table Create Table +t13 CREATE TABLE `t13` ( + `a` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=1234 DEFAULT CHARSET=latin1 +INSERT INTO t13 VALUES(0); +SELECT a AS `Expect 1234` FROM t13; +Expect 1234 +1234 +DROP TABLE t13; +INSERT INTO t1 VALUES(0), (0); +SELECT MAX(a) AS `Expect 33` FROM t1; +Expect 33 +33 +INSERT INTO t3 VALUES(0), (0); +SELECT MAX(a) AS `Expect 4098` FROM t3; +Expect 4098 +4098 +INSERT INTO t5 VALUES(0), (0); +SELECT MAX(a) AS `Expect 1000007` FROM t5; +Expect 1000007 +1000007 +INSERT INTO t7 VALUES(0), (0); +SELECT MAX(a) AS `Expect 100000010` FROM t7; +Expect 100000010 +100000010 +INSERT INTO t9 VALUES(0), (0); +SELECT MAX(a) AS `Expect 100000000008` FROM t9; +Expect 100000000008 +100000000008 +# Scenario 3: Insert some bigger counters, the next counter should start +# from there +INSERT INTO t1 VALUES(40), (0); +INSERT INTO t1 VALUES(42), (0); +SELECT a AS `Expect 43, 42` FROM t1 ORDER BY a DESC LIMIT 4; +Expect 43, 42 +43 +42 +41 +40 +INSERT INTO t3 VALUES(5000), (0); +INSERT INTO t3 VALUES(5010), (0); +SELECT a AS `Expect 5011, 5010` FROM t3 ORDER BY a DESC LIMIT 4; +Expect 5011, 5010 +5011 +5010 +5001 +5000 +INSERT INTO t5 VALUES(1000010), (0); +INSERT INTO t5 VALUES(1000020), (0); +SELECT a AS `Expect 1000021, 1000020` FROM t5 ORDER BY a DESC LIMIT 4; +Expect 1000021, 1000020 +1000021 +1000020 +1000011 +1000010 +INSERT INTO t7 VALUES(100000020), (0); +INSERT INTO t7 VALUES(100000030), (0); +SELECT a AS `Expect 100000031, 100000030` FROM t7 ORDER BY a DESC LIMIT 4; +Expect 100000031, 100000030 +100000031 +100000030 +100000021 +100000020 +INSERT INTO t9 VALUES(100000000010), (0); +INSERT INTO t9 VALUES(100000000020), (0); +SELECT a AS `Expect 100000000021, 100000000020` FROM t9 ORDER BY a DESC LIMIT 4; +Expect 100000000021, 100000000020 +100000000021 +100000000020 +100000000011 +100000000010 +# Scenario 4: Update some values, to test the counters should be updated +# to the bigger value, but not smaller value. +INSERT INTO t1 VALUES(50), (55); +UPDATE t1 SET a = 105 WHERE a = 5; +UPDATE t1 SET a = 100 WHERE a = 55; +# This should insert 102, 106, 107, and make next counter 109. +INSERT INTO t1 VALUES(102), (0), (0); +SELECT a AS `Expect 107, 106` FROM t1 ORDER BY a DESC LIMIT 2; +Expect 107, 106 +107 +106 +DELETE FROM t1 WHERE a > 105; +INSERT INTO t1 VALUES(0); +SELECT MAX(a) AS `Expect 109` FROM t1; +Expect 109 +109 +# Test the same things on t3, t5, t7, t9, to test if DDTableBuffer would +# be updated accordingly +INSERT INTO t3 VALUES(60), (65); +UPDATE t3 SET a = 6005 WHERE a = 5; +UPDATE t3 SET a = 6000 WHERE a = 60; +# This should insert 6002, 6006, 6007, and make next counter 6009. +INSERT INTO t3 VALUES(6002), (0), (0); +SELECT a AS `Expect 6007, 6006` FROM t3 ORDER BY a DESC LIMIT 2; +Expect 6007, 6006 +6007 +6006 +DELETE FROM t3 WHERE a > 6005; +INSERT INTO t3 VALUES(0); +SELECT MAX(a) AS `Expect 6009` FROM t3; +Expect 6009 +6009 +INSERT INTO t5 VALUES(100), (200); +UPDATE t5 SET a = 1000105 WHERE a = 5; +UPDATE t5 SET a = 1000100 WHERE a = 100; +# This should insert 1000102, 1000106, 1000107, and make next counter +# 1000109. +INSERT INTO t5 VALUES(1000102), (0), (0); +SELECT a AS `Expect 1000107, 1000106` FROM t5 ORDER BY a DESC LIMIT 2; +Expect 1000107, 1000106 +1000107 +1000106 +DELETE FROM t5 WHERE a > 1000105; +INSERT INTO t5 VALUES(0); +SELECT MAX(a) AS `Expect 1000109` FROM t5; +Expect 1000109 +1000109 +INSERT INTO t7 VALUES(100), (200); +UPDATE t7 SET a = 100000105 WHERE a = 5; +UPDATE t7 SET a = 100000100 WHERE a = 100; +# This should insert 100000102, 1100000106, 100000107, and make next +# counter 100000109. +INSERT INTO t7 VALUES(100000102), (0), (0); +SELECT a AS `Expect 100000107, 100000106` FROM t7 ORDER BY a DESC LIMIT 2; +Expect 100000107, 100000106 +100000107 +100000106 +DELETE FROM t7 WHERE a > 100000105; +INSERT INTO t7 VALUES(0); +SELECT MAX(a) AS `Expect 100000109` FROM t7; +Expect 100000109 +100000109 +INSERT INTO t9 VALUES(100), (200); +UPDATE t9 SET a = 100000000105 WHERE a = 5; +UPDATE t9 SET a = 100000000100 WHERE a = 100; +# This should insert 100000000102, 100000000106, 100000000107, and make +# next counter 100000000109. +INSERT INTO t9 VALUES(100000000102), (0), (0); +SELECT a AS `Expect 100000000107, 100000000106` FROM t9 ORDER BY a DESC LIMIT 2; +Expect 100000000107, 100000000106 +100000000107 +100000000106 +DELETE FROM t9 WHERE a > 100000000105; +INSERT INTO t9 VALUES(0); +SELECT MAX(a) AS `Expect 100000000109` FROM t9; +Expect 100000000109 +100000000109 +INSERT INTO t1 VALUES(0), (0); +SELECT a AS `Expect 110, 111` FROM t1 ORDER BY a DESC LIMIT 2; +Expect 110, 111 +111 +110 +INSERT INTO t3 VALUES(0), (0); +SELECT a AS `Expect 6010, 6011` FROM t3 ORDER BY a DESC LIMIT 2; +Expect 6010, 6011 +6011 +6010 +INSERT INTO t5 VALUES(0), (0); +SELECT a AS `Expect 1100111, 1100110` FROM t5 ORDER BY a DESC LIMIT 2; +Expect 1100111, 1100110 +1000111 +1000110 +INSERT INTO t7 VALUES(0), (0); +SELECT a AS `Expect 100000111, 100000110` FROM t7 ORDER BY a DESC LIMIT 2; +Expect 100000111, 100000110 +100000111 +100000110 +INSERT INTO t9 VALUES(0), (0); +SELECT a AS `Expect 100000000111, 100000000110` FROM t9 ORDER BY a DESC LIMIT 2; +Expect 100000000111, 100000000110 +100000000111 +100000000110 +# Scenario 5: Test kill the server +INSERT INTO t1 VALUES(125); +DELETE FROM t1 WHERE a = 125; +INSERT INTO t3 VALUES(6100); +DELETE FROM t3 WHERE a = 6100; +INSERT INTO t5 VALUES(1100200); +DELETE FROM t5 WHERE a = 1100200; +INSERT INTO t7 VALUES(100000200); +DELETE FROM t7 WHERE a = 100000200; +# Ensure that all changes before the server is killed are persisted. +set global innodb_flush_log_at_trx_commit=1; +INSERT INTO t9 VALUES(100000000200); +DELETE FROM t9 WHERE a = 100000000200; +# Kill and restart +INSERT INTO t1 VALUES(0); +SELECT a AS `Expect 126` FROM t1 ORDER BY a DESC LIMIT 1; +Expect 126 +126 +INSERT INTO t3 VALUES(0); +SELECT a AS `Expect 6101` FROM t3 ORDER BY a DESC LIMIT 1; +Expect 6101 +6101 +INSERT INTO t5 VALUES(0); +SELECT a AS `Expect 1100201` FROM t5 ORDER BY a DESC LIMIT 1; +Expect 1100201 +1100201 +INSERT INTO t7 VALUES(0); +SELECT a AS `Expect 100000201` FROM t7 ORDER BY a DESC LIMIT 1; +Expect 100000201 +100000201 +INSERT INTO t9 VALUES(0); +SELECT a AS `Expect 100000000201` FROM t9 ORDER BY a DESC LIMIT 1; +Expect 100000000201 +100000000201 +# Scenario 6: Test truncate will reset the counters to 0 +TRUNCATE TABLE t1; +TRUNCATE TABLE t3; +TRUNCATE TABLE t5; +TRUNCATE TABLE t7; +TRUNCATE TABLE t9; +INSERT INTO t1 VALUES(0), (0); +SELECT * FROM t1; +a +1 +2 +INSERT INTO t3 VALUES(0), (0); +SELECT * FROM t3; +a +1 +2 +INSERT INTO t5 VALUES(0), (0); +SELECT * FROM t5; +a +1 +2 +INSERT INTO t7 VALUES(0), (0); +SELECT * FROM t7; +a +1 +2 +INSERT INTO t9 VALUES(0), (0); +SELECT * FROM t9; +a +1 +2 +# Ensure that all changes before the server is killed are persisted. +set global innodb_flush_log_at_trx_commit=1; +TRUNCATE TABLE t1; +TRUNCATE TABLE t3; +TRUNCATE TABLE t5; +TRUNCATE TABLE t7; +TRUNCATE TABLE t9; +# Scenario 7: Test explicit rename table won't change the counter +RENAME TABLE t9 to t19; +INSERT INTO t19 VALUES(0), (0); +SELECT * FROM t19; +a +1 +2 +# Kill and restart +INSERT INTO t1 VALUES(0), (0); +SELECT * FROM t1; +a +1 +2 +INSERT INTO t3 VALUES(0), (0); +SELECT * FROM t3; +a +1 +2 +INSERT INTO t5 VALUES(0), (0); +SELECT * FROM t5; +a +1 +2 +INSERT INTO t7 VALUES(0), (0); +SELECT * FROM t7; +a +1 +2 +INSERT INTO t19 VALUES(0), (0); +SELECT * FROM t19; +a +1 +2 +3 +4 +DELETE FROM t19 WHERE a = 4; +RENAME TABLE t19 to t9; +INSERT INTO t9 VALUES(0), (0); +SELECT * FROM t9; +a +1 +2 +3 +5 +6 +TRUNCATE TABLE t9; +INSERT INTO t9 VALUES(0), (0); +SELECT * FROM t9; +a +1 +2 +# Scenario 8: Test ALTER TABLE operations +INSERT INTO t3 VALUES(0), (0), (100), (200), (1000); +SELECT * FROM t3; +a +1 +2 +3 +4 +100 +200 +1000 +DELETE FROM t3 WHERE a > 300; +SELECT MAX(a) AS `Expect 200` FROM t3; +Expect 200 +200 +# This will not change the counter to 150, but to 201, which is the next +# of current max counter in the table +ALTER TABLE t3 AUTO_INCREMENT = 150; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 +INSERT INTO t3 VALUES(0); +SELECT MAX(a) AS `Expect 201` FROM t3; +Expect 201 +201 +# This will change the counter to 500, which is bigger than any counter +# in the table +ALTER TABLE t3 AUTO_INCREMENT = 500; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=500 DEFAULT CHARSET=latin1 +INSERT INTO t3 VALUES(0); +SELECT MAX(a) AS `Expect 500` FROM t3; +Expect 500 +500 +TRUNCATE TABLE t3; +ALTER TABLE t3 AUTO_INCREMENT = 100; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 +INSERT INTO t3 VALUES(0), (0); +SELECT * FROM t3; +a +100 +101 +INSERT INTO t3 VALUES(150), (180); +UPDATE t3 SET a = 200 WHERE a = 150; +INSERT INTO t3 VALUES(220); +# This still fails to set to 120, but just 221 +ALTER TABLE t3 AUTO_INCREMENT = 120; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=221 DEFAULT CHARSET=latin1 +INSERT INTO t3 VALUES(0); +SELECT MAX(a) AS `Expect 221` FROM t3; +Expect 221 +221 +DELETE FROM t3 WHERE a > 120; +ALTER TABLE t3 AUTO_INCREMENT = 120; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=120 DEFAULT CHARSET=latin1 +# MDEV-6076: Test adding an AUTO_INCREMENT COLUMN +CREATE TABLE mdev6076a (b INT) ENGINE=InnoDB; +INSERT INTO mdev6076a VALUES(2),(1); +CREATE TABLE mdev6076b (b INT) ENGINE=InnoDB; +INSERT INTO mdev6076b VALUES(2),(1); +ALTER TABLE mdev6076a ADD COLUMN a SERIAL FIRST, LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: Adding an auto-increment column requires a lock. Try LOCK=SHARED +ALTER TABLE mdev6076a ADD COLUMN a SERIAL FIRST, ALGORITHM=INPLACE; +ALTER TABLE mdev6076b ADD COLUMN a SERIAL FIRST, AUTO_INCREMENT=100, +ALGORITHM=INPLACE; +# MDEV-6076: Test root page split and page_create_empty() +CREATE TABLE mdev6076empty (b SERIAL, pad CHAR(255) NOT NULL DEFAULT '') +ENGINE=InnoDB; +BEGIN; +# Insert records in descending order of AUTO_INCREMENT, +# causing a page split on the very last insert. +# Without the fix in btr_page_empty() this would lose the counter value. +# Without the fix in page_create_empty() the counter value would be lost +# when ROLLBACK deletes the last row. +ROLLBACK; +# Kill and restart +INSERT INTO t3 VALUES(0); +SELECT MAX(a) AS `Expect 120` FROM t3; +Expect 120 +120 +INSERT INTO mdev6076a SET b=NULL; +SELECT * FROM mdev6076a; +a b +1 2 +2 1 +3 NULL +INSERT INTO mdev6076b SET b=NULL; +SELECT * FROM mdev6076b; +a b +100 2 +101 1 +102 NULL +INSERT INTO mdev6076empty SET b=NULL; +SELECT * FROM mdev6076empty; +b pad +56 +DROP TABLE mdev6076a, mdev6076b, mdev6076empty; +INSERT INTO t3 VALUES(0), (0), (200), (210); +# Test the different algorithms in ALTER TABLE +CREATE TABLE t_inplace LIKE t3; +INSERT INTO t_inplace SELECT * FROM t3; +SELECT * FROM t_inplace; +a +100 +101 +120 +121 +122 +200 +210 +SHOW CREATE TABLE t_inplace; +Table Create Table +t_inplace CREATE TABLE `t_inplace` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=211 DEFAULT CHARSET=latin1 +# This will keep the autoinc counter +ALTER TABLE t_inplace AUTO_INCREMENT = 250, ALGORITHM = INPLACE; +# We expect the counter to be 250 +SHOW CREATE TABLE t_inplace; +Table Create Table +t_inplace CREATE TABLE `t_inplace` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 +# This should keep the autoinc counter as well +ALTER TABLE t_inplace ADD COLUMN b INT, ALGORITHM = INPLACE; +# We expect the counter to be 250 +SHOW CREATE TABLE t_inplace; +Table Create Table +t_inplace CREATE TABLE `t_inplace` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 +DELETE FROM t_inplace WHERE a > 150; +SELECT * FROM t_inplace; +a b +100 NULL +101 NULL +120 NULL +121 NULL +122 NULL +# This should reset the autoinc counter to the one specified +# Since it's smaller than current one but bigger than existing +# biggest counter in the table +ALTER TABLE t_inplace AUTO_INCREMENT = 180, ALGORITHM = INPLACE; +# We expect the counter to be 180 +SHOW CREATE TABLE t_inplace; +Table Create Table +t_inplace CREATE TABLE `t_inplace` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=180 DEFAULT CHARSET=latin1 +# This should reset the autoinc counter to the next value of +# current max counter in the table, since the specified value +# is smaller than the existing biggest value(50 < 123) +ALTER TABLE t_inplace DROP COLUMN b, AUTO_INCREMENT = 50, ALGORITHM = INPLACE; +# We expect the counter to be 123 +SHOW CREATE TABLE t_inplace; +Table Create Table +t_inplace CREATE TABLE `t_inplace` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=123 DEFAULT CHARSET=latin1 +INSERT INTO t_inplace VALUES(0), (0); +SELECT MAX(a) AS `Expect 124` FROM t_inplace; +Expect 124 +124 +OPTIMIZE TABLE t_inplace; +Table Op Msg_type Msg_text +test.t_inplace optimize note Table does not support optimize, doing recreate + analyze instead +test.t_inplace optimize status OK +DELETE FROM t_inplace WHERE a >= 123; +CREATE TABLE it_inplace(a INT AUTO_INCREMENT, INDEX(a)) AUTO_INCREMENT=125 ENGINE=InnoDB; +CREATE UNIQUE INDEX idx_aa ON it_inplace(a); +INSERT INTO t_inplace VALUES(0), (0); +INSERT INTO it_inplace VALUES(0), (0); +SELECT MAX(a) AS `Expect 126` FROM t_inplace; +Expect 126 +126 +SELECT MAX(a) AS `Expect 126` FROM it_inplace; +Expect 126 +126 +DROP TABLE t_inplace, it_inplace; +CREATE TABLE t_copy LIKE t3; +INSERT INTO t_copy SELECT * FROM t3; +SELECT * FROM t_copy; +a +100 +101 +120 +121 +122 +200 +210 +SHOW CREATE TABLE t_copy; +Table Create Table +t_copy CREATE TABLE `t_copy` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=211 DEFAULT CHARSET=latin1 +# This will keep the autoinc counter +ALTER TABLE t_copy AUTO_INCREMENT = 250, ALGORITHM = COPY; +# We expect the counter to be 250 +SHOW CREATE TABLE t_copy; +Table Create Table +t_copy CREATE TABLE `t_copy` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 +# This should keep the autoinc counter as well +ALTER TABLE t_copy ADD COLUMN b INT, ALGORITHM = COPY; +# We expect the counter to be 250 +SHOW CREATE TABLE t_copy; +Table Create Table +t_copy CREATE TABLE `t_copy` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 +DELETE FROM t_copy WHERE a > 150; +SELECT * FROM t_copy; +a b +100 NULL +101 NULL +120 NULL +121 NULL +122 NULL +# This should reset the autoinc counter to the one specified +# Since it's smaller than current one but bigger than existing +# biggest counter in the table +ALTER TABLE t_copy AUTO_INCREMENT = 180, ALGORITHM = COPY; +# We expect the counter to be 180 +SHOW CREATE TABLE t_copy; +Table Create Table +t_copy CREATE TABLE `t_copy` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=180 DEFAULT CHARSET=latin1 +# This should reset the autoinc counter to the next value of +# current max counter in the table, since the specified value +# is smaller than the existing biggest value(50 < 123) +ALTER TABLE t_copy DROP COLUMN b, AUTO_INCREMENT = 50, ALGORITHM = COPY; +# We expect the counter to be 123 +SHOW CREATE TABLE t_copy; +Table Create Table +t_copy CREATE TABLE `t_copy` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=123 DEFAULT CHARSET=latin1 +INSERT INTO t_copy VALUES(0), (0); +SELECT MAX(a) AS `Expect 124` FROM t_copy; +Expect 124 +124 +OPTIMIZE TABLE t_copy; +Table Op Msg_type Msg_text +test.t_copy optimize note Table does not support optimize, doing recreate + analyze instead +test.t_copy optimize status OK +DELETE FROM t_copy WHERE a >= 123; +CREATE TABLE it_copy(a INT AUTO_INCREMENT, INDEX(a)) AUTO_INCREMENT=125 ENGINE=InnoDB; +CREATE UNIQUE INDEX idx_aa ON it_copy(a); +INSERT INTO t_copy VALUES(0), (0); +INSERT INTO it_copy VALUES(0), (0); +SELECT MAX(a) AS `Expect 126` FROM t_copy; +Expect 126 +126 +SELECT MAX(a) AS `Expect 126` FROM it_copy; +Expect 126 +126 +DROP TABLE t_copy, it_copy; +# Scenario 9: Test the sql_mode = NO_AUTO_VALUE_ON_ZERO +CREATE TABLE t30 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT, key(b)) ENGINE = InnoDB; +set SQL_MODE = NO_AUTO_VALUE_ON_ZERO; +INSERT INTO t30 VALUES(NULL, 1), (200, 2), (0, 3); +INSERT INTO t30(b) VALUES(4), (5), (6), (7); +SELECT * FROM t30 ORDER BY b; +a b +1 1 +200 2 +0 3 +201 4 +202 5 +203 6 +204 7 +ALTER TABLE t30 MODIFY b MEDIUMINT; +SELECT * FROM t30 ORDER BY b; +a b +1 1 +200 2 +0 3 +201 4 +202 5 +203 6 +204 7 +# Ensure that all changes before the server is killed are persisted. +set global innodb_flush_log_at_trx_commit=1; +CREATE TABLE t31 (a INT) ENGINE = InnoDB; +INSERT INTO t31 VALUES(1), (2); +ALTER TABLE t31 ADD b INT AUTO_INCREMENT PRIMARY KEY; +INSERT INTO t31 VALUES(3, 0), (4, NULL), (5, NULL); +INSERT INTO t31 VALUES(6, 0); +ERROR 23000: Duplicate entry '0' for key 'PRIMARY' +SELECT * FROM t31; +a b +3 0 +1 1 +2 2 +4 3 +5 4 +SET SQL_MODE = 0; +# Scenario 10: Rollback would not rollback the counter +CREATE TABLE t32 ( +a BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +INSERT INTO t32 VALUES(0), (0); +# Ensure that all changes before the server is killed are persisted. +set global innodb_flush_log_at_trx_commit=1; +START TRANSACTION; +INSERT INTO t32 VALUES(0), (0); +SELECT MAX(a) AS `Expect 4` FROM t32; +Expect 4 +4 +DELETE FROM t32 WHERE a >= 2; +ROLLBACK; +# Scenario 11: Test duplicate primary key/secondary key will not stop +# increasing the counter +CREATE TABLE t33 ( +a BIGINT NOT NULL PRIMARY KEY, +b BIGINT NOT NULL AUTO_INCREMENT, +KEY(b)) ENGINE = InnoDB; +INSERT INTO t33 VALUES(1, NULL); +INSERT INTO t33 VALUES(2, NULL); +INSERT INTO t33 VALUES(2, NULL); +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +INSERT INTO t33 VALUES(3, NULL); +SELECT MAX(b) AS `Expect 4` FROM t33; +Expect 4 +4 +TRUNCATE TABLE t33; +INSERT INTO t33 VALUES(1, NULL); +INSERT INTO t33 VALUES(2, NULL); +set global innodb_flush_log_at_trx_commit=1; +START TRANSACTION; +UPDATE t33 SET a = 10 WHERE a = 1; +INSERT INTO t33 VALUES(2, NULL); +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +COMMIT; +# Kill and restart +# This will not insert 0 +INSERT INTO t31(a) VALUES(6), (0); +SELECT * FROM t31; +a b +3 0 +1 1 +2 2 +4 3 +5 4 +6 5 +0 6 +DROP TABLE t31; +set SQL_MODE = NO_AUTO_VALUE_ON_ZERO; +DELETE FROM t30 WHERE a = 0; +UPDATE t30 set a = 0 where b = 5; +SELECT * FROM t30 ORDER BY b; +a b +1 1 +200 2 +201 4 +0 5 +203 6 +204 7 +DELETE FROM t30 WHERE a = 0; +UPDATE t30 SET a = NULL WHERE b = 6; +Warnings: +Warning 1048 Column 'a' cannot be null +UPDATE t30 SET a = 300 WHERE b = 7; +SELECT * FROM t30 ORDER BY b; +a b +1 1 +200 2 +201 4 +0 6 +300 7 +SET SQL_MODE = 0; +SELECT MAX(a) AS `Expect 2` FROM t32; +Expect 2 +2 +INSERT INTO t32 VALUES(0), (0); +SELECT MAX(a) AS `Expect 6` FROM t32; +Expect 6 +6 +INSERT INTO t33 VALUES(3, NULL); +SELECT MAX(b) AS `Expect 4` FROM t33; +Expect 4 +4 +DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t30, t32, t33; diff --git a/mysql-test/suite/innodb/r/doublewrite.result b/mysql-test/suite/innodb/r/doublewrite.result new file mode 100644 index 00000000000..aa96a5f2d93 --- /dev/null +++ b/mysql-test/suite/innodb/r/doublewrite.result @@ -0,0 +1,241 @@ +# +# Bug #17335427 INNODB CAN NOT USE THE DOUBLEWRITE BUFFER PROPERLY +# Bug #18144349 INNODB CANNOT USE THE DOUBLEWRITE BUFFER FOR THE FIRST +# PAGE OF SYSTEM TABLESPACE +# +SET GLOBAL innodb_fast_shutdown = 0; +show variables like 'innodb_doublewrite'; +Variable_name Value +innodb_doublewrite ON +show variables like 'innodb_fil_make_page_dirty_debug'; +Variable_name Value +innodb_fil_make_page_dirty_debug 0 +show variables like 'innodb_saved_page_number_debug'; +Variable_name Value +innodb_saved_page_number_debug 0 +create table t1 (f1 int primary key, f2 blob) engine=innodb; +start transaction; +insert into t1 values(1, repeat('#',12)); +insert into t1 values(2, repeat('+',12)); +insert into t1 values(3, repeat('/',12)); +insert into t1 values(4, repeat('-',12)); +insert into t1 values(5, repeat('.',12)); +commit work; +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if first page of user +# tablespace is full of zeroes. +select space from information_schema.innodb_sys_tables +where name = 'test/t1' into @space_id; +# Ensure that dirty pages of table t1 is flushed. +flush tables t1 for export; +unlock tables; +begin; +insert into t1 values (6, repeat('%', 12)); +# Make the first page dirty for table t1 +set global innodb_saved_page_number_debug = 0; +set global innodb_fil_make_page_dirty_debug = @space_id; +# Ensure that dirty pages of table t1 are flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Make the first page (page_no=0) of the user tablespace +# full of zeroes. +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +# Test End +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if first page of user +# tablespace is corrupted. +select space from information_schema.innodb_sys_tables +where name = 'test/t1' into @space_id; +# Ensure that dirty pages of table t1 is flushed. +flush tables t1 for export; +unlock tables; +begin; +insert into t1 values (6, repeat('%', 12)); +# Make the first page dirty for table t1 +set global innodb_saved_page_number_debug = 0; +set global innodb_fil_make_page_dirty_debug = @space_id; +# Ensure that dirty pages of table t1 are flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Corrupt the first page (page_no=0) of the user tablespace. +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +# Test End +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if 2nd page of user +# tablespace is full of zeroes. +select space from information_schema.innodb_sys_tables +where name = 'test/t1' into @space_id; +# Ensure that dirty pages of table t1 is flushed. +flush tables t1 for export; +unlock tables; +begin; +insert into t1 values (6, repeat('%', 400)); +# Make the 2nd page dirty for table t1 +set global innodb_saved_page_number_debug = 1; +set global innodb_fil_make_page_dirty_debug = @space_id; +# Ensure that dirty pages of table t1 are flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Make the 2nd page (page_no=1) of the tablespace all zeroes. +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +# Test End +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if 2nd page of user +# tablespace is corrupted. +select space from information_schema.innodb_sys_tables +where name = 'test/t1' into @space_id; +# Ensure that dirty pages of table t1 is flushed. +flush tables t1 for export; +unlock tables; +begin; +insert into t1 values (6, repeat('%', 400)); +# Make the 2nd page dirty for table t1 +set global innodb_saved_page_number_debug = 1; +set global innodb_fil_make_page_dirty_debug = @space_id; +# Ensure that the dirty pages of table t1 are flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Corrupt the 2nd page (page_no=1) of the user tablespace. +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +# Test End +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if first page of +# system tablespace is full of zeroes. +begin; +insert into t1 values (6, repeat('%', 400)); +# Ensure that all dirty pages in the system are flushed. +set global innodb_buf_flush_list_now = 1; +# Make the first page dirty for system tablespace +set global innodb_saved_page_number_debug = 0; +set global innodb_fil_make_page_dirty_debug = 0; +# Ensure that the dirty page of system tablespace is also flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Make the first page (page_no=0) of the system tablespace +# all zeroes. +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +# Test End +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if first page of +# system tablespace is corrupted. +begin; +insert into t1 values (6, repeat('%', 400)); +# Ensure that all dirty pages in the system are flushed. +set global innodb_buf_flush_list_now = 1; +# Make the first page dirty for system tablespace +set global innodb_saved_page_number_debug = 0; +set global innodb_fil_make_page_dirty_debug = 0; +# Ensure that the dirty page of system tablespace is also flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Corrupt the first page (page_no=0) of the system tablespace. +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +# Test End +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if 2nd page of +# system tablespace is full of zeroes. +begin; +insert into t1 values (6, repeat('%', 400)); +# Ensure that all dirty pages in the system are flushed. +set global innodb_buf_flush_list_now = 1; +# Make the second page dirty for system tablespace +set global innodb_saved_page_number_debug = 1; +set global innodb_fil_make_page_dirty_debug = 0; +# Ensure that the dirty page of system tablespace is also flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Make the 2nd page (page_no=1) of the system tablespace +# all zeroes. +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +# Test End +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if 2nd page of +# system tablespace is corrupted. +begin; +insert into t1 values (6, repeat('%', 400)); +# Ensure that all dirty pages in the system are flushed. +set global innodb_buf_flush_list_now = 1; +# Make the second page dirty for system tablespace +set global innodb_saved_page_number_debug = 1; +set global innodb_fil_make_page_dirty_debug = 0; +# Ensure that the dirty page of system tablespace is also flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Make the 2nd page (page_no=1) of the system tablespace +# all zeroes. +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +# Test End +# --------------------------------------------------------------- +drop table t1; diff --git a/mysql-test/suite/innodb/r/foreign-keys.result b/mysql-test/suite/innodb/r/foreign-keys.result index 53ddf618244..0cb53f52a6c 100644 --- a/mysql-test/suite/innodb/r/foreign-keys.result +++ b/mysql-test/suite/innodb/r/foreign-keys.result @@ -14,3 +14,40 @@ ALTER TABLE `title` ADD FOREIGN KEY (`title_manager_fk`) REFERENCES `people` ALTER TABLE `title` ADD FOREIGN KEY (`title_reporter_fk`) REFERENCES `people` (`people_id`); drop table title, department, people; +create table t1 (a int primary key, b int) engine=innodb; +create table t2 (c int primary key, d int, +foreign key (d) references t1 (a) on update cascade) engine=innodb; +insert t1 values (1,1),(2,2),(3,3); +insert t2 values (4,1),(5,2),(6,3); +flush table t2 with read lock; +connect con1,localhost,root; +delete from t1 where a=2; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`d`) REFERENCES `t1` (`a`) ON UPDATE CASCADE) +update t1 set a=10 where a=1; +connection default; +unlock tables; +connection con1; +connection default; +lock table t2 write; +connection con1; +delete from t1 where a=2; +connection default; +unlock tables; +connection con1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`d`) REFERENCES `t1` (`a`) ON UPDATE CASCADE) +connection default; +unlock tables; +disconnect con1; +create user foo; +grant select,update on test.t1 to foo; +connect foo,localhost,foo; +update t1 set a=30 where a=3; +disconnect foo; +connection default; +select * from t2; +c d +5 2 +4 10 +6 30 +drop table t2, t1; +drop user foo; diff --git a/mysql-test/suite/innodb/r/innodb-autoinc-44030.result b/mysql-test/suite/innodb/r/innodb-autoinc-44030.result index cf3ca93db27..5ec1bd38d80 100644 --- a/mysql-test/suite/innodb/r/innodb-autoinc-44030.result +++ b/mysql-test/suite/innodb/r/innodb-autoinc-44030.result @@ -3,15 +3,24 @@ CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; INSERT INTO t1 VALUES (null); INSERT INTO t1 VALUES (null); ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 SELECT * FROM t1; d1 1 2 -SELECT * FROM t1; -d1 -1 -2 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`d1`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES(null); +SELECT * FROM t1; +d1 +1 +2 +3 ALTER TABLE t1 AUTO_INCREMENT = 3; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 diff --git a/mysql-test/suite/innodb/r/innodb-corrupted-table.result b/mysql-test/suite/innodb/r/innodb-corrupted-table.result index 94203a794f8..1a8cea06c4c 100644 --- a/mysql-test/suite/innodb/r/innodb-corrupted-table.result +++ b/mysql-test/suite/innodb/r/innodb-corrupted-table.result @@ -1,5 +1,5 @@ -call mtr.add_suppression("Table .* has a primary key in InnoDB data dictionary, but not in MySQL.*"); -call mtr.add_suppression("InnoDB: Table .* contains .* indexes inside InnoDB, which is different from the number of indexes .* defined in the MySQL.*"); +call mtr.add_suppression("Table .* has a primary key in InnoDB data dictionary, but not in MariaDB.*"); +call mtr.add_suppression("InnoDB: Table .* contains .* indexes inside InnoDB, which is different from the number of indexes .* defined in the MariaDB.*"); create table t1 (pk int, i int, key(i)) engine=InnoDB; insert into t1 values (1,1),(2,2); flush tables; @@ -14,18 +14,18 @@ t1 CREATE TABLE `t1` ( KEY `i` (`i`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 Warnings: -Warning 1082 InnoDB: Table test/t1 has a primary key in InnoDB data dictionary, but not in MySQL! -Warning 1082 InnoDB: Table test/t1 contains 2 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MySQL +Warning 1082 InnoDB: Table test/t1 has a primary key in InnoDB data dictionary, but not in MariaDB! +Warning 1082 InnoDB: Table test/t1 contains 2 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB select * from t1; pk i 1 1 2 2 alter table t1 add j int; Warnings: -Warning 1082 InnoDB: Table test/t1 contains 2 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MySQL +Warning 1082 InnoDB: Table test/t1 contains 2 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB show warnings; Level Code Message -Warning 1082 InnoDB: Table test/t1 contains 2 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MySQL +Warning 1082 InnoDB: Table test/t1 contains 2 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB show create table t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/innodb/r/innodb-index.result b/mysql-test/suite/innodb/r/innodb-index.result index 8cc96230994..2b5e7bf214d 100644 --- a/mysql-test/suite/innodb/r/innodb-index.result +++ b/mysql-test/suite/innodb/r/innodb-index.result @@ -66,7 +66,7 @@ alter table t1 add unique index (c), add index (d); affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 1 Warnings: -Note 1831 Duplicate index 'd' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `d`. This is deprecated and will be disallowed in a future release show create table t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/innodb/r/innodb-lock-schedule-algorithm.result b/mysql-test/suite/innodb/r/innodb-lock-schedule-algorithm.result new file mode 100644 index 00000000000..928cdcfbd97 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-lock-schedule-algorithm.result @@ -0,0 +1,109 @@ +CREATE TABLE t1 (i1 INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (i2 int) ENGINE=MyISAM; +BEGIN; +DELETE FROM t1; +connect con1,localhost,root,,test; +connection con1; +BEGIN; +INSERT INTO t2 VALUES (1),(2); +SELECT * from t1; +i1 +1 +2 +UPDATE t1 SET i1 = 1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +COMMIT; +connection default; +COMMIT; +SELECT * FROM t1; +i1 +SELECT * FROM t2; +i2 +1 +2 +DROP TABLE t1, t2; +disconnect con1; +CREATE TABLE t1 (i1 INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (i2 int) ENGINE=MyISAM; +BEGIN; +DELETE FROM t1; +connect con1,localhost,root,,test; +connection con1; +BEGIN; +INSERT INTO t2 VALUES (1),(2); +SELECT * FROM t1; +i1 +1 +2 +UPDATE t1 SET i1 = 1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection default; +COMMIT; +connection con1; +COMMIT; +connection default; +SELECT * FROM t1; +i1 +SELECT * FROM t2; +i2 +1 +2 +DROP TABLE t1, t2; +disconnect con1; +# "restart: --loose-innodb-lock-schedule-algorithm=FCFS" +CREATE TABLE t1 (i1 INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (i2 int) ENGINE=MyISAM; +BEGIN; +DELETE FROM t1; +connect con1,localhost,root,,test; +connection con1; +BEGIN; +INSERT INTO t2 VALUES (1),(2); +SELECT * from t1; +i1 +1 +2 +UPDATE t1 SET i1 = 1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +COMMIT; +connection default; +COMMIT; +SELECT * FROM t1; +i1 +SELECT * FROM t2; +i2 +1 +2 +DROP TABLE t1, t2; +disconnect con1; +CREATE TABLE t1 (i1 INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (i2 int) ENGINE=MyISAM; +BEGIN; +DELETE FROM t1; +connect con1,localhost,root,,test; +connection con1; +BEGIN; +INSERT INTO t2 VALUES (1),(2); +SELECT * FROM t1; +i1 +1 +2 +UPDATE t1 SET i1 = 1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection default; +COMMIT; +connection con1; +COMMIT; +connection default; +SELECT * FROM t1; +i1 +SELECT * FROM t2; +i2 +1 +2 +DROP TABLE t1, t2; +disconnect con1; diff --git a/mysql-test/suite/innodb/r/innodb-lock.result b/mysql-test/suite/innodb/r/innodb-lock.result index 6604f2396a3..e63a7cd1505 100644 --- a/mysql-test/suite/innodb/r/innodb-lock.result +++ b/mysql-test/suite/innodb/r/innodb-lock.result @@ -36,8 +36,11 @@ drop table t1; # Old lock method (where LOCK TABLE was ignored by InnoDB) no longer # works when LOCK TABLE ... WRITE is used due to fix for bugs #46272 # "MySQL 5.4.4, new MDL: unnecessary and bug #37346 "innodb does not -# detect deadlock between update and alter table". But it still works -# for LOCK TABLE ... READ. +# detect deadlock between update and alter table". +# After WL#6671 "Improve scalability by not using thr_lock.c locks +# for InnoDB tables" was implemented it no longer works for LOCK TABLES +# ,,, READ as well. +# LOCK TABLES locks are now completely handled by MDL subsystem. # set @@innodb_table_locks=0; create table t1 (id integer primary key, x integer) engine=INNODB; @@ -73,28 +76,26 @@ select * from t1 where id = 0 for update; id x 0 1 connection con2; -# The below statement should not be blocked as LOCK TABLES ... READ -# does not take strong SQL-level lock on t1. SELECTs which do not -# conflict with transaction in the first connections should not be -# blocked. -lock table t1 read; -select * from t1; -id x -0 1 -1 1 -2 2 -select * from t1 where id = 1 lock in share mode; -id x -1 1 -unlock tables; -select * from t1; -id x -0 1 -1 1 -2 2 -commit; +# The following statement should block because SQL-level lock +# is taken on t1 which will wait until concurrent transaction +# is commited. +# Sending: +lock table t1 read;; connection con1; +# Wait until LOCK TABLE is blocked on SQL-level lock. +# We should be able to do UPDATEs and SELECTs within transaction. +update t1 set x=2 where id = 0; +select * from t1; +id x +0 2 +1 1 +2 2 +# Unblock LOCK TABLE. commit; +connection con2; +# Reap LOCK TABLE. +unlock tables; +connection default; drop table t1; # #Bug#12842206 INNODB LOCKING REGRESSION FOR INSERT IGNORE diff --git a/mysql-test/suite/innodb/r/innodb-online-alter-gis.result b/mysql-test/suite/innodb/r/innodb-online-alter-gis.result new file mode 100644 index 00000000000..c7daac48e48 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-online-alter-gis.result @@ -0,0 +1,39 @@ +create table t1(a int not null primary key, b geometry not null) engine=innodb; +ALTER ONLINE TABLE t1 ADD SPATIAL INDEX new(b); +ERROR 0A000: LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED +show warnings; +Level Code Message +Error 1846 LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED +show errors; +Level Code Message +Error 1846 LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED +ALTER ONLINE TABLE t1 ADD SPATIAL INDEX new(b), LOCK=SHARED; +show warnings; +Level Code Message +show errors; +Level Code Message +drop table t1; +create table t1(a int not null, b geometry not null, d int,spatial key c(b), key d(d)) engine=innodb; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` geometry NOT NULL, + `d` int(11) DEFAULT NULL, + SPATIAL KEY `c` (`b`), + KEY `d` (`d`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +ALTER ONLINE TABLE t1 ADD PRIMARY KEY(a),DROP INDEX d; +ERROR 0A000: LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED +show warnings; +Level Code Message +Error 1846 LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED +show errors; +Level Code Message +Error 1846 LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED +ALTER ONLINE TABLE t1 ADD PRIMARY KEY(a),DROP INDEX d, LOCK=SHARED; +show warnings; +Level Code Message +show errors; +Level Code Message +drop table t1; diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_tables.result b/mysql-test/suite/innodb/r/innodb-page_compression_tables.result index a0ac8986b9e..7d825e73aa4 100644 --- a/mysql-test/suite/innodb/r/innodb-page_compression_tables.result +++ b/mysql-test/suite/innodb/r/innodb-page_compression_tables.result @@ -123,5 +123,31 @@ drop procedure innodb_insert_proc; drop table innodb_normal; drop table innodb_compact; drop table innodb_dynamic; +CREATE TABLE no_compression (id INT NOT NULL, name VARCHAR(200)) ENGINE=InnoDB; +SET SESSION innodb_compression_default = 1; +CREATE TABLE default_compression (id INT NOT NULL, name VARCHAR(200)) ENGINE=InnoDB; +CREATE TABLE explicit_no_compression (id INT NOT NULL, name VARCHAR(200)) ENGINE=InnoDB PAGE_COMPRESSED=0; +SHOW CREATE TABLE no_compression; +Table Create Table +no_compression CREATE TABLE `no_compression` ( + `id` int(11) NOT NULL, + `name` varchar(200) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW CREATE TABLE default_compression; +Table Create Table +default_compression CREATE TABLE `default_compression` ( + `id` int(11) NOT NULL, + `name` varchar(200) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`='ON' +SHOW CREATE TABLE explicit_no_compression; +Table Create Table +explicit_no_compression CREATE TABLE `explicit_no_compression` ( + `id` int(11) NOT NULL, + `name` varchar(200) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=0 +DROP TABLE no_compression; +DROP TABLE default_compression; +DROP TABLE explicit_no_compression; +SET SESSION innodb_compression_default = 0; Warnings: Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html diff --git a/mysql-test/suite/innodb/r/innodb-virtual-columns.result b/mysql-test/suite/innodb/r/innodb-virtual-columns.result index 9837f567954..6fbb7dcc58f 100644 --- a/mysql-test/suite/innodb/r/innodb-virtual-columns.result +++ b/mysql-test/suite/innodb/r/innodb-virtual-columns.result @@ -30,11 +30,7 @@ grad_degree CREATE TABLE `grad_degree` ( `plan` varchar(10) NOT NULL, `admit_term` char(4) NOT NULL, `wdraw_rsn` varchar(4) NOT NULL DEFAULT '', - `ofis_deg_status` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed' - ELSE 'Not Completed' - END) VIRTUAL, + `ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed' else 'Not Completed' end) VIRTUAL, `deg_start_term` char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data', `deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term', PRIMARY KEY (`student_id`,`plan`,`admit_term`) @@ -140,46 +136,14 @@ grad_degree CREATE TABLE `grad_degree` ( `plan` varchar(10) NOT NULL, `admit_term` char(4) NOT NULL, `wdraw_rsn` varchar(4) NOT NULL DEFAULT '', - `ofis_deg_status` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed' - ELSE 'Not Completed' - END) VIRTUAL, - `ofis_deg_status2` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress2' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed2' - ELSE 'Not Completed2' - END) VIRTUAL, - `ofis_deg_status3` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress3' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed3' - ELSE 'Not Completed3' - END) VIRTUAL, - `ofis_deg_status4` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress4' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed4' - ELSE 'Not Completed4' - END) VIRTUAL, - `ofis_deg_status5` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress5' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed5' - ELSE 'Not Completed5' - END) VIRTUAL, - `ofis_deg_status6` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress6' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed6' - ELSE 'Not Completed6' - END) VIRTUAL, - `ofis_deg_status7` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress7' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed7' - ELSE 'Not Completed7' - END) VIRTUAL, - `ofis_deg_status8` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress8' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed8' - ELSE 'Not Completed8' - END) VIRTUAL, + `ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed' else 'Not Completed' end) VIRTUAL, + `ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed2' else 'Not Completed2' end) VIRTUAL, + `ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed3' else 'Not Completed3' end) VIRTUAL, + `ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed4' else 'Not Completed4' end) VIRTUAL, + `ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed5' else 'Not Completed5' end) VIRTUAL, + `ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed6' else 'Not Completed6' end) VIRTUAL, + `ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed7' else 'Not Completed7' end) VIRTUAL, + `ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed8' else 'Not Completed8' end) VIRTUAL, `deg_start_term` char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data', `deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term', PRIMARY KEY (`student_id`,`plan`,`admit_term`) @@ -229,46 +193,14 @@ grad_degree CREATE TABLE `grad_degree` ( `plan` varchar(10) NOT NULL, `admit_term` char(4) NOT NULL, `wdraw_rsn` varchar(4) NOT NULL DEFAULT '', - `ofis_deg_status` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed' - ELSE 'Not Completed' - END) VIRTUAL, - `ofis_deg_status2` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress2' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed2' - ELSE 'Not Completed2' - END) VIRTUAL, - `ofis_deg_status3` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress3' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed3' - ELSE 'Not Completed3' - END) VIRTUAL, - `ofis_deg_status4` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress4' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed4' - ELSE 'Not Completed4' - END) VIRTUAL, - `ofis_deg_status5` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress5' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed5' - ELSE 'Not Completed5' - END) VIRTUAL, - `ofis_deg_status6` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress6' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed6' - ELSE 'Not Completed6' - END) VIRTUAL, - `ofis_deg_status7` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress7' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed7' - ELSE 'Not Completed7' - END) VIRTUAL, - `ofis_deg_status8` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress8' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed8' - ELSE 'Not Completed8' - END) VIRTUAL, + `ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed' else 'Not Completed' end) VIRTUAL, + `ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed2' else 'Not Completed2' end) VIRTUAL, + `ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed3' else 'Not Completed3' end) VIRTUAL, + `ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed4' else 'Not Completed4' end) VIRTUAL, + `ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed5' else 'Not Completed5' end) VIRTUAL, + `ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed6' else 'Not Completed6' end) VIRTUAL, + `ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed7' else 'Not Completed7' end) VIRTUAL, + `ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed8' else 'Not Completed8' end) VIRTUAL, `deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term', PRIMARY KEY (`student_id`,`plan`,`admit_term`), KEY `grad_degree_as_of_term_ndx` (`deg_as_of_term`) @@ -338,46 +270,14 @@ grad_degree CREATE TABLE `grad_degree` ( `plan` varchar(10) NOT NULL, `admit_term` char(4) NOT NULL, `wdraw_rsn` varchar(4) NOT NULL DEFAULT '', - `ofis_deg_status` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed' - ELSE 'Not Completed' - END) VIRTUAL, - `ofis_deg_status2` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress2' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed2' - ELSE 'Not Completed2' - END) VIRTUAL, - `ofis_deg_status3` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress3' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed3' - ELSE 'Not Completed3' - END) VIRTUAL, - `ofis_deg_status4` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress4' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed4' - ELSE 'Not Completed4' - END) VIRTUAL, - `ofis_deg_status5` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress5' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed5' - ELSE 'Not Completed5' - END) VIRTUAL, - `ofis_deg_status6` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress6' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed6' - ELSE 'Not Completed6' - END) VIRTUAL, - `ofis_deg_status7` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress7' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed7' - ELSE 'Not Completed7' - END) VIRTUAL, - `ofis_deg_status8` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress8' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed8' - ELSE 'Not Completed8' - END) VIRTUAL, + `ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed' else 'Not Completed' end) VIRTUAL, + `ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed2' else 'Not Completed2' end) VIRTUAL, + `ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed3' else 'Not Completed3' end) VIRTUAL, + `ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed4' else 'Not Completed4' end) VIRTUAL, + `ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed5' else 'Not Completed5' end) VIRTUAL, + `ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed6' else 'Not Completed6' end) VIRTUAL, + `ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed7' else 'Not Completed7' end) VIRTUAL, + `ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed8' else 'Not Completed8' end) VIRTUAL, `deg_start_term` char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data', `deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term', PRIMARY KEY (`student_id`,`plan`,`admit_term`) diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-debug-zip.result b/mysql-test/suite/innodb/r/innodb-wl5522-debug-zip.result index 1246cb36e99..cb19c66914e 100644 --- a/mysql-test/suite/innodb/r/innodb-wl5522-debug-zip.result +++ b/mysql-test/suite/innodb/r/innodb-wl5522-debug-zip.result @@ -3,6 +3,7 @@ call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* becau call mtr.add_suppression("InnoDB: Error: Tablespace flags .* corrupted unused .*"); call mtr.add_suppression("InnoDB: Tablespace flags: .* corrupted in file: .* "); call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file .*"); +call mtr.add_suppression("InnoDB: Page for tablespace .* "); flush tables; SET GLOBAL innodb_file_per_table = 1; SELECT @@innodb_file_per_table; diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result index 0138d2ad19a..8327ef36909 100644 --- a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result +++ b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result @@ -7,6 +7,8 @@ call mtr.add_suppression("InnoDB: Ignoring tablespace .* because it could not be call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded."); call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .*"); call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file .*"); +call mtr.add_suppression("InnoDB: Page for tablespace .* "); +flush tables; SET GLOBAL innodb_file_per_table = 1; SELECT @@innodb_file_per_table; @@innodb_file_per_table @@ -931,8 +933,4 @@ set global innodb_monitor_enable = default; set global innodb_monitor_disable = default; set global innodb_monitor_reset = default; set global innodb_monitor_reset_all = default; -Warnings: -Error 145 Table './mtr/test_suppressions' is marked as crashed and should be repaired -Error 1194 Table 'test_suppressions' is marked as crashed and should be repaired -Error 1034 1 client is using or hasn't closed the table properly SET GLOBAL INNODB_FILE_PER_TABLE=1; diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result index 235c8e880d6..c142042fd5a 100644 --- a/mysql-test/suite/innodb/r/innodb.result +++ b/mysql-test/suite/innodb/r/innodb.result @@ -405,7 +405,7 @@ drop table t1; CREATE TABLE t1 (a int not null, b int not null,c int not null, key(a),primary key(a,b), unique(c),key(a),unique(b)); Warnings: -Note 1831 Duplicate index 'a_2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a_2`. This is deprecated and will be disallowed in a future release show index from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment t1 0 PRIMARY 1 a A # NULL NULL BTREE @@ -1512,7 +1512,7 @@ t2 CREATE TABLE `t2` ( ) ENGINE=InnoDB DEFAULT CHARSET=latin1 create index id2 on t2 (id); Warnings: -Note 1831 Duplicate index 'id2' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `id2`. This is deprecated and will be disallowed in a future release show create table t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -1919,7 +1919,7 @@ alter table t1 add unique(v); ERROR 23000: Duplicate entry '{ ' for key 'v_2' alter table t1 add key(v); Warnings: -Note 1831 Duplicate index 'v_2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `v_2`. This is deprecated and will be disallowed in a future release select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a'; qq *a*a*a* @@ -2429,11 +2429,17 @@ drop table t1; create table t1 (a int not null auto_increment primary key, val int) engine=InnoDB; insert into t1 (val) values (1); update t1 set a=2 where a=1; -insert into t1 (val) values (1); +insert into t1 (val) values (3); +select * from t1; +a val +2 1 +3 3 +insert into t1 values (2, 2); ERROR 23000: Duplicate entry '2' for key 'PRIMARY' select * from t1; a val 2 1 +3 3 drop table t1; CREATE TABLE t1 (GRADE DECIMAL(4) NOT NULL, PRIMARY KEY (GRADE)) ENGINE=INNODB; INSERT INTO t1 (GRADE) VALUES (151),(252),(343); @@ -2455,17 +2461,30 @@ drop table t1,t2; CREATE TABLE t1 ( id INTEGER NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) ) ENGINE=InnoDB; +CREATE TABLE t2 ( +id INTEGER NOT NULL, +FOREIGN KEY (id) REFERENCES t1 (id) +) ENGINE=InnoDB; INSERT INTO t1 (id) VALUES (NULL); SELECT * FROM t1; id 1 TRUNCATE t1; +ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`id`) REFERENCES `test`.`t1` (`id`)) INSERT INTO t1 (id) VALUES (NULL); SELECT * FROM t1; id 1 +2 DELETE FROM t1; TRUNCATE t1; +ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`id`) REFERENCES `test`.`t1` (`id`)) +INSERT INTO t1 (id) VALUES (NULL); +SELECT * FROM t1; +id +3 +DROP TABLE t2; +TRUNCATE t1; INSERT INTO t1 (id) VALUES (NULL); SELECT * FROM t1; id @@ -2481,7 +2500,7 @@ id INT NOT NULL PRIMARY KEY, b INT, FOREIGN KEY (b) REFERENCES test.t1(id) ) ENGINE=InnoDB; -Got one of the listed errors +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") DROP TABLE t1; create table t1 (col1 varchar(2000), index (col1(767))) character set = latin1 engine = innodb; @@ -2574,7 +2593,7 @@ INSERT INTO t2 VALUES(1); DELETE FROM t1 WHERE id = 1; ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`)) DROP TABLE t1; -Got one of the listed errors +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`)) SET FOREIGN_KEY_CHECKS=0; DROP TABLE t1; SET FOREIGN_KEY_CHECKS=1; @@ -3089,8 +3108,8 @@ a BIGINT(20) NOT NULL, b VARCHAR(128) NOT NULL, c TEXT NOT NULL, PRIMARY KEY (a,b), -KEY idx_t2_b_c (b,c(200)), -CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a) +KEY idx_t2_b_c (b,c(100)), +CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE CASCADE ) ENGINE=INNODB DEFAULT CHARSET=UTF8; INSERT INTO t1 VALUES (1); diff --git a/mysql-test/suite/innodb/r/innodb_bug12400341.result b/mysql-test/suite/innodb/r/innodb_bug12400341.result index 3bb786c4654..b402af84231 100644 --- a/mysql-test/suite/innodb/r/innodb_bug12400341.result +++ b/mysql-test/suite/innodb/r/innodb_bug12400341.result @@ -14,17 +14,17 @@ innodb_file_per_table ON drop database if exists mysqltest; create database mysqltest; CREATE TABLE mysqltest.transtable (id int unsigned NOT NULL PRIMARY KEY, val int DEFAULT 0) ENGINE=InnoDB; -select count(*) from information_schema.processlist; +select count(*) from information_schema.processlist where command != 'Daemon'; count(*) 33 connection default; CREATE TABLE mysqltest.testtable (id int unsigned not null primary key) ENGINE=InnoDB; ERROR HY000: Can't create table `mysqltest`.`testtable` (errno: 177 "Too many active concurrent transactions") -select count(*) from information_schema.processlist; +select count(*) from information_schema.processlist where command != 'Daemon'; count(*) 33 connection default; -select count(*) from information_schema.processlist; +select count(*) from information_schema.processlist where command != 'Daemon'; count(*) 33 drop database mysqltest; diff --git a/mysql-test/suite/innodb/r/innodb_bug51378.result b/mysql-test/suite/innodb/r/innodb_bug51378.result index 1b0d7db0f82..532fd703af6 100644 --- a/mysql-test/suite/innodb/r/innodb_bug51378.result +++ b/mysql-test/suite/innodb/r/innodb_bug51378.result @@ -5,7 +5,7 @@ col3 time not null) engine = innodb; create unique index idx on bug51378(col1, col2(31)); alter table bug51378 add unique index idx2(col1, col2(31)); Warnings: -Note 1831 Duplicate index 'idx2' defined on the table 'test.bug51378'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `idx2`. This is deprecated and will be disallowed in a future release create unique index idx3 on bug51378(col1, col3); SHOW CREATE TABLE bug51378; Table Create Table diff --git a/mysql-test/suite/innodb/r/innodb_bug54044.result b/mysql-test/suite/innodb/r/innodb_bug54044.result index 1c34ea9de1d..0761c7764e6 100644 --- a/mysql-test/suite/innodb/r/innodb_bug54044.result +++ b/mysql-test/suite/innodb/r/innodb_bug54044.result @@ -6,7 +6,8 @@ table_54044 CREATE TEMPORARY TABLE `table_54044` ( `IF(NULL IS NOT NULL, NULL, NULL)` binary(0) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE table_54044; -CREATE TABLE tmp ENGINE = INNODB AS SELECT COALESCE(NULL, NULL, NULL), GREATEST(NULL, NULL), NULL; +CREATE TABLE tmp ENGINE = INNODB +AS SELECT COALESCE(NULL, NULL, NULL), GREATEST(NULL, NULL), NULL; SHOW CREATE TABLE tmp; Table Create Table tmp CREATE TABLE `tmp` ( diff --git a/mysql-test/suite/innodb/r/innodb_ctype_ldml.result b/mysql-test/suite/innodb/r/innodb_ctype_ldml.result index 375d8b72f3c..12a234a1bde 100644 --- a/mysql-test/suite/innodb/r/innodb_ctype_ldml.result +++ b/mysql-test/suite/innodb/r/innodb_ctype_ldml.result @@ -419,6 +419,9 @@ ucs2_vn_ci ucs2 359 8 ucs2_5624_1 ucs2 360 8 utf8_5624_5 utf8 368 8 utf8_5624_5_bad utf8 369 8 +utf8_czech_test_w2 utf8 370 4 +utf8_czech_test_nopad_w2 utf8 371 4 +utf8_czech_test_bad_w2 utf8 372 4 utf32_test_ci utf32 391 8 utf8_maxuserid_ci utf8 2047 8 show collation like '%test%'; @@ -427,6 +430,9 @@ latin1_test latin1 99 Yes 1 latin1_test2 latin1 332 1 latin1_test2_cs latin1 333 1 utf8_test_ci utf8 353 8 +utf8_czech_test_w2 utf8 370 4 +utf8_czech_test_nopad_w2 utf8 371 4 +utf8_czech_test_bad_w2 utf8 372 4 ucs2_test_ci ucs2 358 8 utf8mb4_test_ci utf8mb4 326 8 utf8mb4_test_400_ci utf8mb4 328 8 diff --git a/mysql-test/suite/innodb/r/innodb_defragment_fill_factor.result b/mysql-test/suite/innodb/r/innodb_defragment_fill_factor.result index 04e41046a6a..e1e616a7e6f 100644 --- a/mysql-test/suite/innodb/r/innodb_defragment_fill_factor.result +++ b/mysql-test/suite/innodb/r/innodb_defragment_fill_factor.result @@ -1,8 +1,8 @@ DROP TABLE if exists t1; DROP TABLE if exists t2; Testing tables with large records -CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256), KEY SECOND(a, b)) ENGINE=INNODB; -INSERT INTO t1 VALUES (1, REPEAT('A', 256)); +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256), c VARCHAR(256), KEY SECOND(a, b,c)) ENGINE=INNODB; +INSERT INTO t1 VALUES (1, REPEAT('A', 256), REPEAT('B', 256)); INSERT INTO t1 (b) SELECT b from t1; INSERT INTO t1 (b) SELECT b from t1; INSERT INTO t1 (b) SELECT b from t1; @@ -16,9 +16,6 @@ INSERT INTO t1 (b) SELECT b from t1; optimize table t1; Table Op Msg_type Msg_text test.t1 optimize status OK -select sleep(1); -sleep(1) -0 select count(*) from t1; count(*) 927 @@ -26,51 +23,94 @@ select count(*) from t1 force index (second); count(*) 927 # A few more insertions on the page should not cause a page split. -insert into t1 values (81, REPEAT('A', 256)); -insert into t1 values (83, REPEAT('A', 256)); -insert into t1 values (87, REPEAT('A', 256)); -insert into t1 values (82, REPEAT('A', 256)); -insert into t1 values (86, REPEAT('A', 256)); -# More insertions will cause page splits -insert into t1 values (88, REPEAT('A', 256)); -insert into t1 values (85, REPEAT('A', 256)); -insert into t1 values (84, REPEAT('A', 256)); +insert into t1 values (81, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (83, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (87, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (82, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (86, REPEAT('A', 256), REPEAT('B', 256)); +# Insert more rows to cause a page split +insert into t1 values (180, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (181, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (182, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (183, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (184, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (185, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (186, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (187, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (188, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (189, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (190, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (191, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (192, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (193, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (194, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (195, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (196, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (197, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (198, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (199, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (200, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (201, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (202, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (203, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (204, REPEAT('A', 256), REPEAT('B', 256)); DROP TABLE t1; Testing table with small records -CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARchar(16), KEY SECOND(a,b)) ENGINE=INNODB; +CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(16), c VARCHAR(32), KEY SECOND(a,b,c)) ENGINE=INNODB; optimize table t2; Table Op Msg_type Msg_text test.t2 optimize status OK -select sleep(1); -sleep(1) -0 +select count(*) from t2; +count(*) +3701 select count(*) from t2 force index(second); count(*) 3701 The page should have room for about 20 insertions -insert into t2 values(1181, REPEAT('A', 16)); -insert into t2 values(1191, REPEAT('A', 16)); -insert into t2 values(1182, REPEAT('A', 16)); -insert into t2 values(1192, REPEAT('A', 16)); -insert into t2 values(1183, REPEAT('A', 16)); -insert into t2 values(1193, REPEAT('A', 16)); -insert into t2 values(1184, REPEAT('A', 16)); -insert into t2 values(1194, REPEAT('A', 16)); -insert into t2 values(1185, REPEAT('A', 16)); -insert into t2 values(1195, REPEAT('A', 16)); -insert into t2 values(1186, REPEAT('A', 16)); -insert into t2 values(1196, REPEAT('A', 16)); -insert into t2 values(1187, REPEAT('A', 16)); -insert into t2 values(1197, REPEAT('A', 16)); -insert into t2 values(1188, REPEAT('A', 16)); -insert into t2 values(1198, REPEAT('A', 16)); -insert into t2 values(1189, REPEAT('A', 16)); -insert into t2 values(1199, REPEAT('A', 16)); -insert into t2 values(1190, REPEAT('A', 16)); -insert into t2 values(1180, REPEAT('A', 16)); -More insertions will cause page split. -insert into t2 values(1280, REPEAT('A', 16)); -insert into t2 values(1290, REPEAT('A', 16)); -insert into t2 values(1281, REPEAT('A', 16)); -insert into t2 values(1291, REPEAT('A', 16)); +insert into t2 values(1181, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1191, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1182, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1192, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1183, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1193, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1184, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1194, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1185, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1195, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1186, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1196, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1187, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1197, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1188, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1198, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1189, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1199, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1190, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1180, REPEAT('A', 16), REPEAT('B',32)); +# Insert more rows to cause a page split +insert into t2 values (180, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (181, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (182, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (183, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (184, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (185, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (186, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (187, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (188, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (189, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (190, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (191, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (192, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (193, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (194, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (195, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (196, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (197, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (198, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (199, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (200, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (201, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (202, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (203, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (204, REPEAT('A', 16), REPEAT('B', 32)); DROP TABLE t2; diff --git a/mysql-test/suite/innodb/r/innodb_monitor.result b/mysql-test/suite/innodb/r/innodb_monitor.result index bda1462ed33..0a163193b58 100644 --- a/mysql-test/suite/innodb/r/innodb_monitor.result +++ b/mysql-test/suite/innodb/r/innodb_monitor.result @@ -39,6 +39,7 @@ buffer_pages_written disabled buffer_index_pages_written disabled buffer_non_index_pages_written disabled buffer_pages_read disabled +buffer_pages0_read disabled buffer_index_sec_rec_cluster_reads disabled buffer_index_sec_rec_cluster_reads_avoided disabled buffer_data_reads disabled diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result index a057719d18b..72e8c30f96f 100644 --- a/mysql-test/suite/innodb/r/innodb_mysql.result +++ b/mysql-test/suite/innodb/r/innodb_mysql.result @@ -1,9 +1,3 @@ -set global innodb_support_xa=default; -Warnings: -Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases. -set session innodb_support_xa=default; -Warnings: -Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases. SET SESSION DEFAULT_STORAGE_ENGINE = InnoDB; drop table if exists t1,t2,t3,t1m,t1i,t2m,t2i,t4; drop procedure if exists p1; @@ -614,9 +608,6 @@ OPTIMIZE TABLE t2; Table Op Msg_type Msg_text test.t2 optimize note Table does not support optimize, doing recreate + analyze instead test.t2 optimize status OK -EXPLAIN SELECT COUNT(*) FROM t2 WHERE stat_id IN (1,3) AND acct_id=785; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx1,idx2 idx1 9 NULL 2 Using where; Using index DROP TABLE t1,t2; create table t1(a int) engine=innodb; alter table t1 comment '123'; @@ -678,8 +669,11 @@ SET AUTOCOMMIT=0; INSERT INTO t2 VALUES (1); connection c2; SET AUTOCOMMIT=0; +SET @old_lock_wait_timeout= @@lock_wait_timeout; +SET lock_wait_timeout= 1; LOCK TABLES t1 READ, t2 READ; ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SET @@lock_wait_timeout= @old_lock_wait_timeout; connection c1; COMMIT; INSERT INTO t1 VALUES (1); @@ -1430,7 +1424,7 @@ INSERT INTO t1 (a,b,c) VALUES (1,1,1), (2,1,1), (3,1,1), (4,1,1); INSERT INTO t1 (a,b,c) SELECT a+4,b,c FROM t1; EXPLAIN SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range t1_b t1_b 5 NULL 8 Using index condition +1 SIMPLE t1 range t1_b t1_b 5 NULL 8 Using where SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5; a b c 8 1 1 @@ -2275,7 +2269,7 @@ INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6); INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); INSERT INTO t3 VALUES (1, 101), (2, 102), (3, 103), (4, 104), (5, 105), (6, 106); INSERT INTO t4 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); -UPDATE t1, t2 SET t1.a = t1.a + 100, t2.b = t1.a + 10 +UPDATE t2 straight_join t1 SET t1.a = t1.a + 100, t2.b = t1.a + 10 WHERE t1.a BETWEEN 2 AND 4 AND t2.a = t1.b; SELECT * FROM t2; a b @@ -2284,7 +2278,7 @@ a b 3 13 4 14 5 5 -UPDATE t3, t4 SET t3.a = t3.a + 100, t4.b = t3.a + 10 +UPDATE t4 straight_join t3 SET t3.a = t3.a + 100, t4.b = t3.a + 10 WHERE t3.a BETWEEN 2 AND 4 AND t4.a = t3.b - 100; SELECT * FROM t4; a b @@ -2335,6 +2329,9 @@ INSERT INTO t1 SELECT c1+1000,c2+1000,c3+1000 from t1; INSERT INTO t1 SELECT c1+10000,c2+10000,c3+10000 from t1; INSERT INTO t1 SELECT c1+100000,c2+100000,c3+100000 from t1; INSERT INTO t1 SELECT c1+1000000,c2+1000000,c3+1000000 from t1; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK SELECT * FROM t1 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3; c1 c2 c3 EXPLAIN SELECT * FROM t1 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3; diff --git a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result index 4dce5d41885..4875dfaeb2a 100644 --- a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result +++ b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result @@ -74,6 +74,7 @@ buffer_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NUL buffer_index_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of index pages written (innodb_index_pages_written) buffer_non_index_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of non index pages written (innodb_non_index_pages_written) buffer_pages_read buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pages read (innodb_pages_read) +buffer_pages0_read buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of page 0 read (innodb_pages0_read) buffer_index_sec_rec_cluster_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of secondary record reads triggered cluster read buffer_index_sec_rec_cluster_reads_avoided buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of secondary record reads avoided triggering cluster read buffer_data_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Amount of data read in bytes (innodb_data_reads) diff --git a/mysql-test/suite/innodb/r/log_data_file_size.result b/mysql-test/suite/innodb/r/log_data_file_size.result new file mode 100644 index 00000000000..d33752b089c --- /dev/null +++ b/mysql-test/suite/innodb/r/log_data_file_size.result @@ -0,0 +1,8 @@ +SET GLOBAL innodb_file_per_table=0; +CREATE TABLE t(a INT)ENGINE=InnoDB; +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE ibd4(a INT UNIQUE)ENGINE=InnoDB; +CREATE TABLE ibd4f(a INT UNIQUE)ENGINE=InnoDB; +CREATE TABLE ibd5(a INT UNIQUE, b INT UNIQUE)ENGINE=InnoDB; +# Kill the server +DROP TABLE t,ibd4,ibd4f,ibd5; diff --git a/mysql-test/suite/innodb/r/system_tables.result b/mysql-test/suite/innodb/r/system_tables.result new file mode 100644 index 00000000000..79a24f7e455 --- /dev/null +++ b/mysql-test/suite/innodb/r/system_tables.result @@ -0,0 +1,8 @@ +alter table mysql.time_zone_name engine=InnoDB; +create table envois3 (starttime datetime) engine=InnoDB; +insert envois3 values ('2008-08-11 22:43:00'); +select convert_tz(starttime,'UTC','Europe/Moscow') starttime from envois3; +starttime +2008-08-12 02:43:00 +drop table envois3; +alter table mysql.time_zone_name engine=MyISAM; diff --git a/mysql-test/suite/innodb/r/table_index_statistics.result b/mysql-test/suite/innodb/r/table_index_statistics.result new file mode 100644 index 00000000000..286c5f9325f --- /dev/null +++ b/mysql-test/suite/innodb/r/table_index_statistics.result @@ -0,0 +1,48 @@ +SET @default_storage_engine_old = @@session.default_storage_engine; +SET SESSION default_storage_engine = INNODB; +FLUSH INDEX_STATISTICS; +FLUSH TABLE_STATISTICS; +SET @userstat_old= @@userstat; +SET GLOBAL userstat=ON; +CREATE TABLE t1 (id int(10), PRIMARY KEY (id)); +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +SELECT COUNT(*) FROM t1; +COUNT(*) +10 +SELECT ROWS_READ FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t1'; +ROWS_READ +10 +SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1'; +ROWS_READ +10 +FLUSH TABLE_STATISTICS; +SELECT ROWS_READ FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t1'; +ROWS_READ +SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1'; +ROWS_READ +10 +FLUSH INDEX_STATISTICS; +SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1'; +ROWS_READ +SELECT COUNT(*) FROM t1; +COUNT(*) +10 +SELECT ROWS_READ FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t1'; +ROWS_READ +10 +SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1'; +ROWS_READ +10 +DROP TABLE t1; +CREATE TABLE t2 (c1 INT UNSIGNED); +ALTER TABLE t2 MODIFY c1 FLOAT; +SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t2'; +TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES +DROP TABLE t2; +CREATE TABLE t2 (c1 INT UNSIGNED); +ALTER TABLE t2 MODIFY c1 FLOAT; +SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t2'; +TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES +DROP TABLE t2; +SET GLOBAL userstat= @userstat_old; +SET SESSION default_storage_engine = @default_storage_engine_old; diff --git a/mysql-test/suite/innodb/r/trigger.result b/mysql-test/suite/innodb/r/trigger.result new file mode 100644 index 00000000000..8218e6e8e70 --- /dev/null +++ b/mysql-test/suite/innodb/r/trigger.result @@ -0,0 +1,28 @@ +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +CREATE TABLE t2 (b INT) ENGINE=InnoDB; +CREATE TABLE t3 (c INT) ENGINE=InnoDB; +CREATE TRIGGER tr BEFORE INSERT ON t3 FOR EACH ROW BEGIN SAVEPOINT sv; INSERT INTO t2 VALUES (0); END $$ +START TRANSACTION; +DELETE FROM t1; +connect con1,localhost,root,,test; +START TRANSACTION; +INSERT INTO t2 VALUES (2); +UPDATE t2 SET b = b+1; +INSERT INTO t1 VALUES (1); +connection default; +COMMIT; +connection con1; +COMMIT; +disconnect con1; +connection default; +SELECT * FROM t1; +a +1 +SELECT * FROM t2; +b +3 +SELECT * FROM t3; +c +DROP TABLE t1, t2, t3; +DROP TRIGGER tr; +ERROR HY000: Trigger does not exist diff --git a/mysql-test/suite/innodb/r/xa_recovery.result b/mysql-test/suite/innodb/r/xa_recovery.result index 0ddfd9c3298..666a65f8ee1 100644 --- a/mysql-test/suite/innodb/r/xa_recovery.result +++ b/mysql-test/suite/innodb/r/xa_recovery.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("InnoDB: Warning: database page corruption or a failed"); CREATE TABLE t1 (a INT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); connect con1,localhost,root; diff --git a/mysql-test/suite/innodb/t/autoinc_persist.test b/mysql-test/suite/innodb/t/autoinc_persist.test new file mode 100644 index 00000000000..45a96f85fe1 --- /dev/null +++ b/mysql-test/suite/innodb/t/autoinc_persist.test @@ -0,0 +1,525 @@ +--source include/have_innodb.inc +# Restarting is not supported when testing the embedded server. +--source include/not_embedded.inc + +--echo # +--echo # MDEV-6076 Persistent AUTO_INCREMENT for InnoDB +--echo # +--echo # WL#6204 InnoDB persistent max value for autoinc columns +--echo # +--echo # Most of this test case is copied from the test innodb.autoinc_persist +--echo # that was introduced in MySQL 8.0.0. The observable behaviour +--echo # of MDEV-6076 is equivalent to WL#6204, with the exception that +--echo # there is less buffering taking place and redo log checkpoints +--echo # are not being treated specially. +--echo # Due to less buffering, there is no debug instrumentation testing +--echo # for MDEV-6076. +--echo # + +--echo # Pre-create several tables + +SET SQL_MODE='STRICT_ALL_TABLES'; + +CREATE TABLE t1(a TINYINT AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t1 VALUES(0), (0), (0), (0), (-1), (-10), (0), +(20), (30), (31); +SELECT * FROM t1; + +CREATE TABLE t2(a TINYINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; +--error ER_WARN_DATA_OUT_OF_RANGE +INSERT INTO t2 VALUES(-5); +INSERT INTO t2 VALUES(0), (0), (0), (0), (8), (10), (0), +(20), (30), (31); +SELECT * FROM t2; + +CREATE TABLE t3(a SMALLINT AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t3 VALUES(0), (0), (0), (0), (-1), (-10), (0), +(20), (30), (31), (1024), (4096); +SELECT * FROM t3; + +CREATE TABLE t4(a SMALLINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; +--error ER_WARN_DATA_OUT_OF_RANGE +INSERT INTO t4 VALUES(-5); +INSERT INTO t4 VALUES(0), (0), (0), (0), (8), (10), (0), +(20), (30), (31), (1024), (4096); +SELECT * FROM t4; + +CREATE TABLE t5(a MEDIUMINT AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t5 VALUES(0), (0), (0), (0), (-1), (-10), (0), +(20), (30), (31), (1000000), (1000005); +SELECT * FROM t5; + +CREATE TABLE t6(a MEDIUMINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; +--error ER_WARN_DATA_OUT_OF_RANGE +INSERT INTO t6 VALUES(-5); +INSERT INTO t6 VALUES(0), (0), (0), (0), (8), (10), (0), +(20), (30), (31), (1000000), (1000005); +SELECT * FROM t6; + +CREATE TABLE t7(a INT AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t7 VALUES(0), (0), (0), (0), (-1), (-10), (0), +(20), (30), (31), (100000000), (100000008); +SELECT * FROM t7; + +CREATE TABLE t8(a INT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; +--error ER_WARN_DATA_OUT_OF_RANGE +INSERT INTO t8 VALUES(-5); +INSERT INTO t8 VALUES(0), (0), (0), (0), (8), (10), (0), +(20), (30), (31), (100000000), (100000008); +SELECT * FROM t8; + +CREATE TABLE t9(a BIGINT AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t9 VALUES(0), (0), (0), (0), (-1), (-10), (0), +(20), (30), (31), (100000000000), (100000000006); +SELECT * FROM t9; + +CREATE TABLE t10(a BIGINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; +--error ER_WARN_DATA_OUT_OF_RANGE +INSERT INTO t10 VALUES(-5); +INSERT INTO t10 VALUES(0), (0), (0), (0), (8), (10), (0), +(20), (30), (31), (100000000000), (100000000006); +SELECT * FROM t10; + +CREATE TABLE t11(a FLOAT AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t11 VALUES(0), (0), (0), (0), (-1), (-10), (0), +(20), (30), (31); +SELECT * FROM t11; + +CREATE TABLE t12(a DOUBLE AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t12 VALUES(0), (0), (0), (0), (-1), (-10), (0), +(20), (30), (31); +SELECT * FROM t12; + +--echo # Scenario 1: Normal restart, to test if the counters are persisted +--echo # Scenario 2: Delete some values, to test the counters should not be the +--echo # one which is the largest in current table + +DELETE FROM t1 WHERE a > 30; +SELECT MAX(a) AS `Expect 30` FROM t1; +DELETE FROM t3 WHERE a > 2000; +SELECT MAX(a) AS `Expect 2000` FROM t3; +DELETE FROM t5 WHERE a > 1000000; +SELECT MAX(a) AS `Expect 1000000` FROM t5; +DELETE FROM t7 WHERE a > 100000000; +SELECT MAX(a) AS `Expect 100000000` FROM t7; +DELETE FROM t9 WHERE a > 100000000000; +SELECT MAX(a) AS `Expect 100000000000` FROM t9; + +CREATE TABLE t13(a INT AUTO_INCREMENT PRIMARY KEY) ENGINE = InnoDB, +AUTO_INCREMENT = 1234; + +--source include/restart_mysqld.inc + +SHOW CREATE TABLE t13; +INSERT INTO t13 VALUES(0); +SELECT a AS `Expect 1234` FROM t13; +DROP TABLE t13; + +INSERT INTO t1 VALUES(0), (0); +SELECT MAX(a) AS `Expect 33` FROM t1; +INSERT INTO t3 VALUES(0), (0); +SELECT MAX(a) AS `Expect 4098` FROM t3; +INSERT INTO t5 VALUES(0), (0); +SELECT MAX(a) AS `Expect 1000007` FROM t5; +INSERT INTO t7 VALUES(0), (0); +SELECT MAX(a) AS `Expect 100000010` FROM t7; +INSERT INTO t9 VALUES(0), (0); +SELECT MAX(a) AS `Expect 100000000008` FROM t9; + +--echo # Scenario 3: Insert some bigger counters, the next counter should start +--echo # from there + +INSERT INTO t1 VALUES(40), (0); +INSERT INTO t1 VALUES(42), (0); +SELECT a AS `Expect 43, 42` FROM t1 ORDER BY a DESC LIMIT 4; +INSERT INTO t3 VALUES(5000), (0); +INSERT INTO t3 VALUES(5010), (0); +SELECT a AS `Expect 5011, 5010` FROM t3 ORDER BY a DESC LIMIT 4; +INSERT INTO t5 VALUES(1000010), (0); +INSERT INTO t5 VALUES(1000020), (0); +SELECT a AS `Expect 1000021, 1000020` FROM t5 ORDER BY a DESC LIMIT 4; +INSERT INTO t7 VALUES(100000020), (0); +INSERT INTO t7 VALUES(100000030), (0); +SELECT a AS `Expect 100000031, 100000030` FROM t7 ORDER BY a DESC LIMIT 4; +INSERT INTO t9 VALUES(100000000010), (0); +INSERT INTO t9 VALUES(100000000020), (0); +SELECT a AS `Expect 100000000021, 100000000020` FROM t9 ORDER BY a DESC LIMIT 4; + +--echo # Scenario 4: Update some values, to test the counters should be updated +--echo # to the bigger value, but not smaller value. + +INSERT INTO t1 VALUES(50), (55); +# Updating to bigger value will update the auto-increment counter +UPDATE t1 SET a = 105 WHERE a = 5; +# Updating to smaller value will not update the counter +UPDATE t1 SET a = 100 WHERE a = 55; +--echo # This should insert 102, 106, 107, and make next counter 109. +INSERT INTO t1 VALUES(102), (0), (0); +SELECT a AS `Expect 107, 106` FROM t1 ORDER BY a DESC LIMIT 2; +DELETE FROM t1 WHERE a > 105; +INSERT INTO t1 VALUES(0); +SELECT MAX(a) AS `Expect 109` FROM t1; + +--echo # Test the same things on t3, t5, t7, t9, to test if DDTableBuffer would +--echo # be updated accordingly + +INSERT INTO t3 VALUES(60), (65); +# Updating to bigger value will update the auto-increment counter +UPDATE t3 SET a = 6005 WHERE a = 5; +# Updating to smaller value will not update the counter +UPDATE t3 SET a = 6000 WHERE a = 60; +--echo # This should insert 6002, 6006, 6007, and make next counter 6009. +INSERT INTO t3 VALUES(6002), (0), (0); +SELECT a AS `Expect 6007, 6006` FROM t3 ORDER BY a DESC LIMIT 2; +DELETE FROM t3 WHERE a > 6005; +INSERT INTO t3 VALUES(0); +SELECT MAX(a) AS `Expect 6009` FROM t3; + +INSERT INTO t5 VALUES(100), (200); +# Updating to bigger value will update the auto-increment counter +UPDATE t5 SET a = 1000105 WHERE a = 5; +# Updating to smaller value will not update the counter +UPDATE t5 SET a = 1000100 WHERE a = 100; +--echo # This should insert 1000102, 1000106, 1000107, and make next counter +--echo # 1000109. +INSERT INTO t5 VALUES(1000102), (0), (0); +SELECT a AS `Expect 1000107, 1000106` FROM t5 ORDER BY a DESC LIMIT 2; +DELETE FROM t5 WHERE a > 1000105; +INSERT INTO t5 VALUES(0); +SELECT MAX(a) AS `Expect 1000109` FROM t5; + +INSERT INTO t7 VALUES(100), (200); +# Updating to bigger value will update the auto-increment counter +UPDATE t7 SET a = 100000105 WHERE a = 5; +# Updating to smaller value will not update the counter +UPDATE t7 SET a = 100000100 WHERE a = 100; +--echo # This should insert 100000102, 1100000106, 100000107, and make next +--echo # counter 100000109. +INSERT INTO t7 VALUES(100000102), (0), (0); +SELECT a AS `Expect 100000107, 100000106` FROM t7 ORDER BY a DESC LIMIT 2; +DELETE FROM t7 WHERE a > 100000105; +INSERT INTO t7 VALUES(0); +SELECT MAX(a) AS `Expect 100000109` FROM t7; + +INSERT INTO t9 VALUES(100), (200); +# Updating to bigger value will update the auto-increment counter +UPDATE t9 SET a = 100000000105 WHERE a = 5; +# Updating to smaller value will not update the counter +UPDATE t9 SET a = 100000000100 WHERE a = 100; +--echo # This should insert 100000000102, 100000000106, 100000000107, and make +--echo # next counter 100000000109. +INSERT INTO t9 VALUES(100000000102), (0), (0); +SELECT a AS `Expect 100000000107, 100000000106` FROM t9 ORDER BY a DESC LIMIT 2; +DELETE FROM t9 WHERE a > 100000000105; +INSERT INTO t9 VALUES(0); +SELECT MAX(a) AS `Expect 100000000109` FROM t9; + +--source include/restart_mysqld.inc + +INSERT INTO t1 VALUES(0), (0); +SELECT a AS `Expect 110, 111` FROM t1 ORDER BY a DESC LIMIT 2; + +INSERT INTO t3 VALUES(0), (0); +SELECT a AS `Expect 6010, 6011` FROM t3 ORDER BY a DESC LIMIT 2; + +INSERT INTO t5 VALUES(0), (0); +SELECT a AS `Expect 1100111, 1100110` FROM t5 ORDER BY a DESC LIMIT 2; + +INSERT INTO t7 VALUES(0), (0); +SELECT a AS `Expect 100000111, 100000110` FROM t7 ORDER BY a DESC LIMIT 2; + +INSERT INTO t9 VALUES(0), (0); +SELECT a AS `Expect 100000000111, 100000000110` FROM t9 ORDER BY a DESC LIMIT 2; + +--echo # Scenario 5: Test kill the server + +INSERT INTO t1 VALUES(125); +DELETE FROM t1 WHERE a = 125; + +INSERT INTO t3 VALUES(6100); +DELETE FROM t3 WHERE a = 6100; + +INSERT INTO t5 VALUES(1100200); +DELETE FROM t5 WHERE a = 1100200; + +INSERT INTO t7 VALUES(100000200); +DELETE FROM t7 WHERE a = 100000200; + +--echo # Ensure that all changes before the server is killed are persisted. +set global innodb_flush_log_at_trx_commit=1; + +INSERT INTO t9 VALUES(100000000200); +DELETE FROM t9 WHERE a = 100000000200; + +--source include/kill_and_restart_mysqld.inc + +INSERT INTO t1 VALUES(0); +SELECT a AS `Expect 126` FROM t1 ORDER BY a DESC LIMIT 1; + +INSERT INTO t3 VALUES(0); +SELECT a AS `Expect 6101` FROM t3 ORDER BY a DESC LIMIT 1; + +INSERT INTO t5 VALUES(0); +SELECT a AS `Expect 1100201` FROM t5 ORDER BY a DESC LIMIT 1; + +INSERT INTO t7 VALUES(0); +SELECT a AS `Expect 100000201` FROM t7 ORDER BY a DESC LIMIT 1; + +INSERT INTO t9 VALUES(0); +SELECT a AS `Expect 100000000201` FROM t9 ORDER BY a DESC LIMIT 1; + +--echo # Scenario 6: Test truncate will reset the counters to 0 + +TRUNCATE TABLE t1; +TRUNCATE TABLE t3; +TRUNCATE TABLE t5; +TRUNCATE TABLE t7; +TRUNCATE TABLE t9; + +INSERT INTO t1 VALUES(0), (0); +SELECT * FROM t1; + +INSERT INTO t3 VALUES(0), (0); +SELECT * FROM t3; + +INSERT INTO t5 VALUES(0), (0); +SELECT * FROM t5; + +INSERT INTO t7 VALUES(0), (0); +SELECT * FROM t7; + +INSERT INTO t9 VALUES(0), (0); +SELECT * FROM t9; + +--echo # Ensure that all changes before the server is killed are persisted. +set global innodb_flush_log_at_trx_commit=1; + +TRUNCATE TABLE t1; +TRUNCATE TABLE t3; +TRUNCATE TABLE t5; +TRUNCATE TABLE t7; +TRUNCATE TABLE t9; + +--echo # Scenario 7: Test explicit rename table won't change the counter + +RENAME TABLE t9 to t19; +INSERT INTO t19 VALUES(0), (0); +SELECT * FROM t19; + +--source include/kill_and_restart_mysqld.inc + +INSERT INTO t1 VALUES(0), (0); +SELECT * FROM t1; + +INSERT INTO t3 VALUES(0), (0); +SELECT * FROM t3; + +INSERT INTO t5 VALUES(0), (0); +SELECT * FROM t5; + +INSERT INTO t7 VALUES(0), (0); +SELECT * FROM t7; + +INSERT INTO t19 VALUES(0), (0); +SELECT * FROM t19; +DELETE FROM t19 WHERE a = 4; + +RENAME TABLE t19 to t9; +INSERT INTO t9 VALUES(0), (0); +SELECT * FROM t9; + +TRUNCATE TABLE t9; + +INSERT INTO t9 VALUES(0), (0); +SELECT * FROM t9; + +--echo # Scenario 8: Test ALTER TABLE operations + +INSERT INTO t3 VALUES(0), (0), (100), (200), (1000); +SELECT * FROM t3; +DELETE FROM t3 WHERE a > 300; +SELECT MAX(a) AS `Expect 200` FROM t3; +--echo # This will not change the counter to 150, but to 201, which is the next +--echo # of current max counter in the table +ALTER TABLE t3 AUTO_INCREMENT = 150; +SHOW CREATE TABLE t3; +INSERT INTO t3 VALUES(0); +SELECT MAX(a) AS `Expect 201` FROM t3; +--echo # This will change the counter to 500, which is bigger than any counter +--echo # in the table +ALTER TABLE t3 AUTO_INCREMENT = 500; +SHOW CREATE TABLE t3; +INSERT INTO t3 VALUES(0); +SELECT MAX(a) AS `Expect 500` FROM t3; + +TRUNCATE TABLE t3; +ALTER TABLE t3 AUTO_INCREMENT = 100; +SHOW CREATE TABLE t3; +INSERT INTO t3 VALUES(0), (0); +SELECT * FROM t3; + +INSERT INTO t3 VALUES(150), (180); +UPDATE t3 SET a = 200 WHERE a = 150; +INSERT INTO t3 VALUES(220); +--echo # This still fails to set to 120, but just 221 +ALTER TABLE t3 AUTO_INCREMENT = 120; +SHOW CREATE TABLE t3; +INSERT INTO t3 VALUES(0); +SELECT MAX(a) AS `Expect 221` FROM t3; + +DELETE FROM t3 WHERE a > 120; + +ALTER TABLE t3 AUTO_INCREMENT = 120; +SHOW CREATE TABLE t3; + +--echo # MDEV-6076: Test adding an AUTO_INCREMENT COLUMN +CREATE TABLE mdev6076a (b INT) ENGINE=InnoDB; +INSERT INTO mdev6076a VALUES(2),(1); +CREATE TABLE mdev6076b (b INT) ENGINE=InnoDB; +INSERT INTO mdev6076b VALUES(2),(1); +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE mdev6076a ADD COLUMN a SERIAL FIRST, LOCK=NONE; +ALTER TABLE mdev6076a ADD COLUMN a SERIAL FIRST, ALGORITHM=INPLACE; +ALTER TABLE mdev6076b ADD COLUMN a SERIAL FIRST, AUTO_INCREMENT=100, +ALGORITHM=INPLACE; +--echo # MDEV-6076: Test root page split and page_create_empty() +CREATE TABLE mdev6076empty (b SERIAL, pad CHAR(255) NOT NULL DEFAULT '') +ENGINE=InnoDB; +BEGIN; +--echo # Insert records in descending order of AUTO_INCREMENT, +--echo # causing a page split on the very last insert. +--echo # Without the fix in btr_page_empty() this would lose the counter value. +--echo # Without the fix in page_create_empty() the counter value would be lost +--echo # when ROLLBACK deletes the last row. +--disable_query_log +let $i= 55; +while ($i) { + eval INSERT INTO mdev6076empty SET b=$i; + dec $i; +} +--enable_query_log +ROLLBACK; + +--source include/kill_and_restart_mysqld.inc + +INSERT INTO t3 VALUES(0); +SELECT MAX(a) AS `Expect 120` FROM t3; + +INSERT INTO mdev6076a SET b=NULL; +SELECT * FROM mdev6076a; +INSERT INTO mdev6076b SET b=NULL; +SELECT * FROM mdev6076b; +INSERT INTO mdev6076empty SET b=NULL; +SELECT * FROM mdev6076empty; +DROP TABLE mdev6076a, mdev6076b, mdev6076empty; + +INSERT INTO t3 VALUES(0), (0), (200), (210); + +--echo # Test the different algorithms in ALTER TABLE + +--let $template = t3 +--let $algorithm = INPLACE +--let $table = t_inplace +--source suite/innodb/include/autoinc_persist_alter.inc +--let $algorithm = COPY +--let $table = t_copy +--source suite/innodb/include/autoinc_persist_alter.inc + +--echo # Scenario 9: Test the sql_mode = NO_AUTO_VALUE_ON_ZERO + +CREATE TABLE t30 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT, key(b)) ENGINE = InnoDB; + +set SQL_MODE = NO_AUTO_VALUE_ON_ZERO; + +INSERT INTO t30 VALUES(NULL, 1), (200, 2), (0, 3); +INSERT INTO t30(b) VALUES(4), (5), (6), (7); +SELECT * FROM t30 ORDER BY b; +ALTER TABLE t30 MODIFY b MEDIUMINT; +SELECT * FROM t30 ORDER BY b; + +--echo # Ensure that all changes before the server is killed are persisted. +set global innodb_flush_log_at_trx_commit=1; + +CREATE TABLE t31 (a INT) ENGINE = InnoDB; +INSERT INTO t31 VALUES(1), (2); +ALTER TABLE t31 ADD b INT AUTO_INCREMENT PRIMARY KEY; +INSERT INTO t31 VALUES(3, 0), (4, NULL), (5, NULL); +--error ER_DUP_ENTRY +INSERT INTO t31 VALUES(6, 0); +SELECT * FROM t31; + +SET SQL_MODE = 0; + +--echo # Scenario 10: Rollback would not rollback the counter +CREATE TABLE t32 ( +a BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; + +INSERT INTO t32 VALUES(0), (0); + +--echo # Ensure that all changes before the server is killed are persisted. +set global innodb_flush_log_at_trx_commit=1; + +START TRANSACTION; +INSERT INTO t32 VALUES(0), (0); +SELECT MAX(a) AS `Expect 4` FROM t32; +DELETE FROM t32 WHERE a >= 2; +ROLLBACK; + +--echo # Scenario 11: Test duplicate primary key/secondary key will not stop +--echo # increasing the counter + +CREATE TABLE t33 ( +a BIGINT NOT NULL PRIMARY KEY, +b BIGINT NOT NULL AUTO_INCREMENT, +KEY(b)) ENGINE = InnoDB; + +INSERT INTO t33 VALUES(1, NULL); +INSERT INTO t33 VALUES(2, NULL); +--error ER_DUP_ENTRY +INSERT INTO t33 VALUES(2, NULL); + +INSERT INTO t33 VALUES(3, NULL); +SELECT MAX(b) AS `Expect 4` FROM t33; + +TRUNCATE TABLE t33; + +INSERT INTO t33 VALUES(1, NULL); +INSERT INTO t33 VALUES(2, NULL); + +set global innodb_flush_log_at_trx_commit=1; + +START TRANSACTION; +UPDATE t33 SET a = 10 WHERE a = 1; +--error ER_DUP_ENTRY +INSERT INTO t33 VALUES(2, NULL); +COMMIT; + +--source include/kill_and_restart_mysqld.inc + +--echo # This will not insert 0 +INSERT INTO t31(a) VALUES(6), (0); +SELECT * FROM t31; +DROP TABLE t31; + +set SQL_MODE = NO_AUTO_VALUE_ON_ZERO; + +DELETE FROM t30 WHERE a = 0; +UPDATE t30 set a = 0 where b = 5; +SELECT * FROM t30 ORDER BY b; +DELETE FROM t30 WHERE a = 0; + +UPDATE t30 SET a = NULL WHERE b = 6; +UPDATE t30 SET a = 300 WHERE b = 7; + +SELECT * FROM t30 ORDER BY b; + +SET SQL_MODE = 0; + +SELECT MAX(a) AS `Expect 2` FROM t32; +INSERT INTO t32 VALUES(0), (0); +SELECT MAX(a) AS `Expect 6` FROM t32; + +INSERT INTO t33 VALUES(3, NULL); +SELECT MAX(b) AS `Expect 4` FROM t33; + +DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t30, t32, t33; diff --git a/mysql-test/suite/innodb/t/doublewrite.test b/mysql-test/suite/innodb/t/doublewrite.test new file mode 100644 index 00000000000..e1984319cb7 --- /dev/null +++ b/mysql-test/suite/innodb/t/doublewrite.test @@ -0,0 +1,368 @@ +--echo # +--echo # Bug #17335427 INNODB CAN NOT USE THE DOUBLEWRITE BUFFER PROPERLY +--echo # Bug #18144349 INNODB CANNOT USE THE DOUBLEWRITE BUFFER FOR THE FIRST +--echo # PAGE OF SYSTEM TABLESPACE +--echo # + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/not_embedded.inc + +# Slow shutdown and restart to make sure ibuf merge is finished +SET GLOBAL innodb_fast_shutdown = 0; +--source include/restart_mysqld.inc + +--disable_query_log +call mtr.add_suppression("InnoDB: Database page [0-9]+:1 contained only zeroes."); +call mtr.add_suppression("Header page consists of zero bytes"); +call mtr.add_suppression("Checksum mismatch in datafile"); +call mtr.add_suppression("but the innodb_page_size start-up parameter is"); +call mtr.add_suppression("Database page corruption"); +--enable_query_log + +let INNODB_PAGE_SIZE=`select @@innodb_page_size`; +let MYSQLD_DATADIR=`select @@datadir`; + +show variables like 'innodb_doublewrite'; +show variables like 'innodb_fil_make_page_dirty_debug'; +show variables like 'innodb_saved_page_number_debug'; + +create table t1 (f1 int primary key, f2 blob) engine=innodb; + +start transaction; +insert into t1 values(1, repeat('#',12)); +insert into t1 values(2, repeat('+',12)); +insert into t1 values(3, repeat('/',12)); +insert into t1 values(4, repeat('-',12)); +insert into t1 values(5, repeat('.',12)); +commit work; + +--echo # --------------------------------------------------------------- +--echo # Test Begin: Test if recovery works if first page of user +--echo # tablespace is full of zeroes. + +select space from information_schema.innodb_sys_tables +where name = 'test/t1' into @space_id; + +--echo # Ensure that dirty pages of table t1 is flushed. +flush tables t1 for export; +unlock tables; + +begin; +insert into t1 values (6, repeat('%', 12)); + +--source ../include/no_checkpoint_start.inc + +--echo # Make the first page dirty for table t1 +set global innodb_saved_page_number_debug = 0; +set global innodb_fil_make_page_dirty_debug = @space_id; + +--echo # Ensure that dirty pages of table t1 are flushed. +set global innodb_buf_flush_list_now = 1; + +--let CLEANUP_IF_CHECKPOINT=drop table t1; +--source ../include/no_checkpoint_end.inc + +--echo # Make the first page (page_no=0) of the user tablespace +--echo # full of zeroes. +perl; +use IO::Handle; +my $fname= "$ENV{'MYSQLD_DATADIR'}test/t1.ibd"; +open(FILE, "+<", $fname) or die; +FILE->autoflush(1); +binmode FILE; +print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}); +close FILE; +EOF + +--source include/start_mysqld.inc + +check table t1; +select f1, f2 from t1; + +--echo # Test End +--echo # --------------------------------------------------------------- +--echo # Test Begin: Test if recovery works if first page of user +--echo # tablespace is corrupted. + +select space from information_schema.innodb_sys_tables +where name = 'test/t1' into @space_id; + +--echo # Ensure that dirty pages of table t1 is flushed. +flush tables t1 for export; +unlock tables; + +begin; +insert into t1 values (6, repeat('%', 12)); + +--source ../include/no_checkpoint_start.inc + +--echo # Make the first page dirty for table t1 +set global innodb_saved_page_number_debug = 0; +set global innodb_fil_make_page_dirty_debug = @space_id; + +--echo # Ensure that dirty pages of table t1 are flushed. +set global innodb_buf_flush_list_now = 1; + +--source include/no_checkpoint_end.inc + +--echo # Corrupt the first page (page_no=0) of the user tablespace. +perl; +use IO::Handle; +my $fname= "$ENV{'MYSQLD_DATADIR'}test/t1.ibd"; +open(FILE, "+<", $fname) or die; +FILE->autoflush(1); +binmode FILE; +print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}/2); +close FILE; +EOF + +--source include/start_mysqld.inc + +check table t1; +select f1, f2 from t1; + +--echo # Test End +--echo # --------------------------------------------------------------- +--echo # Test Begin: Test if recovery works if 2nd page of user +--echo # tablespace is full of zeroes. + +select space from information_schema.innodb_sys_tables +where name = 'test/t1' into @space_id; + +--echo # Ensure that dirty pages of table t1 is flushed. +flush tables t1 for export; +unlock tables; + +begin; +insert into t1 values (6, repeat('%', 400)); + +--source ../include/no_checkpoint_start.inc + +--echo # Make the 2nd page dirty for table t1 +set global innodb_saved_page_number_debug = 1; +set global innodb_fil_make_page_dirty_debug = @space_id; + +--echo # Ensure that dirty pages of table t1 are flushed. +set global innodb_buf_flush_list_now = 1; + +--source include/no_checkpoint_end.inc + +--echo # Make the 2nd page (page_no=1) of the tablespace all zeroes. +perl; +use IO::Handle; +my $fname= "$ENV{'MYSQLD_DATADIR'}test/t1.ibd"; +open(FILE, "+<", $fname) or die; +FILE->autoflush(1); +binmode FILE; +seek(FILE, $ENV{'INNODB_PAGE_SIZE'}, SEEK_SET); +print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}); +close FILE; +EOF + +--source include/start_mysqld.inc + +check table t1; +select f1, f2 from t1; + +--echo # Test End +--echo # --------------------------------------------------------------- +--echo # Test Begin: Test if recovery works if 2nd page of user +--echo # tablespace is corrupted. + +select space from information_schema.innodb_sys_tables +where name = 'test/t1' into @space_id; + +--echo # Ensure that dirty pages of table t1 is flushed. +flush tables t1 for export; +unlock tables; + +begin; +insert into t1 values (6, repeat('%', 400)); + +--source ../include/no_checkpoint_start.inc + +--echo # Make the 2nd page dirty for table t1 +set global innodb_saved_page_number_debug = 1; +set global innodb_fil_make_page_dirty_debug = @space_id; + +--echo # Ensure that the dirty pages of table t1 are flushed. +set global innodb_buf_flush_list_now = 1; + +--source include/no_checkpoint_end.inc + +--echo # Corrupt the 2nd page (page_no=1) of the user tablespace. +perl; +use IO::Handle; +my $fname= "$ENV{'MYSQLD_DATADIR'}test/t1.ibd"; +open(FILE, "+<", $fname) or die; +FILE->autoflush(1); +binmode FILE; +seek(FILE, $ENV{'INNODB_PAGE_SIZE'}, SEEK_SET); +print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}/2); +close FILE; +EOF + +--source include/start_mysqld.inc + +check table t1; +select f1, f2 from t1; + +--echo # Test End +--echo # --------------------------------------------------------------- +--echo # Test Begin: Test if recovery works if first page of +--echo # system tablespace is full of zeroes. + +begin; +insert into t1 values (6, repeat('%', 400)); + +--echo # Ensure that all dirty pages in the system are flushed. +set global innodb_buf_flush_list_now = 1; + +--echo # Make the first page dirty for system tablespace +set global innodb_saved_page_number_debug = 0; +set global innodb_fil_make_page_dirty_debug = 0; + +--echo # Ensure that the dirty page of system tablespace is also flushed. +# We do this after the transaction starts and all dirty pages have been flushed +# already. So flushing of this specified dirty page will surely keep the +# copy in doublewrite buffer, and no more writes to doublewrite buffer would +# overwrite the copy. Thus, we can safely modify the original page when server +# is down. So do the following testings. +set global innodb_buf_flush_list_now = 1; + +--source include/kill_mysqld.inc + +--echo # Make the first page (page_no=0) of the system tablespace +--echo # all zeroes. +perl; +use IO::Handle; +my $fname= "$ENV{'MYSQLD_DATADIR'}ibdata1"; +open(FILE, "+<", $fname) or die; +FILE->autoflush(1); +binmode FILE; +print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}); +close FILE; +EOF + +--source include/start_mysqld.inc + +check table t1; +select f1, f2 from t1; + +--echo # Test End +--echo # --------------------------------------------------------------- +--echo # Test Begin: Test if recovery works if first page of +--echo # system tablespace is corrupted. + +begin; +insert into t1 values (6, repeat('%', 400)); + +--echo # Ensure that all dirty pages in the system are flushed. +set global innodb_buf_flush_list_now = 1; + +--echo # Make the first page dirty for system tablespace +set global innodb_saved_page_number_debug = 0; +set global innodb_fil_make_page_dirty_debug = 0; + +--echo # Ensure that the dirty page of system tablespace is also flushed. +set global innodb_buf_flush_list_now = 1; + +--source include/kill_mysqld.inc + +--echo # Corrupt the first page (page_no=0) of the system tablespace. +perl; +use IO::Handle; +my $fname= "$ENV{'MYSQLD_DATADIR'}ibdata1"; +open(FILE, "+<", $fname) or die; +FILE->autoflush(1); +binmode FILE; +print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}/2); +close FILE; +EOF + +--source include/start_mysqld.inc + +check table t1; +select f1, f2 from t1; + +--echo # Test End +--echo # --------------------------------------------------------------- +--echo # Test Begin: Test if recovery works if 2nd page of +--echo # system tablespace is full of zeroes. + +begin; +insert into t1 values (6, repeat('%', 400)); + +--echo # Ensure that all dirty pages in the system are flushed. +set global innodb_buf_flush_list_now = 1; + +--echo # Make the second page dirty for system tablespace +set global innodb_saved_page_number_debug = 1; +set global innodb_fil_make_page_dirty_debug = 0; + +--echo # Ensure that the dirty page of system tablespace is also flushed. +set global innodb_buf_flush_list_now = 1; + +--source include/kill_mysqld.inc + +--echo # Make the 2nd page (page_no=1) of the system tablespace +--echo # all zeroes. +perl; +use IO::Handle; +my $fname= "$ENV{'MYSQLD_DATADIR'}ibdata1"; +open(FILE, "+<", $fname) or die; +FILE->autoflush(1); +binmode FILE; +seek(FILE, $ENV{'INNODB_PAGE_SIZE'}, SEEK_SET); +print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}); +close FILE; +EOF + +--source include/start_mysqld.inc + +check table t1; +select f1, f2 from t1; + +--echo # Test End +--echo # --------------------------------------------------------------- +--echo # Test Begin: Test if recovery works if 2nd page of +--echo # system tablespace is corrupted. + +begin; +insert into t1 values (6, repeat('%', 400)); + +--echo # Ensure that all dirty pages in the system are flushed. +set global innodb_buf_flush_list_now = 1; + +--echo # Make the second page dirty for system tablespace +set global innodb_saved_page_number_debug = 1; +set global innodb_fil_make_page_dirty_debug = 0; + +--echo # Ensure that the dirty page of system tablespace is also flushed. +set global innodb_buf_flush_list_now = 1; + +--source include/kill_mysqld.inc + +--echo # Make the 2nd page (page_no=1) of the system tablespace +--echo # all zeroes. +perl; +use IO::Handle; +my $fname= "$ENV{'MYSQLD_DATADIR'}ibdata1"; +open(FILE, "+<", $fname) or die; +FILE->autoflush(1); +binmode FILE; +seek(FILE, $ENV{'INNODB_PAGE_SIZE'}, SEEK_SET); +print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}/2); +close FILE; +EOF + +--source include/start_mysqld.inc + +check table t1; +select f1, f2 from t1; + +--echo # Test End +--echo # --------------------------------------------------------------- + +drop table t1; diff --git a/mysql-test/suite/innodb/t/foreign-keys.test b/mysql-test/suite/innodb/t/foreign-keys.test index 2d586e2d6be..e77e1e761c7 100644 --- a/mysql-test/suite/innodb/t/foreign-keys.test +++ b/mysql-test/suite/innodb/t/foreign-keys.test @@ -24,3 +24,49 @@ ALTER TABLE `title` ADD FOREIGN KEY (`title_reporter_fk`) REFERENCES `people` (`people_id`); drop table title, department, people; + +# +# FK and prelocking: +# child table accesses (reads and writes) wait for locks. +# +create table t1 (a int primary key, b int) engine=innodb; +create table t2 (c int primary key, d int, + foreign key (d) references t1 (a) on update cascade) engine=innodb; +insert t1 values (1,1),(2,2),(3,3); +insert t2 values (4,1),(5,2),(6,3); +flush table t2 with read lock; # this takes MDL_SHARED_NO_WRITE +connect (con1,localhost,root); +--error ER_ROW_IS_REFERENCED_2 +delete from t1 where a=2; +send update t1 set a=10 where a=1; +connection default; +let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock'; +source include/wait_condition.inc; +unlock tables; +connection con1; +reap; +connection default; +lock table t2 write; # this takes MDL_SHARED_NO_READ_WRITE +connection con1; +send delete from t1 where a=2; +connection default; +let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock'; +source include/wait_condition.inc; +unlock tables; +connection con1; +--error ER_ROW_IS_REFERENCED_2 +reap; +connection default; +unlock tables; +disconnect con1; + +# but privileges should not be checked +create user foo; +grant select,update on test.t1 to foo; +connect(foo,localhost,foo); +update t1 set a=30 where a=3; +disconnect foo; +connection default; +select * from t2; +drop table t2, t1; +drop user foo; diff --git a/mysql-test/suite/innodb/t/innodb-autoinc-44030-master.opt b/mysql-test/suite/innodb/t/innodb-autoinc-44030-master.opt deleted file mode 100644 index 303ec1be1d0..00000000000 --- a/mysql-test/suite/innodb/t/innodb-autoinc-44030-master.opt +++ /dev/null @@ -1,3 +0,0 @@ ---default-storage-engine=MyISAM ---innodb-strict-mode=0 ---innodb-file-per-table=0 diff --git a/mysql-test/suite/innodb/t/innodb-autoinc-44030.test b/mysql-test/suite/innodb/t/innodb-autoinc-44030.test index 256e7d838ea..61c56127351 100644 --- a/mysql-test/suite/innodb/t/innodb-autoinc-44030.test +++ b/mysql-test/suite/innodb/t/innodb-autoinc-44030.test @@ -2,27 +2,24 @@ # embedded server does not support restarting -- source include/not_embedded.inc -# -# 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from +# Before MDEV-6076 Persistent AUTO_INCREMENT for InnoDB +# this was a test for +# Bug #44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from # the index (PRIMARY) # This test requires a restart of the server SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; INSERT INTO t1 VALUES (null); INSERT INTO t1 VALUES (null); +--enable_info ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT; +--disable_info SELECT * FROM t1; -# Restart the server -- source include/restart_mysqld.inc -# The MySQL and InnoDB data dictionaries should now be out of sync. -# The select should print message to the error log -SELECT * FROM t1; -# MySQL have made a change (http://lists.mysql.com/commits/75268) that no -# longer results in the two data dictionaries being out of sync. If they -# revert their changes then this check for ER_AUTOINC_READ_FAILED will need -# to be enabled. Also, see http://bugs.mysql.com/bug.php?id=47621. -#-- error ER_AUTOINC_READ_FAILED,1467 +SHOW CREATE TABLE t1; INSERT INTO t1 VALUES(null); +SELECT * FROM t1; + # Before WL#5534, the following statement would copy the table, # and effectively set AUTO_INCREMENT to 4, because while copying # it would write values 1,2,3 to the column. diff --git a/mysql-test/suite/innodb/t/innodb-corrupted-table.test b/mysql-test/suite/innodb/t/innodb-corrupted-table.test index 94c5454429f..60da461a33c 100644 --- a/mysql-test/suite/innodb/t/innodb-corrupted-table.test +++ b/mysql-test/suite/innodb/t/innodb-corrupted-table.test @@ -5,8 +5,8 @@ # MDEV-9918: [ERROR] mysqld got signal 11 during ALTER TABLE `name` COLUMN ADD # -call mtr.add_suppression("Table .* has a primary key in InnoDB data dictionary, but not in MySQL.*"); -call mtr.add_suppression("InnoDB: Table .* contains .* indexes inside InnoDB, which is different from the number of indexes .* defined in the MySQL.*"); +call mtr.add_suppression("Table .* has a primary key in InnoDB data dictionary, but not in MariaDB.*"); +call mtr.add_suppression("InnoDB: Table .* contains .* indexes inside InnoDB, which is different from the number of indexes .* defined in the MariaDB.*"); create table t1 (pk int, i int, key(i)) engine=InnoDB; insert into t1 values (1,1),(2,2); diff --git a/mysql-test/suite/innodb/t/innodb-lock-schedule-algorithm.opt b/mysql-test/suite/innodb/t/innodb-lock-schedule-algorithm.opt new file mode 100644 index 00000000000..e5d34636ccb --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-lock-schedule-algorithm.opt @@ -0,0 +1,2 @@ +--loose-innodb-lock-wait-timeout=1 +--loose-innodb-lock-schedule-algorithm=VATS diff --git a/mysql-test/suite/innodb/t/innodb-lock-schedule-algorithm.test b/mysql-test/suite/innodb/t/innodb-lock-schedule-algorithm.test new file mode 100644 index 00000000000..a14c156546a --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-lock-schedule-algorithm.test @@ -0,0 +1,106 @@ +--source include/have_innodb.inc + +CREATE TABLE t1 (i1 INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2); + +CREATE TABLE t2 (i2 int) ENGINE=MyISAM; +BEGIN; +DELETE FROM t1; + +--connect (con1,localhost,root,,test) +connection con1; +BEGIN; +INSERT INTO t2 VALUES (1),(2); +SELECT * from t1; +--error 1205 +UPDATE t1 SET i1 = 1; +COMMIT; + +connection default; +COMMIT; +SELECT * FROM t1; +SELECT * FROM t2; +DROP TABLE t1, t2; +disconnect con1; + +CREATE TABLE t1 (i1 INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2); + +CREATE TABLE t2 (i2 int) ENGINE=MyISAM; +BEGIN; +DELETE FROM t1; + +--connect (con1,localhost,root,,test) +connection con1; +BEGIN; +INSERT INTO t2 VALUES (1),(2); +SELECT * FROM t1; +--error 1205 +UPDATE t1 SET i1 = 1; + +connection default; +COMMIT; + +connection con1; +COMMIT; + +connection default; +SELECT * FROM t1; +SELECT * FROM t2; +DROP TABLE t1, t2; +disconnect con1; + +--echo # "restart: --loose-innodb-lock-schedule-algorithm=FCFS" +--let $restart_parameters=--loose_innodb_lock_schedule_algorithm=FCFS +-- source include/restart_mysqld.inc + +CREATE TABLE t1 (i1 INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2); + +CREATE TABLE t2 (i2 int) ENGINE=MyISAM; +BEGIN; +DELETE FROM t1; + +--connect (con1,localhost,root,,test) +connection con1; +BEGIN; +INSERT INTO t2 VALUES (1),(2); +SELECT * from t1; +--error 1205 +UPDATE t1 SET i1 = 1; +COMMIT; + +connection default; +COMMIT; +SELECT * FROM t1; +SELECT * FROM t2; +DROP TABLE t1, t2; +disconnect con1; + +CREATE TABLE t1 (i1 INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2); + +CREATE TABLE t2 (i2 int) ENGINE=MyISAM; +BEGIN; +DELETE FROM t1; + +--connect (con1,localhost,root,,test) +connection con1; +BEGIN; +INSERT INTO t2 VALUES (1),(2); +SELECT * FROM t1; +--error 1205 +UPDATE t1 SET i1 = 1; + +connection default; +COMMIT; + +connection con1; +COMMIT; + +connection default; +SELECT * FROM t1; +SELECT * FROM t2; +DROP TABLE t1, t2; +disconnect con1; + diff --git a/mysql-test/suite/innodb/t/innodb-lock.test b/mysql-test/suite/innodb/t/innodb-lock.test index 47246c53759..3e9b3dd7fe4 100644 --- a/mysql-test/suite/innodb/t/innodb-lock.test +++ b/mysql-test/suite/innodb/t/innodb-lock.test @@ -60,8 +60,11 @@ drop table t1; --echo # Old lock method (where LOCK TABLE was ignored by InnoDB) no longer --echo # works when LOCK TABLE ... WRITE is used due to fix for bugs #46272 --echo # "MySQL 5.4.4, new MDL: unnecessary and bug #37346 "innodb does not ---echo # detect deadlock between update and alter table". But it still works ---echo # for LOCK TABLE ... READ. +--echo # detect deadlock between update and alter table". +--echo # After WL#6671 "Improve scalability by not using thr_lock.c locks +--echo # for InnoDB tables" was implemented it no longer works for LOCK TABLES +--echo # ,,, READ as well. +--echo # LOCK TABLES locks are now completely handled by MDL subsystem. --echo # set @@innodb_table_locks=0; @@ -104,20 +107,32 @@ connection con1; select * from t1 where id = 0 for update; connection con2; ---echo # The below statement should not be blocked as LOCK TABLES ... READ ---echo # does not take strong SQL-level lock on t1. SELECTs which do not ---echo # conflict with transaction in the first connections should not be ---echo # blocked. -lock table t1 read; -select * from t1; -select * from t1 where id = 1 lock in share mode; -unlock tables; -select * from t1; -commit; +--echo # The following statement should block because SQL-level lock +--echo # is taken on t1 which will wait until concurrent transaction +--echo # is commited. +--echo # Sending: +--send lock table t1 read; connection con1; +--echo # Wait until LOCK TABLE is blocked on SQL-level lock. +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "lock table t1 read"; +--source include/wait_condition.inc +--echo # We should be able to do UPDATEs and SELECTs within transaction. +update t1 set x=2 where id = 0; +select * from t1; +--echo # Unblock LOCK TABLE. commit; +connection con2; +--echo # Reap LOCK TABLE. +--reap +unlock tables; + +connection default; + drop table t1; # End of 4.1 tests diff --git a/mysql-test/suite/innodb/t/innodb-online-alter-gis.test b/mysql-test/suite/innodb/t/innodb-online-alter-gis.test new file mode 100644 index 00000000000..64d07ba23aa --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-online-alter-gis.test @@ -0,0 +1,21 @@ +--source include/have_innodb.inc + +create table t1(a int not null primary key, b geometry not null) engine=innodb; +--error 1846 +ALTER ONLINE TABLE t1 ADD SPATIAL INDEX new(b); +show warnings; +show errors; +ALTER ONLINE TABLE t1 ADD SPATIAL INDEX new(b), LOCK=SHARED; +show warnings; +show errors; +drop table t1; +create table t1(a int not null, b geometry not null, d int,spatial key c(b), key d(d)) engine=innodb; +show create table t1; +--error 1846 +ALTER ONLINE TABLE t1 ADD PRIMARY KEY(a),DROP INDEX d; +show warnings; +show errors; +ALTER ONLINE TABLE t1 ADD PRIMARY KEY(a),DROP INDEX d, LOCK=SHARED; +show warnings; +show errors; +drop table t1; diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_tables.test b/mysql-test/suite/innodb/t/innodb-page_compression_tables.test index 41d844d26b4..3a241810bbc 100644 --- a/mysql-test/suite/innodb/t/innodb-page_compression_tables.test +++ b/mysql-test/suite/innodb/t/innodb-page_compression_tables.test @@ -95,6 +95,20 @@ drop table innodb_normal; drop table innodb_compact; drop table innodb_dynamic; +# MDEV-9820 introducing variable for having page compression turned on by default on InnoDB tables +# test that innodb_compression_default works as expected, i.e. if it has a value of 1 (ON) tables are by default created with page_compressed=1; +CREATE TABLE no_compression (id INT NOT NULL, name VARCHAR(200)) ENGINE=InnoDB; +SET SESSION innodb_compression_default = 1; +CREATE TABLE default_compression (id INT NOT NULL, name VARCHAR(200)) ENGINE=InnoDB; +CREATE TABLE explicit_no_compression (id INT NOT NULL, name VARCHAR(200)) ENGINE=InnoDB PAGE_COMPRESSED=0; +SHOW CREATE TABLE no_compression; +SHOW CREATE TABLE default_compression; +SHOW CREATE TABLE explicit_no_compression; +DROP TABLE no_compression; +DROP TABLE default_compression; +DROP TABLE explicit_no_compression; +SET SESSION innodb_compression_default = 0; + # reset system --disable_query_log EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig; diff --git a/mysql-test/suite/innodb/t/innodb-wl5522-debug-zip.test b/mysql-test/suite/innodb/t/innodb-wl5522-debug-zip.test index 982149f356c..1f15c81b90b 100644 --- a/mysql-test/suite/innodb/t/innodb-wl5522-debug-zip.test +++ b/mysql-test/suite/innodb/t/innodb-wl5522-debug-zip.test @@ -22,6 +22,7 @@ call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* becau call mtr.add_suppression("InnoDB: Error: Tablespace flags .* corrupted unused .*"); call mtr.add_suppression("InnoDB: Tablespace flags: .* corrupted in file: .* "); call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file .*"); +call mtr.add_suppression("InnoDB: Page for tablespace .* "); flush tables; let MYSQLD_DATADIR =`SELECT @@datadir`; @@ -758,4 +759,3 @@ call mtr.add_suppression("Could not find a valid tablespace file for 'test_wl552 eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table; eval SET GLOBAL INNODB_FILE_FORMAT=$innodb_file_format; eval SET SESSION innodb_strict_mode=$innodb_strict_mode_orig; - diff --git a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test index 05c4c04f2d3..e537f5c0fc3 100644 --- a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test +++ b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test @@ -24,6 +24,8 @@ call mtr.add_suppression("InnoDB: Ignoring tablespace .* because it could not be call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded."); call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .*"); call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file .*"); +call mtr.add_suppression("InnoDB: Page for tablespace .* "); +flush tables; let MYSQLD_DATADIR =`SELECT @@datadir`; let $innodb_file_per_table = `SELECT @@innodb_file_per_table`; @@ -1501,4 +1503,3 @@ call mtr.add_suppression("while reading index meta-data, expected to read 44 byt --remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table; - diff --git a/mysql-test/suite/innodb/t/innodb.test b/mysql-test/suite/innodb/t/innodb.test index e456d48b5c2..e5e4b45a861 100644 --- a/mysql-test/suite/innodb/t/innodb.test +++ b/mysql-test/suite/innodb/t/innodb.test @@ -1,18 +1,3 @@ -####################################################################### -# # -# Please, DO NOT TOUCH this file as well as the innodb.result file. # -# These files are to be modified ONLY BY INNOBASE guys. # -# # -# Use innodb_mysql.[test|result] files instead. # -# # -# If nevertheless you need to make some changes here, please, forward # -# your commit message # -# To: innodb_dev_ww@oracle.com # -# Cc: dev-innodb@mysql.com # -# (otherwise your changes may be erased). # -# # -####################################################################### - -- source include/have_innodb.inc -- source include/have_innodb_16k.inc @@ -1478,15 +1463,18 @@ select * from t1; drop table t1; # -# Test that update does not change internal auto-increment value +# Test that update does change internal auto-increment value # create table t1 (a int not null auto_increment primary key, val int) engine=InnoDB; insert into t1 (val) values (1); update t1 set a=2 where a=1; -# We should get the following error because InnoDB does not update the counter +# This should insert 3, since the counter has been updated to 2 already +insert into t1 (val) values (3); +select * from t1; +# We should get the following error because InnoDB does update the counter --error ER_DUP_ENTRY -insert into t1 (val) values (1); +insert into t1 values (2, 2); select * from t1; drop table t1; # @@ -1521,15 +1509,25 @@ CREATE TABLE t1 ( id INTEGER NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) ) ENGINE=InnoDB; +CREATE TABLE t2 ( +id INTEGER NOT NULL, +FOREIGN KEY (id) REFERENCES t1 (id) +) ENGINE=InnoDB; + INSERT INTO t1 (id) VALUES (NULL); SELECT * FROM t1; +--error ER_TRUNCATE_ILLEGAL_FK TRUNCATE t1; INSERT INTO t1 (id) VALUES (NULL); SELECT * FROM t1; -# continued from above; test that doing a slow TRUNCATE on a table with 0 -# rows resets autoincrement columns +# continued from above; test that doing a TRUNCATE resets AUTO_INCREMENT DELETE FROM t1; +--error ER_TRUNCATE_ILLEGAL_FK +TRUNCATE t1; +INSERT INTO t1 (id) VALUES (NULL); +SELECT * FROM t1; +DROP TABLE t2; TRUNCATE t1; INSERT INTO t1 (id) VALUES (NULL); SELECT * FROM t1; @@ -1541,7 +1539,7 @@ CREATE TABLE t1 id INT PRIMARY KEY ) ENGINE=InnoDB; ---error ER_CANNOT_ADD_FOREIGN,1005 +--error ER_CANT_CREATE_TABLE CREATE TEMPORARY TABLE t2 ( id INT NOT NULL PRIMARY KEY, @@ -1630,7 +1628,7 @@ CREATE TABLE t2 CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id) ) ENGINE=InnoDB; ---error 1452 +--error ER_NO_REFERENCED_ROW_2 INSERT INTO t2 VALUES(2); INSERT INTO t1 VALUES(1); @@ -1639,14 +1637,14 @@ INSERT INTO t2 VALUES(1); --error ER_ROW_IS_REFERENCED_2 DELETE FROM t1 WHERE id = 1; ---error ER_ROW_IS_REFERENCED_2, 1217 +--error ER_ROW_IS_REFERENCED_2 DROP TABLE t1; SET FOREIGN_KEY_CHECKS=0; DROP TABLE t1; SET FOREIGN_KEY_CHECKS=1; ---error 1452 +--error ER_NO_REFERENCED_ROW_2 INSERT INTO t2 VALUES(3); DROP TABLE t2; @@ -1702,7 +1700,7 @@ set foreign_key_checks=0; create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb; # Embedded server doesn't chdir to data directory --replace_result $MYSQLTEST_VARDIR . master-data/ '' --- error 1005 +--error ER_CANT_CREATE_TABLE create table t1(a char(10) primary key, b varchar(20)) engine = innodb; set foreign_key_checks=1; drop table t2; @@ -1714,7 +1712,7 @@ set foreign_key_checks=0; create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1; # Embedded server doesn't chdir to data directory --replace_result $MYSQLTEST_VARDIR . master-data/ '' --- error 1005 +--error ER_CANT_CREATE_TABLE create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8; set foreign_key_checks=1; drop table t1; @@ -1946,7 +1944,7 @@ SET sql_mode = default; #insert into t5(a) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12); # #delimiter |; -#create trigger t1t before insert on t1 for each row begin +#create trigger t1t before insert on t1 for each row begin # INSERT INTO t2 SET a = NEW.a; #end | # @@ -1954,7 +1952,7 @@ SET sql_mode = default; # DELETE FROM t3 WHERE a = NEW.a; #end | # -#create trigger t3t before delete on t3 for each row begin +#create trigger t3t before delete on t3 for each row begin # UPDATE t4 SET b = b + 1 WHERE a = OLD.a; #end | # @@ -2078,7 +2076,7 @@ create table t1(a int not null, b int, primary key(a)) engine=innodb; insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3); commit; SET binlog_format='MIXED'; -set autocommit = 0; +set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; update t1 set b = 5 where b = 1; connection b; @@ -2086,7 +2084,7 @@ SET binlog_format='MIXED'; set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; # -# X-lock to record (7,3) should be released in a update +# X-lock to record (7,3) should be released in a update # select * from t1 where a = 7 and b = 3 for update; connection a; @@ -2109,7 +2107,7 @@ connection a; create table t1(a int not null, b int, primary key(a)) engine=innodb; insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2); commit; -set autocommit = 0; +set autocommit = 0; select * from t1 lock in share mode; update t1 set b = 5 where b = 1; connection b; @@ -2117,12 +2115,12 @@ set autocommit = 0; # # S-lock to records (2,2),(4,2), and (6,2) should not be released in a update # ---error 1205 +--error ER_LOCK_WAIT_TIMEOUT select * from t1 where a = 2 and b = 2 for update; # # X-lock to record (1,1),(3,1),(5,1) should not be released in a update # ---error 1205 +--error ER_LOCK_WAIT_TIMEOUT connection a; commit; connection b; @@ -2166,7 +2164,7 @@ disconnect b; drop table t1, t2, t3; # -# Consistent read should not be used if +# Consistent read should not be used if # # (a) isolation level is serializable OR # (b) select ... lock in share mode OR @@ -2262,39 +2260,39 @@ SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update; connection b; ---error 1205 +--error ER_LOCK_WAIT_TIMEOUT reap; connection c; ---error 1205 +--error ER_LOCK_WAIT_TIMEOUT reap; connection d; ---error 1205 +--error ER_LOCK_WAIT_TIMEOUT reap; connection e; ---error 1205 +--error ER_LOCK_WAIT_TIMEOUT reap; connection f; ---error 1205 +--error ER_LOCK_WAIT_TIMEOUT reap; connection g; ---error 1205 +--error ER_LOCK_WAIT_TIMEOUT reap; connection h; ---error 1205 +--error ER_LOCK_WAIT_TIMEOUT reap; connection i; ---error 1205 +--error ER_LOCK_WAIT_TIMEOUT reap; connection j; ---error 1205 +--error ER_LOCK_WAIT_TIMEOUT reap; connection a; @@ -2331,8 +2329,8 @@ CREATE TABLE t2 ( b VARCHAR(128) NOT NULL, c TEXT NOT NULL, PRIMARY KEY (a,b), - KEY idx_t2_b_c (b,c(200)), - CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a) + KEY idx_t2_b_c (b,c(100)), + CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE CASCADE ) ENGINE=INNODB DEFAULT CHARSET=UTF8; @@ -2457,7 +2455,7 @@ INSERT INTO t1 VALUES(-10); SELECT * FROM t1; # # NOTE: The server really needs to be restarted at this point -# for the test to be useful. +# for the test to be useful. # # Without the fix InnoDB would trip over an assertion here. INSERT INTO t1 VALUES(NULL); diff --git a/mysql-test/suite/innodb/t/innodb_bug12400341.test b/mysql-test/suite/innodb/t/innodb_bug12400341.test index 9a96f29fc3b..2cacefc6595 100644 --- a/mysql-test/suite/innodb/t/innodb_bug12400341.test +++ b/mysql-test/suite/innodb/t/innodb_bug12400341.test @@ -59,7 +59,7 @@ while ($c) } --enable_query_log -select count(*) from information_schema.processlist; +select count(*) from information_schema.processlist where command != 'Daemon'; # # fill the all undo slots @@ -80,7 +80,7 @@ connection default; --error ER_CANT_CREATE_TABLE CREATE TABLE mysqltest.testtable (id int unsigned not null primary key) ENGINE=InnoDB; -select count(*) from information_schema.processlist; +select count(*) from information_schema.processlist where command != 'Daemon'; --disable_query_log let $c = 32; @@ -93,7 +93,7 @@ while ($c) --enable_query_log connection default; -select count(*) from information_schema.processlist; +select count(*) from information_schema.processlist where command != 'Daemon'; --disable_query_log let $c = 32; diff --git a/mysql-test/suite/innodb/t/innodb_bug54044.test b/mysql-test/suite/innodb/t/innodb_bug54044.test index aa19c51018c..61a09375ae1 100644 --- a/mysql-test/suite/innodb/t/innodb_bug54044.test +++ b/mysql-test/suite/innodb/t/innodb_bug54044.test @@ -10,7 +10,10 @@ CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB SHOW CREATE TABLE table_54044; DROP TABLE table_54044; -CREATE TABLE tmp ENGINE = INNODB AS SELECT COALESCE(NULL, NULL, NULL), GREATEST(NULL, NULL), NULL; +# This 'create table' should pass since it uses a Field_string of size 0. + +CREATE TABLE tmp ENGINE = INNODB + AS SELECT COALESCE(NULL, NULL, NULL), GREATEST(NULL, NULL), NULL; SHOW CREATE TABLE tmp; DROP TABLE tmp; @@ -23,4 +26,3 @@ FLUSH TABLES; --error 1005 CREATE TEMPORARY TABLE tmp ENGINE=InnoDB AS SELECT VALUES(a) FROM t1; DROP TABLE t1; - diff --git a/mysql-test/suite/innodb/t/innodb_defragment_fill_factor.test b/mysql-test/suite/innodb/t/innodb_defragment_fill_factor.test index a46ca124f51..2edc8a45c02 100644 --- a/mysql-test/suite/innodb/t/innodb_defragment_fill_factor.test +++ b/mysql-test/suite/innodb/t/innodb_defragment_fill_factor.test @@ -11,10 +11,10 @@ DROP TABLE if exists t2; --echo Testing tables with large records # Create table. -CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256), KEY SECOND(a, b)) ENGINE=INNODB; +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256), c VARCHAR(256), KEY SECOND(a, b,c)) ENGINE=INNODB; # Populate table. -INSERT INTO t1 VALUES (1, REPEAT('A', 256)); +INSERT INTO t1 VALUES (1, REPEAT('A', 256), REPEAT('B', 256)); INSERT INTO t1 (b) SELECT b from t1; INSERT INTO t1 (b) SELECT b from t1; INSERT INTO t1 (b) SELECT b from t1; @@ -36,28 +36,24 @@ while ($size) } --enable_query_log +--source include/wait_innodb_all_purged.inc --source include/restart_mysqld.inc optimize table t1; -select sleep(1); ---source include/restart_mysqld.inc select count(*) from t1; -# After deletion & defragmentation, there are 800 records left. Each page can hold about 57 records. We fill the page 90% full, -# so there should be less than 16 pages total. --let $primary_before = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY', Value, 1) select count(*) from t1 force index (second); -# secondary index is slightly bigger than primary index so the number of pages should be similar. --let $second_before = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second', Value, 1) --echo # A few more insertions on the page should not cause a page split. -insert into t1 values (81, REPEAT('A', 256)); -insert into t1 values (83, REPEAT('A', 256)); -insert into t1 values (87, REPEAT('A', 256)); -insert into t1 values (82, REPEAT('A', 256)); -insert into t1 values (86, REPEAT('A', 256)); +insert into t1 values (81, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (83, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (87, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (82, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (86, REPEAT('A', 256), REPEAT('B', 256)); --let $primary_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY', Value, 1) --let $second_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second', Value, 1) @@ -69,28 +65,52 @@ if ($second_before != $second_after) { --echo Insertion caused page split on second, which should be avoided by innodb_defragment_fill_factor. } ---echo # More insertions will cause page splits -insert into t1 values (88, REPEAT('A', 256)); -insert into t1 values (85, REPEAT('A', 256)); -insert into t1 values (84, REPEAT('A', 256)); +--echo # Insert more rows to cause a page split +insert into t1 values (180, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (181, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (182, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (183, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (184, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (185, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (186, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (187, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (188, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (189, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (190, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (191, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (192, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (193, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (194, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (195, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (196, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (197, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (198, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (199, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (200, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (201, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (202, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (203, REPEAT('A', 256), REPEAT('B', 256)); +insert into t1 values (204, REPEAT('A', 256), REPEAT('B', 256)); + --let $primary_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY', Value, 1) + --let $second_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second', Value, 1) if ($primary_before == $primary_after) { - --echo Too much space are reserved on primary index. + --echo Too little space is reserved on primary index. } if ($second_before == $second_after) { - --echo Too much space are reserved on second index. + --echo Too little space is reserved on second index. } DROP TABLE t1; --echo Testing table with small records -CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARchar(16), KEY SECOND(a,b)) ENGINE=INNODB; +CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(16), c VARCHAR(32), KEY SECOND(a,b,c)) ENGINE=INNODB; # Populate table. --disable_query_log -INSERT INTO t2 VALUES (1, REPEAT('A', 16)); +INSERT INTO t2 VALUES (1, REPEAT('A', 16), REPEAT('B', 32)); INSERT INTO t2 (b) SELECT b from t2; INSERT INTO t2 (b) SELECT b from t2; INSERT INTO t2 (b) SELECT b from t2; @@ -115,36 +135,36 @@ while ($size) } --enable_query_log +--source include/wait_innodb_all_purged.inc --source include/restart_mysqld.inc optimize table t2; -select sleep(1); ---source include/restart_mysqld.inc +select count(*) from t2; select count(*) from t2 force index(second); --let $second_before = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t2%' and index_name = 'second', Value, 1) --echo The page should have room for about 20 insertions -insert into t2 values(1181, REPEAT('A', 16)); -insert into t2 values(1191, REPEAT('A', 16)); -insert into t2 values(1182, REPEAT('A', 16)); -insert into t2 values(1192, REPEAT('A', 16)); -insert into t2 values(1183, REPEAT('A', 16)); -insert into t2 values(1193, REPEAT('A', 16)); -insert into t2 values(1184, REPEAT('A', 16)); -insert into t2 values(1194, REPEAT('A', 16)); -insert into t2 values(1185, REPEAT('A', 16)); -insert into t2 values(1195, REPEAT('A', 16)); -insert into t2 values(1186, REPEAT('A', 16)); -insert into t2 values(1196, REPEAT('A', 16)); -insert into t2 values(1187, REPEAT('A', 16)); -insert into t2 values(1197, REPEAT('A', 16)); -insert into t2 values(1188, REPEAT('A', 16)); -insert into t2 values(1198, REPEAT('A', 16)); -insert into t2 values(1189, REPEAT('A', 16)); -insert into t2 values(1199, REPEAT('A', 16)); -insert into t2 values(1190, REPEAT('A', 16)); -insert into t2 values(1180, REPEAT('A', 16)); +insert into t2 values(1181, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1191, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1182, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1192, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1183, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1193, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1184, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1194, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1185, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1195, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1186, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1196, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1187, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1197, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1188, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1198, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1189, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1199, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1190, REPEAT('A', 16), REPEAT('B',32)); +insert into t2 values(1180, REPEAT('A', 16), REPEAT('B',32)); --let $second_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t2%' and index_name = 'second', Value, 1) @@ -152,15 +172,39 @@ if ($second_before != $second_after) { --echo Insertion caused page split on second, which should be avoided by innodb_defragment_fill_factor. } ---echo More insertions will cause page split. -insert into t2 values(1280, REPEAT('A', 16)); -insert into t2 values(1290, REPEAT('A', 16)); -insert into t2 values(1281, REPEAT('A', 16)); -insert into t2 values(1291, REPEAT('A', 16)); +--echo # Insert more rows to cause a page split +insert into t2 values (180, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (181, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (182, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (183, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (184, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (185, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (186, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (187, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (188, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (189, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (190, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (191, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (192, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (193, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (194, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (195, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (196, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (197, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (198, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (199, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (200, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (201, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (202, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (203, REPEAT('A', 16), REPEAT('B', 32)); +insert into t2 values (204, REPEAT('A', 16), REPEAT('B', 32)); --let $second_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t2%' and index_name = 'second', Value, 1) + if ($second_before == $second_after) { - --echo Too much space are reserved on second index. + --echo Too little space is reserved on second index. } -DROP TABLE t2; \ No newline at end of file +DROP TABLE t2; + +--source include/wait_innodb_all_purged.inc diff --git a/mysql-test/suite/innodb/t/innodb_mysql.test b/mysql-test/suite/innodb/t/innodb_mysql.test index ee3975fd350..dc247a96468 100644 --- a/mysql-test/suite/innodb/t/innodb_mysql.test +++ b/mysql-test/suite/innodb/t/innodb_mysql.test @@ -13,10 +13,8 @@ -- source include/have_innodb.inc let $engine_type= InnoDB; let $other_engine_type= MEMORY; -# InnoDB does support FOREIGN KEYFOREIGN KEYs +# InnoDB does support FOREIGN KEYs let $test_foreign_keys= 1; -set global innodb_support_xa=default; -set session innodb_support_xa=default; --source include/mix1.inc --disable_warnings @@ -359,12 +357,16 @@ INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); INSERT INTO t3 VALUES (1, 101), (2, 102), (3, 103), (4, 104), (5, 105), (6, 106); INSERT INTO t4 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); -UPDATE t1, t2 SET t1.a = t1.a + 100, t2.b = t1.a + 10 +# Because t1.a changes and t2.b changes based on t1.a, the result +# depends on join order, so STRAIGHT_JOIN is used to have it repeatable. +UPDATE t2 straight_join t1 SET t1.a = t1.a + 100, t2.b = t1.a + 10 WHERE t1.a BETWEEN 2 AND 4 AND t2.a = t1.b; --sorted_result SELECT * FROM t2; -UPDATE t3, t4 SET t3.a = t3.a + 100, t4.b = t3.a + 10 +# Because t1.a changes and t2.b changes based on t1.a, the result +# depends on join order, so STRAIGHT_JOIN is used to have it repeatable. +UPDATE t4 straight_join t3 SET t3.a = t3.a + 100, t4.b = t3.a + 10 WHERE t3.a BETWEEN 2 AND 4 AND t4.a = t3.b - 100; --sorted_result SELECT * FROM t4; @@ -420,7 +422,7 @@ INSERT INTO t1 SELECT c1+1000,c2+1000,c3+1000 from t1; INSERT INTO t1 SELECT c1+10000,c2+10000,c3+10000 from t1; INSERT INTO t1 SELECT c1+100000,c2+100000,c3+100000 from t1; INSERT INTO t1 SELECT c1+1000000,c2+1000000,c3+1000000 from t1; - +ANALYZE TABLE t1; # query and no rows will match the c1 condition, whereas all will match c3 SELECT * FROM t1 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3; diff --git a/mysql-test/suite/innodb/t/innodb_stats_fetch_corrupted.test b/mysql-test/suite/innodb/t/innodb_stats_fetch_corrupted.test index 1603f3cd764..b6c1ced9985 100644 --- a/mysql-test/suite/innodb/t/innodb_stats_fetch_corrupted.test +++ b/mysql-test/suite/innodb/t/innodb_stats_fetch_corrupted.test @@ -7,6 +7,8 @@ # functionality tested here is not related to the page size, so we only # test with 16k page size. -- source include/have_innodb_16k.inc +# server restart +-- source include/not_embedded.inc call mtr.add_suppression("InnoDB: Table `mysql`.`innodb_index_stats` not found"); call mtr.add_suppression("InnoDB: Fetch of persistent statistics requested for table.*"); @@ -43,3 +45,6 @@ FROM information_schema.tables WHERE table_name = 'test_ps_fetch_corrupted'; ALTER TABLE mysql.innodb_index_stats_ RENAME TO mysql.innodb_index_stats; DROP TABLE test_ps_fetch_corrupted; + +# force server restart to clean up log from above error +--source include/restart_mysqld.inc diff --git a/mysql-test/suite/innodb/t/innodb_trx_weight.opt b/mysql-test/suite/innodb/t/innodb_trx_weight.opt new file mode 100644 index 00000000000..bac39c99a74 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_trx_weight.opt @@ -0,0 +1 @@ +--loose-innodb-lock-schedule-algorithm=FCFS diff --git a/mysql-test/suite/innodb/t/log_data_file_size.opt b/mysql-test/suite/innodb/t/log_data_file_size.opt new file mode 100644 index 00000000000..d9a364a3287 --- /dev/null +++ b/mysql-test/suite/innodb/t/log_data_file_size.opt @@ -0,0 +1,2 @@ +--loose-innodb-sys-indexes +--innodb-data-file-path=ibdata1:1M:autoextend diff --git a/mysql-test/suite/innodb/t/log_data_file_size.test b/mysql-test/suite/innodb/t/log_data_file_size.test new file mode 100644 index 00000000000..0f40474e09b --- /dev/null +++ b/mysql-test/suite/innodb/t/log_data_file_size.test @@ -0,0 +1,65 @@ +--source include/have_innodb.inc +--source include/not_embedded.inc + +let INNODB_PAGE_SIZE=`select @@innodb_page_size`; +let MYSQLD_DATADIR=`select @@datadir`; +let MYSQLD_IS_DEBUG=`select version() like '%debug%'`; +--source include/no_checkpoint_start.inc +SET GLOBAL innodb_file_per_table=0; +CREATE TABLE t(a INT)ENGINE=InnoDB; +let INNODB_ROOT_PAGE= `SELECT page_no FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE name='GEN_CLUST_INDEX'`; +SET GLOBAL innodb_file_per_table=1; + +CREATE TABLE ibd4(a INT UNIQUE)ENGINE=InnoDB; +CREATE TABLE ibd4f(a INT UNIQUE)ENGINE=InnoDB; +CREATE TABLE ibd5(a INT UNIQUE, b INT UNIQUE)ENGINE=InnoDB; + +let $drop_tables= DROP TABLE t,ibd4,ibd4f,ibd5; +--let CLEANUP_IF_CHECKPOINT= $drop_tables; +--source ../include/no_checkpoint_end.inc + +perl; +use Fcntl 'SEEK_CUR', 'SEEK_END'; + +my $page_size = $ENV{'INNODB_PAGE_SIZE'}; +my $restart = 'restart'; +if ($ENV{'MYSQLD_IS_DEBUG'}) +{ + # It is impractical to ensure that CREATE TABLE t will extend ibdata1. + # We rely on innodb_system_tablespace_extend_debug=1 + # to recover from this fault injection if no size change was redo-logged. + my $root = $ENV{'INNODB_ROOT_PAGE'}; + open(FILE, "+<", "$ENV{'MYSQLD_DATADIR'}ibdata1") or die; + my $size = sysseek(FILE, 0, SEEK_END) / $page_size; + seek(FILE, $page_size * ($root + 1), SEEK_SET) or die; + my $empty_tail= 1; + while() { unless (/\0*/gso) { $empty_tail= 0; last } } + if ($empty_tail) + { + $restart = 'restart: --innodb-data-file-size-debug=' . $size; + truncate(FILE, $page_size * $root); + } + close FILE; +} +open(FILE, ">$ENV{MYSQLTEST_VARDIR}/log/start_mysqld.txt") || die; +print FILE '--exec echo "', $restart, '" > $_expect_file_name +--enable_reconnect +--source include/wait_until_connected_again.inc +--disable_reconnect +'; +close FILE; +open(FILE, "+<", "$ENV{'MYSQLD_DATADIR'}test/ibd4.ibd") or die; +truncate(FILE, $page_size * 4); +close FILE; +open(FILE, "+<", "$ENV{'MYSQLD_DATADIR'}test/ibd4f.ibd") or die; +truncate(FILE, $page_size * 4 + 1234); +close FILE; +open(FILE, "+<", "$ENV{'MYSQLD_DATADIR'}test/ibd5.ibd") or die; +truncate(FILE, $page_size * 5); +close FILE; +EOF + +--source $MYSQLTEST_VARDIR/log/start_mysqld.txt +--remove_file $MYSQLTEST_VARDIR/log/start_mysqld.txt + +eval $drop_tables; diff --git a/mysql-test/suite/innodb/t/system_tables.test b/mysql-test/suite/innodb/t/system_tables.test new file mode 100644 index 00000000000..90cb8c59fbd --- /dev/null +++ b/mysql-test/suite/innodb/t/system_tables.test @@ -0,0 +1,12 @@ +--source include/have_innodb.inc + +# +# MDEV-10775 System table in InnoDB format allowed in MariaDB could lead to crash +# +alter table mysql.time_zone_name engine=InnoDB; +create table envois3 (starttime datetime) engine=InnoDB; +insert envois3 values ('2008-08-11 22:43:00'); +--source include/restart_mysqld.inc +select convert_tz(starttime,'UTC','Europe/Moscow') starttime from envois3; +drop table envois3; +alter table mysql.time_zone_name engine=MyISAM; diff --git a/mysql-test/suite/innodb/t/table_index_statistics.test b/mysql-test/suite/innodb/t/table_index_statistics.test new file mode 100644 index 00000000000..af6f1946486 --- /dev/null +++ b/mysql-test/suite/innodb/t/table_index_statistics.test @@ -0,0 +1,8 @@ +--source include/have_innodb.inc + +SET @default_storage_engine_old = @@session.default_storage_engine; +SET SESSION default_storage_engine = INNODB; + +--source extra/table_index_statistics.inc + +SET SESSION default_storage_engine = @default_storage_engine_old; diff --git a/mysql-test/suite/innodb/t/trigger.test b/mysql-test/suite/innodb/t/trigger.test new file mode 100644 index 00000000000..fe0bab21497 --- /dev/null +++ b/mysql-test/suite/innodb/t/trigger.test @@ -0,0 +1,47 @@ +--source include/have_innodb.inc +--source include/count_sessions.inc + +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +CREATE TABLE t2 (b INT) ENGINE=InnoDB; +CREATE TABLE t3 (c INT) ENGINE=InnoDB; + +--delimiter $$ +CREATE TRIGGER tr BEFORE INSERT ON t3 FOR EACH ROW BEGIN SAVEPOINT sv; INSERT INTO t2 VALUES (0); END $$ +--delimiter ; + +START TRANSACTION; +DELETE FROM t1; + +connect (con1,localhost,root,,test); +START TRANSACTION; +INSERT INTO t2 VALUES (2); +UPDATE t2 SET b = b+1; + +--send +INSERT INTO t1 VALUES (1); + +connection default; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = 'update' and info = 'INSERT INTO t1 VALUES (1)' +--source include/wait_condition.inc + +--error ER_LOCK_DEADLOCK +INSERT INTO t3 VALUES (2); +COMMIT; + +connection con1; +reap; +COMMIT; +disconnect con1; + +connection default; +SELECT * FROM t1; +SELECT * FROM t2; +SELECT * FROM t3; + +DROP TABLE t1, t2, t3; +--error ER_TRG_DOES_NOT_EXIST +DROP TRIGGER tr; + +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/xa_recovery.test b/mysql-test/suite/innodb/t/xa_recovery.test index 2c1034f3c4d..32373d63d14 100644 --- a/mysql-test/suite/innodb/t/xa_recovery.test +++ b/mysql-test/suite/innodb/t/xa_recovery.test @@ -12,6 +12,11 @@ if (`select plugin_auth_version <= "5.6.24" from information_schema.plugins wher FLUSH TABLES; --enable_query_log +# +# We kill server belown with timeout 0 that is not fully safe +# +call mtr.add_suppression("InnoDB: Warning: database page corruption or a failed"); + CREATE TABLE t1 (a INT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); connect (con1,localhost,root); diff --git a/mysql-test/suite/innodb_fts/r/create.result b/mysql-test/suite/innodb_fts/r/create.result new file mode 100644 index 00000000000..c537aa81efd --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/create.result @@ -0,0 +1,168 @@ +SET NAMES utf8mb4; +# +# MDEV-11233 CREATE FULLTEXT INDEX with a token +# longer than 127 bytes crashes server +# +CREATE TABLE t(t TEXT CHARACTER SET utf8mb3) ENGINE=InnoDB; +INSERT INTO t SET t=REPEAT(CONCAT(REPEAT(_utf8mb3 0xE0B987, 4), REPEAT(_utf8mb3 0xE0B989, 5)), 5); +INSERT INTO t SET t=REPEAT(_utf8 0xefbc90,84); +INSERT INTO t SET t=REPEAT('befor',17); +INSERT INTO t SET t='BeforeTheIndexCreation'; +CREATE FULLTEXT INDEX ft ON t(t); +Warnings: +Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID +INSERT INTO t SET t='this was inserted after creating the index'; +INSERT INTO t SET t=REPEAT(_utf8 0xefbc91,84); +INSERT INTO t SET t=REPEAT('after',17); +INSERT INTO t SET t=REPEAT(_utf8mb3 0xe794b2e9aaa8e69687, 15); +# The data below is not 3-byte UTF-8, but 4-byte chars. +INSERT INTO t SET t=REPEAT(_utf8mb4 0xf09f9695, 84); +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9F\x96\x95\xF0\x9F...' for column 't' at row 1 +INSERT INTO t SET t=REPEAT(_utf8mb4 0xf09f9696, 85); +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9F\x96\x96\xF0\x9F...' for column 't' at row 1 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST +(REPEAT(CONCAT(REPEAT(_utf8mb3 0xE0B987, 4), REPEAT(_utf8mb3 0xE0B989, 5)), 5)); +COUNT(*) +1 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('BeforeTheIndexCreation'); +COUNT(*) +1 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('befor',17)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('after'); +COUNT(*) +1 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('after',17)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 83)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 84)); +COUNT(*) +1 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 85)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 83)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 84)); +COUNT(*) +1 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 85)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 83)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 84)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 84)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 85)); +COUNT(*) +0 +SELECT * FROM t; +t +็็็็้้้้้็็็็้้้้้็็็็้้้้้็็็็้้้้้็็็็้้้้้ +ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ +beforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbefor +BeforeTheIndexCreation +this was inserted after creating the index +111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +afterafterafterafterafterafterafterafterafterafterafterafterafterafterafterafterafter +甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文 +???????????????????????????????????????????????????????????????????????????????????? +????????????????????????????????????????????????????????????????????????????????????? +SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word' GROUP BY len; +len COUNT(*) +252 6 +DROP TABLE t; +CREATE TABLE t(t TEXT CHARACTER SET utf8mb4) ENGINE=InnoDB; +INSERT INTO t SET t=REPEAT(_utf8mb3 0xe794b2e9aaa8e69687, 15); +INSERT INTO t SET t=REPEAT(_utf8 0xefbc90,84); +INSERT INTO t SET t=REPEAT('befor',17); +INSERT INTO t SET t='BeforeTheIndexCreation'; +CREATE FULLTEXT INDEX ft ON t(t); +Warnings: +Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID +INSERT INTO t SET t='this was inserted after creating the index'; +INSERT INTO t SET t=REPEAT(_utf8 0xefbc91,84); +INSERT INTO t SET t=REPEAT('after',17); +INSERT INTO t SET t=REPEAT(concat(repeat(_utf8mb3 0xE0B987, 4), repeat(_utf8mb3 0xE0B989, 5)), 5); +INSERT INTO t SET t=REPEAT(_utf8mb4 0xf09f9695, 84); +# The token below exceeds the 84-character limit. +INSERT INTO t SET t=REPEAT(_utf8mb4 0xf09f9696, 85); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb3 0xe794b2e9aaa8e69687, 15)); +COUNT(*) +1 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('BeforeTheIndexCreation'); +COUNT(*) +1 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('befor',17)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('after'); +COUNT(*) +1 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('after',17)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 83)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 84)); +COUNT(*) +1 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 85)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 83)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 84)); +COUNT(*) +1 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 85)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 83)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 84)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 84)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 85)); +COUNT(*) +0 +SELECT * FROM t; +t +甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文 +ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ +beforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbefor +BeforeTheIndexCreation +this was inserted after creating the index +111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +afterafterafterafterafterafterafterafterafterafterafterafterafterafterafterafterafter +็็็็้้้้้็็็็้้้้้็็็็้้้้้็็็็้้้้้็็็็้้้้้ +🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕 +🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖 +SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word' GROUP BY len; +len COUNT(*) +336 6 +DROP TABLE t; +CREATE TABLE t(t TEXT CHARACTER SET latin1, FULLTEXT INDEX(t)) +ENGINE=InnoDB; +SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word' GROUP BY len; +len COUNT(*) +84 6 +DROP TABLE t; diff --git a/mysql-test/suite/innodb_fts/r/fulltext_misc.result b/mysql-test/suite/innodb_fts/r/fulltext_misc.result index ce7fe46f4e1..6a24d9aea58 100644 --- a/mysql-test/suite/innodb_fts/r/fulltext_misc.result +++ b/mysql-test/suite/innodb_fts/r/fulltext_misc.result @@ -148,7 +148,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 UNION t1 ALL NULL NULL NULL NULL 2 100.00 NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Using filesort Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by (`a` + 12) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by `a` + 12 # Should not crash SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY a + 12; a @@ -181,7 +181,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Using filesort 3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'a' of SELECT #3 was resolved in SELECT #-1 -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by <`a`>((select `a` from `test`.`t2` where (`test`.`t2`.`b` = 12))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by <`a`>((select `a` from `test`.`t2` where `test`.`t2`.`b` = 12)) # Should not crash SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY (SELECT a FROM t2 WHERE b = 12); diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result b/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result index 44c74c42478..74ade61c940 100644 --- a/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result +++ b/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result @@ -1018,7 +1018,7 @@ CREATE TABLE `t21` (`a` text, `b` int not null, fulltext key (`a`), fulltext key (`a`) ) ENGINE=INNODB DEFAULT CHARSET=LATIN1; Warnings: -Note 1831 Duplicate index 'a_2' defined on the table 'test.t21'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a_2`. This is deprecated and will be disallowed in a future release ALTER TABLE `t21` ADD UNIQUE INDEX (`b`), ALGORITHM=INPLACE; ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY ALTER TABLE `t21` ADD UNIQUE INDEX (`b`); diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result b/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result index c7c86290f3c..f057db1d284 100644 --- a/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result +++ b/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result @@ -139,8 +139,8 @@ INSERT INTO articles (title, body) VALUES SELECT * FROM articles WHERE MATCH(title, body) AGAINST('Tricks'); id title body -4 1001 MySQL Tricks How to use full-text search engine -5 Go MySQL Tricks How to use full text search engine +9 1001 MySQL Tricks How to use full-text search engine +10 Go MySQL Tricks How to use full text search engine SELECT COUNT(*) FROM articles; COUNT(*) 5 diff --git a/mysql-test/suite/innodb_fts/t/create.opt b/mysql-test/suite/innodb_fts/t/create.opt new file mode 100644 index 00000000000..3ad568c816e --- /dev/null +++ b/mysql-test/suite/innodb_fts/t/create.opt @@ -0,0 +1 @@ +--loose-innodb-sys-columns diff --git a/mysql-test/suite/innodb_fts/t/create.test b/mysql-test/suite/innodb_fts/t/create.test new file mode 100644 index 00000000000..f0329602ed1 --- /dev/null +++ b/mysql-test/suite/innodb_fts/t/create.test @@ -0,0 +1,92 @@ +--source include/have_innodb.inc +SET NAMES utf8mb4; + +--echo # +--echo # MDEV-11233 CREATE FULLTEXT INDEX with a token +--echo # longer than 127 bytes crashes server +--echo # + +# This bug is the result of merging the Oracle MySQL follow-up fix +# BUG#22963169 MYSQL CRASHES ON CREATE FULLTEXT INDEX +# without merging a fix of Bug#79475 Insert a token of 84 4-bytes +# chars into fts index causes server crash. + +# Oracle did not publish tests for either of the above MySQL bugs. +# The tests below were developed for MariaDB Server. +# The maximum length of a fulltext-indexed word is 84 characters. + +CREATE TABLE t(t TEXT CHARACTER SET utf8mb3) ENGINE=InnoDB; +INSERT INTO t SET t=REPEAT(CONCAT(REPEAT(_utf8mb3 0xE0B987, 4), REPEAT(_utf8mb3 0xE0B989, 5)), 5); +INSERT INTO t SET t=REPEAT(_utf8 0xefbc90,84); +INSERT INTO t SET t=REPEAT('befor',17); # too long, will not be indexed +INSERT INTO t SET t='BeforeTheIndexCreation'; +CREATE FULLTEXT INDEX ft ON t(t); +INSERT INTO t SET t='this was inserted after creating the index'; +INSERT INTO t SET t=REPEAT(_utf8 0xefbc91,84); +INSERT INTO t SET t=REPEAT('after',17); # too long, will not be indexed +INSERT INTO t SET t=REPEAT(_utf8mb3 0xe794b2e9aaa8e69687, 15); +--echo # The data below is not 3-byte UTF-8, but 4-byte chars. +INSERT INTO t SET t=REPEAT(_utf8mb4 0xf09f9695, 84); +INSERT INTO t SET t=REPEAT(_utf8mb4 0xf09f9696, 85); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST +(REPEAT(CONCAT(REPEAT(_utf8mb3 0xE0B987, 4), REPEAT(_utf8mb3 0xE0B989, 5)), 5)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('BeforeTheIndexCreation'); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('befor',17)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('after'); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('after',17)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 83)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 84)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 85)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 83)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 84)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 85)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 83)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 84)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 84)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 85)); +SELECT * FROM t; + +# The column length should be 252 bytes (84 characters * 3 bytes/character). +SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word' GROUP BY len; +DROP TABLE t; + +CREATE TABLE t(t TEXT CHARACTER SET utf8mb4) ENGINE=InnoDB; +INSERT INTO t SET t=REPEAT(_utf8mb3 0xe794b2e9aaa8e69687, 15); +INSERT INTO t SET t=REPEAT(_utf8 0xefbc90,84); +INSERT INTO t SET t=REPEAT('befor',17); # too long, will not be indexed +INSERT INTO t SET t='BeforeTheIndexCreation'; +CREATE FULLTEXT INDEX ft ON t(t); +INSERT INTO t SET t='this was inserted after creating the index'; +INSERT INTO t SET t=REPEAT(_utf8 0xefbc91,84); +INSERT INTO t SET t=REPEAT('after',17); # too long, will not be indexed +INSERT INTO t SET t=REPEAT(concat(repeat(_utf8mb3 0xE0B987, 4), repeat(_utf8mb3 0xE0B989, 5)), 5); +INSERT INTO t SET t=REPEAT(_utf8mb4 0xf09f9695, 84); +--echo # The token below exceeds the 84-character limit. +INSERT INTO t SET t=REPEAT(_utf8mb4 0xf09f9696, 85); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb3 0xe794b2e9aaa8e69687, 15)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('BeforeTheIndexCreation'); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('befor',17)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('after'); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('after',17)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 83)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 84)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 85)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 83)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 84)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 85)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 83)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 84)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 84)); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 85)); +SELECT * FROM t; + +# The column length should be 336 bytes (84 characters * 4 bytes/character). +SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word' GROUP BY len; +DROP TABLE t; + +CREATE TABLE t(t TEXT CHARACTER SET latin1, FULLTEXT INDEX(t)) +ENGINE=InnoDB; + +# The column length should be 84 bytes (84 characters * 1 byte/character). +SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word' GROUP BY len; +DROP TABLE t; diff --git a/mysql-test/suite/innodb_gis/r/0.result b/mysql-test/suite/innodb_gis/r/0.result new file mode 100644 index 00000000000..9f155deef23 --- /dev/null +++ b/mysql-test/suite/innodb_gis/r/0.result @@ -0,0 +1,619 @@ +SET default_storage_engine=innodb; +DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; +CREATE TABLE gis_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POINT); +CREATE TABLE gis_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g LINESTRING); +CREATE TABLE gis_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POLYGON); +CREATE TABLE gis_multi_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOINT); +CREATE TABLE gis_multi_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTILINESTRING); +CREATE TABLE gis_multi_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOLYGON); +CREATE TABLE gis_geometrycollection (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRYCOLLECTION); +CREATE TABLE gis_geometry (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRY); +SHOW CREATE TABLE gis_point; +Table Create Table +gis_point CREATE TABLE `gis_point` ( + `fid` int(11) NOT NULL AUTO_INCREMENT, + `g` point DEFAULT NULL, + PRIMARY KEY (`fid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW FIELDS FROM gis_point; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g point YES NULL +SHOW FIELDS FROM gis_line; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g linestring YES NULL +SHOW FIELDS FROM gis_polygon; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g polygon YES NULL +SHOW FIELDS FROM gis_multi_point; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g multipoint YES NULL +SHOW FIELDS FROM gis_multi_line; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g multilinestring YES NULL +SHOW FIELDS FROM gis_multi_polygon; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g multipolygon YES NULL +SHOW FIELDS FROM gis_geometrycollection; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g geometrycollection YES NULL +SHOW FIELDS FROM gis_geometry; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g geometry YES NULL +INSERT INTO gis_point VALUES +(101, PointFromText('POINT(10 10)')), +(102, PointFromText('POINT(20 10)')), +(103, PointFromText('POINT(20 20)')), +(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)')))); +INSERT INTO gis_line VALUES +(105, LineFromText('LINESTRING(0 0,0 10,10 0)')), +(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), +(107, LineStringFromWKB(LineString(Point(10, 10), Point(40, 10)))); +INSERT INTO gis_polygon VALUES +(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')), +(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')), +(110, PolyFromWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))); +INSERT INTO gis_multi_point VALUES +(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), +(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), +(113, MPointFromWKB(MultiPoint(Point(3, 6), Point(4, 10)))); +INSERT INTO gis_multi_line VALUES +(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), +(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), +(116, MLineFromWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))); +INSERT INTO gis_multi_polygon VALUES +(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), +(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), +(119, MPolyFromWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))); +INSERT INTO gis_geometrycollection VALUES +(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), +(121, GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))))); +INSERT into gis_geometry SELECT * FROM gis_point; +INSERT into gis_geometry SELECT * FROM gis_line; +INSERT into gis_geometry SELECT * FROM gis_polygon; +INSERT into gis_geometry SELECT * FROM gis_multi_point; +INSERT into gis_geometry SELECT * FROM gis_multi_line; +INSERT into gis_geometry SELECT * FROM gis_multi_polygon; +INSERT into gis_geometry SELECT * FROM gis_geometrycollection; +SELECT fid, AsText(g) FROM gis_point ORDER by fid; +fid AsText(g) +101 POINT(10 10) +102 POINT(20 10) +103 POINT(20 20) +104 POINT(10 20) +SELECT fid, AsText(g) FROM gis_line ORDER by fid; +fid AsText(g) +105 LINESTRING(0 0,0 10,10 0) +106 LINESTRING(10 10,20 10,20 20,10 20,10 10) +107 LINESTRING(10 10,40 10) +SELECT fid, AsText(g) FROM gis_polygon ORDER by fid; +fid AsText(g) +108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) +110 POLYGON((0 0,30 0,30 30,0 0)) +SELECT fid, AsText(g) FROM gis_multi_point ORDER by fid; +fid AsText(g) +111 MULTIPOINT(0 0,10 10,10 20,20 20) +112 MULTIPOINT(1 1,11 11,11 21,21 21) +113 MULTIPOINT(3 6,4 10) +SELECT fid, AsText(g) FROM gis_multi_line ORDER by fid; +fid AsText(g) +114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) +115 MULTILINESTRING((10 48,10 21,10 0)) +116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) +SELECT fid, AsText(g) FROM gis_multi_polygon ORDER by fid; +fid AsText(g) +117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) +SELECT fid, AsText(g) FROM gis_geometrycollection ORDER by fid; +fid AsText(g) +120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) +121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) +SELECT fid, AsText(g) FROM gis_geometry ORDER by fid; +fid AsText(g) +101 POINT(10 10) +102 POINT(20 10) +103 POINT(20 20) +104 POINT(10 20) +105 LINESTRING(0 0,0 10,10 0) +106 LINESTRING(10 10,20 10,20 20,10 20,10 10) +107 LINESTRING(10 10,40 10) +108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) +110 POLYGON((0 0,30 0,30 30,0 0)) +111 MULTIPOINT(0 0,10 10,10 20,20 20) +112 MULTIPOINT(1 1,11 11,11 21,21 21) +113 MULTIPOINT(3 6,4 10) +114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) +115 MULTILINESTRING((10 48,10 21,10 0)) +116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) +117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) +120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) +121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) +SELECT fid, Dimension(g) FROM gis_geometry ORDER by fid; +fid Dimension(g) +101 0 +102 0 +103 0 +104 0 +105 1 +106 1 +107 1 +108 2 +109 2 +110 2 +111 0 +112 0 +113 0 +114 1 +115 1 +116 1 +117 2 +118 2 +119 2 +120 1 +121 1 +SELECT fid, GeometryType(g) FROM gis_geometry ORDER by fid; +fid GeometryType(g) +101 POINT +102 POINT +103 POINT +104 POINT +105 LINESTRING +106 LINESTRING +107 LINESTRING +108 POLYGON +109 POLYGON +110 POLYGON +111 MULTIPOINT +112 MULTIPOINT +113 MULTIPOINT +114 MULTILINESTRING +115 MULTILINESTRING +116 MULTILINESTRING +117 MULTIPOLYGON +118 MULTIPOLYGON +119 MULTIPOLYGON +120 GEOMETRYCOLLECTION +121 GEOMETRYCOLLECTION +SELECT fid, IsEmpty(g) FROM gis_geometry ORDER by fid; +fid IsEmpty(g) +101 0 +102 0 +103 0 +104 0 +105 0 +106 0 +107 0 +108 0 +109 0 +110 0 +111 0 +112 0 +113 0 +114 0 +115 0 +116 0 +117 0 +118 0 +119 0 +120 0 +121 0 +SELECT fid, AsText(Envelope(g)) FROM gis_geometry ORDER by fid; +fid AsText(Envelope(g)) +101 POLYGON((10 10,10 10,10 10,10 10,10 10)) +102 POLYGON((20 10,20 10,20 10,20 10,20 10)) +103 POLYGON((20 20,20 20,20 20,20 20,20 20)) +104 POLYGON((10 20,10 20,10 20,10 20,10 20)) +105 POLYGON((0 0,10 0,10 10,0 10,0 0)) +106 POLYGON((10 10,20 10,20 20,10 20,10 10)) +107 POLYGON((10 10,40 10,40 10,10 10,10 10)) +108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +109 POLYGON((0 0,50 0,50 50,0 50,0 0)) +110 POLYGON((0 0,30 0,30 30,0 30,0 0)) +111 POLYGON((0 0,20 0,20 20,0 20,0 0)) +112 POLYGON((1 1,21 1,21 21,1 21,1 1)) +113 POLYGON((3 6,4 6,4 10,3 10,3 6)) +114 POLYGON((10 0,16 0,16 48,10 48,10 0)) +115 POLYGON((10 0,10 0,10 48,10 48,10 0)) +116 POLYGON((1 2,21 2,21 8,1 8,1 2)) +117 POLYGON((28 0,84 0,84 42,28 42,28 0)) +118 POLYGON((28 0,84 0,84 42,28 42,28 0)) +119 POLYGON((0 0,3 0,3 3,0 3,0 0)) +120 POLYGON((0 0,10 0,10 10,0 10,0 0)) +121 POLYGON((3 6,44 6,44 9,3 9,3 6)) +explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21 100.00 +Warnings: +Note 1003 select st_dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,st_geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,st_isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,st_astext(st_envelope(`test`.`gis_geometry`.`g`)) AS `AsText(Envelope(g))` from `test`.`gis_geometry` +SELECT fid, X(g) FROM gis_point ORDER by fid; +fid X(g) +101 10 +102 20 +103 20 +104 10 +SELECT fid, Y(g) FROM gis_point ORDER by fid; +fid Y(g) +101 10 +102 10 +103 20 +104 20 +explain extended select X(g),Y(g) FROM gis_point; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 100.00 +Warnings: +Note 1003 select st_x(`test`.`gis_point`.`g`) AS `X(g)`,st_y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point` +SELECT fid, AsText(StartPoint(g)) FROM gis_line ORDER by fid; +fid AsText(StartPoint(g)) +105 POINT(0 0) +106 POINT(10 10) +107 POINT(10 10) +SELECT fid, AsText(EndPoint(g)) FROM gis_line ORDER by fid; +fid AsText(EndPoint(g)) +105 POINT(10 0) +106 POINT(10 10) +107 POINT(40 10) +SELECT fid, GLength(g) FROM gis_line ORDER by fid; +fid GLength(g) +105 24.14213562373095 +106 40 +107 30 +SELECT fid, NumPoints(g) FROM gis_line ORDER by fid; +fid NumPoints(g) +105 3 +106 5 +107 2 +SELECT fid, AsText(PointN(g, 2)) FROM gis_line ORDER by fid; +fid AsText(PointN(g, 2)) +105 POINT(0 10) +106 POINT(20 10) +107 POINT(40 10) +SELECT fid, IsClosed(g) FROM gis_line ORDER by fid; +fid IsClosed(g) +105 0 +106 1 +107 0 +explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 select st_astext(st_startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,st_astext(st_endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,st_length(`test`.`gis_line`.`g`) AS `GLength(g)`,st_numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,st_astext(st_pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,st_isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line` +SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid; +fid AsText(Centroid(g)) +108 POINT(15 15) +109 POINT(25.416666666666668 25.416666666666668) +110 POINT(20 10) +SELECT fid, Area(g) FROM gis_polygon ORDER by fid; +fid Area(g) +108 100 +109 2400 +110 450 +SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon ORDER by fid; +fid AsText(ExteriorRing(g)) +108 LINESTRING(10 10,20 10,20 20,10 20,10 10) +109 LINESTRING(0 0,50 0,50 50,0 50,0 0) +110 LINESTRING(0 0,30 0,30 30,0 0) +SELECT fid, NumInteriorRings(g) FROM gis_polygon ORDER by fid; +fid NumInteriorRings(g) +108 0 +109 1 +110 0 +SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon ORDER by fid; +fid AsText(InteriorRingN(g, 1)) +108 NULL +109 LINESTRING(10 10,20 10,20 20,10 20,10 10) +110 NULL +explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM gis_polygon; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 select st_astext(st_centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,st_area(`test`.`gis_polygon`.`g`) AS `Area(g)`,st_astext(st_exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,st_numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,st_astext(st_interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon` +SELECT fid, IsClosed(g) FROM gis_multi_line ORDER by fid; +fid IsClosed(g) +114 0 +115 0 +116 0 +SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon ORDER by fid; +fid AsText(Centroid(g)) +117 POINT(55.58852775304245 17.426536064113982) +118 POINT(55.58852775304245 17.426536064113982) +119 POINT(2 2) +SELECT fid, Area(g) FROM gis_multi_polygon ORDER by fid; +fid Area(g) +117 1684.5 +118 1684.5 +119 4.5 +SELECT fid, NumGeometries(g) from gis_multi_point ORDER by fid; +fid NumGeometries(g) +111 4 +112 4 +113 2 +SELECT fid, NumGeometries(g) from gis_multi_line ORDER by fid; +fid NumGeometries(g) +114 2 +115 1 +116 2 +SELECT fid, NumGeometries(g) from gis_multi_polygon ORDER by fid; +fid NumGeometries(g) +117 2 +118 2 +119 1 +SELECT fid, NumGeometries(g) from gis_geometrycollection ORDER by fid; +fid NumGeometries(g) +120 2 +121 2 +explain extended SELECT fid, NumGeometries(g) from gis_multi_point; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point` +SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point ORDER by fid; +fid AsText(GeometryN(g, 2)) +111 POINT(10 10) +112 POINT(11 11) +113 POINT(4 10) +SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line ORDER by fid; +fid AsText(GeometryN(g, 2)) +114 LINESTRING(16 0,16 23,16 48) +115 NULL +116 LINESTRING(2 5,5 8,21 7) +SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon ORDER by fid; +fid AsText(GeometryN(g, 2)) +117 POLYGON((59 18,67 18,67 13,59 13,59 18)) +118 POLYGON((59 18,67 18,67 13,59 13,59 18)) +119 NULL +SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection ORDER by fid; +fid AsText(GeometryN(g, 2)) +120 LINESTRING(0 0,10 10) +121 LINESTRING(3 6,7 9) +SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection ORDER by fid; +fid AsText(GeometryN(g, 1)) +120 POINT(0 0) +121 POINT(44 6) +explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_astext(st_geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point` +SELECT g1.fid as first, g2.fid as second, +Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o, +Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t, +Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r +FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; +first second w c o e d t i r +120 120 1 1 0 1 0 0 1 0 +120 121 0 0 1 0 0 0 1 0 +121 120 0 0 1 0 0 0 1 0 +121 121 1 1 0 1 0 0 1 0 +explain extended SELECT g1.fid as first, g2.fid as second, +Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o, +Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t, +Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r +FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE g1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +1 SIMPLE g2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +Warnings: +Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,st_within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,st_contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,mbroverlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,st_equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,mbrdisjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,st_touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,mbrintersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,st_crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid` +DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; +CREATE TABLE t1 ( +a INTEGER PRIMARY KEY AUTO_INCREMENT, +gp point, +ln linestring, +pg polygon, +mp multipoint, +mln multilinestring, +mpg multipolygon, +gc geometrycollection, +gm geometry +); +SHOW FIELDS FROM t1; +Field Type Null Key Default Extra +a int(11) NO PRI NULL auto_increment +gp point YES NULL +ln linestring YES NULL +pg polygon YES NULL +mp multipoint YES NULL +mln multilinestring YES NULL +mpg multipolygon YES NULL +gc geometrycollection YES NULL +gm geometry YES NULL +ALTER TABLE t1 ADD fid INT; +SHOW FIELDS FROM t1; +Field Type Null Key Default Extra +a int(11) NO PRI NULL auto_increment +gp point YES NULL +ln linestring YES NULL +pg polygon YES NULL +mp multipoint YES NULL +mln multilinestring YES NULL +mpg multipolygon YES NULL +gc geometrycollection YES NULL +gm geometry YES NULL +fid int(11) YES NULL +DROP TABLE t1; +create table t1 (pk integer primary key auto_increment, a geometry not null); +insert into t1 (a) values (GeomFromText('Point(1 2)')); +insert into t1 (a) values ('Garbage'); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +insert IGNORE into t1 (a) values ('Garbage'); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +drop table t1; +create table t1 (pk integer primary key auto_increment, fl geometry not null); +insert into t1 (fl) values (1); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +insert into t1 (fl) values (1.11); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +insert into t1 (fl) values ("qwerty"); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +insert into t1 (fl) values (pointfromtext('point(1,1)')); +ERROR 23000: Column 'fl' cannot be null +drop table t1; +End of 4.1 tests +CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY); +INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))')); +INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))')); +INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))')); +INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))')); +INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))')); +INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))')); +INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))')); +INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))')); +INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))')); +INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))')); +INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))')); +INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))')); +INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))')); +INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))')); +INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))')); +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrcontains +center,small +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrdisjoint +down3,left3,right3,up3 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrequal +center +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrintersect +big,center,down,down2,left,left2,right,right2,small,up,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbroverlaps +down,left,right,up +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrtouches +down2,left2,right2,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrwithin +big,center +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +contains +center,small +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +disjoint +down3,left3,right3,up3 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +equals +center +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +intersect +big,center,down,down2,left,left2,right,right2,small,up,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +overlaps +down,left,right,up +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +touches +down2,left2,right2,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +within +big,center +SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))'); +SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))'); +SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))'); +SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))'); +SET @point1 = GeomFromText('POLYGON ((0 0))'); +SET @point2 = GeomFromText('POLYGON ((-2 0))'); +SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name; +overlaps +SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name; +overlaps +SELECT Overlaps(@horiz1, @vert1) FROM DUAL; +Overlaps(@horiz1, @vert1) +0 +SELECT Overlaps(@horiz1, @horiz2) FROM DUAL; +Overlaps(@horiz1, @horiz2) +1 +SELECT Overlaps(@horiz1, @horiz3) FROM DUAL; +Overlaps(@horiz1, @horiz3) +0 +SELECT Overlaps(@horiz1, @point1) FROM DUAL; +Overlaps(@horiz1, @point1) +0 +SELECT Overlaps(@horiz1, @point2) FROM DUAL; +Overlaps(@horiz1, @point2) +0 +DROP TABLE t1; +End of 5.0 tests +CREATE TABLE t1 (p POINT); +CREATE TABLE t2 (p POINT, INDEX(p)); +INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)')); +INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)')); +SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +1 +EXPLAIN +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref p p 28 const 1 Using where +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +1 +INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)')); +INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)')); +EXPLAIN +SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +2 +EXPLAIN +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref p p 28 const # Using where +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +2 +EXPLAIN +SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +2 +DROP TABLE t1, t2; +End of 5.0 tests +# +# Test for bug #58650 "Failing assertion: primary_key_no == -1 || +# primary_key_no == 0". +# +drop table if exists t1; +# The minimal test case. +create table t1 (a int not null, b linestring not null, unique key b (b(12)), unique key a (a)); +drop table t1; +# The original test case. +create table t1 (a int not null, b linestring not null, unique key b (b(12))); +create unique index a on t1(a); +drop table t1; +create table t1 (g geometry not null, spatial gk(g)) engine=innodb; +DROP TABLE t1; +create table t1 (c1 int, c2 geometry not null, spatial index (c2))engine=innodb; +connect a,localhost,root,,; +connection a; +start transaction; +insert into t1 values(1, Point(1,1)); +connect con1,localhost,root,,; +connection con1; +set @g1 = ST_GeomFromText('Polygon((0 0,0 100,100 100,100 0,0 0))'); +set transaction isolation level read uncommitted; +select count(*) from t1 where ST_Within(t1.c2, @g1); +count(*) +0 +disconnect con1; +connection a; +commit; +disconnect a; +connection default; +drop table t1; diff --git a/mysql-test/suite/innodb_gis/r/1.result b/mysql-test/suite/innodb_gis/r/1.result new file mode 100644 index 00000000000..94bd5f3b2e8 --- /dev/null +++ b/mysql-test/suite/innodb_gis/r/1.result @@ -0,0 +1,1499 @@ +SET default_storage_engine=InnoDB; +SET innodb_strict_mode=OFF; +CREATE TABLE gis_point (fid INTEGER NOT NULL PRIMARY KEY, g POINT); +CREATE TABLE gis_line (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING); +CREATE TABLE gis_polygon (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON); +CREATE TABLE gis_multi_point (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOINT); +CREATE TABLE gis_multi_line (fid INTEGER NOT NULL PRIMARY KEY, g MULTILINESTRING); +CREATE TABLE gis_multi_polygon (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOLYGON); +CREATE TABLE gis_geometrycollection (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRYCOLLECTION); +CREATE TABLE gis_geometry (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY); +SHOW FIELDS FROM gis_point; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL +g point YES NULL +SHOW FIELDS FROM gis_line; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL +g linestring YES NULL +SHOW FIELDS FROM gis_polygon; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL +g polygon YES NULL +SHOW FIELDS FROM gis_multi_point; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL +g multipoint YES NULL +SHOW FIELDS FROM gis_multi_line; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL +g multilinestring YES NULL +SHOW FIELDS FROM gis_multi_polygon; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL +g multipolygon YES NULL +SHOW FIELDS FROM gis_geometrycollection; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL +g geometrycollection YES NULL +SHOW FIELDS FROM gis_geometry; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL +g geometry YES NULL +INSERT INTO gis_point VALUES +(101, ST_PointFromText('POINT(10 10)')), +(102, ST_PointFromText('POINT(20 10)')), +(103, ST_PointFromText('POINT(20 20)')), +(104, ST_PointFromWKB(ST_AsWKB(ST_PointFromText('POINT(10 20)')))); +INSERT INTO gis_line VALUES +(105, ST_LineFromText('LINESTRING(0 0,0 10,10 0)')), +(106, ST_LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), +(107, ST_LineStringFromWKB(ST_AsWKB(LineString(Point(10, 10), Point(40, 10))))); +INSERT INTO gis_polygon VALUES +(108, ST_PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')), +(109, ST_PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')), +(110, ST_PolyFromWKB(ST_AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))))); +INSERT INTO gis_multi_point VALUES +(111, ST_MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), +(112, ST_MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), +(113, ST_MPointFromWKB(ST_AsWKB(MultiPoint(Point(3, 6), Point(4, 10))))); +INSERT INTO gis_multi_line VALUES +(114, ST_MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), +(115, ST_MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), +(116, ST_MLineFromWKB(ST_AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))))); +INSERT INTO gis_multi_polygon VALUES +(117, ST_MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), +(118, ST_MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), +(119, ST_MPolyFromWKB(ST_AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))))); +INSERT INTO gis_geometrycollection VALUES +(120, ST_GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), +(121, ST_GeometryFromWKB(ST_AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))); +INSERT into gis_geometry SELECT * FROM gis_point; +INSERT into gis_geometry SELECT * FROM gis_line; +INSERT into gis_geometry SELECT * FROM gis_polygon; +INSERT into gis_geometry SELECT * FROM gis_multi_point; +INSERT into gis_geometry SELECT * FROM gis_multi_line; +INSERT into gis_geometry SELECT * FROM gis_multi_polygon; +INSERT into gis_geometry SELECT * FROM gis_geometrycollection; +SELECT fid, ST_AsText(g) FROM gis_point; +fid ST_AsText(g) +101 POINT(10 10) +102 POINT(20 10) +103 POINT(20 20) +104 POINT(10 20) +SELECT fid, ST_AsText(g) FROM gis_line; +fid ST_AsText(g) +105 LINESTRING(0 0,0 10,10 0) +106 LINESTRING(10 10,20 10,20 20,10 20,10 10) +107 LINESTRING(10 10,40 10) +SELECT fid, ST_AsText(g) FROM gis_polygon; +fid ST_AsText(g) +108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) +110 POLYGON((0 0,30 0,30 30,0 0)) +SELECT fid, ST_AsText(g) FROM gis_multi_point; +fid ST_AsText(g) +111 MULTIPOINT(0 0,10 10,10 20,20 20) +112 MULTIPOINT(1 1,11 11,11 21,21 21) +113 MULTIPOINT(3 6,4 10) +SELECT fid, ST_AsText(g) FROM gis_multi_line; +fid ST_AsText(g) +114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) +115 MULTILINESTRING((10 48,10 21,10 0)) +116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) +SELECT fid, ST_AsText(g) FROM gis_multi_polygon; +fid ST_AsText(g) +117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) +SELECT fid, ST_AsText(g) FROM gis_geometrycollection; +fid ST_AsText(g) +120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) +121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) +SELECT fid, ST_AsText(g) FROM gis_geometry; +fid ST_AsText(g) +101 POINT(10 10) +102 POINT(20 10) +103 POINT(20 20) +104 POINT(10 20) +105 LINESTRING(0 0,0 10,10 0) +106 LINESTRING(10 10,20 10,20 20,10 20,10 10) +107 LINESTRING(10 10,40 10) +108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) +110 POLYGON((0 0,30 0,30 30,0 0)) +111 MULTIPOINT(0 0,10 10,10 20,20 20) +112 MULTIPOINT(1 1,11 11,11 21,21 21) +113 MULTIPOINT(3 6,4 10) +114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) +115 MULTILINESTRING((10 48,10 21,10 0)) +116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) +117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) +120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) +121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) +SELECT fid, ST_Dimension(g) FROM gis_geometry; +fid ST_Dimension(g) +101 0 +102 0 +103 0 +104 0 +105 1 +106 1 +107 1 +108 2 +109 2 +110 2 +111 0 +112 0 +113 0 +114 1 +115 1 +116 1 +117 2 +118 2 +119 2 +120 1 +121 1 +SELECT fid, ST_GeometryType(g) FROM gis_geometry; +fid ST_GeometryType(g) +101 POINT +102 POINT +103 POINT +104 POINT +105 LINESTRING +106 LINESTRING +107 LINESTRING +108 POLYGON +109 POLYGON +110 POLYGON +111 MULTIPOINT +112 MULTIPOINT +113 MULTIPOINT +114 MULTILINESTRING +115 MULTILINESTRING +116 MULTILINESTRING +117 MULTIPOLYGON +118 MULTIPOLYGON +119 MULTIPOLYGON +120 GEOMETRYCOLLECTION +121 GEOMETRYCOLLECTION +SELECT fid, ST_IsEmpty(g) FROM gis_geometry; +fid ST_IsEmpty(g) +101 0 +102 0 +103 0 +104 0 +105 0 +106 0 +107 0 +108 0 +109 0 +110 0 +111 0 +112 0 +113 0 +114 0 +115 0 +116 0 +117 0 +118 0 +119 0 +120 0 +121 0 +SELECT fid, ST_AsText(ST_Envelope(g)) FROM gis_geometry; +fid ST_AsText(ST_Envelope(g)) +101 POLYGON((10 10,10 10,10 10,10 10,10 10)) +102 POLYGON((20 10,20 10,20 10,20 10,20 10)) +103 POLYGON((20 20,20 20,20 20,20 20,20 20)) +104 POLYGON((10 20,10 20,10 20,10 20,10 20)) +105 POLYGON((0 0,10 0,10 10,0 10,0 0)) +106 POLYGON((10 10,20 10,20 20,10 20,10 10)) +107 POLYGON((10 10,40 10,40 10,10 10,10 10)) +108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +109 POLYGON((0 0,50 0,50 50,0 50,0 0)) +110 POLYGON((0 0,30 0,30 30,0 30,0 0)) +111 POLYGON((0 0,20 0,20 20,0 20,0 0)) +112 POLYGON((1 1,21 1,21 21,1 21,1 1)) +113 POLYGON((3 6,4 6,4 10,3 10,3 6)) +114 POLYGON((10 0,16 0,16 48,10 48,10 0)) +115 POLYGON((10 0,10 0,10 48,10 48,10 0)) +116 POLYGON((1 2,21 2,21 8,1 8,1 2)) +117 POLYGON((28 0,84 0,84 42,28 42,28 0)) +118 POLYGON((28 0,84 0,84 42,28 42,28 0)) +119 POLYGON((0 0,3 0,3 3,0 3,0 0)) +120 POLYGON((0 0,10 0,10 10,0 10,0 0)) +121 POLYGON((3 6,44 6,44 9,3 9,3 6)) +explain extended select ST_Dimension(g), ST_GeometryType(g), ST_IsEmpty(g), ST_AsText(ST_Envelope(g)) from gis_geometry; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21 # +Warnings: +Note 1003 select st_dimension(`test`.`gis_geometry`.`g`) AS `ST_Dimension(g)`,st_geometrytype(`test`.`gis_geometry`.`g`) AS `ST_GeometryType(g)`,st_isempty(`test`.`gis_geometry`.`g`) AS `ST_IsEmpty(g)`,st_astext(st_envelope(`test`.`gis_geometry`.`g`)) AS `ST_AsText(ST_Envelope(g))` from `test`.`gis_geometry` +SELECT fid, ST_X(g) FROM gis_point; +fid ST_X(g) +101 10 +102 20 +103 20 +104 10 +SELECT fid, ST_Y(g) FROM gis_point; +fid ST_Y(g) +101 10 +102 10 +103 20 +104 20 +explain extended select ST_X(g),ST_Y(g) FROM gis_point; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 # +Warnings: +Note 1003 select st_x(`test`.`gis_point`.`g`) AS `ST_X(g)`,st_y(`test`.`gis_point`.`g`) AS `ST_Y(g)` from `test`.`gis_point` +SELECT fid, ST_AsText(ST_StartPoint(g)) FROM gis_line; +fid ST_AsText(ST_StartPoint(g)) +105 POINT(0 0) +106 POINT(10 10) +107 POINT(10 10) +SELECT fid, ST_AsText(ST_EndPoint(g)) FROM gis_line; +fid ST_AsText(ST_EndPoint(g)) +105 POINT(10 0) +106 POINT(10 10) +107 POINT(40 10) +SELECT fid, ST_Length(g) FROM gis_line; +fid ST_Length(g) +105 24.14213562373095 +106 40 +107 30 +SELECT fid, ST_NumPoints(g) FROM gis_line; +fid ST_NumPoints(g) +105 3 +106 5 +107 2 +SELECT fid, ST_AsText(ST_PointN(g, 2)) FROM gis_line; +fid ST_AsText(ST_PointN(g, 2)) +105 POINT(0 10) +106 POINT(20 10) +107 POINT(40 10) +SELECT fid, ST_IsClosed(g) FROM gis_line; +fid ST_IsClosed(g) +105 0 +106 1 +107 0 +explain extended select ST_AsText(ST_StartPoint(g)),ST_AsText(ST_EndPoint(g)),ST_Length(g),ST_NumPoints(g),ST_AsText(ST_PointN(g, 2)),ST_IsClosed(g) FROM gis_line; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 # +Warnings: +Note 1003 select st_astext(st_startpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_StartPoint(g))`,st_astext(st_endpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_EndPoint(g))`,st_length(`test`.`gis_line`.`g`) AS `ST_Length(g)`,st_numpoints(`test`.`gis_line`.`g`) AS `ST_NumPoints(g)`,st_astext(st_pointn(`test`.`gis_line`.`g`,2)) AS `ST_AsText(ST_PointN(g, 2))`,st_isclosed(`test`.`gis_line`.`g`) AS `ST_IsClosed(g)` from `test`.`gis_line` +SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_polygon; +fid ST_AsText(ST_Centroid(g)) +108 POINT(15 15) +109 POINT(25.416666666666668 25.416666666666668) +110 POINT(20 10) +SELECT fid, ST_Area(g) FROM gis_polygon; +fid ST_Area(g) +108 100 +109 2400 +110 450 +SELECT fid, ST_AsText(ST_ExteriorRing(g)) FROM gis_polygon; +fid ST_AsText(ST_ExteriorRing(g)) +108 LINESTRING(10 10,20 10,20 20,10 20,10 10) +109 LINESTRING(0 0,50 0,50 50,0 50,0 0) +110 LINESTRING(0 0,30 0,30 30,0 0) +SELECT fid, ST_NumInteriorRings(g) FROM gis_polygon; +fid ST_NumInteriorRings(g) +108 0 +109 1 +110 0 +SELECT fid, ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon; +fid ST_AsText(ST_InteriorRingN(g, 1)) +108 NULL +109 LINESTRING(10 10,20 10,20 20,10 20,10 10) +110 NULL +explain extended select ST_AsText(ST_Centroid(g)),ST_Area(g),ST_AsText(ST_ExteriorRing(g)),ST_NumInteriorRings(g),ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 # +Warnings: +Note 1003 select st_astext(st_centroid(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_Centroid(g))`,st_area(`test`.`gis_polygon`.`g`) AS `ST_Area(g)`,st_astext(st_exteriorring(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_ExteriorRing(g))`,st_numinteriorrings(`test`.`gis_polygon`.`g`) AS `ST_NumInteriorRings(g)`,st_astext(st_interiorringn(`test`.`gis_polygon`.`g`,1)) AS `ST_AsText(ST_InteriorRingN(g, 1))` from `test`.`gis_polygon` +SELECT fid, ST_IsClosed(g) FROM gis_multi_line; +fid ST_IsClosed(g) +114 0 +115 0 +116 0 +SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_multi_polygon; +fid ST_AsText(ST_Centroid(g)) +117 POINT(55.58852775304245 17.426536064113982) +118 POINT(55.58852775304245 17.426536064113982) +119 POINT(2 2) +SELECT fid, ST_Area(g) FROM gis_multi_polygon; +fid ST_Area(g) +117 1684.5 +118 1684.5 +119 4.5 +SELECT fid, ST_NumGeometries(g) from gis_multi_point; +fid ST_NumGeometries(g) +111 4 +112 4 +113 2 +SELECT fid, ST_NumGeometries(g) from gis_multi_line; +fid ST_NumGeometries(g) +114 2 +115 1 +116 2 +SELECT fid, ST_NumGeometries(g) from gis_multi_polygon; +fid ST_NumGeometries(g) +117 2 +118 2 +119 1 +SELECT fid, ST_NumGeometries(g) from gis_geometrycollection; +fid ST_NumGeometries(g) +120 2 +121 2 +explain extended SELECT fid, ST_NumGeometries(g) from gis_multi_point; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 # +Warnings: +Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_numgeometries(`test`.`gis_multi_point`.`g`) AS `ST_NumGeometries(g)` from `test`.`gis_multi_point` +SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point; +fid ST_AsText(ST_GeometryN(g, 2)) +111 POINT(10 10) +112 POINT(11 11) +113 POINT(4 10) +SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_line; +fid ST_AsText(ST_GeometryN(g, 2)) +114 LINESTRING(16 0,16 23,16 48) +115 NULL +116 LINESTRING(2 5,5 8,21 7) +SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_polygon; +fid ST_AsText(ST_GeometryN(g, 2)) +117 POLYGON((59 18,67 18,67 13,59 13,59 18)) +118 POLYGON((59 18,67 18,67 13,59 13,59 18)) +119 NULL +SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_geometrycollection; +fid ST_AsText(ST_GeometryN(g, 2)) +120 LINESTRING(0 0,10 10) +121 LINESTRING(3 6,7 9) +SELECT fid, ST_AsText(ST_GeometryN(g, 1)) from gis_geometrycollection; +fid ST_AsText(ST_GeometryN(g, 1)) +120 POINT(0 0) +121 POINT(44 6) +explain extended SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 # +Warnings: +Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_astext(st_geometryn(`test`.`gis_multi_point`.`g`,2)) AS `ST_AsText(ST_GeometryN(g, 2))` from `test`.`gis_multi_point` +SELECT g1.fid as first, g2.fid as second, +MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g) as o, +MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t, +MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r +FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; +first second w c o e d t i r +120 120 1 1 0 1 0 0 1 0 +120 121 0 0 1 0 0 0 1 0 +121 120 0 0 1 0 0 0 1 0 +121 121 1 1 0 1 0 0 1 0 +explain extended SELECT g1.fid as first, g2.fid as second, +MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g) as o, +MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t, +MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r +FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE g1 ALL NULL NULL NULL NULL 2 # Using temporary; Using filesort +1 SIMPLE g2 ALL NULL NULL NULL NULL 2 # Using join buffer (flat, BNL join) +Warnings: +Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,mbrwithin(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,mbrcontains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,mbroverlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,mbrequals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,mbrdisjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,st_touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,mbrintersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,st_crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid` +DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; +CREATE TABLE t1 ( +gp point, +ln linestring, +pg polygon, +mp multipoint, +mln multilinestring, +mpg multipolygon, +gc geometrycollection, +gm geometry +); +SHOW FIELDS FROM t1; +Field Type Null Key Default Extra +gp point YES NULL +ln linestring YES NULL +pg polygon YES NULL +mp multipoint YES NULL +mln multilinestring YES NULL +mpg multipolygon YES NULL +gc geometrycollection YES NULL +gm geometry YES NULL +ALTER TABLE t1 ADD fid INT NOT NULL; +SHOW FIELDS FROM t1; +Field Type Null Key Default Extra +gp point YES NULL +ln linestring YES NULL +pg polygon YES NULL +mp multipoint YES NULL +mln multilinestring YES NULL +mpg multipolygon YES NULL +gc geometrycollection YES NULL +gm geometry YES NULL +fid int(11) NO NULL +DROP TABLE t1; +SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)')))); +ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)')))) +POINT(1 4) +explain extended SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)')))); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select st_astext(st_geometryfromwkb(st_aswkb(st_geometryfromtext('POINT(1 4)')))) AS `ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)'))))` +explain extended SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_PointFromText('POINT(1 4)')))); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select st_astext(st_geometryfromwkb(st_aswkb(st_geometryfromtext('POINT(1 4)')))) AS `ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_PointFromText('POINT(1 4)'))))` +SELECT ST_SRID(ST_GeomFromText('LineString(1 1,2 2)',101)); +ST_SRID(ST_GeomFromText('LineString(1 1,2 2)',101)) +101 +explain extended SELECT ST_SRID(ST_GeomFromText('LineString(1 1,2 2)',101)); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select srid(st_geometryfromtext('LineString(1 1,2 2)',101)) AS `ST_SRID(ST_GeomFromText('LineString(1 1,2 2)',101))` +explain extended select ST_issimple(MultiPoint(Point(3, 6), Point(4, 10))), ST_issimple(Point(3, 6)); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select st_issimple(geometrycollection(point(3,6),point(4,10))) AS `ST_issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,st_issimple(point(3,6)) AS `ST_issimple(Point(3, 6))` +create table t1 (a geometry not null); +insert into t1 values (ST_GeomFromText('Point(1 2)')); +insert into t1 values ('Garbage'); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +insert IGNORE into t1 values ('Garbage'); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +alter table t1 add spatial index(a); +drop table t1; +create table t1(a geometry not null, index(a(5))); +insert into t1 values +(ST_GeomFromText('POINT(1 1)')), (ST_GeomFromText('POINT(3 3)')), +(ST_GeomFromText('POINT(4 4)')), (ST_GeomFromText('POINT(6 6)')); +select ST_AsText(a) from t1 where +MBRContains(ST_GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a) +or +MBRContains(ST_GeomFromText('Polygon((2 2, 2 5, 5 5, 5 2, 2 2))'), a); +ST_AsText(a) +POINT(1 1) +POINT(3 3) +POINT(4 4) +select ST_AsText(a) from t1 where +MBRContains(ST_GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a) +and +MBRContains(ST_GeomFromText('Polygon((0 0, 0 7, 7 7, 7 0, 0 0))'), a); +ST_AsText(a) +POINT(1 1) +drop table t1; +CREATE TABLE t1 (Coordinates POINT NOT NULL, INDEX(Coordinates(10))); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(383293632 1754448)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(564952612 157516260)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(903994614 180726515)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(98128178 141127631)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(862547902 799334546)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(341989013 850270906)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(803302376 93039099)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(857439153 817431356)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(319757546 343162742)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(826341972 717484432)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(305066789 201736238)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(626068992 616241497)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(55789424 755830108)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(802874458 312435220)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(153795660 551723671)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(242207428 537089292)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(553478119 807160039)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(694605552 457472733)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(987886554 792733729)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(598600363 850434457)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(592068275 940589376)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(700705362 395370650)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(33628474 558144514)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(212802006 353386020)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(901307256 39143977)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(70870451 206374045)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(240880214 696939443)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(822615542 296669638)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(452769551 625489999)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(609104858 606565210)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(177213669 851312285)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(143654501 730691787)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(658472325 838260052)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(188164520 646358878)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(630993781 786764883)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(496793334 223062055)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(727354258 197498696)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(618432704 760982731)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(755643210 831234710)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(114368751 656950466)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(870378686 185239202)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(863324511 111258900)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(882178645 685940052)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(407928538 334948195)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(311430051 17033395)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(941513405 488643719)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(868345680 85167906)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(219335507 526818004)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(923427958 407500026)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(173176882 554421738)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(194264908 669970217)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(777483793 921619165)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(867468912 395916497)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(682601897 623112122)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(227151206 796970647)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(280062588 97529892)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(982209849 143387099)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(208788792 864388493)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(829327151 616717329)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(199336688 140757201)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(633750724 140850093)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(629400920 502096404)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(226017998 848736426)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(28914408 149445955)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(256236452 202091290)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(703867693 450501360)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(872061506 481351486)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(372120524 739530418)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(877267982 54722420)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(362642540 104419188)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(851693067 642705127)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(201949080 833902916)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(786092225 410737872)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(698291409 615419376)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(27455201 897628096)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(756176576 661205925)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(38478189 385577496)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(163302328 264496186)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(234313922 192216735)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(413942141 490550373)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(394308025 117809834)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(941051732 266369530)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(599161319 313172256)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(5899948 476429301)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(367894677 368542487)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(580848489 219587743)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(11247614 782797569)')); +drop table t1; +create table t1 select ST_GeomFromWKB(POINT(1,3)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `ST_GeomFromWKB(POINT(1,3))` geometry DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1; +SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; +CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo` +geometry NOT NULL default '') ENGINE=InnoDB ; +SET sql_mode = default; +insert into t1 values ('85984',ST_GeomFromText('MULTIPOLYGON(((-115.006363 +36.305435,-114.992394 36.305202,-114.991219 36.305975,-114.991163 +36.306845,-114.989432 36.309452,-114.978275 36.312642,-114.977363 +36.311978,-114.975327 36.312344,-114.96502 36.31597,-114.963364 +36.313629,-114.961723 36.313721,-114.956398 36.316057,-114.951882 +36.320979,-114.947073 36.323475,-114.945207 36.326451,-114.945207 +36.326451,-114.944132 36.326061,-114.94003 36.326588,-114.924017 +36.334484,-114.923281 36.334146,-114.92564 36.331504,-114.94072 +36.319282,-114.945348 36.314812,-114.948091 36.314762,-114.951755 +36.316211,-114.952446 36.313883,-114.952644 36.309488,-114.944725 +36.313083,-114.93706 36.32043,-114.932478 36.323497,-114.924556 +36.327708,-114.922608 36.329715,-114.92009 36.328695,-114.912105 +36.323566,-114.901647 36.317952,-114.897436 36.313968,-114.895344 +36.309573,-114.891699 36.304398,-114.890569 36.303551,-114.886356 +36.302702,-114.885141 36.301351,-114.885709 36.297391,-114.892499 +36.290893,-114.902142 36.288974,-114.904941 36.288838,-114.905308 +36.289845,-114.906325 36.290395,-114.909916 36.289549,-114.914527 +36.287535,-114.918797 36.284423,-114.922982 36.279731,-114.924113 +36.277282,-114.924057 36.275817,-114.927733 36.27053,-114.929354 +36.269029,-114.929354 36.269029,-114.950856 36.268715,-114.950768 +36.264324,-114.960206 36.264293,-114.960301 36.268943,-115.006662 +36.268929,-115.008583 36.265619,-115.00665 36.264247,-115.006659 +36.246873,-115.006659 36.246873,-115.006838 36.247697,-115.010764 +36.247774,-115.015609 36.25113,-115.015765 36.254505,-115.029517 +36.254619,-115.038573 36.249317,-115.038573 36.249317,-115.023403 +36.25841,-115.023873 36.258994,-115.031845 36.259829,-115.03183 +36.261053,-115.025561 36.261095,-115.036417 36.274632,-115.033729 +36.276041,-115.032217 36.274851,-115.029845 36.273959,-115.029934 +36.274966,-115.025763 36.274896,-115.025406 36.281044,-115.028731 +36.284471,-115.036497 36.290377,-115.042071 36.291039,-115.026759 +36.298478,-115.008995 36.301966,-115.006363 36.305435),(-115.079835 +36.244369,-115.079735 36.260186,-115.076435 36.262369,-115.069758 +36.265,-115.070235 36.268757,-115.064542 36.268655,-115.061843 +36.269857,-115.062676 36.270693,-115.06305 36.272344,-115.059051 +36.281023,-115.05918 36.283008,-115.060591 36.285246,-115.061913 +36.290022,-115.062499 36.306353,-115.062499 36.306353,-115.060918 +36.30642,-115.06112 36.289779,-115.05713 36.2825,-115.057314 +36.279446,-115.060779 36.274659,-115.061366 36.27209,-115.057858 +36.26557,-115.055805 36.262883,-115.054688 36.262874,-115.047335 +36.25037,-115.044234 36.24637,-115.052434 36.24047,-115.061734 +36.23507,-115.061934 36.22677,-115.061934 36.22677,-115.061491 +36.225267,-115.062024 36.218194,-115.060134 36.218278,-115.060133 +36.210771,-115.057833 36.210771,-115.057433 36.196271,-115.062233 +36.196271,-115.062233 36.190371,-115.062233 36.190371,-115.065533 +36.190371,-115.071333 36.188571,-115.098331 36.188275,-115.098331 +36.188275,-115.098435 36.237569,-115.097535 36.240369,-115.097535 +36.240369,-115.093235 36.240369,-115.089135 36.240469,-115.083135 +36.240569,-115.083135 36.240569,-115.079835 +36.244369)))')),('85998',ST_GeomFromText('MULTIPOLYGON(((-115.333107 +36.264587,-115.333168 36.280638,-115.333168 36.280638,-115.32226 +36.280643,-115.322538 36.274311,-115.327222 36.274258,-115.32733 +36.263026,-115.330675 36.262984,-115.332132 36.264673,-115.333107 +36.264587),(-115.247239 36.247066,-115.247438 36.218267,-115.247438 +36.218267,-115.278525 36.219263,-115.278525 36.219263,-115.301545 +36.219559,-115.332748 36.219197,-115.332757 36.220041,-115.332757 +36.220041,-115.332895 36.233514,-115.349023 36.233479,-115.351489 +36.234475,-115.353681 36.237021,-115.357106 36.239789,-115.36519 +36.243331,-115.368156 36.243487,-115.367389 36.244902,-115.364553 +36.246014,-115.359219 36.24616,-115.356186 36.248025,-115.353347 +36.248004,-115.350813 36.249507,-115.339673 36.25387,-115.333069 +36.255018,-115.333069 36.255018,-115.333042 36.247767,-115.279039 +36.248666,-115.263639 36.247466,-115.263839 36.252766,-115.261439 +36.252666,-115.261439 36.247366,-115.247239 36.247066)))')); +select object_id, ST_geometrytype(geo), ST_ISSIMPLE(GEO), ST_ASTEXT(ST_centroid(geo)) from +t1 where object_id=85998; +object_id ST_geometrytype(geo) ST_ISSIMPLE(GEO) ST_ASTEXT(ST_centroid(geo)) +85998 MULTIPOLYGON 1 POINT(115.31877315203187 -36.23747282102153) +select object_id, ST_geometrytype(geo), ST_ISSIMPLE(GEO), ST_ASTEXT(ST_centroid(geo)) from +t1 where object_id=85984; +object_id ST_geometrytype(geo) ST_ISSIMPLE(GEO) ST_ASTEXT(ST_centroid(geo)) +85984 MULTIPOLYGON 1 POINT(-114.87787186923313 36.33101763469059) +drop table t1; +create table t1 (fl geometry not null); +insert into t1 values (1); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +insert into t1 values (1.11); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +insert into t1 values ("qwerty"); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +insert into t1 values (ST_pointfromtext('point(1,1)')); +ERROR 23000: Column 'fl' cannot be null +drop table t1; +select (ST_asWKT(ST_geomfromwkb((0x000000000140240000000000004024000000000000)))); +(ST_asWKT(ST_geomfromwkb((0x000000000140240000000000004024000000000000)))) +POINT(10 10) +select (ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440)))); +(ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440)))) +POINT(10 10) +create table t1 (g GEOMETRY); +select * from t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 g g 255 4294967295 0 Y 144 0 63 +g +select ST_asbinary(g) from t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def ST_asbinary(g) 252 4294967295 0 Y 128 0 63 +ST_asbinary(g) +drop table t1; +create table t1 (a TEXT, b GEOMETRY NOT NULL, INDEX(b(5))); +alter table t1 disable keys; +Warnings: +Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option +load data infile '../../std_data/bad_gis_data.dat' into table t1; +ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'b' at row 1 +alter table t1 enable keys; +Warnings: +Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option +drop table t1; +create table t1 (a int, b blob); +insert into t1 values (1, ''), (2, NULL), (3, '1'); +select * from t1; +a b +1 +2 NULL +3 1 +select +ST_geometryfromtext(b) IS NULL, ST_geometryfromwkb(b) IS NULL, ST_astext(b) IS NULL, +ST_aswkb(b) IS NULL, ST_geometrytype(b) IS NULL, ST_centroid(b) IS NULL, +ST_envelope(b) IS NULL, ST_startpoint(b) IS NULL, ST_endpoint(b) IS NULL, +ST_exteriorring(b) IS NULL, ST_pointn(b, 1) IS NULL, ST_geometryn(b, 1) IS NULL, +ST_interiorringn(b, 1) IS NULL, multipoint(b) IS NULL, ST_isempty(b) IS NULL, +ST_issimple(b) IS NULL, ST_isclosed(b) IS NULL, ST_dimension(b) IS NULL, +ST_numgeometries(b) IS NULL, ST_numinteriorrings(b) IS NULL, ST_numpoints(b) IS NULL, +ST_area(b) IS NULL, ST_length(b) IS NULL, ST_srid(b) IS NULL, ST_x(b) IS NULL, +ST_y(b) IS NULL +from t1; +ERROR 22007: Illegal non geometric '`test`.`t1`.`b`' value found during parsing +select +MBRwithin(b, b) IS NULL, MBRcontains(b, b) IS NULL, MBRoverlaps(b, b) IS NULL, +MBRequals(b, b) IS NULL, MBRdisjoint(b, b) IS NULL, ST_touches(b, b) IS NULL, +MBRintersects(b, b) IS NULL, ST_crosses(b, b) IS NULL +from t1; +MBRwithin(b, b) IS NULL MBRcontains(b, b) IS NULL MBRoverlaps(b, b) IS NULL MBRequals(b, b) IS NULL MBRdisjoint(b, b) IS NULL ST_touches(b, b) IS NULL MBRintersects(b, b) IS NULL ST_crosses(b, b) IS NULL +1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 +select +point(b, b) IS NULL, linestring(b) IS NULL, polygon(b) IS NULL, multipoint(b) IS NULL, +multilinestring(b) IS NULL, multipolygon(b) IS NULL, +geometrycollection(b) IS NULL +from t1; +ERROR 22007: Illegal non geometric '`test`.`t1`.`b`' value found during parsing +drop table t1; +CREATE TABLE t1(a POINT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1; +a +NULL +DROP TABLE t1; +CREATE TABLE `t1` ( `col9` set('a'), `col89` date); +INSERT IGNORE INTO `t1` VALUES ('','0000-00-00'); +select ST_geomfromtext(col9,col89) as a from t1; +a +NULL +DROP TABLE t1; +CREATE TABLE t1 ( +geomdata polygon NOT NULL, +KEY index_geom (geomdata(10)) +) ENGINE=InnoDB DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED; +Warnings: +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +CREATE TABLE t2 ( +geomdata polygon NOT NULL, +KEY index_geom (geomdata(10)) +) ENGINE=InnoDB DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED; +Warnings: +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +CREATE TABLE t3 +select +ST_aswkb(ws.geomdata) AS geomdatawkb +from +t1 ws +union +select +ST_aswkb(ws.geomdata) AS geomdatawkb +from +t2 ws; +describe t3; +Field Type Null Key Default Extra +geomdatawkb longblob YES NULL +drop table t1; +drop table t2; +drop table t3; +create table t1(col1 geometry default null,col15 geometrycollection not +null, index(col15(5)),index(col1(15)))engine=InnoDB; +insert into t1 set col15 = ST_GeomFromText('POINT(6 5)'); +insert into t1 set col15 = ST_GeomFromText('POINT(6 5)'); +check table t1 extended; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; +End of 4.1 tests +create table t1 (s1 geometry not null,s2 char(100)); +create trigger t1_bu before update on t1 for each row set new.s1 = null; +insert into t1 values (null,null); +ERROR 23000: Column 's1' cannot be null +drop table t1; +drop procedure if exists fn3; +create function fn3 () returns point deterministic return ST_GeomFromText("point(1 1)"); +show create function fn3; +Function sql_mode Create Function character_set_client collation_connection Database Collation +fn3 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS point + DETERMINISTIC +return ST_GeomFromText("point(1 1)") latin1 latin1_swedish_ci latin1_swedish_ci +select ST_astext(fn3()); +ST_astext(fn3()) +POINT(1 1) +drop function fn3; +create table t1(pt POINT); +alter table t1 add primary key pti(pt); +drop table t1; +create table t1(pt GEOMETRY); +alter table t1 add primary key pti(pt); +ERROR 42000: BLOB/TEXT column 'pt' used in key specification without a key length +alter table t1 add primary key pti(pt(20)); +drop table t1; +create table t1 select ST_GeomFromText('point(1 1)'); +desc t1; +Field Type Null Key Default Extra +ST_GeomFromText('point(1 1)') geometry YES NULL +drop table t1; +create table t1 (g geometry not null); +insert into t1 values(default); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +drop table t1; +CREATE TABLE t1 (a GEOMETRY); +CREATE VIEW v1 AS SELECT ST_GeomFromwkb(ST_ASBINARY(a)) FROM t1; +CREATE VIEW v2 AS SELECT a FROM t1; +DESCRIBE v1; +Field Type Null Key Default Extra +ST_GeomFromwkb(ST_ASBINARY(a)) geometry YES NULL +DESCRIBE v2; +Field Type Null Key Default Extra +a geometry YES NULL +DROP VIEW v1,v2; +DROP TABLE t1; +create table t1 (name VARCHAR(100), square GEOMETRY); +INSERT INTO t1 VALUES("center", ST_GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))')); +INSERT INTO t1 VALUES("small", ST_GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))')); +INSERT INTO t1 VALUES("big", ST_GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))')); +INSERT INTO t1 VALUES("up", ST_GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))')); +INSERT INTO t1 VALUES("up2", ST_GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))')); +INSERT INTO t1 VALUES("up3", ST_GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))')); +INSERT INTO t1 VALUES("down", ST_GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))')); +INSERT INTO t1 VALUES("down2", ST_GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))')); +INSERT INTO t1 VALUES("down3", ST_GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))')); +INSERT INTO t1 VALUES("right", ST_GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))')); +INSERT INTO t1 VALUES("right2", ST_GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))')); +INSERT INTO t1 VALUES("right3", ST_GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))')); +INSERT INTO t1 VALUES("left", ST_GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))')); +INSERT INTO t1 VALUES("left2", ST_GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))')); +INSERT INTO t1 VALUES("left3", ST_GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))')); +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrcontains +center,small +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrdisjoint +down3,left3,right3,up3 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequals FROM t1 a1 JOIN t1 a2 ON MBREquals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrequals +center +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrintersect +big,center,down,down2,left,left2,right,right2,small,up,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbroverlaps +down,left,right,up +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrtouches +down2,left2,right2,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrwithin +big,center +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +MBRcontains +center,small +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +MBRdisjoint +down3,left3,right3,up3 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRequals FROM t1 a1 JOIN t1 a2 ON MBREquals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +MBRequals +center +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +intersect +big,center,down,down2,left,left2,right,right2,small,up,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRoverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +MBRoverlaps +down,left,right,up +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS ST_touches FROM t1 a1 JOIN t1 a2 ON ST_Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +ST_touches +down2,left2,right2,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +MBRwithin +big,center +SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))'); +SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))'); +SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))'); +SET @horiz3 = ST_GeomFromText('POLYGON ((2 0, 3 0, 2 0))'); +SET @point1 = ST_GeomFromText('POLYGON ((0 0))'); +SET @point2 = ST_GeomFromText('POLYGON ((-2 0))'); +SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @vert1) GROUP BY a1.name; +MBRoverlaps +SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @horiz1) GROUP BY a1.name; +MBRoverlaps +SELECT MBROverlaps(@horiz1, @vert1) FROM DUAL; +MBROverlaps(@horiz1, @vert1) +0 +SELECT MBROverlaps(@horiz1, @horiz2) FROM DUAL; +MBROverlaps(@horiz1, @horiz2) +1 +SELECT MBROverlaps(@horiz1, @horiz3) FROM DUAL; +MBROverlaps(@horiz1, @horiz3) +0 +SELECT MBROverlaps(@horiz1, @point1) FROM DUAL; +MBROverlaps(@horiz1, @point1) +0 +SELECT MBROverlaps(@horiz1, @point2) FROM DUAL; +MBROverlaps(@horiz1, @point2) +0 +DROP TABLE t1; +create table t1(f1 geometry, f2 polygon, f3 linestring); +select f1 from t1 union select f1 from t1; +f1 +insert into t1 (f2,f3) values (ST_GeomFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))'), ST_GeomFromText('LINESTRING(0 0,1 1,2 2)')); +select ST_AsText(f2),ST_AsText(f3) from t1; +ST_AsText(f2) ST_AsText(f3) +POLYGON((10 10,20 10,20 20,10 20,10 10)) LINESTRING(0 0,1 1,2 2) +select ST_AsText(a) from (select f2 as a from t1 union select f3 from t1) t; +ST_AsText(a) +POLYGON((10 10,20 10,20 20,10 20,10 10)) +LINESTRING(0 0,1 1,2 2) +create table t2 as select f2 as a from t1 union select f3 from t1; +desc t2; +Field Type Null Key Default Extra +a geometry YES NULL +select ST_AsText(a) from t2; +ST_AsText(a) +POLYGON((10 10,20 10,20 20,10 20,10 10)) +LINESTRING(0 0,1 1,2 2) +drop table t1, t2; +SELECT 1; +1 +1 +CREATE TABLE t1 (p POINT); +CREATE TABLE t2 (p POINT, INDEX(p)); +INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)')); +INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)')); +SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +1 +EXPLAIN +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref p p 28 const 1 Using where +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +1 +INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)')); +INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)')); +EXPLAIN +SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +2 +EXPLAIN +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref p p 28 const # Using where +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +2 +EXPLAIN +SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +2 +DROP TABLE t1, t2; +End of 5.0 tests +# +# Test for bug #58650 "Failing assertion: primary_key_no == -1 || +# primary_key_no == 0". +# +drop table if exists t1; +# The minimal test case. +create table t1 (a int not null, b linestring not null, unique key b (b(12)), unique key a (a)); +drop table t1; +# The original test case. +create table t1 (a int not null, b linestring not null, unique key b (b(12))); +create unique index a on t1(a); +drop table t1; +create table `t1` (`col002` point)engine=InnoDB; +insert into t1 values (),(),(); +select min(`col002`) from t1 union select `col002` from t1; +min(`col002`) +NULL +drop table t1; +# +# Bug #47780: crash when comparing GIS items from subquery +# +CREATE TABLE t1(a INT, b MULTIPOLYGON); +INSERT INTO t1 VALUES +(0, +ST_GEOMFROMTEXT( +'multipolygon(((1 2,3 4,5 6,7 8,9 8,1 2,1 2),(7 6,5 4,3 2,1 2,3 4,7 6)))')); +# must not crash +SELECT 1 FROM t1 WHERE a <> (SELECT ST_GEOMETRYCOLLECTIONFROMWKB(b) FROM t1); +1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x06\x00\x00\x00\x01\x00\x00\x00\x01\x03\x00\x00\x00\x02\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00' +DROP TABLE t1; +# +# Bug #49250 : spatial btree index corruption and crash +# Part one : spatial syntax check +# +CREATE TABLE t1(col1 MULTIPOLYGON NOT NULL, +SPATIAL INDEX USING BTREE (col1)); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING BTREE (col1))' at line 2 +CREATE TABLE t2(col1 MULTIPOLYGON NOT NULL); +CREATE SPATIAL INDEX USING BTREE ON t2(col); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING BTREE ON t2(col)' at line 1 +ALTER TABLE t2 ADD SPATIAL INDEX USING BTREE (col1); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING BTREE (col1)' at line 1 +DROP TABLE t2; +End of 5.0 tests +create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime); +create view v1 as select * from t1; +desc v1; +Field Type Null Key Default Extra +f1 tinyint(1) YES NULL +f2 char(1) YES NULL +f3 varchar(1) YES NULL +f4 geometry YES NULL +f5 datetime YES NULL +drop view v1; +drop table t1; +SELECT MultiPoint(12345,''); +ERROR 22007: Illegal non geometric '12345' value found during parsing +SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUAL) AS d WHERE (LINESTRING(d.b)); +ERROR 22007: Illegal non geometric ''00000'' value found during parsing +# +# BUG#51875: crash when loading data into geometry function ST_polyfromwkb +# +SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; +SET @a=ST_POLYFROMWKB(@a); +SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; +SET @a=ST_POLYFROMWKB(@a); +create table t1(a polygon NOT NULL)engine=InnoDB; +insert into t1 values (ST_geomfromtext("point(0 1)")); +ERROR 22007: Incorrect POLYGON value: 'POINT' for column 'a' at row 1 +insert into t1 values (ST_geomfromtext("point(1 0)")); +ERROR 22007: Incorrect POLYGON value: 'POINT' for column 'a' at row 1 +select * from (select polygon(t1.a) as p from t1 order by t1.a) d; +p +drop table t1; +# +# Test for bug #59888 "debug assertion when attempt to create spatial index +# on char > 31 bytes". +# +create table t1(a char(32) not null) engine=InnoDB; +create index i on t1 (a(5)); +drop table t1; +End of 5.1 tests +CREATE TABLE t0 (a BINARY(32) NOT NULL); +CREATE UNIQUE INDEX i on t0 (a(10)); +INSERT INTO t0 VALUES (1); +CREATE TABLE t1( +col0 BINARY NOT NULL, +col2 TIMESTAMP, +INDEX i1 (col0) +) ENGINE=InnoDB; +CREATE TABLE t2 ( +col0 BINARY NOT NULL, +col2 TIMESTAMP +) ENGINE=InnoDB; +CREATE INDEX idx0 ON t1(col0); +Warnings: +Note 1831 Duplicate index `idx0`. This is deprecated and will be disallowed in a future release +CREATE TABLE t3 ( +col0 INTEGER NOT NULL, +col1 POINT, +col2 POINT +); +CREATE SPATIAL INDEX idx0 ON t2 (col1, col2); +ERROR HY000: Incorrect arguments to SPATIAL INDEX +CREATE TABLE t4 ( +col0 INTEGER NOT NULL, +col1 POINT, +col2 LINESTRING, +INDEX i1 (col1(5), col2(5)) +); +DROP TABLE IF EXISTS t0, t1, t2, t3,t4; +# +# BUG#12414917 - ST_ISCLOSED() CRASHES ON 64-BIT BUILDS +# +SELECT ST_ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20))); +ST_ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20))) +-1 +# +# 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 +(a geometry NOT NULL, UNIQUE KEY i (a(151))) engine=InnoDB; +INSERT INTO g1 VALUES (ST_geomfromtext('point(1 1)')); +INSERT INTO g1 VALUES (ST_geomfromtext('point(1 2)')); +FLUSH TABLES; +SELECT 1 FROM g1 +FORCE INDEX(i) WHERE a = date_sub(now(), interval 2808.4 year_month) +; +1 +Warnings: +Warning 1292 Incorrect datetime value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF0?\x00\x00\x00\x00\x00\x00\xF0?' +Warning 1441 Datetime function: datetime field overflow +Warning 1292 Incorrect datetime value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF0?\x00\x00\x00\x00\x00\x00\x00@' +DROP TABLE g1; +# +# Bug#13013970 MORE CRASHES IN FIELD_BLOB::GET_KEY_IMAGE +# +CREATE TABLE g1(a TEXT NOT NULL, KEY(a(255))); +INSERT INTO g1 VALUES ('a'),('a'); +SELECT 1 FROM g1 WHERE a >= ANY +(SELECT 1 FROM g1 WHERE a = ST_geomfromtext('') OR a) ; +1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'a' +DROP TABLE g1; +End of 5.5 tests +DROP DATABASE IF EXISTS gis_ogs; +CREATE DATABASE gis_ogs; +USE gis_ogs; +# +# C.3.3.1 Geometry types and functions schema construction +# +CREATE TABLE lakes ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +shore POLYGON); +CREATE TABLE road_segments ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +aliases CHARACTER VARYING(64), +num_lanes INTEGER, +centerline LINESTRING); +CREATE TABLE divided_routes ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +num_lanes INTEGER, +centerlines MULTILINESTRING); +CREATE TABLE forests ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +boundary MULTIPOLYGON); +CREATE TABLE bridges ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +position POINT); +CREATE TABLE streams ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +centerline LINESTRING); +CREATE TABLE buildings ( +fid INTEGER NOT NULL PRIMARY KEY, +address CHARACTER VARYING(64), +position POINT, +footprint POLYGON); +CREATE TABLE ponds ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +type CHARACTER VARYING(64), +shores MULTIPOLYGON); +CREATE TABLE named_places ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +boundary POLYGON); +CREATE TABLE map_neatlines ( +fid INTEGER NOT NULL PRIMARY KEY, +neatline POLYGON); +# +# C.3.3.2 Geometry types and functions schema data loading +# +# Lakes +INSERT INTO lakes VALUES ( +101, 'BLUE LAKE', +ST_PolyFromText( +'POLYGON( +(52 18,66 23,73 9,48 6,52 18), +(59 18,67 18,67 13,59 13,59 18) +)', +101)); +# Road Segments +INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2, +ST_LineFromText( +'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101)); +INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4, +ST_LineFromText( +'LINESTRING( 44 31, 56 34, 70 38 )' ,101)); +INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2, +ST_LineFromText( +'LINESTRING( 70 38, 72 48 )' ,101)); +INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4, +ST_LineFromText( +'LINESTRING( 70 38, 84 42 )' ,101)); +INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL, +1, +ST_LineFromText( +'LINESTRING( 28 26, 28 0 )',101)); +# DividedRoutes +INSERT INTO divided_routes VALUES(119, 'Route 75', 4, +ST_MLineFromText( +'MULTILINESTRING((10 48,10 21,10 0), +(16 0,16 23,16 48))', 101)); +# Forests +INSERT INTO forests VALUES(109, 'Green Forest', +ST_MPolyFromText( +'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26), +(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))', +101)); +# Bridges +INSERT INTO bridges VALUES(110, 'Cam Bridge', ST_PointFromText( +'POINT( 44 31 )', 101)); +# Streams +INSERT INTO streams VALUES(111, 'Cam Stream', +ST_LineFromText( +'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101)); +INSERT INTO streams VALUES(112, NULL, +ST_LineFromText( +'LINESTRING( 76 0, 78 4, 73 9 )', 101)); +# Buildings +INSERT INTO buildings VALUES(113, '123 Main Street', +ST_PointFromText( +'POINT( 52 30 )', 101), +ST_PolyFromText( +'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101)); +INSERT INTO buildings VALUES(114, '215 Main Street', +ST_PointFromText( +'POINT( 64 33 )', 101), +ST_PolyFromText( +'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101)); +# Ponds +INSERT INTO ponds VALUES(120, NULL, 'Stock Pond', +ST_MPolyFromText( +'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ), +( ( 26 44, 26 40, 28 42, 26 44) ) )', 101)); +# Named Places +INSERT INTO named_places VALUES(117, 'Ashton', +ST_PolyFromText( +'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101)); +INSERT INTO named_places VALUES(118, 'Goose Island', +ST_PolyFromText( +'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101)); +# Map Neatlines +INSERT INTO map_neatlines VALUES(115, +ST_PolyFromText( +'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101)); +# +# C.3.3.3 Geometry types and functions schema test queries + +# Conformance Item T6 +SELECT ST_Dimension(shore) +FROM lakes +WHERE name = 'Blue Lake'; +ST_Dimension(shore) +2 +# Conformance Item T7 +SELECT ST_GeometryType(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; +ST_GeometryType(centerlines) +MULTILINESTRING +# Conformance Item T8 +SELECT ST_AsText(boundary) +FROM named_places +WHERE name = 'Goose Island'; +ST_AsText(boundary) +POLYGON((67 13,67 18,59 18,59 13,67 13)) +# Conformance Item T9 +SELECT ST_AsText(ST_PolyFromWKB(ST_AsBinary(boundary),101)) +FROM named_places +WHERE name = 'Goose Island'; +ST_AsText(ST_PolyFromWKB(ST_AsBinary(boundary),101)) +POLYGON((67 13,67 18,59 18,59 13,67 13)) +# Conformance Item T10 +SELECT ST_SRID(boundary) +FROM named_places +WHERE name = 'Goose Island'; +ST_SRID(boundary) +101 +# Conformance Item T11 +SELECT ST_IsEmpty(centerline) +FROM road_segments +WHERE name = 'Route 5' +AND aliases = 'Main Street'; +ST_IsEmpty(centerline) +0 +# Conformance Item T14 +SELECT ST_AsText(ST_Envelope(boundary)) +FROM named_places +WHERE name = 'Goose Island'; +ST_AsText(ST_Envelope(boundary)) +POLYGON((59 13,67 13,67 18,59 18,59 13)) +# Conformance Item T15 +SELECT ST_X(position) +FROM bridges +WHERE name = 'Cam Bridge'; +ST_X(position) +44 +# Conformance Item T16 +SELECT ST_Y(position) +FROM bridges +WHERE name = 'Cam Bridge'; +ST_Y(position) +31 +# Conformance Item T17 +SELECT ST_AsText(ST_StartPoint(centerline)) +FROM road_segments +WHERE fid = 102; +ST_AsText(ST_StartPoint(centerline)) +POINT(0 18) +# Conformance Item T18 +SELECT ST_AsText(ST_EndPoint(centerline)) +FROM road_segments +WHERE fid = 102; +ST_AsText(ST_EndPoint(centerline)) +POINT(44 31) +# Conformance Item T21 +SELECT ST_Length(centerline) +FROM road_segments +WHERE fid = 106; +ST_Length(centerline) +26 +# Conformance Item T22 +SELECT ST_NumPoints(centerline) +FROM road_segments +WHERE fid = 102; +ST_NumPoints(centerline) +5 +# Conformance Item T23 +SELECT ST_AsText(ST_PointN(centerline, 1)) +FROM road_segments +WHERE fid = 102; +ST_AsText(ST_PointN(centerline, 1)) +POINT(0 18) +# Conformance Item T24 +SELECT ST_AsText(ST_Centroid(boundary)) +FROM named_places +WHERE name = 'Goose Island'; +ST_AsText(ST_Centroid(boundary)) +POINT(63 15.5) +# Conformance Item T26 +SELECT ST_Area(boundary) +FROM named_places +WHERE name = 'Goose Island'; +ST_Area(boundary) +40 +# Conformance Item T27 +SELECT ST_AsText(ST_ExteriorRing(shore)) +FROM lakes +WHERE name = 'Blue Lake'; +ST_AsText(ST_ExteriorRing(shore)) +LINESTRING(52 18,66 23,73 9,48 6,52 18) +# Conformance Item T28 +SELECT ST_NumInteriorRings(shore) +FROM lakes +WHERE name = 'Blue Lake'; +ST_NumInteriorRings(shore) +1 +# Conformance Item T29 +SELECT ST_AsText(ST_InteriorRingN(shore, 1)) +FROM lakes +WHERE name = 'Blue Lake'; +ST_AsText(ST_InteriorRingN(shore, 1)) +LINESTRING(59 18,67 18,67 13,59 13,59 18) +# Conformance Item T30 +SELECT ST_NumGeometries(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; +ST_NumGeometries(centerlines) +2 +# Conformance Item T31 +SELECT ST_AsText(ST_GeometryN(centerlines, 2)) +FROM divided_routes +WHERE name = 'Route 75'; +ST_AsText(ST_GeometryN(centerlines, 2)) +LINESTRING(16 0,16 23,16 48) +# Conformance Item T32 +SELECT ST_IsClosed(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; +ST_IsClosed(centerlines) +0 +# Conformance Item T33 +SELECT ST_Length(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; +ST_Length(centerlines) +96 +# Conformance Item T34 +SELECT ST_AsText(ST_Centroid(shores)) +FROM ponds +WHERE fid = 120; +ST_AsText(ST_Centroid(shores)) +POINT(25 42) +# Conformance Item T36 +SELECT ST_Area(shores) +FROM ponds +WHERE fid = 120; +ST_Area(shores) +8 +# Conformance Item T37 +SELECT ST_Equals(boundary, +ST_PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) +FROM named_places +WHERE name = 'Goose Island'; +ST_Equals(boundary, +ST_PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) +1 +# Conformance Item T37 +# Geometry arguments' SRIDs must be identical. +SELECT ST_Equals(boundary, +ST_PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',101)) +FROM named_places +WHERE name = 'Goose Island'; +ST_Equals(boundary, +ST_PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',101)) +1 +# Conformance Item T38 +SELECT ST_Disjoint(centerlines, boundary) +FROM divided_routes, named_places +WHERE divided_routes.name = 'Route 75' +AND named_places.name = 'Ashton'; +ST_Disjoint(centerlines, boundary) +1 +# Conformance Item T39 +SELECT ST_Touches(centerline, shore) +FROM streams, lakes +WHERE streams.name = 'Cam Stream' +AND lakes.name = 'Blue Lake'; +ST_Touches(centerline, shore) +1 +# Conformance Item T42 +SELECT ST_Crosses(road_segments.centerline, divided_routes.centerlines) +FROM road_segments, divided_routes +WHERE road_segments.fid = 102 +AND divided_routes.name = 'Route 75'; +ST_Crosses(road_segments.centerline, divided_routes.centerlines) +1 +# Conformance Item T43 +SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines) +FROM road_segments, divided_routes +WHERE road_segments.fid = 102 +AND divided_routes.name = 'Route 75'; +ST_Intersects(road_segments.centerline, divided_routes.centerlines) +1 +# Conformance Item T44 +SELECT ST_Contains(forests.boundary, named_places.boundary) +FROM forests, named_places +WHERE forests.name = 'Green Forest' +AND named_places.name = 'Ashton'; +ST_Contains(forests.boundary, named_places.boundary) +0 +# Conformance Item T46 +SELECT ST_Distance(position, boundary) +FROM bridges, named_places +WHERE bridges.name = 'Cam Bridge' +AND named_places.name = 'Ashton'; +ST_Distance(position, boundary) +12 +# Conformance Item T48 +SELECT ST_AsText(ST_Difference(named_places.boundary, forests.boundary)) +FROM named_places, forests +WHERE named_places.name = 'Ashton' +AND forests.name = 'Green Forest'; +ST_AsText(ST_Difference(named_places.boundary, forests.boundary)) +POLYGON((56 34,62 48,84 48,84 42,56 34)) +SELECT ST_AsText(ST_Union(shore, boundary)) +FROM lakes, named_places +WHERE lakes.name = 'Blue Lake' +AND named_places.name = 'Goose Island'; +ST_AsText(ST_Union(shore, boundary)) +POLYGON((48 6,52 18,66 23,73 9,48 6)) +# Conformance Item T50 +SELECT ST_AsText(ST_SymDifference(shore, boundary)) +FROM lakes, named_places +WHERE lakes.name = 'Blue Lake' +AND named_places.name = 'Ashton'; +ST_AsText(ST_SymDifference(shore, boundary)) +MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30))) +# Conformance Item T51 +SELECT count(*) +FROM buildings, bridges +WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1; +count(*) +1 +DROP DATABASE gis_ogs; +# +# Bug#13362660 ASSERTION `FIELD_POS < FIELD_COUNT' FAILED. IN PROTOCOL_TEXT::STORE +# +SELECT ST_Union('', ''), md5(1); +ST_Union('', '') md5(1) +NULL c4ca4238a0b923820dcc509a6f75849b diff --git a/mysql-test/suite/innodb_gis/r/alter_spatial_index.result b/mysql-test/suite/innodb_gis/r/alter_spatial_index.result new file mode 100644 index 00000000000..78d5f79e311 --- /dev/null +++ b/mysql-test/suite/innodb_gis/r/alter_spatial_index.result @@ -0,0 +1,671 @@ +CALL mtr.add_suppression("but MySQL is asking statistics for 2 columns. Have you mixed"); +CREATE TABLE tab(c1 int NOT NULL PRIMARY KEY,c2 POINT NOT NULL, +c3 LINESTRING NOT NULL,c4 POLYGON NOT NULL,c5 GEOMETRY NOT NULL) +ENGINE=InnoDB; +CREATE TABLE tab1(c1 int NOT NULL PRIMARY KEY,c2 MULTIPOINT NOT NULL, +c3 MULTILINESTRING NOT NULL,c4 MULTIPOLYGON NOT NULL,c5 GEOMETRY NOT NULL) +ENGINE=InnoDB; +INSERT INTO tab1 SELECT * FROM tab; +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(1,ST_GeomFromText('POINT(10 10)'),ST_GeomFromText('LINESTRING(5 5,20 20,30 30)'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(2,ST_GeomFromText('POINT(20 20)'),ST_GeomFromText('LINESTRING(20 20,30 30,40 40)'), +ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))'), +ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(3,ST_GeomFromText('POINT(4 4)'),ST_GeomFromText('LINESTRING(130 130,140 140,150 150)'), +ST_GeomFromText('POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'), +ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(4,ST_GeomFromText('POINT(50 50)'),ST_GeomFromText('LINESTRING(200 200,300 300,400 400)'), +ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))'), +ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(5,ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(400 400,500 500,600 700)'), +ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))'), +ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(6,ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))'), +ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(7,ST_GeomFromText('POINT(60 70)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(8,ST_GeomFromText('POINT(0 0)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(9,ST_GeomFromText('POINT(120 120)'),ST_GeomFromText('LINESTRING(100 100,110 110,120 120)'), +ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))'), +ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(10,ST_GeomFromText('POINT(160 160)'),ST_GeomFromText('LINESTRING(140 140,150 150,160 160)'), +ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'), +ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))')); +ALTER TABLE tab ADD SPATIAL INDEX idx2(c2 ASC); +ALTER TABLE tab ADD SPATIAL KEY idx3(c3 DESC); +ALTER TABLE tab ADD SPATIAL INDEX idx4(c4 ASC) COMMENT 'testing spatial index on Polygon'; +ALTER TABLE tab ADD SPATIAL KEY idx5(c5 ASC) COMMENT 'testing spatial index on Geometry'; +ALTER TABLE tab ADD INDEX idx6(c4(10)) USING BTREE; +SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1); +c1 ST_Astext(c2) ST_Astext(c4) +3 POINT(4 4) POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRContains(tab.c4, @g1); +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1); +c1 ST_Astext(c2) ST_Astext(c4) +3 POINT(0 0) POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +DELETE FROM tab WHERE MBRContains(tab.c4, @g1); +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1); +c1 ST_Astext(c2) ST_Astext(c4) +SET @g1 = ST_GeomFromText('LINESTRING( 300 300,400 400)'); +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1); +c1 ST_Astext(c2) ST_Astext(c4) +UPDATE tab SET C2 = ST_GeomFromText('POINT(100 100)') +WHERE MBRContains(tab.c4, @g1); +DELETE FROM tab WHERE MBRContains(tab.c4, @g1); +SET @g1 = ST_GeomFromText( 'POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))'); +SELECT c1,ST_AsText(c2),ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1); +c1 ST_AsText(c2) ST_Astext(c4) +5 POINT(3 3) POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010)) +UPDATE tab SET C2 = ST_GeomFromText('POINT(200 200)') +WHERE MBRWithin(tab.c4, @g1); +SELECT c1,ST_AsText(c2),ST_AsText(c4) FROM tab WHERE MBRWithin(tab.c4, @g1); +c1 ST_AsText(c2) ST_AsText(c4) +5 POINT(200 200) POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010)) +DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); +ALTER TABLE tab MODIFY COLUMN c2 MULTIPOINT; +ERROR 42000: All parts of a SPATIAL index must be NOT NULL +ALTER TABLE tab MODIFY COLUMN c3 MULTILINESTRING; +ERROR 42000: All parts of a SPATIAL index must be NOT NULL +ALTER TABLE tab MODIFY COLUMN c4 MULTIPOLYGON; +ERROR 42000: All parts of a SPATIAL index must be NOT NULL +ALTER TABLE tab MODIFY COLUMN c3 MULTILINESTRING NULL; +ERROR 42000: All parts of a SPATIAL index must be NOT NULL +ALTER TABLE tab MODIFY COLUMN c4 MULTIPOLYGON NULL; +ERROR 42000: All parts of a SPATIAL index must be NOT NULL +ALTER TABLE tab MODIFY COLUMN c4 Geometry NULL; +ERROR 42000: All parts of a SPATIAL index must be NOT NULL +ALTER TABLE tab CHANGE COLUMN c2 c22 POINT; +ERROR 42000: All parts of a SPATIAL index must be NOT NULL +ALTER TABLE tab CHANGE COLUMN c3 c33 LINESTRING; +ERROR 42000: All parts of a SPATIAL index must be NOT NULL +ALTER TABLE tab CHANGE COLUMN c4 c44 POLYGON; +ERROR 42000: All parts of a SPATIAL index must be NOT NULL +ALTER TABLE tab add SPATIAL INDEX idx1(c1); +ERROR HY000: Incorrect arguments to SPATIAL INDEX +ALTER TABLE tab ADD SPATIAL INDEX idx6(c2 ASC) USING BTREE; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING BTREE' at line 1 +ALTER TABLE tab ADD SPATIAL INDEX idx6(c2 ASC) USING HASH; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING HASH' at line 1 +SHOW CREATE TABLE tab; +Table Create Table +tab CREATE TABLE `tab` ( + `c1` int(11) NOT NULL, + `c2` point NOT NULL, + `c3` linestring NOT NULL, + `c4` geometry NOT NULL, + `c5` geometry NOT NULL, + PRIMARY KEY (`c1`), + SPATIAL KEY `idx2` (`c2`), + SPATIAL KEY `idx3` (`c3`), + SPATIAL KEY `idx4` (`c4`) COMMENT 'testing spatial index on Polygon', + SPATIAL KEY `idx5` (`c5`) COMMENT 'testing spatial index on Geometry', + KEY `idx6` (`c4`(10)) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW INDEX FROM tab; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +tab 0 PRIMARY 1 c1 A # NULL NULL BTREE +tab 1 idx2 1 c2 A # 32 NULL SPATIAL +tab 1 idx3 1 c3 A # 32 NULL SPATIAL +tab 1 idx4 1 c4 A # 32 NULL SPATIAL testing spatial index on Polygon +tab 1 idx5 1 c5 A # 32 NULL SPATIAL testing spatial index on Geometry +tab 1 idx6 1 c4 A # 10 NULL BTREE +SET @g1 = ST_GeomFromText('POLYGON((20 20,30 30,40 40,50 50,40 50,30 40,30 30,20 20))'); +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1); +c1 ST_Astext(c2) ST_Astext(c4) +2 POINT(20 20) POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +1 POINT(10 10) POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +UPDATE tab SET C2 = ST_GeomFromText('POINT(1000 1000)') +WHERE ST_Crosses(tab.c4, @g1); +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1); +c1 ST_Astext(c2) ST_Astext(c4) +2 POINT(1000 1000) POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +1 POINT(1000 1000) POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); +ALTER TABLE tab CHANGE COLUMN c2 c22 POINT NOT NULL; +ALTER TABLE tab CHANGE COLUMN c3 c33 LINESTRING NOT NULL; +ALTER TABLE tab CHANGE COLUMN c4 c44 POLYGON NOT NULL; +SHOW CREATE TABLE tab; +Table Create Table +tab CREATE TABLE `tab` ( + `c1` int(11) NOT NULL, + `c22` point NOT NULL, + `c33` linestring NOT NULL, + `c44` polygon NOT NULL, + `c5` geometry NOT NULL, + PRIMARY KEY (`c1`), + SPATIAL KEY `idx2` (`c22`), + SPATIAL KEY `idx3` (`c33`), + SPATIAL KEY `idx4` (`c44`) COMMENT 'testing spatial index on Polygon', + SPATIAL KEY `idx5` (`c5`) COMMENT 'testing spatial index on Geometry', + KEY `idx6` (`c44`(10)) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW INDEX FROM tab; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +tab 0 PRIMARY 1 c1 A # NULL NULL BTREE +tab 1 idx2 1 c22 A # 32 NULL SPATIAL +tab 1 idx3 1 c33 A # 32 NULL SPATIAL +tab 1 idx4 1 c44 A # 32 NULL SPATIAL testing spatial index on Polygon +tab 1 idx5 1 c5 A # 32 NULL SPATIAL testing spatial index on Geometry +tab 1 idx6 1 c44 A # 10 NULL BTREE +ALTER TABLE tab CHANGE COLUMN c22 c2 POINT NOT NULL; +ALTER TABLE tab CHANGE COLUMN c33 c3 LINESTRING NOT NULL; +ALTER TABLE tab CHANGE COLUMN c44 c4 POLYGON NOT NULL; +SHOW CREATE TABLE tab; +Table Create Table +tab CREATE TABLE `tab` ( + `c1` int(11) NOT NULL, + `c2` point NOT NULL, + `c3` linestring NOT NULL, + `c4` polygon NOT NULL, + `c5` geometry NOT NULL, + PRIMARY KEY (`c1`), + SPATIAL KEY `idx2` (`c2`), + SPATIAL KEY `idx3` (`c3`), + SPATIAL KEY `idx4` (`c4`) COMMENT 'testing spatial index on Polygon', + SPATIAL KEY `idx5` (`c5`) COMMENT 'testing spatial index on Geometry', + KEY `idx6` (`c4`(10)) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW INDEX FROM tab; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +tab 0 PRIMARY 1 c1 A # NULL NULL BTREE +tab 1 idx2 1 c2 A # 32 NULL SPATIAL +tab 1 idx3 1 c3 A # 32 NULL SPATIAL +tab 1 idx4 1 c4 A # 32 NULL SPATIAL testing spatial index on Polygon +tab 1 idx5 1 c5 A # 32 NULL SPATIAL testing spatial index on Geometry +tab 1 idx6 1 c4 A # 10 NULL BTREE +ALTER TABLE tab DISABLE KEYS; +Warnings: +Note 1031 Storage engine InnoDB of the table `test`.`tab` doesn't have this option +SHOW WARNINGS; +Level Code Message +Note 1031 Storage engine InnoDB of the table `test`.`tab` doesn't have this option +SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1); +c1 ST_Astext(c2) ST_Astext(c4) +10 POINT(160 160) POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) +UPDATE tab SET C2 = ST_GeomFromText('POINT(2000 2000)') +WHERE MBREquals(tab.c4, @g1); +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1); +c1 ST_Astext(c2) ST_Astext(c4) +10 POINT(2000 2000) POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) +DELETE FROM tab WHERE MBREquals(tab.c4, @g1); +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1); +c1 ST_Astext(c2) ST_Astext(c4) +ALTER TABLE tab DROP PRIMARY KEY; +ALTER TABLE tab ADD PRIMARY KEY(c2) ; +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1); +c1 ST_Astext(c2) ST_Astext(c4) +UPDATE tab SET C2 = ST_GeomFromText('POINT(3000 3000)') +WHERE ST_Touches(tab.c4, @g1); +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1); +c1 ST_Astext(c2) ST_Astext(c4) +DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1); +c1 ST_Astext(c2) ST_Astext(c4) +FLUSH TABLE tab FOR EXPORT; +UNLOCK TABLES; +ALTER TABLE tab DISCARD TABLESPACE; +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab; +ERROR HY000: Tablespace has been discarded for table `tab` +CHECK TABLE tab; +Table Op Msg_type Msg_text +test.tab check status OK +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab ORDER BY c1; +c1 ST_Astext(c2) ST_Astext(c4) +4 POINT(50 50) POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) +6 POINT(3 3) POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010)) +7 POINT(60 70) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010)) +8 POINT(0 0) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010)) +9 POINT(120 120) POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010)) +SET @g1 = ST_GeomFromText('LINESTRING( 3010 3010,4010 4010,5010 5010)'); +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) order by c1; +c1 ST_Astext(c2) ST_Astext(c4) +7 POINT(60 70) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010)) +8 POINT(0 0) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010)) +9 POINT(120 120) POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010)) +UPDATE tab SET c2 = ST_GeomFromText('POINT(4000 4000)') +WHERE MBRIntersects(tab.c4, @g1); +ERROR 23000: Duplicate entry '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00@\xAF@\x' for key 'PRIMARY' +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c2) ST_Astext(c4) +7 POINT(60 70) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010)) +8 POINT(0 0) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010)) +9 POINT(120 120) POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010)) +DELETE FROM tab WHERE MBRIntersects(tab.c4, @g1); +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c2) ST_Astext(c4) +INSERT INTO tab SELECT * FROM tab1; +ALTER TABLE tab DROP PRIMARY KEY; +ALTER TABLE tab DROP INDEX idx2; +CREATE TEMPORARY TABLE temp_tab AS SELECT * FROM tab where c1 = c2; +INSERT INTO temp_tab SELECT * FROM tab; +CREATE SPATIAL INDEX idx2 ON temp_tab(c2); +CREATE SPATIAL INDEX idx3 ON temp_tab(c3); +CREATE SPATIAL INDEX idx4 ON temp_tab(c4); +CREATE SPATIAL INDEX idx5 ON temp_tab(c5); +SHOW CREATE TABLE temp_tab; +Table Create Table +temp_tab CREATE TEMPORARY TABLE `temp_tab` ( + `c1` int(11) NOT NULL, + `c2` point NOT NULL, + `c3` linestring NOT NULL, + `c4` geometry NOT NULL, + `c5` geometry NOT NULL, + SPATIAL KEY `idx2` (`c2`), + SPATIAL KEY `idx3` (`c3`), + SPATIAL KEY `idx4` (`c4`), + SPATIAL KEY `idx5` (`c5`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM temp_tab WHERE MBRContains(temp_tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c2) ST_Astext(c4) +UPDATE temp_tab SET C2 = ST_GeomFromText('POINT(1000 1000)') +WHERE MBRContains(temp_tab.c4, @g1); +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM temp_tab WHERE MBRContains(temp_tab.c4, @g1); +c1 ST_Astext(c2) ST_Astext(c4) +DELETE FROM temp_tab WHERE MBRContains(temp_tab.c4, @g1); +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM temp_tab WHERE MBRContains(temp_tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c2) ST_Astext(c4) +SHOW CREATE TABLE tab; +Table Create Table +tab CREATE TABLE `tab` ( + `c1` int(11) NOT NULL, + `c2` point NOT NULL, + `c3` linestring NOT NULL, + `c4` geometry NOT NULL, + `c5` geometry NOT NULL, + SPATIAL KEY `idx3` (`c3`), + SPATIAL KEY `idx4` (`c4`) COMMENT 'testing spatial index on Polygon', + SPATIAL KEY `idx5` (`c5`) COMMENT 'testing spatial index on Geometry', + KEY `idx6` (`c4`(10)) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW INDEX FROM tab; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +tab 1 idx3 1 c3 A # 32 NULL SPATIAL +tab 1 idx4 1 c4 A # 32 NULL SPATIAL testing spatial index on Polygon +tab 1 idx5 1 c5 A # 32 NULL SPATIAL testing spatial index on Geometry +tab 1 idx6 1 c4 A # 10 NULL BTREE +DELETE FROM tab; +ALTER TABLE tab ADD PRIMARY KEY(c2); +CREATE SPATIAL INDEX idx2 ON tab(c2 ASC); +ALTER TABLE tab ADD CONSTRAINT const_1 UNIQUE(c2); +SHOW CREATE TABLE tab; +Table Create Table +tab CREATE TABLE `tab` ( + `c1` int(11) NOT NULL, + `c2` point NOT NULL, + `c3` linestring NOT NULL, + `c4` geometry NOT NULL, + `c5` geometry NOT NULL, + PRIMARY KEY (`c2`(25)), + UNIQUE KEY `const_1` (`c2`(25)), + SPATIAL KEY `idx3` (`c3`), + SPATIAL KEY `idx4` (`c4`) COMMENT 'testing spatial index on Polygon', + SPATIAL KEY `idx5` (`c5`) COMMENT 'testing spatial index on Geometry', + KEY `idx6` (`c4`(10)) USING BTREE, + SPATIAL KEY `idx2` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW INDEX FROM tab; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +tab 0 PRIMARY 1 c2 A # 25 NULL BTREE +tab 0 const_1 1 c2 A # 25 NULL BTREE +tab 1 idx3 1 c3 A # 32 NULL SPATIAL +tab 1 idx4 1 c4 A # 32 NULL SPATIAL testing spatial index on Polygon +tab 1 idx5 1 c5 A # 32 NULL SPATIAL testing spatial index on Geometry +tab 1 idx6 1 c4 A # 10 NULL BTREE +tab 1 idx2 1 c2 A # 32 NULL SPATIAL +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(1,ST_GeomFromText('POINT(10 10)'),ST_GeomFromText('LINESTRING(5 5,20 20,30 30)'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))')); +DELETE FROM tab; +ALTER TABLE tab DROP PRIMARY KEY ; +ALTER TABLE tab DROP KEY const_1; +ALTER TABLE tab ADD PRIMARY KEY(c5(10)); +ALTER TABLE tab ADD CONSTRAINT const_1 UNIQUE(c5(10)); +SHOW CREATE TABLE tab; +Table Create Table +tab CREATE TABLE `tab` ( + `c1` int(11) NOT NULL, + `c2` point NOT NULL, + `c3` linestring NOT NULL, + `c4` geometry NOT NULL, + `c5` geometry NOT NULL, + PRIMARY KEY (`c5`(10)), + UNIQUE KEY `const_1` (`c5`(10)), + SPATIAL KEY `idx3` (`c3`), + SPATIAL KEY `idx4` (`c4`) COMMENT 'testing spatial index on Polygon', + SPATIAL KEY `idx5` (`c5`) COMMENT 'testing spatial index on Geometry', + KEY `idx6` (`c4`(10)) USING BTREE, + SPATIAL KEY `idx2` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW INDEX FROM tab; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +tab 0 PRIMARY 1 c5 A # 10 NULL BTREE +tab 0 const_1 1 c5 A # 10 NULL BTREE +tab 1 idx3 1 c3 A # 32 NULL SPATIAL +tab 1 idx4 1 c4 A # 32 NULL SPATIAL testing spatial index on Polygon +tab 1 idx5 1 c5 A # 32 NULL SPATIAL testing spatial index on Geometry +tab 1 idx6 1 c4 A # 10 NULL BTREE +tab 1 idx2 1 c2 A # 32 NULL SPATIAL +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(1,ST_GeomFromText('POINT(10 10)'),ST_GeomFromText('LINESTRING(5 5,20 20,30 30)'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))')); +DROP TABLE tab,tab1,temp_tab; +CREATE TABLE tab(c1 int NOT NULL PRIMARY KEY,c2 POINT NOT NULL, +c3 LINESTRING NOT NULL,c4 POLYGON NOT NULL,c5 GEOMETRY NOT NULL) +ENGINE=InnoDB; +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(1,ST_GeomFromText('POINT(10 10)'),ST_GeomFromText('LINESTRING(5 5,20 20,30 30)'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(2,ST_GeomFromText('POINT(20 20)'),ST_GeomFromText('LINESTRING(20 20,30 30,40 40)'), +ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))'), +ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(3,ST_GeomFromText('POINT(4 4)'),ST_GeomFromText('LINESTRING(130 130,140 140,150 150)'), +ST_GeomFromText('POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'), +ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(4,ST_GeomFromText('POINT(50 50)'),ST_GeomFromText('LINESTRING(200 200,300 300,400 400)'), +ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))'), +ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(5,ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(400 400,500 500,600 700)'), +ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))'), +ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(6,ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))'), +ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(7,ST_GeomFromText('POINT(60 70)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(8,ST_GeomFromText('POINT(0 0)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(9,ST_GeomFromText('POINT(120 120)'),ST_GeomFromText('LINESTRING(100 100,110 110,120 120)'), +ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))'), +ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(10,ST_GeomFromText('POINT(160 160)'),ST_GeomFromText('LINESTRING(140 140,150 150,160 160)'), +ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'), +ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))')); +ANALYZE TABLE tab; +Table Op Msg_type Msg_text +test.tab analyze status OK +ALTER TABLE tab ADD SPATIAL INDEX idx2(c2 ASC); +ALTER TABLE tab ADD SPATIAL KEY idx3(c3 DESC); +ALTER TABLE tab ADD SPATIAL INDEX idx4(c4 ASC) COMMENT 'testing spatial index on Polygon'; +ALTER TABLE tab ADD SPATIAL KEY idx5(c5 ASC) COMMENT 'testing spatial index on Geometry'; +ALTER TABLE tab ADD INDEX idx6(c4(10)) USING BTREE; +ALTER TABLE tab MODIFY COLUMN c2 GEOMETRY NOT NULL; +ALTER TABLE tab add COLUMN c8 POINT NOT NULL, ALGORITHM = INPLACE, LOCK=NONE; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Do not support online operation on table with GIS index. Try ALGORITHM=COPY +SHOW CREATE TABLE tab; +Table Create Table +tab CREATE TABLE `tab` ( + `c1` int(11) NOT NULL, + `c2` geometry NOT NULL, + `c3` linestring NOT NULL, + `c4` polygon NOT NULL, + `c5` geometry NOT NULL, + PRIMARY KEY (`c1`), + SPATIAL KEY `idx2` (`c2`), + SPATIAL KEY `idx3` (`c3`), + SPATIAL KEY `idx4` (`c4`) COMMENT 'testing spatial index on Polygon', + SPATIAL KEY `idx5` (`c5`) COMMENT 'testing spatial index on Geometry', + KEY `idx6` (`c4`(10)) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW INDEX FROM tab; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +tab 0 PRIMARY 1 c1 A # NULL NULL BTREE +tab 1 idx2 1 c2 A # 32 NULL SPATIAL +tab 1 idx3 1 c3 A # 32 NULL SPATIAL +tab 1 idx4 1 c4 A # 32 NULL SPATIAL testing spatial index on Polygon +tab 1 idx5 1 c5 A # 32 NULL SPATIAL testing spatial index on Geometry +tab 1 idx6 1 c4 A # 10 NULL BTREE +SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); +UPDATE tab SET C2 = ST_GeomFromText('POINT(1000 1000)') +WHERE MBRContains(tab.c4, @g1); +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c2) ST_Astext(c4) +3 POINT(1000 1000) POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +DELETE FROM tab WHERE MBRContains(tab.c4, @g1); +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c2) ST_Astext(c4) +ALTER TABLE tab MODIFY COLUMN c4 GEOMETRY NOT NULL; +SHOW CREATE TABLE tab; +Table Create Table +tab CREATE TABLE `tab` ( + `c1` int(11) NOT NULL, + `c2` geometry NOT NULL, + `c3` linestring NOT NULL, + `c4` geometry NOT NULL, + `c5` geometry NOT NULL, + PRIMARY KEY (`c1`), + SPATIAL KEY `idx2` (`c2`), + SPATIAL KEY `idx3` (`c3`), + SPATIAL KEY `idx4` (`c4`) COMMENT 'testing spatial index on Polygon', + SPATIAL KEY `idx5` (`c5`) COMMENT 'testing spatial index on Geometry', + KEY `idx6` (`c4`(10)) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW INDEX FROM tab; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +tab 0 PRIMARY 1 c1 A # NULL NULL BTREE +tab 1 idx2 1 c2 A # 32 NULL SPATIAL +tab 1 idx3 1 c3 A # 32 NULL SPATIAL +tab 1 idx4 1 c4 A # 32 NULL SPATIAL testing spatial index on Polygon +tab 1 idx5 1 c5 A # 32 NULL SPATIAL testing spatial index on Geometry +tab 1 idx6 1 c4 A # 10 NULL BTREE +ANALYZE TABLE tab; +Table Op Msg_type Msg_text +test.tab analyze status OK +SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); +SET @g2 = ST_GeomFromText('LINESTRING(140 140,150 150,160 160)'); +SELECT c1,ST_Astext(c2),ST_AsText(c3),ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) +AND MBREquals(tab.c3,@g2) ORDER BY c1; +c1 ST_Astext(c2) ST_AsText(c3) ST_Astext(c4) +10 POINT(160 160) LINESTRING(140 140,150 150,160 160) POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) +UPDATE tab SET C2 = ST_GeomFromText('POINT(2000 2000)') +WHERE MBREquals(tab.c4, @g1) AND MBREquals(tab.c3,@g2); +SELECT c1,ST_Astext(c2),ST_AsText(c3),ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) +AND MBREquals(tab.c3,@g2) ORDER BY c1; +c1 ST_Astext(c2) ST_AsText(c3) ST_Astext(c4) +10 POINT(2000 2000) LINESTRING(140 140,150 150,160 160) POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) +DELETE FROM tab WHERE MBREquals(tab.c4, @g1) AND MBREquals(tab.c3,@g2); +SELECT c1,ST_Astext(c2),ST_AsText(c3),ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) +AND MBREquals(tab.c3,@g2) ORDER BY c1; +c1 ST_Astext(c2) ST_AsText(c3) ST_Astext(c4) +ANALYZE TABLE tab; +Table Op Msg_type Msg_text +test.tab analyze status OK +SET @g1 = ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))'); +SET @g2 = ST_GeomFromText('LINESTRING(1 1,2 2,3 3)'); +ALTER TABLE tab MODIFY COLUMN c2 POINT NOT NULL; +ALTER TABLE tab MODIFY COLUMN c3 LINESTRING NOT NULL; +ALTER TABLE tab MODIFY COLUMN c4 POLYGON NOT NULL; +SHOW CREATE TABLE tab; +Table Create Table +tab CREATE TABLE `tab` ( + `c1` int(11) NOT NULL, + `c2` point NOT NULL, + `c3` linestring NOT NULL, + `c4` polygon NOT NULL, + `c5` geometry NOT NULL, + PRIMARY KEY (`c1`), + SPATIAL KEY `idx2` (`c2`), + SPATIAL KEY `idx3` (`c3`), + SPATIAL KEY `idx4` (`c4`) COMMENT 'testing spatial index on Polygon', + SPATIAL KEY `idx5` (`c5`) COMMENT 'testing spatial index on Geometry', + KEY `idx6` (`c4`(10)) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW INDEX FROM tab; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +tab 0 PRIMARY 1 c1 A # NULL NULL BTREE +tab 1 idx2 1 c2 A # 32 NULL SPATIAL +tab 1 idx3 1 c3 A # 32 NULL SPATIAL +tab 1 idx4 1 c4 A # 32 NULL SPATIAL testing spatial index on Polygon +tab 1 idx5 1 c5 A # 32 NULL SPATIAL testing spatial index on Geometry +tab 1 idx6 1 c4 A # 10 NULL BTREE +ANALYZE TABLE tab; +Table Op Msg_type Msg_text +test.tab analyze status OK +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); +SET @g2 = ST_GeomFromText('LINESTRING(1 1,2 2,3 3)'); +SELECT c1,ST_Astext(c2),ST_AsText(c3),ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) +AND ST_Touches(tab.c3,@g2); +c1 ST_Astext(c2) ST_AsText(c3) ST_Astext(c4) +UPDATE tab SET C2 = ST_GeomFromText('POINT(2000 2000)') +WHERE ST_Touches(tab.c4, @g1) AND ST_Touches(tab.c3,@g2); +DELETE FROM tab WHERE ST_Touches(tab.c4, @g1) AND ST_Touches(tab.c3,@g2); +SELECT c1,ST_Astext(c2),ST_AsText(c3),ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) +AND ST_Touches(tab.c3,@g2); +c1 ST_Astext(c2) ST_AsText(c3) ST_Astext(c4) +SELECT c1,ST_Astext(c2),ST_AsText(c3),ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) +OR ST_Touches(tab.c3,@g2); +c1 ST_Astext(c2) ST_AsText(c3) ST_Astext(c4) +2 POINT(20 20) LINESTRING(20 20,30 30,40 40) POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +UPDATE tab SET C2 = ST_GeomFromText('POINT(2000 2000)') +WHERE ST_Touches(tab.c4, @g1) OR ST_Touches(tab.c3,@g2); +SELECT c1,ST_Astext(c2),ST_AsText(c3),ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) +OR ST_Touches(tab.c3,@g2); +c1 ST_Astext(c2) ST_AsText(c3) ST_Astext(c4) +2 POINT(2000 2000) LINESTRING(20 20,30 30,40 40) POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +DELETE FROM tab WHERE ST_Touches(tab.c4, @g1) OR ST_Touches(tab.c3,@g2); +SELECT c1,ST_Astext(c2),ST_AsText(c3),ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) +OR ST_Touches(tab.c3,@g2); +c1 ST_Astext(c2) ST_AsText(c3) ST_Astext(c4) +ALTER TABLE tab MODIFY COLUMN c4 INT NOT NULL; +ERROR HY000: Incorrect arguments to SPATIAL INDEX +ALTER TABLE tab MODIFY COLUMN c4 BLOB NOT NULL; +ERROR HY000: Incorrect arguments to SPATIAL INDEX +ALTER TABLE tab ENGINE Myisam; +ALTER TABLE tab ENGINE InnoDB; +ANALYZE TABLE tab; +Table Op Msg_type Msg_text +test.tab analyze status OK +SET @g1 = ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))'); +SET @g2 = ST_GeomFromText('LINESTRING(400 400,500 500,600 700)'); +SELECT c1,ST_AsText(c2),ST_AsText(c3),ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) AND MBRWithin(tab.c3, @g2); +c1 ST_AsText(c2) ST_AsText(c3) ST_Astext(c4) +5 POINT(3 3) LINESTRING(400 400,500 500,600 700) POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010)) +SET @g1 = ST_GeomFromText('POINT(2000 2000)'); +SET @g2 = ST_GeomFromText('POINT(2000 2000)'); +SELECT c1,ST_AsText(c2),ST_AsText(c3),ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c2, @g1) AND MBRWithin(tab.c3, @g2); +c1 ST_AsText(c2) ST_AsText(c3) ST_Astext(c4) +DELETE FROM tab WHERE MBRWithin(tab.c2, @g1) AND MBRWithin(tab.c3, @g2); +SELECT c1,ST_AsText(c2),ST_AsText(c3),ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c2, @g1) AND MBRWithin(tab.c3, @g2); +c1 ST_AsText(c2) ST_AsText(c3) ST_Astext(c4) +DROP TABLE tab; +CREATE TABLE parent (id POINT, PRIMARY KEY(id)) ENGINE=InnoDB; +CREATE TABLE child (id GEOMETRY NOT NULL, parent_id POINT NOT NULL) ENGINE=InnoDB; +ALTER TABLE parent ADD SPATIAL INDEX idx1(id ASC); +ALTER TABLE child ADD SPATIAL INDEX idx2(parent_id ASC); +SHOW CREATE TABLE parent; +Table Create Table +parent CREATE TABLE `parent` ( + `id` point NOT NULL, + PRIMARY KEY (`id`(25)), + SPATIAL KEY `idx1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW CREATE TABLE child; +Table Create Table +child CREATE TABLE `child` ( + `id` geometry NOT NULL, + `parent_id` point NOT NULL, + SPATIAL KEY `idx2` (`parent_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW INDEX FROM parent; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +parent 0 PRIMARY 1 id A 0 25 NULL BTREE +parent 1 idx1 1 id A NULL 32 NULL SPATIAL +SHOW INDEX FROM child; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +child 1 idx2 1 parent_id A # 32 NULL SPATIAL +ALTER TABLE child ADD FOREIGN KEY(parent_id) REFERENCES parent(id) ; +ALTER TABLE child ADD FOREIGN KEY(parent_id) REFERENCES parent(id) ON DELETE CASCADE ; +DROP table child,parent; +CREATE TABLE parent (id GEOMETRY, PRIMARY KEY(id(10))) ENGINE=InnoDB; +CREATE TABLE child (id GEOMETRY NOT NULL, parent_id GEOMETRY NOT NULL) ENGINE=InnoDB; +ALTER TABLE parent ADD SPATIAL INDEX idx1(id ASC) ; +ALTER TABLE child ADD SPATIAL INDEX idx2(parent_id ASC); +SHOW CREATE TABLE parent; +Table Create Table +parent CREATE TABLE `parent` ( + `id` geometry NOT NULL, + PRIMARY KEY (`id`(10)), + SPATIAL KEY `idx1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW CREATE TABLE child; +Table Create Table +child CREATE TABLE `child` ( + `id` geometry NOT NULL, + `parent_id` geometry NOT NULL, + SPATIAL KEY `idx2` (`parent_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW INDEX FROM parent; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +parent 0 PRIMARY 1 id A 0 10 NULL BTREE +parent 1 idx1 1 id A NULL 32 NULL SPATIAL +SHOW INDEX FROM child; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +child 1 idx2 1 parent_id A NULL 32 NULL SPATIAL +ALTER TABLE child ADD FOREIGN KEY(parent_id) REFERENCES parent(id) ; +DROP table child,parent; +create table t1 (c1 int) engine=innodb; +insert into t1 values(NULL); +alter table t1 add b geometry, add spatial index(b), algorithm=inplace; +ERROR 42000: All parts of a SPATIAL index must be NOT NULL +alter table t1 add b geometry, algorithm=inplace; +update t1 set b = st_geomfromtext('point(0 0)'); +alter table t1 add spatial index(b), algorithm=inplace; +ERROR 42000: All parts of a SPATIAL index must be NOT NULL +delete from t1; +DROP table t1; +create table t1 (c1 int) engine=innodb; +insert into t1 values(NULL); +alter table t1 add b geometry, add spatial index(b), algorithm=copy; +ERROR 42000: All parts of a SPATIAL index must be NOT NULL +alter table t1 add b geometry not null, add spatial index(b), algorithm=copy; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +update t1 set b = st_geomfromtext('point(0 0)'); +ERROR 42S22: Unknown column 'b' in 'field list' +alter table t1 add spatial index(b), algorithm=copy; +ERROR 42000: Key column 'b' doesn't exist in table +delete from t1; +DROP table t1; +# +# BUG#20111575 ALTER TABLE...ADD SPATIAL INDEX...LOCK NONE IS REFUSED +# WITHOUT STATING A REASON +# +CREATE TABLE t1(p point NOT NULL) ENGINE=innodb; +ALTER TABLE t1 ADD SPATIAL INDEX(p), LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED +ALTER TABLE t1 ADD SPATIAL INDEX(p); +ALTER TABLE t1 FORCE, LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_gis/r/check_rtree.result b/mysql-test/suite/innodb_gis/r/check_rtree.result new file mode 100644 index 00000000000..fe60a628fde --- /dev/null +++ b/mysql-test/suite/innodb_gis/r/check_rtree.result @@ -0,0 +1,15 @@ +create table t1 (i int, g geometry not null, spatial index (g))engine=innodb; +SET SESSION debug="+d,rtree_test_check_count"; +Warnings: +Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +insert into t1 values (1, POINT(1,1)); +insert into t1 values (1, POINT(1.5,1.5)); +insert into t1 values (1, POINT(3,3)); +insert into t1 values (1, POINT(3.1,3.1)); +insert into t1 values (1, POINT(5,5)); +CALL mtr.add_suppression("InnoDB: Flagged corruption of `g` in table `test`.`t1` in CHECK TABLE; Wrong count"); +check table t1; +Table Op Msg_type Msg_text +test.t1 check Warning InnoDB: Index 'g' contains 0 entries, should be 5. +test.t1 check error Corrupt +drop table t1; diff --git a/mysql-test/suite/innodb_gis/r/create_spatial_index.result b/mysql-test/suite/innodb_gis/r/create_spatial_index.result new file mode 100644 index 00000000000..1d47fd9688c --- /dev/null +++ b/mysql-test/suite/innodb_gis/r/create_spatial_index.result @@ -0,0 +1,1290 @@ +CREATE TABLE tab(c1 int NOT NULL PRIMARY KEY,c2 POINT NOT NULL, +c3 LINESTRING NOT NULL,c4 POLYGON NOT NULL,c5 GEOMETRY NOT NULL) +ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +CREATE SPATIAL INDEX idx1 on tab(c2 ASC); +CREATE SPATIAL INDEX idx2 on tab(c3 DESC) COMMENT 'wl6968'; +CREATE SPATIAL INDEX idx3 on tab(c4 ASC) KEY_BLOCK_SIZE=8 ; +CREATE SPATIAL INDEX idx4 on tab(c5 DESC) KEY_BLOCK_SIZE=4 +COMMENT 'Spatial index on Geometry type column'; +SHOW INDEXES FROM tab; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +tab 0 PRIMARY 1 c1 A 0 NULL NULL BTREE +tab 1 idx1 1 c2 A NULL 32 NULL SPATIAL +tab 1 idx2 1 c3 A NULL 32 NULL SPATIAL wl6968 +tab 1 idx3 1 c4 A NULL 32 NULL SPATIAL +tab 1 idx4 1 c5 A NULL 32 NULL SPATIAL Spatial index on Geometry type column +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(1,ST_GeomFromText('POINT(10 10)'),ST_GeomFromText('LINESTRING(5 5,20 20,30 30)'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(2,ST_GeomFromText('POINT(20 20)'),ST_GeomFromText('LINESTRING(20 20,30 30,40 40)'), +ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))'), +ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(3,ST_GeomFromText('POINT(4 4)'),ST_GeomFromText('LINESTRING(130 130,140 140,150 150)'), +ST_GeomFromText('POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'), +ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(4,ST_GeomFromText('POINT(50 50)'),ST_GeomFromText('LINESTRING(200 200,300 300,400 400)'), +ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))'), +ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(5,ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(400 400,500 500,600 700)'), +ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))'), +ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(6,ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))'), +ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(7,ST_GeomFromText('POINT(60 70)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(8,ST_GeomFromText('POINT(0 0)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(9,ST_GeomFromText('POINT(120 120)'),ST_GeomFromText('LINESTRING(100 100,110 110,120 120)'), +ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))'), +ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(10,ST_GeomFromText('POINT(160 160)'),ST_GeomFromText('LINESTRING(140 140,150 150,160 160)'), +ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'), +ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))')); +ANALYZE TABLE tab; +Table Op Msg_type Msg_text +test.tab analyze status OK +SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRContains(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText('LINESTRING( 300 300,400 400)'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRContains(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRWithin(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText('POLYGON((100 200,200 300,400 500,500 300,300 200,100 300,100 200))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Crosses(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText('LINESTRING( 10 10,30 30,40 40)'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_CRosses(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Crosses(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) +5 POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010)) +6 POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010)) +7 POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010)) +8 POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010)) +9 POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010)) +10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRDisjoint(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where +EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where +SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBREquals(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +SET @g1 = ST_GeomFromText('LINESTRING( 30 30,40 40,50 50)'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBROverlaps(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText('LINESTRING(7 1,30 30,1010 3010,1010 2010,3010 3010,4010 4010,5010 5010 )'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where +SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBROverlaps(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where +EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Touches(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +SET @g1 = ST_GeomFromText('LINESTRING( 100 100,200 200,300 300)'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Touches(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRContains(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRWithin(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) +5 POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010)) +6 POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010)) +7 POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010)) +8 POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010)) +9 POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010)) +10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRDisjoint(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where +EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where +SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBREquals(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +SET @g1 = ST_GeomFromText('LINESTRING( 30 30,40 40,50 50)'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBROverlaps(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRTouches(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +EXPLAIN DELETE FROM tab WHERE MBRTouches(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +CREATE PROCEDURE proc_wl6968() +BEGIN +SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRContains(tab.c4, @g1); +EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); +END | +CALL proc_wl6968(); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +DELETE FROM tab WHERE MBRContains(tab.c4, @g1); +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +CHECK TABLE tab; +Table Op Msg_type Msg_text +test.tab check status OK +SET @g1 = ST_GeomFromText('LINESTRING( 300 300,400 400)'); +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +DELETE FROM tab WHERE MBRContains(tab.c4, @g1); +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +CHECK TABLE tab; +Table Op Msg_type Msg_text +test.tab check status OK +SET @g1 = ST_GeomFromText('POLYGON((100 200,1010 1010,1020 1020,500 300,300 200,100 300,100 200))'); +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) +5 POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010)) +DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +CHECK TABLE tab; +Table Op Msg_type Msg_text +test.tab check status OK +SET @g1 = ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'); +SET @g2 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); +UPDATE tab SET C4 = @g2 WHERE ST_Crosses(tab.c4, @g1); +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g2) ORDER BY c1; +c1 ST_Astext(c4) +CHECK TABLE tab; +Table Op Msg_type Msg_text +test.tab check status OK +DROP TABLE tab; +DROP PROCEDURE proc_wl6968; +CREATE TABLE tab(c1 int ,c2 POINT NOT NULL, +c3 LINESTRING NOT NULL,c4 POLYGON NOT NULL,c5 GEOMETRY NOT NULL) +ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16; +CREATE SPATIAL INDEX idx1 on tab(c2 ASC); +CREATE SPATIAL INDEX idx2 on tab(c3 DESC) COMMENT 'wl6968'; +CREATE SPATIAL INDEX idx3 on tab(c4 ASC) KEY_BLOCK_SIZE=2 ; +CREATE SPATIAL INDEX idx4 on tab(c5 DESC) KEY_BLOCK_SIZE=8 +COMMENT 'Spatial index on Geometry type column'; +SHOW INDEXES FROM tab; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +tab 1 idx1 1 c2 A NULL 32 NULL SPATIAL +tab 1 idx2 1 c3 A NULL 32 NULL SPATIAL wl6968 +tab 1 idx3 1 c4 A NULL 32 NULL SPATIAL +tab 1 idx4 1 c5 A NULL 32 NULL SPATIAL Spatial index on Geometry type column +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(1,ST_GeomFromText('POINT(10 10)'),ST_GeomFromText('LINESTRING(5 5,20 20,30 30)'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(2,ST_GeomFromText('POINT(20 20)'),ST_GeomFromText('LINESTRING(20 20,30 30,40 40)'), +ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))'), +ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(3,ST_GeomFromText('POINT(4 4)'),ST_GeomFromText('LINESTRING(130 130,140 140,150 150)'), +ST_GeomFromText('POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'), +ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(4,ST_GeomFromText('POINT(50 50)'),ST_GeomFromText('LINESTRING(200 200,300 300,400 400)'), +ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))'), +ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(5,ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(400 400,500 500,600 700)'), +ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))'), +ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(6,ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))'), +ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(7,ST_GeomFromText('POINT(60 70)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(8,ST_GeomFromText('POINT(0 0)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(9,ST_GeomFromText('POINT(120 120)'),ST_GeomFromText('LINESTRING(100 100,110 110,120 120)'), +ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))'), +ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))')); +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(10,ST_GeomFromText('POINT(160 160)'),ST_GeomFromText('LINESTRING(140 140,150 150,160 160)'), +ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'), +ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))')); +ANALYZE TABLE tab; +Table Op Msg_type Msg_text +test.tab analyze status OK +SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRContains(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText('LINESTRING( 300 300,400 400)'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRContains(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRWithin(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText('POLYGON((100 200,200 300,400 500,500 300,300 200,100 300,100 200))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Crosses(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText('LINESTRING( 10 10,30 30,40 40)'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_CRosses(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Crosses(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) +5 POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010)) +6 POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010)) +7 POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010)) +8 POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010)) +9 POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010)) +10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRDisjoint(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where +EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where +SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBREquals(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +SET @g1 = ST_GeomFromText('LINESTRING( 30 30,40 40,50 50)'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBROverlaps(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText('LINESTRING(7 1,30 30,1010 3010,1010 2010,3010 3010,4010 4010,5010 5010 )'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBROverlaps(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where +EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Touches(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +SET @g1 = ST_GeomFromText('LINESTRING( 100 100,200 200,300 300)'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Touches(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRContains(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRWithin(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) +5 POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010)) +6 POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010)) +7 POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010)) +8 POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010)) +9 POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010)) +10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRDisjoint(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where +EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where +SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBREquals(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +SET @g1 = ST_GeomFromText('LINESTRING( 30 30,40 40,50 50)'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBROverlaps(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRTouches(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +EXPLAIN DELETE FROM tab WHERE MBRTouches(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +CREATE PROCEDURE proc_wl6968() +BEGIN +SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBREquals(tab.c4, @g1); +EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); +END | +CALL proc_wl6968(); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +CHECK TABLE tab; +Table Op Msg_type Msg_text +test.tab check status OK +SET @g1 = ST_GeomFromText('POLYGON((100 200,200 300,400 500,500 300,300 200,100 300,100 200))'); +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) +DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); +SET @g2 = ST_GeomFromText( 'POLYGON((1 1,2 2,3 3,10 3,5 1,1 1))'); +UPDATE tab SET C4 = @g2 WHERE MBROverlaps(tab.c4, @g1); +SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +3 POLYGON((1 1,2 2,3 3,10 3,5 1,1 1)) +CHECK TABLE tab; +Table Op Msg_type Msg_text +test.tab check status OK +DROP TABLE tab; +DROP PROCEDURE proc_wl6968; +CREATE TABLE tab(c1 int AUTO_INCREMENT PRIMARY KEY,c2 POINT NOT NULL, +c3 LINESTRING NOT NULL,c4 POLYGON NOT NULL,c5 GEOMETRY NOT NULL) +ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16; +CREATE SPATIAL INDEX idx1 on tab(c2 ASC); +CREATE SPATIAL INDEX idx2 on tab(c3 DESC) COMMENT 'wl6968'; +CREATE SPATIAL INDEX idx3 on tab(c4 ASC) KEY_BLOCK_SIZE=16 ; +CREATE SPATIAL INDEX idx4 on tab(c5 DESC) KEY_BLOCK_SIZE=16 +COMMENT 'Spatial index on Geometry type column'; +SHOW INDEXES FROM tab; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +tab 0 PRIMARY 1 c1 A 0 NULL NULL BTREE +tab 1 idx1 1 c2 A NULL 32 NULL SPATIAL +tab 1 idx2 1 c3 A NULL 32 NULL SPATIAL wl6968 +tab 1 idx3 1 c4 A NULL 32 NULL SPATIAL +tab 1 idx4 1 c5 A NULL 32 NULL SPATIAL Spatial index on Geometry type column +INSERT INTO tab(c2,c3,c4,c5) +VALUES(ST_GeomFromText('POINT(10 10)'),ST_GeomFromText('LINESTRING(5 5,20 20,30 30)'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))')); +INSERT INTO tab(c2,c3,c4,c5) +VALUES(ST_GeomFromText('POINT(20 20)'),ST_GeomFromText('LINESTRING(20 20,30 30,40 40)'), +ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))'), +ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))')); +INSERT INTO tab(c2,c3,c4,c5) +VALUES(ST_GeomFromText('POINT(4 4)'),ST_GeomFromText('LINESTRING(130 130,140 140,150 150)'), +ST_GeomFromText('POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'), +ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))')); +INSERT INTO tab(c2,c3,c4,c5) +VALUES(ST_GeomFromText('POINT(50 50)'),ST_GeomFromText('LINESTRING(200 200,300 300,400 400)'), +ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))'), +ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))')); +INSERT INTO tab(c2,c3,c4,c5) +VALUES(ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(400 400,500 500,600 700)'), +ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))'), +ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))')); +INSERT INTO tab(c2,c3,c4,c5) +VALUES(ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))'), +ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))')); +INSERT INTO tab(c2,c3,c4,c5) +VALUES(ST_GeomFromText('POINT(60 70)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))')); +INSERT INTO tab(c2,c3,c4,c5) +VALUES(ST_GeomFromText('POINT(0 0)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))')); +INSERT INTO tab(c2,c3,c4,c5) +VALUES(ST_GeomFromText('POINT(120 120)'),ST_GeomFromText('LINESTRING(100 100,110 110,120 120)'), +ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))'), +ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))')); +INSERT INTO tab(c2,c3,c4,c5) +VALUES(ST_GeomFromText('POINT(160 160)'),ST_GeomFromText('LINESTRING(140 140,150 150,160 160)'), +ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'), +ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))')); +ANALYZE TABLE tab; +Table Op Msg_type Msg_text +test.tab analyze status OK +SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRContains(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText('LINESTRING( 300 300,400 400)'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRContains(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRWithin(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText('POLYGON((100 200,200 300,400 500,500 300,300 200,100 300,100 200))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Crosses(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText('LINESTRING( 10 10,30 30,40 40)'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_CRosses(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Crosses(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) +5 POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010)) +6 POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010)) +7 POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010)) +8 POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010)) +9 POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010)) +10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRDisjoint(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where +EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where +SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBREquals(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +SET @g1 = ST_GeomFromText('LINESTRING( 30 30,40 40,50 50)'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBROverlaps(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText('LINESTRING(7 1,30 30,1010 3010,1010 2010,3010 3010,4010 4010,5010 5010 )'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where +SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBROverlaps(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where +EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Touches(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +SET @g1 = ST_GeomFromText('LINESTRING( 100 100,200 200,300 300)'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Touches(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRContains(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRWithin(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) +5 POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010)) +6 POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010)) +7 POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010)) +8 POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010)) +9 POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010)) +10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRDisjoint(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where +EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where +SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBREquals(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +SET @g1 = ST_GeomFromText('LINESTRING( 30 30,40 40,50 50)'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBROverlaps(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRTouches(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +EXPLAIN DELETE FROM tab WHERE MBRTouches(tab.c4, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); +SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) +DELETE FROM tab WHERE MBREquals(tab.c4, @g1); +SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +CHECK TABLE tab; +Table Op Msg_type Msg_text +test.tab check status OK +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) +2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) +3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) +DELETE FROM tab WHERE MBRIntersects(tab.c4, @g1); +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; +c1 ST_Astext(c4) +CHECK TABLE tab; +Table Op Msg_type Msg_text +test.tab check status OK +DROP TABLE tab; +CREATE TABLE tab(c1 POINT NOT NULL,CONSTRAINT tab_const check(c1 > 0) ) ENGINE=InnoDB; +CREATE SPATIAL INDEX idx1 ON tab(c1) ; +SHOW CREATE TABLE tab; +Table Create Table +tab CREATE TABLE `tab` ( + `c1` point NOT NULL, + SPATIAL KEY `idx1` (`c1`), + CONSTRAINT `tab_const` CHECK (`c1` > 0) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW INDEX FROM tab; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +tab 1 idx1 1 c1 A NULL 32 NULL SPATIAL +set @g1 = ST_GeomFromText('POINT(-1 -2)'); +SELECT ST_AsText(c1) FROM tab; +ST_AsText(c1) +DROP table tab; +create table `t1`(`a` geometry not null,`b` linestring not null, +primary key (`b`(192),`a`(141)),spatial key (`b`)) engine=innodb; +insert into `t1` values( +point(1,1), +linestring(point(1,1),point(1,1)) +); +insert into `t1` values +( +polygon( +linestring(point(1,1),point(1,1)), +linestring(point(1,1),point(11,1)) +), +linestring(point(1,1),point(1,1)) +); +ERROR 23000: Column 'a' cannot be null +select 1 from t1 where st_intersects( +geometrycollection(point(1,-1)),b +); +1 +drop table t1; +CREATE TABLE t1(c1 POINT NOT NULL); +DROP TABLE mysql.innodb_table_stats; +CALL mtr.add_suppression("InnoDB: Table `mysql`.`innodb_table_stats` not found."); +CALL mtr.add_suppression("InnoDB: Fetch of persistent statistics requested for table `test`.`t1` but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats instead."); +CREATE SPATIAL INDEX idx2 ON t1(c1); +DROP TABLE t1; +CREATE TABLE mysql.innodb_table_stats ( +database_name varchar(64) COLLATE utf8_bin NOT NULL, +table_name varchar(64) COLLATE utf8_bin NOT NULL, +last_update timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +n_rows bigint(20) unsigned NOT NULL, +clustered_index_size bigint(20) unsigned NOT NULL, +sum_of_other_index_sizes bigint(20) unsigned NOT NULL, +PRIMARY KEY (`database_name`,`table_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0; diff --git a/mysql-test/suite/innodb_gis/r/gis.result b/mysql-test/suite/innodb_gis/r/gis.result new file mode 100644 index 00000000000..fed7592f42b --- /dev/null +++ b/mysql-test/suite/innodb_gis/r/gis.result @@ -0,0 +1,1491 @@ +SET default_storage_engine=InnoDB; +DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; +CREATE TABLE gis_point (fid INTEGER NOT NULL PRIMARY KEY, g POINT); +CREATE TABLE gis_line (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING); +CREATE TABLE gis_polygon (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON); +CREATE TABLE gis_multi_point (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOINT); +CREATE TABLE gis_multi_line (fid INTEGER NOT NULL PRIMARY KEY, g MULTILINESTRING); +CREATE TABLE gis_multi_polygon (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOLYGON); +CREATE TABLE gis_geometrycollection (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRYCOLLECTION); +CREATE TABLE gis_geometry (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY); +SHOW FIELDS FROM gis_point; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL +g point YES NULL +SHOW FIELDS FROM gis_line; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL +g linestring YES NULL +SHOW FIELDS FROM gis_polygon; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL +g polygon YES NULL +SHOW FIELDS FROM gis_multi_point; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL +g multipoint YES NULL +SHOW FIELDS FROM gis_multi_line; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL +g multilinestring YES NULL +SHOW FIELDS FROM gis_multi_polygon; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL +g multipolygon YES NULL +SHOW FIELDS FROM gis_geometrycollection; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL +g geometrycollection YES NULL +SHOW FIELDS FROM gis_geometry; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL +g geometry YES NULL +INSERT INTO gis_point VALUES +(101, ST_PointFromText('POINT(10 10)')), +(102, ST_PointFromText('POINT(20 10)')), +(103, ST_PointFromText('POINT(20 20)')), +(104, ST_PointFromWKB(ST_AsWKB(ST_PointFromText('POINT(10 20)')))); +INSERT INTO gis_line VALUES +(105, ST_LineFromText('LINESTRING(0 0,0 10,10 0)')), +(106, ST_LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), +(107, ST_LineStringFromWKB(ST_AsWKB(LineString(Point(10, 10), Point(40, 10))))); +INSERT INTO gis_polygon VALUES +(108, ST_PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')), +(109, ST_PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')), +(110, ST_PolyFromWKB(ST_AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))))); +INSERT INTO gis_multi_point VALUES +(111, ST_MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), +(112, ST_MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), +(113, ST_MPointFromWKB(ST_AsWKB(MultiPoint(Point(3, 6), Point(4, 10))))); +INSERT INTO gis_multi_line VALUES +(114, ST_MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), +(115, ST_MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), +(116, ST_MLineFromWKB(ST_AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))))); +INSERT INTO gis_multi_polygon VALUES +(117, ST_MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), +(118, ST_MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), +(119, ST_MPolyFromWKB(ST_AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))))); +INSERT INTO gis_geometrycollection VALUES +(120, ST_GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), +(121, ST_GeometryFromWKB(ST_AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))); +INSERT into gis_geometry SELECT * FROM gis_point; +INSERT into gis_geometry SELECT * FROM gis_line; +INSERT into gis_geometry SELECT * FROM gis_polygon; +INSERT into gis_geometry SELECT * FROM gis_multi_point; +INSERT into gis_geometry SELECT * FROM gis_multi_line; +INSERT into gis_geometry SELECT * FROM gis_multi_polygon; +INSERT into gis_geometry SELECT * FROM gis_geometrycollection; +SELECT fid, ST_AsText(g) FROM gis_point; +fid ST_AsText(g) +101 POINT(10 10) +102 POINT(20 10) +103 POINT(20 20) +104 POINT(10 20) +SELECT fid, ST_AsText(g) FROM gis_line; +fid ST_AsText(g) +105 LINESTRING(0 0,0 10,10 0) +106 LINESTRING(10 10,20 10,20 20,10 20,10 10) +107 LINESTRING(10 10,40 10) +SELECT fid, ST_AsText(g) FROM gis_polygon; +fid ST_AsText(g) +108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) +110 POLYGON((0 0,30 0,30 30,0 0)) +SELECT fid, ST_AsText(g) FROM gis_multi_point; +fid ST_AsText(g) +111 MULTIPOINT(0 0,10 10,10 20,20 20) +112 MULTIPOINT(1 1,11 11,11 21,21 21) +113 MULTIPOINT(3 6,4 10) +SELECT fid, ST_AsText(g) FROM gis_multi_line; +fid ST_AsText(g) +114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) +115 MULTILINESTRING((10 48,10 21,10 0)) +116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) +SELECT fid, ST_AsText(g) FROM gis_multi_polygon; +fid ST_AsText(g) +117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) +SELECT fid, ST_AsText(g) FROM gis_geometrycollection; +fid ST_AsText(g) +120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) +121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) +SELECT fid, ST_AsText(g) FROM gis_geometry; +fid ST_AsText(g) +101 POINT(10 10) +102 POINT(20 10) +103 POINT(20 20) +104 POINT(10 20) +105 LINESTRING(0 0,0 10,10 0) +106 LINESTRING(10 10,20 10,20 20,10 20,10 10) +107 LINESTRING(10 10,40 10) +108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) +110 POLYGON((0 0,30 0,30 30,0 0)) +111 MULTIPOINT(0 0,10 10,10 20,20 20) +112 MULTIPOINT(1 1,11 11,11 21,21 21) +113 MULTIPOINT(3 6,4 10) +114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) +115 MULTILINESTRING((10 48,10 21,10 0)) +116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) +117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) +120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) +121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) +SELECT fid, ST_Dimension(g) FROM gis_geometry; +fid ST_Dimension(g) +101 0 +102 0 +103 0 +104 0 +105 1 +106 1 +107 1 +108 2 +109 2 +110 2 +111 0 +112 0 +113 0 +114 1 +115 1 +116 1 +117 2 +118 2 +119 2 +120 1 +121 1 +SELECT fid, ST_GeometryType(g) FROM gis_geometry; +fid ST_GeometryType(g) +101 POINT +102 POINT +103 POINT +104 POINT +105 LINESTRING +106 LINESTRING +107 LINESTRING +108 POLYGON +109 POLYGON +110 POLYGON +111 MULTIPOINT +112 MULTIPOINT +113 MULTIPOINT +114 MULTILINESTRING +115 MULTILINESTRING +116 MULTILINESTRING +117 MULTIPOLYGON +118 MULTIPOLYGON +119 MULTIPOLYGON +120 GEOMETRYCOLLECTION +121 GEOMETRYCOLLECTION +SELECT fid, ST_IsEmpty(g) FROM gis_geometry; +fid ST_IsEmpty(g) +101 0 +102 0 +103 0 +104 0 +105 0 +106 0 +107 0 +108 0 +109 0 +110 0 +111 0 +112 0 +113 0 +114 0 +115 0 +116 0 +117 0 +118 0 +119 0 +120 0 +121 0 +SELECT fid, ST_AsText(ST_Envelope(g)) FROM gis_geometry; +fid ST_AsText(ST_Envelope(g)) +101 POLYGON((10 10,10 10,10 10,10 10,10 10)) +102 POLYGON((20 10,20 10,20 10,20 10,20 10)) +103 POLYGON((20 20,20 20,20 20,20 20,20 20)) +104 POLYGON((10 20,10 20,10 20,10 20,10 20)) +105 POLYGON((0 0,10 0,10 10,0 10,0 0)) +106 POLYGON((10 10,20 10,20 20,10 20,10 10)) +107 POLYGON((10 10,40 10,40 10,10 10,10 10)) +108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +109 POLYGON((0 0,50 0,50 50,0 50,0 0)) +110 POLYGON((0 0,30 0,30 30,0 30,0 0)) +111 POLYGON((0 0,20 0,20 20,0 20,0 0)) +112 POLYGON((1 1,21 1,21 21,1 21,1 1)) +113 POLYGON((3 6,4 6,4 10,3 10,3 6)) +114 POLYGON((10 0,16 0,16 48,10 48,10 0)) +115 POLYGON((10 0,10 0,10 48,10 48,10 0)) +116 POLYGON((1 2,21 2,21 8,1 8,1 2)) +117 POLYGON((28 0,84 0,84 42,28 42,28 0)) +118 POLYGON((28 0,84 0,84 42,28 42,28 0)) +119 POLYGON((0 0,3 0,3 3,0 3,0 0)) +120 POLYGON((0 0,10 0,10 10,0 10,0 0)) +121 POLYGON((3 6,44 6,44 9,3 9,3 6)) +explain extended select ST_Dimension(g), ST_GeometryType(g), ST_IsEmpty(g), ST_AsText(ST_Envelope(g)) from gis_geometry; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21 # +Warnings: +Note 1003 select st_dimension(`test`.`gis_geometry`.`g`) AS `ST_Dimension(g)`,st_geometrytype(`test`.`gis_geometry`.`g`) AS `ST_GeometryType(g)`,st_isempty(`test`.`gis_geometry`.`g`) AS `ST_IsEmpty(g)`,st_astext(st_envelope(`test`.`gis_geometry`.`g`)) AS `ST_AsText(ST_Envelope(g))` from `test`.`gis_geometry` +SELECT fid, ST_X(g) FROM gis_point; +fid ST_X(g) +101 10 +102 20 +103 20 +104 10 +SELECT fid, ST_Y(g) FROM gis_point; +fid ST_Y(g) +101 10 +102 10 +103 20 +104 20 +explain extended select ST_X(g),ST_Y(g) FROM gis_point; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 # +Warnings: +Note 1003 select st_x(`test`.`gis_point`.`g`) AS `ST_X(g)`,st_y(`test`.`gis_point`.`g`) AS `ST_Y(g)` from `test`.`gis_point` +SELECT fid, ST_AsText(ST_StartPoint(g)) FROM gis_line; +fid ST_AsText(ST_StartPoint(g)) +105 POINT(0 0) +106 POINT(10 10) +107 POINT(10 10) +SELECT fid, ST_AsText(ST_EndPoint(g)) FROM gis_line; +fid ST_AsText(ST_EndPoint(g)) +105 POINT(10 0) +106 POINT(10 10) +107 POINT(40 10) +SELECT fid, ST_Length(g) FROM gis_line; +fid ST_Length(g) +105 24.14213562373095 +106 40 +107 30 +SELECT fid, ST_NumPoints(g) FROM gis_line; +fid ST_NumPoints(g) +105 3 +106 5 +107 2 +SELECT fid, ST_AsText(ST_PointN(g, 2)) FROM gis_line; +fid ST_AsText(ST_PointN(g, 2)) +105 POINT(0 10) +106 POINT(20 10) +107 POINT(40 10) +SELECT fid, ST_IsClosed(g) FROM gis_line; +fid ST_IsClosed(g) +105 0 +106 1 +107 0 +explain extended select ST_AsText(ST_StartPoint(g)),ST_AsText(ST_EndPoint(g)),ST_Length(g),ST_NumPoints(g),ST_AsText(ST_PointN(g, 2)),ST_IsClosed(g) FROM gis_line; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 # +Warnings: +Note 1003 select st_astext(st_startpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_StartPoint(g))`,st_astext(st_endpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_EndPoint(g))`,st_length(`test`.`gis_line`.`g`) AS `ST_Length(g)`,st_numpoints(`test`.`gis_line`.`g`) AS `ST_NumPoints(g)`,st_astext(st_pointn(`test`.`gis_line`.`g`,2)) AS `ST_AsText(ST_PointN(g, 2))`,st_isclosed(`test`.`gis_line`.`g`) AS `ST_IsClosed(g)` from `test`.`gis_line` +SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_polygon; +fid ST_AsText(ST_Centroid(g)) +108 POINT(15 15) +109 POINT(25.416666666666668 25.416666666666668) +110 POINT(20 10) +SELECT fid, ST_Area(g) FROM gis_polygon; +fid ST_Area(g) +108 100 +109 2400 +110 450 +SELECT fid, ST_AsText(ST_ExteriorRing(g)) FROM gis_polygon; +fid ST_AsText(ST_ExteriorRing(g)) +108 LINESTRING(10 10,20 10,20 20,10 20,10 10) +109 LINESTRING(0 0,50 0,50 50,0 50,0 0) +110 LINESTRING(0 0,30 0,30 30,0 0) +SELECT fid, ST_NumInteriorRings(g) FROM gis_polygon; +fid ST_NumInteriorRings(g) +108 0 +109 1 +110 0 +SELECT fid, ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon; +fid ST_AsText(ST_InteriorRingN(g, 1)) +108 NULL +109 LINESTRING(10 10,20 10,20 20,10 20,10 10) +110 NULL +explain extended select ST_AsText(ST_Centroid(g)),ST_Area(g),ST_AsText(ST_ExteriorRing(g)),ST_NumInteriorRings(g),ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 # +Warnings: +Note 1003 select st_astext(st_centroid(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_Centroid(g))`,st_area(`test`.`gis_polygon`.`g`) AS `ST_Area(g)`,st_astext(st_exteriorring(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_ExteriorRing(g))`,st_numinteriorrings(`test`.`gis_polygon`.`g`) AS `ST_NumInteriorRings(g)`,st_astext(st_interiorringn(`test`.`gis_polygon`.`g`,1)) AS `ST_AsText(ST_InteriorRingN(g, 1))` from `test`.`gis_polygon` +SELECT fid, ST_IsClosed(g) FROM gis_multi_line; +fid ST_IsClosed(g) +114 0 +115 0 +116 0 +SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_multi_polygon; +fid ST_AsText(ST_Centroid(g)) +117 POINT(55.58852775304245 17.426536064113982) +118 POINT(55.58852775304245 17.426536064113982) +119 POINT(2 2) +SELECT fid, ST_Area(g) FROM gis_multi_polygon; +fid ST_Area(g) +117 1684.5 +118 1684.5 +119 4.5 +SELECT fid, ST_NumGeometries(g) from gis_multi_point; +fid ST_NumGeometries(g) +111 4 +112 4 +113 2 +SELECT fid, ST_NumGeometries(g) from gis_multi_line; +fid ST_NumGeometries(g) +114 2 +115 1 +116 2 +SELECT fid, ST_NumGeometries(g) from gis_multi_polygon; +fid ST_NumGeometries(g) +117 2 +118 2 +119 1 +SELECT fid, ST_NumGeometries(g) from gis_geometrycollection; +fid ST_NumGeometries(g) +120 2 +121 2 +explain extended SELECT fid, ST_NumGeometries(g) from gis_multi_point; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 # +Warnings: +Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_numgeometries(`test`.`gis_multi_point`.`g`) AS `ST_NumGeometries(g)` from `test`.`gis_multi_point` +SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point; +fid ST_AsText(ST_GeometryN(g, 2)) +111 POINT(10 10) +112 POINT(11 11) +113 POINT(4 10) +SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_line; +fid ST_AsText(ST_GeometryN(g, 2)) +114 LINESTRING(16 0,16 23,16 48) +115 NULL +116 LINESTRING(2 5,5 8,21 7) +SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_polygon; +fid ST_AsText(ST_GeometryN(g, 2)) +117 POLYGON((59 18,67 18,67 13,59 13,59 18)) +118 POLYGON((59 18,67 18,67 13,59 13,59 18)) +119 NULL +SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_geometrycollection; +fid ST_AsText(ST_GeometryN(g, 2)) +120 LINESTRING(0 0,10 10) +121 LINESTRING(3 6,7 9) +SELECT fid, ST_AsText(ST_GeometryN(g, 1)) from gis_geometrycollection; +fid ST_AsText(ST_GeometryN(g, 1)) +120 POINT(0 0) +121 POINT(44 6) +explain extended SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 # +Warnings: +Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_astext(st_geometryn(`test`.`gis_multi_point`.`g`,2)) AS `ST_AsText(ST_GeometryN(g, 2))` from `test`.`gis_multi_point` +SELECT g1.fid as first, g2.fid as second, +MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g) as o, +MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t, +MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r +FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; +first second w c o e d t i r +120 120 1 1 0 1 0 0 1 0 +120 121 0 0 1 0 0 0 1 0 +121 120 0 0 1 0 0 0 1 0 +121 121 1 1 0 1 0 0 1 0 +explain extended SELECT g1.fid as first, g2.fid as second, +MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g) as o, +MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t, +MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r +FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE g1 ALL NULL NULL NULL NULL 2 # Using temporary; Using filesort +1 SIMPLE g2 ALL NULL NULL NULL NULL 2 # Using join buffer (flat, BNL join) +Warnings: +Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,mbrwithin(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,mbrcontains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,mbroverlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,mbrequals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,mbrdisjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,st_touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,mbrintersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,st_crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid` +DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; +CREATE TABLE t1 ( +gp point, +ln linestring, +pg polygon, +mp multipoint, +mln multilinestring, +mpg multipolygon, +gc geometrycollection, +gm geometry +); +SHOW FIELDS FROM t1; +Field Type Null Key Default Extra +gp point YES NULL +ln linestring YES NULL +pg polygon YES NULL +mp multipoint YES NULL +mln multilinestring YES NULL +mpg multipolygon YES NULL +gc geometrycollection YES NULL +gm geometry YES NULL +ALTER TABLE t1 ADD fid INT NOT NULL; +SHOW FIELDS FROM t1; +Field Type Null Key Default Extra +gp point YES NULL +ln linestring YES NULL +pg polygon YES NULL +mp multipoint YES NULL +mln multilinestring YES NULL +mpg multipolygon YES NULL +gc geometrycollection YES NULL +gm geometry YES NULL +fid int(11) NO NULL +DROP TABLE t1; +SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)')))); +ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)')))) +POINT(1 4) +explain extended SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)')))); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select st_astext(st_geometryfromwkb(st_aswkb(st_geometryfromtext('POINT(1 4)')))) AS `ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)'))))` +explain extended SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_PointFromText('POINT(1 4)')))); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select st_astext(st_geometryfromwkb(st_aswkb(st_geometryfromtext('POINT(1 4)')))) AS `ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_PointFromText('POINT(1 4)'))))` +SELECT ST_SRID(ST_GeomFromText('LineString(1 1,2 2)',101)); +ST_SRID(ST_GeomFromText('LineString(1 1,2 2)',101)) +101 +explain extended SELECT ST_SRID(ST_GeomFromText('LineString(1 1,2 2)',101)); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select srid(st_geometryfromtext('LineString(1 1,2 2)',101)) AS `ST_SRID(ST_GeomFromText('LineString(1 1,2 2)',101))` +explain extended select ST_issimple(MultiPoint(Point(3, 6), Point(4, 10))), ST_issimple(Point(3, 6)); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select st_issimple(geometrycollection(point(3,6),point(4,10))) AS `ST_issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,st_issimple(point(3,6)) AS `ST_issimple(Point(3, 6))` +create table t1 (a geometry not null); +insert into t1 values (ST_GeomFromText('Point(1 2)')); +insert into t1 values ('Garbage'); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +insert IGNORE into t1 values ('Garbage'); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +alter table t1 add spatial index(a); +drop table t1; +create table t1(a geometry not null, spatial index(a)); +insert into t1 values +(ST_GeomFromText('POINT(1 1)')), (ST_GeomFromText('POINT(3 3)')), +(ST_GeomFromText('POINT(4 4)')), (ST_GeomFromText('POINT(6 6)')); +select ST_AsText(a) from t1 where +MBRContains(ST_GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a) +or +MBRContains(ST_GeomFromText('Polygon((2 2, 2 5, 5 5, 5 2, 2 2))'), a); +ST_AsText(a) +POINT(1 1) +POINT(3 3) +POINT(4 4) +select ST_AsText(a) from t1 where +MBRContains(ST_GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a) +and +MBRContains(ST_GeomFromText('Polygon((0 0, 0 7, 7 7, 7 0, 0 0))'), a); +ST_AsText(a) +POINT(1 1) +drop table t1; +CREATE TABLE t1 (Coordinates POINT NOT NULL, SPATIAL INDEX(Coordinates)); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(383293632 1754448)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(564952612 157516260)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(903994614 180726515)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(98128178 141127631)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(862547902 799334546)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(341989013 850270906)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(803302376 93039099)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(857439153 817431356)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(319757546 343162742)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(826341972 717484432)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(305066789 201736238)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(626068992 616241497)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(55789424 755830108)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(802874458 312435220)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(153795660 551723671)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(242207428 537089292)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(553478119 807160039)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(694605552 457472733)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(987886554 792733729)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(598600363 850434457)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(592068275 940589376)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(700705362 395370650)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(33628474 558144514)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(212802006 353386020)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(901307256 39143977)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(70870451 206374045)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(240880214 696939443)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(822615542 296669638)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(452769551 625489999)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(609104858 606565210)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(177213669 851312285)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(143654501 730691787)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(658472325 838260052)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(188164520 646358878)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(630993781 786764883)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(496793334 223062055)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(727354258 197498696)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(618432704 760982731)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(755643210 831234710)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(114368751 656950466)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(870378686 185239202)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(863324511 111258900)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(882178645 685940052)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(407928538 334948195)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(311430051 17033395)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(941513405 488643719)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(868345680 85167906)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(219335507 526818004)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(923427958 407500026)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(173176882 554421738)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(194264908 669970217)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(777483793 921619165)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(867468912 395916497)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(682601897 623112122)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(227151206 796970647)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(280062588 97529892)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(982209849 143387099)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(208788792 864388493)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(829327151 616717329)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(199336688 140757201)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(633750724 140850093)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(629400920 502096404)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(226017998 848736426)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(28914408 149445955)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(256236452 202091290)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(703867693 450501360)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(872061506 481351486)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(372120524 739530418)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(877267982 54722420)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(362642540 104419188)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(851693067 642705127)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(201949080 833902916)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(786092225 410737872)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(698291409 615419376)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(27455201 897628096)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(756176576 661205925)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(38478189 385577496)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(163302328 264496186)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(234313922 192216735)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(413942141 490550373)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(394308025 117809834)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(941051732 266369530)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(599161319 313172256)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(5899948 476429301)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(367894677 368542487)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(580848489 219587743)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(11247614 782797569)')); +drop table t1; +create table t1 select ST_GeomFromWKB(POINT(1,3)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `ST_GeomFromWKB(POINT(1,3))` geometry DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1; +SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; +CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo` +geometry NOT NULL default ''); +SET sql_mode = default; +insert into t1 values ('85984',ST_GeomFromText('MULTIPOLYGON(((-115.006363 +36.305435,-114.992394 36.305202,-114.991219 36.305975,-114.991163 +36.306845,-114.989432 36.309452,-114.978275 36.312642,-114.977363 +36.311978,-114.975327 36.312344,-114.96502 36.31597,-114.963364 +36.313629,-114.961723 36.313721,-114.956398 36.316057,-114.951882 +36.320979,-114.947073 36.323475,-114.945207 36.326451,-114.945207 +36.326451,-114.944132 36.326061,-114.94003 36.326588,-114.924017 +36.334484,-114.923281 36.334146,-114.92564 36.331504,-114.94072 +36.319282,-114.945348 36.314812,-114.948091 36.314762,-114.951755 +36.316211,-114.952446 36.313883,-114.952644 36.309488,-114.944725 +36.313083,-114.93706 36.32043,-114.932478 36.323497,-114.924556 +36.327708,-114.922608 36.329715,-114.92009 36.328695,-114.912105 +36.323566,-114.901647 36.317952,-114.897436 36.313968,-114.895344 +36.309573,-114.891699 36.304398,-114.890569 36.303551,-114.886356 +36.302702,-114.885141 36.301351,-114.885709 36.297391,-114.892499 +36.290893,-114.902142 36.288974,-114.904941 36.288838,-114.905308 +36.289845,-114.906325 36.290395,-114.909916 36.289549,-114.914527 +36.287535,-114.918797 36.284423,-114.922982 36.279731,-114.924113 +36.277282,-114.924057 36.275817,-114.927733 36.27053,-114.929354 +36.269029,-114.929354 36.269029,-114.950856 36.268715,-114.950768 +36.264324,-114.960206 36.264293,-114.960301 36.268943,-115.006662 +36.268929,-115.008583 36.265619,-115.00665 36.264247,-115.006659 +36.246873,-115.006659 36.246873,-115.006838 36.247697,-115.010764 +36.247774,-115.015609 36.25113,-115.015765 36.254505,-115.029517 +36.254619,-115.038573 36.249317,-115.038573 36.249317,-115.023403 +36.25841,-115.023873 36.258994,-115.031845 36.259829,-115.03183 +36.261053,-115.025561 36.261095,-115.036417 36.274632,-115.033729 +36.276041,-115.032217 36.274851,-115.029845 36.273959,-115.029934 +36.274966,-115.025763 36.274896,-115.025406 36.281044,-115.028731 +36.284471,-115.036497 36.290377,-115.042071 36.291039,-115.026759 +36.298478,-115.008995 36.301966,-115.006363 36.305435),(-115.079835 +36.244369,-115.079735 36.260186,-115.076435 36.262369,-115.069758 +36.265,-115.070235 36.268757,-115.064542 36.268655,-115.061843 +36.269857,-115.062676 36.270693,-115.06305 36.272344,-115.059051 +36.281023,-115.05918 36.283008,-115.060591 36.285246,-115.061913 +36.290022,-115.062499 36.306353,-115.062499 36.306353,-115.060918 +36.30642,-115.06112 36.289779,-115.05713 36.2825,-115.057314 +36.279446,-115.060779 36.274659,-115.061366 36.27209,-115.057858 +36.26557,-115.055805 36.262883,-115.054688 36.262874,-115.047335 +36.25037,-115.044234 36.24637,-115.052434 36.24047,-115.061734 +36.23507,-115.061934 36.22677,-115.061934 36.22677,-115.061491 +36.225267,-115.062024 36.218194,-115.060134 36.218278,-115.060133 +36.210771,-115.057833 36.210771,-115.057433 36.196271,-115.062233 +36.196271,-115.062233 36.190371,-115.062233 36.190371,-115.065533 +36.190371,-115.071333 36.188571,-115.098331 36.188275,-115.098331 +36.188275,-115.098435 36.237569,-115.097535 36.240369,-115.097535 +36.240369,-115.093235 36.240369,-115.089135 36.240469,-115.083135 +36.240569,-115.083135 36.240569,-115.079835 +36.244369)))')),('85998',ST_GeomFromText('MULTIPOLYGON(((-115.333107 +36.264587,-115.333168 36.280638,-115.333168 36.280638,-115.32226 +36.280643,-115.322538 36.274311,-115.327222 36.274258,-115.32733 +36.263026,-115.330675 36.262984,-115.332132 36.264673,-115.333107 +36.264587),(-115.247239 36.247066,-115.247438 36.218267,-115.247438 +36.218267,-115.278525 36.219263,-115.278525 36.219263,-115.301545 +36.219559,-115.332748 36.219197,-115.332757 36.220041,-115.332757 +36.220041,-115.332895 36.233514,-115.349023 36.233479,-115.351489 +36.234475,-115.353681 36.237021,-115.357106 36.239789,-115.36519 +36.243331,-115.368156 36.243487,-115.367389 36.244902,-115.364553 +36.246014,-115.359219 36.24616,-115.356186 36.248025,-115.353347 +36.248004,-115.350813 36.249507,-115.339673 36.25387,-115.333069 +36.255018,-115.333069 36.255018,-115.333042 36.247767,-115.279039 +36.248666,-115.263639 36.247466,-115.263839 36.252766,-115.261439 +36.252666,-115.261439 36.247366,-115.247239 36.247066)))')); +select object_id, ST_geometrytype(geo), ST_ISSIMPLE(GEO), ST_ASTEXT(ST_centroid(geo)) from +t1 where object_id=85998; +object_id ST_geometrytype(geo) ST_ISSIMPLE(GEO) ST_ASTEXT(ST_centroid(geo)) +85998 MULTIPOLYGON 1 POINT(115.31877315203187 -36.23747282102153) +select object_id, ST_geometrytype(geo), ST_ISSIMPLE(GEO), ST_ASTEXT(ST_centroid(geo)) from +t1 where object_id=85984; +object_id ST_geometrytype(geo) ST_ISSIMPLE(GEO) ST_ASTEXT(ST_centroid(geo)) +85984 MULTIPOLYGON 1 POINT(-114.87787186923313 36.33101763469059) +drop table t1; +create table t1 (fl geometry not null); +insert into t1 values (1); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +insert into t1 values (1.11); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +insert into t1 values ("qwerty"); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +insert into t1 values (ST_pointfromtext('point(1,1)')); +ERROR 23000: Column 'fl' cannot be null +drop table t1; +select (ST_asWKT(ST_geomfromwkb((0x000000000140240000000000004024000000000000)))); +(ST_asWKT(ST_geomfromwkb((0x000000000140240000000000004024000000000000)))) +POINT(10 10) +select (ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440)))); +(ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440)))) +POINT(10 10) +create table t1 (g GEOMETRY); +select * from t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 g g 255 4294967295 0 Y 144 0 63 +g +select ST_asbinary(g) from t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def ST_asbinary(g) 252 4294967295 0 Y 128 0 63 +ST_asbinary(g) +drop table t1; +create table t1 (a TEXT, b GEOMETRY NOT NULL, SPATIAL KEY(b)); +alter table t1 disable keys; +Warnings: +Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option +load data infile '../../std_data/bad_gis_data.dat' into table t1; +ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'b' at row 1 +alter table t1 enable keys; +Warnings: +Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option +drop table t1; +create table t1 (a int, b blob); +insert into t1 values (1, ''), (2, NULL), (3, '1'); +select * from t1; +a b +1 +2 NULL +3 1 +select +ST_geometryfromtext(b) IS NULL, ST_geometryfromwkb(b) IS NULL, ST_astext(b) IS NULL, +ST_aswkb(b) IS NULL, ST_geometrytype(b) IS NULL, ST_centroid(b) IS NULL, +ST_envelope(b) IS NULL, ST_startpoint(b) IS NULL, ST_endpoint(b) IS NULL, +ST_exteriorring(b) IS NULL, ST_pointn(b, 1) IS NULL, ST_geometryn(b, 1) IS NULL, +ST_interiorringn(b, 1) IS NULL, multipoint(b) IS NULL, ST_isempty(b) IS NULL, +ST_issimple(b) IS NULL, ST_isclosed(b) IS NULL, ST_dimension(b) IS NULL, +ST_numgeometries(b) IS NULL, ST_numinteriorrings(b) IS NULL, ST_numpoints(b) IS NULL, +ST_area(b) IS NULL, ST_length(b) IS NULL, ST_srid(b) IS NULL, ST_x(b) IS NULL, +ST_y(b) IS NULL +from t1; +ERROR 22007: Illegal non geometric '`test`.`t1`.`b`' value found during parsing +select +MBRwithin(b, b) IS NULL, MBRcontains(b, b) IS NULL, MBRoverlaps(b, b) IS NULL, +MBRequals(b, b) IS NULL, MBRdisjoint(b, b) IS NULL, ST_touches(b, b) IS NULL, +MBRintersects(b, b) IS NULL, ST_crosses(b, b) IS NULL +from t1; +MBRwithin(b, b) IS NULL MBRcontains(b, b) IS NULL MBRoverlaps(b, b) IS NULL MBRequals(b, b) IS NULL MBRdisjoint(b, b) IS NULL ST_touches(b, b) IS NULL MBRintersects(b, b) IS NULL ST_crosses(b, b) IS NULL +1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 +select +point(b, b) IS NULL, linestring(b) IS NULL, polygon(b) IS NULL, multipoint(b) IS NULL, +multilinestring(b) IS NULL, multipolygon(b) IS NULL, +geometrycollection(b) IS NULL +from t1; +ERROR 22007: Illegal non geometric '`test`.`t1`.`b`' value found during parsing +drop table t1; +CREATE TABLE t1(a POINT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1; +a +NULL +DROP TABLE t1; +CREATE TABLE `t1` ( `col9` set('a'), `col89` date); +INSERT IGNORE INTO `t1` VALUES ('','0000-00-00'); +select ST_geomfromtext(col9,col89) as a from t1; +a +NULL +DROP TABLE t1; +CREATE TABLE t1 ( +geomdata polygon NOT NULL, +SPATIAL KEY index_geom (geomdata) +) ENGINE=MyISAM DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED; +CREATE TABLE t2 ( +geomdata polygon NOT NULL, +SPATIAL KEY index_geom (geomdata) +) ENGINE=MyISAM DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED; +CREATE TABLE t3 +select +ST_aswkb(ws.geomdata) AS geomdatawkb +from +t1 ws +union +select +ST_aswkb(ws.geomdata) AS geomdatawkb +from +t2 ws; +describe t3; +Field Type Null Key Default Extra +geomdatawkb longblob YES NULL +drop table t1; +drop table t2; +drop table t3; +create table t1(col1 geometry default null,col15 geometrycollection not +null,spatial index(col15),index(col1(15)))engine=innodb; +insert into t1 set col15 = ST_GeomFromText('POINT(6 5)'); +insert into t1 set col15 = ST_GeomFromText('POINT(6 5)'); +check table t1 extended; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; +End of 4.1 tests +create table t1 (s1 geometry not null,s2 char(100)); +create trigger t1_bu before update on t1 for each row set new.s1 = null; +insert into t1 values (null,null); +ERROR 23000: Column 's1' cannot be null +drop table t1; +drop procedure if exists fn3; +create function fn3 () returns point deterministic return ST_GeomFromText("point(1 1)"); +show create function fn3; +Function sql_mode Create Function character_set_client collation_connection Database Collation +fn3 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS point + DETERMINISTIC +return ST_GeomFromText("point(1 1)") latin1 latin1_swedish_ci latin1_swedish_ci +select ST_astext(fn3()); +ST_astext(fn3()) +POINT(1 1) +drop function fn3; +create table t1(pt POINT); +alter table t1 add primary key pti(pt); +drop table t1; +create table t1(pt GEOMETRY); +alter table t1 add primary key pti(pt); +ERROR 42000: BLOB/TEXT column 'pt' used in key specification without a key length +alter table t1 add primary key pti(pt(20)); +drop table t1; +create table t1 select ST_GeomFromText('point(1 1)'); +desc t1; +Field Type Null Key Default Extra +ST_GeomFromText('point(1 1)') geometry YES NULL +drop table t1; +create table t1 (g geometry not null); +insert into t1 values(default); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +drop table t1; +CREATE TABLE t1 (a GEOMETRY); +CREATE VIEW v1 AS SELECT ST_GeomFromwkb(ST_ASBINARY(a)) FROM t1; +CREATE VIEW v2 AS SELECT a FROM t1; +DESCRIBE v1; +Field Type Null Key Default Extra +ST_GeomFromwkb(ST_ASBINARY(a)) geometry YES NULL +DESCRIBE v2; +Field Type Null Key Default Extra +a geometry YES NULL +DROP VIEW v1,v2; +DROP TABLE t1; +create table t1 (name VARCHAR(100), square GEOMETRY); +INSERT INTO t1 VALUES("center", ST_GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))')); +INSERT INTO t1 VALUES("small", ST_GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))')); +INSERT INTO t1 VALUES("big", ST_GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))')); +INSERT INTO t1 VALUES("up", ST_GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))')); +INSERT INTO t1 VALUES("up2", ST_GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))')); +INSERT INTO t1 VALUES("up3", ST_GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))')); +INSERT INTO t1 VALUES("down", ST_GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))')); +INSERT INTO t1 VALUES("down2", ST_GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))')); +INSERT INTO t1 VALUES("down3", ST_GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))')); +INSERT INTO t1 VALUES("right", ST_GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))')); +INSERT INTO t1 VALUES("right2", ST_GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))')); +INSERT INTO t1 VALUES("right3", ST_GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))')); +INSERT INTO t1 VALUES("left", ST_GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))')); +INSERT INTO t1 VALUES("left2", ST_GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))')); +INSERT INTO t1 VALUES("left3", ST_GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))')); +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrcontains +center,small +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrdisjoint +down3,left3,right3,up3 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequals FROM t1 a1 JOIN t1 a2 ON MBREquals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrequals +center +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrintersect +big,center,down,down2,left,left2,right,right2,small,up,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbroverlaps +down,left,right,up +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrtouches +down2,left2,right2,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrwithin +big,center +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +MBRcontains +center,small +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +MBRdisjoint +down3,left3,right3,up3 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRequals FROM t1 a1 JOIN t1 a2 ON MBREquals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +MBRequals +center +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +intersect +big,center,down,down2,left,left2,right,right2,small,up,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRoverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +MBRoverlaps +down,left,right,up +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS ST_touches FROM t1 a1 JOIN t1 a2 ON ST_Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +ST_touches +down2,left2,right2,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +MBRwithin +big,center +SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))'); +SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))'); +SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))'); +SET @horiz3 = ST_GeomFromText('POLYGON ((2 0, 3 0, 2 0))'); +SET @point1 = ST_GeomFromText('POLYGON ((0 0))'); +SET @point2 = ST_GeomFromText('POLYGON ((-2 0))'); +SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @vert1) GROUP BY a1.name; +MBRoverlaps +SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @horiz1) GROUP BY a1.name; +MBRoverlaps +SELECT MBROverlaps(@horiz1, @vert1) FROM DUAL; +MBROverlaps(@horiz1, @vert1) +0 +SELECT MBROverlaps(@horiz1, @horiz2) FROM DUAL; +MBROverlaps(@horiz1, @horiz2) +1 +SELECT MBROverlaps(@horiz1, @horiz3) FROM DUAL; +MBROverlaps(@horiz1, @horiz3) +0 +SELECT MBROverlaps(@horiz1, @point1) FROM DUAL; +MBROverlaps(@horiz1, @point1) +0 +SELECT MBROverlaps(@horiz1, @point2) FROM DUAL; +MBROverlaps(@horiz1, @point2) +0 +DROP TABLE t1; +create table t1(f1 geometry, f2 polygon, f3 linestring); +select f1 from t1 union select f1 from t1; +f1 +insert into t1 (f2,f3) values (ST_GeomFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))'), ST_GeomFromText('LINESTRING(0 0,1 1,2 2)')); +select ST_AsText(f2),ST_AsText(f3) from t1; +ST_AsText(f2) ST_AsText(f3) +POLYGON((10 10,20 10,20 20,10 20,10 10)) LINESTRING(0 0,1 1,2 2) +select ST_AsText(a) from (select f2 as a from t1 union select f3 from t1) t; +ST_AsText(a) +POLYGON((10 10,20 10,20 20,10 20,10 10)) +LINESTRING(0 0,1 1,2 2) +create table t2 as select f2 as a from t1 union select f3 from t1; +desc t2; +Field Type Null Key Default Extra +a geometry YES NULL +select ST_AsText(a) from t2; +ST_AsText(a) +POLYGON((10 10,20 10,20 20,10 20,10 10)) +LINESTRING(0 0,1 1,2 2) +drop table t1, t2; +SELECT 1; +1 +1 +CREATE TABLE t1 (p POINT); +CREATE TABLE t2 (p POINT, INDEX(p)); +INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)')); +INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)')); +SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +1 +EXPLAIN +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref p p 28 const 1 Using where +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +1 +INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)')); +INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)')); +EXPLAIN +SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +2 +EXPLAIN +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref p p 28 const # Using where +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +2 +EXPLAIN +SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +2 +DROP TABLE t1, t2; +End of 5.0 tests +# +# Test for bug #58650 "Failing assertion: primary_key_no == -1 || +# primary_key_no == 0". +# +drop table if exists t1; +# The minimal test case. +create table t1 (a int not null, b linestring not null, unique key b (b(12)), unique key a (a)); +drop table t1; +# The original test case. +create table t1 (a int not null, b linestring not null, unique key b (b(12))); +create unique index a on t1(a); +drop table t1; +create table `t1` (`col002` point)engine=innodb; +insert into t1 values (),(),(); +select min(`col002`) from t1 union select `col002` from t1; +min(`col002`) +NULL +drop table t1; +# +# Bug #47780: crash when comparing GIS items from subquery +# +CREATE TABLE t1(a INT, b MULTIPOLYGON); +INSERT INTO t1 VALUES +(0, +ST_GEOMFROMTEXT( +'multipolygon(((1 2,3 4,5 6,7 8,9 8,1 2,1 2),(7 6,5 4,3 2,1 2,3 4,7 6)))')); +# must not crash +SELECT 1 FROM t1 WHERE a <> (SELECT ST_GEOMETRYCOLLECTIONFROMWKB(b) FROM t1); +1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x06\x00\x00\x00\x01\x00\x00\x00\x01\x03\x00\x00\x00\x02\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00' +DROP TABLE t1; +# +# Bug #49250 : spatial btree index corruption and crash +# Part one : spatial syntax check +# +CREATE TABLE t1(col1 MULTIPOLYGON NOT NULL, +SPATIAL INDEX USING BTREE (col1)); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING BTREE (col1))' at line 2 +CREATE TABLE t2(col1 MULTIPOLYGON NOT NULL); +CREATE SPATIAL INDEX USING BTREE ON t2(col); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING BTREE ON t2(col)' at line 1 +ALTER TABLE t2 ADD SPATIAL INDEX USING BTREE (col1); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING BTREE (col1)' at line 1 +DROP TABLE t2; +End of 5.0 tests +create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime); +create view v1 as select * from t1; +desc v1; +Field Type Null Key Default Extra +f1 tinyint(1) YES NULL +f2 char(1) YES NULL +f3 varchar(1) YES NULL +f4 geometry YES NULL +f5 datetime YES NULL +drop view v1; +drop table t1; +SELECT MultiPoint(12345,''); +ERROR 22007: Illegal non geometric '12345' value found during parsing +SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUAL) AS d WHERE (LINESTRING(d.b)); +ERROR 22007: Illegal non geometric ''00000'' value found during parsing +# +# BUG#51875: crash when loading data into geometry function ST_polyfromwkb +# +SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; +SET @a=ST_POLYFROMWKB(@a); +SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; +SET @a=ST_POLYFROMWKB(@a); +create table t1(a polygon NOT NULL)engine=innodb; +insert into t1 values (ST_geomfromtext("point(0 1)")); +ERROR 22007: Incorrect POLYGON value: 'POINT' for column 'a' at row 1 +insert into t1 values (ST_geomfromtext("point(1 0)")); +ERROR 22007: Incorrect POLYGON value: 'POINT' for column 'a' at row 1 +select * from (select polygon(t1.a) as p from t1 order by t1.a) d; +p +drop table t1; +# +# Test for bug #59888 "debug assertion when attempt to create spatial index +# on char > 31 bytes". +# +create table t1(a char(32) not null) engine=innodb; +create spatial index i on t1 (a); +ERROR HY000: Incorrect arguments to SPATIAL INDEX +drop table t1; +End of 5.1 tests +CREATE TABLE t0 (a BINARY(32) NOT NULL); +CREATE SPATIAL INDEX i on t0 (a); +ERROR HY000: Incorrect arguments to SPATIAL INDEX +INSERT INTO t0 VALUES (1); +CREATE TABLE t1( +col0 BINARY NOT NULL, +col2 TIMESTAMP, +SPATIAL INDEX i1 (col0) +) ENGINE=MyISAM; +ERROR HY000: Incorrect arguments to SPATIAL INDEX +CREATE TABLE t1 ( +col0 BINARY NOT NULL, +col2 TIMESTAMP +) ENGINE=MyISAM; +CREATE SPATIAL INDEX idx0 ON t1(col0); +ERROR HY000: Incorrect arguments to SPATIAL INDEX +ALTER TABLE t1 ADD SPATIAL INDEX i1 (col0); +ERROR HY000: Incorrect arguments to SPATIAL INDEX +CREATE TABLE t2 ( +col0 INTEGER NOT NULL, +col1 POINT, +col2 POINT +); +CREATE SPATIAL INDEX idx0 ON t2 (col1, col2); +ERROR HY000: Incorrect arguments to SPATIAL INDEX +CREATE TABLE t3 ( +col0 INTEGER NOT NULL, +col1 POINT, +col2 LINESTRING, +SPATIAL INDEX i1 (col1, col2) +); +ERROR HY000: Incorrect arguments to SPATIAL INDEX +DROP TABLE t0, t1, t2; +# +# BUG#12414917 - ST_ISCLOSED() CRASHES ON 64-BIT BUILDS +# +SELECT ST_ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20))); +ST_ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20))) +-1 +# +# 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 +(a geometry NOT NULL, UNIQUE KEY i (a(151))) engine=innodb; +INSERT INTO g1 VALUES (ST_geomfromtext('point(1 1)')); +INSERT INTO g1 VALUES (ST_geomfromtext('point(1 2)')); +FLUSH TABLES; +SELECT 1 FROM g1 +FORCE INDEX(i) WHERE a = date_sub(now(), interval 2808.4 year_month) +; +1 +Warnings: +Warning 1292 Incorrect datetime value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF0?\x00\x00\x00\x00\x00\x00\xF0?' +Warning 1441 Datetime function: datetime field overflow +Warning 1292 Incorrect datetime value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF0?\x00\x00\x00\x00\x00\x00\x00@' +DROP TABLE g1; +# +# Bug#13013970 MORE CRASHES IN FIELD_BLOB::GET_KEY_IMAGE +# +CREATE TABLE g1(a TEXT NOT NULL, KEY(a(255))); +INSERT INTO g1 VALUES ('a'),('a'); +SELECT 1 FROM g1 WHERE a >= ANY +(SELECT 1 FROM g1 WHERE a = ST_geomfromtext('') OR a) ; +1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'a' +DROP TABLE g1; +End of 5.5 tests +DROP DATABASE IF EXISTS gis_ogs; +CREATE DATABASE gis_ogs; +USE gis_ogs; +# +# C.3.3.1 Geometry types and functions schema construction +# +CREATE TABLE lakes ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +shore POLYGON); +CREATE TABLE road_segments ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +aliases CHARACTER VARYING(64), +num_lanes INTEGER, +centerline LINESTRING); +CREATE TABLE divided_routes ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +num_lanes INTEGER, +centerlines MULTILINESTRING); +CREATE TABLE forests ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +boundary MULTIPOLYGON); +CREATE TABLE bridges ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +position POINT); +CREATE TABLE streams ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +centerline LINESTRING); +CREATE TABLE buildings ( +fid INTEGER NOT NULL PRIMARY KEY, +address CHARACTER VARYING(64), +position POINT, +footprint POLYGON); +CREATE TABLE ponds ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +type CHARACTER VARYING(64), +shores MULTIPOLYGON); +CREATE TABLE named_places ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +boundary POLYGON); +CREATE TABLE map_neatlines ( +fid INTEGER NOT NULL PRIMARY KEY, +neatline POLYGON); +# +# C.3.3.2 Geometry types and functions schema data loading +# +# Lakes +INSERT INTO lakes VALUES ( +101, 'BLUE LAKE', +ST_PolyFromText( +'POLYGON( +(52 18,66 23,73 9,48 6,52 18), +(59 18,67 18,67 13,59 13,59 18) +)', +101)); +# Road Segments +INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2, +ST_LineFromText( +'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101)); +INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4, +ST_LineFromText( +'LINESTRING( 44 31, 56 34, 70 38 )' ,101)); +INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2, +ST_LineFromText( +'LINESTRING( 70 38, 72 48 )' ,101)); +INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4, +ST_LineFromText( +'LINESTRING( 70 38, 84 42 )' ,101)); +INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL, +1, +ST_LineFromText( +'LINESTRING( 28 26, 28 0 )',101)); +# DividedRoutes +INSERT INTO divided_routes VALUES(119, 'Route 75', 4, +ST_MLineFromText( +'MULTILINESTRING((10 48,10 21,10 0), +(16 0,16 23,16 48))', 101)); +# Forests +INSERT INTO forests VALUES(109, 'Green Forest', +ST_MPolyFromText( +'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26), +(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))', +101)); +# Bridges +INSERT INTO bridges VALUES(110, 'Cam Bridge', ST_PointFromText( +'POINT( 44 31 )', 101)); +# Streams +INSERT INTO streams VALUES(111, 'Cam Stream', +ST_LineFromText( +'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101)); +INSERT INTO streams VALUES(112, NULL, +ST_LineFromText( +'LINESTRING( 76 0, 78 4, 73 9 )', 101)); +# Buildings +INSERT INTO buildings VALUES(113, '123 Main Street', +ST_PointFromText( +'POINT( 52 30 )', 101), +ST_PolyFromText( +'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101)); +INSERT INTO buildings VALUES(114, '215 Main Street', +ST_PointFromText( +'POINT( 64 33 )', 101), +ST_PolyFromText( +'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101)); +# Ponds +INSERT INTO ponds VALUES(120, NULL, 'Stock Pond', +ST_MPolyFromText( +'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ), +( ( 26 44, 26 40, 28 42, 26 44) ) )', 101)); +# Named Places +INSERT INTO named_places VALUES(117, 'Ashton', +ST_PolyFromText( +'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101)); +INSERT INTO named_places VALUES(118, 'Goose Island', +ST_PolyFromText( +'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101)); +# Map Neatlines +INSERT INTO map_neatlines VALUES(115, +ST_PolyFromText( +'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101)); +# +# C.3.3.3 Geometry types and functions schema test queries + +# Conformance Item T6 +SELECT ST_Dimension(shore) +FROM lakes +WHERE name = 'Blue Lake'; +ST_Dimension(shore) +2 +# Conformance Item T7 +SELECT ST_GeometryType(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; +ST_GeometryType(centerlines) +MULTILINESTRING +# Conformance Item T8 +SELECT ST_AsText(boundary) +FROM named_places +WHERE name = 'Goose Island'; +ST_AsText(boundary) +POLYGON((67 13,67 18,59 18,59 13,67 13)) +# Conformance Item T9 +SELECT ST_AsText(ST_PolyFromWKB(ST_AsBinary(boundary),101)) +FROM named_places +WHERE name = 'Goose Island'; +ST_AsText(ST_PolyFromWKB(ST_AsBinary(boundary),101)) +POLYGON((67 13,67 18,59 18,59 13,67 13)) +# Conformance Item T10 +SELECT ST_SRID(boundary) +FROM named_places +WHERE name = 'Goose Island'; +ST_SRID(boundary) +101 +# Conformance Item T11 +SELECT ST_IsEmpty(centerline) +FROM road_segments +WHERE name = 'Route 5' +AND aliases = 'Main Street'; +ST_IsEmpty(centerline) +0 +# Conformance Item T14 +SELECT ST_AsText(ST_Envelope(boundary)) +FROM named_places +WHERE name = 'Goose Island'; +ST_AsText(ST_Envelope(boundary)) +POLYGON((59 13,67 13,67 18,59 18,59 13)) +# Conformance Item T15 +SELECT ST_X(position) +FROM bridges +WHERE name = 'Cam Bridge'; +ST_X(position) +44 +# Conformance Item T16 +SELECT ST_Y(position) +FROM bridges +WHERE name = 'Cam Bridge'; +ST_Y(position) +31 +# Conformance Item T17 +SELECT ST_AsText(ST_StartPoint(centerline)) +FROM road_segments +WHERE fid = 102; +ST_AsText(ST_StartPoint(centerline)) +POINT(0 18) +# Conformance Item T18 +SELECT ST_AsText(ST_EndPoint(centerline)) +FROM road_segments +WHERE fid = 102; +ST_AsText(ST_EndPoint(centerline)) +POINT(44 31) +# Conformance Item T21 +SELECT ST_Length(centerline) +FROM road_segments +WHERE fid = 106; +ST_Length(centerline) +26 +# Conformance Item T22 +SELECT ST_NumPoints(centerline) +FROM road_segments +WHERE fid = 102; +ST_NumPoints(centerline) +5 +# Conformance Item T23 +SELECT ST_AsText(ST_PointN(centerline, 1)) +FROM road_segments +WHERE fid = 102; +ST_AsText(ST_PointN(centerline, 1)) +POINT(0 18) +# Conformance Item T24 +SELECT ST_AsText(ST_Centroid(boundary)) +FROM named_places +WHERE name = 'Goose Island'; +ST_AsText(ST_Centroid(boundary)) +POINT(63 15.5) +# Conformance Item T26 +SELECT ST_Area(boundary) +FROM named_places +WHERE name = 'Goose Island'; +ST_Area(boundary) +40 +# Conformance Item T27 +SELECT ST_AsText(ST_ExteriorRing(shore)) +FROM lakes +WHERE name = 'Blue Lake'; +ST_AsText(ST_ExteriorRing(shore)) +LINESTRING(52 18,66 23,73 9,48 6,52 18) +# Conformance Item T28 +SELECT ST_NumInteriorRings(shore) +FROM lakes +WHERE name = 'Blue Lake'; +ST_NumInteriorRings(shore) +1 +# Conformance Item T29 +SELECT ST_AsText(ST_InteriorRingN(shore, 1)) +FROM lakes +WHERE name = 'Blue Lake'; +ST_AsText(ST_InteriorRingN(shore, 1)) +LINESTRING(59 18,67 18,67 13,59 13,59 18) +# Conformance Item T30 +SELECT ST_NumGeometries(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; +ST_NumGeometries(centerlines) +2 +# Conformance Item T31 +SELECT ST_AsText(ST_GeometryN(centerlines, 2)) +FROM divided_routes +WHERE name = 'Route 75'; +ST_AsText(ST_GeometryN(centerlines, 2)) +LINESTRING(16 0,16 23,16 48) +# Conformance Item T32 +SELECT ST_IsClosed(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; +ST_IsClosed(centerlines) +0 +# Conformance Item T33 +SELECT ST_Length(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; +ST_Length(centerlines) +96 +# Conformance Item T34 +SELECT ST_AsText(ST_Centroid(shores)) +FROM ponds +WHERE fid = 120; +ST_AsText(ST_Centroid(shores)) +POINT(25 42) +# Conformance Item T36 +SELECT ST_Area(shores) +FROM ponds +WHERE fid = 120; +ST_Area(shores) +8 +# Conformance Item T37 +SELECT ST_Equals(boundary, +ST_PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',101)) +FROM named_places +WHERE name = 'Goose Island'; +ST_Equals(boundary, +ST_PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',101)) +1 +# Conformance Item T38 +SELECT ST_Disjoint(centerlines, boundary) +FROM divided_routes, named_places +WHERE divided_routes.name = 'Route 75' +AND named_places.name = 'Ashton'; +ST_Disjoint(centerlines, boundary) +1 +# Conformance Item T39 +SELECT ST_Touches(centerline, shore) +FROM streams, lakes +WHERE streams.name = 'Cam Stream' +AND lakes.name = 'Blue Lake'; +ST_Touches(centerline, shore) +1 +# Conformance Item T42 +SELECT ST_Crosses(road_segments.centerline, divided_routes.centerlines) +FROM road_segments, divided_routes +WHERE road_segments.fid = 102 +AND divided_routes.name = 'Route 75'; +ST_Crosses(road_segments.centerline, divided_routes.centerlines) +1 +# Conformance Item T43 +SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines) +FROM road_segments, divided_routes +WHERE road_segments.fid = 102 +AND divided_routes.name = 'Route 75'; +ST_Intersects(road_segments.centerline, divided_routes.centerlines) +1 +# Conformance Item T44 +SELECT ST_Contains(forests.boundary, named_places.boundary) +FROM forests, named_places +WHERE forests.name = 'Green Forest' +AND named_places.name = 'Ashton'; +ST_Contains(forests.boundary, named_places.boundary) +0 +# Conformance Item T46 +SELECT ST_Distance(position, boundary) +FROM bridges, named_places +WHERE bridges.name = 'Cam Bridge' +AND named_places.name = 'Ashton'; +ST_Distance(position, boundary) +12 +# Conformance Item T48 +SELECT ST_AsText(ST_Difference(named_places.boundary, forests.boundary)) +FROM named_places, forests +WHERE named_places.name = 'Ashton' +AND forests.name = 'Green Forest'; +ST_AsText(ST_Difference(named_places.boundary, forests.boundary)) +POLYGON((56 34,62 48,84 48,84 42,56 34)) +SELECT ST_AsText(ST_Union(shore, boundary)) +FROM lakes, named_places +WHERE lakes.name = 'Blue Lake' +AND named_places.name = 'Goose Island'; +ST_AsText(ST_Union(shore, boundary)) +POLYGON((48 6,52 18,66 23,73 9,48 6)) +# Conformance Item T50 +SELECT ST_AsText(ST_SymDifference(shore, boundary)) +FROM lakes, named_places +WHERE lakes.name = 'Blue Lake' +AND named_places.name = 'Ashton'; +ST_AsText(ST_SymDifference(shore, boundary)) +MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30))) +# Conformance Item T51 +SELECT count(*) +FROM buildings, bridges +WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1; +count(*) +1 +DROP DATABASE gis_ogs; +# +# Bug#13362660 ASSERTION `FIELD_POS < FIELD_COUNT' FAILED. IN PROTOCOL_TEXT::STORE +# +SELECT ST_Union('', ''), md5(1); +ST_Union('', '') md5(1) +NULL c4ca4238a0b923820dcc509a6f75849b diff --git a/mysql-test/suite/innodb_gis/r/precise.result b/mysql-test/suite/innodb_gis/r/precise.result new file mode 100644 index 00000000000..9d6538bc3ed --- /dev/null +++ b/mysql-test/suite/innodb_gis/r/precise.result @@ -0,0 +1,515 @@ +DROP TABLE IF EXISTS t1; +select 1, ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))'), ST_GeomFromText('POLYGON((10 10,30 10,30 30,10 30,10 10))')); +1 ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))'), ST_GeomFromText('POLYGON((10 10,30 10,30 30,10 30,10 10))')) +1 1 +select 0, ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POLYGON((10 40, 40 50, 20 70, 10 40))')); +0 ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POLYGON((10 40, 40 50, 20 70, 10 40))')) +0 0 +select 1, ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POINT(10 10)')); +1 ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POINT(10 10)')) +1 1 +select 1, ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); +1 ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')) +1 1 +select 0, ST_Within(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); +0 ST_Within(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')) +0 0 +select 1, ST_Within(ST_GeomFromText('POLYGON((1 1,20 10,10 30, 1 1))'), ST_GeomFromText('POLYGON((0 0,30 5,10 40, 0 0))')); +1 ST_Within(ST_GeomFromText('POLYGON((1 1,20 10,10 30, 1 1))'), ST_GeomFromText('POLYGON((0 0,30 5,10 40, 0 0))')) +1 1 +create table t1 (g point)engine=innodb; +insert into t1 values +(ST_GeomFromText('POINT(2 2)')), (ST_GeomFromText('POINT(2 4)')), (ST_GeomFromText('POINT(2 6)')), (ST_GeomFromText('POINT(2 8)')), +(ST_GeomFromText('POINT(4 2)')), (ST_GeomFromText('POINT(4 4)')), (ST_GeomFromText('POINT(4 6)')), (ST_GeomFromText('POINT(4 8)')), +(ST_GeomFromText('POINT(6 2)')), (ST_GeomFromText('POINT(6 4)')), (ST_GeomFromText('POINT(6 6)')), (ST_GeomFromText('POINT(6 8)')), +(ST_GeomFromText('POINT(8 2)')), (ST_GeomFromText('POINT(8 4)')), (ST_GeomFromText('POINT(8 6)')), (ST_GeomFromText('POINT(8 8)')); +select ST_astext(g) from t1 where ST_Within(g, ST_GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))')); +ST_astext(g) +POINT(4 4) +POINT(6 2) +POINT(6 4) +POINT(6 6) +select 'Contains'; +Contains +Contains +select ST_astext(g) from t1 where ST_Contains(ST_GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))'), g); +ST_astext(g) +POINT(4 4) +POINT(6 2) +POINT(6 4) +POINT(6 6) +select 'Intersects'; +Intersects +Intersects +select ST_astext(g) from t1 where ST_Intersects(ST_GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))'), g); +ST_astext(g) +POINT(4 4) +POINT(6 2) +POINT(6 4) +POINT(6 6) +select 'Contains'; +Contains +Contains +select ST_astext(g) from t1 where ST_Contains(ST_GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))'), g); +ST_astext(g) +POINT(4 4) +POINT(6 2) +POINT(6 4) +POINT(6 6) +select 'Contains2'; +Contains2 +Contains2 +select ST_astext(g) from t1 where ST_Contains(ST_GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1), (5.01 3.01, 6 5, 9 5, 8 3, 5.01 3.01))'), g); +ST_astext(g) +POINT(4 4) +POINT(6 2) +POINT(6 6) +POINT(8 4) +DROP TABLE t1; +select 0, ST_Within(ST_GeomFromText('LINESTRING(15 15, 50 50, 60 60)'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); +0 ST_Within(ST_GeomFromText('LINESTRING(15 15, 50 50, 60 60)'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')) +0 0 +select 1, ST_Within(ST_GeomFromText('LINESTRING(15 15, 16 16)'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); +1 ST_Within(ST_GeomFromText('LINESTRING(15 15, 16 16)'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')) +1 1 +select 1, ST_Intersects(ST_GeomFromText('LINESTRING(15 15, 50 50)'), ST_GeomFromText('LINESTRING(50 15, 15 50)')); +1 ST_Intersects(ST_GeomFromText('LINESTRING(15 15, 50 50)'), ST_GeomFromText('LINESTRING(50 15, 15 50)')) +1 1 +select 1, ST_Intersects(ST_GeomFromText('LINESTRING(15 15, 50 50)'), ST_GeomFromText('LINESTRING(16 16, 51 51)')); +1 ST_Intersects(ST_GeomFromText('LINESTRING(15 15, 50 50)'), ST_GeomFromText('LINESTRING(16 16, 51 51)')) +1 1 +select 1, ST_Intersects(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')); +1 ST_Intersects(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')) +1 1 +select ST_astext(ST_Union(ST_geometryfromtext('point(1 1)'), ST_geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))'))); +ST_astext(ST_Union(ST_geometryfromtext('point(1 1)'), ST_geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))'))) +POLYGON((0 0,1 2,2 0,0 0)) +select ST_astext(ST_Intersection(ST_geometryfromtext('point(1 1)'), ST_geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))'))); +ST_astext(ST_Intersection(ST_geometryfromtext('point(1 1)'), ST_geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))'))) +POINT(1 1) +select ST_Intersects(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')); +ST_Intersects(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')) +1 +select ST_contains(ST_GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)), ((6 6, 6 11, 11 11, 11 6, 6 6)))'), ST_GeomFromText('POINT(5 10)')); +ST_contains(ST_GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)), ((6 6, 6 11, 11 11, 11 6, 6 6)))'), ST_GeomFromText('POINT(5 10)')) +0 +select ST_Disjoint(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((10 10, 10 15, 15 15, 15 10, 10 10))')); +ST_Disjoint(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((10 10, 10 15, 15 15, 15 10, 10 10))')) +1 +select ST_Disjoint(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))')); +ST_Disjoint(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))')) +0 +select ST_Overlaps(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))')); +ST_Overlaps(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))')) +1 +select ST_Overlaps(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((1 1, 1 4, 4 4, 4 1, 1 1))')); +ST_Overlaps(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((1 1, 1 4, 4 4, 4 1, 1 1))')) +0 +select ST_DISTANCE(ST_geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), ST_geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')); +ST_DISTANCE(ST_geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), ST_geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')) +0.7071067811865475 +select ST_DISTANCE(ST_geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), ST_geomfromtext('linestring(0 1, 1 0)')); +ST_DISTANCE(ST_geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), ST_geomfromtext('linestring(0 1, 1 0)')) +0 +select ST_DISTANCE(ST_geomfromtext('polygon((0 0, 3 6, 6 3, 0 0))'), ST_geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')); +ST_DISTANCE(ST_geomfromtext('polygon((0 0, 3 6, 6 3, 0 0))'), ST_geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')) +0 +select ST_DISTANCE(ST_geomfromtext('polygon((0 0, 3 6, 6 3, 0 0),(2 2, 3 4, 4 3, 2 2))'), ST_geomfromtext('point(3 3)')); +ST_DISTANCE(ST_geomfromtext('polygon((0 0, 3 6, 6 3, 0 0),(2 2, 3 4, 4 3, 2 2))'), ST_geomfromtext('point(3 3)')) +0.4472135954999579 +select ST_DISTANCE(ST_geomfromtext('linestring(0 0, 3 6, 6 3, 0 0)'), ST_geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')); +ST_DISTANCE(ST_geomfromtext('linestring(0 0, 3 6, 6 3, 0 0)'), ST_geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')) +0.8944271909999159 +select ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))'))); +ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))'))) +POLYGON((26.47058823529412 23.823529411764707,21.951219512195124 27.439024390243905,23.855421686746986 29.819277108433734,29.289940828402365 26.36094674556213,26.47058823529412 23.823529411764707)) +select ST_astext(ST_Intersection(ST_GeomFromText('LINESTRING(0 0, 50 45, 40 50, 0 0)'), ST_GeomFromText('LINESTRING(50 5, 55 10, 0 45, 50 5)'))); +ST_astext(ST_Intersection(ST_GeomFromText('LINESTRING(0 0, 50 45, 40 50, 0 0)'), ST_GeomFromText('LINESTRING(50 5, 55 10, 0 45, 50 5)'))) +MULTIPOINT(26.47058823529412 23.823529411764707,29.289940828402365 26.36094674556213,21.951219512195124 27.439024390243905,23.855421686746986 29.819277108433734) +select ST_astext(ST_Intersection(ST_GeomFromText('LINESTRING(0 0, 50 45, 40 50)'), ST_GeomFromText('LINESTRING(50 5, 55 10, 0 45)'))); +ST_astext(ST_Intersection(ST_GeomFromText('LINESTRING(0 0, 50 45, 40 50)'), ST_GeomFromText('LINESTRING(50 5, 55 10, 0 45)'))) +POINT(29.289940828402365 26.36094674556213) +select ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POINT(20 20)'))); +ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POINT(20 20)'))) +POINT(20 20) +select ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200)'))); +ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200)'))) +LINESTRING(0 0,46.666666666666664 46.666666666666664) +select ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))); +ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))) +MULTILINESTRING((0 0,46.666666666666664 46.666666666666664),(8 10,45.33333333333333 47.33333333333333)) +select ST_astext(ST_UNION(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))); +ST_astext(ST_UNION(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))) +GEOMETRYCOLLECTION(LINESTRING(-10 -10,0 0),LINESTRING(-11 -9,8 10),POLYGON((0 0,40 50,50 45,0 0)),LINESTRING(46.666666666666664 46.666666666666664,200 200,199 201,45.33333333333333 47.33333333333333)) +select ST_astext(ST_intersection(ST_geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), ST_geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))'))); +ST_astext(ST_intersection(ST_geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), ST_geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))'))) +POLYGON((0 0,0 1,0.5 0.5,0 0)) +select ST_astext(ST_symdifference(ST_geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), ST_geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))'))); +ST_astext(ST_symdifference(ST_geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), ST_geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))'))) +MULTIPOLYGON(((0 0,0.5 0.5,1 0,0 0)),((0.5 0.5,0 1,0 2,1 1,0.5 0.5))) +select ST_astext(ST_UNION(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))); +ST_astext(ST_UNION(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))) +GEOMETRYCOLLECTION(LINESTRING(-10 -10,0 0),LINESTRING(-11 -9,8 10),POLYGON((0 0,40 50,50 45,0 0)),LINESTRING(46.666666666666664 46.666666666666664,200 200,199 201,45.33333333333333 47.33333333333333)) +select ST_astext(ST_buffer(ST_geometryfromtext('point(1 1)'), 1)); +ST_astext(ST_buffer(ST_geometryfromtext('point(1 1)'), 1)) +POLYGON((1 0,0.9509 0.0012,0.9019 0.0048,0.8532 0.0108,0.8049 0.0192,0.7570 0.0299,0.7097 0.0430,0.6631 0.0584,0.6173 0.0761,0.5724 0.0960,0.5286 0.1180,0.4858 0.1422,0.4444 0.1685,0.4043 0.1967,0.3656 0.2269,0.3284 0.2590,0.2928 0.2928,0.2590 0.3284,0.2269 0.3656,0.1967 0.4043,0.1685 0.4444,0.1422 0.4858,0.1180 0.5286,0.0960 0.5724,0.0761 0.6173,0.0584 0.6631,0.0430 0.7097,0.0299 0.7570,0.0192 0.8049,0.0108 0.8532,0.0048 0.9019,0.0012 0.9509,0 1,0.0048 1.0980,0.0108 1.1467,0.0192 1.1950,0.0299 1.2429,0.0430 1.2902,0.0584 1.3368,0.0761 1.3826,0.0960 1.4275,0.1180 1.4713,0.1422 1.5141,0.1685 1.5555,0.1967 1.5956,0.2269 1.6343,0.2590 1.6715,0.2928 1.7071,0.3284 1.7409,0.3656 1.7730,0.4043 1.8032,0.4444 1.8314,0.4858 1.8577,0.5286 1.8819,0.5724 1.9039,0.6173 1.9238,0.6631 1.9415,0.7097 1.9569,0.7570 1.9700,0.8049 1.9807,0.8532 1.9891,0.9019 1.9951,0.9509 1.9987,1 2,1.0490 1.9987,1.0980 1.9951,1.1467 1.9891,1.1950 1.9807,1.2429 1.9700,1.2902 1.9569,1.3368 1.9415,1.3826 1.9238,1.4275 1.9039,1.4713 1.8819,1.5141 1.8577,1.5555 1.8314,1.5956 1.8032,1.6343 1.7730,1.6715 1.7409,1.7071 1.7071,1.7409 1.6715,1.7730 1.6343,1.8032 1.5956,1.8314 1.5555,1.8577 1.5141,1.8819 1.4713,1.9039 1.4275,1.9238 1.3826,1.9415 1.3368,1.9569 1.2902,1.9700 1.2429,1.9807 1.1950,1.9891 1.1467,1.9951 1.0980,1.9987 1.0490,2 1,1.9951 0.9019,1.9891 0.8532,1.9807 0.8049,1.9700 0.7570,1.9569 0.7097,1.9415 0.6631,1.9238 0.6173,1.9039 0.5724,1.8819 0.5286,1.8577 0.4858,1.8314 0.4444,1.8032 0.4043,1.7730 0.3656,1.7409 0.3284,1.7071 0.2928,1.6715 0.2590,1.6343 0.2269,1.5956 0.1967,1.5555 0.1685,1.5141 0.1422,1.4713 0.1180,1.4275 0.0960,1.3826 0.0761,1.3368 0.0584,1.2902 0.0430,1.2429 0.0299,1.1950 0.0192,1.1467 0.0108,1.0980 0.0048,1.0490 0.0012,1 0)) +create table t1(geom geometrycollection)engine=innodb; +select ST_astext(geom), ST_area(geom),ST_area(ST_buffer(geom,2)) from t1; +ST_astext(geom) ST_area(geom) ST_area(ST_buffer(geom,2)) +select ST_NUMPOINTS(ST_EXTERIORRING(ST_buffer(geom,2))) from t1; +ST_NUMPOINTS(ST_EXTERIORRING(ST_buffer(geom,2))) +set @geom=ST_geomfromtext('LINESTRING(2 1, 4 2, 2 3, 2 5)'); +set @buff=ST_buffer(@geom,1); +select ST_NUMPOINTS(ST_EXTERIORRING(@buff)) from t1; +ST_NUMPOINTS(ST_EXTERIORRING(@buff)) +DROP TABLE t1; +select st_touches(ST_geomfromtext('point(0 0)'), ST_geomfromtext('point(1 1)')); +st_touches(ST_geomfromtext('point(0 0)'), ST_geomfromtext('point(1 1)')) +0 +select st_touches(ST_geomfromtext('point(1 1)'), ST_geomfromtext('point(1 1)')); +st_touches(ST_geomfromtext('point(1 1)'), ST_geomfromtext('point(1 1)')) +0 +select st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('point(1 1)')); +st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('point(1 1)')) +1 +select st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('point(1 0)')); +st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('point(1 0)')) +0 +select st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('point(1 2)')); +st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('point(1 2)')) +0 +select st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('polygon((1 1.2, 1 0, 2 0, 1 1.2))')); +st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('polygon((1 1.2, 1 0, 2 0, 1 1.2))')) +0 +select st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('polygon((1 1, 1 0, 2 0, 1 1))')); +st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('polygon((1 1, 1 0, 2 0, 1 1))')) +1 +SELECT ST_Equals(ST_PolyFromText('POLYGON((67 13, 67 18, 67 18, 59 18, 59 13, 67 13) )'),ST_PolyFromText('POLYGON((67 13, 67 18, 59 19, 59 13, 59 13, 67 13) )')) as result; +result +0 +SELECT ST_Equals(ST_PolyFromText('POLYGON((67 13, 67 18, 67 18, 59 18, 59 13, 67 13) )'),ST_PolyFromText('POLYGON((67 13, 67 18, 59 18, 59 13, 59 13, 67 13) )')) as result; +result +1 +SELECT ST_Equals(ST_PointFromText('POINT (12 13)'),ST_PointFromText('POINT (12 13)')) as result; +result +1 +# +# BUG#11755628/47429: INTERSECTION FUNCTION CRASHED MYSQLD +# BUG#11759650/51979: UNION/INTERSECTION OF POLYGONS CRASHES MYSQL +# +SELECT ST_ASTEXT(ST_UNION(ST_GEOMFROMTEXT('POLYGON((525000 183300,525400 +183300,525400 18370, 525000 183700,525000 183300))'), +ST_geomfromtext('POLYGON((525298.67 183511.53,525296.57 +183510.39,525296.42 183510.31,525289.11 183506.62,525283.17 +183503.47,525280.98 183502.26,525278.63 183500.97,525278.39 +183500.84,525276.79 183500,525260.7 183491.55,525263.95 +183484.75,525265.58 183481.95,525278.97 183488.73,525276.5 +183493.45,525275.5 183495.7,525280.35 183498.2,525282.3 +183499.1,525282.2 183499.3,525283.55 183500,525301.75 +183509.35,525304.45 183504.25,525307.85 183504.95,525304.5 +183510.83,525302.81 183513.8,525298.67 183511.53),(525275.06 +183489.89,525272.06 183488.37,525268.94 183494.51,525271.94 +183496.03,525275.06 183489.89),(525263.26 183491.55,525266.15 +183493.04,525269.88 183485.82,525266.99 183484.33,525263.26 +183491.55))'))) st_u; +st_u +MULTIPOLYGON(((525400 18370,525000.9677614468 183300,525400 183300,525400 18370)),((525000 183300,525000 183700,525000.9677614468 183300,525000 183300)),((525265.58 183481.95,525263.95 183484.75,525260.7 183491.55,525276.79 183500,525278.39 183500.84,525278.63 183500.97,525280.98 183502.26,525283.17 183503.47,525289.11 183506.62,525296.42 183510.31,525296.57 183510.39,525298.67 183511.53,525302.81 183513.8,525304.5 183510.83,525307.85 183504.95,525304.45 183504.25,525301.75 183509.35,525283.55 183500,525282.2 183499.3,525282.3 183499.1,525280.35 183498.2,525275.5 183495.7,525276.5 183493.45,525278.97 183488.73,525265.58 183481.95),(525266.99 183484.33,525263.26 183491.55,525266.15 183493.04,525269.88 183485.82,525266.99 183484.33),(525272.06 183488.37,525268.94 183494.51,525271.94 183496.03,525275.06 183489.89,525272.06 183488.37))) +SET @a=0x0000000001030000000200000005000000000000000000000000000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000000000000000000024400000000000000000000000000000000000000000000000000000F03F000000000000F03F0000000000000040000000000000F03F00000000000000400000000000000040000000000000F03F0000000000000040000000000000F03F000000000000F03F; +SELECT ST_ASTEXT(ST_TOUCHES(@a, ST_GEOMFROMTEXT('point(0 0)'))) t; +t +NULL +DROP TABLE IF EXISTS p1; +CREATE PROCEDURE p1(dist DOUBLE, geom TEXT) +BEGIN +DECLARE g GEOMETRY; +SET g=GeomFromText(geom); +SELECT geom AS `-----`; +SELECT dist, GeometryType(@buf:=ST_Buffer(g, dist)) AS `buffer`, ROUND(ST_AREA(@buf),2) AS buf_area; +END| +# +# Testing ST_BUFFER with positive distance +# +----- +POINT(0 0)) +dist buffer buf_area +1 POLYGON 3.14 +----- +LineString(0 1, 1 1)) +dist buffer buf_area +1 POLYGON 5.14 +----- +LineString(9 9,8 1,1 5,0 0) +dist buffer buf_area +1 POLYGON 44.63 +----- +Polygon((2 2,2 8,8 8,8 2,2 2)) +dist buffer buf_area +1 POLYGON 63.14 +----- +Polygon((0 0,0 8,8 8,8 0,0 0),(2 2,6 2,6 6,2 6,2 2)) +dist buffer buf_area +1 POLYGON 95.14 +----- +Polygon((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0)) +dist buffer buf_area +1 POLYGON 174.93 +----- +MultiPoint(9 9,8 1,1 5) +dist buffer buf_area +1 MULTIPOLYGON 9.42 +----- +MultiLineString((0 0,2 2)) +dist buffer buf_area +1 POLYGON 8.80 +----- +MultiLineString((0 0,2 2,0 4)) +dist buffer buf_area +1 POLYGON 14.24 +----- +MultiLineString((0 0,2 2),(0 2,2 0)) +dist buffer buf_area +1 POLYGON 13.59 +----- +MultiLineString((2 2,2 8,-2 8),(-6 -6, 6 6),(10 10, 14 14)) +dist buffer buf_area +1 MULTIPOLYGON 70.06 +----- +MultiPolygon(((2 2,2 8,8 8,8 2,2 2)), ((9 9,8 1,1 5,9 9))) +dist buffer buf_area +1 POLYGON 73.18 +----- +MultiPolygon(((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)),((9 9,8 1,1 5,9 9))) +dist buffer buf_area +1 POLYGON 73.18 +----- +GeometryCollection(Point(0 0)) +dist buffer buf_area +1 POLYGON 3.14 +----- +GeometryCollection(LineString(0 0, 2 2))) +dist buffer buf_area +1 POLYGON 8.80 +----- +GeometryCollection(Polygon((2 2,2 8,8 8,8 2,2 2)))) +dist buffer buf_area +1 POLYGON 63.14 +----- +GeometryCollection(MultiPoint(9 9,8 1,1 5)) +dist buffer buf_area +1 MULTIPOLYGON 9.42 +----- +GeometryCollection(MultiLineString((0 0,0 1),(3 0,3 1))) +dist buffer buf_area +1 MULTIPOLYGON 10.28 +----- +GeometryCollection(MultiPolygon(((0 0, 3 0, 3 3, 0 3, 0 0)),((6 6,6 9,9 9,9 6,6 6)))) +dist buffer buf_area +1 MULTIPOLYGON 48.28 +----- +GeometryCollection(Point(9 9),LineString(1 5,0 0),Polygon((2 2,2 8,8 8,8 2,2 2))) +dist buffer buf_area +1 POLYGON 75.92 +# +# Testing ST_BUFFER with zero distance +# +----- +POINT(0 0)) +dist buffer buf_area +0 POINT 0.00 +----- +LineString(0 1, 1 1)) +dist buffer buf_area +0 LINESTRING 0.00 +----- +LineString(9 9,8 1,1 5,0 0) +dist buffer buf_area +0 LINESTRING 0.00 +----- +Polygon((2 2,2 8,8 8,8 2,2 2)) +dist buffer buf_area +0 POLYGON 36.00 +----- +Polygon((0 0,0 8,8 8,8 0,0 0),(2 2,6 2,6 6,2 6,2 2)) +dist buffer buf_area +0 POLYGON 48.00 +----- +Polygon((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0)) +dist buffer buf_area +0 POLYGON 116.00 +----- +MultiPoint(9 9,8 1,1 5) +dist buffer buf_area +0 MULTIPOINT NULL +----- +MultiLineString((0 0,2 2)) +dist buffer buf_area +0 MULTILINESTRING NULL +----- +MultiLineString((0 0,2 2,0 4)) +dist buffer buf_area +0 MULTILINESTRING NULL +----- +MultiLineString((0 0,2 2),(0 2,2 0)) +dist buffer buf_area +0 MULTILINESTRING NULL +----- +MultiLineString((2 2,2 8,-2 8),(-6 -6, 6 6),(10 10, 14 14)) +dist buffer buf_area +0 MULTILINESTRING NULL +----- +MultiPolygon(((2 2,2 8,8 8,8 2,2 2)), ((9 9,8 1,1 5,9 9))) +dist buffer buf_area +0 MULTIPOLYGON 66.00 +----- +MultiPolygon(((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)),((9 9,8 1,1 5,9 9))) +dist buffer buf_area +0 MULTIPOLYGON 62.00 +----- +GeometryCollection(Point(0 0)) +dist buffer buf_area +0 GEOMETRYCOLLECTION 0.00 +----- +GeometryCollection(LineString(0 0, 2 2))) +dist buffer buf_area +0 GEOMETRYCOLLECTION 0.00 +----- +GeometryCollection(Polygon((2 2,2 8,8 8,8 2,2 2)))) +dist buffer buf_area +0 GEOMETRYCOLLECTION 36.00 +----- +GeometryCollection(MultiPoint(9 9,8 1,1 5)) +dist buffer buf_area +0 GEOMETRYCOLLECTION NULL +----- +GeometryCollection(MultiLineString((0 0,0 1),(3 0,3 1))) +dist buffer buf_area +0 GEOMETRYCOLLECTION NULL +----- +GeometryCollection(MultiPolygon(((0 0, 3 0, 3 3, 0 3, 0 0)),((6 6,6 9,9 9,9 6,6 6)))) +dist buffer buf_area +0 GEOMETRYCOLLECTION 18.00 +----- +GeometryCollection(Point(9 9),LineString(1 5,0 0),Polygon((2 2,2 8,8 8,8 2,2 2))) +dist buffer buf_area +0 GEOMETRYCOLLECTION 36.00 +# +# Testing ST_BUFFER with negative distance +# +----- +POINT(0 0)) +dist buffer buf_area +-1 GEOMETRYCOLLECTION 0.00 +----- +LineString(0 1, 1 1)) +dist buffer buf_area +-1 GEOMETRYCOLLECTION 0.00 +----- +LineString(9 9,8 1,1 5,0 0) +dist buffer buf_area +-1 GEOMETRYCOLLECTION 0.00 +----- +Polygon((2 2,2 8,8 8,8 2,2 2)) +dist buffer buf_area +-1 POLYGON 16.00 +----- +MultiPoint(9 9,8 1,1 5) +dist buffer buf_area +-1 GEOMETRYCOLLECTION 0.00 +----- +MultiLineString((0 0,2 2)) +dist buffer buf_area +-1 GEOMETRYCOLLECTION 0.00 +----- +MultiLineString((0 0,2 2,0 4)) +dist buffer buf_area +-1 GEOMETRYCOLLECTION 0.00 +----- +MultiLineString((0 0,2 2),(0 2,2 0)) +dist buffer buf_area +-1 GEOMETRYCOLLECTION 0.00 +----- +MultiLineString((2 2,2 8,-2 8),(-6 -6, 6 6),(10 10, 14 14)) +dist buffer buf_area +-1 GEOMETRYCOLLECTION 0.00 +----- +GeometryCollection(Point(0 0)) +dist buffer buf_area +-1 GEOMETRYCOLLECTION 0.00 +----- +GeometryCollection(LineString(0 0, 2 2))) +dist buffer buf_area +-1 GEOMETRYCOLLECTION 0.00 +----- +GeometryCollection(Polygon((2 2,2 8,8 8,8 2,2 2)))) +dist buffer buf_area +-1 POLYGON 16.00 +----- +GeometryCollection(MultiPoint(9 9,8 1,1 5)) +dist buffer buf_area +-1 GEOMETRYCOLLECTION 0.00 +----- +GeometryCollection(MultiLineString((0 0,0 1),(3 0,3 1))) +dist buffer buf_area +-1 GEOMETRYCOLLECTION 0.00 +----- +GeometryCollection(Point(9 9),LineString(1 5,0 0),Polygon((2 2,2 8,8 8,8 2,2 2))) +dist buffer buf_area +-1 POLYGON 16.00 +SELECT ST_CONTAINS( +GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), +GeomFromText('POINT(5 10)')); +ST_CONTAINS( +GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), +GeomFromText('POINT(5 10)')) +0 +SELECT AsText(ST_UNION( +GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), +GeomFromText('POINT(5 10)'))); +AsText(ST_UNION( +GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), +GeomFromText('POINT(5 10)'))) +GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)),POLYGON((6 6,6 11,11 11,11 6,6 6)),POINT(5 10)) +DROP PROCEDURE p1; +# +# Bug #13833019 ASSERTION `T1->RESULT_RANGE' FAILED IN GCALC_OPERATION_REDUCER::END_COUPLE +# +SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3)); +GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3)) +POLYGON +# +# Bug #13832749 HANDLE_FATAL_SIGNAL IN GCALC_FUNCTION::COUNT_INTERNAL +# +SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), ((9 9,8 1,1 5,9 9)))'),1)); +GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), ((9 9,8 1,1 5,9 9)))'),1)) +POLYGON +# +# Bug#13358363 - ASSERTION: N > 0 && N < SINUSES_CALCULATED*2+1 | GET_N_SINCOS/ADD_EDGE_BUFFER +# +DO ST_BUFFER(ST_GEOMCOLLFROMTEXT('linestring(1 1,2 2)'),''); +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '' +SELECT ST_WITHIN( +LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '), +ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) '), +ST_NUMINTERIORRINGS(POLYGONFROMTEXT('POLYGON((3 5,2 4,2 5,3 5)) ')))); +ST_WITHIN( +LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '), +ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) ') +0 +SELECT ST_DIMENSION(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((3 5,2 5,2 4,3 4,3 5)) '), +ST_NUMINTERIORRINGS(POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))')))); +ST_DIMENSION(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((3 5,2 5,2 4,3 4,3 5)) '), +ST_NUMINTERIORRINGS(POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))')))) +2 +SELECT ST_NUMINTERIORRINGS( +ST_ENVELOPE(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5))) '), +SRID(MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) '))))); +ST_NUMINTERIORRINGS( +ST_ENVELOPE(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5))) '), +SRID(MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) '))))) +0 +SELECT ASTEXT(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'), +SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) ')))); +ASTEXT(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'), +SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) ')))) +POLYGON((9 9,5 2,4 5,9 9)) diff --git a/mysql-test/suite/innodb_gis/r/rt_precise.result b/mysql-test/suite/innodb_gis/r/rt_precise.result new file mode 100644 index 00000000000..e52f2ab5aa3 --- /dev/null +++ b/mysql-test/suite/innodb_gis/r/rt_precise.result @@ -0,0 +1,59 @@ +SET default_storage_engine=InnoDB; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +g GEOMETRY NOT NULL, +KEY gis_key(g(5)) +) ENGINE=InnoDB; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `fid` int(11) NOT NULL AUTO_INCREMENT, + `g` geometry NOT NULL, + PRIMARY KEY (`fid`), + KEY `gis_key` (`g`(5)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT count(*) FROM t1; +count(*) +150 +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +EXPLAIN SELECT fid, ST_AsText(g) FROM t1 WHERE ST_Within(g, ST_GeomFromText('Polygon((140 140,160 140,160 160,140 140))')); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL gis_key NULL NULL NULL 150 # +SELECT fid, ST_AsText(g) FROM t1 WHERE ST_Within(g, ST_GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))')) ORDER BY fid; +fid ST_AsText(g) +1 LINESTRING(150 150,150 150) +2 LINESTRING(149 149,151 151) +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) +DROP TABLE t1; +CREATE TABLE t1 ( +fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +g GEOMETRY NOT NULL +) ENGINE=InnoDB; +ALTER TABLE t1 ADD SPATIAL KEY(g); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `fid` int(11) NOT NULL AUTO_INCREMENT, + `g` geometry NOT NULL, + PRIMARY KEY (`fid`), + SPATIAL KEY `g` (`g`) +) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=latin1 +SELECT count(*) FROM t1; +count(*) +100 +SELECT fid, ST_AsText(g) FROM t1 WHERE ST_Within(g, +ST_GeomFromText('Polygon((40 40,60 40,60 60,40 40))')) ORDER BY fid; +fid ST_AsText(g) +DROP TABLE t1; +End of 5.5 tests. diff --git a/mysql-test/suite/innodb_gis/r/rtree.result b/mysql-test/suite/innodb_gis/r/rtree.result new file mode 100644 index 00000000000..a2b685f1747 --- /dev/null +++ b/mysql-test/suite/innodb_gis/r/rtree.result @@ -0,0 +1,251 @@ +create table t1 (i int, g geometry not null, spatial index (g))engine=innodb; +insert into t1 values (1, POINT(1,1)); +insert into t1 values (1, POINT(1.5,1.5)); +insert into t1 values (1, POINT(3,3)); +insert into t1 values (1, POINT(3.1,3.1)); +insert into t1 values (1, POINT(5,5)); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))'); +explain select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range g g 34 NULL 1 Using where +select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1); +ST_astext(t1.g) +set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))'); +delete from t1 where MBRWithin(t1.g, @g1); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select ST_astext(t1.g) from t1; +ST_astext(t1.g) +POINT(1 1) +POINT(1.5 1.5) +POINT(3 3) +POINT(3.1 3.1) +POINT(5 5) +set @g1 = ST_GeomFromText('Polygon((5 5,5 5,5 5,5 5,5 5))'); +update t1 set g = POINT(2,2) where MBRWithin(t1.g, @g1); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select ST_astext(t1.g) from t1; +ST_astext(t1.g) +POINT(1 1) +POINT(1.5 1.5) +POINT(3 3) +POINT(3.1 3.1) +POINT(2 2) +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +t1 1 g 1 g A # 32 NULL SPATIAL +drop table t1; +create table t1 (name VARCHAR(100), square GEOMETRY not null, spatial index (square))engine=innodb; +INSERT INTO t1 VALUES("small", ST_GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))')); +INSERT INTO t1 VALUES("big", ST_GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))')); +INSERT INTO t1 VALUES("up", ST_GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))')); +INSERT INTO t1 VALUES("up2", ST_GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))')); +INSERT INTO t1 VALUES("up3", ST_GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))')); +INSERT INTO t1 VALUES("down", ST_GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))')); +INSERT INTO t1 VALUES("down2", ST_GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))')); +INSERT INTO t1 VALUES("down3", ST_GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))')); +INSERT INTO t1 VALUES("right", ST_GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))')); +INSERT INTO t1 VALUES("right2", ST_GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))')); +INSERT INTO t1 VALUES("right3", ST_GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))')); +INSERT INTO t1 VALUES("left", ST_GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))')); +INSERT INTO t1 VALUES("left2", ST_GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))')); +INSERT INTO t1 VALUES("left3", ST_GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))')); +SET @p = ST_GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'); +SELECT name, ST_AsText(square) from t1 where MBRContains(@p, square); +name ST_AsText(square) +small POLYGON((0 0,0 1,1 1,1 0,0 0)) +SELECT name, ST_AsText(square) from t1 where MBRDisjoint(@p, square); +name ST_AsText(square) +up3 POLYGON((0 3,0 5,2 5,2 3,0 3)) +down3 POLYGON((0 -3,0 -1,2 -1,2 -3,0 -3)) +right3 POLYGON((3 0,3 2,5 2,5 0,3 0)) +left3 POLYGON((-3 0,-3 2,-1 2,-1 0,-3 0)) +SELECT name, ST_AsText(square) from t1 where MBREquals(@p, square); +name ST_AsText(square) +SELECT name, ST_AsText(square) from t1 where MBRIntersects(@p, square); +name ST_AsText(square) +right2 POLYGON((2 0,2 2,4 2,4 0,2 0)) +right POLYGON((1 0,1 2,3 2,3 0,1 0)) +up2 POLYGON((0 2,0 4,2 4,2 2,0 2)) +up POLYGON((0 1,0 3,2 3,2 1,0 1)) +big POLYGON((0 0,0 3,3 3,3 0,0 0)) +small POLYGON((0 0,0 1,1 1,1 0,0 0)) +down POLYGON((0 -1,0 1,2 1,2 -1,0 -1)) +down2 POLYGON((0 -2,0 0,2 0,2 -2,0 -2)) +left POLYGON((-1 0,-1 2,1 2,1 0,-1 0)) +left2 POLYGON((-2 0,-2 2,0 2,0 0,-2 0)) +SELECT name, ST_AsText(square) from t1 where MBROverlaps(@p, square); +name ST_AsText(square) +right POLYGON((1 0,1 2,3 2,3 0,1 0)) +up POLYGON((0 1,0 3,2 3,2 1,0 1)) +down POLYGON((0 -1,0 1,2 1,2 -1,0 -1)) +left POLYGON((-1 0,-1 2,1 2,1 0,-1 0)) +SELECT name, ST_AsText(square) from t1 where MBRTouches(@p, square); +name ST_AsText(square) +right2 POLYGON((2 0,2 2,4 2,4 0,2 0)) +up2 POLYGON((0 2,0 4,2 4,2 2,0 2)) +down2 POLYGON((0 -2,0 0,2 0,2 -2,0 -2)) +left2 POLYGON((-2 0,-2 2,0 2,0 0,-2 0)) +SELECT name, ST_AsText(square) from t1 where MBRWithin(@p, square); +name ST_AsText(square) +big POLYGON((0 0,0 3,3 3,3 0,0 0)) +SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))'); +SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))'); +SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))'); +SET @horiz3 = ST_GeomFromText('POLYGON ((2 0, 3 0, 2 0))'); +SET @point1 = ST_GeomFromText('POLYGON ((0 0))'); +SET @point2 = ST_GeomFromText('POLYGON ((-2 0))'); +SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @vert1) GROUP BY a1.name; +MBRoverlaps +SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @horiz1) GROUP BY a1.name; +MBRoverlaps +SELECT MBROverlaps(@horiz1, @vert1) FROM DUAL; +MBROverlaps(@horiz1, @vert1) +0 +SELECT MBROverlaps(@horiz1, @horiz2) FROM DUAL; +MBROverlaps(@horiz1, @horiz2) +1 +SELECT MBROverlaps(@horiz1, @horiz3) FROM DUAL; +MBROverlaps(@horiz1, @horiz3) +0 +SELECT MBROverlaps(@horiz1, @point1) FROM DUAL; +MBROverlaps(@horiz1, @point1) +0 +SELECT MBROverlaps(@horiz1, @point2) FROM DUAL; +MBROverlaps(@horiz1, @point2) +0 +DROP TABLE t1; +create table t1 (i int not null, g geometry not null)engine=innodb; +insert into t1 values (1, POINT(1,1)); +insert into t1 values (2, POINT(1.5,1.5)); +insert into t1 values (3, POINT(3,3)); +insert into t1 values (4, POINT(3.1,3.1)); +insert into t1 values (5, POINT(5,5)); +alter table t1 add primary key(i); +alter table t1 drop primary key; +create spatial index idx on t1(g); +create spatial index idx2 on t1(g); +Warnings: +Note 1831 Duplicate index `idx2`. This is deprecated and will be disallowed in a future release +alter table t1 add primary key(i); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) NOT NULL, + `g` geometry NOT NULL, + PRIMARY KEY (`i`), + SPATIAL KEY `idx` (`g`), + SPATIAL KEY `idx2` (`g`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop index idx on t1; +drop table t1; +create table t1 (i int, i2 char(10), g geometry not null, primary key (i, i2), spatial index (g))engine=innodb; +insert into t1 values (1, "111", POINT(1,1)); +insert into t1 values (2, "222", POINT(1.5,1.5)); +insert into t1 values (3, "333", POINT(3,3)); +insert into t1 values (4, "444", POINT(3.1,3.1)); +insert into t1 values (5, "555", POINT(5,5)); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))'); +explain select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range g g 34 NULL 1 Using where +select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1); +ST_astext(t1.g) +set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))'); +delete from t1 where MBRWithin(t1.g, @g1); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select ST_astext(t1.g) from t1; +ST_astext(t1.g) +POINT(1 1) +POINT(1.5 1.5) +POINT(3 3) +POINT(3.1 3.1) +POINT(5 5) +set @g1 = ST_GeomFromText('Polygon((5 5,5 5,5 5,5 5,5 5))'); +update t1 set g = POINT(2,2) where MBRWithin(t1.g, @g1); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select ST_astext(t1.g) from t1; +ST_astext(t1.g) +POINT(1 1) +POINT(1.5 1.5) +POINT(3 3) +POINT(3.1 3.1) +POINT(2 2) +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +t1 0 PRIMARY 1 i A # NULL NULL BTREE +t1 0 PRIMARY 2 i2 A # NULL NULL BTREE +t1 1 g 1 g A # 32 NULL SPATIAL +drop table t1; +CREATE TABLE `t1` ( +`id` int(11) NOT NULL AUTO_INCREMENT, +`way` geometry NOT NULL, +PRIMARY KEY (`id`), +SPATIAL KEY `way` (`way`) +) ENGINE=InnoDB; +INSERT INTO t1 SET way = ST_GeomFromText('POINT(1 1)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(1 2)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(1 3)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(1 4)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(1 5)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(2 1)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(2 2)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(2 3)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(2 4)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(2 5)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(3 1)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(3 2)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(3 3)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(3 4)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(3 5)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(4 1)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(4 2)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(4 3)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(4 4)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(4 5)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(5 1)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(5 2)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(5 3)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(5 4)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(5 5)'); +SELECT COUNT(*) +FROM t1 +WHERE ST_CONTAINS(ST_GeomFromText('POLYGON((2 2,4 2, 4 4, 2 4, 2 2))'),way); +COUNT(*) +9 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +SELECT COUNT(*) +FROM t1 +WHERE ST_CONTAINS(ST_GeomFromText('POLYGON((2 2,4 2, 4 4, 2 4, 2 2))'),way); +COUNT(*) +9 +DROP TABLE t1; +CREATE TABLE t1( i INT, g GEOMETRY NOT NULL, SPATIAL INDEX (g)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1, LINESTRING(POINT(1,1), POINT(4, 4))); +INSERT INTO t1 VALUES(2, LINESTRING(POINT(2,2), POINT(5, 5))); +UPDATE t1 SET g = LINESTRING(POINT(1,1), POINT(2,2), POINT(3,3), POINT(4,4)) +WHERE i = 1; +UPDATE t1 SET g = LINESTRING(POINT(1,1), POINT(2,2), POINT(3,3), POINT(8,8)) +WHERE i = 2; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DELETE FROM t1 +WHERE ST_CONTAINS(ST_GeomFromText('POLYGON((0 0,4 0, 4 4, 0 4, 0 0))'),g); +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_gis/t/0.test b/mysql-test/suite/innodb_gis/t/0.test new file mode 100644 index 00000000000..b5d82f2ae69 --- /dev/null +++ b/mysql-test/suite/innodb_gis/t/0.test @@ -0,0 +1,42 @@ +--source include/have_innodb.inc +SET default_storage_engine=innodb; +--source include/gis_generic.inc +--source include/gis_keys.inc + +# +# Bug #15680 (SPATIAL key in innodb) +# +#--error ER_TABLE_CANT_HANDLE_SPKEYS +create table t1 (g geometry not null, spatial gk(g)) engine=innodb; + +DROP TABLE t1; + +# Test read uncommitted +create table t1 (c1 int, c2 geometry not null, spatial index (c2))engine=innodb; + +connect (a,localhost,root,,); +connection a; + +start transaction; +insert into t1 values(1, Point(1,1)); + + +connect (con1,localhost,root,,); +connection con1; +set @g1 = ST_GeomFromText('Polygon((0 0,0 100,100 100,100 0,0 0))'); +set transaction isolation level read uncommitted; +select count(*) from t1 where ST_Within(t1.c2, @g1); +disconnect con1; + +--source include/wait_until_disconnected.inc + +connection a; +commit; +disconnect a; +--source include/wait_until_disconnected.inc + +connection default; +drop table t1; + + + diff --git a/mysql-test/suite/innodb_gis/t/1.test b/mysql-test/suite/innodb_gis/t/1.test new file mode 100644 index 00000000000..110a8acc18f --- /dev/null +++ b/mysql-test/suite/innodb_gis/t/1.test @@ -0,0 +1,1451 @@ +#***************************************************************** +# The Orginal name of the testcase : gis.test +# The following are the modification done +# 1.SET default_storage_engine=InnoDB; +# 2.MyiSam to Innodb where ever is required. +# 3.Spatial index to Index as Innodb does not support +#***************************************************************** +--source include/have_innodb.inc +-- source include/have_geometry.inc + +SET default_storage_engine=InnoDB; +SET innodb_strict_mode=OFF; + +# +# Spatial objects +# + +CREATE TABLE gis_point (fid INTEGER NOT NULL PRIMARY KEY, g POINT); +CREATE TABLE gis_line (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING); +CREATE TABLE gis_polygon (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON); +CREATE TABLE gis_multi_point (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOINT); +CREATE TABLE gis_multi_line (fid INTEGER NOT NULL PRIMARY KEY, g MULTILINESTRING); +CREATE TABLE gis_multi_polygon (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOLYGON); +CREATE TABLE gis_geometrycollection (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRYCOLLECTION); +CREATE TABLE gis_geometry (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY); + +SHOW FIELDS FROM gis_point; +SHOW FIELDS FROM gis_line; +SHOW FIELDS FROM gis_polygon; +SHOW FIELDS FROM gis_multi_point; +SHOW FIELDS FROM gis_multi_line; +SHOW FIELDS FROM gis_multi_polygon; +SHOW FIELDS FROM gis_geometrycollection; +SHOW FIELDS FROM gis_geometry; + + +INSERT INTO gis_point VALUES +(101, ST_PointFromText('POINT(10 10)')), +(102, ST_PointFromText('POINT(20 10)')), +(103, ST_PointFromText('POINT(20 20)')), +(104, ST_PointFromWKB(ST_AsWKB(ST_PointFromText('POINT(10 20)')))); + +INSERT INTO gis_line VALUES +(105, ST_LineFromText('LINESTRING(0 0,0 10,10 0)')), +(106, ST_LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), +(107, ST_LineStringFromWKB(ST_AsWKB(LineString(Point(10, 10), Point(40, 10))))); + +INSERT INTO gis_polygon VALUES +(108, ST_PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')), +(109, ST_PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')), +(110, ST_PolyFromWKB(ST_AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))))); + +INSERT INTO gis_multi_point VALUES +(111, ST_MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), +(112, ST_MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), +(113, ST_MPointFromWKB(ST_AsWKB(MultiPoint(Point(3, 6), Point(4, 10))))); + +INSERT INTO gis_multi_line VALUES +(114, ST_MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), +(115, ST_MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), +(116, ST_MLineFromWKB(ST_AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))))); + + +INSERT INTO gis_multi_polygon VALUES +(117, ST_MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), +(118, ST_MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), +(119, ST_MPolyFromWKB(ST_AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))))); + +INSERT INTO gis_geometrycollection VALUES +(120, ST_GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), +(121, ST_GeometryFromWKB(ST_AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))); + +INSERT into gis_geometry SELECT * FROM gis_point; +INSERT into gis_geometry SELECT * FROM gis_line; +INSERT into gis_geometry SELECT * FROM gis_polygon; +INSERT into gis_geometry SELECT * FROM gis_multi_point; +INSERT into gis_geometry SELECT * FROM gis_multi_line; +INSERT into gis_geometry SELECT * FROM gis_multi_polygon; +INSERT into gis_geometry SELECT * FROM gis_geometrycollection; + +SELECT fid, ST_AsText(g) FROM gis_point; +SELECT fid, ST_AsText(g) FROM gis_line; +SELECT fid, ST_AsText(g) FROM gis_polygon; +SELECT fid, ST_AsText(g) FROM gis_multi_point; +SELECT fid, ST_AsText(g) FROM gis_multi_line; +SELECT fid, ST_AsText(g) FROM gis_multi_polygon; +SELECT fid, ST_AsText(g) FROM gis_geometrycollection; +SELECT fid, ST_AsText(g) FROM gis_geometry; + +SELECT fid, ST_Dimension(g) FROM gis_geometry; +SELECT fid, ST_GeometryType(g) FROM gis_geometry; +SELECT fid, ST_IsEmpty(g) FROM gis_geometry; +SELECT fid, ST_AsText(ST_Envelope(g)) FROM gis_geometry; +--replace_column 10 # +explain extended select ST_Dimension(g), ST_GeometryType(g), ST_IsEmpty(g), ST_AsText(ST_Envelope(g)) from gis_geometry; + +SELECT fid, ST_X(g) FROM gis_point; +SELECT fid, ST_Y(g) FROM gis_point; +--replace_column 10 # +explain extended select ST_X(g),ST_Y(g) FROM gis_point; + +SELECT fid, ST_AsText(ST_StartPoint(g)) FROM gis_line; +SELECT fid, ST_AsText(ST_EndPoint(g)) FROM gis_line; +SELECT fid, ST_Length(g) FROM gis_line; +SELECT fid, ST_NumPoints(g) FROM gis_line; +SELECT fid, ST_AsText(ST_PointN(g, 2)) FROM gis_line; +SELECT fid, ST_IsClosed(g) FROM gis_line; +--replace_column 10 # +explain extended select ST_AsText(ST_StartPoint(g)),ST_AsText(ST_EndPoint(g)),ST_Length(g),ST_NumPoints(g),ST_AsText(ST_PointN(g, 2)),ST_IsClosed(g) FROM gis_line; + +SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_polygon; +SELECT fid, ST_Area(g) FROM gis_polygon; +SELECT fid, ST_AsText(ST_ExteriorRing(g)) FROM gis_polygon; +SELECT fid, ST_NumInteriorRings(g) FROM gis_polygon; +SELECT fid, ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon; +--replace_column 10 # +explain extended select ST_AsText(ST_Centroid(g)),ST_Area(g),ST_AsText(ST_ExteriorRing(g)),ST_NumInteriorRings(g),ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon; + +SELECT fid, ST_IsClosed(g) FROM gis_multi_line; + +SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_multi_polygon; +SELECT fid, ST_Area(g) FROM gis_multi_polygon; + +SELECT fid, ST_NumGeometries(g) from gis_multi_point; +SELECT fid, ST_NumGeometries(g) from gis_multi_line; +SELECT fid, ST_NumGeometries(g) from gis_multi_polygon; +SELECT fid, ST_NumGeometries(g) from gis_geometrycollection; +--replace_column 10 # +explain extended SELECT fid, ST_NumGeometries(g) from gis_multi_point; + +SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point; +SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_line; +SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_polygon; +SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_geometrycollection; +SELECT fid, ST_AsText(ST_GeometryN(g, 1)) from gis_geometrycollection; +--replace_column 10 # +explain extended SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point; + +SELECT g1.fid as first, g2.fid as second, +MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g) as o, +MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t, +MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r +FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; +--replace_column 10 # +explain extended SELECT g1.fid as first, g2.fid as second, +MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g) as o, +MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t, +MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r +FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; + +DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; + +# +# Check that ALTER TABLE doesn't loose geometry type +# +CREATE TABLE t1 ( + gp point, + ln linestring, + pg polygon, + mp multipoint, + mln multilinestring, + mpg multipolygon, + gc geometrycollection, + gm geometry +); + +SHOW FIELDS FROM t1; +ALTER TABLE t1 ADD fid INT NOT NULL; +SHOW FIELDS FROM t1; +DROP TABLE t1; + +SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)')))); +explain extended SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)')))); +explain extended SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_PointFromText('POINT(1 4)')))); +SELECT ST_SRID(ST_GeomFromText('LineString(1 1,2 2)',101)); +explain extended SELECT ST_SRID(ST_GeomFromText('LineString(1 1,2 2)',101)); +#select ST_issimple(MultiPoint(Point(3, 6), Point(4, 10))), ST_issimple(Point(3, 6)),ST_issimple(ST_PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),ST_issimple(ST_GeometryFromText('POINT(1 4)')), ST_issimple(ST_AsWKB(ST_GeometryFromText('POINT(1 4)'))); +explain extended select ST_issimple(MultiPoint(Point(3, 6), Point(4, 10))), ST_issimple(Point(3, 6)); + +create table t1 (a geometry not null); +insert into t1 values (ST_GeomFromText('Point(1 2)')); +-- error 1416 +insert into t1 values ('Garbage'); +-- error 1416 +insert IGNORE into t1 values ('Garbage'); + +# Now we support spatial index +alter table t1 add spatial index(a); + +drop table t1; + +# +# Bug #5219: problem with range optimizer +# + +create table t1(a geometry not null, index(a(5))); +insert into t1 values +(ST_GeomFromText('POINT(1 1)')), (ST_GeomFromText('POINT(3 3)')), +(ST_GeomFromText('POINT(4 4)')), (ST_GeomFromText('POINT(6 6)')); +select ST_AsText(a) from t1 where + MBRContains(ST_GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a) + or + MBRContains(ST_GeomFromText('Polygon((2 2, 2 5, 5 5, 5 2, 2 2))'), a); +select ST_AsText(a) from t1 where + MBRContains(ST_GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a) + and + MBRContains(ST_GeomFromText('Polygon((0 0, 0 7, 7 7, 7 0, 0 0))'), a); +drop table t1; + +CREATE TABLE t1 (Coordinates POINT NOT NULL, INDEX(Coordinates(10))); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(383293632 1754448)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(564952612 157516260)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(903994614 180726515)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(98128178 141127631)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(862547902 799334546)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(341989013 850270906)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(803302376 93039099)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(857439153 817431356)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(319757546 343162742)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(826341972 717484432)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(305066789 201736238)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(626068992 616241497)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(55789424 755830108)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(802874458 312435220)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(153795660 551723671)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(242207428 537089292)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(553478119 807160039)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(694605552 457472733)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(987886554 792733729)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(598600363 850434457)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(592068275 940589376)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(700705362 395370650)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(33628474 558144514)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(212802006 353386020)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(901307256 39143977)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(70870451 206374045)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(240880214 696939443)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(822615542 296669638)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(452769551 625489999)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(609104858 606565210)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(177213669 851312285)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(143654501 730691787)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(658472325 838260052)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(188164520 646358878)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(630993781 786764883)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(496793334 223062055)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(727354258 197498696)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(618432704 760982731)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(755643210 831234710)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(114368751 656950466)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(870378686 185239202)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(863324511 111258900)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(882178645 685940052)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(407928538 334948195)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(311430051 17033395)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(941513405 488643719)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(868345680 85167906)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(219335507 526818004)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(923427958 407500026)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(173176882 554421738)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(194264908 669970217)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(777483793 921619165)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(867468912 395916497)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(682601897 623112122)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(227151206 796970647)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(280062588 97529892)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(982209849 143387099)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(208788792 864388493)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(829327151 616717329)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(199336688 140757201)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(633750724 140850093)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(629400920 502096404)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(226017998 848736426)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(28914408 149445955)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(256236452 202091290)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(703867693 450501360)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(872061506 481351486)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(372120524 739530418)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(877267982 54722420)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(362642540 104419188)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(851693067 642705127)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(201949080 833902916)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(786092225 410737872)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(698291409 615419376)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(27455201 897628096)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(756176576 661205925)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(38478189 385577496)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(163302328 264496186)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(234313922 192216735)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(413942141 490550373)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(394308025 117809834)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(941051732 266369530)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(599161319 313172256)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(5899948 476429301)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(367894677 368542487)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(580848489 219587743)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(11247614 782797569)')); +drop table t1; + +create table t1 select ST_GeomFromWKB(POINT(1,3)); +show create table t1; +drop table t1; + +SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; + +CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo` +geometry NOT NULL default '') ENGINE=InnoDB ; + +SET sql_mode = default; + +insert into t1 values ('85984',ST_GeomFromText('MULTIPOLYGON(((-115.006363 +36.305435,-114.992394 36.305202,-114.991219 36.305975,-114.991163 +36.306845,-114.989432 36.309452,-114.978275 36.312642,-114.977363 +36.311978,-114.975327 36.312344,-114.96502 36.31597,-114.963364 +36.313629,-114.961723 36.313721,-114.956398 36.316057,-114.951882 +36.320979,-114.947073 36.323475,-114.945207 36.326451,-114.945207 +36.326451,-114.944132 36.326061,-114.94003 36.326588,-114.924017 +36.334484,-114.923281 36.334146,-114.92564 36.331504,-114.94072 +36.319282,-114.945348 36.314812,-114.948091 36.314762,-114.951755 +36.316211,-114.952446 36.313883,-114.952644 36.309488,-114.944725 +36.313083,-114.93706 36.32043,-114.932478 36.323497,-114.924556 +36.327708,-114.922608 36.329715,-114.92009 36.328695,-114.912105 +36.323566,-114.901647 36.317952,-114.897436 36.313968,-114.895344 +36.309573,-114.891699 36.304398,-114.890569 36.303551,-114.886356 +36.302702,-114.885141 36.301351,-114.885709 36.297391,-114.892499 +36.290893,-114.902142 36.288974,-114.904941 36.288838,-114.905308 +36.289845,-114.906325 36.290395,-114.909916 36.289549,-114.914527 +36.287535,-114.918797 36.284423,-114.922982 36.279731,-114.924113 +36.277282,-114.924057 36.275817,-114.927733 36.27053,-114.929354 +36.269029,-114.929354 36.269029,-114.950856 36.268715,-114.950768 +36.264324,-114.960206 36.264293,-114.960301 36.268943,-115.006662 +36.268929,-115.008583 36.265619,-115.00665 36.264247,-115.006659 +36.246873,-115.006659 36.246873,-115.006838 36.247697,-115.010764 +36.247774,-115.015609 36.25113,-115.015765 36.254505,-115.029517 +36.254619,-115.038573 36.249317,-115.038573 36.249317,-115.023403 +36.25841,-115.023873 36.258994,-115.031845 36.259829,-115.03183 +36.261053,-115.025561 36.261095,-115.036417 36.274632,-115.033729 +36.276041,-115.032217 36.274851,-115.029845 36.273959,-115.029934 +36.274966,-115.025763 36.274896,-115.025406 36.281044,-115.028731 +36.284471,-115.036497 36.290377,-115.042071 36.291039,-115.026759 +36.298478,-115.008995 36.301966,-115.006363 36.305435),(-115.079835 +36.244369,-115.079735 36.260186,-115.076435 36.262369,-115.069758 +36.265,-115.070235 36.268757,-115.064542 36.268655,-115.061843 +36.269857,-115.062676 36.270693,-115.06305 36.272344,-115.059051 +36.281023,-115.05918 36.283008,-115.060591 36.285246,-115.061913 +36.290022,-115.062499 36.306353,-115.062499 36.306353,-115.060918 +36.30642,-115.06112 36.289779,-115.05713 36.2825,-115.057314 +36.279446,-115.060779 36.274659,-115.061366 36.27209,-115.057858 +36.26557,-115.055805 36.262883,-115.054688 36.262874,-115.047335 +36.25037,-115.044234 36.24637,-115.052434 36.24047,-115.061734 +36.23507,-115.061934 36.22677,-115.061934 36.22677,-115.061491 +36.225267,-115.062024 36.218194,-115.060134 36.218278,-115.060133 +36.210771,-115.057833 36.210771,-115.057433 36.196271,-115.062233 +36.196271,-115.062233 36.190371,-115.062233 36.190371,-115.065533 +36.190371,-115.071333 36.188571,-115.098331 36.188275,-115.098331 +36.188275,-115.098435 36.237569,-115.097535 36.240369,-115.097535 +36.240369,-115.093235 36.240369,-115.089135 36.240469,-115.083135 +36.240569,-115.083135 36.240569,-115.079835 +36.244369)))')),('85998',ST_GeomFromText('MULTIPOLYGON(((-115.333107 +36.264587,-115.333168 36.280638,-115.333168 36.280638,-115.32226 +36.280643,-115.322538 36.274311,-115.327222 36.274258,-115.32733 +36.263026,-115.330675 36.262984,-115.332132 36.264673,-115.333107 +36.264587),(-115.247239 36.247066,-115.247438 36.218267,-115.247438 +36.218267,-115.278525 36.219263,-115.278525 36.219263,-115.301545 +36.219559,-115.332748 36.219197,-115.332757 36.220041,-115.332757 +36.220041,-115.332895 36.233514,-115.349023 36.233479,-115.351489 +36.234475,-115.353681 36.237021,-115.357106 36.239789,-115.36519 +36.243331,-115.368156 36.243487,-115.367389 36.244902,-115.364553 +36.246014,-115.359219 36.24616,-115.356186 36.248025,-115.353347 +36.248004,-115.350813 36.249507,-115.339673 36.25387,-115.333069 +36.255018,-115.333069 36.255018,-115.333042 36.247767,-115.279039 +36.248666,-115.263639 36.247466,-115.263839 36.252766,-115.261439 +36.252666,-115.261439 36.247366,-115.247239 36.247066)))')); + +# Expected result is 115.31877315203187, but IA64 returns 115.31877315203188 +# due to fused multiply-add instructions. +--replace_result 115.31877315203188 115.31877315203187 +select object_id, ST_geometrytype(geo), ST_ISSIMPLE(GEO), ST_ASTEXT(ST_centroid(geo)) from +t1 where object_id=85998; + +# Expected result is 36.3310176346905, but IA64 returns 36.3310176346904 +# due to fused multiply-add instructions. +--replace_result 36.3310176346904 36.3310176346905 -114.87787186923326 -114.87787186923313 36.33101763469053 36.33101763469059 36.33101763469043 36.33101763469059 +select object_id, ST_geometrytype(geo), ST_ISSIMPLE(GEO), ST_ASTEXT(ST_centroid(geo)) from +t1 where object_id=85984; + +drop table t1; + +create table t1 (fl geometry not null); +--error 1416 +insert into t1 values (1); +--error 1416 +insert into t1 values (1.11); +--error 1416 +insert into t1 values ("qwerty"); +# --error ER_GIS_INVALID_DATA +--error ER_BAD_NULL_ERROR +insert into t1 values (ST_pointfromtext('point(1,1)')); + +drop table t1; + +select (ST_asWKT(ST_geomfromwkb((0x000000000140240000000000004024000000000000)))); +select (ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440)))); + +--enable_metadata +create table t1 (g GEOMETRY); +select * from t1; +select ST_asbinary(g) from t1; +--disable_metadata +drop table t1; + +create table t1 (a TEXT, b GEOMETRY NOT NULL, INDEX(b(5))); +alter table t1 disable keys; +--error 1263 +load data infile '../../std_data/bad_gis_data.dat' into table t1; +alter table t1 enable keys; +drop table t1; + +# +# Bug #26038: is null and bad data +# + +create table t1 (a int, b blob); +insert into t1 values (1, ''), (2, NULL), (3, '1'); +select * from t1; + +--error ER_ILLEGAL_VALUE_FOR_TYPE +select + ST_geometryfromtext(b) IS NULL, ST_geometryfromwkb(b) IS NULL, ST_astext(b) IS NULL, + ST_aswkb(b) IS NULL, ST_geometrytype(b) IS NULL, ST_centroid(b) IS NULL, + ST_envelope(b) IS NULL, ST_startpoint(b) IS NULL, ST_endpoint(b) IS NULL, + ST_exteriorring(b) IS NULL, ST_pointn(b, 1) IS NULL, ST_geometryn(b, 1) IS NULL, + ST_interiorringn(b, 1) IS NULL, multipoint(b) IS NULL, ST_isempty(b) IS NULL, + ST_issimple(b) IS NULL, ST_isclosed(b) IS NULL, ST_dimension(b) IS NULL, + ST_numgeometries(b) IS NULL, ST_numinteriorrings(b) IS NULL, ST_numpoints(b) IS NULL, + ST_area(b) IS NULL, ST_length(b) IS NULL, ST_srid(b) IS NULL, ST_x(b) IS NULL, + ST_y(b) IS NULL +from t1; + +# --error ER_GIS_INVALID_DATA +select + MBRwithin(b, b) IS NULL, MBRcontains(b, b) IS NULL, MBRoverlaps(b, b) IS NULL, + MBRequals(b, b) IS NULL, MBRdisjoint(b, b) IS NULL, ST_touches(b, b) IS NULL, + MBRintersects(b, b) IS NULL, ST_crosses(b, b) IS NULL +from t1; + +--error ER_ILLEGAL_VALUE_FOR_TYPE +select + point(b, b) IS NULL, linestring(b) IS NULL, polygon(b) IS NULL, multipoint(b) IS NULL, + multilinestring(b) IS NULL, multipolygon(b) IS NULL, + geometrycollection(b) IS NULL +from t1; + +drop table t1; + +# +# Bug #27164: Crash when mixing InnoDB and InnoDB Geospatial tables +# +CREATE TABLE t1(a POINT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1; +DROP TABLE t1; + +# +# Bug #30955 ST_geomfromtext() crasher +# +CREATE TABLE `t1` ( `col9` set('a'), `col89` date); +INSERT IGNORE INTO `t1` VALUES ('','0000-00-00'); +# --error ER_GIS_INVALID_DATA +select ST_geomfromtext(col9,col89) as a from t1; +DROP TABLE t1; + +# +# Bug #31158 Spatial, Union, LONGBLOB vs BLOB bug (crops data) +# + +CREATE TABLE t1 ( + geomdata polygon NOT NULL, + KEY index_geom (geomdata(10)) +) ENGINE=InnoDB DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED; + +CREATE TABLE t2 ( + geomdata polygon NOT NULL, + KEY index_geom (geomdata(10)) +) ENGINE=InnoDB DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED; + +CREATE TABLE t3 +select + ST_aswkb(ws.geomdata) AS geomdatawkb + from + t1 ws +union + select + ST_aswkb(ws.geomdata) AS geomdatawkb + from + t2 ws; + +describe t3; + +drop table t1; +drop table t2; +drop table t3; + +# +# Bug #30284 spatial key corruption +# + +create table t1(col1 geometry default null,col15 geometrycollection not +null, index(col15(5)),index(col1(15)))engine=InnoDB; +# --error ER_CANT_CREATE_GEOMETRY_OBJECT +insert into t1 set col15 = ST_GeomFromText('POINT(6 5)'); +# --error ER_CANT_CREATE_GEOMETRY_OBJECT +insert into t1 set col15 = ST_GeomFromText('POINT(6 5)'); +check table t1 extended; +drop table t1; + +--echo End of 4.1 tests + +# +# Bug #12281 (Geometry: crash in trigger) +# + +create table t1 (s1 geometry not null,s2 char(100)); +create trigger t1_bu before update on t1 for each row set new.s1 = null; +--error 1048 +insert into t1 values (null,null); +drop table t1; + +# +# Bug #10499 (function creation with GEOMETRY datatype) +# +--disable_warnings +drop procedure if exists fn3; +--enable_warnings +create function fn3 () returns point deterministic return ST_GeomFromText("point(1 1)"); +show create function fn3; +select ST_astext(fn3()); +drop function fn3; + +# +# Bug #12267 (primary key over GIS) +# +create table t1(pt POINT); +alter table t1 add primary key pti(pt); +drop table t1; +create table t1(pt GEOMETRY); +--error 1170 +alter table t1 add primary key pti(pt); +alter table t1 add primary key pti(pt(20)); +drop table t1; + + +create table t1 select ST_GeomFromText('point(1 1)'); +desc t1; +drop table t1; + +# +# Bug #20691 (DEFAULT over NOT NULL field) +# +create table t1 (g geometry not null); +--error ER_CANT_CREATE_GEOMETRY_OBJECT +insert into t1 values(default); +drop table t1; + +# +# Bug #27300: create view with geometry functions lost columns types +# +CREATE TABLE t1 (a GEOMETRY); +CREATE VIEW v1 AS SELECT ST_GeomFromwkb(ST_ASBINARY(a)) FROM t1; +CREATE VIEW v2 AS SELECT a FROM t1; +DESCRIBE v1; +DESCRIBE v2; + +DROP VIEW v1,v2; +DROP TABLE t1; + +# +# Bug#24563: MBROverlaps does not seem to function propertly +# Bug#54888: MBROverlaps missing in 5.1? +# + +# Test all MBR* functions and their non-MBR-prefixed aliases, +# using shifted squares to verify the spatial relations. + +create table t1 (name VARCHAR(100), square GEOMETRY); + +INSERT INTO t1 VALUES("center", ST_GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))')); + +INSERT INTO t1 VALUES("small", ST_GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))')); +INSERT INTO t1 VALUES("big", ST_GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))')); + +INSERT INTO t1 VALUES("up", ST_GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))')); +INSERT INTO t1 VALUES("up2", ST_GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))')); +INSERT INTO t1 VALUES("up3", ST_GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))')); + +INSERT INTO t1 VALUES("down", ST_GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))')); +INSERT INTO t1 VALUES("down2", ST_GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))')); +INSERT INTO t1 VALUES("down3", ST_GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))')); + +INSERT INTO t1 VALUES("right", ST_GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))')); +INSERT INTO t1 VALUES("right2", ST_GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))')); +INSERT INTO t1 VALUES("right3", ST_GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))')); + +INSERT INTO t1 VALUES("left", ST_GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))')); +INSERT INTO t1 VALUES("left2", ST_GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))')); +INSERT INTO t1 VALUES("left3", ST_GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))')); + +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequals FROM t1 a1 JOIN t1 a2 ON MBREquals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; + +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRequals FROM t1 a1 JOIN t1 a2 ON MBREquals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRoverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS ST_touches FROM t1 a1 JOIN t1 a2 ON ST_Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; + +# MBROverlaps needs a few more tests, with point and line dimensions + +# --error ER_GIS_INVALID_DATA +SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))'); +# --error ER_GIS_INVALID_DATA +SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))'); +# --error ER_GIS_INVALID_DATA +SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))'); +# --error ER_GIS_INVALID_DATA +SET @horiz3 = ST_GeomFromText('POLYGON ((2 0, 3 0, 2 0))'); +# --error ER_GIS_INVALID_DATA +SET @point1 = ST_GeomFromText('POLYGON ((0 0))'); +# --error ER_GIS_INVALID_DATA +SET @point2 = ST_GeomFromText('POLYGON ((-2 0))'); + +SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @vert1) GROUP BY a1.name; +SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @horiz1) GROUP BY a1.name; +SELECT MBROverlaps(@horiz1, @vert1) FROM DUAL; +SELECT MBROverlaps(@horiz1, @horiz2) FROM DUAL; +SELECT MBROverlaps(@horiz1, @horiz3) FROM DUAL; +SELECT MBROverlaps(@horiz1, @point1) FROM DUAL; +SELECT MBROverlaps(@horiz1, @point2) FROM DUAL; + +DROP TABLE t1; + +# +# Bug#28763: Selecting geometry fields in UNION caused server crash. +# +create table t1(f1 geometry, f2 polygon, f3 linestring); +select f1 from t1 union select f1 from t1; +insert into t1 (f2,f3) values (ST_GeomFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))'), ST_GeomFromText('LINESTRING(0 0,1 1,2 2)')); +select ST_AsText(f2),ST_AsText(f3) from t1; +select ST_AsText(a) from (select f2 as a from t1 union select f3 from t1) t; +create table t2 as select f2 as a from t1 union select f3 from t1; +desc t2; +select ST_AsText(a) from t2; +drop table t1, t2; + +# +# Bug #29166: MYsql crash when query is run +# + +# The test query itself is not logged : too large output. +# The real test is the second query : see if the first hasn't crashed the +# server +--disable_query_log +--disable_result_log +SELECT ST_AsText(ST_GeometryFromText(CONCAT( + 'MULTIPOLYGON(((', + REPEAT ('-0.00000000001234567890123456789012 -0.123456789012345678,', 1000), + '-0.00000000001234567890123456789012 -0.123456789012345678', + ')))' +))) AS a; +--enable_result_log +--enable_query_log +SELECT 1; + +-- source include/gis_keys.inc + +# +# Bug #31155 gis types in union'd select cause crash +# + +create table `t1` (`col002` point)engine=InnoDB; +insert into t1 values (),(),(); +# --error ER_WRONG_ARGUMENTS +select min(`col002`) from t1 union select `col002` from t1; +drop table t1; + +--echo # +--echo # Bug #47780: crash when comparing GIS items from subquery +--echo # + +CREATE TABLE t1(a INT, b MULTIPOLYGON); +INSERT INTO t1 VALUES + (0, + ST_GEOMFROMTEXT( + 'multipolygon(((1 2,3 4,5 6,7 8,9 8,1 2,1 2),(7 6,5 4,3 2,1 2,3 4,7 6)))')); + +--echo # must not crash +SELECT 1 FROM t1 WHERE a <> (SELECT ST_GEOMETRYCOLLECTIONFROMWKB(b) FROM t1); + +DROP TABLE t1; + +--echo # +--echo # Bug #49250 : spatial btree index corruption and crash +--echo # Part one : spatial syntax check +--echo # + +--error ER_PARSE_ERROR +CREATE TABLE t1(col1 MULTIPOLYGON NOT NULL, + SPATIAL INDEX USING BTREE (col1)); +CREATE TABLE t2(col1 MULTIPOLYGON NOT NULL); +--error ER_PARSE_ERROR +CREATE SPATIAL INDEX USING BTREE ON t2(col); +--error ER_PARSE_ERROR +ALTER TABLE t2 ADD SPATIAL INDEX USING BTREE (col1); + +DROP TABLE t2; + +--echo End of 5.0 tests + + +# +# Bug #11335 View redefines column types +# +create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime); +create view v1 as select * from t1; +desc v1; +drop view v1; +drop table t1; + +# +# Bug#44684: valgrind reports invalid reads in +# Item_func_spatial_collection::val_str +# +--error ER_ILLEGAL_VALUE_FOR_TYPE +SELECT MultiPoint(12345,''); +#SELECT MultiPoint(123451,''); +#SELECT MultiPoint(1234512,''); +#SELECT MultiPoint(12345123,''); + +--error ER_ILLEGAL_VALUE_FOR_TYPE +#SELECT MultiLineString(12345,''); +#SELECT MultiLineString(123451,''); +#SELECT MultiLineString(1234512,''); +#SELECT MultiLineString(12345123,''); + +--error ER_ILLEGAL_VALUE_FOR_TYPE +#SELECT LineString(12345,''); +#SELECT LineString(123451,''); +#SELECT LineString(1234512,''); +#SELECT LineString(12345123,''); + +--error ER_ILLEGAL_VALUE_FOR_TYPE +#SELECT Polygon(12345,''); +#SELECT Polygon(123451,''); +#SELECT Polygon(1234512,''); +#SELECT Polygon(12345123,''); + +# +# Bug55531 crash with conversions of geometry types / strings +# +--error ER_ILLEGAL_VALUE_FOR_TYPE +SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUAL) AS d WHERE (LINESTRING(d.b)); + + +--echo # +--echo # BUG#51875: crash when loading data into geometry function ST_polyfromwkb +--echo # +SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; +# --error ER_GIS_INVALID_DATA +SET @a=ST_POLYFROMWKB(@a); +SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; +# --error ER_GIS_INVALID_DATA +SET @a=ST_POLYFROMWKB(@a); + + +# +# Bug #57321 crashes and valgrind errors from spatial types +# + +create table t1(a polygon NOT NULL)engine=InnoDB; +--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +insert into t1 values (ST_geomfromtext("point(0 1)")); +--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +insert into t1 values (ST_geomfromtext("point(1 0)")); +select * from (select polygon(t1.a) as p from t1 order by t1.a) d; +drop table t1; + + +--echo # +--echo # Test for bug #59888 "debug assertion when attempt to create spatial index +--echo # on char > 31 bytes". +--echo # +create table t1(a char(32) not null) engine=InnoDB; +#--error ER_SPATIAL_MUST_HAVE_GEOM_COL +create index i on t1 (a(5)); +drop table t1; + + +--echo End of 5.1 tests + +# +# Bug #50574 5.5.ST_x allows spatial indexes on non-spatial +# columns, causing crashes! +# Bug#11767480 SPATIAL INDEXES ON NON-SPATIAL COLUMNS +# CAUSE CRASHES. +# +CREATE TABLE t0 (a BINARY(32) NOT NULL); +#--error ER_SPATIAL_MUST_HAVE_GEOM_COL +CREATE UNIQUE INDEX i on t0 (a(10)); +INSERT INTO t0 VALUES (1); + +#--error ER_SPATIAL_MUST_HAVE_GEOM_COL +CREATE TABLE t1( + col0 BINARY NOT NULL, + col2 TIMESTAMP, + INDEX i1 (col0) +) ENGINE=InnoDB; + +# Test other ways to add indices +CREATE TABLE t2 ( + col0 BINARY NOT NULL, + col2 TIMESTAMP +) ENGINE=InnoDB; + +#--error ER_SPATIAL_MUST_HAVE_GEOM_COL +CREATE INDEX idx0 ON t1(col0); + +#--error ER_SPATIAL_MUST_HAVE_GEOM_COL +#ALTER TABLE t1 ADD INDEX i1 (col0); + +CREATE TABLE t3 ( + col0 INTEGER NOT NULL, + col1 POINT, + col2 POINT +); + +# --error ER_TOO_MANY_KEY_PARTS +--error ER_WRONG_ARGUMENTS +CREATE SPATIAL INDEX idx0 ON t2 (col1, col2); + + +CREATE TABLE t4 ( + col0 INTEGER NOT NULL, + col1 POINT, + col2 LINESTRING, + INDEX i1 (col1(5), col2(5)) +); + +# cleanup +DROP TABLE IF EXISTS t0, t1, t2, t3,t4; + + +--echo # +--echo # BUG#12414917 - ST_ISCLOSED() CRASHES ON 64-BIT BUILDS +--echo # +# --error ER_GIS_DATA_WRONG_ENDIANESS +SELECT ST_ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20))); + +--echo # +--echo # BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN +--echo # GEOMETRY FUNCTION ARGUMENTS +--echo # +--replace_regex /non geometric .* value/non geometric '' value/ +--error ER_ILLEGAL_VALUE_FOR_TYPE +SELECT GEOMETRYCOLLECTION((SELECT @@OLD)); + + +--echo End of 5.1 tests + + +--echo # +--echo # Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE +--echo # + +CREATE TABLE g1 +(a geometry NOT NULL, UNIQUE KEY i (a(151))) engine=InnoDB; + +INSERT INTO g1 VALUES (ST_geomfromtext('point(1 1)')); +INSERT INTO g1 VALUES (ST_geomfromtext('point(1 2)')); + +FLUSH TABLES; + +SELECT 1 FROM g1 +FORCE INDEX(i) WHERE a = date_sub(now(), interval 2808.4 year_month) +; + +DROP TABLE g1; + +--echo # +--echo # Bug#13013970 MORE CRASHES IN FIELD_BLOB::GET_KEY_IMAGE +--echo # + +CREATE TABLE g1(a TEXT NOT NULL, KEY(a(255))); + +INSERT INTO g1 VALUES ('a'),('a'); +# --error ER_GIS_INVALID_DATA +SELECT 1 FROM g1 WHERE a >= ANY +(SELECT 1 FROM g1 WHERE a = ST_geomfromtext('') OR a) ; + +DROP TABLE g1; + +--echo End of 5.5 tests + + +# Conformance tests +# +# C.3.3 Geometry types and functions +# + +--disable_warnings +DROP DATABASE IF EXISTS gis_ogs; +--enable_warnings + +CREATE DATABASE gis_ogs; +USE gis_ogs; + +--echo # +--echo # C.3.3.1 Geometry types and functions schema construction +--echo # + +# TODO: WL#2377 +#CREATE TABLE spatial_ref_sys ( +#ST_srid INTEGER NOT NULL PRIMARY KEY, +#auth_name CHARACTER VARYING, +#auth_srid INTEGER, +#srtext CHARACTER VARYING(2048)); + +CREATE TABLE lakes ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + shore POLYGON); + +CREATE TABLE road_segments ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + aliases CHARACTER VARYING(64), + num_lanes INTEGER, + centerline LINESTRING); + +CREATE TABLE divided_routes ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + num_lanes INTEGER, + centerlines MULTILINESTRING); + +CREATE TABLE forests ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + boundary MULTIPOLYGON); + +CREATE TABLE bridges ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + position POINT); + +CREATE TABLE streams ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + centerline LINESTRING); + +CREATE TABLE buildings ( + fid INTEGER NOT NULL PRIMARY KEY, + address CHARACTER VARYING(64), + position POINT, + footprint POLYGON); + +CREATE TABLE ponds ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + type CHARACTER VARYING(64), + shores MULTIPOLYGON); + +CREATE TABLE named_places ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + boundary POLYGON); + +CREATE TABLE map_neatlines ( + fid INTEGER NOT NULL PRIMARY KEY, + neatline POLYGON); + +--echo # +--echo # C.3.3.2 Geometry types and functions schema data loading +--echo # + +# TODO: WL#2377 +#-- Spatial Reference System +#INSERT INTO spatial_ref_sys VALUES +#(101, 'POSC', 32214, 'PROJCS["UTM_ZONE_14N", +#GEOGCS["World Geodetic System 72", +#DATUM["WGS_72", +#ELLIPSOID["NWL_10D", 6378135, 298.26]], +#PRIMEM["Greenwich", 0], +#UNIT["Meter", 1.0]], +#PROJECTION["Transverse_Mercator"], +#PARAMETER["False_Easting", 500000.0], +#PARAMETER["False_Northing", 0.0], +#PARAMETER["Central_Meridian", -99.0], +#PARAMETER["Scale_Factor", 0.9996], +#PARAMETER["Latitude_of_origin", 0.0], +#UNIT["Meter", 1.0]]'); + +--echo # Lakes +INSERT INTO lakes VALUES ( +101, 'BLUE LAKE', +ST_PolyFromText( +'POLYGON( +(52 18,66 23,73 9,48 6,52 18), +(59 18,67 18,67 13,59 13,59 18) +)', +101)); + + +--echo # Road Segments + +INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2, +ST_LineFromText( +'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101)); + +INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4, +ST_LineFromText( +'LINESTRING( 44 31, 56 34, 70 38 )' ,101)); + +INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2, +ST_LineFromText( +'LINESTRING( 70 38, 72 48 )' ,101)); + +INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4, +ST_LineFromText( +'LINESTRING( 70 38, 84 42 )' ,101)); + +INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL, +1, +ST_LineFromText( +'LINESTRING( 28 26, 28 0 )',101)); + +--echo # DividedRoutes + +INSERT INTO divided_routes VALUES(119, 'Route 75', 4, +ST_MLineFromText( +'MULTILINESTRING((10 48,10 21,10 0), +(16 0,16 23,16 48))', 101)); + +--echo # Forests + +INSERT INTO forests VALUES(109, 'Green Forest', +ST_MPolyFromText( +'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26), +(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))', +101)); + +--echo # Bridges + +INSERT INTO bridges VALUES(110, 'Cam Bridge', ST_PointFromText( +'POINT( 44 31 )', 101)); + +--echo # Streams + +INSERT INTO streams VALUES(111, 'Cam Stream', +ST_LineFromText( +'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101)); + +INSERT INTO streams VALUES(112, NULL, +ST_LineFromText( +'LINESTRING( 76 0, 78 4, 73 9 )', 101)); + +--echo # Buildings + +INSERT INTO buildings VALUES(113, '123 Main Street', +ST_PointFromText( +'POINT( 52 30 )', 101), +ST_PolyFromText( +'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101)); + +INSERT INTO buildings VALUES(114, '215 Main Street', +ST_PointFromText( +'POINT( 64 33 )', 101), +ST_PolyFromText( +'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101)); + + +--echo # Ponds + +INSERT INTO ponds VALUES(120, NULL, 'Stock Pond', +ST_MPolyFromText( +'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ), +( ( 26 44, 26 40, 28 42, 26 44) ) )', 101)); + +--echo # Named Places + +INSERT INTO named_places VALUES(117, 'Ashton', +ST_PolyFromText( +'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101)); + +INSERT INTO named_places VALUES(118, 'Goose Island', +ST_PolyFromText( +'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101)); + +--echo # Map Neatlines + +INSERT INTO map_neatlines VALUES(115, +ST_PolyFromText( +'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101)); + +--echo # +--echo # C.3.3.3 Geometry types and functions schema test queries +--echo + +# TODO: WL#2377 +#--echo # Conformance Item T1 +#SELECT f_table_name +#FROM geometry_columns; +# +#--echo # Conformance Item T2 +#SELECT f_geometry_column +#FROM geometry_columns +#WHERE f_table_name = 'streams'; +# +#--echo # Conformance Item T3 +#SELECT coord_dimension +#FROM geometry_columns +#WHERE f_table_name = 'streams'; +# +#--echo # Conformance Item T4 +# +#SELECT ST_srid +#FROM geometry_columns +#WHERE f_table_name = 'streams'; +# +#--echo # Conformance Item T5 +# +#SELECT srtext +#FROM SPATIAL_REF_SYS +#WHERE ST_SRID = 101; +# + + +--echo # Conformance Item T6 +# TODO: ST_Dimension() alias +SELECT ST_Dimension(shore) +FROM lakes +WHERE name = 'Blue Lake'; + +--echo # Conformance Item T7 +# TODO: ST_GeometryType() alias +SELECT ST_GeometryType(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; + +--echo # Conformance Item T8 +# TODO: ST_AsText() alias +SELECT ST_AsText(boundary) +FROM named_places +WHERE name = 'Goose Island'; + +--echo # Conformance Item T9 +# TODO: ST_AsBinary(), ST_PolyFromWKB() aliases +SELECT ST_AsText(ST_PolyFromWKB(ST_AsBinary(boundary),101)) +FROM named_places +WHERE name = 'Goose Island'; + +--echo # Conformance Item T10 +# TODO: ST_SRID() alias +SELECT ST_SRID(boundary) +FROM named_places +WHERE name = 'Goose Island'; + +--echo # Conformance Item T11 +# TODO: ST_IsEmpty() alias +SELECT ST_IsEmpty(centerline) +FROM road_segments +WHERE name = 'Route 5' +AND aliases = 'Main Street'; + +# FIXME: get wrong result:0, expected 1. +#--echo # Conformance Item T12 +# TODO: ST_IsSimple() alias +#SELECT ST_IsSimple(shore) +#FROM lakes +#WHERE name = 'Blue Lake'; + +# TODO: WL#2377 +#--echo # Conformance Item T13 +#SELECT ST_AsText(Boundary((boundary),101) +#FROM named_places +#WHERE name = 'Goose Island'; + +--echo # Conformance Item T14 +# TODO: ST_Envelope( ) alias +# FIXME: we get anticlockwise, GIS suggests clockwise +SELECT ST_AsText(ST_Envelope(boundary)) +FROM named_places +WHERE name = 'Goose Island'; + +--echo # Conformance Item T15 +# TODO: ST_X() alias +SELECT ST_X(position) +FROM bridges +WHERE name = 'Cam Bridge'; + +--echo # Conformance Item T16 +# TODO: ST_Y() alias +SELECT ST_Y(position) +FROM bridges +WHERE name = 'Cam Bridge'; + +--echo # Conformance Item T17 +# TODO: ST_StartPoint() alias +SELECT ST_AsText(ST_StartPoint(centerline)) +FROM road_segments +WHERE fid = 102; + +--echo # Conformance Item T18 +# TODO: ST_EndPoint +SELECT ST_AsText(ST_EndPoint(centerline)) +FROM road_segments +WHERE fid = 102; + +# TODO: WL#2377 +#--echo # Conformance Item T19 +# TODO: ST_LineFromWKB() alias +#SELECT ST_IsClosed(LineFromWKB(ST_AsBinary(Boundary(boundary)),ST_SRID(boundary))) +#FROM named_places +#WHERE name = 'Goose Island'; + +# TODO: WL#2377 +#--echo # Conformance Item T20 +#SELECT IsRing(LineFromWKB(ST_AsBinary(Boundary(boundary)),ST_SRID(boundary))) +#FROM named_places +#WHERE name = 'Goose Island'; + +--echo # Conformance Item T21 +# TODO: ST_Length() alias +SELECT ST_Length(centerline) +FROM road_segments +WHERE fid = 106; + +--echo # Conformance Item T22 +# TODO: ST_NumPoints() alias +SELECT ST_NumPoints(centerline) +FROM road_segments +WHERE fid = 102; + +--echo # Conformance Item T23 +# TODO: ST_PointN() alias +SELECT ST_AsText(ST_PointN(centerline, 1)) +FROM road_segments +WHERE fid = 102; + +--echo # Conformance Item T24 +# TODO: ST_Centroid() alias +SELECT ST_AsText(ST_Centroid(boundary)) +FROM named_places +WHERE name = 'Goose Island'; + +# TODO: WL#2377 +#--echo # Conformance Item T25 +#SELECT MBRContains(boundary, PointOnSurface(boundary)) +#FROM named_places +#WHERE name = 'Goose Island'; + +--echo # Conformance Item T26 +# TODO: ST_Area() alias +SELECT ST_Area(boundary) +FROM named_places +WHERE name = 'Goose Island'; + +--echo # Conformance Item T27 +# TODO: ST_ExteriorRing() alias +SELECT ST_AsText(ST_ExteriorRing(shore)) +FROM lakes +WHERE name = 'Blue Lake'; + +--echo # Conformance Item T28 +# TODO: ST_NumInteriorRings() alias +SELECT ST_NumInteriorRings(shore) +FROM lakes +WHERE name = 'Blue Lake'; + +--echo # Conformance Item T29 +# TODO: ST_InteriorRingN() alias +SELECT ST_AsText(ST_InteriorRingN(shore, 1)) +FROM lakes +WHERE name = 'Blue Lake'; + +--echo # Conformance Item T30 +# TODO: ST_NumGeometries() alias +SELECT ST_NumGeometries(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; + +--echo # Conformance Item T31 +# TODO: ST_GeometryN() alias +SELECT ST_AsText(ST_GeometryN(centerlines, 2)) +FROM divided_routes +WHERE name = 'Route 75'; + +--echo # Conformance Item T32 +# TODO: ST_IsClosed() alias +SELECT ST_IsClosed(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; + +--echo # Conformance Item T33 +# TODO: ST_Length() alias +SELECT ST_Length(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; + +--echo # Conformance Item T34 +# TODO: ST_Centroid() alias +SELECT ST_AsText(ST_Centroid(shores)) +FROM ponds +WHERE fid = 120; + +# TODO: WL#2377 +#--echo # Conformance Item T35 +#SELECT MBRContains(shores, PointOnSurface(shores)) +#FROM ponds +#WHERE fid = 120; + +--echo # Conformance Item T36 +# TODO: ST_Area() alias +SELECT ST_Area(shores) +FROM ponds +WHERE fid = 120; + +--echo # Conformance Item T37 +# TODO: ST_PolyFromText() alias +# --error ER_GIS_DIFFERENT_SRIDS +SELECT ST_Equals(boundary, +ST_PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) +FROM named_places +WHERE name = 'Goose Island'; + +--echo # Conformance Item T37 +--echo # Geometry arguments' SRIDs must be identical. +SELECT ST_Equals(boundary, +ST_PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',101)) +FROM named_places +WHERE name = 'Goose Island'; + + +--echo # Conformance Item T38 +SELECT ST_Disjoint(centerlines, boundary) +FROM divided_routes, named_places +WHERE divided_routes.name = 'Route 75' +AND named_places.name = 'Ashton'; + +--echo # Conformance Item T39 +SELECT ST_Touches(centerline, shore) +FROM streams, lakes +WHERE streams.name = 'Cam Stream' +AND lakes.name = 'Blue Lake'; + +# FIXME: wrong result: get 0, expected 1 +#--echo # Conformance Item T40 +#SELECT ST_Within(boundary, footprint) +#FROM named_places, buildings +#WHERE named_places.name = 'Ashton' +#AND buildings.address = '215 Main Street'; + +# FIXME: wrong result: get 0, expected 1 +#--echo # Conformance Item T41 +#SELECT ST_Overlaps(forests.boundary, named_places.boundary) +#FROM forests, named_places +#WHERE forests.name = 'Green Forest' +#AND named_places.name = 'Ashton'; + +--echo # Conformance Item T42 +# FIXME: TODO: ST_Crosses() alias +SELECT ST_Crosses(road_segments.centerline, divided_routes.centerlines) +FROM road_segments, divided_routes +WHERE road_segments.fid = 102 +AND divided_routes.name = 'Route 75'; + +--echo # Conformance Item T43 +SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines) +FROM road_segments, divided_routes +WHERE road_segments.fid = 102 +AND divided_routes.name = 'Route 75'; + +--echo # Conformance Item T44 +SELECT ST_Contains(forests.boundary, named_places.boundary) +FROM forests, named_places +WHERE forests.name = 'Green Forest' +AND named_places.name = 'Ashton'; + +# TODO: WL#2377 +#--echo # Conformance Item T45 +#SELECT Relate(forests.boundary, named_places.boundary, 'TTTTTTTTT') +#FROM forests, named_places +#WHERE forests.name = 'Green Forest' +#AND named_places.name = 'Ashton'; + +--echo # Conformance Item T46 +SELECT ST_Distance(position, boundary) +FROM bridges, named_places +WHERE bridges.name = 'Cam Bridge' +AND named_places.name = 'Ashton'; + +# FIXME: wrong result: NULL, expected 12 +#--echo # Conformance Item T47 +#SELECT ST_AsText(ST_Intersection(centerline, shore)) +#FROM streams, lakes +#WHERE streams.name = 'Cam Stream' +#AND lakes.name = 'Blue Lake'; + +--echo # Conformance Item T48 +SELECT ST_AsText(ST_Difference(named_places.boundary, forests.boundary)) +FROM named_places, forests +WHERE named_places.name = 'Ashton' +AND forests.name = 'Green Forest'; + +#--echo # Conformance Item T49 +SELECT ST_AsText(ST_Union(shore, boundary)) +FROM lakes, named_places +WHERE lakes.name = 'Blue Lake' +AND named_places.name = 'Goose Island'; + +--echo # Conformance Item T50 +SELECT ST_AsText(ST_SymDifference(shore, boundary)) +FROM lakes, named_places +WHERE lakes.name = 'Blue Lake' +AND named_places.name = 'Ashton'; + +--echo # Conformance Item T51 +SELECT count(*) +FROM buildings, bridges +WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1; + +# TODO: WL#2377 +#--echo # Conformance Item T52 +#SELECT ST_AsText(ConvexHull(shore)) +#FROM lakes +#WHERE lakes.name = 'Blue Lake'; + +DROP DATABASE gis_ogs; + +--echo # +--echo # Bug#13362660 ASSERTION `FIELD_POS < FIELD_COUNT' FAILED. IN PROTOCOL_TEXT::STORE +--echo # + +# --error ER_GIS_INVALID_DATA +SELECT ST_Union('', ''), md5(1); diff --git a/mysql-test/suite/innodb_gis/t/alter_spatial_index.test b/mysql-test/suite/innodb_gis/t/alter_spatial_index.test new file mode 100644 index 00000000000..efd6cb6c867 --- /dev/null +++ b/mysql-test/suite/innodb_gis/t/alter_spatial_index.test @@ -0,0 +1,753 @@ +# ****************************************************************** +# Test Alter table add spatial idex asc/desc comments +# Test error Alter table modify column with No not null option +# Test error Alter table modify column with null option +# Test table column having both indexes spatial and Btree +# Test error Alter table spatial index using hash/Btree +# Test modify column from point to multipoint,line to multiline +# Test modify column from mutipoint to point,multiline to line +# Test discard & import tablepsace +# spatial index on temp tables +# Unique constraint on spatial index column Geometry +# Unique constraint on spatial index column POINT +# Modify Engine Innodb to Myisam to InnoDB +# Check Foreign Key constraint on Point column +# Check Foreign Key constraint on Geometry column +# ****************************************************************** + +CALL mtr.add_suppression("but MySQL is asking statistics for 2 columns. Have you mixed"); + +--source include/have_innodb.inc +--source include/have_geometry.inc + +let MYSQLD_DATADIR= `select @@datadir`; + +CREATE TABLE tab(c1 int NOT NULL PRIMARY KEY,c2 POINT NOT NULL, +c3 LINESTRING NOT NULL,c4 POLYGON NOT NULL,c5 GEOMETRY NOT NULL) +ENGINE=InnoDB; + +CREATE TABLE tab1(c1 int NOT NULL PRIMARY KEY,c2 MULTIPOINT NOT NULL, +c3 MULTILINESTRING NOT NULL,c4 MULTIPOLYGON NOT NULL,c5 GEOMETRY NOT NULL) +ENGINE=InnoDB; + +INSERT INTO tab1 SELECT * FROM tab; + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(1,ST_GeomFromText('POINT(10 10)'),ST_GeomFromText('LINESTRING(5 5,20 20,30 30)'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))')); + + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(2,ST_GeomFromText('POINT(20 20)'),ST_GeomFromText('LINESTRING(20 20,30 30,40 40)'), +ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))'), +ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))')); + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(3,ST_GeomFromText('POINT(4 4)'),ST_GeomFromText('LINESTRING(130 130,140 140,150 150)'), +ST_GeomFromText('POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'), +ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))')); + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(4,ST_GeomFromText('POINT(50 50)'),ST_GeomFromText('LINESTRING(200 200,300 300,400 400)'), +ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))'), +ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))')); + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(5,ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(400 400,500 500,600 700)'), +ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))'), +ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))')); + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(6,ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))'), +ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))')); + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(7,ST_GeomFromText('POINT(60 70)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))')); + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(8,ST_GeomFromText('POINT(0 0)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))')); + + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(9,ST_GeomFromText('POINT(120 120)'),ST_GeomFromText('LINESTRING(100 100,110 110,120 120)'), +ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))'), +ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))')); + + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(10,ST_GeomFromText('POINT(160 160)'),ST_GeomFromText('LINESTRING(140 140,150 150,160 160)'), +ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'), +ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))')); + + +ALTER TABLE tab ADD SPATIAL INDEX idx2(c2 ASC); + +ALTER TABLE tab ADD SPATIAL KEY idx3(c3 DESC); + +ALTER TABLE tab ADD SPATIAL INDEX idx4(c4 ASC) COMMENT 'testing spatial index on Polygon'; + +ALTER TABLE tab ADD SPATIAL KEY idx5(c5 ASC) COMMENT 'testing spatial index on Geometry'; + +ALTER TABLE tab ADD INDEX idx6(c4(10)) USING BTREE; + + +# Test the MBRContains +SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); + +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1); + +UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRContains(tab.c4, @g1); + +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1); + +DELETE FROM tab WHERE MBRContains(tab.c4, @g1); + +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1); + + +SET @g1 = ST_GeomFromText('LINESTRING( 300 300,400 400)'); + +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1); + +UPDATE tab SET C2 = ST_GeomFromText('POINT(100 100)') +WHERE MBRContains(tab.c4, @g1); + +DELETE FROM tab WHERE MBRContains(tab.c4, @g1); + +# Test the MBRWithin +SET @g1 = ST_GeomFromText( 'POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))'); + +SELECT c1,ST_AsText(c2),ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1); + +UPDATE tab SET C2 = ST_GeomFromText('POINT(200 200)') +WHERE MBRWithin(tab.c4, @g1); + +SELECT c1,ST_AsText(c2),ST_AsText(c4) FROM tab WHERE MBRWithin(tab.c4, @g1); + +DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); + +--error ER_SPATIAL_CANT_HAVE_NULL +ALTER TABLE tab MODIFY COLUMN c2 MULTIPOINT; + +--error ER_SPATIAL_CANT_HAVE_NULL +ALTER TABLE tab MODIFY COLUMN c3 MULTILINESTRING; + +--error ER_SPATIAL_CANT_HAVE_NULL +ALTER TABLE tab MODIFY COLUMN c4 MULTIPOLYGON; + +--error ER_SPATIAL_CANT_HAVE_NULL +ALTER TABLE tab MODIFY COLUMN c3 MULTILINESTRING NULL; + +--error ER_SPATIAL_CANT_HAVE_NULL +ALTER TABLE tab MODIFY COLUMN c4 MULTIPOLYGON NULL; + +--error ER_SPATIAL_CANT_HAVE_NULL +ALTER TABLE tab MODIFY COLUMN c4 Geometry NULL; + +--error ER_SPATIAL_CANT_HAVE_NULL +ALTER TABLE tab CHANGE COLUMN c2 c22 POINT; + +--error ER_SPATIAL_CANT_HAVE_NULL +ALTER TABLE tab CHANGE COLUMN c3 c33 LINESTRING; + +--error ER_SPATIAL_CANT_HAVE_NULL +ALTER TABLE tab CHANGE COLUMN c4 c44 POLYGON; + +# --error ER_SPATIAL_MUST_HAVE_GEOM_COL +--error ER_WRONG_ARGUMENTS +ALTER TABLE tab add SPATIAL INDEX idx1(c1); + +--error ER_PARSE_ERROR +ALTER TABLE tab ADD SPATIAL INDEX idx6(c2 ASC) USING BTREE; + +--error ER_PARSE_ERROR +ALTER TABLE tab ADD SPATIAL INDEX idx6(c2 ASC) USING HASH; + +# --error ER_INVALID_USE_OF_NULL +# ALTER TABLE tab CHANGE c2 c2 MULTIPOINT NOT NULL FIRST, ALGORITHM=COPY; + +# --error ER_CANT_CREATE_GEOMETRY_OBJECT +# ALTER TABLE tab MODIFY COLUMN c3 MULTILINESTRING NOT NULL,ALGORITHM=COPY; + +# --error ER_CANT_CREATE_GEOMETRY_OBJECT +# ALTER TABLE tab MODIFY COLUMN c4 MULTIPOLYGON NOT NULL; + +SHOW CREATE TABLE tab; + +--replace_column 7 # +SHOW INDEX FROM tab; + +SET @g1 = ST_GeomFromText('POLYGON((20 20,30 30,40 40,50 50,40 50,30 40,30 30,20 20))'); + +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1); + +UPDATE tab SET C2 = ST_GeomFromText('POINT(1000 1000)') +WHERE ST_Crosses(tab.c4, @g1); + +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1); + +DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); + +ALTER TABLE tab CHANGE COLUMN c2 c22 POINT NOT NULL; + +ALTER TABLE tab CHANGE COLUMN c3 c33 LINESTRING NOT NULL; + +ALTER TABLE tab CHANGE COLUMN c4 c44 POLYGON NOT NULL; + +SHOW CREATE TABLE tab; + +--replace_column 7 # +SHOW INDEX FROM tab; + +ALTER TABLE tab CHANGE COLUMN c22 c2 POINT NOT NULL; + +ALTER TABLE tab CHANGE COLUMN c33 c3 LINESTRING NOT NULL; + +ALTER TABLE tab CHANGE COLUMN c44 c4 POLYGON NOT NULL; + +SHOW CREATE TABLE tab; + +--replace_column 7 # +SHOW INDEX FROM tab; + +ALTER TABLE tab DISABLE KEYS; + +SHOW WARNINGS; + +SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); + +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1); + +UPDATE tab SET C2 = ST_GeomFromText('POINT(2000 2000)') +WHERE MBREquals(tab.c4, @g1); + +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1); + +DELETE FROM tab WHERE MBREquals(tab.c4, @g1); + +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1); + +ALTER TABLE tab DROP PRIMARY KEY; + +ALTER TABLE tab ADD PRIMARY KEY(c2) ; + +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); + +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1); + +UPDATE tab SET C2 = ST_GeomFromText('POINT(3000 3000)') +WHERE ST_Touches(tab.c4, @g1); + +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1); + +DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); + +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1); + +FLUSH TABLE tab FOR EXPORT; + +--copy_file $MYSQLD_DATADIR/test/tab.ibd $MYSQLD_DATADIR/test/tab.ibd.bk + +UNLOCK TABLES; + +ALTER TABLE tab DISCARD TABLESPACE; + +--disable_warnings + +--error ER_TABLESPACE_DISCARDED +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab; + +--copy_file $MYSQLD_DATADIR/test/tab.ibd.bk $MYSQLD_DATADIR/test/tab.ibd + +--remove_file $MYSQLD_DATADIR/test/tab.ibd.bk + +--disable_query_log + +ALTER TABLE tab IMPORT TABLESPACE; + +--enable_query_log + +CHECK TABLE tab; + +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab ORDER BY c1; + +SET @g1 = ST_GeomFromText('LINESTRING( 3010 3010,4010 4010,5010 5010)'); + +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) order by c1; + +--error ER_DUP_ENTRY +UPDATE tab SET c2 = ST_GeomFromText('POINT(4000 4000)') +WHERE MBRIntersects(tab.c4, @g1); + +# --error ER_CANT_CREATE_GEOMETRY_OBJECT +# UPDATE tab SET c4 = ST_GeomFromText('POINT(4000 4000)') +# WHERE MBRIntersects(tab.c4, @g1); + +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +DELETE FROM tab WHERE MBRIntersects(tab.c4, @g1); + +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; + +INSERT INTO tab SELECT * FROM tab1; + +ALTER TABLE tab DROP PRIMARY KEY; + +ALTER TABLE tab DROP INDEX idx2; + +# Check spatial index on temp tables + +CREATE TEMPORARY TABLE temp_tab AS SELECT * FROM tab where c1 = c2; + +INSERT INTO temp_tab SELECT * FROM tab; + +CREATE SPATIAL INDEX idx2 ON temp_tab(c2); + +CREATE SPATIAL INDEX idx3 ON temp_tab(c3); + +CREATE SPATIAL INDEX idx4 ON temp_tab(c4); + +CREATE SPATIAL INDEX idx5 ON temp_tab(c5); + +SHOW CREATE TABLE temp_tab; + +SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); + +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM temp_tab WHERE MBRContains(temp_tab.c4, @g1) ORDER BY c1; + +# The following comments will be removed once the patch is available +UPDATE temp_tab SET C2 = ST_GeomFromText('POINT(1000 1000)') +WHERE MBRContains(temp_tab.c4, @g1); + +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM temp_tab WHERE MBRContains(temp_tab.c4, @g1); + +# Sever crashes Here so commented, will be removed later +DELETE FROM temp_tab WHERE MBRContains(temp_tab.c4, @g1); + +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM temp_tab WHERE MBRContains(temp_tab.c4, @g1) ORDER BY c1; + +# Check Unique constraint on spatial index column POINT + +SHOW CREATE TABLE tab; + +--replace_column 7 # +SHOW INDEX FROM tab; + +DELETE FROM tab; + +ALTER TABLE tab ADD PRIMARY KEY(c2); + +CREATE SPATIAL INDEX idx2 ON tab(c2 ASC); + +ALTER TABLE tab ADD CONSTRAINT const_1 UNIQUE(c2); + +SHOW CREATE TABLE tab; + +--replace_column 7 # +SHOW INDEX FROM tab; + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(1,ST_GeomFromText('POINT(10 10)'),ST_GeomFromText('LINESTRING(5 5,20 20,30 30)'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))')); + +# Check Unique constraint on spatial index column Geometry + +DELETE FROM tab; + +ALTER TABLE tab DROP PRIMARY KEY ; + +ALTER TABLE tab DROP KEY const_1; + +ALTER TABLE tab ADD PRIMARY KEY(c5(10)); + +ALTER TABLE tab ADD CONSTRAINT const_1 UNIQUE(c5(10)); + +SHOW CREATE TABLE tab; + +--replace_column 7 # +SHOW INDEX FROM tab; + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(1,ST_GeomFromText('POINT(10 10)'),ST_GeomFromText('LINESTRING(5 5,20 20,30 30)'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))')); + +#cleanup +DROP TABLE tab,tab1,temp_tab; + +--enable_warnings + +# Check Modify POINT to GEOMETRY and GEOMETRY to POINT +CREATE TABLE tab(c1 int NOT NULL PRIMARY KEY,c2 POINT NOT NULL, +c3 LINESTRING NOT NULL,c4 POLYGON NOT NULL,c5 GEOMETRY NOT NULL) +ENGINE=InnoDB; + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(1,ST_GeomFromText('POINT(10 10)'),ST_GeomFromText('LINESTRING(5 5,20 20,30 30)'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))')); + + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(2,ST_GeomFromText('POINT(20 20)'),ST_GeomFromText('LINESTRING(20 20,30 30,40 40)'), +ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))'), +ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))')); + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(3,ST_GeomFromText('POINT(4 4)'),ST_GeomFromText('LINESTRING(130 130,140 140,150 150)'), +ST_GeomFromText('POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'), +ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))')); + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(4,ST_GeomFromText('POINT(50 50)'),ST_GeomFromText('LINESTRING(200 200,300 300,400 400)'), +ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))'), +ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))')); + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(5,ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(400 400,500 500,600 700)'), +ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))'), +ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))')); + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(6,ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))'), +ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))')); + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(7,ST_GeomFromText('POINT(60 70)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))')); + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(8,ST_GeomFromText('POINT(0 0)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))')); + + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(9,ST_GeomFromText('POINT(120 120)'),ST_GeomFromText('LINESTRING(100 100,110 110,120 120)'), +ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))'), +ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))')); + + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(10,ST_GeomFromText('POINT(160 160)'),ST_GeomFromText('LINESTRING(140 140,150 150,160 160)'), +ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'), +ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))')); + +ANALYZE TABLE tab; + +ALTER TABLE tab ADD SPATIAL INDEX idx2(c2 ASC); + +ALTER TABLE tab ADD SPATIAL KEY idx3(c3 DESC); + +ALTER TABLE tab ADD SPATIAL INDEX idx4(c4 ASC) COMMENT 'testing spatial index on Polygon'; + +ALTER TABLE tab ADD SPATIAL KEY idx5(c5 ASC) COMMENT 'testing spatial index on Geometry'; + +ALTER TABLE tab ADD INDEX idx6(c4(10)) USING BTREE; + + +ALTER TABLE tab MODIFY COLUMN c2 GEOMETRY NOT NULL; + +# --error ER_CANT_CREATE_GEOMETRY_OBJECT +# ALTER TABLE tab MODIFY COLUMN c3 POLYGON NOT NULL; + +# --error ER_INVALID_USE_OF_NULL +# ALTER TABLE tab add COLUMN c7 POINT NOT NULL; + +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE tab add COLUMN c8 POINT NOT NULL, ALGORITHM = INPLACE, LOCK=NONE; + +SHOW CREATE TABLE tab; + +--replace_column 7 # +SHOW INDEX FROM tab; + +SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); + +UPDATE tab SET C2 = ST_GeomFromText('POINT(1000 1000)') +WHERE MBRContains(tab.c4, @g1); + +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +DELETE FROM tab WHERE MBRContains(tab.c4, @g1); + +SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +# --error ER_CANT_CREATE_GEOMETRY_OBJECT +# ALTER TABLE tab MODIFY COLUMN c2 POLYGON NOT NULL; + +ALTER TABLE tab MODIFY COLUMN c4 GEOMETRY NOT NULL; + +SHOW CREATE TABLE tab; + +--replace_column 7 # +SHOW INDEX FROM tab; + +ANALYZE TABLE tab; + +SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); + +SET @g2 = ST_GeomFromText('LINESTRING(140 140,150 150,160 160)'); + +SELECT c1,ST_Astext(c2),ST_AsText(c3),ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) +AND MBREquals(tab.c3,@g2) ORDER BY c1; + +UPDATE tab SET C2 = ST_GeomFromText('POINT(2000 2000)') +WHERE MBREquals(tab.c4, @g1) AND MBREquals(tab.c3,@g2); + +SELECT c1,ST_Astext(c2),ST_AsText(c3),ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) +AND MBREquals(tab.c3,@g2) ORDER BY c1; + +DELETE FROM tab WHERE MBREquals(tab.c4, @g1) AND MBREquals(tab.c3,@g2); + +SELECT c1,ST_Astext(c2),ST_AsText(c3),ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) +AND MBREquals(tab.c3,@g2) ORDER BY c1; + +ANALYZE TABLE tab; + +SET @g1 = ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))'); + +SET @g2 = ST_GeomFromText('LINESTRING(1 1,2 2,3 3)'); + +# When Point type data exist in the column allow DDL operation +ALTER TABLE tab MODIFY COLUMN c2 POINT NOT NULL; + +ALTER TABLE tab MODIFY COLUMN c3 LINESTRING NOT NULL; + +ALTER TABLE tab MODIFY COLUMN c4 POLYGON NOT NULL; + +SHOW CREATE TABLE tab; + +--replace_column 7 # +SHOW INDEX FROM tab; + +ANALYZE TABLE tab; + +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); + +SET @g2 = ST_GeomFromText('LINESTRING(1 1,2 2,3 3)'); + +# Should be 0 rows affected +SELECT c1,ST_Astext(c2),ST_AsText(c3),ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) +AND ST_Touches(tab.c3,@g2); + +# Should be 0 rows affected +UPDATE tab SET C2 = ST_GeomFromText('POINT(2000 2000)') +WHERE ST_Touches(tab.c4, @g1) AND ST_Touches(tab.c3,@g2); + +# Should be 0 rows affected +DELETE FROM tab WHERE ST_Touches(tab.c4, @g1) AND ST_Touches(tab.c3,@g2); + +# Should be 0 rows affected +SELECT c1,ST_Astext(c2),ST_AsText(c3),ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) +AND ST_Touches(tab.c3,@g2); + +# should be 1 row affected +SELECT c1,ST_Astext(c2),ST_AsText(c3),ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) +OR ST_Touches(tab.c3,@g2); + +# should be 1 row affected +UPDATE tab SET C2 = ST_GeomFromText('POINT(2000 2000)') +WHERE ST_Touches(tab.c4, @g1) OR ST_Touches(tab.c3,@g2); + +# should be 1 row affected +SELECT c1,ST_Astext(c2),ST_AsText(c3),ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) +OR ST_Touches(tab.c3,@g2); + +# should be 1 row affected +DELETE FROM tab WHERE ST_Touches(tab.c4, @g1) OR ST_Touches(tab.c3,@g2); + +# Should be Empty set +SELECT c1,ST_Astext(c2),ST_AsText(c3),ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) +OR ST_Touches(tab.c3,@g2); + +# --error ER_SPATIAL_MUST_HAVE_GEOM_COL +--error ER_WRONG_ARGUMENTS +ALTER TABLE tab MODIFY COLUMN c4 INT NOT NULL; + +# --error ER_SPATIAL_MUST_HAVE_GEOM_COL +--error ER_WRONG_ARGUMENTS +ALTER TABLE tab MODIFY COLUMN c4 BLOB NOT NULL; + +# Test InnoDB to Myisam to InnoDB +ALTER TABLE tab ENGINE Myisam; + +ALTER TABLE tab ENGINE InnoDB; + +ANALYZE TABLE tab; + +SET @g1 = ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))'); + +SET @g2 = ST_GeomFromText('LINESTRING(400 400,500 500,600 700)'); + +SELECT c1,ST_AsText(c2),ST_AsText(c3),ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) AND MBRWithin(tab.c3, @g2); + +# --error ER_CANT_CREATE_GEOMETRY_OBJECT +# UPDATE tab SET c2 = ST_GeomFromText('POINT(2000 2000)'), +# c3=ST_GeomFromText('POINT(2000 2000)') +# WHERE MBRWithin(tab.c4, @g1) AND MBRWithin(tab.c3, @g2); + +SET @g1 = ST_GeomFromText('POINT(2000 2000)'); + +SET @g2 = ST_GeomFromText('POINT(2000 2000)'); + +SELECT c1,ST_AsText(c2),ST_AsText(c3),ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c2, @g1) AND MBRWithin(tab.c3, @g2); + +DELETE FROM tab WHERE MBRWithin(tab.c2, @g1) AND MBRWithin(tab.c3, @g2); + +SELECT c1,ST_AsText(c2),ST_AsText(c3),ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c2, @g1) AND MBRWithin(tab.c3, @g2); + +#cleanup +DROP TABLE tab; + +# Check Foreign Key constraint on Point column +CREATE TABLE parent (id POINT, PRIMARY KEY(id)) ENGINE=InnoDB; + +CREATE TABLE child (id GEOMETRY NOT NULL, parent_id POINT NOT NULL) ENGINE=InnoDB; + +ALTER TABLE parent ADD SPATIAL INDEX idx1(id ASC); + +ALTER TABLE child ADD SPATIAL INDEX idx2(parent_id ASC); + +SHOW CREATE TABLE parent; + +SHOW CREATE TABLE child; + +SHOW INDEX FROM parent; + +--replace_column 7 # +SHOW INDEX FROM child; + +# --error ER_CANNOT_ADD_FOREIGN +--disable_result_log +--error ER_CANT_CREATE_TABLE +ALTER TABLE child ADD FOREIGN KEY(parent_id) REFERENCES parent(id) ; + +# --error ER_CANNOT_ADD_FOREIGN +--error ER_CANT_CREATE_TABLE +ALTER TABLE child ADD FOREIGN KEY(parent_id) REFERENCES parent(id) ON DELETE CASCADE ; +--enable_result_log + +#cleanup +DROP table child,parent; + +# Check Foreign Key constraint on Geometry column +CREATE TABLE parent (id GEOMETRY, PRIMARY KEY(id(10))) ENGINE=InnoDB; + +CREATE TABLE child (id GEOMETRY NOT NULL, parent_id GEOMETRY NOT NULL) ENGINE=InnoDB; + +ALTER TABLE parent ADD SPATIAL INDEX idx1(id ASC) ; + +ALTER TABLE child ADD SPATIAL INDEX idx2(parent_id ASC); + +SHOW CREATE TABLE parent; + +SHOW CREATE TABLE child; + +SHOW INDEX FROM parent; + +SHOW INDEX FROM child; + +--disable_result_log +# --error ER_BLOB_KEY_WITHOUT_LENGTH +--error ER_CANT_CREATE_TABLE +ALTER TABLE child ADD FOREIGN KEY(parent_id) REFERENCES parent(id) ; +--enable_result_log + +#cleanup +DROP table child,parent; + +# Check add spatial index when table already has rows (inplace). +create table t1 (c1 int) engine=innodb; +insert into t1 values(NULL); + +# Add spatial index fail, since geometry column can't be null. +--error ER_SPATIAL_CANT_HAVE_NULL +alter table t1 add b geometry, add spatial index(b), algorithm=inplace; + +# Add spatial index fail, since there's invalid geo data. +# The case has to be commented because it no longer fails and following cases +# don't expect the effect of such a statement. +#--error ER_CANT_CREATE_GEOMETRY_OBJECT +# alter table t1 add b geometry not null, add spatial index(b), algorithm=inplace; + +# Add a geometry column. +alter table t1 add b geometry, algorithm=inplace; + +# Add spatial index fail, since there's a NULL or invalid geo data. +# The case has to be commented because it no longer fails and following cases +# don't expect the effect of such a statement. +#--error ER_CANT_CREATE_GEOMETRY_OBJECT +#alter table t1 add spatial index(b), algorithm=inplace; + +# Update invalide geo data to point(0 0). +update t1 set b = st_geomfromtext('point(0 0)'); + +# Add spatial index success. +--error ER_SPATIAL_CANT_HAVE_NULL +alter table t1 add spatial index(b), algorithm=inplace; + +# Delete rows. +delete from t1; + +#cleanup +DROP table t1; + +# Check add spatial index when table already has rows (copy). +create table t1 (c1 int) engine=innodb; +insert into t1 values(NULL); + +# Add spatial index fail, since geometry column can't be null. +--error ER_SPATIAL_CANT_HAVE_NULL +alter table t1 add b geometry, add spatial index(b), algorithm=copy; + +# Add spatial index fail, since there's a NULL or invalid geo data. +# --error ER_INVALID_USE_OF_NULL +--error ER_CANT_CREATE_GEOMETRY_OBJECT +alter table t1 add b geometry not null, add spatial index(b), algorithm=copy; + +# Add a geometry column. +# --error ER_INVALID_USE_OF_NULL +# alter table t1 add b geometry not null, algorithm=copy; + +# Add spatial index. +# The case has to be commented because it no longer fails and following cases +# don't expect the effect of such a statement. +#--error ER_CANT_CREATE_GEOMETRY_OBJECT +#alter table t1 add spatial index(b), algorithm=copy; + +# Update invalide geo data to point(0 0). +--error ER_BAD_FIELD_ERROR +update t1 set b = st_geomfromtext('point(0 0)'); + +# Add spatial index success. +--error ER_KEY_COLUMN_DOES_NOT_EXITS +alter table t1 add spatial index(b), algorithm=copy; + +# Delete rows. +delete from t1; + +#cleanup +DROP table t1; + +--echo # +--echo # BUG#20111575 ALTER TABLE...ADD SPATIAL INDEX...LOCK NONE IS REFUSED +--echo # WITHOUT STATING A REASON +--echo # +CREATE TABLE t1(p point NOT NULL) ENGINE=innodb; +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t1 ADD SPATIAL INDEX(p), LOCK=NONE; +ALTER TABLE t1 ADD SPATIAL INDEX(p); +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t1 FORCE, LOCK=NONE; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_gis/t/check_rtree.test b/mysql-test/suite/innodb_gis/t/check_rtree.test new file mode 100644 index 00000000000..09bba50d191 --- /dev/null +++ b/mysql-test/suite/innodb_gis/t/check_rtree.test @@ -0,0 +1,27 @@ +# This test case will test checking R-tree features. + +# Not supported in embedded +--source include/not_embedded.inc +--source include/have_debug.inc +--source include/have_innodb.inc + +# Create table with R-tree index. +create table t1 (i int, g geometry not null, spatial index (g))engine=innodb; + +# Turn on the geometry data print. +SET SESSION debug="+d,rtree_test_check_count"; + +# Insert values. +insert into t1 values (1, POINT(1,1)); +insert into t1 values (1, POINT(1.5,1.5)); +insert into t1 values (1, POINT(3,3)); +insert into t1 values (1, POINT(3.1,3.1)); +insert into t1 values (1, POINT(5,5)); + +CALL mtr.add_suppression("InnoDB: Flagged corruption of `g` in table `test`.`t1` in CHECK TABLE; Wrong count"); + +# Select by R-tree index. +check table t1; + +# Cleanup. +drop table t1; diff --git a/mysql-test/suite/innodb_gis/t/create_spatial_index.test b/mysql-test/suite/innodb_gis/t/create_spatial_index.test new file mode 100644 index 00000000000..d25a2e79793 --- /dev/null +++ b/mysql-test/suite/innodb_gis/t/create_spatial_index.test @@ -0,0 +1,1175 @@ +# ********************************************************* +# Test Multiple Spatial Indexes on compression table +# Test spatial index with table having primary key column +# Test Spatial index with Create Index different clauses +# Test Spatial index with spatial relationship functions +# Test Spatial index with MBR spatial relationship functions +# Test Spatial index columns with DML & SELECT queries +# Test Spatial index with procedures +# Test Delete & Update & check status of the table +# Test spatial index with table have no primary key column +# Test spatial index with table have no auto_increment +# Test spatial index with check constraint +# ********************************************************** +--source include/have_innodb.inc +--source include/have_innodb_16k.inc +--source include/have_geometry.inc + + +# Check spatial index functionality on compress table with Primary key +CREATE TABLE tab(c1 int NOT NULL PRIMARY KEY,c2 POINT NOT NULL, +c3 LINESTRING NOT NULL,c4 POLYGON NOT NULL,c5 GEOMETRY NOT NULL) +ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; + +# Check spatial index functionality with Create Index clause options +CREATE SPATIAL INDEX idx1 on tab(c2 ASC); +CREATE SPATIAL INDEX idx2 on tab(c3 DESC) COMMENT 'wl6968'; +CREATE SPATIAL INDEX idx3 on tab(c4 ASC) KEY_BLOCK_SIZE=8 ; +CREATE SPATIAL INDEX idx4 on tab(c5 DESC) KEY_BLOCK_SIZE=4 +COMMENT 'Spatial index on Geometry type column'; + +# Check index type +SHOW INDEXES FROM tab; + +# Populate some spatial data +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(1,ST_GeomFromText('POINT(10 10)'),ST_GeomFromText('LINESTRING(5 5,20 20,30 30)'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))')); + + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(2,ST_GeomFromText('POINT(20 20)'),ST_GeomFromText('LINESTRING(20 20,30 30,40 40)'), +ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))'), +ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))')); + + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(3,ST_GeomFromText('POINT(4 4)'),ST_GeomFromText('LINESTRING(130 130,140 140,150 150)'), +ST_GeomFromText('POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'), +ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))')); + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(4,ST_GeomFromText('POINT(50 50)'),ST_GeomFromText('LINESTRING(200 200,300 300,400 400)'), +ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))'), +ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))')); + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(5,ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(400 400,500 500,600 700)'), +ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))'), +ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))')); + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(6,ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))'), +ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))')); + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(7,ST_GeomFromText('POINT(60 70)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))')); + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(8,ST_GeomFromText('POINT(0 0)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))')); + + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(9,ST_GeomFromText('POINT(120 120)'),ST_GeomFromText('LINESTRING(100 100,110 110,120 120)'), +ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))'), +ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))')); + + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(10,ST_GeomFromText('POINT(160 160)'),ST_GeomFromText('LINESTRING(140 140,150 150,160 160)'), +ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'), +ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))')); + +ANALYZE TABLE tab; + +# Check the spatial relationship between 2 GIS shapes + +# Test the MBRContains +SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRContains(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); + +SET @g1 = ST_GeomFromText('LINESTRING( 300 300,400 400)'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRContains(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); + +# Test the MBRWithin +SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRWithin(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); + +# Test the ST_Crosses +SET @g1 = ST_GeomFromText('POLYGON((100 200,200 300,400 500,500 300,300 200,100 300,100 200))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Crosses(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); + +SET @g1 = ST_GeomFromText('LINESTRING( 10 10,30 30,40 40)'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_CRosses(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Crosses(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); + +# Test the MBRDisjoint +SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRDisjoint(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); + +# Test the MBREquals +SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBREquals(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); + +# Test the MBRintersects +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); + +SET @g1 = ST_GeomFromText('LINESTRING( 30 30,40 40,50 50)'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); + +# Test the Overelaps +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBROverlaps(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); + +SET @g1 = ST_GeomFromText('LINESTRING(7 1,30 30,1010 3010,1010 2010,3010 3010,4010 4010,5010 5010 )'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBROverlaps(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); + +# Test the ST_Touches +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Touches(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); + +SET @g1 = ST_GeomFromText('LINESTRING( 100 100,200 200,300 300)'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Touches(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); + +# Test the MBRContains +SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRContains(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); + +SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRWithin(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); + +# Test the MBRDisjoint +SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRDisjoint(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); + +# Test the MBREquals +SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBREquals(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); + +# Test the MBRintersects +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); + +SET @g1 = ST_GeomFromText('LINESTRING( 30 30,40 40,50 50)'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); + +# Test the MBROverelaps +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBROverlaps(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); + +# Test the MBRTouches +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRTouches(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRTouches(tab.c4, @g1); + +# Test with Procedure +delimiter |; + +CREATE PROCEDURE proc_wl6968() +BEGIN + +SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRContains(tab.c4, @g1); +EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); + +END | + +delimiter ;| + +CALL proc_wl6968(); + +# Test the Delete & Update +SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +DELETE FROM tab WHERE MBRContains(tab.c4, @g1); + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +CHECK TABLE tab; + +SET @g1 = ST_GeomFromText('LINESTRING( 300 300,400 400)'); + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +DELETE FROM tab WHERE MBRContains(tab.c4, @g1); + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +CHECK TABLE tab; + +SET @g1 = ST_GeomFromText('POLYGON((100 200,1010 1010,1020 1020,500 300,300 200,100 300,100 200))'); + +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; + +DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); + +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; + +CHECK TABLE tab; + +SET @g1 = ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'); + +SET @g2 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); + +UPDATE tab SET C4 = @g2 WHERE ST_Crosses(tab.c4, @g1); + +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g2) ORDER BY c1; + +CHECK TABLE tab; + +# Cleanup +DROP TABLE tab; +DROP PROCEDURE proc_wl6968; + +# End of Testcase compress table with Primary key + +# Check spatial index functionality on compress table No Primary key +CREATE TABLE tab(c1 int ,c2 POINT NOT NULL, +c3 LINESTRING NOT NULL,c4 POLYGON NOT NULL,c5 GEOMETRY NOT NULL) +ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16; + +# Check spatial index functionality with Create Index clause options +CREATE SPATIAL INDEX idx1 on tab(c2 ASC); +CREATE SPATIAL INDEX idx2 on tab(c3 DESC) COMMENT 'wl6968'; +CREATE SPATIAL INDEX idx3 on tab(c4 ASC) KEY_BLOCK_SIZE=2 ; +CREATE SPATIAL INDEX idx4 on tab(c5 DESC) KEY_BLOCK_SIZE=8 +COMMENT 'Spatial index on Geometry type column'; + +# Check index type +SHOW INDEXES FROM tab; + +# Populate some spatial data +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(1,ST_GeomFromText('POINT(10 10)'),ST_GeomFromText('LINESTRING(5 5,20 20,30 30)'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))')); + + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(2,ST_GeomFromText('POINT(20 20)'),ST_GeomFromText('LINESTRING(20 20,30 30,40 40)'), +ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))'), +ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))')); + + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(3,ST_GeomFromText('POINT(4 4)'),ST_GeomFromText('LINESTRING(130 130,140 140,150 150)'), +ST_GeomFromText('POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'), +ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))')); + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(4,ST_GeomFromText('POINT(50 50)'),ST_GeomFromText('LINESTRING(200 200,300 300,400 400)'), +ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))'), +ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))')); + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(5,ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(400 400,500 500,600 700)'), +ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))'), +ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))')); + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(6,ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))'), +ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))')); + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(7,ST_GeomFromText('POINT(60 70)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))')); + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(8,ST_GeomFromText('POINT(0 0)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))')); + + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(9,ST_GeomFromText('POINT(120 120)'),ST_GeomFromText('LINESTRING(100 100,110 110,120 120)'), +ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))'), +ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))')); + + +INSERT INTO tab(c1,c2,c3,c4,c5) +VALUES(10,ST_GeomFromText('POINT(160 160)'),ST_GeomFromText('LINESTRING(140 140,150 150,160 160)'), +ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'), +ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))')); + +ANALYZE TABLE tab; + +# Check the spatial relationship between 2 GIS shapes + +# Test the MBRContains +SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRContains(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); + +SET @g1 = ST_GeomFromText('LINESTRING( 300 300,400 400)'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRContains(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); + +# Test the MBRWithin +SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRWithin(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); + +# Test the ST_Crosses +SET @g1 = ST_GeomFromText('POLYGON((100 200,200 300,400 500,500 300,300 200,100 300,100 200))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Crosses(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); + +SET @g1 = ST_GeomFromText('LINESTRING( 10 10,30 30,40 40)'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_CRosses(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Crosses(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); + +# Test the MBRDisjoint +SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRDisjoint(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); + +# Test the MBREquals +SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBREquals(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); + +# Test the MBRintersects +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); + +SET @g1 = ST_GeomFromText('LINESTRING( 30 30,40 40,50 50)'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); + +# Test the Overelaps +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBROverlaps(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); + +SET @g1 = ST_GeomFromText('LINESTRING(7 1,30 30,1010 3010,1010 2010,3010 3010,4010 4010,5010 5010 )'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBROverlaps(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); + +# Test the ST_Touches +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Touches(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); + +SET @g1 = ST_GeomFromText('LINESTRING( 100 100,200 200,300 300)'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Touches(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); + +# Test the MBRContains +SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRContains(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); + +SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRWithin(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); + +# Test the MBRDisjoint +SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRDisjoint(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); + +# Test the MBREquals +SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBREquals(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); + +# Test the MBRintersects +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); + +SET @g1 = ST_GeomFromText('LINESTRING( 30 30,40 40,50 50)'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); + +# Test the MBROverelaps +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBROverlaps(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); + +# Test the MBRTouches +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRTouches(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRTouches(tab.c4, @g1); + +# Test with Procedure +delimiter |; + +CREATE PROCEDURE proc_wl6968() +BEGIN + +SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBREquals(tab.c4, @g1); +EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); + +END | + +delimiter ;| + +CALL proc_wl6968(); + +# Test the Delete & Update +SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; + +DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; + +CHECK TABLE tab; + +SET @g1 = ST_GeomFromText('POLYGON((100 200,200 300,400 500,500 300,300 200,100 300,100 200))'); + +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; + +DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); + +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; + +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); + +SET @g2 = ST_GeomFromText( 'POLYGON((1 1,2 2,3 3,10 3,5 1,1 1))'); + +UPDATE tab SET C4 = @g2 WHERE MBROverlaps(tab.c4, @g1); + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; + +CHECK TABLE tab; + +# Cleanup +DROP TABLE tab; +DROP PROCEDURE proc_wl6968; + +# End of Testcase compress table No Primary key + +# Check spatial index functionality on compress table with auto_increment +CREATE TABLE tab(c1 int AUTO_INCREMENT PRIMARY KEY,c2 POINT NOT NULL, +c3 LINESTRING NOT NULL,c4 POLYGON NOT NULL,c5 GEOMETRY NOT NULL) +ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16; + +# Check spatial index functionality with Create Index clause options +CREATE SPATIAL INDEX idx1 on tab(c2 ASC); +CREATE SPATIAL INDEX idx2 on tab(c3 DESC) COMMENT 'wl6968'; +CREATE SPATIAL INDEX idx3 on tab(c4 ASC) KEY_BLOCK_SIZE=16 ; +CREATE SPATIAL INDEX idx4 on tab(c5 DESC) KEY_BLOCK_SIZE=16 +COMMENT 'Spatial index on Geometry type column'; + +# Check index type +SHOW INDEXES FROM tab; + +# Populate some spatial data +INSERT INTO tab(c2,c3,c4,c5) +VALUES(ST_GeomFromText('POINT(10 10)'),ST_GeomFromText('LINESTRING(5 5,20 20,30 30)'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'), +ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))')); + + +INSERT INTO tab(c2,c3,c4,c5) +VALUES(ST_GeomFromText('POINT(20 20)'),ST_GeomFromText('LINESTRING(20 20,30 30,40 40)'), +ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))'), +ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))')); + + +INSERT INTO tab(c2,c3,c4,c5) +VALUES(ST_GeomFromText('POINT(4 4)'),ST_GeomFromText('LINESTRING(130 130,140 140,150 150)'), +ST_GeomFromText('POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'), +ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))')); + +INSERT INTO tab(c2,c3,c4,c5) +VALUES(ST_GeomFromText('POINT(50 50)'),ST_GeomFromText('LINESTRING(200 200,300 300,400 400)'), +ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))'), +ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))')); + +INSERT INTO tab(c2,c3,c4,c5) +VALUES(ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(400 400,500 500,600 700)'), +ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))'), +ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))')); + +INSERT INTO tab(c2,c3,c4,c5) +VALUES(ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))'), +ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))')); + +INSERT INTO tab(c2,c3,c4,c5) +VALUES(ST_GeomFromText('POINT(60 70)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))')); + +INSERT INTO tab(c2,c3,c4,c5) +VALUES(ST_GeomFromText('POINT(0 0)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'), +ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))')); + + +INSERT INTO tab(c2,c3,c4,c5) +VALUES(ST_GeomFromText('POINT(120 120)'),ST_GeomFromText('LINESTRING(100 100,110 110,120 120)'), +ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))'), +ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))')); + + +INSERT INTO tab(c2,c3,c4,c5) +VALUES(ST_GeomFromText('POINT(160 160)'),ST_GeomFromText('LINESTRING(140 140,150 150,160 160)'), +ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'), +ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))')); + +ANALYZE TABLE tab; + +# Check the spatial relationship between 2 GIS shapes + +# Test the MBRContains +SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRContains(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); + +SET @g1 = ST_GeomFromText('LINESTRING( 300 300,400 400)'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRContains(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); + +# Test the MBRWithin +SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRWithin(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); + +# Test the ST_Crosses +SET @g1 = ST_GeomFromText('POLYGON((100 200,200 300,400 500,500 300,300 200,100 300,100 200))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Crosses(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); + +SET @g1 = ST_GeomFromText('LINESTRING( 10 10,30 30,40 40)'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_CRosses(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Crosses(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); + +# Test the MBRDisjoint +SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRDisjoint(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); + +# Test the MBREquals +SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBREquals(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); + +# Test the MBRintersects +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); + +SET @g1 = ST_GeomFromText('LINESTRING( 30 30,40 40,50 50)'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); + +# Test the Overelaps +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBROverlaps(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); + +SET @g1 = ST_GeomFromText('LINESTRING(7 1,30 30,1010 3010,1010 2010,3010 3010,4010 4010,5010 5010 )'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBROverlaps(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); + +# Test the ST_Touches +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Touches(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); + +SET @g1 = ST_GeomFromText('LINESTRING( 100 100,200 200,300 300)'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE ST_Touches(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); + +# Test the MBRContains +SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRContains(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); + +SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRWithin(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); + +# Test the MBRDisjoint +SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRDisjoint(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); + +# Test the MBREquals +SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBREquals(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); + +# Test the MBRintersects +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); + +SET @g1 = ST_GeomFromText('LINESTRING( 30 30,40 40,50 50)'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRintersects(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); + +# Test the MBROverelaps +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBROverlaps(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); + +# Test the MBRTouches +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); + +EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; + +EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') +WHERE MBRTouches(tab.c4, @g1); + +EXPLAIN DELETE FROM tab WHERE MBRTouches(tab.c4, @g1); + +# Test the Delete & Update +SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; + +DELETE FROM tab WHERE MBREquals(tab.c4, @g1); + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; + +CHECK TABLE tab; + +SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +DELETE FROM tab WHERE MBRIntersects(tab.c4, @g1); + +SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; + +CHECK TABLE tab; + +# Cleanup +DROP TABLE tab; + +# End of Testcase compress table with Auto_increment + +# Test check constraint on spatial column +CREATE TABLE tab(c1 POINT NOT NULL,CONSTRAINT tab_const check(c1 > 0) ) ENGINE=InnoDB; + +CREATE SPATIAL INDEX idx1 ON tab(c1) ; + +SHOW CREATE TABLE tab; + +SHOW INDEX FROM tab; + +set @g1 = ST_GeomFromText('POINT(-1 -2)'); + +SELECT ST_AsText(c1) FROM tab; + +DROP table tab; + +# repro case for bug#20451454 - FAILING ASSERTION: LOW_MATCH +# < DTUPLE_GET_N_FIELDS_CMP(TUPLE) +create table `t1`(`a` geometry not null,`b` linestring not null, +primary key (`b`(192),`a`(141)),spatial key (`b`)) engine=innodb; +insert into `t1` values( + point(1,1), + linestring(point(1,1),point(1,1)) +); + +# --error ER_GIS_INVALID_DATA +--error ER_BAD_NULL_ERROR +insert into `t1` values +( + polygon( + linestring(point(1,1),point(1,1)), + linestring(point(1,1),point(11,1)) + ), + linestring(point(1,1),point(1,1)) +); +select 1 from t1 where st_intersects( + geometrycollection(point(1,-1)),b +); +drop table t1; + +# Reproduce case for updating statistic after droping stats info table. +CREATE TABLE t1(c1 POINT NOT NULL); +DROP TABLE mysql.innodb_table_stats; +CALL mtr.add_suppression("InnoDB: Table `mysql`.`innodb_table_stats` not found."); +CALL mtr.add_suppression("InnoDB: Fetch of persistent statistics requested for table `test`.`t1` but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats instead."); +CREATE SPATIAL INDEX idx2 ON t1(c1); + +DROP TABLE t1; +CREATE TABLE mysql.innodb_table_stats ( + database_name varchar(64) COLLATE utf8_bin NOT NULL, + table_name varchar(64) COLLATE utf8_bin NOT NULL, + last_update timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + n_rows bigint(20) unsigned NOT NULL, + clustered_index_size bigint(20) unsigned NOT NULL, + sum_of_other_index_sizes bigint(20) unsigned NOT NULL, + PRIMARY KEY (`database_name`,`table_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0; diff --git a/mysql-test/suite/innodb_gis/t/gis.test b/mysql-test/suite/innodb_gis/t/gis.test new file mode 100644 index 00000000000..f28809f393c --- /dev/null +++ b/mysql-test/suite/innodb_gis/t/gis.test @@ -0,0 +1,1444 @@ +# This is a testcase copied from mysql-test/t/gis.test + +--source include/have_innodb.inc +-- source include/have_geometry.inc + +SET default_storage_engine=InnoDB; + +# +# Spatial objects +# + +--disable_warnings +DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; +--enable_warnings + +CREATE TABLE gis_point (fid INTEGER NOT NULL PRIMARY KEY, g POINT); +CREATE TABLE gis_line (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING); +CREATE TABLE gis_polygon (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON); +CREATE TABLE gis_multi_point (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOINT); +CREATE TABLE gis_multi_line (fid INTEGER NOT NULL PRIMARY KEY, g MULTILINESTRING); +CREATE TABLE gis_multi_polygon (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOLYGON); +CREATE TABLE gis_geometrycollection (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRYCOLLECTION); +CREATE TABLE gis_geometry (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY); + +SHOW FIELDS FROM gis_point; +SHOW FIELDS FROM gis_line; +SHOW FIELDS FROM gis_polygon; +SHOW FIELDS FROM gis_multi_point; +SHOW FIELDS FROM gis_multi_line; +SHOW FIELDS FROM gis_multi_polygon; +SHOW FIELDS FROM gis_geometrycollection; +SHOW FIELDS FROM gis_geometry; + + +INSERT INTO gis_point VALUES +(101, ST_PointFromText('POINT(10 10)')), +(102, ST_PointFromText('POINT(20 10)')), +(103, ST_PointFromText('POINT(20 20)')), +(104, ST_PointFromWKB(ST_AsWKB(ST_PointFromText('POINT(10 20)')))); + +INSERT INTO gis_line VALUES +(105, ST_LineFromText('LINESTRING(0 0,0 10,10 0)')), +(106, ST_LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), +(107, ST_LineStringFromWKB(ST_AsWKB(LineString(Point(10, 10), Point(40, 10))))); + +INSERT INTO gis_polygon VALUES +(108, ST_PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')), +(109, ST_PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')), +(110, ST_PolyFromWKB(ST_AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))))); + +INSERT INTO gis_multi_point VALUES +(111, ST_MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), +(112, ST_MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), +(113, ST_MPointFromWKB(ST_AsWKB(MultiPoint(Point(3, 6), Point(4, 10))))); + +INSERT INTO gis_multi_line VALUES +(114, ST_MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), +(115, ST_MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), +(116, ST_MLineFromWKB(ST_AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))))); + + +INSERT INTO gis_multi_polygon VALUES +(117, ST_MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), +(118, ST_MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), +(119, ST_MPolyFromWKB(ST_AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))))); + +INSERT INTO gis_geometrycollection VALUES +(120, ST_GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), +(121, ST_GeometryFromWKB(ST_AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))); + +INSERT into gis_geometry SELECT * FROM gis_point; +INSERT into gis_geometry SELECT * FROM gis_line; +INSERT into gis_geometry SELECT * FROM gis_polygon; +INSERT into gis_geometry SELECT * FROM gis_multi_point; +INSERT into gis_geometry SELECT * FROM gis_multi_line; +INSERT into gis_geometry SELECT * FROM gis_multi_polygon; +INSERT into gis_geometry SELECT * FROM gis_geometrycollection; + +SELECT fid, ST_AsText(g) FROM gis_point; +SELECT fid, ST_AsText(g) FROM gis_line; +SELECT fid, ST_AsText(g) FROM gis_polygon; +SELECT fid, ST_AsText(g) FROM gis_multi_point; +SELECT fid, ST_AsText(g) FROM gis_multi_line; +SELECT fid, ST_AsText(g) FROM gis_multi_polygon; +SELECT fid, ST_AsText(g) FROM gis_geometrycollection; +SELECT fid, ST_AsText(g) FROM gis_geometry; + +SELECT fid, ST_Dimension(g) FROM gis_geometry; +SELECT fid, ST_GeometryType(g) FROM gis_geometry; +SELECT fid, ST_IsEmpty(g) FROM gis_geometry; +SELECT fid, ST_AsText(ST_Envelope(g)) FROM gis_geometry; +--replace_column 10 # +explain extended select ST_Dimension(g), ST_GeometryType(g), ST_IsEmpty(g), ST_AsText(ST_Envelope(g)) from gis_geometry; + +SELECT fid, ST_X(g) FROM gis_point; +SELECT fid, ST_Y(g) FROM gis_point; +--replace_column 10 # +explain extended select ST_X(g),ST_Y(g) FROM gis_point; + +SELECT fid, ST_AsText(ST_StartPoint(g)) FROM gis_line; +SELECT fid, ST_AsText(ST_EndPoint(g)) FROM gis_line; +SELECT fid, ST_Length(g) FROM gis_line; +SELECT fid, ST_NumPoints(g) FROM gis_line; +SELECT fid, ST_AsText(ST_PointN(g, 2)) FROM gis_line; +SELECT fid, ST_IsClosed(g) FROM gis_line; +--replace_column 10 # +explain extended select ST_AsText(ST_StartPoint(g)),ST_AsText(ST_EndPoint(g)),ST_Length(g),ST_NumPoints(g),ST_AsText(ST_PointN(g, 2)),ST_IsClosed(g) FROM gis_line; + +SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_polygon; +SELECT fid, ST_Area(g) FROM gis_polygon; +SELECT fid, ST_AsText(ST_ExteriorRing(g)) FROM gis_polygon; +SELECT fid, ST_NumInteriorRings(g) FROM gis_polygon; +SELECT fid, ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon; +--replace_column 10 # +explain extended select ST_AsText(ST_Centroid(g)),ST_Area(g),ST_AsText(ST_ExteriorRing(g)),ST_NumInteriorRings(g),ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon; + +SELECT fid, ST_IsClosed(g) FROM gis_multi_line; + +SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_multi_polygon; +SELECT fid, ST_Area(g) FROM gis_multi_polygon; + +SELECT fid, ST_NumGeometries(g) from gis_multi_point; +SELECT fid, ST_NumGeometries(g) from gis_multi_line; +SELECT fid, ST_NumGeometries(g) from gis_multi_polygon; +SELECT fid, ST_NumGeometries(g) from gis_geometrycollection; +--replace_column 10 # +explain extended SELECT fid, ST_NumGeometries(g) from gis_multi_point; + +SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point; +SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_line; +SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_polygon; +SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_geometrycollection; +SELECT fid, ST_AsText(ST_GeometryN(g, 1)) from gis_geometrycollection; +--replace_column 10 # +explain extended SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point; + +SELECT g1.fid as first, g2.fid as second, +MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g) as o, +MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t, +MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r +FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; +--replace_column 10 # +explain extended SELECT g1.fid as first, g2.fid as second, +MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g) as o, +MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t, +MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r +FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; + +DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; + +# +# Check that ALTER TABLE doesn't loose geometry type +# +CREATE TABLE t1 ( + gp point, + ln linestring, + pg polygon, + mp multipoint, + mln multilinestring, + mpg multipolygon, + gc geometrycollection, + gm geometry +); + +SHOW FIELDS FROM t1; +ALTER TABLE t1 ADD fid INT NOT NULL; +SHOW FIELDS FROM t1; +DROP TABLE t1; + +SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)')))); +explain extended SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)')))); +explain extended SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_PointFromText('POINT(1 4)')))); +SELECT ST_SRID(ST_GeomFromText('LineString(1 1,2 2)',101)); +explain extended SELECT ST_SRID(ST_GeomFromText('LineString(1 1,2 2)',101)); +#select ST_issimple(MultiPoint(Point(3, 6), Point(4, 10))), ST_issimple(Point(3, 6)),ST_issimple(ST_PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),ST_issimple(ST_GeometryFromText('POINT(1 4)')), ST_issimple(ST_AsWKB(ST_GeometryFromText('POINT(1 4)'))); +explain extended select ST_issimple(MultiPoint(Point(3, 6), Point(4, 10))), ST_issimple(Point(3, 6)); + +create table t1 (a geometry not null); +insert into t1 values (ST_GeomFromText('Point(1 2)')); +-- error 1416 +insert into t1 values ('Garbage'); +-- error 1416 +insert IGNORE into t1 values ('Garbage'); +alter table t1 add spatial index(a); + +drop table t1; + +# +# Bug #5219: problem with range optimizer +# + +create table t1(a geometry not null, spatial index(a)); +insert into t1 values +(ST_GeomFromText('POINT(1 1)')), (ST_GeomFromText('POINT(3 3)')), +(ST_GeomFromText('POINT(4 4)')), (ST_GeomFromText('POINT(6 6)')); +select ST_AsText(a) from t1 where + MBRContains(ST_GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a) + or + MBRContains(ST_GeomFromText('Polygon((2 2, 2 5, 5 5, 5 2, 2 2))'), a); +select ST_AsText(a) from t1 where + MBRContains(ST_GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a) + and + MBRContains(ST_GeomFromText('Polygon((0 0, 0 7, 7 7, 7 0, 0 0))'), a); +drop table t1; + +CREATE TABLE t1 (Coordinates POINT NOT NULL, SPATIAL INDEX(Coordinates)); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(383293632 1754448)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(564952612 157516260)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(903994614 180726515)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(98128178 141127631)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(862547902 799334546)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(341989013 850270906)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(803302376 93039099)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(857439153 817431356)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(319757546 343162742)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(826341972 717484432)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(305066789 201736238)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(626068992 616241497)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(55789424 755830108)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(802874458 312435220)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(153795660 551723671)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(242207428 537089292)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(553478119 807160039)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(694605552 457472733)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(987886554 792733729)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(598600363 850434457)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(592068275 940589376)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(700705362 395370650)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(33628474 558144514)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(212802006 353386020)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(901307256 39143977)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(70870451 206374045)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(240880214 696939443)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(822615542 296669638)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(452769551 625489999)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(609104858 606565210)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(177213669 851312285)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(143654501 730691787)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(658472325 838260052)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(188164520 646358878)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(630993781 786764883)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(496793334 223062055)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(727354258 197498696)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(618432704 760982731)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(755643210 831234710)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(114368751 656950466)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(870378686 185239202)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(863324511 111258900)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(882178645 685940052)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(407928538 334948195)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(311430051 17033395)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(941513405 488643719)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(868345680 85167906)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(219335507 526818004)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(923427958 407500026)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(173176882 554421738)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(194264908 669970217)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(777483793 921619165)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(867468912 395916497)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(682601897 623112122)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(227151206 796970647)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(280062588 97529892)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(982209849 143387099)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(208788792 864388493)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(829327151 616717329)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(199336688 140757201)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(633750724 140850093)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(629400920 502096404)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(226017998 848736426)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(28914408 149445955)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(256236452 202091290)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(703867693 450501360)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(872061506 481351486)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(372120524 739530418)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(877267982 54722420)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(362642540 104419188)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(851693067 642705127)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(201949080 833902916)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(786092225 410737872)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(698291409 615419376)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(27455201 897628096)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(756176576 661205925)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(38478189 385577496)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(163302328 264496186)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(234313922 192216735)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(413942141 490550373)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(394308025 117809834)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(941051732 266369530)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(599161319 313172256)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(5899948 476429301)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(367894677 368542487)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(580848489 219587743)')); +INSERT INTO t1 VALUES(ST_GeomFromText('POINT(11247614 782797569)')); +drop table t1; + +create table t1 select ST_GeomFromWKB(POINT(1,3)); +show create table t1; +drop table t1; + +SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; +CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo` +geometry NOT NULL default ''); +SET sql_mode = default; + +insert into t1 values ('85984',ST_GeomFromText('MULTIPOLYGON(((-115.006363 +36.305435,-114.992394 36.305202,-114.991219 36.305975,-114.991163 +36.306845,-114.989432 36.309452,-114.978275 36.312642,-114.977363 +36.311978,-114.975327 36.312344,-114.96502 36.31597,-114.963364 +36.313629,-114.961723 36.313721,-114.956398 36.316057,-114.951882 +36.320979,-114.947073 36.323475,-114.945207 36.326451,-114.945207 +36.326451,-114.944132 36.326061,-114.94003 36.326588,-114.924017 +36.334484,-114.923281 36.334146,-114.92564 36.331504,-114.94072 +36.319282,-114.945348 36.314812,-114.948091 36.314762,-114.951755 +36.316211,-114.952446 36.313883,-114.952644 36.309488,-114.944725 +36.313083,-114.93706 36.32043,-114.932478 36.323497,-114.924556 +36.327708,-114.922608 36.329715,-114.92009 36.328695,-114.912105 +36.323566,-114.901647 36.317952,-114.897436 36.313968,-114.895344 +36.309573,-114.891699 36.304398,-114.890569 36.303551,-114.886356 +36.302702,-114.885141 36.301351,-114.885709 36.297391,-114.892499 +36.290893,-114.902142 36.288974,-114.904941 36.288838,-114.905308 +36.289845,-114.906325 36.290395,-114.909916 36.289549,-114.914527 +36.287535,-114.918797 36.284423,-114.922982 36.279731,-114.924113 +36.277282,-114.924057 36.275817,-114.927733 36.27053,-114.929354 +36.269029,-114.929354 36.269029,-114.950856 36.268715,-114.950768 +36.264324,-114.960206 36.264293,-114.960301 36.268943,-115.006662 +36.268929,-115.008583 36.265619,-115.00665 36.264247,-115.006659 +36.246873,-115.006659 36.246873,-115.006838 36.247697,-115.010764 +36.247774,-115.015609 36.25113,-115.015765 36.254505,-115.029517 +36.254619,-115.038573 36.249317,-115.038573 36.249317,-115.023403 +36.25841,-115.023873 36.258994,-115.031845 36.259829,-115.03183 +36.261053,-115.025561 36.261095,-115.036417 36.274632,-115.033729 +36.276041,-115.032217 36.274851,-115.029845 36.273959,-115.029934 +36.274966,-115.025763 36.274896,-115.025406 36.281044,-115.028731 +36.284471,-115.036497 36.290377,-115.042071 36.291039,-115.026759 +36.298478,-115.008995 36.301966,-115.006363 36.305435),(-115.079835 +36.244369,-115.079735 36.260186,-115.076435 36.262369,-115.069758 +36.265,-115.070235 36.268757,-115.064542 36.268655,-115.061843 +36.269857,-115.062676 36.270693,-115.06305 36.272344,-115.059051 +36.281023,-115.05918 36.283008,-115.060591 36.285246,-115.061913 +36.290022,-115.062499 36.306353,-115.062499 36.306353,-115.060918 +36.30642,-115.06112 36.289779,-115.05713 36.2825,-115.057314 +36.279446,-115.060779 36.274659,-115.061366 36.27209,-115.057858 +36.26557,-115.055805 36.262883,-115.054688 36.262874,-115.047335 +36.25037,-115.044234 36.24637,-115.052434 36.24047,-115.061734 +36.23507,-115.061934 36.22677,-115.061934 36.22677,-115.061491 +36.225267,-115.062024 36.218194,-115.060134 36.218278,-115.060133 +36.210771,-115.057833 36.210771,-115.057433 36.196271,-115.062233 +36.196271,-115.062233 36.190371,-115.062233 36.190371,-115.065533 +36.190371,-115.071333 36.188571,-115.098331 36.188275,-115.098331 +36.188275,-115.098435 36.237569,-115.097535 36.240369,-115.097535 +36.240369,-115.093235 36.240369,-115.089135 36.240469,-115.083135 +36.240569,-115.083135 36.240569,-115.079835 +36.244369)))')),('85998',ST_GeomFromText('MULTIPOLYGON(((-115.333107 +36.264587,-115.333168 36.280638,-115.333168 36.280638,-115.32226 +36.280643,-115.322538 36.274311,-115.327222 36.274258,-115.32733 +36.263026,-115.330675 36.262984,-115.332132 36.264673,-115.333107 +36.264587),(-115.247239 36.247066,-115.247438 36.218267,-115.247438 +36.218267,-115.278525 36.219263,-115.278525 36.219263,-115.301545 +36.219559,-115.332748 36.219197,-115.332757 36.220041,-115.332757 +36.220041,-115.332895 36.233514,-115.349023 36.233479,-115.351489 +36.234475,-115.353681 36.237021,-115.357106 36.239789,-115.36519 +36.243331,-115.368156 36.243487,-115.367389 36.244902,-115.364553 +36.246014,-115.359219 36.24616,-115.356186 36.248025,-115.353347 +36.248004,-115.350813 36.249507,-115.339673 36.25387,-115.333069 +36.255018,-115.333069 36.255018,-115.333042 36.247767,-115.279039 +36.248666,-115.263639 36.247466,-115.263839 36.252766,-115.261439 +36.252666,-115.261439 36.247366,-115.247239 36.247066)))')); + +# Expected result is 115.31877315203187, but IA64 returns 115.31877315203188 +# due to fused multiply-add instructions. +--replace_result 115.31877315203188 115.31877315203187 +select object_id, ST_geometrytype(geo), ST_ISSIMPLE(GEO), ST_ASTEXT(ST_centroid(geo)) from +t1 where object_id=85998; + +# Expected result is 36.3310176346905, but IA64 returns 36.3310176346904 +# due to fused multiply-add instructions. +--replace_result 36.3310176346904 36.3310176346905 -114.87787186923326 -114.87787186923313 36.33101763469053 36.33101763469059 36.33101763469043 36.33101763469059 +select object_id, ST_geometrytype(geo), ST_ISSIMPLE(GEO), ST_ASTEXT(ST_centroid(geo)) from +t1 where object_id=85984; + +drop table t1; + +create table t1 (fl geometry not null); +--error 1416 +insert into t1 values (1); +--error 1416 +insert into t1 values (1.11); +--error 1416 +insert into t1 values ("qwerty"); +--error 1048 +# --error ER_GIS_INVALID_DATA +insert into t1 values (ST_pointfromtext('point(1,1)')); + +drop table t1; + +select (ST_asWKT(ST_geomfromwkb((0x000000000140240000000000004024000000000000)))); +select (ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440)))); + +--enable_metadata +create table t1 (g GEOMETRY); +select * from t1; +select ST_asbinary(g) from t1; +--disable_metadata +drop table t1; + +create table t1 (a TEXT, b GEOMETRY NOT NULL, SPATIAL KEY(b)); +alter table t1 disable keys; +--error 1263 +load data infile '../../std_data/bad_gis_data.dat' into table t1; +alter table t1 enable keys; +drop table t1; + +# +# Bug #26038: is null and bad data +# + +create table t1 (a int, b blob); +insert into t1 values (1, ''), (2, NULL), (3, '1'); +select * from t1; + +--error ER_ILLEGAL_VALUE_FOR_TYPE +select + ST_geometryfromtext(b) IS NULL, ST_geometryfromwkb(b) IS NULL, ST_astext(b) IS NULL, + ST_aswkb(b) IS NULL, ST_geometrytype(b) IS NULL, ST_centroid(b) IS NULL, + ST_envelope(b) IS NULL, ST_startpoint(b) IS NULL, ST_endpoint(b) IS NULL, + ST_exteriorring(b) IS NULL, ST_pointn(b, 1) IS NULL, ST_geometryn(b, 1) IS NULL, + ST_interiorringn(b, 1) IS NULL, multipoint(b) IS NULL, ST_isempty(b) IS NULL, + ST_issimple(b) IS NULL, ST_isclosed(b) IS NULL, ST_dimension(b) IS NULL, + ST_numgeometries(b) IS NULL, ST_numinteriorrings(b) IS NULL, ST_numpoints(b) IS NULL, + ST_area(b) IS NULL, ST_length(b) IS NULL, ST_srid(b) IS NULL, ST_x(b) IS NULL, + ST_y(b) IS NULL +from t1; + +# --error ER_GIS_INVALID_DATA +select + MBRwithin(b, b) IS NULL, MBRcontains(b, b) IS NULL, MBRoverlaps(b, b) IS NULL, + MBRequals(b, b) IS NULL, MBRdisjoint(b, b) IS NULL, ST_touches(b, b) IS NULL, + MBRintersects(b, b) IS NULL, ST_crosses(b, b) IS NULL +from t1; + +--error ER_ILLEGAL_VALUE_FOR_TYPE +select + point(b, b) IS NULL, linestring(b) IS NULL, polygon(b) IS NULL, multipoint(b) IS NULL, + multilinestring(b) IS NULL, multipolygon(b) IS NULL, + geometrycollection(b) IS NULL +from t1; + +drop table t1; + +# +# Bug #27164: Crash when mixing InnoDB and MyISAM Geospatial tables +# +CREATE TABLE t1(a POINT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1; +DROP TABLE t1; + +# +# Bug #30955 ST_geomfromtext() crasher +# +CREATE TABLE `t1` ( `col9` set('a'), `col89` date); +INSERT IGNORE INTO `t1` VALUES ('','0000-00-00'); +# --error ER_GIS_INVALID_DATA +select ST_geomfromtext(col9,col89) as a from t1; +DROP TABLE t1; + +# +# Bug #31158 Spatial, Union, LONGBLOB vs BLOB bug (crops data) +# + +CREATE TABLE t1 ( + geomdata polygon NOT NULL, + SPATIAL KEY index_geom (geomdata) +) ENGINE=MyISAM DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED; + +CREATE TABLE t2 ( + geomdata polygon NOT NULL, + SPATIAL KEY index_geom (geomdata) +) ENGINE=MyISAM DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED; + +CREATE TABLE t3 +select + ST_aswkb(ws.geomdata) AS geomdatawkb + from + t1 ws +union + select + ST_aswkb(ws.geomdata) AS geomdatawkb + from + t2 ws; + +describe t3; + +drop table t1; +drop table t2; +drop table t3; + +# +# Bug #30284 spatial key corruption +# + +create table t1(col1 geometry default null,col15 geometrycollection not +null,spatial index(col15),index(col1(15)))engine=innodb; +# --error ER_CANT_CREATE_GEOMETRY_OBJECT +insert into t1 set col15 = ST_GeomFromText('POINT(6 5)'); +# --error ER_CANT_CREATE_GEOMETRY_OBJECT +insert into t1 set col15 = ST_GeomFromText('POINT(6 5)'); +check table t1 extended; +drop table t1; + +--echo End of 4.1 tests + +# +# Bug #12281 (Geometry: crash in trigger) +# + +create table t1 (s1 geometry not null,s2 char(100)); +create trigger t1_bu before update on t1 for each row set new.s1 = null; +--error 1048 +insert into t1 values (null,null); +drop table t1; + +# +# Bug #10499 (function creation with GEOMETRY datatype) +# +--disable_warnings +drop procedure if exists fn3; +--enable_warnings +create function fn3 () returns point deterministic return ST_GeomFromText("point(1 1)"); +show create function fn3; +select ST_astext(fn3()); +drop function fn3; + +# +# Bug #12267 (primary key over GIS) +# +create table t1(pt POINT); +alter table t1 add primary key pti(pt); +drop table t1; +create table t1(pt GEOMETRY); +--error 1170 +alter table t1 add primary key pti(pt); +alter table t1 add primary key pti(pt(20)); +drop table t1; + + +create table t1 select ST_GeomFromText('point(1 1)'); +desc t1; +drop table t1; + +# +# Bug #20691 (DEFAULT over NOT NULL field) +# +create table t1 (g geometry not null); +--error ER_CANT_CREATE_GEOMETRY_OBJECT +insert into t1 values(default); +drop table t1; + +# +# Bug #27300: create view with geometry functions lost columns types +# +CREATE TABLE t1 (a GEOMETRY); +CREATE VIEW v1 AS SELECT ST_GeomFromwkb(ST_ASBINARY(a)) FROM t1; +CREATE VIEW v2 AS SELECT a FROM t1; +DESCRIBE v1; +DESCRIBE v2; + +DROP VIEW v1,v2; +DROP TABLE t1; + +# +# Bug#24563: MBROverlaps does not seem to function propertly +# Bug#54888: MBROverlaps missing in 5.1? +# + +# Test all MBR* functions and their non-MBR-prefixed aliases, +# using shifted squares to verify the spatial relations. + +create table t1 (name VARCHAR(100), square GEOMETRY); + +INSERT INTO t1 VALUES("center", ST_GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))')); + +INSERT INTO t1 VALUES("small", ST_GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))')); +INSERT INTO t1 VALUES("big", ST_GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))')); + +INSERT INTO t1 VALUES("up", ST_GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))')); +INSERT INTO t1 VALUES("up2", ST_GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))')); +INSERT INTO t1 VALUES("up3", ST_GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))')); + +INSERT INTO t1 VALUES("down", ST_GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))')); +INSERT INTO t1 VALUES("down2", ST_GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))')); +INSERT INTO t1 VALUES("down3", ST_GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))')); + +INSERT INTO t1 VALUES("right", ST_GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))')); +INSERT INTO t1 VALUES("right2", ST_GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))')); +INSERT INTO t1 VALUES("right3", ST_GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))')); + +INSERT INTO t1 VALUES("left", ST_GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))')); +INSERT INTO t1 VALUES("left2", ST_GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))')); +INSERT INTO t1 VALUES("left3", ST_GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))')); + +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequals FROM t1 a1 JOIN t1 a2 ON MBREquals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; + +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRequals FROM t1 a1 JOIN t1 a2 ON MBREquals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRoverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS ST_touches FROM t1 a1 JOIN t1 a2 ON ST_Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; + +# MBROverlaps needs a few more tests, with point and line dimensions + +# --error ER_GIS_INVALID_DATA +SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))'); +# --error ER_GIS_INVALID_DATA +SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))'); +# --error ER_GIS_INVALID_DATA +SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))'); +# --error ER_GIS_INVALID_DATA +SET @horiz3 = ST_GeomFromText('POLYGON ((2 0, 3 0, 2 0))'); +# --error ER_GIS_INVALID_DATA +SET @point1 = ST_GeomFromText('POLYGON ((0 0))'); +# --error ER_GIS_INVALID_DATA +SET @point2 = ST_GeomFromText('POLYGON ((-2 0))'); + +SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @vert1) GROUP BY a1.name; +SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @horiz1) GROUP BY a1.name; +SELECT MBROverlaps(@horiz1, @vert1) FROM DUAL; +SELECT MBROverlaps(@horiz1, @horiz2) FROM DUAL; +SELECT MBROverlaps(@horiz1, @horiz3) FROM DUAL; +SELECT MBROverlaps(@horiz1, @point1) FROM DUAL; +SELECT MBROverlaps(@horiz1, @point2) FROM DUAL; + +DROP TABLE t1; + +# +# Bug#28763: Selecting geometry fields in UNION caused server crash. +# +create table t1(f1 geometry, f2 polygon, f3 linestring); +select f1 from t1 union select f1 from t1; +insert into t1 (f2,f3) values (ST_GeomFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))'), ST_GeomFromText('LINESTRING(0 0,1 1,2 2)')); +select ST_AsText(f2),ST_AsText(f3) from t1; +select ST_AsText(a) from (select f2 as a from t1 union select f3 from t1) t; +create table t2 as select f2 as a from t1 union select f3 from t1; +desc t2; +select ST_AsText(a) from t2; +drop table t1, t2; + +# +# Bug #29166: MYsql crash when query is run +# + +# The test query itself is not logged : too large output. +# The real test is the second query : see if the first hasn't crashed the +# server +--disable_query_log +--disable_result_log +SELECT ST_AsText(ST_GeometryFromText(CONCAT( + 'MULTIPOLYGON(((', + REPEAT ('-0.00000000001234567890123456789012 -0.123456789012345678,', 1000), + '-0.00000000001234567890123456789012 -0.123456789012345678', + ')))' +))) AS a; +--enable_result_log +--enable_query_log +SELECT 1; + +-- source include/gis_keys.inc + +# +# Bug #31155 gis types in union'd select cause crash +# + +create table `t1` (`col002` point)engine=innodb; +insert into t1 values (),(),(); +# --error ER_WRONG_ARGUMENTS +select min(`col002`) from t1 union select `col002` from t1; +drop table t1; + +--echo # +--echo # Bug #47780: crash when comparing GIS items from subquery +--echo # + +CREATE TABLE t1(a INT, b MULTIPOLYGON); +INSERT INTO t1 VALUES + (0, + ST_GEOMFROMTEXT( + 'multipolygon(((1 2,3 4,5 6,7 8,9 8,1 2,1 2),(7 6,5 4,3 2,1 2,3 4,7 6)))')); + +--echo # must not crash +SELECT 1 FROM t1 WHERE a <> (SELECT ST_GEOMETRYCOLLECTIONFROMWKB(b) FROM t1); + +DROP TABLE t1; + +--echo # +--echo # Bug #49250 : spatial btree index corruption and crash +--echo # Part one : spatial syntax check +--echo # + +--error ER_PARSE_ERROR +CREATE TABLE t1(col1 MULTIPOLYGON NOT NULL, + SPATIAL INDEX USING BTREE (col1)); +CREATE TABLE t2(col1 MULTIPOLYGON NOT NULL); +--error ER_PARSE_ERROR +CREATE SPATIAL INDEX USING BTREE ON t2(col); +--error ER_PARSE_ERROR +ALTER TABLE t2 ADD SPATIAL INDEX USING BTREE (col1); + +DROP TABLE t2; + +--echo End of 5.0 tests + + +# +# Bug #11335 View redefines column types +# +create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime); +create view v1 as select * from t1; +desc v1; +drop view v1; +drop table t1; + +# +# Bug#44684: valgrind reports invalid reads in +# Item_func_spatial_collection::val_str +# +--error ER_ILLEGAL_VALUE_FOR_TYPE +SELECT MultiPoint(12345,''); +#SELECT MultiPoint(123451,''); +#SELECT MultiPoint(1234512,''); +#SELECT MultiPoint(12345123,''); + +--error ER_ILLEGAL_VALUE_FOR_TYPE +#SELECT MultiLineString(12345,''); +#SELECT MultiLineString(123451,''); +#SELECT MultiLineString(1234512,''); +#SELECT MultiLineString(12345123,''); + +--error ER_ILLEGAL_VALUE_FOR_TYPE +#SELECT LineString(12345,''); +#SELECT LineString(123451,''); +#SELECT LineString(1234512,''); +#SELECT LineString(12345123,''); + +--error ER_ILLEGAL_VALUE_FOR_TYPE +#SELECT Polygon(12345,''); +#SELECT Polygon(123451,''); +#SELECT Polygon(1234512,''); +#SELECT Polygon(12345123,''); + +# +# Bug55531 crash with conversions of geometry types / strings +# +--error ER_ILLEGAL_VALUE_FOR_TYPE +SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUAL) AS d WHERE (LINESTRING(d.b)); + + +--echo # +--echo # BUG#51875: crash when loading data into geometry function ST_polyfromwkb +--echo # +SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; +# --error ER_GIS_INVALID_DATA +SET @a=ST_POLYFROMWKB(@a); +SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; +# --error ER_GIS_INVALID_DATA +SET @a=ST_POLYFROMWKB(@a); + + +# +# Bug #57321 crashes and valgrind errors from spatial types +# + +create table t1(a polygon NOT NULL)engine=innodb; +# --error ER_CANT_CREATE_GEOMETRY_OBJECT +--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +insert into t1 values (ST_geomfromtext("point(0 1)")); +# --error ER_CANT_CREATE_GEOMETRY_OBJECT +--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +insert into t1 values (ST_geomfromtext("point(1 0)")); +select * from (select polygon(t1.a) as p from t1 order by t1.a) d; +drop table t1; + + +--echo # +--echo # Test for bug #59888 "debug assertion when attempt to create spatial index +--echo # on char > 31 bytes". +--echo # +create table t1(a char(32) not null) engine=innodb; +# --error ER_SPATIAL_MUST_HAVE_GEOM_COL +--error ER_WRONG_ARGUMENTS +create spatial index i on t1 (a); +drop table t1; + + +--echo End of 5.1 tests + +# +# Bug #50574 5.5.ST_x allows spatial indexes on non-spatial +# columns, causing crashes! +# Bug#11767480 SPATIAL INDEXES ON NON-SPATIAL COLUMNS +# CAUSE CRASHES. +# +CREATE TABLE t0 (a BINARY(32) NOT NULL); +# --error ER_SPATIAL_MUST_HAVE_GEOM_COL +--error ER_WRONG_ARGUMENTS +CREATE SPATIAL INDEX i on t0 (a); +INSERT INTO t0 VALUES (1); + +# --error ER_SPATIAL_MUST_HAVE_GEOM_COL +--error ER_WRONG_ARGUMENTS +CREATE TABLE t1( + col0 BINARY NOT NULL, + col2 TIMESTAMP, + SPATIAL INDEX i1 (col0) +) ENGINE=MyISAM; + +# Test other ways to add indices +CREATE TABLE t1 ( + col0 BINARY NOT NULL, + col2 TIMESTAMP +) ENGINE=MyISAM; + +# --error ER_SPATIAL_MUST_HAVE_GEOM_COL +--error ER_WRONG_ARGUMENTS +CREATE SPATIAL INDEX idx0 ON t1(col0); + +# --error ER_SPATIAL_MUST_HAVE_GEOM_COL +--error ER_WRONG_ARGUMENTS +ALTER TABLE t1 ADD SPATIAL INDEX i1 (col0); + +CREATE TABLE t2 ( + col0 INTEGER NOT NULL, + col1 POINT, + col2 POINT +); + +# --error ER_TOO_MANY_KEY_PARTS +--error ER_WRONG_ARGUMENTS +CREATE SPATIAL INDEX idx0 ON t2 (col1, col2); + +# --error ER_TOO_MANY_KEY_PARTS +--error ER_WRONG_ARGUMENTS +CREATE TABLE t3 ( + col0 INTEGER NOT NULL, + col1 POINT, + col2 LINESTRING, + SPATIAL INDEX i1 (col1, col2) +); + +# cleanup +DROP TABLE t0, t1, t2; + + +--echo # +--echo # BUG#12414917 - ST_ISCLOSED() CRASHES ON 64-BIT BUILDS +--echo # +# --error ER_GIS_DATA_WRONG_ENDIANESS +SELECT ST_ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20))); + +--echo # +--echo # BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN +--echo # GEOMETRY FUNCTION ARGUMENTS +--echo # +--replace_regex /non geometric .* value/non geometric '' value/ +--error ER_ILLEGAL_VALUE_FOR_TYPE +SELECT GEOMETRYCOLLECTION((SELECT @@OLD)); + + +--echo End of 5.1 tests + + +--echo # +--echo # Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE +--echo # + +CREATE TABLE g1 +(a geometry NOT NULL, UNIQUE KEY i (a(151))) engine=innodb; + +INSERT INTO g1 VALUES (ST_geomfromtext('point(1 1)')); +INSERT INTO g1 VALUES (ST_geomfromtext('point(1 2)')); + +FLUSH TABLES; + +SELECT 1 FROM g1 +FORCE INDEX(i) WHERE a = date_sub(now(), interval 2808.4 year_month) +; + +DROP TABLE g1; + +--echo # +--echo # Bug#13013970 MORE CRASHES IN FIELD_BLOB::GET_KEY_IMAGE +--echo # + +CREATE TABLE g1(a TEXT NOT NULL, KEY(a(255))); + +INSERT INTO g1 VALUES ('a'),('a'); +# --error ER_GIS_INVALID_DATA +SELECT 1 FROM g1 WHERE a >= ANY +(SELECT 1 FROM g1 WHERE a = ST_geomfromtext('') OR a) ; + +DROP TABLE g1; + +--echo End of 5.5 tests + + +# Conformance tests +# +# C.3.3 Geometry types and functions +# + +--disable_warnings +DROP DATABASE IF EXISTS gis_ogs; +--enable_warnings + +CREATE DATABASE gis_ogs; +USE gis_ogs; + +--echo # +--echo # C.3.3.1 Geometry types and functions schema construction +--echo # + +# TODO: WL#2377 +#CREATE TABLE spatial_ref_sys ( +#ST_srid INTEGER NOT NULL PRIMARY KEY, +#auth_name CHARACTER VARYING, +#auth_srid INTEGER, +#srtext CHARACTER VARYING(2048)); + +CREATE TABLE lakes ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + shore POLYGON); + +CREATE TABLE road_segments ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + aliases CHARACTER VARYING(64), + num_lanes INTEGER, + centerline LINESTRING); + +CREATE TABLE divided_routes ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + num_lanes INTEGER, + centerlines MULTILINESTRING); + +CREATE TABLE forests ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + boundary MULTIPOLYGON); + +CREATE TABLE bridges ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + position POINT); + +CREATE TABLE streams ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + centerline LINESTRING); + +CREATE TABLE buildings ( + fid INTEGER NOT NULL PRIMARY KEY, + address CHARACTER VARYING(64), + position POINT, + footprint POLYGON); + +CREATE TABLE ponds ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + type CHARACTER VARYING(64), + shores MULTIPOLYGON); + +CREATE TABLE named_places ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + boundary POLYGON); + +CREATE TABLE map_neatlines ( + fid INTEGER NOT NULL PRIMARY KEY, + neatline POLYGON); + +--echo # +--echo # C.3.3.2 Geometry types and functions schema data loading +--echo # + +# TODO: WL#2377 +#-- Spatial Reference System +#INSERT INTO spatial_ref_sys VALUES +#(101, 'POSC', 32214, 'PROJCS["UTM_ZONE_14N", +#GEOGCS["World Geodetic System 72", +#DATUM["WGS_72", +#ELLIPSOID["NWL_10D", 6378135, 298.26]], +#PRIMEM["Greenwich", 0], +#UNIT["Meter", 1.0]], +#PROJECTION["Transverse_Mercator"], +#PARAMETER["False_Easting", 500000.0], +#PARAMETER["False_Northing", 0.0], +#PARAMETER["Central_Meridian", -99.0], +#PARAMETER["Scale_Factor", 0.9996], +#PARAMETER["Latitude_of_origin", 0.0], +#UNIT["Meter", 1.0]]'); + +--echo # Lakes +INSERT INTO lakes VALUES ( +101, 'BLUE LAKE', +ST_PolyFromText( +'POLYGON( +(52 18,66 23,73 9,48 6,52 18), +(59 18,67 18,67 13,59 13,59 18) +)', +101)); + + +--echo # Road Segments + +INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2, +ST_LineFromText( +'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101)); + +INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4, +ST_LineFromText( +'LINESTRING( 44 31, 56 34, 70 38 )' ,101)); + +INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2, +ST_LineFromText( +'LINESTRING( 70 38, 72 48 )' ,101)); + +INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4, +ST_LineFromText( +'LINESTRING( 70 38, 84 42 )' ,101)); + +INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL, +1, +ST_LineFromText( +'LINESTRING( 28 26, 28 0 )',101)); + +--echo # DividedRoutes + +INSERT INTO divided_routes VALUES(119, 'Route 75', 4, +ST_MLineFromText( +'MULTILINESTRING((10 48,10 21,10 0), +(16 0,16 23,16 48))', 101)); + +--echo # Forests + +INSERT INTO forests VALUES(109, 'Green Forest', +ST_MPolyFromText( +'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26), +(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))', +101)); + +--echo # Bridges + +INSERT INTO bridges VALUES(110, 'Cam Bridge', ST_PointFromText( +'POINT( 44 31 )', 101)); + +--echo # Streams + +INSERT INTO streams VALUES(111, 'Cam Stream', +ST_LineFromText( +'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101)); + +INSERT INTO streams VALUES(112, NULL, +ST_LineFromText( +'LINESTRING( 76 0, 78 4, 73 9 )', 101)); + +--echo # Buildings + +INSERT INTO buildings VALUES(113, '123 Main Street', +ST_PointFromText( +'POINT( 52 30 )', 101), +ST_PolyFromText( +'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101)); + +INSERT INTO buildings VALUES(114, '215 Main Street', +ST_PointFromText( +'POINT( 64 33 )', 101), +ST_PolyFromText( +'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101)); + + +--echo # Ponds + +INSERT INTO ponds VALUES(120, NULL, 'Stock Pond', +ST_MPolyFromText( +'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ), +( ( 26 44, 26 40, 28 42, 26 44) ) )', 101)); + +--echo # Named Places + +INSERT INTO named_places VALUES(117, 'Ashton', +ST_PolyFromText( +'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101)); + +INSERT INTO named_places VALUES(118, 'Goose Island', +ST_PolyFromText( +'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101)); + +--echo # Map Neatlines + +INSERT INTO map_neatlines VALUES(115, +ST_PolyFromText( +'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101)); + +--echo # +--echo # C.3.3.3 Geometry types and functions schema test queries +--echo + +# TODO: WL#2377 +#--echo # Conformance Item T1 +#SELECT f_table_name +#FROM geometry_columns; +# +#--echo # Conformance Item T2 +#SELECT f_geometry_column +#FROM geometry_columns +#WHERE f_table_name = 'streams'; +# +#--echo # Conformance Item T3 +#SELECT coord_dimension +#FROM geometry_columns +#WHERE f_table_name = 'streams'; +# +#--echo # Conformance Item T4 +# +#SELECT ST_srid +#FROM geometry_columns +#WHERE f_table_name = 'streams'; +# +#--echo # Conformance Item T5 +# +#SELECT srtext +#FROM SPATIAL_REF_SYS +#WHERE ST_SRID = 101; +# + + +--echo # Conformance Item T6 +# TODO: ST_Dimension() alias +SELECT ST_Dimension(shore) +FROM lakes +WHERE name = 'Blue Lake'; + +--echo # Conformance Item T7 +# TODO: ST_GeometryType() alias +SELECT ST_GeometryType(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; + +--echo # Conformance Item T8 +# TODO: ST_AsText() alias +SELECT ST_AsText(boundary) +FROM named_places +WHERE name = 'Goose Island'; + +--echo # Conformance Item T9 +# TODO: ST_AsBinary(), ST_PolyFromWKB() aliases +SELECT ST_AsText(ST_PolyFromWKB(ST_AsBinary(boundary),101)) +FROM named_places +WHERE name = 'Goose Island'; + +--echo # Conformance Item T10 +# TODO: ST_SRID() alias +SELECT ST_SRID(boundary) +FROM named_places +WHERE name = 'Goose Island'; + +--echo # Conformance Item T11 +# TODO: ST_IsEmpty() alias +SELECT ST_IsEmpty(centerline) +FROM road_segments +WHERE name = 'Route 5' +AND aliases = 'Main Street'; + +# FIXME: get wrong result:0, expected 1. +#--echo # Conformance Item T12 +# TODO: ST_IsSimple() alias +#SELECT ST_IsSimple(shore) +#FROM lakes +#WHERE name = 'Blue Lake'; + +# TODO: WL#2377 +#--echo # Conformance Item T13 +#SELECT ST_AsText(Boundary((boundary),101) +#FROM named_places +#WHERE name = 'Goose Island'; + +--echo # Conformance Item T14 +# TODO: ST_Envelope( ) alias +# FIXME: we get anticlockwise, GIS suggests clockwise +SELECT ST_AsText(ST_Envelope(boundary)) +FROM named_places +WHERE name = 'Goose Island'; + +--echo # Conformance Item T15 +# TODO: ST_X() alias +SELECT ST_X(position) +FROM bridges +WHERE name = 'Cam Bridge'; + +--echo # Conformance Item T16 +# TODO: ST_Y() alias +SELECT ST_Y(position) +FROM bridges +WHERE name = 'Cam Bridge'; + +--echo # Conformance Item T17 +# TODO: ST_StartPoint() alias +SELECT ST_AsText(ST_StartPoint(centerline)) +FROM road_segments +WHERE fid = 102; + +--echo # Conformance Item T18 +# TODO: ST_EndPoint +SELECT ST_AsText(ST_EndPoint(centerline)) +FROM road_segments +WHERE fid = 102; + +# TODO: WL#2377 +#--echo # Conformance Item T19 +# TODO: ST_LineFromWKB() alias +#SELECT ST_IsClosed(LineFromWKB(ST_AsBinary(Boundary(boundary)),ST_SRID(boundary))) +#FROM named_places +#WHERE name = 'Goose Island'; + +# TODO: WL#2377 +#--echo # Conformance Item T20 +#SELECT IsRing(LineFromWKB(ST_AsBinary(Boundary(boundary)),ST_SRID(boundary))) +#FROM named_places +#WHERE name = 'Goose Island'; + +--echo # Conformance Item T21 +# TODO: ST_Length() alias +SELECT ST_Length(centerline) +FROM road_segments +WHERE fid = 106; + +--echo # Conformance Item T22 +# TODO: ST_NumPoints() alias +SELECT ST_NumPoints(centerline) +FROM road_segments +WHERE fid = 102; + +--echo # Conformance Item T23 +# TODO: ST_PointN() alias +SELECT ST_AsText(ST_PointN(centerline, 1)) +FROM road_segments +WHERE fid = 102; + +--echo # Conformance Item T24 +# TODO: ST_Centroid() alias +SELECT ST_AsText(ST_Centroid(boundary)) +FROM named_places +WHERE name = 'Goose Island'; + +# TODO: WL#2377 +#--echo # Conformance Item T25 +#SELECT MBRContains(boundary, PointOnSurface(boundary)) +#FROM named_places +#WHERE name = 'Goose Island'; + +--echo # Conformance Item T26 +# TODO: ST_Area() alias +SELECT ST_Area(boundary) +FROM named_places +WHERE name = 'Goose Island'; + +--echo # Conformance Item T27 +# TODO: ST_ExteriorRing() alias +SELECT ST_AsText(ST_ExteriorRing(shore)) +FROM lakes +WHERE name = 'Blue Lake'; + +--echo # Conformance Item T28 +# TODO: ST_NumInteriorRings() alias +SELECT ST_NumInteriorRings(shore) +FROM lakes +WHERE name = 'Blue Lake'; + +--echo # Conformance Item T29 +# TODO: ST_InteriorRingN() alias +SELECT ST_AsText(ST_InteriorRingN(shore, 1)) +FROM lakes +WHERE name = 'Blue Lake'; + +--echo # Conformance Item T30 +# TODO: ST_NumGeometries() alias +SELECT ST_NumGeometries(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; + +--echo # Conformance Item T31 +# TODO: ST_GeometryN() alias +SELECT ST_AsText(ST_GeometryN(centerlines, 2)) +FROM divided_routes +WHERE name = 'Route 75'; + +--echo # Conformance Item T32 +# TODO: ST_IsClosed() alias +SELECT ST_IsClosed(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; + +--echo # Conformance Item T33 +# TODO: ST_Length() alias +SELECT ST_Length(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; + +--echo # Conformance Item T34 +# TODO: ST_Centroid() alias +SELECT ST_AsText(ST_Centroid(shores)) +FROM ponds +WHERE fid = 120; + +# TODO: WL#2377 +#--echo # Conformance Item T35 +#SELECT MBRContains(shores, PointOnSurface(shores)) +#FROM ponds +#WHERE fid = 120; + +--echo # Conformance Item T36 +# TODO: ST_Area() alias +SELECT ST_Area(shores) +FROM ponds +WHERE fid = 120; + +--echo # Conformance Item T37 +# TODO: ST_PolyFromText() alias +SELECT ST_Equals(boundary, +ST_PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',101)) +FROM named_places +WHERE name = 'Goose Island'; + +--echo # Conformance Item T38 +SELECT ST_Disjoint(centerlines, boundary) +FROM divided_routes, named_places +WHERE divided_routes.name = 'Route 75' +AND named_places.name = 'Ashton'; + +--echo # Conformance Item T39 +SELECT ST_Touches(centerline, shore) +FROM streams, lakes +WHERE streams.name = 'Cam Stream' +AND lakes.name = 'Blue Lake'; + +# FIXME: wrong result: get 0, expected 1 +#--echo # Conformance Item T40 +#SELECT ST_Within(boundary, footprint) +#FROM named_places, buildings +#WHERE named_places.name = 'Ashton' +#AND buildings.address = '215 Main Street'; + +# FIXME: wrong result: get 0, expected 1 +#--echo # Conformance Item T41 +#SELECT ST_Overlaps(forests.boundary, named_places.boundary) +#FROM forests, named_places +#WHERE forests.name = 'Green Forest' +#AND named_places.name = 'Ashton'; + +--echo # Conformance Item T42 +# FIXME: TODO: ST_Crosses() alias +SELECT ST_Crosses(road_segments.centerline, divided_routes.centerlines) +FROM road_segments, divided_routes +WHERE road_segments.fid = 102 +AND divided_routes.name = 'Route 75'; + +--echo # Conformance Item T43 +SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines) +FROM road_segments, divided_routes +WHERE road_segments.fid = 102 +AND divided_routes.name = 'Route 75'; + +--echo # Conformance Item T44 +SELECT ST_Contains(forests.boundary, named_places.boundary) +FROM forests, named_places +WHERE forests.name = 'Green Forest' +AND named_places.name = 'Ashton'; + +# TODO: WL#2377 +#--echo # Conformance Item T45 +#SELECT Relate(forests.boundary, named_places.boundary, 'TTTTTTTTT') +#FROM forests, named_places +#WHERE forests.name = 'Green Forest' +#AND named_places.name = 'Ashton'; + +--echo # Conformance Item T46 +SELECT ST_Distance(position, boundary) +FROM bridges, named_places +WHERE bridges.name = 'Cam Bridge' +AND named_places.name = 'Ashton'; + +# FIXME: wrong result: NULL, expected 12 +#--echo # Conformance Item T47 +#SELECT ST_AsText(ST_Intersection(centerline, shore)) +#FROM streams, lakes +#WHERE streams.name = 'Cam Stream' +#AND lakes.name = 'Blue Lake'; + +--echo # Conformance Item T48 +SELECT ST_AsText(ST_Difference(named_places.boundary, forests.boundary)) +FROM named_places, forests +WHERE named_places.name = 'Ashton' +AND forests.name = 'Green Forest'; + +#--echo # Conformance Item T49 +SELECT ST_AsText(ST_Union(shore, boundary)) +FROM lakes, named_places +WHERE lakes.name = 'Blue Lake' +AND named_places.name = 'Goose Island'; + +--echo # Conformance Item T50 +SELECT ST_AsText(ST_SymDifference(shore, boundary)) +FROM lakes, named_places +WHERE lakes.name = 'Blue Lake' +AND named_places.name = 'Ashton'; + +--echo # Conformance Item T51 +SELECT count(*) +FROM buildings, bridges +WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1; + +# TODO: WL#2377 +#--echo # Conformance Item T52 +#SELECT ST_AsText(ConvexHull(shore)) +#FROM lakes +#WHERE lakes.name = 'Blue Lake'; + +DROP DATABASE gis_ogs; + +--echo # +--echo # Bug#13362660 ASSERTION `FIELD_POS < FIELD_COUNT' FAILED. IN PROTOCOL_TEXT::STORE +--echo # + +# --error ER_GIS_INVALID_DATA +SELECT ST_Union('', ''), md5(1); diff --git a/mysql-test/suite/innodb_gis/t/precise.test b/mysql-test/suite/innodb_gis/t/precise.test new file mode 100644 index 00000000000..43cd906782e --- /dev/null +++ b/mysql-test/suite/innodb_gis/t/precise.test @@ -0,0 +1,144 @@ +-- source include/have_innodb.inc +-- source include/have_geometry.inc + + +# +# Spatial objects +# + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +select 1, ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))'), ST_GeomFromText('POLYGON((10 10,30 10,30 30,10 30,10 10))')); +select 0, ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POLYGON((10 40, 40 50, 20 70, 10 40))')); +select 1, ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POINT(10 10)')); +select 1, ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); +select 0, ST_Within(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); +select 1, ST_Within(ST_GeomFromText('POLYGON((1 1,20 10,10 30, 1 1))'), ST_GeomFromText('POLYGON((0 0,30 5,10 40, 0 0))')); + + +create table t1 (g point)engine=innodb; +insert into t1 values +(ST_GeomFromText('POINT(2 2)')), (ST_GeomFromText('POINT(2 4)')), (ST_GeomFromText('POINT(2 6)')), (ST_GeomFromText('POINT(2 8)')), +(ST_GeomFromText('POINT(4 2)')), (ST_GeomFromText('POINT(4 4)')), (ST_GeomFromText('POINT(4 6)')), (ST_GeomFromText('POINT(4 8)')), +(ST_GeomFromText('POINT(6 2)')), (ST_GeomFromText('POINT(6 4)')), (ST_GeomFromText('POINT(6 6)')), (ST_GeomFromText('POINT(6 8)')), +(ST_GeomFromText('POINT(8 2)')), (ST_GeomFromText('POINT(8 4)')), (ST_GeomFromText('POINT(8 6)')), (ST_GeomFromText('POINT(8 8)')); + +select ST_astext(g) from t1 where ST_Within(g, ST_GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))')); +select 'Contains'; +select ST_astext(g) from t1 where ST_Contains(ST_GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))'), g); +select 'Intersects'; +select ST_astext(g) from t1 where ST_Intersects(ST_GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))'), g); +select 'Contains'; +select ST_astext(g) from t1 where ST_Contains(ST_GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))'), g); +select 'Contains2'; +select ST_astext(g) from t1 where ST_Contains(ST_GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1), (5.01 3.01, 6 5, 9 5, 8 3, 5.01 3.01))'), g); + +DROP TABLE t1; + +select 0, ST_Within(ST_GeomFromText('LINESTRING(15 15, 50 50, 60 60)'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); +select 1, ST_Within(ST_GeomFromText('LINESTRING(15 15, 16 16)'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); + + +select 1, ST_Intersects(ST_GeomFromText('LINESTRING(15 15, 50 50)'), ST_GeomFromText('LINESTRING(50 15, 15 50)')); +select 1, ST_Intersects(ST_GeomFromText('LINESTRING(15 15, 50 50)'), ST_GeomFromText('LINESTRING(16 16, 51 51)')); + +select 1, ST_Intersects(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')); + +select ST_astext(ST_Union(ST_geometryfromtext('point(1 1)'), ST_geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))'))); +select ST_astext(ST_Intersection(ST_geometryfromtext('point(1 1)'), ST_geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))'))); + +select ST_Intersects(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')); +select ST_contains(ST_GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)), ((6 6, 6 11, 11 11, 11 6, 6 6)))'), ST_GeomFromText('POINT(5 10)')); +select ST_Disjoint(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((10 10, 10 15, 15 15, 15 10, 10 10))')); +select ST_Disjoint(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))')); +select ST_Overlaps(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))')); +select ST_Overlaps(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((1 1, 1 4, 4 4, 4 1, 1 1))')); + +# Distance tests +select ST_DISTANCE(ST_geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), ST_geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')); +select ST_DISTANCE(ST_geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), ST_geomfromtext('linestring(0 1, 1 0)')); +select ST_DISTANCE(ST_geomfromtext('polygon((0 0, 3 6, 6 3, 0 0))'), ST_geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')); +select ST_DISTANCE(ST_geomfromtext('polygon((0 0, 3 6, 6 3, 0 0),(2 2, 3 4, 4 3, 2 2))'), ST_geomfromtext('point(3 3)')); +select ST_DISTANCE(ST_geomfromtext('linestring(0 0, 3 6, 6 3, 0 0)'), ST_geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')); + + +# Operations tests +--replace_result 23.85542168674699 23.855421686746986 +select ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))'))); +--replace_result 23.85542168674699 23.855421686746986 +select ST_astext(ST_Intersection(ST_GeomFromText('LINESTRING(0 0, 50 45, 40 50, 0 0)'), ST_GeomFromText('LINESTRING(50 5, 55 10, 0 45, 50 5)'))); +select ST_astext(ST_Intersection(ST_GeomFromText('LINESTRING(0 0, 50 45, 40 50)'), ST_GeomFromText('LINESTRING(50 5, 55 10, 0 45)'))); +select ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POINT(20 20)'))); +select ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200)'))); +select ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))); +select ST_astext(ST_UNION(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))); + +select ST_astext(ST_intersection(ST_geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), ST_geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))'))); + +select ST_astext(ST_symdifference(ST_geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), ST_geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))'))); +select ST_astext(ST_UNION(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))); + +# Buffer() tests +--replace_regex /([0-9]+\.[0-9]{4})[0-9]*/\1/ +select ST_astext(ST_buffer(ST_geometryfromtext('point(1 1)'), 1)); +create table t1(geom geometrycollection)engine=innodb; +# --error ER_CANT_CREATE_GEOMETRY_OBJECT +# insert into t1 values (ST_geomfromtext('POLYGON((0 0, 10 10, 0 8, 0 0))')); +# --error ER_CANT_CREATE_GEOMETRY_OBJECT +# insert into t1 values (ST_geomfromtext('POLYGON((1 1, 10 10, 0 8, 1 1))')); +--replace_regex /([0-9]+\.[0-9]{4})[0-9]*/\1/ +select ST_astext(geom), ST_area(geom),ST_area(ST_buffer(geom,2)) from t1; +select ST_NUMPOINTS(ST_EXTERIORRING(ST_buffer(geom,2))) from t1; + +set @geom=ST_geomfromtext('LINESTRING(2 1, 4 2, 2 3, 2 5)'); +set @buff=ST_buffer(@geom,1); +select ST_NUMPOINTS(ST_EXTERIORRING(@buff)) from t1; + +# cleanup +DROP TABLE t1; + +#ST_Touches tests +select st_touches(ST_geomfromtext('point(0 0)'), ST_geomfromtext('point(1 1)')); +select st_touches(ST_geomfromtext('point(1 1)'), ST_geomfromtext('point(1 1)')); +select st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('point(1 1)')); +select st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('point(1 0)')); +select st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('point(1 2)')); +select st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('polygon((1 1.2, 1 0, 2 0, 1 1.2))')); +select st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('polygon((1 1, 1 0, 2 0, 1 1))')); + +#Equals test +SELECT ST_Equals(ST_PolyFromText('POLYGON((67 13, 67 18, 67 18, 59 18, 59 13, 67 13) )'),ST_PolyFromText('POLYGON((67 13, 67 18, 59 19, 59 13, 59 13, 67 13) )')) as result; +SELECT ST_Equals(ST_PolyFromText('POLYGON((67 13, 67 18, 67 18, 59 18, 59 13, 67 13) )'),ST_PolyFromText('POLYGON((67 13, 67 18, 59 18, 59 13, 59 13, 67 13) )')) as result; +SELECT ST_Equals(ST_PointFromText('POINT (12 13)'),ST_PointFromText('POINT (12 13)')) as result; + + +--echo # +--echo # BUG#11755628/47429: INTERSECTION FUNCTION CRASHED MYSQLD +--echo # BUG#11759650/51979: UNION/INTERSECTION OF POLYGONS CRASHES MYSQL +--echo # + +# --error ER_GIS_INVALID_DATA +SELECT ST_ASTEXT(ST_UNION(ST_GEOMFROMTEXT('POLYGON((525000 183300,525400 +183300,525400 18370, 525000 183700,525000 183300))'), +ST_geomfromtext('POLYGON((525298.67 183511.53,525296.57 +183510.39,525296.42 183510.31,525289.11 183506.62,525283.17 +183503.47,525280.98 183502.26,525278.63 183500.97,525278.39 +183500.84,525276.79 183500,525260.7 183491.55,525263.95 +183484.75,525265.58 183481.95,525278.97 183488.73,525276.5 +183493.45,525275.5 183495.7,525280.35 183498.2,525282.3 +183499.1,525282.2 183499.3,525283.55 183500,525301.75 +183509.35,525304.45 183504.25,525307.85 183504.95,525304.5 +183510.83,525302.81 183513.8,525298.67 183511.53),(525275.06 +183489.89,525272.06 183488.37,525268.94 183494.51,525271.94 +183496.03,525275.06 183489.89),(525263.26 183491.55,525266.15 +183493.04,525269.88 183485.82,525266.99 183484.33,525263.26 +183491.55))'))) st_u; + +SET @a=0x0000000001030000000200000005000000000000000000000000000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000000000000000000024400000000000000000000000000000000000000000000000000000F03F000000000000F03F0000000000000040000000000000F03F00000000000000400000000000000040000000000000F03F0000000000000040000000000000F03F000000000000F03F; +# --error ER_GIS_INVALID_DATA +SELECT ST_ASTEXT(ST_TOUCHES(@a, ST_GEOMFROMTEXT('point(0 0)'))) t; + + +--source include/gis_debug.inc diff --git a/mysql-test/suite/innodb_gis/t/rt_precise.test b/mysql-test/suite/innodb_gis/t/rt_precise.test new file mode 100644 index 00000000000..8049ff02ff1 --- /dev/null +++ b/mysql-test/suite/innodb_gis/t/rt_precise.test @@ -0,0 +1,74 @@ +#***************************************************************** +# This was a Myisam testcase, converted to InnoDB +# Since Innodb does not support the spatial key, hence converted +# Orginal name of the testcase : gis_rt_precise.test +#***************************************************************** +--source include/have_innodb.inc +-- source include/have_geometry.inc +SET default_storage_engine=InnoDB; + +# +# test of rtree (using with spatial data) +# +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 ( + fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + g GEOMETRY NOT NULL, + KEY gis_key(g(5)) +) ENGINE=InnoDB; + +SHOW CREATE TABLE t1; + +--disable_query_log +let $1=150; +let $2=150; +while ($1) +{ + eval INSERT INTO t1 (g) VALUES (ST_GeomFromText('LineString($1 $1, $2 $2)')); + dec $1; + inc $2; +} +--enable_query_log + +SELECT count(*) FROM t1; + +ANALYZE TABLE t1; + +--replace_column 10 # +EXPLAIN SELECT fid, ST_AsText(g) FROM t1 WHERE ST_Within(g, ST_GeomFromText('Polygon((140 140,160 140,160 160,140 140))')); +SELECT fid, ST_AsText(g) FROM t1 WHERE ST_Within(g, ST_GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))')) ORDER BY fid; + +DROP TABLE t1; + +CREATE TABLE t1 ( + fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + g GEOMETRY NOT NULL +) ENGINE=InnoDB; + +--disable_query_log +let $1=10; +while ($1) +{ + let $2=10; + while ($2) + { + eval INSERT INTO t1 (g) VALUES (LineString(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10))); + dec $2; + } + dec $1; +} +--enable_query_log + +#--error 1464 +ALTER TABLE t1 ADD SPATIAL KEY(g); +SHOW CREATE TABLE t1; +SELECT count(*) FROM t1; +SELECT fid, ST_AsText(g) FROM t1 WHERE ST_Within(g, + ST_GeomFromText('Polygon((40 40,60 40,60 60,40 40))')) ORDER BY fid; + +DROP TABLE t1; + +--echo End of 5.5 tests. diff --git a/mysql-test/suite/innodb_gis/t/rtree.test b/mysql-test/suite/innodb_gis/t/rtree.test new file mode 100644 index 00000000000..3a0e5311b32 --- /dev/null +++ b/mysql-test/suite/innodb_gis/t/rtree.test @@ -0,0 +1,236 @@ +# WL#6745 InnoDB R-tree support +# This test case will test basic R-tree support features. + +# Not supported in embedded +--source include/not_embedded.inc + +--source include/have_innodb.inc + +# Create table with R-tree index. +create table t1 (i int, g geometry not null, spatial index (g))engine=innodb; + +# Insert values. +insert into t1 values (1, POINT(1,1)); +insert into t1 values (1, POINT(1.5,1.5)); +insert into t1 values (1, POINT(3,3)); +insert into t1 values (1, POINT(3.1,3.1)); +insert into t1 values (1, POINT(5,5)); + +analyze table t1; + +# Select by R-tree index. +set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))'); +explain select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1); +select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1); + +# Delete values. +set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))'); +delete from t1 where MBRWithin(t1.g, @g1); +check table t1; + +select ST_astext(t1.g) from t1; + +# Update values. +set @g1 = ST_GeomFromText('Polygon((5 5,5 5,5 5,5 5,5 5))'); +update t1 set g = POINT(2,2) where MBRWithin(t1.g, @g1); +check table t1; + +select ST_astext(t1.g) from t1; + +# Show index. +--replace_column 7 # +show indexes from t1; + +# Cleanup. +drop table t1; + +# Test functions. +create table t1 (name VARCHAR(100), square GEOMETRY not null, spatial index (square))engine=innodb; + + +INSERT INTO t1 VALUES("small", ST_GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))')); +INSERT INTO t1 VALUES("big", ST_GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))')); + +INSERT INTO t1 VALUES("up", ST_GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))')); +INSERT INTO t1 VALUES("up2", ST_GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))')); +INSERT INTO t1 VALUES("up3", ST_GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))')); + +INSERT INTO t1 VALUES("down", ST_GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))')); +INSERT INTO t1 VALUES("down2", ST_GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))')); +INSERT INTO t1 VALUES("down3", ST_GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))')); + +INSERT INTO t1 VALUES("right", ST_GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))')); +INSERT INTO t1 VALUES("right2", ST_GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))')); +INSERT INTO t1 VALUES("right3", ST_GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))')); + +INSERT INTO t1 VALUES("left", ST_GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))')); +INSERT INTO t1 VALUES("left2", ST_GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))')); +INSERT INTO t1 VALUES("left3", ST_GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))')); + +SET @p = ST_GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'); +SELECT name, ST_AsText(square) from t1 where MBRContains(@p, square); +SELECT name, ST_AsText(square) from t1 where MBRDisjoint(@p, square); +SELECT name, ST_AsText(square) from t1 where MBREquals(@p, square); +SELECT name, ST_AsText(square) from t1 where MBRIntersects(@p, square); +SELECT name, ST_AsText(square) from t1 where MBROverlaps(@p, square); +SELECT name, ST_AsText(square) from t1 where MBRTouches(@p, square); +SELECT name, ST_AsText(square) from t1 where MBRWithin(@p, square); + +# MBROverlaps needs a few more tests, with point and line dimensions + +# --error ER_GIS_INVALID_DATA +SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))'); +# --error ER_GIS_INVALID_DATA +SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))'); +# --error ER_GIS_INVALID_DATA +SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))'); +# --error ER_GIS_INVALID_DATA +SET @horiz3 = ST_GeomFromText('POLYGON ((2 0, 3 0, 2 0))'); +# --error ER_GIS_INVALID_DATA +SET @point1 = ST_GeomFromText('POLYGON ((0 0))'); +# --error ER_GIS_INVALID_DATA +SET @point2 = ST_GeomFromText('POLYGON ((-2 0))'); + +SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @vert1) GROUP BY a1.name; +SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @horiz1) GROUP BY a1.name; +SELECT MBROverlaps(@horiz1, @vert1) FROM DUAL; +SELECT MBROverlaps(@horiz1, @horiz2) FROM DUAL; +SELECT MBROverlaps(@horiz1, @horiz3) FROM DUAL; +SELECT MBROverlaps(@horiz1, @point1) FROM DUAL; +SELECT MBROverlaps(@horiz1, @point2) FROM DUAL; + +DROP TABLE t1; + +# Inplace create spatial index is not supported +create table t1 (i int not null, g geometry not null)engine=innodb; + +# Insert values. +insert into t1 values (1, POINT(1,1)); +insert into t1 values (2, POINT(1.5,1.5)); +insert into t1 values (3, POINT(3,3)); +insert into t1 values (4, POINT(3.1,3.1)); +insert into t1 values (5, POINT(5,5)); + +# alter table t1 add primary key(i), algorithm=inplace; +alter table t1 add primary key(i); +alter table t1 drop primary key; + +# create spatial index idx on t1(g) algorithm=inplace; +create spatial index idx on t1(g); + +create spatial index idx2 on t1(g); + +# alter table t1 add primary key(i), algorithm=inplace; +alter table t1 add primary key(i); + +show create table t1; + +drop index idx on t1; + +drop table t1; + +#Test multi pk table. +create table t1 (i int, i2 char(10), g geometry not null, primary key (i, i2), spatial index (g))engine=innodb; + +# Insert values. +insert into t1 values (1, "111", POINT(1,1)); +insert into t1 values (2, "222", POINT(1.5,1.5)); +insert into t1 values (3, "333", POINT(3,3)); +insert into t1 values (4, "444", POINT(3.1,3.1)); +insert into t1 values (5, "555", POINT(5,5)); + +analyze table t1; + +# Select by R-tree index. +set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))'); +explain select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1); +select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1); + +# Delete values. +set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))'); +delete from t1 where MBRWithin(t1.g, @g1); +check table t1; + +select ST_astext(t1.g) from t1; + +# Update values. +set @g1 = ST_GeomFromText('Polygon((5 5,5 5,5 5,5 5,5 5))'); +update t1 set g = POINT(2,2) where MBRWithin(t1.g, @g1); +check table t1; + +select ST_astext(t1.g) from t1; + +# Show index. +--replace_column 7 # +show indexes from t1; + +# Cleanup. +drop table t1; + +CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `way` geometry NOT NULL, + PRIMARY KEY (`id`), + SPATIAL KEY `way` (`way`) +) ENGINE=InnoDB; + +INSERT INTO t1 SET way = ST_GeomFromText('POINT(1 1)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(1 2)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(1 3)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(1 4)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(1 5)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(2 1)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(2 2)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(2 3)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(2 4)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(2 5)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(3 1)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(3 2)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(3 3)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(3 4)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(3 5)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(4 1)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(4 2)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(4 3)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(4 4)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(4 5)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(5 1)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(5 2)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(5 3)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(5 4)'); +INSERT INTO t1 SET way = ST_GeomFromText('POINT(5 5)'); + +SELECT COUNT(*) + FROM t1 + WHERE ST_CONTAINS(ST_GeomFromText('POLYGON((2 2,4 2, 4 4, 2 4, 2 2))'),way); + +OPTIMIZE TABLE t1; + +SELECT COUNT(*) + FROM t1 + WHERE ST_CONTAINS(ST_GeomFromText('POLYGON((2 2,4 2, 4 4, 2 4, 2 2))'),way); + + +DROP TABLE t1; + +# Check the update with unchanged MBR optimization. +# Create table with R-tree index. +CREATE TABLE t1( i INT, g GEOMETRY NOT NULL, SPATIAL INDEX (g)) ENGINE=InnoDB; + +# Insert values. +INSERT INTO t1 VALUES(1, LINESTRING(POINT(1,1), POINT(4, 4))); +INSERT INTO t1 VALUES(2, LINESTRING(POINT(2,2), POINT(5, 5))); + +# Update value. +UPDATE t1 SET g = LINESTRING(POINT(1,1), POINT(2,2), POINT(3,3), POINT(4,4)) + WHERE i = 1; +UPDATE t1 SET g = LINESTRING(POINT(1,1), POINT(2,2), POINT(3,3), POINT(8,8)) + WHERE i = 2; + + +CHECK TABLE t1; + +DELETE FROM t1 + WHERE ST_CONTAINS(ST_GeomFromText('POLYGON((0 0,4 0, 4 4, 0 4, 0 0))'),g); + +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_zip/r/16k.result b/mysql-test/suite/innodb_zip/r/16k.result index e594ff08281..9e8534417b7 100644 --- a/mysql-test/suite/innodb_zip/r/16k.result +++ b/mysql-test/suite/innodb_zip/r/16k.result @@ -41,12 +41,6 @@ test/t1 Single DEFAULT 0 Compact or Redundant MYSQLD_DATADIR/test/t1.ibd test/t2 Single DEFAULT 0 Compact or Redundant MYSQLD_DATADIR/test/t2.ibd test/t3 Single DEFAULT 8192 Compressed MYSQLD_DATADIR/test/t3.ibd test/t4 Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/t4.ibd -=== information_schema.files === -Space_Name File_Type Engine Status Tablespace_Name Path -test/t1 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t1.ibd -test/t2 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t2.ibd -test/t3 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t3.ibd -test/t4 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t4.ibd DROP TABLE t1, t2, t3, t4; # Test 4) The maximum row size is dependent upon the page size. # Redundant: 8123, Compact: 8126. diff --git a/mysql-test/suite/innodb_zip/r/4k.result b/mysql-test/suite/innodb_zip/r/4k.result index 721943e7f5a..50646fff5d3 100644 --- a/mysql-test/suite/innodb_zip/r/4k.result +++ b/mysql-test/suite/innodb_zip/r/4k.result @@ -20,28 +20,8 @@ WHERE t.table_id = i.table_id AND t.name LIKE 'mysql%' ORDER BY t.name, i.index_id; table_name n_cols table_flags index_name root_page type n_fields merge_threshold -mysql/engine_cost 9 33 PRIMARY 3 3 3 50 -mysql/gtid_executed 6 33 PRIMARY 3 3 2 50 -mysql/help_category 7 33 PRIMARY 3 3 1 50 -mysql/help_category 7 33 name 4 2 1 50 -mysql/help_keyword 5 33 PRIMARY 3 3 1 50 -mysql/help_keyword 5 33 name 4 2 1 50 -mysql/help_relation 5 33 PRIMARY 3 3 2 50 -mysql/help_topic 9 33 PRIMARY 3 3 1 50 -mysql/help_topic 9 33 name 4 2 1 50 mysql/innodb_index_stats 11 33 PRIMARY 3 3 4 50 mysql/innodb_table_stats 9 33 PRIMARY 3 3 2 50 -mysql/plugin 5 33 PRIMARY 3 3 1 50 -mysql/servers 12 33 PRIMARY 3 3 1 50 -mysql/server_cost 7 33 PRIMARY 3 3 1 50 -mysql/slave_master_info 28 33 PRIMARY 3 3 1 50 -mysql/slave_relay_log_info 12 33 PRIMARY 3 3 1 50 -mysql/slave_worker_info 16 33 PRIMARY 3 3 2 50 -mysql/time_zone 5 33 PRIMARY 3 3 1 50 -mysql/time_zone_leap_second 5 33 PRIMARY 3 3 1 50 -mysql/time_zone_name 5 33 PRIMARY 3 3 1 50 -mysql/time_zone_transition 6 33 PRIMARY 3 3 2 50 -mysql/time_zone_transition_type 8 33 PRIMARY 3 3 2 50 CREATE TABLE t1 (a INT KEY, b TEXT) ROW_FORMAT=REDUNDANT ENGINE=innodb; CREATE TABLE t2 (a INT KEY, b TEXT) ROW_FORMAT=COMPACT ENGINE=innodb; CREATE TABLE t3 (a INT KEY, b TEXT) ROW_FORMAT=COMPRESSED ENGINE=innodb; @@ -65,12 +45,6 @@ test/t1 Single DEFAULT 0 Compact or Redundant MYSQLD_DATADIR/test/t1.ibd test/t2 Single DEFAULT 0 Compact or Redundant MYSQLD_DATADIR/test/t2.ibd test/t3 Single DEFAULT 2048 Compressed MYSQLD_DATADIR/test/t3.ibd test/t4 Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/t4.ibd -=== information_schema.files === -Space_Name File_Type Engine Status Tablespace_Name Path -test/t1 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t1.ibd -test/t2 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t2.ibd -test/t3 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t3.ibd -test/t4 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t4.ibd DROP TABLE t1, t2, t3, t4; # Test 4) The maximum row size is dependent upon the page size. # Redundant: 1979, Compact: 1982. @@ -153,38 +127,40 @@ ERROR 42000: Specified key was too long; max key length is 768 bytes # in strict mode and converted to 4 in non-strict mode. SET SESSION innodb_strict_mode = ON; CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16; -ERROR HY000: Table storage engine for 't1' doesn't have this option +ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options") SHOW WARNINGS; Level Code Message Warning 1478 InnoDB: KEY_BLOCK_SIZE=16 cannot be larger than 4. -Error 1031 Table storage engine for 't1' doesn't have this option +Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options") +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; -ERROR HY000: Table storage engine for 't1' doesn't have this option +ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options") SHOW WARNINGS; Level Code Message Warning 1478 InnoDB: KEY_BLOCK_SIZE=8 cannot be larger than 4. -Error 1031 Table storage engine for 't1' doesn't have this option +Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options") +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; SHOW WARNINGS; Level Code Message SELECT table_name, row_format, create_options FROM information_schema.tables WHERE table_name = 't1'; table_name row_format create_options -t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=4 +t1 Compressed row_format=COMPRESSED key_block_size=4 ALTER TABLE t1 KEY_BLOCK_SIZE=2; SHOW WARNINGS; Level Code Message SELECT table_name, row_format, create_options FROM information_schema.tables WHERE table_name = 't1'; table_name row_format create_options -t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=2 +t1 Compressed row_format=COMPRESSED key_block_size=2 ALTER TABLE t1 KEY_BLOCK_SIZE=1; SHOW WARNINGS; Level Code Message SELECT table_name, row_format, create_options FROM information_schema.tables WHERE table_name = 't1'; table_name row_format create_options -t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=1 +t1 Compressed row_format=COMPRESSED key_block_size=1 ALTER TABLE t1 KEY_BLOCK_SIZE=0; SHOW WARNINGS; Level Code Message @@ -203,7 +179,7 @@ Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16. SELECT table_name, row_format, create_options FROM information_schema.tables WHERE table_name = 't1'; table_name row_format create_options -t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=16 +t1 Compressed row_format=COMPRESSED key_block_size=16 DROP TABLE t1; CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; Warnings: @@ -214,7 +190,7 @@ Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8. SELECT table_name, row_format, create_options FROM information_schema.tables WHERE table_name = 't1'; table_name row_format create_options -t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=8 +t1 Compressed row_format=COMPRESSED key_block_size=8 DROP TABLE t1; CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; SHOW WARNINGS; @@ -222,21 +198,21 @@ Level Code Message SELECT table_name, row_format, create_options FROM information_schema.tables WHERE table_name = 't1'; table_name row_format create_options -t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=4 +t1 Compressed row_format=COMPRESSED key_block_size=4 ALTER TABLE t1 KEY_BLOCK_SIZE=2; SHOW WARNINGS; Level Code Message SELECT table_name, row_format, create_options FROM information_schema.tables WHERE table_name = 't1'; table_name row_format create_options -t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=2 +t1 Compressed row_format=COMPRESSED key_block_size=2 ALTER TABLE t1 KEY_BLOCK_SIZE=1; SHOW WARNINGS; Level Code Message SELECT table_name, row_format, create_options FROM information_schema.tables WHERE table_name = 't1'; table_name row_format create_options -t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=1 +t1 Compressed row_format=COMPRESSED key_block_size=1 ALTER TABLE t1 KEY_BLOCK_SIZE=0; SHOW WARNINGS; Level Code Message @@ -253,37 +229,41 @@ SHOW VARIABLES LIKE 'innodb_file_per_table'; Variable_name Value innodb_file_per_table OFF CREATE TABLE t4 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=8; -ERROR HY000: Table storage engine for 't4' doesn't have this option +ERROR HY000: Can't create table `test`.`t4` (errno: 140 "Wrong create options") SHOW WARNINGS; Level Code Message Warning 1478 InnoDB: KEY_BLOCK_SIZE=8 cannot be larger than 4. Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Error 1031 Table storage engine for 't4' doesn't have this option +Error 1005 Can't create table `test`.`t4` (errno: 140 "Wrong create options") +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB CREATE TABLE t5 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=16; -ERROR HY000: Table storage engine for 't5' doesn't have this option +ERROR HY000: Can't create table `test`.`t5` (errno: 140 "Wrong create options") SHOW WARNINGS; Level Code Message Warning 1478 InnoDB: KEY_BLOCK_SIZE=16 cannot be larger than 4. Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Error 1031 Table storage engine for 't5' doesn't have this option +Error 1005 Can't create table `test`.`t5` (errno: 140 "Wrong create options") +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_file_format = `Antelope`; Warnings: Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html CREATE TABLE t4 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=8; -ERROR HY000: Table storage engine for 't4' doesn't have this option +ERROR HY000: Can't create table `test`.`t4` (errno: 140 "Wrong create options") SHOW WARNINGS; Level Code Message Warning 1478 InnoDB: KEY_BLOCK_SIZE=8 cannot be larger than 4. Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Error 1031 Table storage engine for 't4' doesn't have this option +Error 1005 Can't create table `test`.`t4` (errno: 140 "Wrong create options") +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB CREATE TABLE t5 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=16; -ERROR HY000: Table storage engine for 't5' doesn't have this option +ERROR HY000: Can't create table `test`.`t5` (errno: 140 "Wrong create options") SHOW WARNINGS; Level Code Message Warning 1478 InnoDB: KEY_BLOCK_SIZE=16 cannot be larger than 4. Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Error 1031 Table storage engine for 't5' doesn't have this option +Error 1005 Can't create table `test`.`t5` (errno: 140 "Wrong create options") +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB SET GLOBAL innodb_file_format = `Barracuda`; Warnings: Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html @@ -307,7 +287,7 @@ k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c; CREATE INDEX t1b ON t1 (b(767)); UPDATE t1 SET a=@d,b=@d,c=@d,d=@d,e=@d,f=@d,g=@d,h=@d,i=@d,j=@d, k=@d,l=@d,m=@d,n=@d,o=@d,p=@d,q=@d,r=@d,s=@d,t=@d,u=@d; -ERROR HY000: Undo log record is too big. +ERROR HY000: Undo log record is too big BEGIN; UPDATE t1 SET a=@d,b=@d,c=@d,d=@d,e=@d; UPDATE t1 SET f=@d,g=@d,h=@d,i=@d,j=@d,k=@d,l=@d,m=@d, @@ -317,32 +297,32 @@ CREATE INDEX t1c ON t1 (c(767)); UPDATE t1 SET c=@e; CREATE INDEX t1d ON t1 (d(767)); UPDATE t1 SET d=@e; -ERROR HY000: Undo log record is too big. +ERROR HY000: Undo log record is too big CREATE INDEX t1e ON t1 (e(767)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` blob, - `b` blob, - `c` blob, - `d` blob, - `e` blob, - `f` blob, - `g` blob, - `h` blob, - `i` blob, - `j` blob, - `k` blob, - `l` blob, - `m` blob, - `n` blob, - `o` blob, - `p` blob, - `q` blob, - `r` blob, - `s` blob, - `t` blob, - `u` blob, + `a` blob DEFAULT NULL, + `b` blob DEFAULT NULL, + `c` blob DEFAULT NULL, + `d` blob DEFAULT NULL, + `e` blob DEFAULT NULL, + `f` blob DEFAULT NULL, + `g` blob DEFAULT NULL, + `h` blob DEFAULT NULL, + `i` blob DEFAULT NULL, + `j` blob DEFAULT NULL, + `k` blob DEFAULT NULL, + `l` blob DEFAULT NULL, + `m` blob DEFAULT NULL, + `n` blob DEFAULT NULL, + `o` blob DEFAULT NULL, + `p` blob DEFAULT NULL, + `q` blob DEFAULT NULL, + `r` blob DEFAULT NULL, + `s` blob DEFAULT NULL, + `t` blob DEFAULT NULL, + `u` blob DEFAULT NULL, KEY `t1a` (`a`(767)), KEY `t1b` (`b`(767)), KEY `t1c` (`c`(767)), diff --git a/mysql-test/suite/innodb_zip/r/8k.result b/mysql-test/suite/innodb_zip/r/8k.result index dc2b5ca1363..17ea11880c1 100644 --- a/mysql-test/suite/innodb_zip/r/8k.result +++ b/mysql-test/suite/innodb_zip/r/8k.result @@ -20,28 +20,8 @@ WHERE t.table_id = i.table_id AND t.name LIKE 'mysql%' ORDER BY t.name, i.index_id; table_name n_cols table_flags index_name root_page type n_fields merge_threshold -mysql/engine_cost 9 33 PRIMARY 3 3 3 50 -mysql/gtid_executed 6 33 PRIMARY 3 3 2 50 -mysql/help_category 7 33 PRIMARY 3 3 1 50 -mysql/help_category 7 33 name 4 2 1 50 -mysql/help_keyword 5 33 PRIMARY 3 3 1 50 -mysql/help_keyword 5 33 name 4 2 1 50 -mysql/help_relation 5 33 PRIMARY 3 3 2 50 -mysql/help_topic 9 33 PRIMARY 3 3 1 50 -mysql/help_topic 9 33 name 4 2 1 50 mysql/innodb_index_stats 11 33 PRIMARY 3 3 4 50 mysql/innodb_table_stats 9 33 PRIMARY 3 3 2 50 -mysql/plugin 5 33 PRIMARY 3 3 1 50 -mysql/servers 12 33 PRIMARY 3 3 1 50 -mysql/server_cost 7 33 PRIMARY 3 3 1 50 -mysql/slave_master_info 28 33 PRIMARY 3 3 1 50 -mysql/slave_relay_log_info 12 33 PRIMARY 3 3 1 50 -mysql/slave_worker_info 16 33 PRIMARY 3 3 2 50 -mysql/time_zone 5 33 PRIMARY 3 3 1 50 -mysql/time_zone_leap_second 5 33 PRIMARY 3 3 1 50 -mysql/time_zone_name 5 33 PRIMARY 3 3 1 50 -mysql/time_zone_transition 6 33 PRIMARY 3 3 2 50 -mysql/time_zone_transition_type 8 33 PRIMARY 3 3 2 50 CREATE TABLE t1 (a INT KEY, b TEXT) ROW_FORMAT=REDUNDANT ENGINE=innodb; CREATE TABLE t2 (a INT KEY, b TEXT) ROW_FORMAT=COMPACT ENGINE=innodb; CREATE TABLE t3 (a INT KEY, b TEXT) ROW_FORMAT=COMPRESSED ENGINE=innodb; @@ -65,12 +45,6 @@ test/t1 Single DEFAULT 0 Compact or Redundant MYSQLD_DATADIR/test/t1.ibd test/t2 Single DEFAULT 0 Compact or Redundant MYSQLD_DATADIR/test/t2.ibd test/t3 Single DEFAULT 4096 Compressed MYSQLD_DATADIR/test/t3.ibd test/t4 Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/t4.ibd -=== information_schema.files === -Space_Name File_Type Engine Status Tablespace_Name Path -test/t1 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t1.ibd -test/t2 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t2.ibd -test/t3 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t3.ibd -test/t4 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t4.ibd DROP TABLE t1, t2, t3, t4; # Test 4) The maximum row size is dependent upon the page size. # Redundant: 4027, Compact: 4030. @@ -169,39 +143,40 @@ ERROR 42000: Specified key was too long; max key length is 1536 bytes # strict mode and converted to 8 in non-strict mode. SET SESSION innodb_strict_mode = ON; CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16; -ERROR HY000: Table storage engine for 't1' doesn't have this option +ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options") SHOW WARNINGS; Level Code Message Warning 1478 InnoDB: KEY_BLOCK_SIZE=16 cannot be larger than 8. -Error 1031 Table storage engine for 't1' doesn't have this option +Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options") +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; SHOW WARNINGS; Level Code Message SELECT table_name, row_format, create_options FROM information_schema.tables WHERE table_name = 't1'; table_name row_format create_options -t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=8 +t1 Compressed row_format=COMPRESSED key_block_size=8 ALTER TABLE t1 KEY_BLOCK_SIZE=4; SHOW WARNINGS; Level Code Message SELECT table_name, row_format, create_options FROM information_schema.tables WHERE table_name = 't1'; table_name row_format create_options -t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=4 +t1 Compressed row_format=COMPRESSED key_block_size=4 ALTER TABLE t1 KEY_BLOCK_SIZE=2; SHOW WARNINGS; Level Code Message SELECT table_name, row_format, create_options FROM information_schema.tables WHERE table_name = 't1'; table_name row_format create_options -t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=2 +t1 Compressed row_format=COMPRESSED key_block_size=2 ALTER TABLE t1 KEY_BLOCK_SIZE=1; SHOW WARNINGS; Level Code Message SELECT table_name, row_format, create_options FROM information_schema.tables WHERE table_name = 't1'; table_name row_format create_options -t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=1 +t1 Compressed row_format=COMPRESSED key_block_size=1 ALTER TABLE t1 KEY_BLOCK_SIZE=0; SHOW WARNINGS; Level Code Message @@ -220,7 +195,7 @@ Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16. SELECT table_name, row_format, create_options FROM information_schema.tables WHERE table_name = 't1'; table_name row_format create_options -t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=16 +t1 Compressed row_format=COMPRESSED key_block_size=16 DROP TABLE t1; CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; SHOW WARNINGS; @@ -228,7 +203,7 @@ Level Code Message SELECT table_name, row_format, create_options FROM information_schema.tables WHERE table_name = 't1'; table_name row_format create_options -t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=8 +t1 Compressed row_format=COMPRESSED key_block_size=8 DROP TABLE t1; CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; SHOW WARNINGS; @@ -236,21 +211,21 @@ Level Code Message SELECT table_name, row_format, create_options FROM information_schema.tables WHERE table_name = 't1'; table_name row_format create_options -t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=4 +t1 Compressed row_format=COMPRESSED key_block_size=4 ALTER TABLE t1 KEY_BLOCK_SIZE=2; SHOW WARNINGS; Level Code Message SELECT table_name, row_format, create_options FROM information_schema.tables WHERE table_name = 't1'; table_name row_format create_options -t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=2 +t1 Compressed row_format=COMPRESSED key_block_size=2 ALTER TABLE t1 KEY_BLOCK_SIZE=1; SHOW WARNINGS; Level Code Message SELECT table_name, row_format, create_options FROM information_schema.tables WHERE table_name = 't1'; table_name row_format create_options -t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=1 +t1 Compressed row_format=COMPRESSED key_block_size=1 ALTER TABLE t1 KEY_BLOCK_SIZE=0; SHOW WARNINGS; Level Code Message @@ -267,35 +242,39 @@ SHOW VARIABLES LIKE 'innodb_file_per_table'; Variable_name Value innodb_file_per_table OFF CREATE TABLE t4 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=8; -ERROR HY000: Table storage engine for 't4' doesn't have this option +ERROR HY000: Can't create table `test`.`t4` (errno: 140 "Wrong create options") SHOW WARNINGS; Level Code Message Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Error 1031 Table storage engine for 't4' doesn't have this option +Error 1005 Can't create table `test`.`t4` (errno: 140 "Wrong create options") +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB CREATE TABLE t5 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=16; -ERROR HY000: Table storage engine for 't5' doesn't have this option +ERROR HY000: Can't create table `test`.`t5` (errno: 140 "Wrong create options") SHOW WARNINGS; Level Code Message Warning 1478 InnoDB: KEY_BLOCK_SIZE=16 cannot be larger than 8. Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Error 1031 Table storage engine for 't5' doesn't have this option +Error 1005 Can't create table `test`.`t5` (errno: 140 "Wrong create options") +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_file_format = `Antelope`; Warnings: Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html CREATE TABLE t4 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=8; -ERROR HY000: Table storage engine for 't4' doesn't have this option +ERROR HY000: Can't create table `test`.`t4` (errno: 140 "Wrong create options") SHOW WARNINGS; Level Code Message Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Error 1031 Table storage engine for 't4' doesn't have this option +Error 1005 Can't create table `test`.`t4` (errno: 140 "Wrong create options") +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB CREATE TABLE t5 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=16; -ERROR HY000: Table storage engine for 't5' doesn't have this option +ERROR HY000: Can't create table `test`.`t5` (errno: 140 "Wrong create options") SHOW WARNINGS; Level Code Message Warning 1478 InnoDB: KEY_BLOCK_SIZE=16 cannot be larger than 8. Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Error 1031 Table storage engine for 't5' doesn't have this option +Error 1005 Can't create table `test`.`t5` (errno: 140 "Wrong create options") +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB SET GLOBAL innodb_file_format = `Barracuda`; Warnings: Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html @@ -320,7 +299,7 @@ k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c; CREATE INDEX t1c ON t1 (c(767)); UPDATE t1 SET a=@d,b=@d,c=@d,d=@d,e=@d,f=@d,g=@d,h=@d,i=@d,j=@d, k=@d,l=@d,m=@d,n=@d,o=@d,p=@d,q=@d,r=@d,s=@d,t=@d,u=@d; -ERROR HY000: Undo log record is too big. +ERROR HY000: Undo log record is too big BEGIN; UPDATE t1 SET a=@d,b=@d,c=@d,d=@d,e=@d; UPDATE t1 SET f=@d,g=@d,h=@d,i=@d,j=@d,k=@d,l=@d,m=@d, @@ -341,31 +320,31 @@ UPDATE t1 SET i=@e; CREATE INDEX t1k ON t1 (j(767)); CREATE INDEX t1j ON t1 (j(500)); UPDATE t1 SET j=@e; -ERROR HY000: Undo log record is too big. +ERROR HY000: Undo log record is too big SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` blob, - `b` blob, - `c` blob, - `d` blob, - `e` blob, - `f` blob, - `g` blob, - `h` blob, - `i` blob, - `j` blob, - `k` blob, - `l` blob, - `m` blob, - `n` blob, - `o` blob, - `p` blob, - `q` blob, - `r` blob, - `s` blob, - `t` blob, - `u` blob, + `a` blob DEFAULT NULL, + `b` blob DEFAULT NULL, + `c` blob DEFAULT NULL, + `d` blob DEFAULT NULL, + `e` blob DEFAULT NULL, + `f` blob DEFAULT NULL, + `g` blob DEFAULT NULL, + `h` blob DEFAULT NULL, + `i` blob DEFAULT NULL, + `j` blob DEFAULT NULL, + `k` blob DEFAULT NULL, + `l` blob DEFAULT NULL, + `m` blob DEFAULT NULL, + `n` blob DEFAULT NULL, + `o` blob DEFAULT NULL, + `p` blob DEFAULT NULL, + `q` blob DEFAULT NULL, + `r` blob DEFAULT NULL, + `s` blob DEFAULT NULL, + `t` blob DEFAULT NULL, + `u` blob DEFAULT NULL, KEY `t1a` (`a`(767)), KEY `t1b` (`b`(767)), KEY `t1c` (`c`(767)), diff --git a/mysql-test/suite/innodb_zip/r/index_large_prefix.result b/mysql-test/suite/innodb_zip/r/index_large_prefix.result index 9d1c364cc22..f7591462803 100644 --- a/mysql-test/suite/innodb_zip/r/index_large_prefix.result +++ b/mysql-test/suite/innodb_zip/r/index_large_prefix.result @@ -217,10 +217,10 @@ Level Code Message Warning 1071 Specified key was too long; max key length is 3072 bytes create index idx3 on worklog5743_8(a2(3072)); Warnings: -Note 1831 Duplicate index 'idx3' defined on the table 'test.worklog5743_8'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `idx3`. This is deprecated and will be disallowed in a future release show warnings; Level Code Message -Note 1831 Duplicate index 'idx3' defined on the table 'test.worklog5743_8'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `idx3`. This is deprecated and will be disallowed in a future release create index idx4 on worklog5743_8(a1, a2(3069)); ERROR 42000: Specified key was too long; max key length is 3072 bytes show warnings; @@ -257,10 +257,10 @@ Level Code Message Warning 1071 Specified key was too long; max key length is 3072 bytes create index idx3 on worklog5743_16(a2(3072)); Warnings: -Note 1831 Duplicate index 'idx3' defined on the table 'test.worklog5743_16'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `idx3`. This is deprecated and will be disallowed in a future release show warnings; Level Code Message -Note 1831 Duplicate index 'idx3' defined on the table 'test.worklog5743_16'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `idx3`. This is deprecated and will be disallowed in a future release create index idx4 on worklog5743_16(a1, a2(3069)); ERROR 42000: Specified key was too long; max key length is 3072 bytes show warnings; @@ -511,7 +511,7 @@ Warnings: Warning 1071 Specified key was too long; max key length is 3072 bytes create index idx2 on worklog5743(a(3072)); Warnings: -Note 1831 Duplicate index 'idx2' defined on the table 'test.worklog5743'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `idx2`. This is deprecated and will be disallowed in a future release show create table worklog5743; Table Create Table worklog5743 CREATE TABLE `worklog5743` ( diff --git a/mysql-test/suite/innodb_zip/r/innodb_index_large_prefix.result b/mysql-test/suite/innodb_zip/r/innodb_index_large_prefix.result index c4daf87a15b..d44c7e33fe3 100644 --- a/mysql-test/suite/innodb_zip/r/innodb_index_large_prefix.result +++ b/mysql-test/suite/innodb_zip/r/innodb_index_large_prefix.result @@ -224,10 +224,10 @@ Level Code Message Warning 1071 Specified key was too long; max key length is 3072 bytes create index idx3 on worklog5743_8(a2(3072)); Warnings: -Note 1831 Duplicate index 'idx3' defined on the table 'test.worklog5743_8'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `idx3`. This is deprecated and will be disallowed in a future release show warnings; Level Code Message -Note 1831 Duplicate index 'idx3' defined on the table 'test.worklog5743_8'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `idx3`. This is deprecated and will be disallowed in a future release create index idx4 on worklog5743_8(a1, a2(3069)); ERROR 42000: Specified key was too long; max key length is 3072 bytes show warnings; @@ -264,10 +264,10 @@ Level Code Message Warning 1071 Specified key was too long; max key length is 3072 bytes create index idx3 on worklog5743_16(a2(3072)); Warnings: -Note 1831 Duplicate index 'idx3' defined on the table 'test.worklog5743_16'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `idx3`. This is deprecated and will be disallowed in a future release show warnings; Level Code Message -Note 1831 Duplicate index 'idx3' defined on the table 'test.worklog5743_16'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `idx3`. This is deprecated and will be disallowed in a future release create index idx4 on worklog5743_16(a1, a2(3069)); ERROR 42000: Specified key was too long; max key length is 3072 bytes show warnings; @@ -510,7 +510,7 @@ Warnings: Warning 1071 Specified key was too long; max key length is 3072 bytes create index idx2 on worklog5743(a(3072)); Warnings: -Note 1831 Duplicate index 'idx2' defined on the table 'test.worklog5743'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `idx2`. This is deprecated and will be disallowed in a future release show create table worklog5743; Table Create Table worklog5743 CREATE TABLE `worklog5743` ( diff --git a/mysql-test/suite/innodb_zip/r/restart.result b/mysql-test/suite/innodb_zip/r/restart.result index 5645b1ee310..4820914f760 100644 --- a/mysql-test/suite/innodb_zip/r/restart.result +++ b/mysql-test/suite/innodb_zip/r/restart.result @@ -21,7 +21,7 @@ t1_restart CREATE TABLE `t1_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=1000000027 DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT SELECT count(*) FROM t1_restart; @@ -44,7 +44,7 @@ t2_restart CREATE TABLE `t2_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=1000000027 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT SELECT count(*) FROM t2_restart; @@ -67,7 +67,7 @@ t3_restart CREATE TABLE `t3_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=1000000027 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 SELECT count(*) FROM t3_restart; @@ -90,7 +90,7 @@ t4_restart CREATE TABLE `t4_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=1000000027 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC SELECT count(*) FROM t4_restart; @@ -113,7 +113,7 @@ t5_restart CREATE TABLE `t5_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=1000000027 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SELECT count(*) FROM t5_restart; @@ -142,13 +142,13 @@ t6_restart CREATE TABLE `t6_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 -/*!50100 PARTITION BY HASH (c1) -(PARTITION p0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir/' ENGINE = InnoDB, - PARTITION p1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir/' ENGINE = InnoDB, - PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir/' ENGINE = InnoDB) */ + PARTITION BY HASH (c1) +(PARTITION p0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, + PARTITION p1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, + PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB) SELECT count(*) FROM t6_restart; count(*) 16 @@ -178,65 +178,21 @@ t7_restart CREATE TABLE `t7_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC -/*!50100 PARTITION BY RANGE (c1) + PARTITION BY RANGE (c1) SUBPARTITION BY HASH (c1) (PARTITION p0 VALUES LESS THAN (10) - (SUBPARTITION s0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir/' ENGINE = InnoDB, - SUBPARTITION s1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir/' ENGINE = InnoDB), + (SUBPARTITION s0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, + SUBPARTITION s1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB), PARTITION p1 VALUES LESS THAN MAXVALUE - (SUBPARTITION s2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir/' ENGINE = InnoDB, - SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir/' ENGINE = InnoDB)) */ + (SUBPARTITION s2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, + SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB)) SELECT count(*) FROM t7_restart; count(*) 16 # -# Create and insert records into a table that uses a general tablespace. -# -CREATE TABLESPACE s1_restart ADD DATAFILE 's1_restart.ibd'; -CREATE TABLE t8_restart(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT) -ROW_FORMAT=COMPACT ENGINE=InnoDB TABLESPACE=s1_restart; -INSERT INTO t8_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot'); -INSERT INTO t8_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); -INSERT INTO t8_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); -INSERT INTO t8_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); -INSERT INTO t8_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); -SHOW CREATE TABLE t8_restart; -Table Create Table -t8_restart CREATE TABLE `t8_restart` ( - `c1` double NOT NULL AUTO_INCREMENT, - `c2` char(10) DEFAULT NULL, - `c3` varchar(100) DEFAULT NULL, - `c4` date DEFAULT NULL, - `c5` text, - PRIMARY KEY (`c1`) -) /*!50100 TABLESPACE `s1_restart` */ ENGINE=InnoDB AUTO_INCREMENT=1000000125 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT -SELECT count(*) FROM t8_restart; -count(*) -65 -CREATE TABLE t9_restart(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT) -ROW_FORMAT=DYNAMIC ENGINE=InnoDB TABLESPACE=s1_restart; -INSERT INTO t9_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot'); -INSERT INTO t9_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); -INSERT INTO t9_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); -INSERT INTO t9_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); -INSERT INTO t9_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); -SHOW CREATE TABLE t9_restart; -Table Create Table -t9_restart CREATE TABLE `t9_restart` ( - `c1` double NOT NULL AUTO_INCREMENT, - `c2` char(10) DEFAULT NULL, - `c3` varchar(100) DEFAULT NULL, - `c4` date DEFAULT NULL, - `c5` text, - PRIMARY KEY (`c1`) -) /*!50100 TABLESPACE `s1_restart` */ ENGINE=InnoDB AUTO_INCREMENT=1000000125 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC -SELECT count(*) FROM t9_restart; -count(*) -65 -# # Show these tables in information_schema. # === information_schema.innodb_sys_tables and innodb_sys_tablespaces === @@ -253,8 +209,6 @@ test/t7_restart#p#p0#sp#s0 test/t7_restart#p#p0#sp#s0 97 8 Dynamic 0 Single test/t7_restart#p#p0#sp#s1 test/t7_restart#p#p0#sp#s1 97 8 Dynamic 0 Single test/t7_restart#p#p1#sp#s2 test/t7_restart#p#p1#sp#s2 97 8 Dynamic 0 Single test/t7_restart#p#p1#sp#s3 test/t7_restart#p#p1#sp#s3 97 8 Dynamic 0 Single -test/t8_restart s1_restart 129 8 Compact 0 General -test/t9_restart s1_restart 161 8 Dynamic 0 General === information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path test/t1_restart Single DEFAULT 0 Compact or Redundant MYSQLD_DATADIR/test/t1_restart.ibd @@ -269,22 +223,6 @@ test/t7_restart#p#p0#sp#s0 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t test/t7_restart#p#p0#sp#s1 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd test/t7_restart#p#p1#sp#s2 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd test/t7_restart#p#p1#sp#s3 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd -s1_restart General DEFAULT 0 Any MYSQLD_DATADIR/s1_restart.ibd -=== information_schema.files === -Space_Name File_Type Engine Status Tablespace_Name Path -test/t1_restart TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t1_restart.ibd -test/t2_restart TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t2_restart.ibd -test/t3_restart TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t3_restart.ibd -test/t4_restart TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t4_restart.ibd -test/t5_restart TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd -test/t6_restart#p#p0 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd -test/t6_restart#p#p1 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd -test/t6_restart#p#p2 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd -test/t7_restart#p#p0#sp#s0 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd -test/t7_restart#p#p0#sp#s1 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd -test/t7_restart#p#p1#sp#s2 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd -test/t7_restart#p#p1#sp#s3 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd -s1_restart TABLESPACE InnoDB NORMAL s1_restart MYSQLD_DATADIR/s1_restart.ibd # # Shutdown the server and list the tablespace OS files # @@ -303,13 +241,13 @@ t6_restart#p#p0.isl t6_restart#p#p1.isl t6_restart#p#p2.isl t6_restart.frm +t6_restart.par t7_restart#p#p0#sp#s0.isl t7_restart#p#p0#sp#s1.isl t7_restart#p#p1#sp#s2.isl t7_restart#p#p1#sp#s3.isl t7_restart.frm -t8_restart.frm -t9_restart.frm +t7_restart.par ---- MYSQL_TMP_DIR/alt_dir test ---- MYSQL_TMP_DIR/alt_dir/test @@ -324,7 +262,6 @@ t7_restart#p#p1#sp#s3.ibd # # Start the server and show that tables are still visible and accessible. # -# restart SHOW VARIABLES LIKE 'innodb_file_per_table'; Variable_name Value innodb_file_per_table ON @@ -335,7 +272,7 @@ t1_restart CREATE TABLE `t1_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=1000000020 DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT SHOW CREATE TABLE t2_restart; @@ -345,7 +282,7 @@ t2_restart CREATE TABLE `t2_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=1000000020 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT SHOW CREATE TABLE t3_restart; @@ -355,7 +292,7 @@ t3_restart CREATE TABLE `t3_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=1000000020 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 SHOW CREATE TABLE t4_restart; @@ -365,7 +302,7 @@ t4_restart CREATE TABLE `t4_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=1000000020 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC SHOW CREATE TABLE t5_restart; @@ -375,7 +312,7 @@ t5_restart CREATE TABLE `t5_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=1000000020 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SHOW CREATE TABLE t6_restart; @@ -385,13 +322,13 @@ t6_restart CREATE TABLE `t6_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 -/*!50100 PARTITION BY HASH (c1) + PARTITION BY HASH (c1) (PARTITION p0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, PARTITION p1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, - PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB) */ + PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB) SHOW CREATE TABLE t7_restart; Table Create Table t7_restart CREATE TABLE `t7_restart` ( @@ -399,37 +336,17 @@ t7_restart CREATE TABLE `t7_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC -/*!50100 PARTITION BY RANGE (c1) + PARTITION BY RANGE (c1) SUBPARTITION BY HASH (c1) (PARTITION p0 VALUES LESS THAN (10) (SUBPARTITION s0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, SUBPARTITION s1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB), PARTITION p1 VALUES LESS THAN MAXVALUE (SUBPARTITION s2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, - SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB)) */ -SHOW CREATE TABLE t8_restart; -Table Create Table -t8_restart CREATE TABLE `t8_restart` ( - `c1` double NOT NULL AUTO_INCREMENT, - `c2` char(10) DEFAULT NULL, - `c3` varchar(100) DEFAULT NULL, - `c4` date DEFAULT NULL, - `c5` text, - PRIMARY KEY (`c1`) -) /*!50100 TABLESPACE `s1_restart` */ ENGINE=InnoDB AUTO_INCREMENT=1000000110 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT -SHOW CREATE TABLE t9_restart; -Table Create Table -t9_restart CREATE TABLE `t9_restart` ( - `c1` double NOT NULL AUTO_INCREMENT, - `c2` char(10) DEFAULT NULL, - `c3` varchar(100) DEFAULT NULL, - `c4` date DEFAULT NULL, - `c5` text, - PRIMARY KEY (`c1`) -) /*!50100 TABLESPACE `s1_restart` */ ENGINE=InnoDB AUTO_INCREMENT=1000000110 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC + SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB)) INSERT INTO t1_restart (SELECT 0, c2, c3, c4, c5 FROM t1_restart); INSERT INTO t2_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); INSERT INTO t3_restart (SELECT 0, c2, c3, c4, c5 FROM t3_restart); @@ -437,8 +354,6 @@ INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart); INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart); INSERT INTO t6_restart (SELECT 0, c2, c3, c4, c5 FROM t6_restart); INSERT INTO t7_restart (SELECT 0, c2, c3, c4, c5 FROM t7_restart); -INSERT INTO t8_restart (SELECT 0, c2, c3, c4, c5 FROM t8_restart); -INSERT INTO t9_restart (SELECT 0, c2, c3, c4, c5 FROM t9_restart); SELECT count(*) FROM t1_restart; count(*) 32 @@ -460,12 +375,6 @@ count(*) SELECT count(*) FROM t7_restart; count(*) 32 -SELECT count(*) FROM t8_restart; -count(*) -130 -SELECT count(*) FROM t9_restart; -count(*) -130 # # Show these tables in information_schema. # @@ -483,8 +392,6 @@ test/t7_restart#p#p0#sp#s0 test/t7_restart#p#p0#sp#s0 97 8 Dynamic 0 Single test/t7_restart#p#p0#sp#s1 test/t7_restart#p#p0#sp#s1 97 8 Dynamic 0 Single test/t7_restart#p#p1#sp#s2 test/t7_restart#p#p1#sp#s2 97 8 Dynamic 0 Single test/t7_restart#p#p1#sp#s3 test/t7_restart#p#p1#sp#s3 97 8 Dynamic 0 Single -test/t8_restart s1_restart 129 8 Compact 0 General -test/t9_restart s1_restart 161 8 Dynamic 0 General === information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path test/t1_restart Single DEFAULT 0 Compact or Redundant MYSQLD_DATADIR/test/t1_restart.ibd @@ -499,28 +406,9 @@ test/t7_restart#p#p0#sp#s0 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t test/t7_restart#p#p0#sp#s1 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd test/t7_restart#p#p1#sp#s2 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd test/t7_restart#p#p1#sp#s3 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd -s1_restart General DEFAULT 0 Any MYSQLD_DATADIR/s1_restart.ibd -=== information_schema.files === -Space_Name File_Type Engine Status Tablespace_Name Path -test/t1_restart TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t1_restart.ibd -test/t2_restart TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t2_restart.ibd -test/t3_restart TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t3_restart.ibd -test/t4_restart TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t4_restart.ibd -test/t5_restart TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd -test/t6_restart#p#p0 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd -test/t6_restart#p#p1 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd -test/t6_restart#p#p2 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd -test/t7_restart#p#p0#sp#s0 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd -test/t7_restart#p#p0#sp#s1 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd -test/t7_restart#p#p1#sp#s2 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd -test/t7_restart#p#p1#sp#s3 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd -s1_restart TABLESPACE InnoDB NORMAL s1_restart MYSQLD_DATADIR/s1_restart.ibd DROP TABLE t1_restart; DROP TABLE t2_restart; DROP TABLE t3_restart; -DROP TABLE t8_restart; -DROP TABLE t9_restart; -DROP TABLESPACE s1_restart; # # Truncate the remote tablespaces. # @@ -538,17 +426,6 @@ test/t7_restart#p#p0#sp#s0 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t test/t7_restart#p#p0#sp#s1 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd test/t7_restart#p#p1#sp#s2 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd test/t7_restart#p#p1#sp#s3 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd -=== information_schema.files === -Space_Name File_Type Engine Status Tablespace_Name Path -test/t4_restart TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t4_restart.ibd -test/t5_restart TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd -test/t6_restart#p#p0 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd -test/t6_restart#p#p1 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd -test/t6_restart#p#p2 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd -test/t7_restart#p#p0#sp#s0 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd -test/t7_restart#p#p0#sp#s1 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd -test/t7_restart#p#p1#sp#s2 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd -test/t7_restart#p#p1#sp#s3 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd INSERT INTO t5_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot'); INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart); INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart); @@ -563,7 +440,7 @@ t5_restart CREATE TABLE `t5_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=1000000012 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SELECT count(*) FROM t6_restart; @@ -576,13 +453,13 @@ t6_restart CREATE TABLE `t6_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 -/*!50100 PARTITION BY HASH (c1) + PARTITION BY HASH (c1) (PARTITION p0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, PARTITION p1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, - PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB) */ + PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB) SELECT count(*) FROM t7_restart; count(*) 9 @@ -593,17 +470,17 @@ t7_restart CREATE TABLE `t7_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC -/*!50100 PARTITION BY RANGE (c1) + PARTITION BY RANGE (c1) SUBPARTITION BY HASH (c1) (PARTITION p0 VALUES LESS THAN (10) (SUBPARTITION s0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, SUBPARTITION s1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB), PARTITION p1 VALUES LESS THAN MAXVALUE (SUBPARTITION s2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, - SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB)) */ + SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB)) # # Shutdown the server and make a backup of a tablespace # @@ -618,11 +495,13 @@ t6_restart#p#p0.isl t6_restart#p#p1.isl t6_restart#p#p2.isl t6_restart.frm +t6_restart.par t7_restart#p#p0#sp#s0.isl t7_restart#p#p0#sp#s1.isl t7_restart#p#p1#sp#s2.isl t7_restart#p#p1#sp#s3.isl t7_restart.frm +t7_restart.par ---- MYSQL_TMP_DIR/alt_dir/test t5_restart.ibd t5_restart.ibd.bak @@ -636,7 +515,6 @@ t7_restart#p#p1#sp#s3.ibd # # Start the server and show the tablespaces. # -# restart SHOW VARIABLES LIKE 'innodb_file_per_table'; Variable_name Value innodb_file_per_table ON @@ -651,17 +529,6 @@ test/t7_restart#p#p0#sp#s0 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t test/t7_restart#p#p0#sp#s1 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd test/t7_restart#p#p1#sp#s2 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd test/t7_restart#p#p1#sp#s3 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd -=== information_schema.files === -Space_Name File_Type Engine Status Tablespace_Name Path -test/t4_restart TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t4_restart.ibd -test/t5_restart TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd -test/t6_restart#p#p0 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd -test/t6_restart#p#p1 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd -test/t6_restart#p#p2 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd -test/t7_restart#p#p0#sp#s0 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd -test/t7_restart#p#p0#sp#s1 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd -test/t7_restart#p#p1#sp#s2 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd -test/t7_restart#p#p1#sp#s3 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd SELECT count(*) FROM t5_restart; count(*) 8 @@ -672,7 +539,7 @@ t5_restart CREATE TABLE `t5_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=1000000009 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SELECT count(*) FROM t6_restart; @@ -685,13 +552,13 @@ t6_restart CREATE TABLE `t6_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 -/*!50100 PARTITION BY HASH (c1) + PARTITION BY HASH (c1) (PARTITION p0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, PARTITION p1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, - PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB) */ + PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB) SELECT count(*) FROM t7_restart; count(*) 9 @@ -702,24 +569,24 @@ t7_restart CREATE TABLE `t7_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC -/*!50100 PARTITION BY RANGE (c1) + PARTITION BY RANGE (c1) SUBPARTITION BY HASH (c1) (PARTITION p0 VALUES LESS THAN (10) (SUBPARTITION s0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, SUBPARTITION s1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB), PARTITION p1 VALUES LESS THAN MAXVALUE (SUBPARTITION s2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, - SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB)) */ + SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB)) # # Try to rename a tablespace to a file that already exists # RENAME TABLE t5_restart TO t55_restart; ERROR 42S01: Table 't55_restart' already exists RENAME TABLE t5_restart TO t55_restart; -ERROR HY000: Error on rename of './test/t5_restart' to './test/t55_restart' (errno: 184 - Tablespace already exists) +ERROR HY000: Error on rename of './test/t5_restart' to './test/t55_restart' (errno: 184 "Tablespace already exists") ---- MYSQL_DATA_DIR/test t4_restart.frm t4_restart.ibd @@ -729,11 +596,13 @@ t6_restart#p#p0.isl t6_restart#p#p1.isl t6_restart#p#p2.isl t6_restart.frm +t6_restart.par t7_restart#p#p0#sp#s0.isl t7_restart#p#p0#sp#s1.isl t7_restart#p#p1#sp#s2.isl t7_restart#p#p1#sp#s3.isl t7_restart.frm +t7_restart.par ---- MYSQL_TMP_DIR/alt_dir/test t5_restart.ibd t6_restart#p#p0.ibd @@ -760,17 +629,6 @@ test/t77_restart#p#p0#sp#s0 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/ test/t77_restart#p#p0#sp#s1 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s1.ibd test/t77_restart#p#p1#sp#s2 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s2.ibd test/t77_restart#p#p1#sp#s3 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s3.ibd -=== information_schema.files === -Space_Name File_Type Engine Status Tablespace_Name Path -test/t4_restart TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t4_restart.ibd -test/t55_restart TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd -test/t66_restart#p#p0 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p0.ibd -test/t66_restart#p#p1 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p1.ibd -test/t66_restart#p#p2 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p2.ibd -test/t77_restart#p#p0#sp#s0 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s0.ibd -test/t77_restart#p#p0#sp#s1 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s1.ibd -test/t77_restart#p#p1#sp#s2 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s2.ibd -test/t77_restart#p#p1#sp#s3 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s3.ibd INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart); SELECT count(*) FROM t55_restart; count(*) @@ -782,7 +640,7 @@ t55_restart CREATE TABLE `t55_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=1000000024 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' INSERT INTO t66_restart (SELECT 0, c2, c3, c4, c5 FROM t66_restart); @@ -796,13 +654,13 @@ t66_restart CREATE TABLE `t66_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 -/*!50100 PARTITION BY HASH (c1) + PARTITION BY HASH (c1) (PARTITION p0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, PARTITION p1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, - PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB) */ + PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB) INSERT INTO t77_restart (SELECT 0, c2, c3, c4, c5 FROM t77_restart); SELECT count(*) FROM t77_restart; count(*) @@ -814,17 +672,17 @@ t77_restart CREATE TABLE `t77_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC -/*!50100 PARTITION BY RANGE (c1) + PARTITION BY RANGE (c1) SUBPARTITION BY HASH (c1) (PARTITION p0 VALUES LESS THAN (10) (SUBPARTITION s0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, SUBPARTITION s1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB), PARTITION p1 VALUES LESS THAN MAXVALUE (SUBPARTITION s2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, - SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB)) */ + SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB)) ---- MYSQL_DATA_DIR/test t4_restart.frm t4_restart.ibd @@ -834,11 +692,13 @@ t66_restart#p#p0.isl t66_restart#p#p1.isl t66_restart#p#p2.isl t66_restart.frm +t66_restart.par t77_restart#p#p0#sp#s0.isl t77_restart#p#p0#sp#s1.isl t77_restart#p#p1#sp#s2.isl t77_restart#p#p1#sp#s3.isl t77_restart.frm +t77_restart.par ---- MYSQL_TMP_DIR/alt_dir/test t55_restart.ibd t66_restart#p#p0.ibd @@ -851,7 +711,6 @@ t77_restart#p#p1#sp#s3.ibd # # Restart the server # -# restart SHOW VARIABLES LIKE 'innodb_file_per_table'; Variable_name Value innodb_file_per_table ON @@ -866,17 +725,6 @@ test/t77_restart#p#p0#sp#s0 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/ test/t77_restart#p#p0#sp#s1 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s1.ibd test/t77_restart#p#p1#sp#s2 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s2.ibd test/t77_restart#p#p1#sp#s3 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s3.ibd -=== information_schema.files === -Space_Name File_Type Engine Status Tablespace_Name Path -test/t4_restart TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t4_restart.ibd -test/t55_restart TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd -test/t66_restart#p#p0 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p0.ibd -test/t66_restart#p#p1 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p1.ibd -test/t66_restart#p#p2 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p2.ibd -test/t77_restart#p#p0#sp#s0 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s0.ibd -test/t77_restart#p#p0#sp#s1 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s1.ibd -test/t77_restart#p#p1#sp#s2 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s2.ibd -test/t77_restart#p#p1#sp#s3 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s3.ibd INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart); SELECT count(*) FROM t55_restart; count(*) @@ -888,7 +736,7 @@ t55_restart CREATE TABLE `t55_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=1000000048 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' INSERT INTO t66_restart (SELECT 0, c2, c3, c4, c5 FROM t66_restart); @@ -902,13 +750,13 @@ t66_restart CREATE TABLE `t66_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=95 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 -/*!50100 PARTITION BY HASH (c1) + PARTITION BY HASH (c1) (PARTITION p0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, PARTITION p1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, - PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB) */ + PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB) INSERT INTO t77_restart (SELECT 0, c2, c3, c4, c5 FROM t77_restart); SELECT count(*) FROM t77_restart; count(*) @@ -920,17 +768,17 @@ t77_restart CREATE TABLE `t77_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC -/*!50100 PARTITION BY RANGE (c1) + PARTITION BY RANGE (c1) SUBPARTITION BY HASH (c1) (PARTITION p0 VALUES LESS THAN (10) (SUBPARTITION s0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, SUBPARTITION s1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB), PARTITION p1 VALUES LESS THAN MAXVALUE (SUBPARTITION s2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, - SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB)) */ + SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB)) # # Shutdown the server # @@ -946,11 +794,13 @@ t66_restart#p#p0.isl t66_restart#p#p1.isl t66_restart#p#p2.isl t66_restart.frm +t66_restart.par t77_restart#p#p0#sp#s0.isl t77_restart#p#p0#sp#s1.isl t77_restart#p#p1#sp#s2.isl t77_restart#p#p1#sp#s3.isl t77_restart.frm +t77_restart.par ---- MYSQL_TMP_DIR/alt_dir/test t55_restart.ibd t66_restart#p#p0.ibd @@ -974,11 +824,13 @@ t66_restart#p#p0.isl t66_restart#p#p1.isl t66_restart#p#p2.isl t66_restart.frm +t66_restart.par t77_restart#p#p0#sp#s0.isl t77_restart#p#p0#sp#s1.isl t77_restart#p#p1#sp#s2.isl t77_restart#p#p1#sp#s3.isl t77_restart.frm +t77_restart.par ---- MYSQL_TMP_DIR/alt_dir/test ---- MYSQL_TMP_DIR/new_dir/test t4_restart.ibd @@ -993,7 +845,6 @@ t77_restart#p#p1#sp#s3.ibd # # Start the server and check tablespaces. # -# restart === information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path test/t4_restart Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd @@ -1005,17 +856,6 @@ test/t77_restart#p#p0#sp#s0 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/new_dir/test/ test/t77_restart#p#p0#sp#s1 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p0#sp#s1.ibd test/t77_restart#p#p1#sp#s2 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p1#sp#s2.ibd test/t77_restart#p#p1#sp#s3 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p1#sp#s3.ibd -=== information_schema.files === -Space_Name File_Type Engine Status Tablespace_Name Path -test/t4_restart TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd -test/t55_restart TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd -test/t66_restart#p#p0 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p0.ibd -test/t66_restart#p#p1 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p1.ibd -test/t66_restart#p#p2 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p2.ibd -test/t77_restart#p#p0#sp#s0 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p0#sp#s0.ibd -test/t77_restart#p#p0#sp#s1 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p0#sp#s1.ibd -test/t77_restart#p#p1#sp#s2 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p1#sp#s2.ibd -test/t77_restart#p#p1#sp#s3 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p1#sp#s3.ibd INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart); SELECT count(*) FROM t4_restart; count(*) @@ -1027,9 +867,9 @@ t4_restart CREATE TABLE `t4_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=1000000099 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB AUTO_INCREMENT=1000000099 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/new_dir/' INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart); SELECT count(*) FROM t55_restart; count(*) @@ -1041,7 +881,7 @@ t55_restart CREATE TABLE `t55_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=1000000096 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/new_dir/' INSERT INTO t66_restart (SELECT 0, c2, c3, c4, c5 FROM t66_restart); @@ -1055,13 +895,13 @@ t66_restart CREATE TABLE `t66_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=179 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 -/*!50100 PARTITION BY HASH (c1) + PARTITION BY HASH (c1) (PARTITION p0 DATA DIRECTORY = 'MYSQL_TMP_DIR/new_dir' ENGINE = InnoDB, PARTITION p1 DATA DIRECTORY = 'MYSQL_TMP_DIR/new_dir' ENGINE = InnoDB, - PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/new_dir' ENGINE = InnoDB) */ + PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/new_dir' ENGINE = InnoDB) INSERT INTO t77_restart (SELECT 0, c2, c3, c4, c5 FROM t77_restart); SELECT count(*) FROM t77_restart; count(*) @@ -1073,17 +913,17 @@ t77_restart CREATE TABLE `t77_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=73 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC -/*!50100 PARTITION BY RANGE (c1) + PARTITION BY RANGE (c1) SUBPARTITION BY HASH (c1) (PARTITION p0 VALUES LESS THAN (10) (SUBPARTITION s0 DATA DIRECTORY = 'MYSQL_TMP_DIR/new_dir' ENGINE = InnoDB, SUBPARTITION s1 DATA DIRECTORY = 'MYSQL_TMP_DIR/new_dir' ENGINE = InnoDB), PARTITION p1 VALUES LESS THAN MAXVALUE (SUBPARTITION s2 DATA DIRECTORY = 'MYSQL_TMP_DIR/new_dir' ENGINE = InnoDB, - SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/new_dir' ENGINE = InnoDB)) */ + SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/new_dir' ENGINE = InnoDB)) # # Shutdown the server # @@ -1099,11 +939,13 @@ t66_restart#p#p0.isl t66_restart#p#p1.isl t66_restart#p#p2.isl t66_restart.frm +t66_restart.par t77_restart#p#p0#sp#s0.isl t77_restart#p#p0#sp#s1.isl t77_restart#p#p1#sp#s2.isl t77_restart#p#p1#sp#s3.isl t77_restart.frm +t77_restart.par ---- MYSQL_TMP_DIR/new_dir/test t4_restart.ibd t55_restart.ibd @@ -1127,16 +969,17 @@ t66_restart#p#p0.ibd t66_restart#p#p1.ibd t66_restart#p#p2.ibd t66_restart.frm +t66_restart.par t77_restart#p#p0#sp#s0.ibd t77_restart#p#p0#sp#s1.ibd t77_restart#p#p1#sp#s2.ibd t77_restart#p#p1#sp#s3.ibd t77_restart.frm +t77_restart.par ---- MYSQL_TMP_DIR/new_dir/test # # Start the server and check tablespaces. # -# restart === information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path test/t4_restart Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/t4_restart.ibd @@ -1148,17 +991,6 @@ test/t77_restart#p#p0#sp#s0 Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/t77_res test/t77_restart#p#p0#sp#s1 Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/t77_restart#p#p0#sp#s1.ibd test/t77_restart#p#p1#sp#s2 Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/t77_restart#p#p1#sp#s2.ibd test/t77_restart#p#p1#sp#s3 Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/t77_restart#p#p1#sp#s3.ibd -=== information_schema.files === -Space_Name File_Type Engine Status Tablespace_Name Path -test/t4_restart TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t4_restart.ibd -test/t55_restart TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t55_restart.ibd -test/t66_restart#p#p0 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t66_restart#p#p0.ibd -test/t66_restart#p#p1 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t66_restart#p#p1.ibd -test/t66_restart#p#p2 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t66_restart#p#p2.ibd -test/t77_restart#p#p0#sp#s0 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t77_restart#p#p0#sp#s0.ibd -test/t77_restart#p#p0#sp#s1 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t77_restart#p#p0#sp#s1.ibd -test/t77_restart#p#p1#sp#s2 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t77_restart#p#p1#sp#s2.ibd -test/t77_restart#p#p1#sp#s3 TABLESPACE InnoDB NORMAL innodb_file_per_table.## MYSQLD_DATADIR/test/t77_restart#p#p1#sp#s3.ibd INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart); SELECT count(*) FROM t4_restart; count(*) @@ -1170,7 +1002,7 @@ t4_restart CREATE TABLE `t4_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=1000000195 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart); @@ -1184,7 +1016,7 @@ t55_restart CREATE TABLE `t55_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=1000000192 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC INSERT INTO t66_restart (SELECT 0, c2, c3, c4, c5 FROM t66_restart); @@ -1198,13 +1030,13 @@ t66_restart CREATE TABLE `t66_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=347 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 -/*!50100 PARTITION BY HASH (c1) + PARTITION BY HASH (c1) (PARTITION p0 ENGINE = InnoDB, PARTITION p1 ENGINE = InnoDB, - PARTITION p2 ENGINE = InnoDB) */ + PARTITION p2 ENGINE = InnoDB) INSERT INTO t77_restart (SELECT 0, c2, c3, c4, c5 FROM t77_restart); SELECT count(*) FROM t77_restart; count(*) @@ -1216,17 +1048,17 @@ t77_restart CREATE TABLE `t77_restart` ( `c2` char(10) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL, `c4` date DEFAULT NULL, - `c5` text, + `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=145 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC -/*!50100 PARTITION BY RANGE (c1) + PARTITION BY RANGE (c1) SUBPARTITION BY HASH (c1) (PARTITION p0 VALUES LESS THAN (10) (SUBPARTITION s0 ENGINE = InnoDB, SUBPARTITION s1 ENGINE = InnoDB), PARTITION p1 VALUES LESS THAN MAXVALUE (SUBPARTITION s2 ENGINE = InnoDB, - SUBPARTITION s3 ENGINE = InnoDB)) */ + SUBPARTITION s3 ENGINE = InnoDB)) # # Cleanup # diff --git a/mysql-test/suite/innodb_zip/t/4k-master.opt b/mysql-test/suite/innodb_zip/t/4k-master.opt new file mode 100644 index 00000000000..82f574a8039 --- /dev/null +++ b/mysql-test/suite/innodb_zip/t/4k-master.opt @@ -0,0 +1,3 @@ +--loose-innodb-sys-indexes +--loose-innodb-sys-tablespaces +--loose-innodb-sys-datafiles diff --git a/mysql-test/suite/innodb_zip/t/4k.test b/mysql-test/suite/innodb_zip/t/4k.test index 6226c4abcee..cdbed557e1d 100644 --- a/mysql-test/suite/innodb_zip/t/4k.test +++ b/mysql-test/suite/innodb_zip/t/4k.test @@ -169,11 +169,11 @@ CREATE TABLE t1 (a varchar(64) character set utf8, SET SESSION innodb_strict_mode = ON; ---error ER_ILLEGAL_HA +--error ER_CANT_CREATE_TABLE CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16; SHOW WARNINGS; ---error ER_ILLEGAL_HA +--error ER_CANT_CREATE_TABLE CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; SHOW WARNINGS; @@ -240,18 +240,18 @@ DROP TABLE t1; SET SESSION innodb_strict_mode = ON; SET GLOBAL innodb_file_per_table = OFF; SHOW VARIABLES LIKE 'innodb_file_per_table'; ---error ER_ILLEGAL_HA +--error ER_CANT_CREATE_TABLE CREATE TABLE t4 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=8; SHOW WARNINGS; ---error ER_ILLEGAL_HA +--error ER_CANT_CREATE_TABLE CREATE TABLE t5 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=16; SHOW WARNINGS; SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_file_format = `Antelope`; ---error ER_ILLEGAL_HA +--error ER_CANT_CREATE_TABLE CREATE TABLE t4 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=8; SHOW WARNINGS; ---error ER_ILLEGAL_HA +--error ER_CANT_CREATE_TABLE CREATE TABLE t5 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=16; SHOW WARNINGS; SET GLOBAL innodb_file_format = `Barracuda`; diff --git a/mysql-test/suite/innodb_zip/t/8k-master.opt b/mysql-test/suite/innodb_zip/t/8k-master.opt new file mode 100644 index 00000000000..82f574a8039 --- /dev/null +++ b/mysql-test/suite/innodb_zip/t/8k-master.opt @@ -0,0 +1,3 @@ +--loose-innodb-sys-indexes +--loose-innodb-sys-tablespaces +--loose-innodb-sys-datafiles diff --git a/mysql-test/suite/innodb_zip/t/8k.test b/mysql-test/suite/innodb_zip/t/8k.test index 3a2e8755f57..fb440099c85 100644 --- a/mysql-test/suite/innodb_zip/t/8k.test +++ b/mysql-test/suite/innodb_zip/t/8k.test @@ -185,7 +185,7 @@ CREATE TABLE t1 (a varchar(128) character set utf8, SET SESSION innodb_strict_mode = ON; ---error ER_ILLEGAL_HA +--error ER_CANT_CREATE_TABLE CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16; SHOW WARNINGS; @@ -257,18 +257,18 @@ DROP TABLE t1; SET SESSION innodb_strict_mode = ON; SET GLOBAL innodb_file_per_table = OFF; SHOW VARIABLES LIKE 'innodb_file_per_table'; ---error ER_ILLEGAL_HA +--error ER_CANT_CREATE_TABLE CREATE TABLE t4 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=8; SHOW WARNINGS; ---error ER_ILLEGAL_HA +--error ER_CANT_CREATE_TABLE CREATE TABLE t5 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=16; SHOW WARNINGS; SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_file_format = `Antelope`; ---error ER_ILLEGAL_HA +--error ER_CANT_CREATE_TABLE CREATE TABLE t4 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=8; SHOW WARNINGS; ---error ER_ILLEGAL_HA +--error ER_CANT_CREATE_TABLE CREATE TABLE t5 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=16; SHOW WARNINGS; SET GLOBAL innodb_file_format = `Barracuda`; diff --git a/mysql-test/suite/innodb_zip/t/disabled.def b/mysql-test/suite/innodb_zip/t/disabled.def index b97bc405f21..02adb097c9d 100644 --- a/mysql-test/suite/innodb_zip/t/disabled.def +++ b/mysql-test/suite/innodb_zip/t/disabled.def @@ -10,7 +10,5 @@ # ############################################################################## -restart : Not supported by MariaDB 10.2 2/9/2016 jplindst -wl6650 : Not supported by MariaDB 10.2 wl6560 : Very long, timeout diff --git a/mysql-test/suite/innodb_zip/t/restart.opt b/mysql-test/suite/innodb_zip/t/restart.opt new file mode 100644 index 00000000000..52314cbf241 --- /dev/null +++ b/mysql-test/suite/innodb_zip/t/restart.opt @@ -0,0 +1,3 @@ +--loose-innodb-sys-tables +--loose-innodb-sys-tablespaces +--loose-innodb-sys-datafiles diff --git a/mysql-test/suite/innodb_zip/t/restart.test b/mysql-test/suite/innodb_zip/t/restart.test index 354e63a69f7..a2dacdb4a05 100644 --- a/mysql-test/suite/innodb_zip/t/restart.test +++ b/mysql-test/suite/innodb_zip/t/restart.test @@ -152,29 +152,6 @@ INSERT INTO t7_restart (SELECT 0, c2, c3, c4, c5 FROM t7_restart); SHOW CREATE TABLE t7_restart; SELECT count(*) FROM t7_restart; ---echo # ---echo # Create and insert records into a table that uses a general tablespace. ---echo # -CREATE TABLESPACE s1_restart ADD DATAFILE 's1_restart.ibd'; -CREATE TABLE t8_restart(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT) - ROW_FORMAT=COMPACT ENGINE=InnoDB TABLESPACE=s1_restart; -INSERT INTO t8_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot'); -INSERT INTO t8_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); -INSERT INTO t8_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); -INSERT INTO t8_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); -INSERT INTO t8_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); -SHOW CREATE TABLE t8_restart; -SELECT count(*) FROM t8_restart; -CREATE TABLE t9_restart(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT) - ROW_FORMAT=DYNAMIC ENGINE=InnoDB TABLESPACE=s1_restart; -INSERT INTO t9_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot'); -INSERT INTO t9_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); -INSERT INTO t9_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); -INSERT INTO t9_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); -INSERT INTO t9_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); -SHOW CREATE TABLE t9_restart; -SELECT count(*) FROM t9_restart; - --echo # --echo # Show these tables in information_schema. --echo # @@ -211,8 +188,6 @@ SHOW CREATE TABLE t5_restart; SHOW CREATE TABLE t6_restart; --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR SHOW CREATE TABLE t7_restart; -SHOW CREATE TABLE t8_restart; -SHOW CREATE TABLE t9_restart; INSERT INTO t1_restart (SELECT 0, c2, c3, c4, c5 FROM t1_restart); INSERT INTO t2_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); @@ -221,8 +196,6 @@ INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart); INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart); INSERT INTO t6_restart (SELECT 0, c2, c3, c4, c5 FROM t6_restart); INSERT INTO t7_restart (SELECT 0, c2, c3, c4, c5 FROM t7_restart); -INSERT INTO t8_restart (SELECT 0, c2, c3, c4, c5 FROM t8_restart); -INSERT INTO t9_restart (SELECT 0, c2, c3, c4, c5 FROM t9_restart); SELECT count(*) FROM t1_restart; SELECT count(*) FROM t2_restart; @@ -231,8 +204,6 @@ SELECT count(*) FROM t4_restart; SELECT count(*) FROM t5_restart; SELECT count(*) FROM t6_restart; SELECT count(*) FROM t7_restart; -SELECT count(*) FROM t8_restart; -SELECT count(*) FROM t9_restart; --echo # --echo # Show these tables in information_schema. @@ -247,9 +218,6 @@ DROP TABLE t3_restart; # and an ISL file will be created not using InnoDB. # Table t5_restart will be expanded. # Tables t6_restart and t7_restart will be truncated. -DROP TABLE t8_restart; -DROP TABLE t9_restart; -DROP TABLESPACE s1_restart; --echo # --echo # Truncate the remote tablespaces. diff --git a/mysql-test/suite/maria/collations.result b/mysql-test/suite/maria/collations.result new file mode 100644 index 00000000000..86f7117c378 --- /dev/null +++ b/mysql-test/suite/maria/collations.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_croatian_ci, KEY(a)) ENGINE=ARIA; +INSERT INTO t1 VALUES ('na'),('nj'),('nz'),('Z'); +explain SELECT a FROM t1 ORDER BY a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a 33 NULL 4 Using index +SELECT a FROM t1 ORDER BY a; +a +na +nz +nj +Z +ALTER TABLE t1 engine=myisam; +explain SELECT a FROM t1 ORDER BY a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a 33 NULL 4 Using index +SELECT a FROM t1 ORDER BY a; +a +na +nz +nj +Z +drop table t1; diff --git a/mysql-test/suite/maria/collations.test b/mysql-test/suite/maria/collations.test new file mode 100644 index 00000000000..fe93e1913a7 --- /dev/null +++ b/mysql-test/suite/maria/collations.test @@ -0,0 +1,14 @@ +# +# Test 2-byte collations +# + +DROP TABLE IF EXISTS t1; + +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_croatian_ci, KEY(a)) ENGINE=ARIA; +INSERT INTO t1 VALUES ('na'),('nj'),('nz'),('Z'); +explain SELECT a FROM t1 ORDER BY a; +SELECT a FROM t1 ORDER BY a; +ALTER TABLE t1 engine=myisam; +explain SELECT a FROM t1 ORDER BY a; +SELECT a FROM t1 ORDER BY a; +drop table t1; diff --git a/mysql-test/suite/maria/icp.result b/mysql-test/suite/maria/icp.result index 82c47a23e93..64ae4f5e057 100644 --- a/mysql-test/suite/maria/icp.result +++ b/mysql-test/suite/maria/icp.result @@ -722,8 +722,8 @@ b INT, c INT, d DATE NOT NULL, e VARCHAR(1), KEY (c), KEY (d), KEY k2(b), KEY k3(b), KEY k4(b) ); Warnings: -Note 1831 Duplicate index 'k3' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'k4' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `k3`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `k4`. This is deprecated and will be disallowed in a future release INSERT INTO t1 (b,c,d,e) VALUES (6,5,'2006-05-25','y'),(1,5,'2008-01-23','t'), (6,5,'2007-06-18','d'),(4,5,'1900-01-01','r'), diff --git a/mysql-test/suite/maria/maria.result b/mysql-test/suite/maria/maria.result index 01323be90a6..cebb7e034b9 100644 --- a/mysql-test/suite/maria/maria.result +++ b/mysql-test/suite/maria/maria.result @@ -1146,7 +1146,7 @@ alter table t1 add unique(v); ERROR 23000: Duplicate entry '{ ' for key 'v_2' alter table t1 add key(v); Warnings: -Note 1831 Duplicate index 'v_2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `v_2`. This is deprecated and will be disallowed in a future release select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a'; qq *a*a*a* @@ -2725,8 +2725,8 @@ SET aria_repair_threads=2; SET aria_sort_buffer_size=8192; CREATE TABLE t1(a CHAR(255), KEY(a), KEY(a), KEY(a)); Warnings: -Note 1831 Duplicate index 'a_2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a_3' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a_2`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a_3`. This is deprecated and will be disallowed in a future release INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(0),(1),(2),(3); REPAIR TABLE t1; Table Op Msg_type Msg_text diff --git a/mysql-test/suite/multi_source/gtid.test b/mysql-test/suite/multi_source/gtid.test index bebee66068f..c81ca20a254 100644 --- a/mysql-test/suite/multi_source/gtid.test +++ b/mysql-test/suite/multi_source/gtid.test @@ -150,22 +150,22 @@ SET GLOBAL gtid_domain_id=0; --source include/wait_condition.inc --sorted_result STOP ALL SLAVES; ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect slave1 --connection slave2 SET GLOBAL gtid_domain_id=0; --sorted_result STOP ALL SLAVES; ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect slave2 --connection master1 SET GLOBAL gtid_domain_id=0; ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect master1 --connection master2 SET GLOBAL gtid_domain_id=0; ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect master2 diff --git a/mysql-test/suite/multi_source/gtid_ignore_duplicates.test b/mysql-test/suite/multi_source/gtid_ignore_duplicates.test index 4d98b5c2ee7..218d91aa7fb 100644 --- a/mysql-test/suite/multi_source/gtid_ignore_duplicates.test +++ b/mysql-test/suite/multi_source/gtid_ignore_duplicates.test @@ -431,20 +431,20 @@ SET GLOBAL gtid_ignore_duplicates= @old_ignore_duplicates; --connection server_1 DROP TABLE t1; ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect server_1 --connection server_2 DROP TABLE t1; ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect server_2 --connection server_3 DROP TABLE t1; ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect server_3 --connection server_4 DROP TABLE t1; ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect server_4 diff --git a/mysql-test/suite/multi_source/info_logs.result b/mysql-test/suite/multi_source/info_logs.result index 1e3243df07a..e177c9826a9 100644 --- a/mysql-test/suite/multi_source/info_logs.result +++ b/mysql-test/suite/multi_source/info_logs.result @@ -89,17 +89,17 @@ MASTER 2.2 # EOF # show all slaves status; -Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos - Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 relay.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 1 No conservative 0 1073741824 7 0 60.000 -MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 relay-master@00202@002e2.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No conservative 0 1073741824 7 0 60.000 +Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos + Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 relay.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 1 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 1073741824 7 0 60.000 +MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 relay-master@00202@002e2.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 1073741824 7 0 60.000 include/wait_for_slave_to_start.inc set default_master_connection = 'MASTER 2.2'; include/wait_for_slave_to_start.inc set default_master_connection = ''; show all slaves status; -Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos - Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 relay.000004 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 1 No conservative 0 1073741824 6 0 60.000 -MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 relay-master@00202@002e2.000004 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No conservative 0 1073741824 6 0 60.000 +Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos + Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 relay.000004 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 1 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 1073741824 6 0 60.000 +MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 relay-master@00202@002e2.000004 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 1073741824 6 0 60.000 # # List of files matching '*info*' pattern # after slave server restart diff --git a/mysql-test/suite/multi_source/info_logs.test b/mysql-test/suite/multi_source/info_logs.test index 2aaaf14c919..ef504e06a2f 100644 --- a/mysql-test/suite/multi_source/info_logs.test +++ b/mysql-test/suite/multi_source/info_logs.test @@ -187,14 +187,14 @@ show all slaves status; # Cleanup ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect slave --connection master1 ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect master1 --connection master2 ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect master2 diff --git a/mysql-test/suite/multi_source/load_data.test b/mysql-test/suite/multi_source/load_data.test index ca2391a9c8d..94b328d56ae 100644 --- a/mysql-test/suite/multi_source/load_data.test +++ b/mysql-test/suite/multi_source/load_data.test @@ -61,11 +61,11 @@ drop table t2; --sorted_result stop all slaves; ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect slave --connection master1 ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect master1 --connection master2 ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect master2 diff --git a/mysql-test/suite/multi_source/multisource.test b/mysql-test/suite/multi_source/multisource.test index dfeefe9a1d3..fc58fe81803 100644 --- a/mysql-test/suite/multi_source/multisource.test +++ b/mysql-test/suite/multi_source/multisource.test @@ -1,291 +1 @@ -# -# Test basic replication functionality -# in multi-source setup -# - ---source include/not_embedded.inc ---source include/have_innodb.inc ---source include/binlog_start_pos.inc ---let $rpl_server_count= 0 - ---connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3) - -# MDEV-3984: crash/read of freed memory when changing master with named connection -# This fails after adding the new master 'abc', check we do not free twice. ---error ER_RELAY_LOG_INIT -change master 'abc' to relay_log_file=''; -# This fails before adding the new master, check that we do free it. ---error ER_WRONG_ARGUMENTS -change master 'abc2' to master_host=''; - - -# Start replication from the first master - ---replace_result $SERVER_MYPORT_1 MYPORT_1 -eval change master 'master1' to -master_port=$SERVER_MYPORT_1, -master_host='127.0.0.1', -master_user='root'; - -start slave 'master1'; -set default_master_connection = 'master1'; ---source include/wait_for_slave_to_start.inc - ---connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1) ---save_master_pos - ---connection slave ---sync_with_master 0,'master1' - -# Here and further: add an extra check on SQL thread status -# as the normal sync is not always enough ---source wait_for_sql_thread_read_all.inc - -# each of the 3 commands should produce -# 'master1' status - -let $wait_for_all= 1; -let $show_statement= SHOW ALL SLAVES STATUS; -let $field= Slave_IO_State; -let $condition= = 'Waiting for master to send event'; ---source include/wait_show_condition.inc - ---echo # ---echo # Checking SHOW SLAVE 'master1' STATUS ---echo # ---let $status_items= Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno ---let $slave_field_result_replace= /$SERVER_MYPORT_1/MYPORT_1/ ---let $slave_name= 'master1' ---source include/show_slave_status.inc ---let $slave_name= - ---echo # ---echo # Checking SHOW SLAVE STATUS ---echo # ---source include/show_slave_status.inc - ---echo # ---echo # Checking SHOW ALL SLAVES STATUS ---echo # ---let $all_slaves_status= 1 ---let $status_items= Connection_name, Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno, Slave_heartbeat_period ---source include/show_slave_status.inc ---let $all_slaves_status= ---echo # - - -# Check that replication actually works - ---connection master1 - ---disable_warnings -drop database if exists db1; ---enable_warnings -create database db1; -use db1; -create table t1 (i int auto_increment, f1 varchar(16), primary key pk (i,f1)) engine=MyISAM; -insert into t1 (f1) values ('one'),('two'); ---save_master_pos - ---connection slave ---sync_with_master 0,'master1' - ---sorted_result -select * from db1.t1; - ---let $datadir = `SELECT @@datadir` - ---echo # List of relay log files in the datadir ---list_files $datadir mysqld-relay-bin-master1.* - -# Check that relay logs are recognizable - -let binlog_start=4; -let binlog_file=; -source include/show_relaylog_events.inc; -let binlog_file= mysqld-relay-bin-master1.000002; -source include/show_relaylog_events.inc; - -# Try to configure connection with the same name again, -# should get an error because the slave is running - ---replace_result $SERVER_MYPORT_2 MYPORT_2 ---error ER_SLAVE_MUST_STOP -eval change master 'master1' to -master_port=$SERVER_MYPORT_2, -master_host='127.0.0.1', -master_user='root'; - -# Try to configure using the default connection name -# (which is 'master1' at the moment), -# again, should get an error - ---replace_result $SERVER_MYPORT_2 MYPORT_2 ---error ER_SLAVE_MUST_STOP -eval change master to -master_port=$SERVER_MYPORT_2, -master_host='127.0.0.1', -master_user='root'; - -# Try to configure a connection with the same master -# using a different name, should get a conflict - ---replace_result $SERVER_MYPORT_1 MYPORT_1 ---error ER_CONNECTION_ALREADY_EXISTS -eval change master 'master2' to -master_port=$SERVER_MYPORT_1, -master_host='127.0.0.1', -master_user='root'; - - -# Set up a proper 'default' connection to master2 - -set default_master_connection = ''; - ---replace_result $SERVER_MYPORT_2 MYPORT_2 -eval change master to -master_port=$SERVER_MYPORT_2, -master_host='127.0.0.1', -master_user='root'; - -start slave; ---source include/wait_for_slave_to_start.inc - ---source wait_for_sql_thread_read_all.inc - -# See both connections in the same status output - -let $wait_for_all= 1; -let $show_statement= SHOW ALL SLAVES STATUS; -let $field= Slave_IO_State; -let $condition= = 'Waiting for master to send event'; ---source include/wait_show_condition.inc - ---echo # ---echo # Checking SHOW ALL SLAVES STATUS ---echo # ---let $all_slaves_status= 1 ---let $status_items= Connection_name, Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno, Slave_heartbeat_period ---let $slave_field_result_replace= /$SERVER_MYPORT_1/MYPORT_1/ /$SERVER_MYPORT_2/MYPORT_2/ ---source include/show_slave_status.inc ---let $all_slaves_status= ---echo # - -# Check that replication from two servers actually works - ---connection master1 - -insert into t1 (f1) values ('three'); ---save_master_pos - ---connect (master2,127.0.0.1,root,,,$SERVER_MYPORT_2) - ---disable_warnings -drop database if exists db2; ---enable_warnings -create database db2; -use db2; -create table t1 (pk int auto_increment primary key, f1 int) engine=InnoDB; -begin; -insert into t1 (f1) values (1),(2); - ---connection slave ---sync_with_master 0,'master1' - ---connection master2 ---save_master_pos - ---connection slave ---sync_with_master 0 ---sorted_result -select * from db1.t1; -select * from db2.t1; - ---connection master2 -commit; ---save_master_pos - ---connection slave ---sync_with_master 0 ---sorted_result -select * from db2.t1; - -# Flush and purge logs on one master, -# make sure slaves don't get confused - ---connection master1 -flush logs; ---source include/wait_for_binlog_checkpoint.inc ---save_master_pos ---connection slave ---sync_with_master 0, 'master1' - ---connection master1 -purge binary logs to 'master-bin.000002'; -let filesize=`select $binlog_start_pos+131`; ---replace_result $filesize filesize -show binary logs; -insert into t1 (f1) values ('four'); -create table db1.t3 (f1 int) engine=InnoDB; ---save_master_pos - ---connection slave ---sync_with_master 0,'master1' - ---source wait_for_sql_thread_read_all.inc - -let $wait_for_all= 1; -let $show_statement= SHOW ALL SLAVES STATUS; -let $field= Slave_IO_State; -let $condition= = 'Waiting for master to send event'; ---source include/wait_show_condition.inc - ---echo # ---echo # Checking SHOW ALL SLAVES STATUS ---echo # ---let $all_slaves_status= 1 ---let $status_items= Connection_name, Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno, Slave_heartbeat_period ---let $slave_field_result_replace= /$SERVER_MYPORT_1/MYPORT_1/ /$SERVER_MYPORT_2/MYPORT_2/ ---source include/show_slave_status.inc ---let $all_slaves_status= ---echo # - ---sorted_result -select * from db1.t1; - -# This should show relay log events for the default master -# (the one with the empty name) -let binlog_file=; -source include/show_relaylog_events.inc; -let binlog_file= mysqld-relay-bin.000002; -source include/show_relaylog_events.inc; - -# Make sure we don't lose control over replication connections -# after reconnecting to the slave - ---disconnect slave ---connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3) - -stop slave io_thread; -show status like 'Slave_running'; -set default_master_connection = 'master1'; -show status like 'Slave_running'; - -# Cleanup - -drop database db1; -drop database db2; - ---source reset_master_slave.inc ---disconnect slave - ---connection master1 -drop database db1; ---source reset_master_slave.inc ---disconnect master1 - ---connection master2 -drop database db2; ---source reset_master_slave.inc ---disconnect master2 - +--source extra/rpl_tests/multisource.inc diff --git a/mysql-test/suite/multi_source/relaylog_events.test b/mysql-test/suite/multi_source/relaylog_events.test index 18e92c32e8e..7e5257af837 100644 --- a/mysql-test/suite/multi_source/relaylog_events.test +++ b/mysql-test/suite/multi_source/relaylog_events.test @@ -44,10 +44,10 @@ drop table t1; --connection slave --sync_with_master 0,'master1' ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect slave --connection master1 ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect master1 diff --git a/mysql-test/suite/multi_source/reset_slave.result b/mysql-test/suite/multi_source/reset_slave.result index 926c603f701..353970ac8ff 100644 --- a/mysql-test/suite/multi_source/reset_slave.result +++ b/mysql-test/suite/multi_source/reset_slave.result @@ -13,15 +13,15 @@ insert into t1 values (1),(2); connection slave; stop slave 'master1'; show slave 'master1' status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode - 127.0.0.1 root MYPORT_1 60 master-bin.000001 mysqld-relay-bin-master1.000002 master-bin.000001 No No 0 0 None 0 No NULL No 0 0 1 No conservative +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State + 127.0.0.1 root MYPORT_1 60 master-bin.000001 mysqld-relay-bin-master1.000002 master-bin.000001 No No 0 0 None 0 No NULL No 0 0 1 No conservative 0 NULL mysqld-relay-bin-master1.000001 mysqld-relay-bin-master1.000002 mysqld-relay-bin-master1.index reset slave 'master1'; show slave 'master1' status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode - 127.0.0.1 root MYPORT_1 60 4 No No 0 0 0 None 0 No NULL No 0 0 1 No conservative +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State + 127.0.0.1 root MYPORT_1 60 4 No No 0 0 0 None 0 No NULL No 0 0 1 No conservative 0 NULL reset slave 'master1' all; show slave 'master1' status; ERROR HY000: There is no master connection 'master1' diff --git a/mysql-test/suite/multi_source/reset_slave.test b/mysql-test/suite/multi_source/reset_slave.test index f708a71d6de..63a1f9c3490 100644 --- a/mysql-test/suite/multi_source/reset_slave.test +++ b/mysql-test/suite/multi_source/reset_slave.test @@ -61,12 +61,12 @@ show slave 'master1' status; # Cleanup drop table t1; ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect slave --connection master1 drop table t1; ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect master1 diff --git a/mysql-test/suite/multi_source/simple.result b/mysql-test/suite/multi_source/simple.result index cabad76d7e6..419b9951905 100644 --- a/mysql-test/suite/multi_source/simple.result +++ b/mysql-test/suite/multi_source/simple.result @@ -18,9 +18,9 @@ connection slave; connection master2; connection slave; show all slaves status; -Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos -slave1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 mysqld-relay-bin-slave1.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 1 No conservative 0 1073741824 7 0 60.000 -slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 mysqld-relay-bin-slave2.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No conservative 0 1073741824 7 0 60.000 +Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos +slave1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 mysqld-relay-bin-slave1.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 1 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 1073741824 7 0 60.000 +slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 mysqld-relay-bin-slave2.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 1073741824 7 0 60.000 start all slaves; stop slave 'slave1'; show slave 'slave1' status; @@ -71,21 +71,24 @@ Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode conservative +SQL_Delay 0 +SQL_Remaining_Delay NULL +Slave_SQL_Running_State reset slave 'slave1'; show all slaves status; -Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos -slave1 127.0.0.1 root MYPORT_1 60 4 No No 0 0 0 None 0 No NULL No 0 0 1 No conservative 0 1073741824 7 0 60.000 -slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 mysqld-relay-bin-slave2.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No conservative 0 1073741824 7 0 60.000 +Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos +slave1 127.0.0.1 root MYPORT_1 60 4 No No 0 0 0 None 0 No NULL No 0 0 1 No conservative 0 NULL 0 1073741824 7 0 60.000 +slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 mysqld-relay-bin-slave2.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 1073741824 7 0 60.000 reset slave 'slave1' all; show all slaves status; -Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos -slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 mysqld-relay-bin-slave2.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No conservative 0 1073741824 7 0 60.000 +Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos +slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 mysqld-relay-bin-slave2.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No conservative 0 NULL Slave has read all relay log; waiting for the slave I/O thread to update it 0 1073741824 7 0 60.000 stop all slaves; Warnings: Note 1938 SLAVE 'slave2' stopped show all slaves status; -Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos -slave2 127.0.0.1 root MYPORT_2 60 master-bin.000001 mysqld-relay-bin-slave2.000002 master-bin.000001 No No 0 0 None 0 No NULL No 0 0 2 No conservative 0 1073741824 7 0 60.000 +Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos +slave2 127.0.0.1 root MYPORT_2 60 master-bin.000001 mysqld-relay-bin-slave2.000002 master-bin.000001 No No 0 0 None 0 No NULL No 0 0 2 No conservative 0 NULL 0 1073741824 7 0 60.000 stop all slaves; include/reset_master_slave.inc disconnect slave; diff --git a/mysql-test/suite/multi_source/simple.test b/mysql-test/suite/multi_source/simple.test index 8260686e927..95291c53778 100644 --- a/mysql-test/suite/multi_source/simple.test +++ b/mysql-test/suite/multi_source/simple.test @@ -75,12 +75,12 @@ stop all slaves; # clean up # ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect slave --connection master1 ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect master1 --connection master2 ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect master2 diff --git a/mysql-test/suite/multi_source/skip_counter.test b/mysql-test/suite/multi_source/skip_counter.test index 937261350a8..e53d0276a91 100644 --- a/mysql-test/suite/multi_source/skip_counter.test +++ b/mysql-test/suite/multi_source/skip_counter.test @@ -134,16 +134,16 @@ drop database db; --eval set global max_relay_log_size = $max_relay_log_size_saved --eval set global max_binlog_size = $max_binlog_size_saved ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect slave --connection master1 drop database db; ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect master1 --connection master2 drop database db; ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect master2 diff --git a/mysql-test/suite/multi_source/status_vars.test b/mysql-test/suite/multi_source/status_vars.test index d1cfda75d01..e76a403db33 100644 --- a/mysql-test/suite/multi_source/status_vars.test +++ b/mysql-test/suite/multi_source/status_vars.test @@ -127,13 +127,13 @@ show status like 'Slave_open_temp_tables'; # Cleanup ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect slave --connection master1 ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect master1 --connection master2 ---source reset_master_slave.inc +--source include/reset_master_slave.inc --disconnect master2 diff --git a/mysql-test/suite/multi_source/syntax.result b/mysql-test/suite/multi_source/syntax.result index 7059234472a..a17a61d3e7c 100644 --- a/mysql-test/suite/multi_source/syntax.result +++ b/mysql-test/suite/multi_source/syntax.result @@ -1,11 +1,11 @@ include/master-slave.inc [connection master] show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State show slave '' status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State show all slaves status; -Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos +Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos # # Check error handling # diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug45221.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug45221.result index 834cdbf1cf4..79100ca2b48 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug45221.result +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug45221.result @@ -8,7 +8,7 @@ KEY `int_key` (`int_key`), KEY `varchar_key` (`int_key`) ) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1; Warnings: -Note 1831 Duplicate index 'varchar_key' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `varchar_key`. This is deprecated and will be disallowed in a future release INSERT INTO `t2` VALUES (10,8,NULL,'2002-02-26 06:14:37'),(11,9,'2006-06-14','1900-01-01 00:00:00'),(12,9,'2002-09-12','2006-12-03 09:37:26'),(13,186,'2005-02-15','2008-05-26 12:27:10'),(14,NULL,NULL,'2004-12-14 16:37:30'),(15,2,'2008-11-04','2003-02-11 21:19:41'),(16,3,'2004-09-04','2009-10-18 02:27:49'),(17,0,'2006-06-05','2000-09-26 07:45:57'),(18,133,'1900-01-01',NULL),(19,1,'1900-01-01','2005-11-10 12:40:29'),(20,8,'1900-01-01','2009-04-25 00:00:00'),(21,5,'2005-01-13','2002-11-27 00:00:00'),(22,5,'2006-05-21','2004-01-26 20:32:32'),(23,8,'2003-09-08','2007-10-26 11:41:40'),(24,6,'2006-12-23','2005-10-07 00:00:00'),(25,51,'2006-10-15','2000-07-15 05:00:34'),(26,4,'2005-04-06','2000-04-03 16:33:32'),(27,7,'2008-04-07',NULL),(28,6,'2006-10-10','2001-04-25 01:26:12'),(29,4,'1900-01-01','2000-12-27 00:00:00'); CREATE TABLE t1 ( `pk` int(11) NOT NULL AUTO_INCREMENT, @@ -20,7 +20,7 @@ KEY `int_key` (`int_key`), KEY `varchar_key` (`int_key`) ) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1; Warnings: -Note 1831 Duplicate index 'varchar_key' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `varchar_key`. This is deprecated and will be disallowed in a future release INSERT INTO t1 VALUES (1,2,NULL,'2004-10-11 18:13:16'),(2,9,'2001-09-19',NULL),(3,3,'2004-09-12','1900-01-01 00:00:00'),(4,9,NULL,'2009-07-25 00:00:00'),(5,NULL,'2002-07-19',NULL),(6,9,'2002-12-16','2008-07-27 00:00:00'),(7,3,'2006-02-08','2002-11-13 16:37:31'),(8,8,'2006-08-28','1900-01-01 00:00:00'),(9,8,'2001-04-14','2003-12-10 00:00:00'),(10,53,'2000-01-05','2001-12-21 22:38:22'),(11,0,'2003-12-06','2008-12-13 23:16:44'),(12,5,'1900-01-01','2005-08-15 12:39:41'),(13,166,'2002-11-27',NULL),(14,3,NULL,'2006-09-11 12:06:14'),(15,0,'2003-05-27','2007-12-15 12:39:34'),(16,1,'2005-05-03','2005-08-09 00:00:00'),(17,9,'2001-04-18','2001-09-02 22:50:02'),(18,5,'2005-12-27','2005-12-16 22:58:11'),(19,6,'2004-08-20','2007-04-19 00:19:53'),(20,2,'1900-01-01','1900-01-01 00:00:00'); SELECT `pk` FROM t1 OUTR @@ -77,7 +77,7 @@ KEY `datetime_key` (`datetime_key`), KEY `varchar_key` (`int_key`) ) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1; Warnings: -Note 1831 Duplicate index 'varchar_key' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `varchar_key`. This is deprecated and will be disallowed in a future release INSERT INTO `t2` VALUES (10,7,8,NULL,'2002-02-26 06:14:37','2002-02-26 06:14:37'),(11,1,9,'2006-06-14','1900-01-01 00:00:00','1900-01-01 00:00:00'),(12,5,9,'2002-09-12','2006-12-03 09:37:26','2006-12-03 09:37:26'),(13,3,186,'2005-02-15','2008-05-26 12:27:10','2008-05-26 12:27:10'),(14,6,NULL,NULL,'2004-12-14 16:37:30','2004-12-14 16:37:30'),(15,92,2,'2008-11-04','2003-02-11 21:19:41','2003-02-11 21:19:41'),(16,7,3,'2004-09-04','2009-10-18 02:27:49','2009-10-18 02:27:49'),(17,NULL,0,'2006-06-05','2000-09-26 07:45:57','2000-09-26 07:45:57'),(18,3,133,'1900-01-01',NULL,NULL),(19,5,1,'1900-01-01','2005-11-10 12:40:29','2005-11-10 12:40:29'),(20,1,8,'1900-01-01','2009-04-25 00:00:00','2009-04-25 00:00:00'),(21,2,5,'2005-01-13','2002-11-27 00:00:00','2002-11-27 00:00:00'),(22,NULL,5,'2006-05-21','2004-01-26 20:32:32','2004-01-26 20:32:32'),(23,1,8,'2003-09-08','2007-10-26 11:41:40','2007-10-26 11:41:40'),(24,0,6,'2006-12-23','2005-10-07 00:00:00','2005-10-07 00:00:00'),(25,210,51,'2006-10-15','2000-07-15 05:00:34','2000-07-15 05:00:34'),(26,8,4,'2005-04-06','2000-04-03 16:33:32','2000-04-03 16:33:32'),(27,7,7,'2008-04-07',NULL,NULL),(28,5,6,'2006-10-10','2001-04-25 01:26:12','2001-04-25 01:26:12'),(29,NULL,4,'1900-01-01','2000-12-27 00:00:00','2000-12-27 00:00:00'); CREATE TABLE t1 ( `pk` int(11) NOT NULL AUTO_INCREMENT, @@ -92,7 +92,7 @@ KEY `datetime_key` (`datetime_key`), KEY `varchar_key` (`int_key`) ) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1; Warnings: -Note 1831 Duplicate index 'varchar_key' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `varchar_key`. This is deprecated and will be disallowed in a future release INSERT INTO t1 VALUES (1,NULL,2,NULL,'2004-10-11 18:13:16','2004-10-11 18:13:16'),(2,7,9,'2001-09-19',NULL,NULL),(3,9,3,'2004-09-12','1900-01-01 00:00:00','1900-01-01 00:00:00'),(4,7,9,NULL,'2009-07-25 00:00:00','2009-07-25 00:00:00'),(5,4,NULL,'2002-07-19',NULL,NULL),(6,2,9,'2002-12-16','2008-07-27 00:00:00','2008-07-27 00:00:00'),(7,6,3,'2006-02-08','2002-11-13 16:37:31','2002-11-13 16:37:31'),(8,8,8,'2006-08-28','1900-01-01 00:00:00','1900-01-01 00:00:00'),(9,NULL,8,'2001-04-14','2003-12-10 00:00:00','2003-12-10 00:00:00'),(10,5,53,'2000-01-05','2001-12-21 22:38:22','2001-12-21 22:38:22'),(11,NULL,0,'2003-12-06','2008-12-13 23:16:44','2008-12-13 23:16:44'),(12,6,5,'1900-01-01','2005-08-15 12:39:41','2005-08-15 12:39:41'),(13,188,166,'2002-11-27',NULL,NULL),(14,2,3,NULL,'2006-09-11 12:06:14','2006-09-11 12:06:14'),(15,1,0,'2003-05-27','2007-12-15 12:39:34','2007-12-15 12:39:34'),(16,1,1,'2005-05-03','2005-08-09 00:00:00','2005-08-09 00:00:00'),(17,0,9,'2001-04-18','2001-09-02 22:50:02','2001-09-02 22:50:02'),(18,9,5,'2005-12-27','2005-12-16 22:58:11','2005-12-16 22:58:11'),(19,NULL,6,'2004-08-20','2007-04-19 00:19:53','2007-04-19 00:19:53'),(20,4,2,'1900-01-01','1900-01-01 00:00:00','1900-01-01 00:00:00'); SELECT OUTR . `pk` AS X FROM t1 AS OUTR diff --git a/mysql-test/suite/parts/r/part_supported_sql_func_innodb.result b/mysql-test/suite/parts/r/part_supported_sql_func_innodb.result index c4eeb25d6b4..e0c16eeba74 100644 --- a/mysql-test/suite/parts/r/part_supported_sql_func_innodb.result +++ b/mysql-test/suite/parts/r/part_supported_sql_func_innodb.result @@ -620,7 +620,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (abs(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, @@ -628,7 +628,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) select * from t55 order by colint; colint col1 1 15 @@ -2317,7 +2317,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (mod(col1,10)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, @@ -2325,7 +2325,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) select * from t55 order by colint; colint col1 1 15 @@ -3667,7 +3667,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (day(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, @@ -3675,7 +3675,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) select * from t55 order by colint; colint col1 1 2006-02-05 @@ -4184,7 +4184,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofmonth(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, @@ -4192,7 +4192,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) select * from t55 order by colint; colint col1 1 2006-02-05 @@ -4701,7 +4701,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofweek(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, @@ -4709,7 +4709,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) select * from t55 order by colint; colint col1 1 2006-02-03 @@ -5230,7 +5230,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, @@ -5238,7 +5238,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) select * from t55 order by colint; colint col1 1 2006-02-03 @@ -5749,7 +5749,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (extract(month from col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, @@ -5757,7 +5757,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) select * from t55 order by colint; colint col1 1 2006-02-03 @@ -6268,7 +6268,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` time DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (hour(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, @@ -6276,7 +6276,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) select * from t55 order by colint; colint col1 1 09:09:15 @@ -6793,7 +6793,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` time(6) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (microsecond(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, @@ -6801,7 +6801,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) select * from t55 order by colint; colint col1 1 05:30:34.000037 @@ -7314,7 +7314,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` time DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (minute(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, @@ -7322,7 +7322,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) select * from t55 order by colint; colint col1 1 10:24:23 @@ -7845,7 +7845,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` time DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (second(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, @@ -7853,7 +7853,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) select * from t55 order by colint; colint col1 1 09:09:15 @@ -8376,7 +8376,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (month(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, @@ -8384,7 +8384,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) select * from t55 order by colint; colint col1 1 2006-02-03 @@ -8901,7 +8901,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (quarter(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, @@ -8909,7 +8909,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) select * from t55 order by colint; colint col1 1 2006-02-03 @@ -9424,7 +9424,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (weekday(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, @@ -9432,7 +9432,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) select * from t55 order by colint; colint col1 1 2006-02-03 @@ -9945,7 +9945,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (year(col1)-1990) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, @@ -9953,7 +9953,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) select * from t55 order by colint; colint col1 1 2006-02-03 @@ -10470,7 +10470,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (yearweek(col1)-200600) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, @@ -10478,7 +10478,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) select * from t55 order by colint; colint col1 1 2006-02-03 diff --git a/mysql-test/suite/parts/r/part_supported_sql_func_myisam.result b/mysql-test/suite/parts/r/part_supported_sql_func_myisam.result index e4bf955f16a..b211340a6ff 100644 --- a/mysql-test/suite/parts/r/part_supported_sql_func_myisam.result +++ b/mysql-test/suite/parts/r/part_supported_sql_func_myisam.result @@ -620,7 +620,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (abs(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, @@ -628,7 +628,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) select * from t55 order by colint; colint col1 1 15 @@ -2317,7 +2317,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (mod(col1,10)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, @@ -2325,7 +2325,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) select * from t55 order by colint; colint col1 1 15 @@ -3667,7 +3667,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (day(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, @@ -3675,7 +3675,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) select * from t55 order by colint; colint col1 1 2006-02-05 @@ -4184,7 +4184,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofmonth(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, @@ -4192,7 +4192,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) select * from t55 order by colint; colint col1 1 2006-02-05 @@ -4701,7 +4701,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofweek(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, @@ -4709,7 +4709,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) select * from t55 order by colint; colint col1 1 2006-02-03 @@ -5230,7 +5230,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, @@ -5238,7 +5238,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) select * from t55 order by colint; colint col1 1 2006-02-03 @@ -5749,7 +5749,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (extract(month from col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, @@ -5757,7 +5757,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) select * from t55 order by colint; colint col1 1 2006-02-03 @@ -6268,7 +6268,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` time DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (hour(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, @@ -6276,7 +6276,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) select * from t55 order by colint; colint col1 1 09:09:15 @@ -6793,7 +6793,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` time(6) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (microsecond(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, @@ -6801,7 +6801,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) select * from t55 order by colint; colint col1 1 05:30:34.000037 @@ -7314,7 +7314,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` time DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (minute(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, @@ -7322,7 +7322,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) select * from t55 order by colint; colint col1 1 10:24:23 @@ -7845,7 +7845,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` time DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (second(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, @@ -7853,7 +7853,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) select * from t55 order by colint; colint col1 1 09:09:15 @@ -8376,7 +8376,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (month(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, @@ -8384,7 +8384,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) select * from t55 order by colint; colint col1 1 2006-02-03 @@ -8901,7 +8901,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (quarter(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, @@ -8909,7 +8909,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) select * from t55 order by colint; colint col1 1 2006-02-03 @@ -9424,7 +9424,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (weekday(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, @@ -9432,7 +9432,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) select * from t55 order by colint; colint col1 1 2006-02-03 @@ -9945,7 +9945,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (year(col1)-1990) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, @@ -9953,7 +9953,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) select * from t55 order by colint; colint col1 1 2006-02-03 @@ -10470,7 +10470,7 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) + PARTITION BY LIST (colint) SUBPARTITION BY HASH (yearweek(col1)-200600) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, @@ -10478,7 +10478,7 @@ SUBPARTITIONS 5 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ + PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) select * from t55 order by colint; colint col1 1 2006-02-03 diff --git a/mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result b/mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result index c55fab0f5cc..b126d459335 100644 --- a/mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result +++ b/mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result @@ -75,8 +75,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -567,8 +567,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -1067,7 +1067,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -1075,7 +1075,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -1572,13 +1572,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -2071,13 +2071,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -2574,7 +2574,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -2587,7 +2587,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -3084,7 +3084,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -3097,7 +3097,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -3592,12 +3592,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -4089,8 +4089,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -4581,8 +4581,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -5081,7 +5081,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -5089,7 +5089,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -5586,13 +5586,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -6085,13 +6085,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -6588,7 +6588,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -6601,7 +6601,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -7098,7 +7098,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -7111,7 +7111,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -7606,12 +7606,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -8104,8 +8104,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -8612,8 +8612,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -9128,7 +9128,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -9136,7 +9136,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -9649,13 +9649,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -10164,13 +10164,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -10683,7 +10683,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -10696,7 +10696,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -11209,7 +11209,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -11222,7 +11222,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -11733,12 +11733,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -12246,8 +12246,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -12754,8 +12754,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -13270,7 +13270,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -13278,7 +13278,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -13791,13 +13791,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -14306,13 +14306,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -14825,7 +14825,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -14838,7 +14838,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -15351,7 +15351,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -15364,7 +15364,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -15875,12 +15875,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -16390,8 +16390,8 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -16883,8 +16883,8 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -17384,7 +17384,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -17392,7 +17392,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -17890,13 +17890,13 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -18390,13 +18390,13 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -18894,7 +18894,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -18907,7 +18907,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -19405,7 +19405,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -19418,7 +19418,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -19914,12 +19914,12 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -20412,8 +20412,8 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -20905,8 +20905,8 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -21406,7 +21406,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -21414,7 +21414,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -21912,13 +21912,13 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -22412,13 +22412,13 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -22916,7 +22916,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -22929,7 +22929,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -23427,7 +23427,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -23440,7 +23440,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -23936,12 +23936,12 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -24434,8 +24434,8 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -24927,8 +24927,8 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -25428,7 +25428,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -25436,7 +25436,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -25934,13 +25934,13 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -26434,13 +26434,13 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -26938,7 +26938,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -26951,7 +26951,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -27449,7 +27449,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -27462,7 +27462,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -27958,12 +27958,12 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 diff --git a/mysql-test/suite/parts/r/partition_alter1_1_2_myisam.result b/mysql-test/suite/parts/r/partition_alter1_1_2_myisam.result index 3d5548c340b..ae352a35a36 100644 --- a/mysql-test/suite/parts/r/partition_alter1_1_2_myisam.result +++ b/mysql-test/suite/parts/r/partition_alter1_1_2_myisam.result @@ -75,8 +75,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -592,8 +592,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -1123,7 +1123,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -1131,7 +1131,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -1665,13 +1665,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -2197,13 +2197,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -2737,7 +2737,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -2750,7 +2750,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -3284,7 +3284,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -3297,7 +3297,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -3829,12 +3829,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -4365,8 +4365,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -4882,8 +4882,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -5413,7 +5413,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -5421,7 +5421,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -5955,13 +5955,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -6487,13 +6487,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -7027,7 +7027,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -7040,7 +7040,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -7574,7 +7574,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -7587,7 +7587,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -8119,12 +8119,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD diff --git a/mysql-test/suite/parts/r/partition_alter1_1_innodb.result b/mysql-test/suite/parts/r/partition_alter1_1_innodb.result index 29aaa2713c1..30dd7222570 100644 --- a/mysql-test/suite/parts/r/partition_alter1_1_innodb.result +++ b/mysql-test/suite/parts/r/partition_alter1_1_innodb.result @@ -393,8 +393,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -885,8 +885,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -1385,7 +1385,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -1393,7 +1393,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -1890,13 +1890,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -2389,13 +2389,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -2894,7 +2894,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -2907,7 +2907,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -3404,7 +3404,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -3417,7 +3417,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -3912,12 +3912,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -4409,8 +4409,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -4901,8 +4901,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -5401,7 +5401,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -5409,7 +5409,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -5906,13 +5906,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -6405,13 +6405,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -6910,7 +6910,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -6923,7 +6923,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -7420,7 +7420,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -7433,7 +7433,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -7928,12 +7928,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -8426,8 +8426,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -8934,8 +8934,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -9450,7 +9450,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -9458,7 +9458,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -9971,13 +9971,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -10486,13 +10486,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -11007,7 +11007,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -11020,7 +11020,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -11533,7 +11533,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -11546,7 +11546,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -12057,12 +12057,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -12570,8 +12570,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -13078,8 +13078,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -13594,7 +13594,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -13602,7 +13602,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -14115,13 +14115,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -14630,13 +14630,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -15151,7 +15151,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -15164,7 +15164,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -15677,7 +15677,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -15690,7 +15690,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -16201,12 +16201,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 diff --git a/mysql-test/suite/parts/r/partition_alter1_1_myisam.result b/mysql-test/suite/parts/r/partition_alter1_1_myisam.result index 4f724d3c8b2..6c769bd8cd9 100644 --- a/mysql-test/suite/parts/r/partition_alter1_1_myisam.result +++ b/mysql-test/suite/parts/r/partition_alter1_1_myisam.result @@ -234,8 +234,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -751,8 +751,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -1282,7 +1282,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -1290,7 +1290,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -1824,13 +1824,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -2356,13 +2356,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -2898,7 +2898,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -2911,7 +2911,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -3445,7 +3445,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -3458,7 +3458,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -3990,12 +3990,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -4526,8 +4526,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -5043,8 +5043,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -5574,7 +5574,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -5582,7 +5582,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -6116,13 +6116,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -6648,13 +6648,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -7190,7 +7190,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -7203,7 +7203,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -7737,7 +7737,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -7750,7 +7750,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -8282,12 +8282,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD diff --git a/mysql-test/suite/parts/r/partition_alter1_2_innodb.result b/mysql-test/suite/parts/r/partition_alter1_2_innodb.result index d52a3180124..f4765293d15 100644 --- a/mysql-test/suite/parts/r/partition_alter1_2_innodb.result +++ b/mysql-test/suite/parts/r/partition_alter1_2_innodb.result @@ -73,8 +73,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -513,8 +513,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -961,7 +961,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -969,7 +969,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -1414,13 +1414,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -1861,13 +1861,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -2314,7 +2314,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -2327,7 +2327,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -2772,7 +2772,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -2785,7 +2785,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -3228,12 +3228,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -3673,8 +3673,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -4113,8 +4113,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -4561,7 +4561,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -4569,7 +4569,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -5014,13 +5014,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -5461,13 +5461,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -5914,7 +5914,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -5927,7 +5927,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -6372,7 +6372,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -6385,7 +6385,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -6828,12 +6828,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -7273,8 +7273,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -7729,8 +7729,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -8193,7 +8193,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -8201,7 +8201,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -8662,13 +8662,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -9125,13 +9125,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -9594,7 +9594,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -9607,7 +9607,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -10068,7 +10068,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -10081,7 +10081,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -10540,12 +10540,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -11005,8 +11005,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -11445,8 +11445,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -11893,7 +11893,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -11901,7 +11901,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -12346,13 +12346,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -12793,13 +12793,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -13244,7 +13244,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -13257,7 +13257,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -13702,7 +13702,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -13715,7 +13715,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -14158,12 +14158,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -14603,8 +14603,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -15043,8 +15043,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -15491,7 +15491,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -15499,7 +15499,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -15944,13 +15944,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -16391,13 +16391,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -16842,7 +16842,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -16855,7 +16855,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -17300,7 +17300,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -17313,7 +17313,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -17756,12 +17756,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -18202,8 +18202,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -18658,8 +18658,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -19122,7 +19122,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -19130,7 +19130,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -19591,13 +19591,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -20054,13 +20054,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -20521,7 +20521,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -20534,7 +20534,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -20995,7 +20995,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -21008,7 +21008,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -21467,12 +21467,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -21928,8 +21928,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -22384,8 +22384,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -22848,7 +22848,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -22856,7 +22856,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -23317,13 +23317,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -23780,13 +23780,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -24247,7 +24247,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -24260,7 +24260,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -24721,7 +24721,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -24734,7 +24734,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -25193,12 +25193,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -25655,8 +25655,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -26095,8 +26095,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -26543,7 +26543,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -26551,7 +26551,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -26996,13 +26996,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -27443,13 +27443,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -27894,7 +27894,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -27907,7 +27907,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -28352,7 +28352,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -28365,7 +28365,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -28808,12 +28808,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -29253,8 +29253,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -29693,8 +29693,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -30141,7 +30141,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -30149,7 +30149,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -30594,13 +30594,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -31041,13 +31041,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -31492,7 +31492,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -31505,7 +31505,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -31950,7 +31950,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -31963,7 +31963,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -32406,12 +32406,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -32851,8 +32851,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -33307,8 +33307,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -33771,7 +33771,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -33779,7 +33779,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -34240,13 +34240,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -34703,13 +34703,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -35170,7 +35170,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -35183,7 +35183,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -35644,7 +35644,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -35657,7 +35657,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -36116,12 +36116,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 diff --git a/mysql-test/suite/parts/r/partition_alter1_2_myisam.result b/mysql-test/suite/parts/r/partition_alter1_2_myisam.result index 6f9a2486fbe..7001cbd17d2 100644 --- a/mysql-test/suite/parts/r/partition_alter1_2_myisam.result +++ b/mysql-test/suite/parts/r/partition_alter1_2_myisam.result @@ -72,8 +72,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -537,8 +537,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -1016,7 +1016,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -1024,7 +1024,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -1506,13 +1506,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -1986,13 +1986,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -2476,7 +2476,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -2489,7 +2489,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -2971,7 +2971,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -2984,7 +2984,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -3464,12 +3464,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -3952,8 +3952,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -4417,8 +4417,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -4896,7 +4896,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -4904,7 +4904,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -5386,13 +5386,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -5866,13 +5866,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -6354,7 +6354,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -6367,7 +6367,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -6849,7 +6849,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -6862,7 +6862,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -7342,12 +7342,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -7826,8 +7826,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -8291,8 +8291,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -8770,7 +8770,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -8778,7 +8778,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -9260,13 +9260,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -9740,13 +9740,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -10228,7 +10228,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -10241,7 +10241,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -10723,7 +10723,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -10736,7 +10736,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -11216,12 +11216,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -11700,8 +11700,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -12165,8 +12165,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -12644,7 +12644,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -12652,7 +12652,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -13134,13 +13134,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -13614,13 +13614,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -14102,7 +14102,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -14115,7 +14115,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -14597,7 +14597,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -14610,7 +14610,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -15090,12 +15090,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD diff --git a/mysql-test/suite/parts/r/partition_alter2_1_1_innodb.result b/mysql-test/suite/parts/r/partition_alter2_1_1_innodb.result index 06dd78b69dc..22317d93724 100644 --- a/mysql-test/suite/parts/r/partition_alter2_1_1_innodb.result +++ b/mysql-test/suite/parts/r/partition_alter2_1_1_innodb.result @@ -74,8 +74,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -530,8 +530,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -994,7 +994,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -1002,7 +1002,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -1463,13 +1463,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -1926,13 +1926,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -2395,7 +2395,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -2408,7 +2408,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -2869,7 +2869,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -2882,7 +2882,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -3341,12 +3341,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -3804,8 +3804,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -4298,8 +4298,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -4800,7 +4800,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -4808,7 +4808,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -5307,13 +5307,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -5808,13 +5808,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -6315,7 +6315,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -6328,7 +6328,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -6827,7 +6827,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -6840,7 +6840,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -7337,12 +7337,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -7836,8 +7836,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -8330,8 +8330,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -8832,7 +8832,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -8840,7 +8840,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -9339,13 +9339,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -9840,13 +9840,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -10347,7 +10347,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -10360,7 +10360,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -10859,7 +10859,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -10872,7 +10872,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -11369,12 +11369,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -11869,8 +11869,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -12377,8 +12377,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -12893,7 +12893,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -12901,7 +12901,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -13414,13 +13414,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -13929,13 +13929,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -14450,7 +14450,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -14463,7 +14463,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -14976,7 +14976,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -14989,7 +14989,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -15500,12 +15500,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -16013,8 +16013,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -16521,8 +16521,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -17037,7 +17037,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -17045,7 +17045,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -17558,13 +17558,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -18073,13 +18073,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -18594,7 +18594,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -18607,7 +18607,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -19120,7 +19120,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -19133,7 +19133,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -19644,12 +19644,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 diff --git a/mysql-test/suite/parts/r/partition_alter2_1_2_innodb.result b/mysql-test/suite/parts/r/partition_alter2_1_2_innodb.result index 769abc32dff..680edaa7cc7 100644 --- a/mysql-test/suite/parts/r/partition_alter2_1_2_innodb.result +++ b/mysql-test/suite/parts/r/partition_alter2_1_2_innodb.result @@ -70,8 +70,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -526,8 +526,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -990,7 +990,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -998,7 +998,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -1459,13 +1459,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -1922,13 +1922,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -2389,7 +2389,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -2402,7 +2402,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -2863,7 +2863,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -2876,7 +2876,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -3335,12 +3335,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -3798,8 +3798,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -4293,8 +4293,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -4796,7 +4796,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -4804,7 +4804,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -5304,13 +5304,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -5806,13 +5806,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -6312,7 +6312,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -6325,7 +6325,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -6825,7 +6825,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -6838,7 +6838,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -7336,12 +7336,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -7836,8 +7836,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -8331,8 +8331,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -8834,7 +8834,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -8842,7 +8842,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -9342,13 +9342,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -9844,13 +9844,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -10350,7 +10350,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -10363,7 +10363,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -10863,7 +10863,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -10876,7 +10876,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -11374,12 +11374,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -11875,8 +11875,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -12383,8 +12383,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -12899,7 +12899,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -12907,7 +12907,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -13420,13 +13420,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -13935,13 +13935,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -14454,7 +14454,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -14467,7 +14467,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -14980,7 +14980,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -14993,7 +14993,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -15504,12 +15504,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -16017,8 +16017,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -16525,8 +16525,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -17041,7 +17041,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -17049,7 +17049,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -17562,13 +17562,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -18077,13 +18077,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -18596,7 +18596,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -18609,7 +18609,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -19122,7 +19122,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -19135,7 +19135,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -19646,12 +19646,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 diff --git a/mysql-test/suite/parts/r/partition_alter2_1_maria.result b/mysql-test/suite/parts/r/partition_alter2_1_maria.result index 1905c5c25ae..3ef0364c5a8 100644 --- a/mysql-test/suite/parts/r/partition_alter2_1_maria.result +++ b/mysql-test/suite/parts/r/partition_alter2_1_maria.result @@ -74,8 +74,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 unified filelist t1#P#p0.MAD @@ -539,8 +539,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 unified filelist t1#P#p0.MAD @@ -1018,7 +1018,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = Aria, PARTITION part_2 VALUES IN (-2) ENGINE = Aria, PARTITION part_1 VALUES IN (-1) ENGINE = Aria, @@ -1026,7 +1026,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = Aria, PARTITION part1 VALUES IN (1) ENGINE = Aria, PARTITION part2 VALUES IN (2) ENGINE = Aria, - PARTITION part3 VALUES IN (3) ENGINE = Aria) */ + PARTITION part3 VALUES IN (3) ENGINE = Aria) unified filelist t1#P#part0.MAD @@ -1508,13 +1508,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, PARTITION partd VALUES LESS THAN (15) ENGINE = Aria, PARTITION parte VALUES LESS THAN (20) ENGINE = Aria, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta.MAD @@ -1988,13 +1988,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta#SP#partasp0.MAD @@ -2478,7 +2478,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = Aria, @@ -2491,7 +2491,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = Aria), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = Aria, - SUBPARTITION subpart42 ENGINE = Aria)) */ + SUBPARTITION subpart42 ENGINE = Aria)) unified filelist t1#P#part1#SP#subpart11.MAD @@ -2973,7 +2973,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = Aria, @@ -2986,7 +2986,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = Aria), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = Aria, - SUBPARTITION sp42 ENGINE = Aria)) */ + SUBPARTITION sp42 ENGINE = Aria)) unified filelist t1#P#part1#SP#sp11.MAD @@ -3466,12 +3466,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = Aria, PARTITION part2 VALUES IN (1) ENGINE = Aria, - PARTITION part3 VALUES IN (NULL) ENGINE = Aria) */ + PARTITION part3 VALUES IN (NULL) ENGINE = Aria) unified filelist t1#P#part1#SP#part1sp0.MAD @@ -3952,8 +3952,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 unified filelist t1#P#p0.MAD @@ -4469,8 +4469,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 unified filelist t1#P#p0.MAD @@ -5000,7 +5000,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = Aria, PARTITION part_2 VALUES IN (-2) ENGINE = Aria, PARTITION part_1 VALUES IN (-1) ENGINE = Aria, @@ -5008,7 +5008,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = Aria, PARTITION part1 VALUES IN (1) ENGINE = Aria, PARTITION part2 VALUES IN (2) ENGINE = Aria, - PARTITION part3 VALUES IN (3) ENGINE = Aria) */ + PARTITION part3 VALUES IN (3) ENGINE = Aria) unified filelist t1#P#part0.MAD @@ -5542,13 +5542,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, PARTITION partd VALUES LESS THAN (15) ENGINE = Aria, PARTITION parte VALUES LESS THAN (20) ENGINE = Aria, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta.MAD @@ -6074,13 +6074,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta#SP#partasp0.MAD @@ -6616,7 +6616,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = Aria, @@ -6629,7 +6629,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = Aria), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = Aria, - SUBPARTITION subpart42 ENGINE = Aria)) */ + SUBPARTITION subpart42 ENGINE = Aria)) unified filelist t1#P#part1#SP#subpart11.MAD @@ -7163,7 +7163,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = Aria, @@ -7176,7 +7176,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = Aria), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = Aria, - SUBPARTITION sp42 ENGINE = Aria)) */ + SUBPARTITION sp42 ENGINE = Aria)) unified filelist t1#P#part1#SP#sp11.MAD @@ -7708,12 +7708,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = Aria, PARTITION part2 VALUES IN (1) ENGINE = Aria, - PARTITION part3 VALUES IN (NULL) ENGINE = Aria) */ + PARTITION part3 VALUES IN (NULL) ENGINE = Aria) unified filelist t1#P#part1#SP#part1sp0.MAD @@ -8244,8 +8244,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 unified filelist t1#P#p0.MAD @@ -8761,8 +8761,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 unified filelist t1#P#p0.MAD @@ -9292,7 +9292,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = Aria, PARTITION part_2 VALUES IN (-2) ENGINE = Aria, PARTITION part_1 VALUES IN (-1) ENGINE = Aria, @@ -9300,7 +9300,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = Aria, PARTITION part1 VALUES IN (1) ENGINE = Aria, PARTITION part2 VALUES IN (2) ENGINE = Aria, - PARTITION part3 VALUES IN (3) ENGINE = Aria) */ + PARTITION part3 VALUES IN (3) ENGINE = Aria) unified filelist t1#P#part0.MAD @@ -9834,13 +9834,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, PARTITION partd VALUES LESS THAN (15) ENGINE = Aria, PARTITION parte VALUES LESS THAN (20) ENGINE = Aria, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta.MAD @@ -10366,13 +10366,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta#SP#partasp0.MAD @@ -10908,7 +10908,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = Aria, @@ -10921,7 +10921,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = Aria), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = Aria, - SUBPARTITION subpart42 ENGINE = Aria)) */ + SUBPARTITION subpart42 ENGINE = Aria)) unified filelist t1#P#part1#SP#subpart11.MAD @@ -11455,7 +11455,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = Aria, @@ -11468,7 +11468,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = Aria), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = Aria, - SUBPARTITION sp42 ENGINE = Aria)) */ + SUBPARTITION sp42 ENGINE = Aria)) unified filelist t1#P#part1#SP#sp11.MAD @@ -12000,12 +12000,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = Aria, PARTITION part2 VALUES IN (1) ENGINE = Aria, - PARTITION part3 VALUES IN (NULL) ENGINE = Aria) */ + PARTITION part3 VALUES IN (NULL) ENGINE = Aria) unified filelist t1#P#part1#SP#part1sp0.MAD @@ -12540,8 +12540,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 unified filelist t1#P#p0.MAD @@ -13005,8 +13005,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 unified filelist t1#P#p0.MAD @@ -13484,7 +13484,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = Aria, PARTITION part_2 VALUES IN (-2) ENGINE = Aria, PARTITION part_1 VALUES IN (-1) ENGINE = Aria, @@ -13492,7 +13492,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = Aria, PARTITION part1 VALUES IN (1) ENGINE = Aria, PARTITION part2 VALUES IN (2) ENGINE = Aria, - PARTITION part3 VALUES IN (3) ENGINE = Aria) */ + PARTITION part3 VALUES IN (3) ENGINE = Aria) unified filelist t1#P#part0.MAD @@ -13974,13 +13974,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, PARTITION partd VALUES LESS THAN (15) ENGINE = Aria, PARTITION parte VALUES LESS THAN (20) ENGINE = Aria, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta.MAD @@ -14454,13 +14454,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta#SP#partasp0.MAD @@ -14942,7 +14942,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = Aria, @@ -14955,7 +14955,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = Aria), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = Aria, - SUBPARTITION subpart42 ENGINE = Aria)) */ + SUBPARTITION subpart42 ENGINE = Aria)) unified filelist t1#P#part1#SP#subpart11.MAD @@ -15437,7 +15437,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = Aria, @@ -15450,7 +15450,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = Aria), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = Aria, - SUBPARTITION sp42 ENGINE = Aria)) */ + SUBPARTITION sp42 ENGINE = Aria)) unified filelist t1#P#part1#SP#sp11.MAD @@ -15930,12 +15930,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = Aria, PARTITION part2 VALUES IN (1) ENGINE = Aria, - PARTITION part3 VALUES IN (NULL) ENGINE = Aria) */ + PARTITION part3 VALUES IN (NULL) ENGINE = Aria) unified filelist t1#P#part1#SP#part1sp0.MAD @@ -16416,8 +16416,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 unified filelist t1#P#p0.MAD @@ -16933,8 +16933,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 unified filelist t1#P#p0.MAD @@ -17464,7 +17464,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = Aria, PARTITION part_2 VALUES IN (-2) ENGINE = Aria, PARTITION part_1 VALUES IN (-1) ENGINE = Aria, @@ -17472,7 +17472,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = Aria, PARTITION part1 VALUES IN (1) ENGINE = Aria, PARTITION part2 VALUES IN (2) ENGINE = Aria, - PARTITION part3 VALUES IN (3) ENGINE = Aria) */ + PARTITION part3 VALUES IN (3) ENGINE = Aria) unified filelist t1#P#part0.MAD @@ -18006,13 +18006,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, PARTITION partd VALUES LESS THAN (15) ENGINE = Aria, PARTITION parte VALUES LESS THAN (20) ENGINE = Aria, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta.MAD @@ -18538,13 +18538,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta#SP#partasp0.MAD @@ -19078,7 +19078,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = Aria, @@ -19091,7 +19091,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = Aria), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = Aria, - SUBPARTITION subpart42 ENGINE = Aria)) */ + SUBPARTITION subpart42 ENGINE = Aria)) unified filelist t1#P#part1#SP#subpart11.MAD @@ -19625,7 +19625,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = Aria, @@ -19638,7 +19638,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = Aria), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = Aria, - SUBPARTITION sp42 ENGINE = Aria)) */ + SUBPARTITION sp42 ENGINE = Aria)) unified filelist t1#P#part1#SP#sp11.MAD @@ -20170,12 +20170,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = Aria, PARTITION part2 VALUES IN (1) ENGINE = Aria, - PARTITION part3 VALUES IN (NULL) ENGINE = Aria) */ + PARTITION part3 VALUES IN (NULL) ENGINE = Aria) unified filelist t1#P#part1#SP#part1sp0.MAD @@ -20706,8 +20706,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 unified filelist t1#P#p0.MAD @@ -21223,8 +21223,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 unified filelist t1#P#p0.MAD @@ -21754,7 +21754,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = Aria, PARTITION part_2 VALUES IN (-2) ENGINE = Aria, PARTITION part_1 VALUES IN (-1) ENGINE = Aria, @@ -21762,7 +21762,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = Aria, PARTITION part1 VALUES IN (1) ENGINE = Aria, PARTITION part2 VALUES IN (2) ENGINE = Aria, - PARTITION part3 VALUES IN (3) ENGINE = Aria) */ + PARTITION part3 VALUES IN (3) ENGINE = Aria) unified filelist t1#P#part0.MAD @@ -22296,13 +22296,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, PARTITION partd VALUES LESS THAN (15) ENGINE = Aria, PARTITION parte VALUES LESS THAN (20) ENGINE = Aria, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta.MAD @@ -22828,13 +22828,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta#SP#partasp0.MAD @@ -23368,7 +23368,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = Aria, @@ -23381,7 +23381,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = Aria), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = Aria, - SUBPARTITION subpart42 ENGINE = Aria)) */ + SUBPARTITION subpart42 ENGINE = Aria)) unified filelist t1#P#part1#SP#subpart11.MAD @@ -23915,7 +23915,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = Aria, @@ -23928,7 +23928,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = Aria), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = Aria, - SUBPARTITION sp42 ENGINE = Aria)) */ + SUBPARTITION sp42 ENGINE = Aria)) unified filelist t1#P#part1#SP#sp11.MAD @@ -24460,12 +24460,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = Aria, PARTITION part2 VALUES IN (1) ENGINE = Aria, - PARTITION part3 VALUES IN (NULL) ENGINE = Aria) */ + PARTITION part3 VALUES IN (NULL) ENGINE = Aria) unified filelist t1#P#part1#SP#part1sp0.MAD diff --git a/mysql-test/suite/parts/r/partition_alter2_1_myisam.result b/mysql-test/suite/parts/r/partition_alter2_1_myisam.result index 3a31fa905e1..44550776616 100644 --- a/mysql-test/suite/parts/r/partition_alter2_1_myisam.result +++ b/mysql-test/suite/parts/r/partition_alter2_1_myisam.result @@ -74,8 +74,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -539,8 +539,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -1018,7 +1018,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -1026,7 +1026,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -1508,13 +1508,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -1988,13 +1988,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -2478,7 +2478,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -2491,7 +2491,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -2973,7 +2973,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -2986,7 +2986,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -3466,12 +3466,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -3952,8 +3952,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -4469,8 +4469,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -5000,7 +5000,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -5008,7 +5008,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -5542,13 +5542,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -6074,13 +6074,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -6616,7 +6616,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -6629,7 +6629,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -7163,7 +7163,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -7176,7 +7176,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -7708,12 +7708,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -8244,8 +8244,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -8761,8 +8761,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -9292,7 +9292,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -9300,7 +9300,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -9834,13 +9834,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -10366,13 +10366,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -10908,7 +10908,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -10921,7 +10921,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -11455,7 +11455,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -11468,7 +11468,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -12000,12 +12000,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -12540,8 +12540,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -13005,8 +13005,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -13484,7 +13484,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -13492,7 +13492,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -13974,13 +13974,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -14454,13 +14454,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -14942,7 +14942,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -14955,7 +14955,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -15437,7 +15437,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -15450,7 +15450,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -15930,12 +15930,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -16416,8 +16416,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -16933,8 +16933,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -17464,7 +17464,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -17472,7 +17472,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -18006,13 +18006,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -18538,13 +18538,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -19078,7 +19078,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -19091,7 +19091,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -19625,7 +19625,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -19638,7 +19638,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -20170,12 +20170,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -20706,8 +20706,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -21223,8 +21223,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -21754,7 +21754,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -21762,7 +21762,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -22296,13 +22296,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -22828,13 +22828,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -23368,7 +23368,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -23381,7 +23381,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -23915,7 +23915,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -23928,7 +23928,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -24460,12 +24460,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD diff --git a/mysql-test/suite/parts/r/partition_alter2_2_1_innodb.result b/mysql-test/suite/parts/r/partition_alter2_2_1_innodb.result index 1b5fbc437cc..113fc7bb312 100644 --- a/mysql-test/suite/parts/r/partition_alter2_2_1_innodb.result +++ b/mysql-test/suite/parts/r/partition_alter2_2_1_innodb.result @@ -74,8 +74,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -532,8 +532,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -998,7 +998,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -1006,7 +1006,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -1469,13 +1469,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -1932,13 +1932,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -2403,7 +2403,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -2416,7 +2416,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -2877,7 +2877,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -2890,7 +2890,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -3351,12 +3351,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -3815,8 +3815,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -4311,8 +4311,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -4815,7 +4815,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -4823,7 +4823,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -5324,13 +5324,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -5825,13 +5825,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -6334,7 +6334,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -6347,7 +6347,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -6846,7 +6846,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -6859,7 +6859,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -7358,12 +7358,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -7859,8 +7859,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -8355,8 +8355,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -8859,7 +8859,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -8867,7 +8867,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -9368,13 +9368,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -9869,13 +9869,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -10378,7 +10378,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -10391,7 +10391,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -10890,7 +10890,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -10903,7 +10903,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -11402,12 +11402,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -11904,8 +11904,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -12414,8 +12414,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -12932,7 +12932,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -12940,7 +12940,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -13455,13 +13455,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -13970,13 +13970,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -14493,7 +14493,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -14506,7 +14506,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -15019,7 +15019,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -15032,7 +15032,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -15545,12 +15545,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -16060,8 +16060,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -16570,8 +16570,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -17088,7 +17088,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -17096,7 +17096,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -17611,13 +17611,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -18126,13 +18126,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -18649,7 +18649,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -18662,7 +18662,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -19175,7 +19175,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -19188,7 +19188,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -19701,12 +19701,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 diff --git a/mysql-test/suite/parts/r/partition_alter2_2_2_innodb.result b/mysql-test/suite/parts/r/partition_alter2_2_2_innodb.result index c2e4d73cd0d..becbaddd927 100644 --- a/mysql-test/suite/parts/r/partition_alter2_2_2_innodb.result +++ b/mysql-test/suite/parts/r/partition_alter2_2_2_innodb.result @@ -69,8 +69,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -528,8 +528,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -995,7 +995,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -1003,7 +1003,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -1467,13 +1467,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -1935,13 +1935,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -2407,7 +2407,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -2420,7 +2420,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -2886,7 +2886,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -2899,7 +2899,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -3361,12 +3361,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -3827,8 +3827,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -4325,8 +4325,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -4831,7 +4831,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -4839,7 +4839,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -5342,13 +5342,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -5849,13 +5849,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -6360,7 +6360,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -6373,7 +6373,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -6878,7 +6878,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -6891,7 +6891,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -7392,12 +7392,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -7895,8 +7895,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -8393,8 +8393,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -8899,7 +8899,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -8907,7 +8907,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -9410,13 +9410,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -9917,13 +9917,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -10428,7 +10428,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -10441,7 +10441,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -10946,7 +10946,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -10959,7 +10959,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -11460,12 +11460,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -11964,8 +11964,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -12475,8 +12475,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -12994,7 +12994,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -13002,7 +13002,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -13518,13 +13518,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -14038,13 +14038,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -14562,7 +14562,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -14575,7 +14575,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -15093,7 +15093,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -15106,7 +15106,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -15620,12 +15620,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -16136,8 +16136,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -16647,8 +16647,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -17166,7 +17166,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -17174,7 +17174,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -17690,13 +17690,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -18210,13 +18210,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -18734,7 +18734,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -18747,7 +18747,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -19265,7 +19265,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -19278,7 +19278,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -19792,12 +19792,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 diff --git a/mysql-test/suite/parts/r/partition_alter2_2_maria.result b/mysql-test/suite/parts/r/partition_alter2_2_maria.result index 9407be53e04..72a497ed964 100644 --- a/mysql-test/suite/parts/r/partition_alter2_2_maria.result +++ b/mysql-test/suite/parts/r/partition_alter2_2_maria.result @@ -74,8 +74,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 unified filelist t1#P#p0.MAD @@ -541,8 +541,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 unified filelist t1#P#p0.MAD @@ -1022,7 +1022,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = Aria, PARTITION part_2 VALUES IN (-2) ENGINE = Aria, PARTITION part_1 VALUES IN (-1) ENGINE = Aria, @@ -1030,7 +1030,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = Aria, PARTITION part1 VALUES IN (1) ENGINE = Aria, PARTITION part2 VALUES IN (2) ENGINE = Aria, - PARTITION part3 VALUES IN (3) ENGINE = Aria) */ + PARTITION part3 VALUES IN (3) ENGINE = Aria) unified filelist t1#P#part0.MAD @@ -1514,13 +1514,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, PARTITION partd VALUES LESS THAN (15) ENGINE = Aria, PARTITION parte VALUES LESS THAN (20) ENGINE = Aria, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta.MAD @@ -1994,13 +1994,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta#SP#partasp0.MAD @@ -2486,7 +2486,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = Aria, @@ -2499,7 +2499,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = Aria), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = Aria, - SUBPARTITION subpart42 ENGINE = Aria)) */ + SUBPARTITION subpart42 ENGINE = Aria)) unified filelist t1#P#part1#SP#subpart11.MAD @@ -2981,7 +2981,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = Aria, @@ -2994,7 +2994,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = Aria), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = Aria, - SUBPARTITION sp42 ENGINE = Aria)) */ + SUBPARTITION sp42 ENGINE = Aria)) unified filelist t1#P#part1#SP#sp11.MAD @@ -3476,12 +3476,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = Aria, PARTITION part2 VALUES IN (1) ENGINE = Aria, - PARTITION part3 VALUES IN (NULL) ENGINE = Aria) */ + PARTITION part3 VALUES IN (NULL) ENGINE = Aria) unified filelist t1#P#part1#SP#part1sp0.MAD @@ -3964,8 +3964,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 unified filelist t1#P#p0.MAD @@ -4483,8 +4483,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 unified filelist t1#P#p0.MAD @@ -5016,7 +5016,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = Aria, PARTITION part_2 VALUES IN (-2) ENGINE = Aria, PARTITION part_1 VALUES IN (-1) ENGINE = Aria, @@ -5024,7 +5024,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = Aria, PARTITION part1 VALUES IN (1) ENGINE = Aria, PARTITION part2 VALUES IN (2) ENGINE = Aria, - PARTITION part3 VALUES IN (3) ENGINE = Aria) */ + PARTITION part3 VALUES IN (3) ENGINE = Aria) unified filelist t1#P#part0.MAD @@ -5560,13 +5560,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, PARTITION partd VALUES LESS THAN (15) ENGINE = Aria, PARTITION parte VALUES LESS THAN (20) ENGINE = Aria, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta.MAD @@ -6092,13 +6092,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta#SP#partasp0.MAD @@ -6636,7 +6636,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = Aria, @@ -6649,7 +6649,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = Aria), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = Aria, - SUBPARTITION subpart42 ENGINE = Aria)) */ + SUBPARTITION subpart42 ENGINE = Aria)) unified filelist t1#P#part1#SP#subpart11.MAD @@ -7183,7 +7183,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = Aria, @@ -7196,7 +7196,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = Aria), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = Aria, - SUBPARTITION sp42 ENGINE = Aria)) */ + SUBPARTITION sp42 ENGINE = Aria)) unified filelist t1#P#part1#SP#sp11.MAD @@ -7730,12 +7730,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = Aria, PARTITION part2 VALUES IN (1) ENGINE = Aria, - PARTITION part3 VALUES IN (NULL) ENGINE = Aria) */ + PARTITION part3 VALUES IN (NULL) ENGINE = Aria) unified filelist t1#P#part1#SP#part1sp0.MAD @@ -8268,8 +8268,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 unified filelist t1#P#p0.MAD @@ -8787,8 +8787,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 unified filelist t1#P#p0.MAD @@ -9320,7 +9320,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = Aria, PARTITION part_2 VALUES IN (-2) ENGINE = Aria, PARTITION part_1 VALUES IN (-1) ENGINE = Aria, @@ -9328,7 +9328,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = Aria, PARTITION part1 VALUES IN (1) ENGINE = Aria, PARTITION part2 VALUES IN (2) ENGINE = Aria, - PARTITION part3 VALUES IN (3) ENGINE = Aria) */ + PARTITION part3 VALUES IN (3) ENGINE = Aria) unified filelist t1#P#part0.MAD @@ -9864,13 +9864,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, PARTITION partd VALUES LESS THAN (15) ENGINE = Aria, PARTITION parte VALUES LESS THAN (20) ENGINE = Aria, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta.MAD @@ -10396,13 +10396,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta#SP#partasp0.MAD @@ -10940,7 +10940,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = Aria, @@ -10953,7 +10953,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = Aria), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = Aria, - SUBPARTITION subpart42 ENGINE = Aria)) */ + SUBPARTITION subpart42 ENGINE = Aria)) unified filelist t1#P#part1#SP#subpart11.MAD @@ -11487,7 +11487,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = Aria, @@ -11500,7 +11500,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = Aria), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = Aria, - SUBPARTITION sp42 ENGINE = Aria)) */ + SUBPARTITION sp42 ENGINE = Aria)) unified filelist t1#P#part1#SP#sp11.MAD @@ -12034,12 +12034,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = Aria, PARTITION part2 VALUES IN (1) ENGINE = Aria, - PARTITION part3 VALUES IN (NULL) ENGINE = Aria) */ + PARTITION part3 VALUES IN (NULL) ENGINE = Aria) unified filelist t1#P#part1#SP#part1sp0.MAD @@ -12575,8 +12575,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 unified filelist t1#P#p0.MAD @@ -13043,8 +13043,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 unified filelist t1#P#p0.MAD @@ -13525,7 +13525,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = Aria, PARTITION part_2 VALUES IN (-2) ENGINE = Aria, PARTITION part_1 VALUES IN (-1) ENGINE = Aria, @@ -13533,7 +13533,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = Aria, PARTITION part1 VALUES IN (1) ENGINE = Aria, PARTITION part2 VALUES IN (2) ENGINE = Aria, - PARTITION part3 VALUES IN (3) ENGINE = Aria) */ + PARTITION part3 VALUES IN (3) ENGINE = Aria) unified filelist t1#P#part0.MAD @@ -14018,13 +14018,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, PARTITION partd VALUES LESS THAN (15) ENGINE = Aria, PARTITION parte VALUES LESS THAN (20) ENGINE = Aria, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta.MAD @@ -14503,13 +14503,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta#SP#partasp0.MAD @@ -14996,7 +14996,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = Aria, @@ -15009,7 +15009,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = Aria), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = Aria, - SUBPARTITION subpart42 ENGINE = Aria)) */ + SUBPARTITION subpart42 ENGINE = Aria)) unified filelist t1#P#part1#SP#subpart11.MAD @@ -15496,7 +15496,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = Aria, @@ -15509,7 +15509,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = Aria), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = Aria, - SUBPARTITION sp42 ENGINE = Aria)) */ + SUBPARTITION sp42 ENGINE = Aria)) unified filelist t1#P#part1#SP#sp11.MAD @@ -15992,12 +15992,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = Aria, PARTITION part2 VALUES IN (1) ENGINE = Aria, - PARTITION part3 VALUES IN (NULL) ENGINE = Aria) */ + PARTITION part3 VALUES IN (NULL) ENGINE = Aria) unified filelist t1#P#part1#SP#part1sp0.MAD @@ -16481,8 +16481,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 unified filelist t1#P#p0.MAD @@ -17001,8 +17001,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 unified filelist t1#P#p0.MAD @@ -17535,7 +17535,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = Aria, PARTITION part_2 VALUES IN (-2) ENGINE = Aria, PARTITION part_1 VALUES IN (-1) ENGINE = Aria, @@ -17543,7 +17543,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = Aria, PARTITION part1 VALUES IN (1) ENGINE = Aria, PARTITION part2 VALUES IN (2) ENGINE = Aria, - PARTITION part3 VALUES IN (3) ENGINE = Aria) */ + PARTITION part3 VALUES IN (3) ENGINE = Aria) unified filelist t1#P#part0.MAD @@ -18080,13 +18080,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, PARTITION partd VALUES LESS THAN (15) ENGINE = Aria, PARTITION parte VALUES LESS THAN (20) ENGINE = Aria, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta.MAD @@ -18617,13 +18617,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta#SP#partasp0.MAD @@ -19162,7 +19162,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = Aria, @@ -19175,7 +19175,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = Aria), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = Aria, - SUBPARTITION subpart42 ENGINE = Aria)) */ + SUBPARTITION subpart42 ENGINE = Aria)) unified filelist t1#P#part1#SP#subpart11.MAD @@ -19714,7 +19714,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = Aria, @@ -19727,7 +19727,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = Aria), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = Aria, - SUBPARTITION sp42 ENGINE = Aria)) */ + SUBPARTITION sp42 ENGINE = Aria)) unified filelist t1#P#part1#SP#sp11.MAD @@ -20262,12 +20262,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = Aria, PARTITION part2 VALUES IN (1) ENGINE = Aria, - PARTITION part3 VALUES IN (NULL) ENGINE = Aria) */ + PARTITION part3 VALUES IN (NULL) ENGINE = Aria) unified filelist t1#P#part1#SP#part1sp0.MAD @@ -20801,8 +20801,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 unified filelist t1#P#p0.MAD @@ -21321,8 +21321,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 unified filelist t1#P#p0.MAD @@ -21855,7 +21855,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = Aria, PARTITION part_2 VALUES IN (-2) ENGINE = Aria, PARTITION part_1 VALUES IN (-1) ENGINE = Aria, @@ -21863,7 +21863,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = Aria, PARTITION part1 VALUES IN (1) ENGINE = Aria, PARTITION part2 VALUES IN (2) ENGINE = Aria, - PARTITION part3 VALUES IN (3) ENGINE = Aria) */ + PARTITION part3 VALUES IN (3) ENGINE = Aria) unified filelist t1#P#part0.MAD @@ -22400,13 +22400,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, PARTITION partd VALUES LESS THAN (15) ENGINE = Aria, PARTITION parte VALUES LESS THAN (20) ENGINE = Aria, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta.MAD @@ -22937,13 +22937,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = Aria, PARTITION partb VALUES LESS THAN (5) ENGINE = Aria, PARTITION partc VALUES LESS THAN (10) ENGINE = Aria, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = Aria) unified filelist t1#P#parta#SP#partasp0.MAD @@ -23482,7 +23482,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = Aria, @@ -23495,7 +23495,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = Aria), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = Aria, - SUBPARTITION subpart42 ENGINE = Aria)) */ + SUBPARTITION subpart42 ENGINE = Aria)) unified filelist t1#P#part1#SP#subpart11.MAD @@ -24034,7 +24034,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = Aria, @@ -24047,7 +24047,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = Aria), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = Aria, - SUBPARTITION sp42 ENGINE = Aria)) */ + SUBPARTITION sp42 ENGINE = Aria)) unified filelist t1#P#part1#SP#sp11.MAD @@ -24582,12 +24582,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = Aria, PARTITION part2 VALUES IN (1) ENGINE = Aria, - PARTITION part3 VALUES IN (NULL) ENGINE = Aria) */ + PARTITION part3 VALUES IN (NULL) ENGINE = Aria) unified filelist t1#P#part1#SP#part1sp0.MAD diff --git a/mysql-test/suite/parts/r/partition_alter2_2_myisam.result b/mysql-test/suite/parts/r/partition_alter2_2_myisam.result index f2a450686f5..aa490308295 100644 --- a/mysql-test/suite/parts/r/partition_alter2_2_myisam.result +++ b/mysql-test/suite/parts/r/partition_alter2_2_myisam.result @@ -74,8 +74,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -541,8 +541,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -1022,7 +1022,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -1030,7 +1030,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -1514,13 +1514,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -1994,13 +1994,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -2486,7 +2486,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -2499,7 +2499,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -2981,7 +2981,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -2994,7 +2994,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -3476,12 +3476,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -3964,8 +3964,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -4483,8 +4483,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -5016,7 +5016,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -5024,7 +5024,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -5560,13 +5560,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -6092,13 +6092,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -6636,7 +6636,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -6649,7 +6649,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -7183,7 +7183,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -7196,7 +7196,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -7730,12 +7730,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -8268,8 +8268,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -8787,8 +8787,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -9320,7 +9320,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -9328,7 +9328,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -9864,13 +9864,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -10396,13 +10396,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -10940,7 +10940,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -10953,7 +10953,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -11487,7 +11487,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -11500,7 +11500,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -12034,12 +12034,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -12575,8 +12575,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -13043,8 +13043,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -13525,7 +13525,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -13533,7 +13533,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -14018,13 +14018,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -14503,13 +14503,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -14996,7 +14996,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -15009,7 +15009,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -15496,7 +15496,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -15509,7 +15509,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -15992,12 +15992,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -16481,8 +16481,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -17001,8 +17001,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -17535,7 +17535,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -17543,7 +17543,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -18080,13 +18080,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -18617,13 +18617,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -19162,7 +19162,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -19175,7 +19175,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -19714,7 +19714,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -19727,7 +19727,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -20262,12 +20262,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -20801,8 +20801,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -21321,8 +21321,8 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -21855,7 +21855,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -21863,7 +21863,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -22400,13 +22400,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -22937,13 +22937,13 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -23482,7 +23482,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -23495,7 +23495,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -24034,7 +24034,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -24047,7 +24047,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -24582,12 +24582,12 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD diff --git a/mysql-test/suite/parts/r/partition_alter3_innodb.result b/mysql-test/suite/parts/r/partition_alter3_innodb.result index 2bb1bcc2433..57c0bc78914 100644 --- a/mysql-test/suite/parts/r/partition_alter3_innodb.result +++ b/mysql-test/suite/parts/r/partition_alter3_innodb.result @@ -78,7 +78,7 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) */ + PARTITION BY HASH (YEAR(f_date)) t1#P#p0.ibd t1.frm t1.par @@ -97,7 +97,7 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAYOFYEAR(f_date)) */ + PARTITION BY HASH (DAYOFYEAR(f_date)) t1#P#p0.ibd t1.frm t1.par @@ -114,7 +114,7 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) */ + PARTITION BY HASH (YEAR(f_date)) t1#P#p0.ibd t1.frm t1.par @@ -137,10 +137,10 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) + PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = InnoDB, PARTITION part1 ENGINE = InnoDB, - PARTITION part7 ENGINE = InnoDB) */ + PARTITION part7 ENGINE = InnoDB) t1#P#p0.ibd t1#P#part1.ibd t1#P#part7.ibd @@ -163,11 +163,11 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) + PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = InnoDB, PARTITION part1 ENGINE = InnoDB, PARTITION part7 ENGINE = InnoDB, - PARTITION part2 ENGINE = InnoDB) */ + PARTITION part2 ENGINE = InnoDB) t1#P#p0.ibd t1#P#part1.ibd t1#P#part2.ibd @@ -188,7 +188,7 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) + PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = InnoDB, PARTITION part1 ENGINE = InnoDB, PARTITION part7 ENGINE = InnoDB, @@ -196,7 +196,7 @@ t1 CREATE TABLE `t1` ( PARTITION p4 ENGINE = InnoDB, PARTITION p5 ENGINE = InnoDB, PARTITION p6 ENGINE = InnoDB, - PARTITION p7 ENGINE = InnoDB) */ + PARTITION p7 ENGINE = InnoDB) t1#P#p0.ibd t1#P#p4.ibd t1#P#p5.ibd @@ -233,14 +233,14 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) + PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = InnoDB, PARTITION part1 ENGINE = InnoDB, PARTITION part7 ENGINE = InnoDB, PARTITION part2 ENGINE = InnoDB, PARTITION p4 ENGINE = InnoDB, PARTITION p5 ENGINE = InnoDB, - PARTITION p6 ENGINE = InnoDB) */ + PARTITION p6 ENGINE = InnoDB) t1#P#p0.ibd t1#P#p4.ibd t1#P#p5.ibd @@ -263,13 +263,13 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) + PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = InnoDB, PARTITION part1 ENGINE = InnoDB, PARTITION part7 ENGINE = InnoDB, PARTITION part2 ENGINE = InnoDB, PARTITION p4 ENGINE = InnoDB, - PARTITION p5 ENGINE = InnoDB) */ + PARTITION p5 ENGINE = InnoDB) t1#P#p0.ibd t1#P#p4.ibd t1#P#p5.ibd @@ -291,12 +291,12 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) + PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = InnoDB, PARTITION part1 ENGINE = InnoDB, PARTITION part7 ENGINE = InnoDB, PARTITION part2 ENGINE = InnoDB, - PARTITION p4 ENGINE = InnoDB) */ + PARTITION p4 ENGINE = InnoDB) t1#P#p0.ibd t1#P#p4.ibd t1#P#part1.ibd @@ -317,11 +317,11 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) + PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = InnoDB, PARTITION part1 ENGINE = InnoDB, PARTITION part7 ENGINE = InnoDB, - PARTITION part2 ENGINE = InnoDB) */ + PARTITION part2 ENGINE = InnoDB) t1#P#p0.ibd t1#P#part1.ibd t1#P#part2.ibd @@ -341,10 +341,10 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) + PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = InnoDB, PARTITION part1 ENGINE = InnoDB, - PARTITION part7 ENGINE = InnoDB) */ + PARTITION part7 ENGINE = InnoDB) t1#P#p0.ibd t1#P#part1.ibd t1#P#part7.ibd @@ -363,9 +363,9 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) + PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = InnoDB, - PARTITION part1 ENGINE = InnoDB) */ + PARTITION part1 ENGINE = InnoDB) t1#P#p0.ibd t1#P#part1.ibd t1.frm @@ -383,8 +383,8 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) -(PARTITION p0 ENGINE = InnoDB) */ + PARTITION BY HASH (YEAR(f_date)) +(PARTITION p0 ENGINE = InnoDB) t1#P#p0.ibd t1.frm t1.par @@ -469,7 +469,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) */ + PARTITION BY KEY (f_int1) t1#P#p0.ibd t1.frm t1.par @@ -495,10 +495,10 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = InnoDB, PARTITION part1 ENGINE = InnoDB, - PARTITION part7 ENGINE = InnoDB) */ + PARTITION part7 ENGINE = InnoDB) t1#P#p0.ibd t1#P#part1.ibd t1#P#part7.ibd @@ -521,11 +521,11 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = InnoDB, PARTITION part1 ENGINE = InnoDB, PARTITION part7 ENGINE = InnoDB, - PARTITION part2 ENGINE = InnoDB) */ + PARTITION part2 ENGINE = InnoDB) t1#P#p0.ibd t1#P#part1.ibd t1#P#part2.ibd @@ -549,7 +549,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = InnoDB, PARTITION part1 ENGINE = InnoDB, PARTITION part7 ENGINE = InnoDB, @@ -557,7 +557,7 @@ t1 CREATE TABLE `t1` ( PARTITION p4 ENGINE = InnoDB, PARTITION p5 ENGINE = InnoDB, PARTITION p6 ENGINE = InnoDB, - PARTITION p7 ENGINE = InnoDB) */ + PARTITION p7 ENGINE = InnoDB) t1#P#p0.ibd t1#P#p4.ibd t1#P#p5.ibd @@ -592,14 +592,14 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = InnoDB, PARTITION part1 ENGINE = InnoDB, PARTITION part7 ENGINE = InnoDB, PARTITION part2 ENGINE = InnoDB, PARTITION p4 ENGINE = InnoDB, PARTITION p5 ENGINE = InnoDB, - PARTITION p6 ENGINE = InnoDB) */ + PARTITION p6 ENGINE = InnoDB) t1#P#p0.ibd t1#P#p4.ibd t1#P#p5.ibd @@ -625,13 +625,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = InnoDB, PARTITION part1 ENGINE = InnoDB, PARTITION part7 ENGINE = InnoDB, PARTITION part2 ENGINE = InnoDB, PARTITION p4 ENGINE = InnoDB, - PARTITION p5 ENGINE = InnoDB) */ + PARTITION p5 ENGINE = InnoDB) t1#P#p0.ibd t1#P#p4.ibd t1#P#p5.ibd @@ -656,12 +656,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = InnoDB, PARTITION part1 ENGINE = InnoDB, PARTITION part7 ENGINE = InnoDB, PARTITION part2 ENGINE = InnoDB, - PARTITION p4 ENGINE = InnoDB) */ + PARTITION p4 ENGINE = InnoDB) t1#P#p0.ibd t1#P#p4.ibd t1#P#part1.ibd @@ -685,11 +685,11 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = InnoDB, PARTITION part1 ENGINE = InnoDB, PARTITION part7 ENGINE = InnoDB, - PARTITION part2 ENGINE = InnoDB) */ + PARTITION part2 ENGINE = InnoDB) t1#P#p0.ibd t1#P#part1.ibd t1#P#part2.ibd @@ -712,10 +712,10 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = InnoDB, PARTITION part1 ENGINE = InnoDB, - PARTITION part7 ENGINE = InnoDB) */ + PARTITION part7 ENGINE = InnoDB) t1#P#p0.ibd t1#P#part1.ibd t1#P#part7.ibd @@ -737,9 +737,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = InnoDB, - PARTITION part1 ENGINE = InnoDB) */ + PARTITION part1 ENGINE = InnoDB) t1#P#p0.ibd t1#P#part1.ibd t1.frm @@ -760,8 +760,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -(PARTITION p0 ENGINE = InnoDB) */ + PARTITION BY KEY (f_int1) +(PARTITION p0 ENGINE = InnoDB) t1#P#p0.ibd t1.frm t1.par diff --git a/mysql-test/suite/parts/r/partition_alter3_myisam.result b/mysql-test/suite/parts/r/partition_alter3_myisam.result index 2a2ae74d8bd..99d1587ef09 100644 --- a/mysql-test/suite/parts/r/partition_alter3_myisam.result +++ b/mysql-test/suite/parts/r/partition_alter3_myisam.result @@ -79,7 +79,7 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) */ + PARTITION BY HASH (YEAR(f_date)) t1#P#p0.MYD t1#P#p0.MYI t1.frm @@ -99,7 +99,7 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (DAYOFYEAR(f_date)) */ + PARTITION BY HASH (DAYOFYEAR(f_date)) t1#P#p0.MYD t1#P#p0.MYI t1.frm @@ -117,7 +117,7 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) */ + PARTITION BY HASH (YEAR(f_date)) t1#P#p0.MYD t1#P#p0.MYI t1.frm @@ -141,10 +141,10 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) + PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, - PARTITION part7 ENGINE = MyISAM) */ + PARTITION part7 ENGINE = MyISAM) t1#P#p0.MYD t1#P#p0.MYI t1#P#part1.MYD @@ -170,11 +170,11 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) + PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, - PARTITION part2 ENGINE = MyISAM) */ + PARTITION part2 ENGINE = MyISAM) t1#P#p0.MYD t1#P#p0.MYI t1#P#part1.MYD @@ -199,7 +199,7 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) + PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, @@ -207,7 +207,7 @@ t1 CREATE TABLE `t1` ( PARTITION p4 ENGINE = MyISAM, PARTITION p5 ENGINE = MyISAM, PARTITION p6 ENGINE = MyISAM, - PARTITION p7 ENGINE = MyISAM) */ + PARTITION p7 ENGINE = MyISAM) t1#P#p0.MYD t1#P#p0.MYI t1#P#p4.MYD @@ -252,14 +252,14 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) + PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM, PARTITION p4 ENGINE = MyISAM, PARTITION p5 ENGINE = MyISAM, - PARTITION p6 ENGINE = MyISAM) */ + PARTITION p6 ENGINE = MyISAM) t1#P#p0.MYD t1#P#p0.MYI t1#P#p4.MYD @@ -289,13 +289,13 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) + PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM, PARTITION p4 ENGINE = MyISAM, - PARTITION p5 ENGINE = MyISAM) */ + PARTITION p5 ENGINE = MyISAM) t1#P#p0.MYD t1#P#p0.MYI t1#P#p4.MYD @@ -323,12 +323,12 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) + PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM, - PARTITION p4 ENGINE = MyISAM) */ + PARTITION p4 ENGINE = MyISAM) t1#P#p0.MYD t1#P#p0.MYI t1#P#p4.MYD @@ -354,11 +354,11 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) + PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, - PARTITION part2 ENGINE = MyISAM) */ + PARTITION part2 ENGINE = MyISAM) t1#P#p0.MYD t1#P#p0.MYI t1#P#part1.MYD @@ -382,10 +382,10 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) + PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, - PARTITION part7 ENGINE = MyISAM) */ + PARTITION part7 ENGINE = MyISAM) t1#P#p0.MYD t1#P#p0.MYI t1#P#part1.MYD @@ -407,9 +407,9 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) + PARTITION BY HASH (YEAR(f_date)) (PARTITION p0 ENGINE = MyISAM, - PARTITION part1 ENGINE = MyISAM) */ + PARTITION part1 ENGINE = MyISAM) t1#P#p0.MYD t1#P#p0.MYI t1#P#part1.MYD @@ -429,8 +429,8 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (YEAR(f_date)) -(PARTITION p0 ENGINE = MyISAM) */ + PARTITION BY HASH (YEAR(f_date)) +(PARTITION p0 ENGINE = MyISAM) t1#P#p0.MYD t1#P#p0.MYI t1.frm @@ -512,7 +512,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) */ + PARTITION BY KEY (f_int1) t1#P#p0.MYD t1#P#p0.MYI t1.frm @@ -539,10 +539,10 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, - PARTITION part7 ENGINE = MyISAM) */ + PARTITION part7 ENGINE = MyISAM) t1#P#p0.MYD t1#P#p0.MYI t1#P#part1.MYD @@ -568,11 +568,11 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, - PARTITION part2 ENGINE = MyISAM) */ + PARTITION part2 ENGINE = MyISAM) t1#P#p0.MYD t1#P#p0.MYI t1#P#part1.MYD @@ -600,7 +600,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, @@ -608,7 +608,7 @@ t1 CREATE TABLE `t1` ( PARTITION p4 ENGINE = MyISAM, PARTITION p5 ENGINE = MyISAM, PARTITION p6 ENGINE = MyISAM, - PARTITION p7 ENGINE = MyISAM) */ + PARTITION p7 ENGINE = MyISAM) t1#P#p0.MYD t1#P#p0.MYI t1#P#p4.MYD @@ -651,14 +651,14 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM, PARTITION p4 ENGINE = MyISAM, PARTITION p5 ENGINE = MyISAM, - PARTITION p6 ENGINE = MyISAM) */ + PARTITION p6 ENGINE = MyISAM) t1#P#p0.MYD t1#P#p0.MYI t1#P#p4.MYD @@ -691,13 +691,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM, PARTITION p4 ENGINE = MyISAM, - PARTITION p5 ENGINE = MyISAM) */ + PARTITION p5 ENGINE = MyISAM) t1#P#p0.MYD t1#P#p0.MYI t1#P#p4.MYD @@ -728,12 +728,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM, - PARTITION p4 ENGINE = MyISAM) */ + PARTITION p4 ENGINE = MyISAM) t1#P#p0.MYD t1#P#p0.MYI t1#P#p4.MYD @@ -762,11 +762,11 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, PARTITION part7 ENGINE = MyISAM, - PARTITION part2 ENGINE = MyISAM) */ + PARTITION part2 ENGINE = MyISAM) t1#P#p0.MYD t1#P#p0.MYI t1#P#part1.MYD @@ -793,10 +793,10 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM, - PARTITION part7 ENGINE = MyISAM) */ + PARTITION part7 ENGINE = MyISAM) t1#P#p0.MYD t1#P#p0.MYI t1#P#part1.MYD @@ -821,9 +821,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION p0 ENGINE = MyISAM, - PARTITION part1 ENGINE = MyISAM) */ + PARTITION part1 ENGINE = MyISAM) t1#P#p0.MYD t1#P#p0.MYI t1#P#part1.MYD @@ -846,8 +846,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -(PARTITION p0 ENGINE = MyISAM) */ + PARTITION BY KEY (f_int1) +(PARTITION p0 ENGINE = MyISAM) t1#P#p0.MYD t1#P#p0.MYI t1.frm diff --git a/mysql-test/suite/parts/r/partition_alter4_innodb.result b/mysql-test/suite/parts/r/partition_alter4_innodb.result index 5bdf4ac0ab1..169f73d045a 100644 --- a/mysql-test/suite/parts/r/partition_alter4_innodb.result +++ b/mysql-test/suite/parts/r/partition_alter4_innodb.result @@ -75,9 +75,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = InnoDB, - PARTITION part_2 ENGINE = InnoDB) */ + PARTITION part_2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -534,12 +534,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = InnoDB, PARTITION part_2 ENGINE = InnoDB, PARTITION part_3 ENGINE = InnoDB, PARTITION part_4 ENGINE = InnoDB, - PARTITION part_5 ENGINE = InnoDB) */ + PARTITION part_5 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -1004,7 +1004,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -1012,7 +1012,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -1475,13 +1475,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_1 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION part_4 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -1940,13 +1940,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -2411,7 +2411,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -2424,7 +2424,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -2887,7 +2887,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -2900,7 +2900,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -3361,12 +3361,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = InnoDB, PARTITION part_2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -3825,9 +3825,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = InnoDB, - PARTITION part_2 ENGINE = InnoDB) */ + PARTITION part_2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -4284,12 +4284,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = InnoDB, PARTITION part_2 ENGINE = InnoDB, PARTITION part_3 ENGINE = InnoDB, PARTITION part_4 ENGINE = InnoDB, - PARTITION part_5 ENGINE = InnoDB) */ + PARTITION part_5 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -4754,7 +4754,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -4762,7 +4762,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -5225,13 +5225,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_1 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION part_4 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -5690,13 +5690,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -6161,7 +6161,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -6174,7 +6174,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -6637,7 +6637,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -6650,7 +6650,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -7111,12 +7111,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = InnoDB, PARTITION part_2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -7575,9 +7575,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = InnoDB, - PARTITION part_2 ENGINE = InnoDB) */ + PARTITION part_2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -8034,12 +8034,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = InnoDB, PARTITION part_2 ENGINE = InnoDB, PARTITION part_3 ENGINE = InnoDB, PARTITION part_4 ENGINE = InnoDB, - PARTITION part_5 ENGINE = InnoDB) */ + PARTITION part_5 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -8504,7 +8504,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -8512,7 +8512,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -8975,13 +8975,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_1 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION part_4 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -9440,13 +9440,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -9911,7 +9911,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -9924,7 +9924,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -10387,7 +10387,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -10400,7 +10400,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -10861,12 +10861,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = InnoDB, PARTITION part_2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -11325,9 +11325,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = InnoDB, - PARTITION part_2 ENGINE = InnoDB) */ + PARTITION part_2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -11784,12 +11784,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = InnoDB, PARTITION part_2 ENGINE = InnoDB, PARTITION part_3 ENGINE = InnoDB, PARTITION part_4 ENGINE = InnoDB, - PARTITION part_5 ENGINE = InnoDB) */ + PARTITION part_5 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -12254,7 +12254,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -12262,7 +12262,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -12725,13 +12725,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_1 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION part_4 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -13190,13 +13190,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -13661,7 +13661,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -13674,7 +13674,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -14137,7 +14137,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -14150,7 +14150,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -14611,12 +14611,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = InnoDB, PARTITION part_2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -15075,9 +15075,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = InnoDB, - PARTITION part_2 ENGINE = InnoDB) */ + PARTITION part_2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -15534,12 +15534,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = InnoDB, PARTITION part_2 ENGINE = InnoDB, PARTITION part_3 ENGINE = InnoDB, PARTITION part_4 ENGINE = InnoDB, - PARTITION part_5 ENGINE = InnoDB) */ + PARTITION part_5 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -16004,7 +16004,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -16012,7 +16012,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -16475,13 +16475,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_1 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION part_4 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -16940,13 +16940,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -17411,7 +17411,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -17424,7 +17424,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -17887,7 +17887,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -17900,7 +17900,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -18361,12 +18361,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = InnoDB, PARTITION part_2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -18828,9 +18828,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = InnoDB, - PARTITION part_2 ENGINE = InnoDB) */ + PARTITION part_2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -19287,12 +19287,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = InnoDB, PARTITION part_2 ENGINE = InnoDB, PARTITION part_3 ENGINE = InnoDB, PARTITION part_4 ENGINE = InnoDB, - PARTITION part_5 ENGINE = InnoDB) */ + PARTITION part_5 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -19757,7 +19757,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -19765,7 +19765,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -20228,13 +20228,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_1 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION part_4 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -20693,13 +20693,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -21164,7 +21164,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -21177,7 +21177,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -21640,7 +21640,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -21653,7 +21653,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -22114,12 +22114,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = InnoDB, PARTITION part_2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -22578,9 +22578,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = InnoDB, - PARTITION part_2 ENGINE = InnoDB) */ + PARTITION part_2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -23037,12 +23037,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = InnoDB, PARTITION part_2 ENGINE = InnoDB, PARTITION part_3 ENGINE = InnoDB, PARTITION part_4 ENGINE = InnoDB, - PARTITION part_5 ENGINE = InnoDB) */ + PARTITION part_5 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -23507,7 +23507,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -23515,7 +23515,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -23978,13 +23978,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_1 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION part_4 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -24443,13 +24443,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -24914,7 +24914,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -24927,7 +24927,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -25390,7 +25390,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -25403,7 +25403,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -25864,12 +25864,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = InnoDB, PARTITION part_2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -26328,9 +26328,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = InnoDB, - PARTITION part_2 ENGINE = InnoDB) */ + PARTITION part_2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -26787,12 +26787,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = InnoDB, PARTITION part_2 ENGINE = InnoDB, PARTITION part_3 ENGINE = InnoDB, PARTITION part_4 ENGINE = InnoDB, - PARTITION part_5 ENGINE = InnoDB) */ + PARTITION part_5 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -27257,7 +27257,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -27265,7 +27265,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -27728,13 +27728,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_1 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION part_4 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -28193,13 +28193,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -28664,7 +28664,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -28677,7 +28677,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -29140,7 +29140,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -29153,7 +29153,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -29614,12 +29614,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = InnoDB, PARTITION part_2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -30078,9 +30078,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = InnoDB, - PARTITION part_2 ENGINE = InnoDB) */ + PARTITION part_2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -30537,12 +30537,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = InnoDB, PARTITION part_2 ENGINE = InnoDB, PARTITION part_3 ENGINE = InnoDB, PARTITION part_4 ENGINE = InnoDB, - PARTITION part_5 ENGINE = InnoDB) */ + PARTITION part_5 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -31007,7 +31007,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -31015,7 +31015,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -31478,13 +31478,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_1 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION part_4 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -31943,13 +31943,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -32414,7 +32414,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -32427,7 +32427,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -32890,7 +32890,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -32903,7 +32903,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -33364,12 +33364,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = InnoDB, PARTITION part_2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -33828,9 +33828,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = InnoDB, - PARTITION part_2 ENGINE = InnoDB) */ + PARTITION part_2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -34287,12 +34287,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = InnoDB, PARTITION part_2 ENGINE = InnoDB, PARTITION part_3 ENGINE = InnoDB, PARTITION part_4 ENGINE = InnoDB, - PARTITION part_5 ENGINE = InnoDB) */ + PARTITION part_5 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -34757,7 +34757,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -34765,7 +34765,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -35228,13 +35228,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_1 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION part_4 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -35693,13 +35693,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -36164,7 +36164,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -36177,7 +36177,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -36640,7 +36640,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -36653,7 +36653,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -37114,12 +37114,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = InnoDB, PARTITION part_2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -37582,9 +37582,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = InnoDB, - PARTITION part_2 ENGINE = InnoDB) */ + PARTITION part_2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -38042,12 +38042,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = InnoDB, PARTITION part_2 ENGINE = InnoDB, PARTITION part_3 ENGINE = InnoDB, PARTITION part_4 ENGINE = InnoDB, - PARTITION part_5 ENGINE = InnoDB) */ + PARTITION part_5 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -38513,7 +38513,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -38521,7 +38521,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -38985,13 +38985,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_1 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION part_4 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -39451,13 +39451,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -39923,7 +39923,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -39936,7 +39936,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -40400,7 +40400,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -40413,7 +40413,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -40875,12 +40875,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = InnoDB, PARTITION part_2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -41340,9 +41340,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = InnoDB, - PARTITION part_2 ENGINE = InnoDB) */ + PARTITION part_2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -41800,12 +41800,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = InnoDB, PARTITION part_2 ENGINE = InnoDB, PARTITION part_3 ENGINE = InnoDB, PARTITION part_4 ENGINE = InnoDB, - PARTITION part_5 ENGINE = InnoDB) */ + PARTITION part_5 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -42271,7 +42271,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -42279,7 +42279,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -42743,13 +42743,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_1 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION part_4 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -43209,13 +43209,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -43681,7 +43681,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -43694,7 +43694,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -44158,7 +44158,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -44171,7 +44171,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -44633,12 +44633,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = InnoDB, PARTITION part_2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -45097,9 +45097,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = InnoDB, - PARTITION part_2 ENGINE = InnoDB) */ + PARTITION part_2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -45556,12 +45556,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = InnoDB, PARTITION part_2 ENGINE = InnoDB, PARTITION part_3 ENGINE = InnoDB, PARTITION part_4 ENGINE = InnoDB, - PARTITION part_5 ENGINE = InnoDB) */ + PARTITION part_5 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -46026,7 +46026,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -46034,7 +46034,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -46497,13 +46497,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_1 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION part_4 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -46962,13 +46962,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -47433,7 +47433,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -47446,7 +47446,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -47909,7 +47909,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -47922,7 +47922,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -48383,12 +48383,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = InnoDB, PARTITION part_2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -48847,9 +48847,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = InnoDB, - PARTITION part_2 ENGINE = InnoDB) */ + PARTITION part_2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -49306,12 +49306,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = InnoDB, PARTITION part_2 ENGINE = InnoDB, PARTITION part_3 ENGINE = InnoDB, PARTITION part_4 ENGINE = InnoDB, - PARTITION part_5 ENGINE = InnoDB) */ + PARTITION part_5 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -49776,7 +49776,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -49784,7 +49784,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -50247,13 +50247,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_1 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION part_4 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -50712,13 +50712,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -51183,7 +51183,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -51196,7 +51196,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -51659,7 +51659,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -51672,7 +51672,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -52133,12 +52133,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = InnoDB, PARTITION part_2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -52598,9 +52598,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = InnoDB, - PARTITION part_2 ENGINE = InnoDB) */ + PARTITION part_2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -53058,12 +53058,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = InnoDB, PARTITION part_2 ENGINE = InnoDB, PARTITION part_3 ENGINE = InnoDB, PARTITION part_4 ENGINE = InnoDB, - PARTITION part_5 ENGINE = InnoDB) */ + PARTITION part_5 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -53529,7 +53529,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -53537,7 +53537,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -54001,13 +54001,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_1 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION part_4 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -54467,13 +54467,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -54939,7 +54939,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -54952,7 +54952,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -55416,7 +55416,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -55429,7 +55429,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -55891,12 +55891,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = InnoDB, PARTITION part_2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -56356,9 +56356,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = InnoDB, - PARTITION part_2 ENGINE = InnoDB) */ + PARTITION part_2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -56813,12 +56813,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = InnoDB, PARTITION part_2 ENGINE = InnoDB, PARTITION part_3 ENGINE = InnoDB, PARTITION part_4 ENGINE = InnoDB, - PARTITION part_5 ENGINE = InnoDB) */ + PARTITION part_5 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -57281,7 +57281,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -57289,7 +57289,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -57750,13 +57750,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_1 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION part_4 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -58213,13 +58213,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -58682,7 +58682,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -58695,7 +58695,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -59156,7 +59156,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -59169,7 +59169,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -59628,12 +59628,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = InnoDB, PARTITION part_2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -60090,9 +60090,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = InnoDB, - PARTITION part_2 ENGINE = InnoDB) */ + PARTITION part_2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -60547,12 +60547,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = InnoDB, PARTITION part_2 ENGINE = InnoDB, PARTITION part_3 ENGINE = InnoDB, PARTITION part_4 ENGINE = InnoDB, - PARTITION part_5 ENGINE = InnoDB) */ + PARTITION part_5 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -61015,7 +61015,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -61023,7 +61023,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -61484,13 +61484,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_1 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION part_4 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -61947,13 +61947,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -62416,7 +62416,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -62429,7 +62429,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -62890,7 +62890,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -62903,7 +62903,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -63362,12 +63362,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = InnoDB, PARTITION part_2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -64144,9 +64144,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = InnoDB, - PARTITION part_2 ENGINE = InnoDB) */ + PARTITION part_2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -64601,12 +64601,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = InnoDB, PARTITION part_2 ENGINE = InnoDB, PARTITION part_3 ENGINE = InnoDB, PARTITION part_4 ENGINE = InnoDB, - PARTITION part_5 ENGINE = InnoDB) */ + PARTITION part_5 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -65069,7 +65069,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -65077,7 +65077,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -65538,13 +65538,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_1 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION part_4 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -66001,13 +66001,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -66470,7 +66470,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -66483,7 +66483,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -66944,7 +66944,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -66957,7 +66957,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -67416,12 +67416,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = InnoDB, PARTITION part_2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -67883,9 +67883,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = InnoDB, - PARTITION part_2 ENGINE = InnoDB) */ + PARTITION part_2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -68342,12 +68342,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = InnoDB, PARTITION part_2 ENGINE = InnoDB, PARTITION part_3 ENGINE = InnoDB, PARTITION part_4 ENGINE = InnoDB, - PARTITION part_5 ENGINE = InnoDB) */ + PARTITION part_5 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -68812,7 +68812,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -68820,7 +68820,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -69283,13 +69283,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_1 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION part_4 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -69748,13 +69748,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -70219,7 +70219,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -70232,7 +70232,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -70695,7 +70695,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -70708,7 +70708,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -71169,12 +71169,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = InnoDB, PARTITION part_2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -71633,9 +71633,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = InnoDB, - PARTITION part_2 ENGINE = InnoDB) */ + PARTITION part_2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -72092,12 +72092,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = InnoDB, PARTITION part_2 ENGINE = InnoDB, PARTITION part_3 ENGINE = InnoDB, PARTITION part_4 ENGINE = InnoDB, - PARTITION part_5 ENGINE = InnoDB) */ + PARTITION part_5 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -72562,7 +72562,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -72570,7 +72570,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -73033,13 +73033,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_1 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION part_4 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -73498,13 +73498,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -73969,7 +73969,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -73982,7 +73982,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -74445,7 +74445,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -74458,7 +74458,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -74919,12 +74919,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = InnoDB, PARTITION part_2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -75383,9 +75383,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = InnoDB, - PARTITION part_2 ENGINE = InnoDB) */ + PARTITION part_2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -75842,12 +75842,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = InnoDB, PARTITION part_2 ENGINE = InnoDB, PARTITION part_3 ENGINE = InnoDB, PARTITION part_4 ENGINE = InnoDB, - PARTITION part_5 ENGINE = InnoDB) */ + PARTITION part_5 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -76312,7 +76312,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -76320,7 +76320,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -76783,13 +76783,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_1 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION part_4 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -77248,13 +77248,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -77719,7 +77719,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -77732,7 +77732,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -78195,7 +78195,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -78208,7 +78208,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -78669,12 +78669,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = InnoDB, PARTITION part_2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -79133,9 +79133,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = InnoDB, - PARTITION part_2 ENGINE = InnoDB) */ + PARTITION part_2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -79592,12 +79592,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = InnoDB, PARTITION part_2 ENGINE = InnoDB, PARTITION part_3 ENGINE = InnoDB, PARTITION part_4 ENGINE = InnoDB, - PARTITION part_5 ENGINE = InnoDB) */ + PARTITION part_5 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -80062,7 +80062,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -80070,7 +80070,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -80533,13 +80533,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_1 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION part_4 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -80998,13 +80998,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -81469,7 +81469,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -81482,7 +81482,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -81945,7 +81945,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -81958,7 +81958,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -82419,12 +82419,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = InnoDB, PARTITION part_2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -82883,9 +82883,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = InnoDB, - PARTITION part_2 ENGINE = InnoDB) */ + PARTITION part_2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -83342,12 +83342,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = InnoDB, PARTITION part_2 ENGINE = InnoDB, PARTITION part_3 ENGINE = InnoDB, PARTITION part_4 ENGINE = InnoDB, - PARTITION part_5 ENGINE = InnoDB) */ + PARTITION part_5 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -83812,7 +83812,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -83820,7 +83820,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -84283,13 +84283,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_1 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION part_4 VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -84748,13 +84748,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION part_2 VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION part_3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -85219,7 +85219,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -85232,7 +85232,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -85695,7 +85695,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -85708,7 +85708,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -86169,12 +86169,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = InnoDB, PARTITION part_2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 diff --git a/mysql-test/suite/parts/r/partition_alter4_myisam.result b/mysql-test/suite/parts/r/partition_alter4_myisam.result index da99d6867ab..a4f7c05345f 100644 --- a/mysql-test/suite/parts/r/partition_alter4_myisam.result +++ b/mysql-test/suite/parts/r/partition_alter4_myisam.result @@ -75,9 +75,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = MyISAM, - PARTITION part_2 ENGINE = MyISAM) */ + PARTITION part_2 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -543,12 +543,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = MyISAM, PARTITION part_2 ENGINE = MyISAM, PARTITION part_3 ENGINE = MyISAM, PARTITION part_4 ENGINE = MyISAM, - PARTITION part_5 ENGINE = MyISAM) */ + PARTITION part_5 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -1028,7 +1028,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -1036,7 +1036,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -1520,13 +1520,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_1 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION part_4 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -2002,13 +2002,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -2494,7 +2494,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -2507,7 +2507,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#subpart11.MYD @@ -2991,7 +2991,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -3004,7 +3004,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#sp11.MYD @@ -3486,12 +3486,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = MyISAM, PARTITION part_2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -3973,9 +3973,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = MyISAM, - PARTITION part_2 ENGINE = MyISAM) */ + PARTITION part_2 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -4441,12 +4441,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = MyISAM, PARTITION part_2 ENGINE = MyISAM, PARTITION part_3 ENGINE = MyISAM, PARTITION part_4 ENGINE = MyISAM, - PARTITION part_5 ENGINE = MyISAM) */ + PARTITION part_5 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -4926,7 +4926,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -4934,7 +4934,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -5418,13 +5418,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_1 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION part_4 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -5900,13 +5900,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -6392,7 +6392,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -6405,7 +6405,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#subpart11.MYD @@ -6889,7 +6889,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -6902,7 +6902,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#sp11.MYD @@ -7384,12 +7384,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = MyISAM, PARTITION part_2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -7871,9 +7871,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = MyISAM, - PARTITION part_2 ENGINE = MyISAM) */ + PARTITION part_2 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -8339,12 +8339,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = MyISAM, PARTITION part_2 ENGINE = MyISAM, PARTITION part_3 ENGINE = MyISAM, PARTITION part_4 ENGINE = MyISAM, - PARTITION part_5 ENGINE = MyISAM) */ + PARTITION part_5 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -8824,7 +8824,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -8832,7 +8832,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -9316,13 +9316,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_1 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION part_4 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -9798,13 +9798,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -10290,7 +10290,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -10303,7 +10303,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#subpart11.MYD @@ -10787,7 +10787,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -10800,7 +10800,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#sp11.MYD @@ -11282,12 +11282,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = MyISAM, PARTITION part_2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -11769,9 +11769,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = MyISAM, - PARTITION part_2 ENGINE = MyISAM) */ + PARTITION part_2 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -12237,12 +12237,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = MyISAM, PARTITION part_2 ENGINE = MyISAM, PARTITION part_3 ENGINE = MyISAM, PARTITION part_4 ENGINE = MyISAM, - PARTITION part_5 ENGINE = MyISAM) */ + PARTITION part_5 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -12722,7 +12722,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -12730,7 +12730,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -13214,13 +13214,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_1 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION part_4 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -13696,13 +13696,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -14188,7 +14188,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -14201,7 +14201,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#subpart11.MYD @@ -14685,7 +14685,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -14698,7 +14698,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#sp11.MYD @@ -15180,12 +15180,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = MyISAM, PARTITION part_2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -15667,9 +15667,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = MyISAM, - PARTITION part_2 ENGINE = MyISAM) */ + PARTITION part_2 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -16135,12 +16135,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = MyISAM, PARTITION part_2 ENGINE = MyISAM, PARTITION part_3 ENGINE = MyISAM, PARTITION part_4 ENGINE = MyISAM, - PARTITION part_5 ENGINE = MyISAM) */ + PARTITION part_5 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -16620,7 +16620,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -16628,7 +16628,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -17112,13 +17112,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_1 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION part_4 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -17594,13 +17594,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -18086,7 +18086,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -18099,7 +18099,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#subpart11.MYD @@ -18583,7 +18583,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -18596,7 +18596,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#sp11.MYD @@ -19078,12 +19078,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = MyISAM, PARTITION part_2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -19568,9 +19568,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = MyISAM, - PARTITION part_2 ENGINE = MyISAM) */ + PARTITION part_2 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -20036,12 +20036,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = MyISAM, PARTITION part_2 ENGINE = MyISAM, PARTITION part_3 ENGINE = MyISAM, PARTITION part_4 ENGINE = MyISAM, - PARTITION part_5 ENGINE = MyISAM) */ + PARTITION part_5 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -20521,7 +20521,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -20529,7 +20529,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -21013,13 +21013,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_1 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION part_4 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -21495,13 +21495,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -21987,7 +21987,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -22000,7 +22000,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#subpart11.MYD @@ -22484,7 +22484,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -22497,7 +22497,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#sp11.MYD @@ -22979,12 +22979,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = MyISAM, PARTITION part_2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -23466,9 +23466,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = MyISAM, - PARTITION part_2 ENGINE = MyISAM) */ + PARTITION part_2 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -23934,12 +23934,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = MyISAM, PARTITION part_2 ENGINE = MyISAM, PARTITION part_3 ENGINE = MyISAM, PARTITION part_4 ENGINE = MyISAM, - PARTITION part_5 ENGINE = MyISAM) */ + PARTITION part_5 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -24419,7 +24419,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -24427,7 +24427,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -24911,13 +24911,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_1 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION part_4 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -25393,13 +25393,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -25885,7 +25885,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -25898,7 +25898,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#subpart11.MYD @@ -26382,7 +26382,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -26395,7 +26395,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#sp11.MYD @@ -26877,12 +26877,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = MyISAM, PARTITION part_2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -27364,9 +27364,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = MyISAM, - PARTITION part_2 ENGINE = MyISAM) */ + PARTITION part_2 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -27832,12 +27832,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = MyISAM, PARTITION part_2 ENGINE = MyISAM, PARTITION part_3 ENGINE = MyISAM, PARTITION part_4 ENGINE = MyISAM, - PARTITION part_5 ENGINE = MyISAM) */ + PARTITION part_5 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -28317,7 +28317,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -28325,7 +28325,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -28809,13 +28809,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_1 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION part_4 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -29291,13 +29291,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -29783,7 +29783,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -29796,7 +29796,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#subpart11.MYD @@ -30280,7 +30280,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -30293,7 +30293,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#sp11.MYD @@ -30775,12 +30775,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = MyISAM, PARTITION part_2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -31262,9 +31262,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = MyISAM, - PARTITION part_2 ENGINE = MyISAM) */ + PARTITION part_2 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -31730,12 +31730,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = MyISAM, PARTITION part_2 ENGINE = MyISAM, PARTITION part_3 ENGINE = MyISAM, PARTITION part_4 ENGINE = MyISAM, - PARTITION part_5 ENGINE = MyISAM) */ + PARTITION part_5 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -32215,7 +32215,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -32223,7 +32223,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -32707,13 +32707,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_1 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION part_4 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -33189,13 +33189,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -33681,7 +33681,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -33694,7 +33694,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#subpart11.MYD @@ -34178,7 +34178,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -34191,7 +34191,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#sp11.MYD @@ -34673,12 +34673,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = MyISAM, PARTITION part_2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -35160,9 +35160,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = MyISAM, - PARTITION part_2 ENGINE = MyISAM) */ + PARTITION part_2 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -35628,12 +35628,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = MyISAM, PARTITION part_2 ENGINE = MyISAM, PARTITION part_3 ENGINE = MyISAM, PARTITION part_4 ENGINE = MyISAM, - PARTITION part_5 ENGINE = MyISAM) */ + PARTITION part_5 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -36113,7 +36113,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -36121,7 +36121,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -36605,13 +36605,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_1 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION part_4 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -37087,13 +37087,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -37579,7 +37579,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -37592,7 +37592,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#subpart11.MYD @@ -38076,7 +38076,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -38089,7 +38089,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#sp11.MYD @@ -38571,12 +38571,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = MyISAM, PARTITION part_2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -39061,9 +39061,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = MyISAM, - PARTITION part_2 ENGINE = MyISAM) */ + PARTITION part_2 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -39529,12 +39529,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = MyISAM, PARTITION part_2 ENGINE = MyISAM, PARTITION part_3 ENGINE = MyISAM, PARTITION part_4 ENGINE = MyISAM, - PARTITION part_5 ENGINE = MyISAM) */ + PARTITION part_5 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -40014,7 +40014,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -40022,7 +40022,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -40506,13 +40506,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_1 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION part_4 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -40988,13 +40988,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -41480,7 +41480,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -41493,7 +41493,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#subpart11.MYD @@ -41977,7 +41977,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -41990,7 +41990,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#sp11.MYD @@ -42472,12 +42472,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = MyISAM, PARTITION part_2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -42959,9 +42959,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = MyISAM, - PARTITION part_2 ENGINE = MyISAM) */ + PARTITION part_2 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -43427,12 +43427,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = MyISAM, PARTITION part_2 ENGINE = MyISAM, PARTITION part_3 ENGINE = MyISAM, PARTITION part_4 ENGINE = MyISAM, - PARTITION part_5 ENGINE = MyISAM) */ + PARTITION part_5 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -43912,7 +43912,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -43920,7 +43920,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -44404,13 +44404,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_1 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION part_4 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -44886,13 +44886,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -45378,7 +45378,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -45391,7 +45391,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#subpart11.MYD @@ -45875,7 +45875,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -45888,7 +45888,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#sp11.MYD @@ -46370,12 +46370,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = MyISAM, PARTITION part_2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -46857,9 +46857,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = MyISAM, - PARTITION part_2 ENGINE = MyISAM) */ + PARTITION part_2 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -47325,12 +47325,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = MyISAM, PARTITION part_2 ENGINE = MyISAM, PARTITION part_3 ENGINE = MyISAM, PARTITION part_4 ENGINE = MyISAM, - PARTITION part_5 ENGINE = MyISAM) */ + PARTITION part_5 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -47810,7 +47810,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -47818,7 +47818,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -48302,13 +48302,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_1 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION part_4 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -48784,13 +48784,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -49276,7 +49276,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -49289,7 +49289,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#subpart11.MYD @@ -49773,7 +49773,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -49786,7 +49786,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#sp11.MYD @@ -50268,12 +50268,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = MyISAM, PARTITION part_2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -50755,9 +50755,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = MyISAM, - PARTITION part_2 ENGINE = MyISAM) */ + PARTITION part_2 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -51223,12 +51223,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = MyISAM, PARTITION part_2 ENGINE = MyISAM, PARTITION part_3 ENGINE = MyISAM, PARTITION part_4 ENGINE = MyISAM, - PARTITION part_5 ENGINE = MyISAM) */ + PARTITION part_5 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -51708,7 +51708,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -51716,7 +51716,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -52200,13 +52200,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_1 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION part_4 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -52682,13 +52682,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -53174,7 +53174,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -53187,7 +53187,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#subpart11.MYD @@ -53671,7 +53671,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -53684,7 +53684,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#sp11.MYD @@ -54166,12 +54166,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = MyISAM, PARTITION part_2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -54653,9 +54653,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = MyISAM, - PARTITION part_2 ENGINE = MyISAM) */ + PARTITION part_2 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -55121,12 +55121,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = MyISAM, PARTITION part_2 ENGINE = MyISAM, PARTITION part_3 ENGINE = MyISAM, PARTITION part_4 ENGINE = MyISAM, - PARTITION part_5 ENGINE = MyISAM) */ + PARTITION part_5 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -55606,7 +55606,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -55614,7 +55614,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -56098,13 +56098,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_1 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION part_4 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -56580,13 +56580,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -57072,7 +57072,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -57085,7 +57085,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#subpart11.MYD @@ -57569,7 +57569,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -57582,7 +57582,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#sp11.MYD @@ -58064,12 +58064,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = MyISAM, PARTITION part_2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -58552,9 +58552,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = MyISAM, - PARTITION part_2 ENGINE = MyISAM) */ + PARTITION part_2 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -59018,12 +59018,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = MyISAM, PARTITION part_2 ENGINE = MyISAM, PARTITION part_3 ENGINE = MyISAM, PARTITION part_4 ENGINE = MyISAM, - PARTITION part_5 ENGINE = MyISAM) */ + PARTITION part_5 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -59501,7 +59501,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -59509,7 +59509,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -59991,13 +59991,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_1 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION part_4 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -60471,13 +60471,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -60961,7 +60961,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -60974,7 +60974,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#subpart11.MYD @@ -61456,7 +61456,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -61469,7 +61469,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#sp11.MYD @@ -61949,12 +61949,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = MyISAM, PARTITION part_2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -62434,9 +62434,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = MyISAM, - PARTITION part_2 ENGINE = MyISAM) */ + PARTITION part_2 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -62900,12 +62900,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = MyISAM, PARTITION part_2 ENGINE = MyISAM, PARTITION part_3 ENGINE = MyISAM, PARTITION part_4 ENGINE = MyISAM, - PARTITION part_5 ENGINE = MyISAM) */ + PARTITION part_5 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -63383,7 +63383,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -63391,7 +63391,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -63873,13 +63873,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_1 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION part_4 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -64353,13 +64353,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -64843,7 +64843,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -64856,7 +64856,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#subpart11.MYD @@ -65338,7 +65338,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -65351,7 +65351,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#sp11.MYD @@ -65831,12 +65831,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = MyISAM, PARTITION part_2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -66636,9 +66636,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = MyISAM, - PARTITION part_2 ENGINE = MyISAM) */ + PARTITION part_2 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -67102,12 +67102,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = MyISAM, PARTITION part_2 ENGINE = MyISAM, PARTITION part_3 ENGINE = MyISAM, PARTITION part_4 ENGINE = MyISAM, - PARTITION part_5 ENGINE = MyISAM) */ + PARTITION part_5 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -67585,7 +67585,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -67593,7 +67593,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -68075,13 +68075,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_1 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION part_4 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -68555,13 +68555,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -69045,7 +69045,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -69058,7 +69058,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#subpart11.MYD @@ -69540,7 +69540,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -69553,7 +69553,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#sp11.MYD @@ -70033,12 +70033,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = MyISAM, PARTITION part_2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -70523,9 +70523,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = MyISAM, - PARTITION part_2 ENGINE = MyISAM) */ + PARTITION part_2 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -70991,12 +70991,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = MyISAM, PARTITION part_2 ENGINE = MyISAM, PARTITION part_3 ENGINE = MyISAM, PARTITION part_4 ENGINE = MyISAM, - PARTITION part_5 ENGINE = MyISAM) */ + PARTITION part_5 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -71476,7 +71476,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -71484,7 +71484,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -71968,13 +71968,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_1 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION part_4 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -72450,13 +72450,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -72942,7 +72942,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -72955,7 +72955,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#subpart11.MYD @@ -73439,7 +73439,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -73452,7 +73452,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#sp11.MYD @@ -73934,12 +73934,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = MyISAM, PARTITION part_2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -74421,9 +74421,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = MyISAM, - PARTITION part_2 ENGINE = MyISAM) */ + PARTITION part_2 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -74889,12 +74889,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = MyISAM, PARTITION part_2 ENGINE = MyISAM, PARTITION part_3 ENGINE = MyISAM, PARTITION part_4 ENGINE = MyISAM, - PARTITION part_5 ENGINE = MyISAM) */ + PARTITION part_5 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -75374,7 +75374,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -75382,7 +75382,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -75866,13 +75866,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_1 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION part_4 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -76348,13 +76348,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -76840,7 +76840,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -76853,7 +76853,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#subpart11.MYD @@ -77337,7 +77337,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -77350,7 +77350,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#sp11.MYD @@ -77832,12 +77832,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = MyISAM, PARTITION part_2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -78319,9 +78319,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = MyISAM, - PARTITION part_2 ENGINE = MyISAM) */ + PARTITION part_2 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -78787,12 +78787,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = MyISAM, PARTITION part_2 ENGINE = MyISAM, PARTITION part_3 ENGINE = MyISAM, PARTITION part_4 ENGINE = MyISAM, - PARTITION part_5 ENGINE = MyISAM) */ + PARTITION part_5 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -79272,7 +79272,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -79280,7 +79280,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -79764,13 +79764,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_1 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION part_4 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -80246,13 +80246,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -80738,7 +80738,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -80751,7 +80751,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#subpart11.MYD @@ -81235,7 +81235,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -81248,7 +81248,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#sp11.MYD @@ -81730,12 +81730,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = MyISAM, PARTITION part_2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -82217,9 +82217,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = MyISAM, - PARTITION part_2 ENGINE = MyISAM) */ + PARTITION part_2 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -82685,12 +82685,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = MyISAM, PARTITION part_2 ENGINE = MyISAM, PARTITION part_3 ENGINE = MyISAM, PARTITION part_4 ENGINE = MyISAM, - PARTITION part_5 ENGINE = MyISAM) */ + PARTITION part_5 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -83170,7 +83170,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -83178,7 +83178,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -83662,13 +83662,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_1 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION part_4 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -84144,13 +84144,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -84636,7 +84636,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -84649,7 +84649,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#subpart11.MYD @@ -85133,7 +85133,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -85146,7 +85146,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#sp11.MYD @@ -85628,12 +85628,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = MyISAM, PARTITION part_2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -86115,9 +86115,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part_1 ENGINE = MyISAM, - PARTITION part_2 ENGINE = MyISAM) */ + PARTITION part_2 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -86583,12 +86583,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION part_1 ENGINE = MyISAM, PARTITION part_2 ENGINE = MyISAM, PARTITION part_3 ENGINE = MyISAM, PARTITION part_4 ENGINE = MyISAM, - PARTITION part_5 ENGINE = MyISAM) */ + PARTITION part_5 ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -87068,7 +87068,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -87076,7 +87076,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -87560,13 +87560,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_1 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION part_4 VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_5 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1.MYD @@ -88042,13 +88042,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part_1 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION part_2 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION part_3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part_4 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD @@ -88534,7 +88534,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part_1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -88547,7 +88547,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part_4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#subpart11.MYD @@ -89031,7 +89031,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part_1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -89044,7 +89044,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part_4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part_1#SP#sp11.MYD @@ -89526,12 +89526,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part_1 VALUES IN (0) ENGINE = MyISAM, PARTITION part_2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part_3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part_1#SP#part_1sp0.MYD diff --git a/mysql-test/suite/parts/r/partition_auto_increment_archive.result b/mysql-test/suite/parts/r/partition_auto_increment_archive.result index c9a2103f2ce..7497e7d9cea 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_archive.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_archive.result @@ -135,8 +135,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=ARCHIVE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1; c1 1 @@ -341,8 +341,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=ARCHIVE AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 2 @@ -365,8 +365,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=ARCHIVE AUTO_INCREMENT=28 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 2 @@ -394,8 +394,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; # Test with two threads connection default; @@ -646,8 +646,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=ARCHIVE AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (4); # ERROR (only OK if Archive) mysql_errno: 1022 SHOW CREATE TABLE t1; @@ -656,8 +656,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=ARCHIVE AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); SHOW CREATE TABLE t1; Table Create Table @@ -665,8 +665,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=ARCHIVE AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -674,8 +674,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=ARCHIVE AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 15 @@ -689,8 +689,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=ARCHIVE AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); # ERROR (only OK if Archive) mysql_errno: 1022 SHOW CREATE TABLE t1; @@ -699,8 +699,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=ARCHIVE AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -708,8 +708,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=ARCHIVE AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 15 @@ -729,8 +729,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -738,8 +738,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=ARCHIVE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1; c1 1 @@ -750,8 +750,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=ARCHIVE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -759,8 +759,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=ARCHIVE AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SET INSERT_ID = 22; INSERT INTO t1 VALUES (NULL), (NULL), (NULL); INSERT INTO t1 VALUES (NULL); @@ -784,8 +784,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 FLUSH TABLE; SHOW CREATE TABLE t1; Table Create Table @@ -793,8 +793,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 VALUES (4); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -803,8 +803,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=ARCHIVE AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 VALUES (NULL); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -813,8 +813,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=ARCHIVE AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 4 diff --git a/mysql-test/suite/parts/r/partition_auto_increment_blackhole.result b/mysql-test/suite/parts/r/partition_auto_increment_blackhole.result index e1d5814dc45..639748e7977 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_blackhole.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_blackhole.result @@ -166,8 +166,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=BLACKHOLE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1; c1 DROP TABLE t1; @@ -324,8 +324,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=BLACKHOLE AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 TRUNCATE TABLE t1; @@ -336,8 +336,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=BLACKHOLE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 INSERT INTO t1 VALUES (100); @@ -352,8 +352,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; # Test with two threads connection default; @@ -534,8 +534,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (4); SHOW CREATE TABLE t1; Table Create Table @@ -543,8 +543,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=BLACKHOLE AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); SHOW CREATE TABLE t1; Table Create Table @@ -552,8 +552,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=BLACKHOLE AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -561,8 +561,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=BLACKHOLE AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 # Test sql_mode 'NO_AUTO_VALUE_ON_ZERO' @@ -574,8 +574,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=BLACKHOLE AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); SHOW CREATE TABLE t1; Table Create Table @@ -583,8 +583,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=BLACKHOLE AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -592,8 +592,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=BLACKHOLE AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 SET @@session.sql_mode = ''; @@ -609,8 +609,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -618,8 +618,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=BLACKHOLE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1; c1 SET INSERT_ID = 23; @@ -629,8 +629,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=BLACKHOLE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -638,8 +638,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=BLACKHOLE AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SET INSERT_ID = 22; INSERT INTO t1 VALUES (NULL), (NULL), (NULL); # ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY @@ -661,8 +661,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 FLUSH TABLE; SHOW CREATE TABLE t1; Table Create Table @@ -670,8 +670,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 VALUES (4); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -680,8 +680,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 VALUES (NULL); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -690,8 +690,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 DROP TABLE t1; diff --git a/mysql-test/suite/parts/r/partition_auto_increment_innodb.result b/mysql-test/suite/parts/r/partition_auto_increment_innodb.result index 63bd8a83b70..a6af2b924c0 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_innodb.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_innodb.result @@ -43,7 +43,7 @@ UPDATE t1 SET c1 = 40 WHERE c1 = 50; SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; AUTO_INCREMENT -32 +52 UPDATE t1 SET c1 = NULL WHERE c1 = 4; Warnings: Warning 1048 Column 'c1' cannot be null @@ -62,10 +62,10 @@ c1 25 30 31 -32 -33 40 51 +52 +53 DROP TABLE t1; CREATE TABLE t1 ( c1 INT NOT NULL AUTO_INCREMENT, @@ -186,8 +186,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1; c1 1 @@ -255,7 +255,7 @@ UPDATE t1 SET c1 = 140 WHERE c1 = 150; SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; AUTO_INCREMENT -141 +152 UPDATE t1 SET c1 = NULL WHERE c1 = 4; Warnings: Warning 1048 Column 'c1' cannot be null @@ -279,9 +279,9 @@ c1 90 91 140 -141 -142 151 +152 +153 DROP TABLE t1; # Test with auto_increment_increment and auto_increment_offset. CREATE TABLE t1 ( @@ -410,8 +410,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 26 @@ -423,8 +423,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 1 @@ -441,8 +441,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; # Test with two threads connection default; @@ -701,8 +701,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (4); SHOW CREATE TABLE t1; Table Create Table @@ -710,8 +710,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); SHOW CREATE TABLE t1; Table Create Table @@ -719,8 +719,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -728,8 +728,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 4 @@ -744,8 +744,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); SHOW CREATE TABLE t1; Table Create Table @@ -753,8 +753,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -762,8 +762,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 0 @@ -785,8 +785,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -794,8 +794,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1; c1 1 @@ -806,8 +806,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -815,8 +815,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SET INSERT_ID = 22; INSERT INTO t1 VALUES (NULL), (NULL), (NULL); INSERT INTO t1 VALUES (NULL); @@ -839,8 +839,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 FLUSH TABLE; SHOW CREATE TABLE t1; Table Create Table @@ -848,8 +848,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 VALUES (4); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -858,8 +858,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 VALUES (NULL); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -868,8 +868,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 4 diff --git a/mysql-test/suite/parts/r/partition_auto_increment_maria.result b/mysql-test/suite/parts/r/partition_auto_increment_maria.result index 9a38ae6b8d5..6fdbdeb2653 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_maria.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_maria.result @@ -186,8 +186,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=Aria AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1; c1 1 @@ -410,8 +410,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=Aria AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 26 @@ -423,8 +423,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=Aria AUTO_INCREMENT=28 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 27 @@ -440,8 +440,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=Aria AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; # Test with two threads connection default; @@ -747,8 +747,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=Aria AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (4); SHOW CREATE TABLE t1; Table Create Table @@ -756,8 +756,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=Aria AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); SHOW CREATE TABLE t1; Table Create Table @@ -765,8 +765,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=Aria AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -774,8 +774,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=Aria AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 4 @@ -790,8 +790,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=Aria AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); SHOW CREATE TABLE t1; Table Create Table @@ -799,8 +799,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=Aria AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -808,8 +808,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=Aria AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 0 @@ -831,8 +831,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -840,8 +840,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=Aria AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1; c1 1 @@ -852,8 +852,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=Aria AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -861,8 +861,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=Aria AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SET INSERT_ID = 22; INSERT INTO t1 VALUES (NULL), (NULL), (NULL); INSERT INTO t1 VALUES (NULL); @@ -886,8 +886,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 FLUSH TABLE; SHOW CREATE TABLE t1; Table Create Table @@ -895,8 +895,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=Aria DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 VALUES (4); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -905,8 +905,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=Aria AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 VALUES (NULL); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -915,8 +915,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=Aria AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 4 diff --git a/mysql-test/suite/parts/r/partition_auto_increment_memory.result b/mysql-test/suite/parts/r/partition_auto_increment_memory.result index e6240f1bb40..62ab0c1ca51 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_memory.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_memory.result @@ -186,8 +186,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1; c1 1 @@ -410,8 +410,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MEMORY AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 26 @@ -423,8 +423,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 1 @@ -440,8 +440,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MEMORY AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; # Test with two threads connection default; @@ -728,8 +728,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MEMORY AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (4); SHOW CREATE TABLE t1; Table Create Table @@ -737,8 +737,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MEMORY AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); SHOW CREATE TABLE t1; Table Create Table @@ -746,8 +746,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MEMORY AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -755,8 +755,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MEMORY AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 4 @@ -771,8 +771,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MEMORY AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); SHOW CREATE TABLE t1; Table Create Table @@ -780,8 +780,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MEMORY AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -789,8 +789,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MEMORY AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 0 @@ -812,8 +812,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -821,8 +821,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1; c1 1 @@ -833,8 +833,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -842,8 +842,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MEMORY AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SET INSERT_ID = 22; INSERT INTO t1 VALUES (NULL), (NULL), (NULL); INSERT INTO t1 VALUES (NULL); @@ -867,8 +867,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 FLUSH TABLE; SHOW CREATE TABLE t1; Table Create Table @@ -876,8 +876,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 VALUES (4); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -886,8 +886,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MEMORY AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 VALUES (NULL); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -896,8 +896,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MEMORY AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 4 diff --git a/mysql-test/suite/parts/r/partition_auto_increment_myisam.result b/mysql-test/suite/parts/r/partition_auto_increment_myisam.result index 32e75205f3b..27cf857abb0 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_myisam.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_myisam.result @@ -186,8 +186,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1; c1 1 @@ -410,8 +410,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MyISAM AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 26 @@ -423,8 +423,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 1 @@ -440,8 +440,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MyISAM AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 DROP TABLE t1; # Test with two threads connection default; @@ -747,8 +747,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (4); SHOW CREATE TABLE t1; Table Create Table @@ -756,8 +756,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); SHOW CREATE TABLE t1; Table Create Table @@ -765,8 +765,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -774,8 +774,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 4 @@ -790,8 +790,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MyISAM AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); SHOW CREATE TABLE t1; Table Create Table @@ -799,8 +799,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MyISAM AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -808,8 +808,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MyISAM AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 0 @@ -831,8 +831,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -840,8 +840,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1; c1 1 @@ -852,8 +852,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table @@ -861,8 +861,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MyISAM AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SET INSERT_ID = 22; INSERT INTO t1 VALUES (NULL), (NULL), (NULL); INSERT INTO t1 VALUES (NULL); @@ -886,8 +886,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 FLUSH TABLE; SHOW CREATE TABLE t1; Table Create Table @@ -895,8 +895,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 VALUES (4); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -905,8 +905,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 INSERT INTO t1 VALUES (NULL); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -915,8 +915,8 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) -PARTITIONS 2 */ + PARTITION BY HASH (c1) +PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 4 diff --git a/mysql-test/suite/parts/r/partition_basic_innodb.result b/mysql-test/suite/parts/r/partition_basic_innodb.result index 5bfda948ca4..d8872e16d5e 100644 --- a/mysql-test/suite/parts/r/partition_basic_innodb.result +++ b/mysql-test/suite/parts/r/partition_basic_innodb.result @@ -73,8 +73,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 unified filelist t1#P#p0.ibd @@ -530,8 +530,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 unified filelist t1#P#p0.ibd @@ -998,7 +998,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -1006,7 +1006,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) unified filelist t1#P#part0.ibd @@ -1474,13 +1474,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) unified filelist t1#P#parta.ibd @@ -1942,13 +1942,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) unified filelist t1#P#parta#SP#partasp0.ibd @@ -2418,7 +2418,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -2431,7 +2431,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) unified filelist t1#P#part1#SP#subpart11.ibd @@ -2903,7 +2903,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -2916,7 +2916,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) unified filelist t1#P#part1#SP#sp11.ibd @@ -3382,12 +3382,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) unified filelist t1#P#part1#SP#part1sp0.ibd @@ -3852,8 +3852,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 unified filelist t1#P#p0.ibd @@ -4309,8 +4309,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 unified filelist t1#P#p0.ibd @@ -4777,7 +4777,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -4785,7 +4785,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) unified filelist t1#P#part0.ibd @@ -5253,13 +5253,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) unified filelist t1#P#parta.ibd @@ -5721,13 +5721,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) unified filelist t1#P#parta#SP#partasp0.ibd @@ -6195,7 +6195,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -6208,7 +6208,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) unified filelist t1#P#part1#SP#subpart11.ibd @@ -6676,7 +6676,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -6689,7 +6689,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) unified filelist t1#P#part1#SP#sp11.ibd @@ -7155,12 +7155,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) unified filelist t1#P#part1#SP#part1sp0.ibd @@ -7631,8 +7631,8 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 unified filelist t1#P#p0.ibd @@ -8125,8 +8125,8 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 unified filelist t1#P#p0.ibd @@ -8630,7 +8630,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -8638,7 +8638,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) unified filelist t1#P#part0.ibd @@ -9143,13 +9143,13 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) unified filelist t1#P#parta.ibd @@ -9648,13 +9648,13 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) unified filelist t1#P#parta#SP#partasp0.ibd @@ -10161,7 +10161,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -10174,7 +10174,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) unified filelist t1#P#part1#SP#subpart11.ibd @@ -10683,7 +10683,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -10696,7 +10696,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) unified filelist t1#P#part1#SP#sp11.ibd @@ -11199,12 +11199,12 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) unified filelist t1#P#part1#SP#part1sp0.ibd @@ -11705,8 +11705,8 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 unified filelist t1#P#p0.ibd @@ -12199,8 +12199,8 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 unified filelist t1#P#p0.ibd @@ -12704,7 +12704,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -12712,7 +12712,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) unified filelist t1#P#part0.ibd @@ -13217,13 +13217,13 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) unified filelist t1#P#parta.ibd @@ -13722,13 +13722,13 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) unified filelist t1#P#parta#SP#partasp0.ibd @@ -14235,7 +14235,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -14248,7 +14248,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) unified filelist t1#P#part1#SP#subpart11.ibd @@ -14757,7 +14757,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -14770,7 +14770,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) unified filelist t1#P#part1#SP#sp11.ibd @@ -15273,12 +15273,12 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) unified filelist t1#P#part1#SP#part1sp0.ibd @@ -15779,8 +15779,8 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 unified filelist t1#P#p0.ibd @@ -16289,8 +16289,8 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 unified filelist t1#P#p0.ibd @@ -16810,7 +16810,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -16818,7 +16818,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) unified filelist t1#P#part0.ibd @@ -17339,13 +17339,13 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) unified filelist t1#P#parta.ibd @@ -17860,13 +17860,13 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) unified filelist t1#P#parta#SP#partasp0.ibd @@ -18389,7 +18389,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -18402,7 +18402,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) unified filelist t1#P#part1#SP#subpart11.ibd @@ -18927,7 +18927,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -18940,7 +18940,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) unified filelist t1#P#part1#SP#sp11.ibd @@ -19459,12 +19459,12 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) unified filelist t1#P#part1#SP#part1sp0.ibd @@ -19986,8 +19986,8 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 unified filelist t1#P#p0.ibd @@ -20480,8 +20480,8 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 unified filelist t1#P#p0.ibd @@ -20985,7 +20985,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -20993,7 +20993,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) unified filelist t1#P#part0.ibd @@ -21498,13 +21498,13 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) unified filelist t1#P#parta.ibd @@ -22003,13 +22003,13 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) unified filelist t1#P#parta#SP#partasp0.ibd @@ -22514,7 +22514,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -22527,7 +22527,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) unified filelist t1#P#part1#SP#subpart11.ibd @@ -23032,7 +23032,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -23045,7 +23045,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) unified filelist t1#P#part1#SP#sp11.ibd @@ -23548,12 +23548,12 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) unified filelist t1#P#part1#SP#part1sp0.ibd @@ -24054,8 +24054,8 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 unified filelist t1#P#p0.ibd @@ -24548,8 +24548,8 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 unified filelist t1#P#p0.ibd @@ -25053,7 +25053,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -25061,7 +25061,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) unified filelist t1#P#part0.ibd @@ -25566,13 +25566,13 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) unified filelist t1#P#parta.ibd @@ -26071,13 +26071,13 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) unified filelist t1#P#parta#SP#partasp0.ibd @@ -26582,7 +26582,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -26595,7 +26595,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) unified filelist t1#P#part1#SP#subpart11.ibd @@ -27100,7 +27100,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -27113,7 +27113,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) unified filelist t1#P#part1#SP#sp11.ibd @@ -27616,12 +27616,12 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) unified filelist t1#P#part1#SP#part1sp0.ibd @@ -28122,8 +28122,8 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 unified filelist t1#P#p0.ibd @@ -28632,8 +28632,8 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 unified filelist t1#P#p0.ibd @@ -29153,7 +29153,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, @@ -29161,7 +29161,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, - PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (3) ENGINE = InnoDB) unified filelist t1#P#part0.ibd @@ -29682,13 +29682,13 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) unified filelist t1#P#parta.ibd @@ -30203,13 +30203,13 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) unified filelist t1#P#parta#SP#partasp0.ibd @@ -30730,7 +30730,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -30743,7 +30743,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, - SUBPARTITION subpart42 ENGINE = InnoDB)) */ + SUBPARTITION subpart42 ENGINE = InnoDB)) unified filelist t1#P#part1#SP#subpart11.ibd @@ -31264,7 +31264,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, @@ -31277,7 +31277,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, - SUBPARTITION sp42 ENGINE = InnoDB)) */ + SUBPARTITION sp42 ENGINE = InnoDB)) unified filelist t1#P#part1#SP#sp11.ibd @@ -31796,12 +31796,12 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, - PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) unified filelist t1#P#part1#SP#part1sp0.ibd diff --git a/mysql-test/suite/parts/r/partition_basic_myisam.result b/mysql-test/suite/parts/r/partition_basic_myisam.result index 3351201ea06..69799a07076 100644 --- a/mysql-test/suite/parts/r/partition_basic_myisam.result +++ b/mysql-test/suite/parts/r/partition_basic_myisam.result @@ -73,8 +73,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -533,8 +533,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -1007,7 +1007,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -1015,7 +1015,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -1492,13 +1492,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -1967,13 +1967,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -2452,7 +2452,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -2465,7 +2465,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -2946,7 +2946,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -2959,7 +2959,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -3434,12 +3434,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -3914,8 +3914,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -4374,8 +4374,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -4848,7 +4848,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -4856,7 +4856,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -5333,13 +5333,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -5808,13 +5808,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -6291,7 +6291,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -6304,7 +6304,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -6781,7 +6781,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -6794,7 +6794,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -7269,12 +7269,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -7755,8 +7755,8 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -8268,8 +8268,8 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -8795,7 +8795,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -8803,7 +8803,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -9333,13 +9333,13 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -9861,13 +9861,13 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -10399,7 +10399,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -10412,7 +10412,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -10946,7 +10946,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -10959,7 +10959,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -11487,12 +11487,12 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -12024,8 +12024,8 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1 + f_int2) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -12537,8 +12537,8 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) -PARTITIONS 5 */ + PARTITION BY KEY (f_int1,f_int2) +PARTITIONS 5 unified filelist t1#P#p0.MYD @@ -13064,7 +13064,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, @@ -13072,7 +13072,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -13602,13 +13602,13 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -14130,13 +14130,13 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -14666,7 +14666,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -14679,7 +14679,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -15209,7 +15209,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, @@ -15222,7 +15222,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, - SUBPARTITION sp42 ENGINE = MyISAM)) */ + SUBPARTITION sp42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -15750,12 +15750,12 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD diff --git a/mysql-test/suite/parts/r/partition_basic_symlink_innodb.result b/mysql-test/suite/parts/r/partition_basic_symlink_innodb.result index d7a77e5e54a..f1c2a7d9af4 100644 --- a/mysql-test/suite/parts/r/partition_basic_symlink_innodb.result +++ b/mysql-test/suite/parts/r/partition_basic_symlink_innodb.result @@ -70,9 +70,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) + PARTITION BY HASH (c1) (PARTITION p0 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB, - PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB) */ + PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB) # # Verify that the DATA/INDEX DIRECTORY is stored and used if we # ALTER TABLE to MyISAM. @@ -83,9 +83,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) + PARTITION BY HASH (c1) (PARTITION p0 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = MyISAM, - PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = MyISAM) */ + PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = MyISAM) # Verifying .frm, .par and MyISAM files (.MYD, MYI) ---- MYSQLD_DATADIR/test t1#P#p0.MYD @@ -110,9 +110,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (c1) + PARTITION BY HASH (c1) (PARTITION p0 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB, - PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB) */ + PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB) # Verifying .frm, .par, .isl and InnoDB .ibd files ---- MYSQLD_DATADIR/test t1#P#p0.isl diff --git a/mysql-test/suite/parts/r/partition_basic_symlink_myisam.result b/mysql-test/suite/parts/r/partition_basic_symlink_myisam.result index 1c1a758f985..89ebd5652e7 100644 --- a/mysql-test/suite/parts/r/partition_basic_symlink_myisam.result +++ b/mysql-test/suite/parts/r/partition_basic_symlink_myisam.result @@ -83,9 +83,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#p1.MYD @@ -563,12 +563,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#p1.MYD @@ -1059,7 +1059,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -1067,7 +1067,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -1572,13 +1572,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -2067,13 +2067,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -2572,7 +2572,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -2585,7 +2585,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM)) */ + SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -3102,7 +3102,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -3115,7 +3115,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM)) */ + SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -3612,12 +3612,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -4116,9 +4116,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) + PARTITION BY HASH (f_int1 + f_int2) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#p1.MYD @@ -4596,12 +4596,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) + PARTITION BY KEY (f_int1,f_int2) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#p1.MYD @@ -5092,7 +5092,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -5100,7 +5100,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -5605,13 +5605,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -6100,13 +6100,13 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -6603,7 +6603,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -6616,7 +6616,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM)) */ + SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -7133,7 +7133,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -7146,7 +7146,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM)) */ + SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -7643,12 +7643,12 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -8153,9 +8153,9 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#p1.MYD @@ -8686,12 +8686,12 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1) + PARTITION BY KEY (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#p1.MYD @@ -9235,7 +9235,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -9243,7 +9243,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -9801,13 +9801,13 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -10349,13 +10349,13 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -10907,7 +10907,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -10920,7 +10920,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM)) */ + SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -11490,7 +11490,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -11503,7 +11503,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM)) */ + SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -12053,12 +12053,12 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -12614,9 +12614,9 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1 + f_int2) + PARTITION BY HASH (f_int1 + f_int2) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#p1.MYD @@ -13147,12 +13147,12 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (f_int1,f_int2) + PARTITION BY KEY (f_int1,f_int2) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#p1.MYD @@ -13696,7 +13696,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) + PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -13704,7 +13704,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -14262,13 +14262,13 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) + PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -14810,13 +14810,13 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -15366,7 +15366,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -15379,7 +15379,7 @@ SUBPARTITION BY KEY (f_int2) SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM)) */ + SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -15949,7 +15949,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -15962,7 +15962,7 @@ SUBPARTITION BY HASH (f_int2 + 1) SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM)) */ + SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD @@ -16512,12 +16512,12 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) + PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -17069,9 +17069,9 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION p1 INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - PARTITION p2 INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION p2 INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#p1.MYD @@ -17595,12 +17595,12 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = MyISAM, PARTITION p2 INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION p4 ENGINE = MyISAM, - PARTITION p5 INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION p5 INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#p1.MYD @@ -18139,7 +18139,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,4)) + PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -18147,7 +18147,7 @@ t1 CREATE TABLE `t1` ( PARTITION part0 VALUES IN (0) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = MyISAM, - PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#part0.MYD @@ -18692,13 +18692,13 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = MyISAM, - PARTITION partf VALUES LESS THAN (2147483646) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION partf VALUES LESS THAN (2147483646) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#parta.MYD @@ -19230,13 +19230,13 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1 DIV 2) + PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) */ + PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) unified filelist t1#P#parta#SP#partasp0.MYD @@ -19781,7 +19781,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = MyISAM, @@ -19794,7 +19794,7 @@ SUBPARTITION BY KEY (f_int1) SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, - SUBPARTITION subpart42 ENGINE = MyISAM)) */ + SUBPARTITION subpart42 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -20324,7 +20324,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) + PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -20337,7 +20337,7 @@ SUBPARTITION BY HASH (f_int1 + 1) SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, - SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM)) */ + SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM)) unified filelist t1#P#part1#SP#sp11.MYD diff --git a/mysql-test/suite/parts/r/partition_bit_innodb.result b/mysql-test/suite/parts/r/partition_bit_innodb.result index 558b5b3aae4..187b4a13d05 100644 --- a/mysql-test/suite/parts/r/partition_bit_innodb.result +++ b/mysql-test/suite/parts/r/partition_bit_innodb.result @@ -9,7 +9,7 @@ t1 CREATE TABLE `t1` ( `a` bit(1) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) */ + PARTITION BY KEY (a) drop table t1; create table t1 (a bit(0), primary key (a)) engine='INNODB' partition by key (a) ( @@ -21,9 +21,9 @@ t1 CREATE TABLE `t1` ( `a` bit(1) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 ENGINE = InnoDB, - PARTITION pa2 ENGINE = InnoDB) */ + PARTITION pa2 ENGINE = InnoDB) drop table t1; create table t1 (a bit(64), primary key (a)) engine='INNODB' partition by key (a) partitions 2; @@ -33,8 +33,8 @@ t1 CREATE TABLE `t1` ( `a` bit(64) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 2 */ + PARTITION BY KEY (a) +PARTITIONS 2 insert into t1 values (b'1111111111111111111111111111111111111111111111111111111111111111'), (b'1000000000000000000000000000000000000000000000000000000000000000'), @@ -61,11 +61,11 @@ t1 CREATE TABLE `t1` ( `a` bit(64) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) insert into t1 values (b'1111111111111111111111111111111111111111111111111111111111111111'), (b'1000000000000000000000000000000000000000000000000000000000000000'), @@ -91,8 +91,8 @@ t2 CREATE TABLE `t2` ( `a` bit(1) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 4 */ + PARTITION BY KEY (a) +PARTITIONS 4 insert into t2 values (b'0'), (b'1'); select hex(a) from t2; hex(a) @@ -104,8 +104,8 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` bit(1) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 4 */ + PARTITION BY KEY (a) +PARTITIONS 4 select hex(a) from t2; hex(a) 0 @@ -117,8 +117,8 @@ t2 CREATE TABLE `t2` ( `a` bit(1) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 4 */ + PARTITION BY KEY (a) +PARTITIONS 4 select hex(a) from t2; hex(a) 0 @@ -136,13 +136,13 @@ t3 CREATE TABLE `t3` ( `a` bit(8) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) SUBPARTITION BY KEY (a) SUBPARTITIONS 2 (PARTITION pa1 VALUES LESS THAN (3) ENGINE = InnoDB, PARTITION pa2 VALUES LESS THAN (16) ENGINE = InnoDB, PARTITION pa3 VALUES LESS THAN (64) ENGINE = InnoDB, - PARTITION pa4 VALUES LESS THAN (256) ENGINE = InnoDB) */ + PARTITION pa4 VALUES LESS THAN (256) ENGINE = InnoDB) 255 inserts; select hex(a) from t3 where a=b'01010101'; hex(a) @@ -419,12 +419,12 @@ t4 CREATE TABLE `t4` ( `a` bit(8) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) SUBPARTITION BY KEY (a) SUBPARTITIONS 2 (PARTITION pa1 VALUES IN (0,1,2,3) ENGINE = InnoDB, PARTITION pa2 VALUES IN (4,5,6,7,8,9,10,11,12,13,14,15,16) ENGINE = InnoDB, - PARTITION pa3 VALUES IN (17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32) ENGINE = InnoDB) */ + PARTITION pa3 VALUES IN (17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32) ENGINE = InnoDB) 32 inserts; select hex(a) from t4 where a=b'00000001'; hex(a) diff --git a/mysql-test/suite/parts/r/partition_bit_myisam.result b/mysql-test/suite/parts/r/partition_bit_myisam.result index c101f44475d..3530743893e 100644 --- a/mysql-test/suite/parts/r/partition_bit_myisam.result +++ b/mysql-test/suite/parts/r/partition_bit_myisam.result @@ -9,7 +9,7 @@ t1 CREATE TABLE `t1` ( `a` bit(1) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) */ + PARTITION BY KEY (a) drop table t1; create table t1 (a bit(0), primary key (a)) engine='MyISAM' partition by key (a) ( @@ -21,9 +21,9 @@ t1 CREATE TABLE `t1` ( `a` bit(1) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 ENGINE = MyISAM, - PARTITION pa2 ENGINE = MyISAM) */ + PARTITION pa2 ENGINE = MyISAM) drop table t1; create table t1 (a bit(64), primary key (a)) engine='MyISAM' partition by key (a) partitions 2; @@ -33,8 +33,8 @@ t1 CREATE TABLE `t1` ( `a` bit(64) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 2 */ + PARTITION BY KEY (a) +PARTITIONS 2 insert into t1 values (b'1111111111111111111111111111111111111111111111111111111111111111'), (b'1000000000000000000000000000000000000000000000000000000000000000'), @@ -61,11 +61,11 @@ t1 CREATE TABLE `t1` ( `a` bit(64) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) insert into t1 values (b'1111111111111111111111111111111111111111111111111111111111111111'), (b'1000000000000000000000000000000000000000000000000000000000000000'), @@ -91,8 +91,8 @@ t2 CREATE TABLE `t2` ( `a` bit(1) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 4 */ + PARTITION BY KEY (a) +PARTITIONS 4 insert into t2 values (b'0'), (b'1'); select hex(a) from t2; hex(a) @@ -104,8 +104,8 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` bit(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 4 */ + PARTITION BY KEY (a) +PARTITIONS 4 select hex(a) from t2; hex(a) 0 @@ -117,8 +117,8 @@ t2 CREATE TABLE `t2` ( `a` bit(1) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 4 */ + PARTITION BY KEY (a) +PARTITIONS 4 select hex(a) from t2; hex(a) 0 @@ -136,13 +136,13 @@ t3 CREATE TABLE `t3` ( `a` bit(8) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) SUBPARTITION BY KEY (a) SUBPARTITIONS 2 (PARTITION pa1 VALUES LESS THAN (3) ENGINE = MyISAM, PARTITION pa2 VALUES LESS THAN (16) ENGINE = MyISAM, PARTITION pa3 VALUES LESS THAN (64) ENGINE = MyISAM, - PARTITION pa4 VALUES LESS THAN (256) ENGINE = MyISAM) */ + PARTITION pa4 VALUES LESS THAN (256) ENGINE = MyISAM) 255 inserts; select hex(a) from t3 where a=b'01010101'; hex(a) @@ -419,12 +419,12 @@ t4 CREATE TABLE `t4` ( `a` bit(8) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) SUBPARTITION BY KEY (a) SUBPARTITIONS 2 (PARTITION pa1 VALUES IN (0,1,2,3) ENGINE = MyISAM, PARTITION pa2 VALUES IN (4,5,6,7,8,9,10,11,12,13,14,15,16) ENGINE = MyISAM, - PARTITION pa3 VALUES IN (17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32) ENGINE = MyISAM) */ + PARTITION pa3 VALUES IN (17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32) ENGINE = MyISAM) 32 inserts; select hex(a) from t4 where a=b'00000001'; hex(a) diff --git a/mysql-test/suite/parts/r/partition_char_innodb.result b/mysql-test/suite/parts/r/partition_char_innodb.result index bb99e89b022..ab961222a66 100644 Binary files a/mysql-test/suite/parts/r/partition_char_innodb.result and b/mysql-test/suite/parts/r/partition_char_innodb.result differ diff --git a/mysql-test/suite/parts/r/partition_char_myisam.result b/mysql-test/suite/parts/r/partition_char_myisam.result index 9936f3ec0f4..09b77cad211 100644 Binary files a/mysql-test/suite/parts/r/partition_char_myisam.result and b/mysql-test/suite/parts/r/partition_char_myisam.result differ diff --git a/mysql-test/suite/parts/r/partition_datetime_innodb.result b/mysql-test/suite/parts/r/partition_datetime_innodb.result index 0a5e9775c36..0c7b47edcda 100644 --- a/mysql-test/suite/parts/r/partition_datetime_innodb.result +++ b/mysql-test/suite/parts/r/partition_datetime_innodb.result @@ -7,14 +7,14 @@ partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) insert into t1 values ('1975-01-01 21:21:21'), ('2020-12-31 12:10:30'), ('1980-10-14 03:03'), ('2000-06-15 23:59'); select * from t1; a @@ -37,11 +37,11 @@ partition by key (a) partitions 12; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 12 */ + PARTITION BY KEY (a) +PARTITIONS 12 insert into t2 values ('1975-01-01 0:1:1'), ('2020-12-31 10:11:12'), ('1980-10-14 13:14:15'), ('2000-06-15 14:15:16'); select * from t2; a @@ -137,11 +137,11 @@ t1 CREATE TABLE `t1` ( `a` date NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) insert into t1 values ('1975-01-01'), ('2020-12-31'), ('1980-10-14'), ('2000-06-15'); select * from t1; a @@ -167,8 +167,8 @@ t2 CREATE TABLE `t2` ( `a` date NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 12 */ + PARTITION BY KEY (a) +PARTITIONS 12 insert into t2 values ('1975-01-01'), ('2020-12-31'), ('1980-10-14'), ('2000-06-15'); select * from t2; a @@ -291,13 +291,13 @@ t3 CREATE TABLE `t3` ( `a` date NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (month(a)) + PARTITION BY RANGE (month(a)) SUBPARTITION BY KEY (a) SUBPARTITIONS 3 (PARTITION quarter1 VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION quarter2 VALUES LESS THAN (7) ENGINE = InnoDB, PARTITION quarter3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION quarter4 VALUES LESS THAN (13) ENGINE = InnoDB) */ + PARTITION quarter4 VALUES LESS THAN (13) ENGINE = InnoDB) 12 inserts; select count(*) from t3; count(*) @@ -331,13 +331,13 @@ t4 CREATE TABLE `t4` ( `a` date NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (month(a)) + PARTITION BY LIST (month(a)) SUBPARTITION BY KEY (a) SUBPARTITIONS 3 (PARTITION quarter1 VALUES IN (1,2,3) ENGINE = InnoDB, PARTITION quarter2 VALUES IN (4,5,6) ENGINE = InnoDB, PARTITION quarter3 VALUES IN (7,8,9) ENGINE = InnoDB, - PARTITION quarter4 VALUES IN (10,11,12) ENGINE = InnoDB) */ + PARTITION quarter4 VALUES IN (10,11,12) ENGINE = InnoDB) 12 inserts; select count(*) from t4; count(*) @@ -369,11 +369,11 @@ t1 CREATE TABLE `t1` ( `a` time NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) insert into t1 values ('21:21:21'), ('12:10:30'), ('03:03:03'), ('23:59'); select * from t1; a @@ -399,8 +399,8 @@ t2 CREATE TABLE `t2` ( `a` time NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 12 */ + PARTITION BY KEY (a) +PARTITIONS 12 insert into t2 values ('0:1:1'), ('10:11:12'), ('13:14:15'), ('14:15:16'); select * from t2; a @@ -498,13 +498,13 @@ t3 CREATE TABLE `t3` ( `a` time NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (second(a)) + PARTITION BY RANGE (second(a)) SUBPARTITION BY KEY (a) SUBPARTITIONS 3 (PARTITION quarter1 VALUES LESS THAN (16) ENGINE = InnoDB, PARTITION quarter2 VALUES LESS THAN (31) ENGINE = InnoDB, PARTITION quarter3 VALUES LESS THAN (46) ENGINE = InnoDB, - PARTITION quarter4 VALUES LESS THAN (61) ENGINE = InnoDB) */ + PARTITION quarter4 VALUES LESS THAN (61) ENGINE = InnoDB) 59 inserts; select count(*) from t3; count(*) @@ -585,13 +585,13 @@ t4 CREATE TABLE `t4` ( `a` time NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (second(a)) + PARTITION BY LIST (second(a)) SUBPARTITION BY KEY (a) SUBPARTITIONS 3 (PARTITION quarter1 VALUES IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) ENGINE = InnoDB, PARTITION quarter2 VALUES IN (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION quarter3 VALUES IN (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45) ENGINE = InnoDB, - PARTITION quarter4 VALUES IN (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ + PARTITION quarter4 VALUES IN (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) 59 inserts; select count(*) from t4; count(*) @@ -670,11 +670,11 @@ t1 CREATE TABLE `t1` ( `a` datetime NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) insert into t1 values ('1975-01-01 21:21:21'), ('2020-12-31 12:10:30'), ('1980-10-14 03:03'), ('2000-06-15 23:59'); select * from t1; a @@ -700,8 +700,8 @@ t2 CREATE TABLE `t2` ( `a` datetime NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 12 */ + PARTITION BY KEY (a) +PARTITIONS 12 insert into t2 values ('1975-01-01 0:1:1'), ('2020-12-31 10:11:12'), ('1980-10-14 13:14:15'), ('2000-06-15 14:15:16'); select * from t2; a @@ -799,13 +799,13 @@ t3 CREATE TABLE `t3` ( `a` datetime NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (month(a)) + PARTITION BY RANGE (month(a)) SUBPARTITION BY KEY (a) SUBPARTITIONS 3 (PARTITION quarter1 VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION quarter2 VALUES LESS THAN (7) ENGINE = InnoDB, PARTITION quarter3 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION quarter4 VALUES LESS THAN (13) ENGINE = InnoDB) */ + PARTITION quarter4 VALUES LESS THAN (13) ENGINE = InnoDB) 12 inserts; select count(*) from t3; count(*) @@ -839,13 +839,13 @@ t4 CREATE TABLE `t4` ( `a` datetime NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (month(a)) + PARTITION BY LIST (month(a)) SUBPARTITION BY KEY (a) SUBPARTITIONS 3 (PARTITION quarter1 VALUES IN (1,2,3) ENGINE = InnoDB, PARTITION quarter2 VALUES IN (4,5,6) ENGINE = InnoDB, PARTITION quarter3 VALUES IN (7,8,9) ENGINE = InnoDB, - PARTITION quarter4 VALUES IN (10,11,12) ENGINE = InnoDB) */ + PARTITION quarter4 VALUES IN (10,11,12) ENGINE = InnoDB) 12 inserts; select count(*) from t4; count(*) @@ -877,11 +877,11 @@ t1 CREATE TABLE `t1` ( `a` year(4) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) insert into t1 values ('1975'), (2020), ('1980'), ('2000'); select * from t1; a @@ -907,8 +907,8 @@ t2 CREATE TABLE `t2` ( `a` year(4) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 12 */ + PARTITION BY KEY (a) +PARTITIONS 12 insert into t2 values ('1975'), ('2020'), ('1980'), ('2000'); select * from t2; a diff --git a/mysql-test/suite/parts/r/partition_datetime_myisam.result b/mysql-test/suite/parts/r/partition_datetime_myisam.result index 217fe9ace1d..40efba9d984 100644 --- a/mysql-test/suite/parts/r/partition_datetime_myisam.result +++ b/mysql-test/suite/parts/r/partition_datetime_myisam.result @@ -7,14 +7,14 @@ partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) insert into t1 values ('1975-01-01 21:21:21'), ('2020-12-31 12:10:30'), ('1980-10-14 03:03'), ('2000-06-15 23:59'); select * from t1; a @@ -37,11 +37,11 @@ partition by key (a) partitions 12; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 12 */ + PARTITION BY KEY (a) +PARTITIONS 12 insert into t2 values ('1975-01-01 0:1:1'), ('2020-12-31 10:11:12'), ('1980-10-14 13:14:15'), ('2000-06-15 14:15:16'); select * from t2; a @@ -137,11 +137,11 @@ t1 CREATE TABLE `t1` ( `a` date NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) insert into t1 values ('1975-01-01'), ('2020-12-31'), ('1980-10-14'), ('2000-06-15'); select * from t1; a @@ -167,8 +167,8 @@ t2 CREATE TABLE `t2` ( `a` date NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 12 */ + PARTITION BY KEY (a) +PARTITIONS 12 insert into t2 values ('1975-01-01'), ('2020-12-31'), ('1980-10-14'), ('2000-06-15'); select * from t2; a @@ -291,13 +291,13 @@ t3 CREATE TABLE `t3` ( `a` date NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (month(a)) + PARTITION BY RANGE (month(a)) SUBPARTITION BY KEY (a) SUBPARTITIONS 3 (PARTITION quarter1 VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION quarter2 VALUES LESS THAN (7) ENGINE = MyISAM, PARTITION quarter3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION quarter4 VALUES LESS THAN (13) ENGINE = MyISAM) */ + PARTITION quarter4 VALUES LESS THAN (13) ENGINE = MyISAM) 12 inserts; select count(*) from t3; count(*) @@ -331,13 +331,13 @@ t4 CREATE TABLE `t4` ( `a` date NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (month(a)) + PARTITION BY LIST (month(a)) SUBPARTITION BY KEY (a) SUBPARTITIONS 3 (PARTITION quarter1 VALUES IN (1,2,3) ENGINE = MyISAM, PARTITION quarter2 VALUES IN (4,5,6) ENGINE = MyISAM, PARTITION quarter3 VALUES IN (7,8,9) ENGINE = MyISAM, - PARTITION quarter4 VALUES IN (10,11,12) ENGINE = MyISAM) */ + PARTITION quarter4 VALUES IN (10,11,12) ENGINE = MyISAM) 12 inserts; select count(*) from t4; count(*) @@ -369,11 +369,11 @@ t1 CREATE TABLE `t1` ( `a` time NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) insert into t1 values ('21:21:21'), ('12:10:30'), ('03:03:03'), ('23:59'); select * from t1; a @@ -399,8 +399,8 @@ t2 CREATE TABLE `t2` ( `a` time NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 12 */ + PARTITION BY KEY (a) +PARTITIONS 12 insert into t2 values ('0:1:1'), ('10:11:12'), ('13:14:15'), ('14:15:16'); select * from t2; a @@ -498,13 +498,13 @@ t3 CREATE TABLE `t3` ( `a` time NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (second(a)) + PARTITION BY RANGE (second(a)) SUBPARTITION BY KEY (a) SUBPARTITIONS 3 (PARTITION quarter1 VALUES LESS THAN (16) ENGINE = MyISAM, PARTITION quarter2 VALUES LESS THAN (31) ENGINE = MyISAM, PARTITION quarter3 VALUES LESS THAN (46) ENGINE = MyISAM, - PARTITION quarter4 VALUES LESS THAN (61) ENGINE = MyISAM) */ + PARTITION quarter4 VALUES LESS THAN (61) ENGINE = MyISAM) 59 inserts; select count(*) from t3; count(*) @@ -585,13 +585,13 @@ t4 CREATE TABLE `t4` ( `a` time NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (second(a)) + PARTITION BY LIST (second(a)) SUBPARTITION BY KEY (a) SUBPARTITIONS 3 (PARTITION quarter1 VALUES IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) ENGINE = MyISAM, PARTITION quarter2 VALUES IN (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION quarter3 VALUES IN (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45) ENGINE = MyISAM, - PARTITION quarter4 VALUES IN (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ + PARTITION quarter4 VALUES IN (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) 59 inserts; select count(*) from t4; count(*) @@ -670,11 +670,11 @@ t1 CREATE TABLE `t1` ( `a` datetime NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) insert into t1 values ('1975-01-01 21:21:21'), ('2020-12-31 12:10:30'), ('1980-10-14 03:03'), ('2000-06-15 23:59'); select * from t1; a @@ -700,8 +700,8 @@ t2 CREATE TABLE `t2` ( `a` datetime NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 12 */ + PARTITION BY KEY (a) +PARTITIONS 12 insert into t2 values ('1975-01-01 0:1:1'), ('2020-12-31 10:11:12'), ('1980-10-14 13:14:15'), ('2000-06-15 14:15:16'); select * from t2; a @@ -799,13 +799,13 @@ t3 CREATE TABLE `t3` ( `a` datetime NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (month(a)) + PARTITION BY RANGE (month(a)) SUBPARTITION BY KEY (a) SUBPARTITIONS 3 (PARTITION quarter1 VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION quarter2 VALUES LESS THAN (7) ENGINE = MyISAM, PARTITION quarter3 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION quarter4 VALUES LESS THAN (13) ENGINE = MyISAM) */ + PARTITION quarter4 VALUES LESS THAN (13) ENGINE = MyISAM) 12 inserts; select count(*) from t3; count(*) @@ -839,13 +839,13 @@ t4 CREATE TABLE `t4` ( `a` datetime NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (month(a)) + PARTITION BY LIST (month(a)) SUBPARTITION BY KEY (a) SUBPARTITIONS 3 (PARTITION quarter1 VALUES IN (1,2,3) ENGINE = MyISAM, PARTITION quarter2 VALUES IN (4,5,6) ENGINE = MyISAM, PARTITION quarter3 VALUES IN (7,8,9) ENGINE = MyISAM, - PARTITION quarter4 VALUES IN (10,11,12) ENGINE = MyISAM) */ + PARTITION quarter4 VALUES IN (10,11,12) ENGINE = MyISAM) 12 inserts; select count(*) from t4; count(*) @@ -877,11 +877,11 @@ t1 CREATE TABLE `t1` ( `a` year(4) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) insert into t1 values ('1975'), (2020), ('1980'), ('2000'); select * from t1; a @@ -907,8 +907,8 @@ t2 CREATE TABLE `t2` ( `a` year(4) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 12 */ + PARTITION BY KEY (a) +PARTITIONS 12 insert into t2 values ('1975'), ('2020'), ('1980'), ('2000'); select * from t2; a diff --git a/mysql-test/suite/parts/r/partition_debug.result b/mysql-test/suite/parts/r/partition_debug.result index 109072be49c..aa33b3ffa57 100644 --- a/mysql-test/suite/parts/r/partition_debug.result +++ b/mysql-test/suite/parts/r/partition_debug.result @@ -55,9 +55,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -100,9 +100,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -167,9 +167,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -212,9 +212,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -279,9 +279,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -324,9 +324,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -391,9 +391,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -436,9 +436,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -503,9 +503,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -548,9 +548,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -615,9 +615,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -660,9 +660,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -727,9 +727,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -772,9 +772,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -839,9 +839,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -884,9 +884,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -951,9 +951,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -996,9 +996,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 11 Original from partition p1 @@ -1063,9 +1063,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1098,9 +1098,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1165,9 +1165,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1200,9 +1200,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1267,9 +1267,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1302,9 +1302,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1369,9 +1369,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1404,9 +1404,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1471,9 +1471,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1506,9 +1506,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1573,9 +1573,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1608,9 +1608,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1675,9 +1675,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1710,9 +1710,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1777,9 +1777,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1812,9 +1812,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1879,9 +1879,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1914,9 +1914,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1; a b 11 Original from partition p1 diff --git a/mysql-test/suite/parts/r/partition_debug_innodb.result b/mysql-test/suite/parts/r/partition_debug_innodb.result index 7ecd746077e..0cc8b5454a2 100644 --- a/mysql-test/suite/parts/r/partition_debug_innodb.result +++ b/mysql-test/suite/parts/r/partition_debug_innodb.result @@ -30,9 +30,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -62,9 +62,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -95,9 +95,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -129,9 +129,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -162,9 +162,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -196,9 +196,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -229,9 +229,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -263,9 +263,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -296,9 +296,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -331,9 +331,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -364,9 +364,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -399,9 +399,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -432,9 +432,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -467,9 +467,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -500,9 +500,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -536,10 +536,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -570,9 +570,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -604,10 +604,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -638,9 +638,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -672,10 +672,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -707,9 +707,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -734,9 +734,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -766,9 +766,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -794,9 +794,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -828,9 +828,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -855,9 +855,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -887,9 +887,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -915,9 +915,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -949,9 +949,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -976,9 +976,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1008,9 +1008,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1036,9 +1036,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1070,9 +1070,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1097,9 +1097,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1129,9 +1129,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1157,9 +1157,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1191,9 +1191,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1218,9 +1218,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1250,9 +1250,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1278,9 +1278,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1312,9 +1312,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1339,9 +1339,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1371,9 +1371,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1399,9 +1399,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1433,9 +1433,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1460,9 +1460,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1492,9 +1492,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1520,9 +1520,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1554,9 +1554,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1582,10 +1582,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1615,9 +1615,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1644,10 +1644,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1679,9 +1679,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1707,10 +1707,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1740,9 +1740,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1769,10 +1769,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1804,9 +1804,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1832,10 +1832,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1865,9 +1865,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1894,10 +1894,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1930,9 +1930,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1961,9 +1961,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1994,9 +1994,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2027,9 +2027,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2060,9 +2060,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2093,9 +2093,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2126,9 +2126,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2158,8 +2158,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2186,9 +2186,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2218,8 +2218,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2246,9 +2246,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2278,8 +2278,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2306,9 +2306,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2336,8 +2336,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2364,9 +2364,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2393,8 +2393,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2421,9 +2421,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2450,8 +2450,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2479,9 +2479,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2505,9 +2505,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2537,9 +2537,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2564,9 +2564,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2598,9 +2598,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2624,9 +2624,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2656,9 +2656,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2683,9 +2683,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2717,9 +2717,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2743,9 +2743,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2775,9 +2775,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2802,9 +2802,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2836,9 +2836,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2861,8 +2861,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2888,9 +2888,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2914,8 +2914,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2943,9 +2943,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2968,8 +2968,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2995,9 +2995,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3021,8 +3021,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3050,9 +3050,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3075,8 +3075,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3102,9 +3102,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3128,8 +3128,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3157,9 +3157,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3182,8 +3182,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3209,9 +3209,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3235,8 +3235,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3264,9 +3264,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3289,8 +3289,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3316,9 +3316,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3342,8 +3342,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3371,9 +3371,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3396,8 +3396,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3423,9 +3423,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3449,8 +3449,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3480,9 +3480,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3513,9 +3513,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3546,9 +3546,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3581,9 +3581,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3614,9 +3614,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3649,9 +3649,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3682,9 +3682,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3719,9 +3719,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3752,9 +3752,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3789,9 +3789,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3822,9 +3822,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3859,9 +3859,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3892,9 +3892,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3930,10 +3930,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3964,9 +3964,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4002,10 +4002,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4036,9 +4036,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4072,10 +4072,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4106,9 +4106,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4142,10 +4142,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4176,9 +4176,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4211,10 +4211,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4245,9 +4245,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4280,10 +4280,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4316,9 +4316,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4344,9 +4344,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4376,9 +4376,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4405,9 +4405,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4439,9 +4439,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4467,9 +4467,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4499,9 +4499,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4528,9 +4528,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4562,9 +4562,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4590,9 +4590,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4622,9 +4622,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4651,9 +4651,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4685,9 +4685,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4713,9 +4713,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4745,9 +4745,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4774,9 +4774,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4808,9 +4808,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4836,9 +4836,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4868,9 +4868,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4897,9 +4897,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4931,9 +4931,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4959,9 +4959,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4991,9 +4991,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5020,9 +5020,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5054,9 +5054,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5083,10 +5083,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5116,9 +5116,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5146,10 +5146,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5181,9 +5181,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5210,10 +5210,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5243,9 +5243,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5273,10 +5273,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5308,9 +5308,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5337,10 +5337,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5370,9 +5370,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5400,10 +5400,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5435,9 +5435,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5464,10 +5464,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5497,9 +5497,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5527,10 +5527,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5562,9 +5562,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5591,10 +5591,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5624,9 +5624,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5654,10 +5654,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5689,9 +5689,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5718,10 +5718,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5751,9 +5751,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5781,10 +5781,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5838,9 +5838,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5877,9 +5877,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5943,9 +5943,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5982,9 +5982,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6048,9 +6048,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6087,9 +6087,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6153,9 +6153,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6192,9 +6192,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6258,9 +6258,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6297,9 +6297,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6363,9 +6363,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6402,9 +6402,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6468,9 +6468,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6507,9 +6507,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6573,9 +6573,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6612,9 +6612,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6678,9 +6678,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6717,9 +6717,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 11 Original from partition p1 @@ -6783,9 +6783,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6815,9 +6815,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6881,9 +6881,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6913,9 +6913,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6979,9 +6979,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -7011,9 +7011,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -7077,9 +7077,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -7109,9 +7109,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -7175,9 +7175,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -7207,9 +7207,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -7273,9 +7273,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -7305,9 +7305,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -7371,9 +7371,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -7403,9 +7403,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -7469,9 +7469,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -7501,9 +7501,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -7567,9 +7567,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 1 Original from partition p0 @@ -7599,9 +7599,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a b 11 Original from partition p1 diff --git a/mysql-test/suite/parts/r/partition_debug_myisam.result b/mysql-test/suite/parts/r/partition_debug_myisam.result index 8408f166e79..c0ddc1bfb16 100644 --- a/mysql-test/suite/parts/r/partition_debug_myisam.result +++ b/mysql-test/suite/parts/r/partition_debug_myisam.result @@ -29,9 +29,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -65,9 +65,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -100,9 +100,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -138,9 +138,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -173,9 +173,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -211,9 +211,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -246,9 +246,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -284,9 +284,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -319,9 +319,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -359,9 +359,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -394,9 +394,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -434,9 +434,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -469,9 +469,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -509,9 +509,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -544,9 +544,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -586,10 +586,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -622,9 +622,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -662,10 +662,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -698,9 +698,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -738,10 +738,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -775,9 +775,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -804,9 +804,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -838,9 +838,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -868,9 +868,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -904,9 +904,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -933,9 +933,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -967,9 +967,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -997,9 +997,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1033,9 +1033,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1062,9 +1062,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1096,9 +1096,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1126,9 +1126,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1162,9 +1162,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1191,9 +1191,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1225,9 +1225,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1255,9 +1255,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1291,9 +1291,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1320,9 +1320,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1354,9 +1354,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1384,9 +1384,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1420,9 +1420,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1449,9 +1449,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1483,9 +1483,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1513,9 +1513,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1549,9 +1549,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1578,9 +1578,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1612,9 +1612,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1642,9 +1642,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1678,9 +1678,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1709,10 +1709,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1744,9 +1744,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1776,10 +1776,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1813,9 +1813,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1844,10 +1844,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1879,9 +1879,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1911,10 +1911,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1948,9 +1948,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -1979,10 +1979,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2014,9 +2014,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2046,10 +2046,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2084,9 +2084,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2119,9 +2119,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2154,9 +2154,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2191,9 +2191,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2226,9 +2226,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2263,9 +2263,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2298,9 +2298,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2333,8 +2333,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2363,9 +2363,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2398,8 +2398,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2428,9 +2428,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2463,8 +2463,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2493,9 +2493,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2526,8 +2526,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2556,9 +2556,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2587,8 +2587,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2617,9 +2617,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2648,8 +2648,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2679,9 +2679,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2707,9 +2707,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2741,9 +2741,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2770,9 +2770,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2806,9 +2806,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2834,9 +2834,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2868,9 +2868,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2897,9 +2897,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2933,9 +2933,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2961,9 +2961,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -2995,9 +2995,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3024,9 +3024,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3060,9 +3060,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3086,8 +3086,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3115,9 +3115,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3142,8 +3142,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3173,9 +3173,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3199,8 +3199,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3228,9 +3228,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3255,8 +3255,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3286,9 +3286,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3312,8 +3312,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3341,9 +3341,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3368,8 +3368,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3399,9 +3399,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3425,8 +3425,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3454,9 +3454,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3481,8 +3481,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3512,9 +3512,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3538,8 +3538,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3567,9 +3567,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3594,8 +3594,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3625,9 +3625,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3651,8 +3651,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3680,9 +3680,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3707,8 +3707,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) -(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ + PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3740,9 +3740,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3777,9 +3777,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3812,9 +3812,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3851,9 +3851,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3886,9 +3886,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3925,9 +3925,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -3960,9 +3960,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4003,9 +4003,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4038,9 +4038,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4081,9 +4081,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4116,9 +4116,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4159,9 +4159,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4194,9 +4194,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4239,10 +4239,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4275,9 +4275,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4320,10 +4320,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4356,9 +4356,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4399,10 +4399,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4435,9 +4435,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4478,10 +4478,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4514,9 +4514,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4555,10 +4555,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4591,9 +4591,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4632,10 +4632,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4670,9 +4670,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4700,9 +4700,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4734,9 +4734,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4765,9 +4765,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4801,9 +4801,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4831,9 +4831,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4865,9 +4865,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4896,9 +4896,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4932,9 +4932,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4962,9 +4962,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -4996,9 +4996,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5027,9 +5027,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5063,9 +5063,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5093,9 +5093,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5127,9 +5127,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5158,9 +5158,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5194,9 +5194,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5224,9 +5224,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5258,9 +5258,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5289,9 +5289,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5325,9 +5325,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5355,9 +5355,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5389,9 +5389,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5420,9 +5420,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5456,9 +5456,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5488,10 +5488,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5523,9 +5523,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5556,10 +5556,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5593,9 +5593,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5625,10 +5625,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5660,9 +5660,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5693,10 +5693,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5730,9 +5730,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5762,10 +5762,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5797,9 +5797,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5830,10 +5830,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5867,9 +5867,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5899,10 +5899,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5934,9 +5934,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -5967,10 +5967,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6004,9 +6004,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6036,10 +6036,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6071,9 +6071,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6104,10 +6104,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6141,9 +6141,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6173,10 +6173,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6208,9 +6208,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 @@ -6241,10 +6241,10 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, - PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) SELECT * FROM t1; a b 1 Original from partition p0 diff --git a/mysql-test/suite/parts/r/partition_debug_sync_innodb.result b/mysql-test/suite/parts/r/partition_debug_sync_innodb.result index 9a62988087e..a34085675cf 100644 --- a/mysql-test/suite/parts/r/partition_debug_sync_innodb.result +++ b/mysql-test/suite/parts/r/partition_debug_sync_innodb.result @@ -51,8 +51,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) -(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION BY RANGE (a) +(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) t1#P#p0.ibd t1.frm t1.par @@ -88,9 +88,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION p10 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p10 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1; a 1 diff --git a/mysql-test/suite/parts/r/partition_decimal_innodb.result b/mysql-test/suite/parts/r/partition_decimal_innodb.result index 8eb408d05d9..58c51f0ed3c 100644 --- a/mysql-test/suite/parts/r/partition_decimal_innodb.result +++ b/mysql-test/suite/parts/r/partition_decimal_innodb.result @@ -10,11 +10,11 @@ t1 CREATE TABLE `t1` ( `a` decimal(10,4) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) insert into t1 values (999999.9999), (-999999.9999), (123456.7899), (-123456.7899), (-1.5), (1), (0), (-1), (1.5), (1234.567), (-1234.567); select * from t1; a @@ -54,8 +54,8 @@ t2 CREATE TABLE `t2` ( `a` decimal(18,9) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 10 */ + PARTITION BY KEY (a) +PARTITIONS 10 insert into t2 values (999999999.999999999), (-999999999.999999999), (-1.5), (-1), (0), (1.5), (1234.567), (-1234.567); select * from t2; a @@ -100,14 +100,14 @@ t3 CREATE TABLE `t3` ( `a` decimal(18,9) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (floor(a)) + PARTITION BY RANGE (floor(a)) SUBPARTITION BY KEY (a) SUBPARTITIONS 2 (PARTITION pa2 VALUES LESS THAN (2) ENGINE = InnoDB, PARTITION pa4 VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION pa6 VALUES LESS THAN (6) ENGINE = InnoDB, PARTITION pa8 VALUES LESS THAN (8) ENGINE = InnoDB, - PARTITION pa10 VALUES LESS THAN (10) ENGINE = InnoDB) */ + PARTITION pa10 VALUES LESS THAN (10) ENGINE = InnoDB) 9*3 inserts; select count(*) from t3; count(*) @@ -127,14 +127,14 @@ t4 CREATE TABLE `t4` ( `a` decimal(18,9) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ceiling(a)) + PARTITION BY LIST (ceiling(a)) SUBPARTITION BY KEY (a) SUBPARTITIONS 2 (PARTITION pa2 VALUES IN (1,2) ENGINE = InnoDB, PARTITION pa4 VALUES IN (3,4) ENGINE = InnoDB, PARTITION pa6 VALUES IN (5,6) ENGINE = InnoDB, PARTITION pa8 VALUES IN (7,8) ENGINE = InnoDB, - PARTITION pa10 VALUES IN (9,10) ENGINE = InnoDB) */ + PARTITION pa10 VALUES IN (9,10) ENGINE = InnoDB) 9*3 inserts; select count(*) from t4; count(*) diff --git a/mysql-test/suite/parts/r/partition_decimal_myisam.result b/mysql-test/suite/parts/r/partition_decimal_myisam.result index 2b214bd94cf..956923117a5 100644 --- a/mysql-test/suite/parts/r/partition_decimal_myisam.result +++ b/mysql-test/suite/parts/r/partition_decimal_myisam.result @@ -10,11 +10,11 @@ t1 CREATE TABLE `t1` ( `a` decimal(10,4) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) insert into t1 values (999999.9999), (-999999.9999), (123456.7899), (-123456.7899), (-1.5), (1), (0), (-1), (1.5), (1234.567), (-1234.567); select * from t1; a @@ -54,8 +54,8 @@ t2 CREATE TABLE `t2` ( `a` decimal(18,9) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 10 */ + PARTITION BY KEY (a) +PARTITIONS 10 insert into t2 values (999999999.999999999), (-999999999.999999999), (-1.5), (-1), (0), (1.5), (1234.567), (-1234.567); select * from t2; a @@ -100,14 +100,14 @@ t3 CREATE TABLE `t3` ( `a` decimal(18,9) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (floor(a)) + PARTITION BY RANGE (floor(a)) SUBPARTITION BY KEY (a) SUBPARTITIONS 2 (PARTITION pa2 VALUES LESS THAN (2) ENGINE = MyISAM, PARTITION pa4 VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION pa6 VALUES LESS THAN (6) ENGINE = MyISAM, PARTITION pa8 VALUES LESS THAN (8) ENGINE = MyISAM, - PARTITION pa10 VALUES LESS THAN (10) ENGINE = MyISAM) */ + PARTITION pa10 VALUES LESS THAN (10) ENGINE = MyISAM) 9*3 inserts; select count(*) from t3; count(*) @@ -127,14 +127,14 @@ t4 CREATE TABLE `t4` ( `a` decimal(18,9) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (ceiling(a)) + PARTITION BY LIST (ceiling(a)) SUBPARTITION BY KEY (a) SUBPARTITIONS 2 (PARTITION pa2 VALUES IN (1,2) ENGINE = MyISAM, PARTITION pa4 VALUES IN (3,4) ENGINE = MyISAM, PARTITION pa6 VALUES IN (5,6) ENGINE = MyISAM, PARTITION pa8 VALUES IN (7,8) ENGINE = MyISAM, - PARTITION pa10 VALUES IN (9,10) ENGINE = MyISAM) */ + PARTITION pa10 VALUES IN (9,10) ENGINE = MyISAM) 9*3 inserts; select count(*) from t4; count(*) diff --git a/mysql-test/suite/parts/r/partition_engine_innodb.result b/mysql-test/suite/parts/r/partition_engine_innodb.result index cfa27c8e112..ec306c42648 100644 --- a/mysql-test/suite/parts/r/partition_engine_innodb.result +++ b/mysql-test/suite/parts/r/partition_engine_innodb.result @@ -68,8 +68,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -525,9 +525,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part1 ENGINE = InnoDB, - PARTITION part2 ENGINE = InnoDB) */ + PARTITION part2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -984,14 +984,14 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) (PARTITION part1 VALUES LESS THAN (10) (SUBPARTITION subpart11 ENGINE = InnoDB, SUBPARTITION subpart12 ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (2147483646) (SUBPARTITION subpart21 ENGINE = InnoDB, - SUBPARTITION subpart22 ENGINE = InnoDB)) */ + SUBPARTITION subpart22 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -1509,14 +1509,14 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) (PARTITION part1 VALUES LESS THAN (10) (SUBPARTITION subpart11 ENGINE = InnoDB, SUBPARTITION subpart12 ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (2147483646) (SUBPARTITION subpart21 ENGINE = InnoDB, - SUBPARTITION subpart22 ENGINE = InnoDB)) */ + SUBPARTITION subpart22 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -2010,14 +2010,14 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) (PARTITION part1 VALUES LESS THAN (10) (SUBPARTITION subpart11 ENGINE = InnoDB, SUBPARTITION subpart12 ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (2147483646) (SUBPARTITION subpart21 ENGINE = InnoDB, - SUBPARTITION subpart22 ENGINE = InnoDB)) */ + SUBPARTITION subpart22 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -2472,14 +2472,14 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) (PARTITION part1 VALUES LESS THAN (10) (SUBPARTITION subpart11 ENGINE = InnoDB, SUBPARTITION subpart12 ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (2147483646) (SUBPARTITION subpart21 ENGINE = InnoDB, - SUBPARTITION subpart22 ENGINE = InnoDB)) */ + SUBPARTITION subpart22 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -2934,9 +2934,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part1 ENGINE = InnoDB, - PARTITION part2 ENGINE = InnoDB) */ + PARTITION part2 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -3393,14 +3393,14 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) (PARTITION part1 VALUES LESS THAN (10) (SUBPARTITION subpart11 ENGINE = InnoDB, SUBPARTITION subpart12 ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (2147483646) (SUBPARTITION subpart21 ENGINE = InnoDB, - SUBPARTITION subpart22 ENGINE = InnoDB)) */ + SUBPARTITION subpart22 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -3858,14 +3858,14 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) (PARTITION part1 VALUES LESS THAN (10) (SUBPARTITION subpart11 ENGINE = InnoDB, SUBPARTITION subpart12 ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (2147483646) (SUBPARTITION subpart21 ENGINE = InnoDB, - SUBPARTITION subpart22 ENGINE = InnoDB)) */ + SUBPARTITION subpart22 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -4316,8 +4316,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -(PARTITION part1 ENGINE = InnoDB) */ + PARTITION BY HASH (f_int1) +(PARTITION part1 ENGINE = InnoDB) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -4770,11 +4770,11 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) (PARTITION part1 VALUES LESS THAN (1000) (SUBPARTITION subpart11 ENGINE = InnoDB, - SUBPARTITION subpart12 ENGINE = InnoDB)) */ + SUBPARTITION subpart12 ENGINE = InnoDB)) # check prerequisites-1 success: 1 # check COUNT(*) success: 1 diff --git a/mysql-test/suite/parts/r/partition_engine_myisam.result b/mysql-test/suite/parts/r/partition_engine_myisam.result index 3d20dbb726a..30f3b8116f7 100644 --- a/mysql-test/suite/parts/r/partition_engine_myisam.result +++ b/mysql-test/suite/parts/r/partition_engine_myisam.result @@ -68,8 +68,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -534,9 +534,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part1 ENGINE = MyISAM, - PARTITION part2 ENGINE = MyISAM) */ + PARTITION part2 ENGINE = MyISAM) unified filelist t1#P#part1.MYD @@ -1002,14 +1002,14 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) (PARTITION part1 VALUES LESS THAN (10) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483646) (SUBPARTITION subpart21 ENGINE = MyISAM, - SUBPARTITION subpart22 ENGINE = MyISAM)) */ + SUBPARTITION subpart22 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -1540,14 +1540,14 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) (PARTITION part1 VALUES LESS THAN (10) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483646) (SUBPARTITION subpart21 ENGINE = MyISAM, - SUBPARTITION subpart22 ENGINE = MyISAM)) */ + SUBPARTITION subpart22 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -2054,14 +2054,14 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) (PARTITION part1 VALUES LESS THAN (10) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483646) (SUBPARTITION subpart21 ENGINE = MyISAM, - SUBPARTITION subpart22 ENGINE = MyISAM)) */ + SUBPARTITION subpart22 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -2529,14 +2529,14 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) (PARTITION part1 VALUES LESS THAN (10) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483646) (SUBPARTITION subpart21 ENGINE = MyISAM, - SUBPARTITION subpart22 ENGINE = MyISAM)) */ + SUBPARTITION subpart22 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -3004,9 +3004,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part1 ENGINE = MyISAM, - PARTITION part2 ENGINE = MyISAM) */ + PARTITION part2 ENGINE = MyISAM) unified filelist t1#P#part1.MYD @@ -3472,14 +3472,14 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) (PARTITION part1 VALUES LESS THAN (10) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483646) (SUBPARTITION subpart21 ENGINE = MyISAM, - SUBPARTITION subpart22 ENGINE = MyISAM)) */ + SUBPARTITION subpart22 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -3950,14 +3950,14 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) (PARTITION part1 VALUES LESS THAN (10) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483646) (SUBPARTITION subpart21 ENGINE = MyISAM, - SUBPARTITION subpart22 ENGINE = MyISAM)) */ + SUBPARTITION subpart22 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -4421,8 +4421,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -(PARTITION part1 ENGINE = MyISAM) */ + PARTITION BY HASH (f_int1) +(PARTITION part1 ENGINE = MyISAM) unified filelist t1#P#part1.MYD @@ -4882,11 +4882,11 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) (PARTITION part1 VALUES LESS THAN (1000) (SUBPARTITION subpart11 ENGINE = MyISAM, - SUBPARTITION subpart12 ENGINE = MyISAM)) */ + SUBPARTITION subpart12 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD diff --git a/mysql-test/suite/parts/r/partition_exch_qa_1_innodb.result b/mysql-test/suite/parts/r/partition_exch_qa_1_innodb.result index 5fe5b7cbfcd..12996c0668a 100644 --- a/mysql-test/suite/parts/r/partition_exch_qa_1_innodb.result +++ b/mysql-test/suite/parts/r/partition_exch_qa_1_innodb.result @@ -128,10 +128,10 @@ tp CREATE TABLE `tp` ( PRIMARY KEY (`a`), UNIQUE KEY `a` (`a`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION p1 VALUES LESS THAN (100) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (1000) ENGINE = InnoDB) */ + PARTITION p2 VALUES LESS THAN (1000) ENGINE = InnoDB) ALTER TABLE tp DROP INDEX a; ALTER TABLE t_10 DROP INDEX a; ALTER TABLE tp ADD UNIQUE INDEX USING BTREE (a,b); @@ -153,10 +153,10 @@ tp CREATE TABLE `tp` ( PRIMARY KEY (`a`), UNIQUE KEY `a` (`a`,`b`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION p1 VALUES LESS THAN (100) ENGINE = InnoDB, - PARTITION p2 VALUES LESS THAN (1000) ENGINE = InnoDB) */ + PARTITION p2 VALUES LESS THAN (1000) ENGINE = InnoDB) DROP TABLE IF EXISTS t_10; DROP TABLE IF EXISTS t_100; DROP TABLE IF EXISTS t_1000; diff --git a/mysql-test/suite/parts/r/partition_exch_qa_1_myisam.result b/mysql-test/suite/parts/r/partition_exch_qa_1_myisam.result index 8a9ffd0479a..d6a45d7dc5f 100644 --- a/mysql-test/suite/parts/r/partition_exch_qa_1_myisam.result +++ b/mysql-test/suite/parts/r/partition_exch_qa_1_myisam.result @@ -128,10 +128,10 @@ tp CREATE TABLE `tp` ( PRIMARY KEY (`a`), UNIQUE KEY `a` (`a`) USING BTREE ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (100) ENGINE = MyISAM, - PARTITION p2 VALUES LESS THAN (1000) ENGINE = MyISAM) */ + PARTITION p2 VALUES LESS THAN (1000) ENGINE = MyISAM) ALTER TABLE tp DROP INDEX a; ALTER TABLE t_10 DROP INDEX a; ALTER TABLE tp ADD UNIQUE INDEX USING BTREE (a,b); @@ -153,10 +153,10 @@ tp CREATE TABLE `tp` ( PRIMARY KEY (`a`), UNIQUE KEY `a` (`a`,`b`) USING BTREE ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (100) ENGINE = MyISAM, - PARTITION p2 VALUES LESS THAN (1000) ENGINE = MyISAM) */ + PARTITION p2 VALUES LESS THAN (1000) ENGINE = MyISAM) DROP TABLE IF EXISTS t_10; DROP TABLE IF EXISTS t_100; DROP TABLE IF EXISTS t_1000; diff --git a/mysql-test/suite/parts/r/partition_exchange_archive.result b/mysql-test/suite/parts/r/partition_exchange_archive.result index 2918c2eed31..45f6571c70d 100644 --- a/mysql-test/suite/parts/r/partition_exchange_archive.result +++ b/mysql-test/suite/parts/r/partition_exchange_archive.result @@ -14,8 +14,8 @@ tp CREATE TABLE `tp` ( `b` varchar(24) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) -PARTITIONS 4 */ + PARTITION BY HASH (a) +PARTITIONS 4 SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( @@ -80,8 +80,8 @@ tp CREATE TABLE `tp` ( `b` varchar(24) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=ARCHIVE AUTO_INCREMENT=22 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) -PARTITIONS 4 */ + PARTITION BY HASH (a) +PARTITIONS 4 SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( @@ -175,9 +175,9 @@ tp CREATE TABLE `tp` ( `a` int(11) DEFAULT NULL, `b` varchar(55) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = ARCHIVE, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE) SET DEBUG_SYNC= 'now SIGNAL goto_verification'; SET DEBUG_SYNC= 'now WAIT_FOR swap_in_progress'; # select from t and select/update/delete/insert from tp should work @@ -208,9 +208,9 @@ tp CREATE TABLE `tp` ( `a` int(11) DEFAULT NULL, `b` varchar(55) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = ARCHIVE, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE) SET DEBUG_SYNC= 'now SIGNAL goto_wait'; SET DEBUG_SYNC= 'now WAIT_FOR swap_in_progress'; # Both tables should now be under exclusive lock, even SHOW should fail @@ -265,9 +265,9 @@ tp CREATE TABLE `tp` ( `a` int(11) DEFAULT NULL, `b` varchar(55) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = ARCHIVE, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE) SELECT * FROM tp WHERE a = 99; a b 99 End of values @@ -292,9 +292,9 @@ tp CREATE TABLE `tp` ( `a` int(11) DEFAULT NULL, `b` varchar(55) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = ARCHIVE, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE) SELECT * FROM t; a b 10 Ten diff --git a/mysql-test/suite/parts/r/partition_exchange_innodb.result b/mysql-test/suite/parts/r/partition_exchange_innodb.result index 3070f7c3932..97aef348c59 100644 --- a/mysql-test/suite/parts/r/partition_exchange_innodb.result +++ b/mysql-test/suite/parts/r/partition_exchange_innodb.result @@ -13,8 +13,8 @@ tp CREATE TABLE `tp` ( `b` varchar(24) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) -PARTITIONS 4 */ + PARTITION BY HASH (a) +PARTITIONS 4 SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( @@ -86,8 +86,8 @@ tp CREATE TABLE `tp` ( `b` varchar(24) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB AUTO_INCREMENT=112 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) -PARTITIONS 4 */ + PARTITION BY HASH (a) +PARTITIONS 4 SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( @@ -194,9 +194,9 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SET DEBUG_SYNC= 'now SIGNAL goto_verification'; SET DEBUG_SYNC= 'now WAIT_FOR swap_in_progress'; # select from t and select/update/delete/insert from tp should work @@ -237,9 +237,9 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SET DEBUG_SYNC= 'now SIGNAL goto_wait'; SET DEBUG_SYNC= 'now WAIT_FOR swap_in_progress'; # Both tables should now be under exclusive lock, even SHOW should fail @@ -312,9 +312,9 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM tp WHERE a = 99; a b 99 End of values @@ -346,9 +346,9 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t; a b 10 Ten diff --git a/mysql-test/suite/parts/r/partition_exchange_memory.result b/mysql-test/suite/parts/r/partition_exchange_memory.result index edd3667a484..9c270422e17 100644 --- a/mysql-test/suite/parts/r/partition_exchange_memory.result +++ b/mysql-test/suite/parts/r/partition_exchange_memory.result @@ -13,8 +13,8 @@ tp CREATE TABLE `tp` ( `b` varchar(24) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) -PARTITIONS 4 */ + PARTITION BY HASH (a) +PARTITIONS 4 SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( @@ -86,8 +86,8 @@ tp CREATE TABLE `tp` ( `b` varchar(24) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY AUTO_INCREMENT=112 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) -PARTITIONS 4 */ + PARTITION BY HASH (a) +PARTITIONS 4 SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( @@ -194,9 +194,9 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MEMORY, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MEMORY) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MEMORY) SET DEBUG_SYNC= 'now SIGNAL goto_verification'; SET DEBUG_SYNC= 'now WAIT_FOR swap_in_progress'; # select from t and select/update/delete/insert from tp should work @@ -237,9 +237,9 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MEMORY, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MEMORY) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MEMORY) SET DEBUG_SYNC= 'now SIGNAL goto_wait'; SET DEBUG_SYNC= 'now WAIT_FOR swap_in_progress'; # Both tables should now be under exclusive lock, even SHOW should fail @@ -312,9 +312,9 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MEMORY, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MEMORY) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MEMORY) SELECT * FROM tp WHERE a = 99; a b 99 End of values @@ -346,9 +346,9 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MEMORY, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MEMORY) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MEMORY) SELECT * FROM t; a b 10 Ten diff --git a/mysql-test/suite/parts/r/partition_exchange_myisam.result b/mysql-test/suite/parts/r/partition_exchange_myisam.result index 9ad0b9f2728..ecabe7bde1d 100644 --- a/mysql-test/suite/parts/r/partition_exchange_myisam.result +++ b/mysql-test/suite/parts/r/partition_exchange_myisam.result @@ -13,8 +13,8 @@ tp CREATE TABLE `tp` ( `b` varchar(24) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) -PARTITIONS 4 */ + PARTITION BY HASH (a) +PARTITIONS 4 SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( @@ -86,8 +86,8 @@ tp CREATE TABLE `tp` ( `b` varchar(24) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM AUTO_INCREMENT=112 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) -PARTITIONS 4 */ + PARTITION BY HASH (a) +PARTITIONS 4 SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( @@ -194,9 +194,9 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SET DEBUG_SYNC= 'now SIGNAL goto_verification'; SET DEBUG_SYNC= 'now WAIT_FOR swap_in_progress'; # select from t and select/update/delete/insert from tp should work @@ -237,9 +237,9 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SET DEBUG_SYNC= 'now SIGNAL goto_wait'; SET DEBUG_SYNC= 'now WAIT_FOR swap_in_progress'; # Both tables should now be under exclusive lock, even SHOW should fail @@ -312,9 +312,9 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM tp WHERE a = 99; a b 99 End of values @@ -346,9 +346,9 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t; a b 10 Ten diff --git a/mysql-test/suite/parts/r/partition_float_innodb.result b/mysql-test/suite/parts/r/partition_float_innodb.result index d2f04a68629..d7f6e4bb4ac 100644 --- a/mysql-test/suite/parts/r/partition_float_innodb.result +++ b/mysql-test/suite/parts/r/partition_float_innodb.result @@ -10,11 +10,11 @@ t1 CREATE TABLE `t1` ( `a` float NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) insert into t1 values (-3.402823466E+38), (3.402823466E+38), (-1.5), (-1), (0), (1), (1.5); select * from t1; a @@ -46,8 +46,8 @@ t2 CREATE TABLE `t2` ( `a` float NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 10 */ + PARTITION BY KEY (a) +PARTITIONS 10 insert into t2 values (-3.402823466E+38), (-3.402823466E+37), (-123.456), (0), (1234546.789), (123.456), (1.5); select * from t2; a @@ -100,11 +100,11 @@ t1 CREATE TABLE `t1` ( `a` double NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) insert into t1 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208); select * from t1; a @@ -138,8 +138,8 @@ t2 CREATE TABLE `t2` ( `a` double NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 10 */ + PARTITION BY KEY (a) +PARTITIONS 10 insert into t2 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208); select * from t2; a diff --git a/mysql-test/suite/parts/r/partition_float_myisam.result b/mysql-test/suite/parts/r/partition_float_myisam.result index 2d52d095989..f4b57fc271a 100644 --- a/mysql-test/suite/parts/r/partition_float_myisam.result +++ b/mysql-test/suite/parts/r/partition_float_myisam.result @@ -10,11 +10,11 @@ t1 CREATE TABLE `t1` ( `a` float NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) insert into t1 values (-3.402823466E+38), (3.402823466E+38), (-1.5), (-1), (0), (1), (1.5); select * from t1; a @@ -46,8 +46,8 @@ t2 CREATE TABLE `t2` ( `a` float NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 10 */ + PARTITION BY KEY (a) +PARTITIONS 10 insert into t2 values (-3.402823466E+38), (-3.402823466E+37), (-123.456), (0), (1234546.789), (123.456), (1.5); select * from t2; a @@ -100,11 +100,11 @@ t1 CREATE TABLE `t1` ( `a` double NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) insert into t1 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208); select * from t1; a @@ -138,8 +138,8 @@ t2 CREATE TABLE `t2` ( `a` double NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 10 */ + PARTITION BY KEY (a) +PARTITIONS 10 insert into t2 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208); select * from t2; a diff --git a/mysql-test/suite/parts/r/partition_int_innodb.result b/mysql-test/suite/parts/r/partition_int_innodb.result index 7a51b80d5d7..9556aca2a96 100644 --- a/mysql-test/suite/parts/r/partition_int_innodb.result +++ b/mysql-test/suite/parts/r/partition_int_innodb.result @@ -10,11 +10,11 @@ t1 CREATE TABLE `t1` ( `a` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) insert into t1 values (255), (254), (253), (252), (1), (2), (128); select * from t1; a @@ -46,8 +46,8 @@ t2 CREATE TABLE `t2` ( `a` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 8 */ + PARTITION BY KEY (a) +PARTITIONS 8 insert into t2 values (255), (254), (253), (252); select * from t2; a @@ -78,8 +78,8 @@ t3 CREATE TABLE `t3` ( `a` tinyint(4) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 7 */ + PARTITION BY KEY (a) +PARTITIONS 7 insert into t3 values (127), (126), (125), (124), (-128), (-127), (1), (-1), (0); select * from t3; a @@ -119,11 +119,11 @@ t1 CREATE TABLE `t1` ( `a` smallint(5) unsigned NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) insert into t1 values (65535), (65534), (65533), (65532), (1), (2), (256); select * from t1; a @@ -155,8 +155,8 @@ t2 CREATE TABLE `t2` ( `a` smallint(5) unsigned NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 8 */ + PARTITION BY KEY (a) +PARTITIONS 8 insert into t2 values (65535), (65534), (65533), (65532); select * from t2; a @@ -187,8 +187,8 @@ t3 CREATE TABLE `t3` ( `a` smallint(6) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 7 */ + PARTITION BY KEY (a) +PARTITIONS 7 insert into t3 values (32767), (32766), (32765), (32764), (-32768), (-32767), (1), (-1), (0); select * from t3; a @@ -228,11 +228,11 @@ t1 CREATE TABLE `t1` ( `a` int(10) unsigned NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) insert into t1 values (4294967295), (4294967294), (4294967293), (4294967292), (1), (2), (65535); select * from t1; a @@ -264,8 +264,8 @@ t2 CREATE TABLE `t2` ( `a` int(10) unsigned NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 8 */ + PARTITION BY KEY (a) +PARTITIONS 8 insert into t2 values (4294967295), (4294967294), (4294967293), (4294967292); select * from t2; a @@ -296,8 +296,8 @@ t3 CREATE TABLE `t3` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 7 */ + PARTITION BY KEY (a) +PARTITIONS 7 insert into t3 values (2147483647), (2147483646), (2147483645), (2147483644), (-2147483648), (-2147483647), (1), (-1), (0); select * from t3; a @@ -337,11 +337,11 @@ t1 CREATE TABLE `t1` ( `a` mediumint(8) unsigned NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) insert into t1 values (16777215), (16777214), (16777213), (16777212), (1), (2), (65535); select * from t1; a @@ -373,8 +373,8 @@ t2 CREATE TABLE `t2` ( `a` mediumint(8) unsigned NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 8 */ + PARTITION BY KEY (a) +PARTITIONS 8 insert into t2 values (16777215), (16777214), (16777213), (16777212); select * from t2; a @@ -405,8 +405,8 @@ t3 CREATE TABLE `t3` ( `a` mediumint(9) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 7 */ + PARTITION BY KEY (a) +PARTITIONS 7 insert into t3 values (8388607), (8388606), (8388605), (8388604), (-8388608), (-8388607), (1), (-1), (0); select * from t3; a @@ -446,11 +446,11 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) unsigned NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612), (1), (2), (65535); select * from t1; a @@ -494,8 +494,8 @@ t2 CREATE TABLE `t2` ( `a` bigint(20) unsigned NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 8 */ + PARTITION BY KEY (a) +PARTITIONS 8 insert into t2 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612); select * from t2; a @@ -526,8 +526,8 @@ t3 CREATE TABLE `t3` ( `a` bigint(20) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 7 */ + PARTITION BY KEY (a) +PARTITIONS 7 insert into t3 values (9223372036854775807), (9223372036854775806), (9223372036854775805), (9223372036854775804), (-9223372036854775808), (-9223372036854775807), (1), (-1), (0); select * from t3; a diff --git a/mysql-test/suite/parts/r/partition_int_myisam.result b/mysql-test/suite/parts/r/partition_int_myisam.result index 4387bbfdd78..9eaa98af38f 100644 --- a/mysql-test/suite/parts/r/partition_int_myisam.result +++ b/mysql-test/suite/parts/r/partition_int_myisam.result @@ -10,11 +10,11 @@ t1 CREATE TABLE `t1` ( `a` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) insert into t1 values (255), (254), (253), (252), (1), (2), (128); select * from t1; a @@ -46,8 +46,8 @@ t2 CREATE TABLE `t2` ( `a` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 8 */ + PARTITION BY KEY (a) +PARTITIONS 8 insert into t2 values (255), (254), (253), (252); select * from t2; a @@ -78,8 +78,8 @@ t3 CREATE TABLE `t3` ( `a` tinyint(4) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 7 */ + PARTITION BY KEY (a) +PARTITIONS 7 insert into t3 values (127), (126), (125), (124), (-128), (-127), (1), (-1), (0); select * from t3; a @@ -119,11 +119,11 @@ t1 CREATE TABLE `t1` ( `a` smallint(5) unsigned NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) insert into t1 values (65535), (65534), (65533), (65532), (1), (2), (256); select * from t1; a @@ -155,8 +155,8 @@ t2 CREATE TABLE `t2` ( `a` smallint(5) unsigned NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 8 */ + PARTITION BY KEY (a) +PARTITIONS 8 insert into t2 values (65535), (65534), (65533), (65532); select * from t2; a @@ -187,8 +187,8 @@ t3 CREATE TABLE `t3` ( `a` smallint(6) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 7 */ + PARTITION BY KEY (a) +PARTITIONS 7 insert into t3 values (32767), (32766), (32765), (32764), (-32768), (-32767), (1), (-1), (0); select * from t3; a @@ -228,11 +228,11 @@ t1 CREATE TABLE `t1` ( `a` int(10) unsigned NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) insert into t1 values (4294967295), (4294967294), (4294967293), (4294967292), (1), (2), (65535); select * from t1; a @@ -264,8 +264,8 @@ t2 CREATE TABLE `t2` ( `a` int(10) unsigned NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 8 */ + PARTITION BY KEY (a) +PARTITIONS 8 insert into t2 values (4294967295), (4294967294), (4294967293), (4294967292); select * from t2; a @@ -296,8 +296,8 @@ t3 CREATE TABLE `t3` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 7 */ + PARTITION BY KEY (a) +PARTITIONS 7 insert into t3 values (2147483647), (2147483646), (2147483645), (2147483644), (-2147483648), (-2147483647), (1), (-1), (0); select * from t3; a @@ -337,11 +337,11 @@ t1 CREATE TABLE `t1` ( `a` mediumint(8) unsigned NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) insert into t1 values (16777215), (16777214), (16777213), (16777212), (1), (2), (65535); select * from t1; a @@ -373,8 +373,8 @@ t2 CREATE TABLE `t2` ( `a` mediumint(8) unsigned NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 8 */ + PARTITION BY KEY (a) +PARTITIONS 8 insert into t2 values (16777215), (16777214), (16777213), (16777212); select * from t2; a @@ -405,8 +405,8 @@ t3 CREATE TABLE `t3` ( `a` mediumint(9) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 7 */ + PARTITION BY KEY (a) +PARTITIONS 7 insert into t3 values (8388607), (8388606), (8388605), (8388604), (-8388608), (-8388607), (1), (-1), (0); select * from t3; a @@ -446,11 +446,11 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) unsigned NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612), (1), (2), (65535); select * from t1; a @@ -494,8 +494,8 @@ t2 CREATE TABLE `t2` ( `a` bigint(20) unsigned NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 8 */ + PARTITION BY KEY (a) +PARTITIONS 8 insert into t2 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612); select * from t2; a @@ -526,8 +526,8 @@ t3 CREATE TABLE `t3` ( `a` bigint(20) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) -PARTITIONS 7 */ + PARTITION BY KEY (a) +PARTITIONS 7 insert into t3 values (9223372036854775807), (9223372036854775806), (9223372036854775805), (9223372036854775804), (-9223372036854775808), (-9223372036854775807), (1), (-1), (0); select * from t3; a diff --git a/mysql-test/suite/parts/r/partition_mgm_lc0_archive.result b/mysql-test/suite/parts/r/partition_mgm_lc0_archive.result index 330258094ef..de888826906 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc0_archive.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc0_archive.result @@ -56,14 +56,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = ARCHIVE, PARTITION partB ENGINE = ARCHIVE, PARTITION Partc ENGINE = ARCHIVE, PARTITION PartD ENGINE = ARCHIVE, PARTITION partE ENGINE = ARCHIVE, PARTITION Partf ENGINE = ARCHIVE, - PARTITION PartG ENGINE = ARCHIVE) */ + PARTITION PartG ENGINE = ARCHIVE) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -84,10 +84,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = ARCHIVE, PARTITION partB ENGINE = ARCHIVE, - PARTITION Partc ENGINE = ARCHIVE) */ + PARTITION Partc ENGINE = ARCHIVE) # Test of EXCHANGE PARTITION WITH TABLE SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME TABLE_ROWS @@ -112,10 +112,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = ARCHIVE, PARTITION partB ENGINE = ARCHIVE, - PARTITION Partc ENGINE = ARCHIVE) */ + PARTITION Partc ENGINE = ARCHIVE) SELECT * FROM TableB; a 10 @@ -156,10 +156,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = ARCHIVE, PARTITION partB ENGINE = ARCHIVE, - PARTITION Partc ENGINE = ARCHIVE) */ + PARTITION Partc ENGINE = ARCHIVE) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -192,10 +192,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = ARCHIVE, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = ARCHIVE, - PARTITION Partc ENGINE = ARCHIVE) */ + PARTITION Partc ENGINE = ARCHIVE) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -271,11 +271,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = ARCHIVE, PARTITION partB ENGINE = ARCHIVE, PARTITION Partc ENGINE = ARCHIVE, - PARTITION PartD ENGINE = ARCHIVE) */ + PARTITION PartD ENGINE = ARCHIVE) DROP TABLE tablea; # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; @@ -364,14 +364,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = ARCHIVE, PARTITION partB ENGINE = ARCHIVE, PARTITION Partc ENGINE = ARCHIVE, PARTITION PartD ENGINE = ARCHIVE, PARTITION partE ENGINE = ARCHIVE, PARTITION Partf ENGINE = ARCHIVE, - PARTITION PartG ENGINE = ARCHIVE) */ + PARTITION PartG ENGINE = ARCHIVE) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -392,10 +392,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = ARCHIVE, PARTITION partB ENGINE = ARCHIVE, - PARTITION Partc ENGINE = ARCHIVE) */ + PARTITION Partc ENGINE = ARCHIVE) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -428,10 +428,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = ARCHIVE, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = ARCHIVE, - PARTITION Partc ENGINE = ARCHIVE) */ + PARTITION Partc ENGINE = ARCHIVE) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -507,11 +507,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = ARCHIVE, PARTITION partB ENGINE = ARCHIVE, PARTITION Partc ENGINE = ARCHIVE, - PARTITION PartD ENGINE = ARCHIVE) */ + PARTITION PartD ENGINE = ARCHIVE) DROP TABLE tablea; # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; @@ -589,14 +589,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = ARCHIVE, PARTITION partB VALUES LESS THAN (7) ENGINE = ARCHIVE, PARTITION Partc VALUES LESS THAN (10) ENGINE = ARCHIVE, PARTITION PartD VALUES LESS THAN (13) ENGINE = ARCHIVE, PARTITION partE VALUES LESS THAN (16) ENGINE = ARCHIVE, PARTITION Partf VALUES LESS THAN (19) ENGINE = ARCHIVE, - PARTITION PartG VALUES LESS THAN (22) ENGINE = ARCHIVE) */ + PARTITION PartG VALUES LESS THAN (22) ENGINE = ARCHIVE) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION @@ -620,12 +620,12 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = ARCHIVE, PARTITION partB VALUES LESS THAN (7) ENGINE = ARCHIVE, PARTITION Partc VALUES LESS THAN (10) ENGINE = ARCHIVE, PARTITION PartD VALUES LESS THAN (13) ENGINE = ARCHIVE, - PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE) */ + PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE) # Test of REORGANIZE PARTITIONS # Error since it must reorganize a consecutive range ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO @@ -658,11 +658,11 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = ARCHIVE, PARTITION partD VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = ARCHIVE, PARTITION partB VALUES LESS THAN (11) COMMENT = 'Previously partly Partc and partly PartD' ENGINE = ARCHIVE, - PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = ARCHIVE) */ + PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = ARCHIVE) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -738,11 +738,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = ARCHIVE, PARTITION partB VALUES LESS THAN (7) ENGINE = ARCHIVE, PARTITION Partc VALUES LESS THAN (10) ENGINE = ARCHIVE, - PARTITION PartD VALUES LESS THAN (13) ENGINE = ARCHIVE) */ + PARTITION PartD VALUES LESS THAN (13) ENGINE = ARCHIVE) DROP TABLE tablea; # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; @@ -820,14 +820,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = ARCHIVE, PARTITION partB VALUES IN (2,10,11) ENGINE = ARCHIVE, PARTITION Partc VALUES IN (3,4,7) ENGINE = ARCHIVE, PARTITION PartD VALUES IN (5,6,12) ENGINE = ARCHIVE, PARTITION partE VALUES IN (16) ENGINE = ARCHIVE, PARTITION Partf VALUES IN (19) ENGINE = ARCHIVE, - PARTITION PartG VALUES IN (22) ENGINE = ARCHIVE) */ + PARTITION PartG VALUES IN (22) ENGINE = ARCHIVE) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION @@ -851,12 +851,12 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = ARCHIVE, PARTITION partB VALUES IN (2,10,11) ENGINE = ARCHIVE, PARTITION Partc VALUES IN (3,4,7) ENGINE = ARCHIVE, PARTITION PartD VALUES IN (5,6,12) ENGINE = ARCHIVE, - PARTITION PartE VALUES IN (13) ENGINE = ARCHIVE) */ + PARTITION PartE VALUES IN (13) ENGINE = ARCHIVE) # Test of REORGANIZE PARTITIONS ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO (PARTITION Partc VALUES IN (1,7) @@ -889,12 +889,12 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION Partc VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = ARCHIVE, PARTITION parta VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = ARCHIVE, PARTITION partB VALUES IN (4,8) COMMENT = 'Mix 3 of old parta and Partc' ENGINE = ARCHIVE, PARTITION PartD VALUES IN (5,6,12) ENGINE = ARCHIVE, - PARTITION PartE VALUES IN (13) ENGINE = ARCHIVE) */ + PARTITION PartE VALUES IN (13) ENGINE = ARCHIVE) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -961,11 +961,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = ARCHIVE, PARTITION partB VALUES IN (2,10,11) ENGINE = ARCHIVE, PARTITION Partc VALUES IN (3,4,7) ENGINE = ARCHIVE, - PARTITION PartD VALUES IN (5,6,12) ENGINE = ARCHIVE) */ + PARTITION PartD VALUES IN (5,6,12) ENGINE = ARCHIVE) DROP TABLE tablea; # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; diff --git a/mysql-test/suite/parts/r/partition_mgm_lc0_innodb.result b/mysql-test/suite/parts/r/partition_mgm_lc0_innodb.result index 5b54e9c571f..dcc48f46251 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc0_innodb.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc0_innodb.result @@ -56,14 +56,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = InnoDB, PARTITION partB ENGINE = InnoDB, PARTITION Partc ENGINE = InnoDB, PARTITION PartD ENGINE = InnoDB, PARTITION partE ENGINE = InnoDB, PARTITION Partf ENGINE = InnoDB, - PARTITION PartG ENGINE = InnoDB) */ + PARTITION PartG ENGINE = InnoDB) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -84,10 +84,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = InnoDB, PARTITION partB ENGINE = InnoDB, - PARTITION Partc ENGINE = InnoDB) */ + PARTITION Partc ENGINE = InnoDB) # Test of EXCHANGE PARTITION WITH TABLE SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME TABLE_ROWS @@ -112,10 +112,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = InnoDB, PARTITION partB ENGINE = InnoDB, - PARTITION Partc ENGINE = InnoDB) */ + PARTITION Partc ENGINE = InnoDB) SELECT * FROM TableB; a 10 @@ -156,10 +156,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = InnoDB, PARTITION partB ENGINE = InnoDB, - PARTITION Partc ENGINE = InnoDB) */ + PARTITION Partc ENGINE = InnoDB) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -192,10 +192,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = InnoDB, - PARTITION Partc ENGINE = InnoDB) */ + PARTITION Partc ENGINE = InnoDB) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -271,11 +271,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = InnoDB, PARTITION partB ENGINE = InnoDB, PARTITION Partc ENGINE = InnoDB, - PARTITION PartD ENGINE = InnoDB) */ + PARTITION PartD ENGINE = InnoDB) DROP TABLE tablea; # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; @@ -364,14 +364,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = InnoDB, PARTITION partB ENGINE = InnoDB, PARTITION Partc ENGINE = InnoDB, PARTITION PartD ENGINE = InnoDB, PARTITION partE ENGINE = InnoDB, PARTITION Partf ENGINE = InnoDB, - PARTITION PartG ENGINE = InnoDB) */ + PARTITION PartG ENGINE = InnoDB) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -392,10 +392,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = InnoDB, PARTITION partB ENGINE = InnoDB, - PARTITION Partc ENGINE = InnoDB) */ + PARTITION Partc ENGINE = InnoDB) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -428,10 +428,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = InnoDB, - PARTITION Partc ENGINE = InnoDB) */ + PARTITION Partc ENGINE = InnoDB) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -507,11 +507,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = InnoDB, PARTITION partB ENGINE = InnoDB, PARTITION Partc ENGINE = InnoDB, - PARTITION PartD ENGINE = InnoDB) */ + PARTITION PartD ENGINE = InnoDB) DROP TABLE tablea; # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; @@ -589,14 +589,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION partB VALUES LESS THAN (7) ENGINE = InnoDB, PARTITION Partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION PartD VALUES LESS THAN (13) ENGINE = InnoDB, PARTITION partE VALUES LESS THAN (16) ENGINE = InnoDB, PARTITION Partf VALUES LESS THAN (19) ENGINE = InnoDB, - PARTITION PartG VALUES LESS THAN (22) ENGINE = InnoDB) */ + PARTITION PartG VALUES LESS THAN (22) ENGINE = InnoDB) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION @@ -620,12 +620,12 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION partB VALUES LESS THAN (7) ENGINE = InnoDB, PARTITION Partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION PartD VALUES LESS THAN (13) ENGINE = InnoDB, - PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = InnoDB) # Test of REORGANIZE PARTITIONS # Error since it must reorganize a consecutive range ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO @@ -658,11 +658,11 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION partD VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = InnoDB, PARTITION partB VALUES LESS THAN (11) COMMENT = 'Previously partly Partc and partly PartD' ENGINE = InnoDB, - PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = InnoDB) */ + PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = InnoDB) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -738,11 +738,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION partB VALUES LESS THAN (7) ENGINE = InnoDB, PARTITION Partc VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION PartD VALUES LESS THAN (13) ENGINE = InnoDB) */ + PARTITION PartD VALUES LESS THAN (13) ENGINE = InnoDB) DROP TABLE tablea; # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; @@ -820,14 +820,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = InnoDB, PARTITION partB VALUES IN (2,10,11) ENGINE = InnoDB, PARTITION Partc VALUES IN (3,4,7) ENGINE = InnoDB, PARTITION PartD VALUES IN (5,6,12) ENGINE = InnoDB, PARTITION partE VALUES IN (16) ENGINE = InnoDB, PARTITION Partf VALUES IN (19) ENGINE = InnoDB, - PARTITION PartG VALUES IN (22) ENGINE = InnoDB) */ + PARTITION PartG VALUES IN (22) ENGINE = InnoDB) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION @@ -851,12 +851,12 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = InnoDB, PARTITION partB VALUES IN (2,10,11) ENGINE = InnoDB, PARTITION Partc VALUES IN (3,4,7) ENGINE = InnoDB, PARTITION PartD VALUES IN (5,6,12) ENGINE = InnoDB, - PARTITION PartE VALUES IN (13) ENGINE = InnoDB) */ + PARTITION PartE VALUES IN (13) ENGINE = InnoDB) # Test of REORGANIZE PARTITIONS ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO (PARTITION Partc VALUES IN (1,7) @@ -889,12 +889,12 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION Partc VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = InnoDB, PARTITION parta VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = InnoDB, PARTITION partB VALUES IN (4,8) COMMENT = 'Mix 3 of old parta and Partc' ENGINE = InnoDB, PARTITION PartD VALUES IN (5,6,12) ENGINE = InnoDB, - PARTITION PartE VALUES IN (13) ENGINE = InnoDB) */ + PARTITION PartE VALUES IN (13) ENGINE = InnoDB) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -961,11 +961,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = InnoDB, PARTITION partB VALUES IN (2,10,11) ENGINE = InnoDB, PARTITION Partc VALUES IN (3,4,7) ENGINE = InnoDB, - PARTITION PartD VALUES IN (5,6,12) ENGINE = InnoDB) */ + PARTITION PartD VALUES IN (5,6,12) ENGINE = InnoDB) DROP TABLE tablea; # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; @@ -1004,10 +1004,10 @@ t1 CREATE TABLE `t1` ( `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION LT1000 VALUES LESS THAN (1000) ENGINE = InnoDB, PARTITION LT2000 VALUES LESS THAN (2000) ENGINE = InnoDB, - PARTITION MAX VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION MAX VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1 ORDER BY a; a b 1 First diff --git a/mysql-test/suite/parts/r/partition_mgm_lc0_memory.result b/mysql-test/suite/parts/r/partition_mgm_lc0_memory.result index dd4bed89ea8..5451b5a6fd3 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc0_memory.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc0_memory.result @@ -56,14 +56,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MEMORY, PARTITION partB ENGINE = MEMORY, PARTITION Partc ENGINE = MEMORY, PARTITION PartD ENGINE = MEMORY, PARTITION partE ENGINE = MEMORY, PARTITION Partf ENGINE = MEMORY, - PARTITION PartG ENGINE = MEMORY) */ + PARTITION PartG ENGINE = MEMORY) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -84,10 +84,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MEMORY, PARTITION partB ENGINE = MEMORY, - PARTITION Partc ENGINE = MEMORY) */ + PARTITION Partc ENGINE = MEMORY) # Test of EXCHANGE PARTITION WITH TABLE SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME TABLE_ROWS @@ -112,10 +112,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MEMORY, PARTITION partB ENGINE = MEMORY, - PARTITION Partc ENGINE = MEMORY) */ + PARTITION Partc ENGINE = MEMORY) SELECT * FROM TableB; a 10 @@ -156,10 +156,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MEMORY, PARTITION partB ENGINE = MEMORY, - PARTITION Partc ENGINE = MEMORY) */ + PARTITION Partc ENGINE = MEMORY) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -192,10 +192,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = MEMORY, - PARTITION Partc ENGINE = MEMORY) */ + PARTITION Partc ENGINE = MEMORY) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -271,11 +271,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MEMORY, PARTITION partB ENGINE = MEMORY, PARTITION Partc ENGINE = MEMORY, - PARTITION PartD ENGINE = MEMORY) */ + PARTITION PartD ENGINE = MEMORY) DROP TABLE tablea; # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; @@ -364,14 +364,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = MEMORY, PARTITION partB ENGINE = MEMORY, PARTITION Partc ENGINE = MEMORY, PARTITION PartD ENGINE = MEMORY, PARTITION partE ENGINE = MEMORY, PARTITION Partf ENGINE = MEMORY, - PARTITION PartG ENGINE = MEMORY) */ + PARTITION PartG ENGINE = MEMORY) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -392,10 +392,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = MEMORY, PARTITION partB ENGINE = MEMORY, - PARTITION Partc ENGINE = MEMORY) */ + PARTITION Partc ENGINE = MEMORY) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -428,10 +428,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = MEMORY, - PARTITION Partc ENGINE = MEMORY) */ + PARTITION Partc ENGINE = MEMORY) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -507,11 +507,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = MEMORY, PARTITION partB ENGINE = MEMORY, PARTITION Partc ENGINE = MEMORY, - PARTITION PartD ENGINE = MEMORY) */ + PARTITION PartD ENGINE = MEMORY) DROP TABLE tablea; # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; @@ -589,14 +589,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION partB VALUES LESS THAN (7) ENGINE = MEMORY, PARTITION Partc VALUES LESS THAN (10) ENGINE = MEMORY, PARTITION PartD VALUES LESS THAN (13) ENGINE = MEMORY, PARTITION partE VALUES LESS THAN (16) ENGINE = MEMORY, PARTITION Partf VALUES LESS THAN (19) ENGINE = MEMORY, - PARTITION PartG VALUES LESS THAN (22) ENGINE = MEMORY) */ + PARTITION PartG VALUES LESS THAN (22) ENGINE = MEMORY) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION @@ -620,12 +620,12 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION partB VALUES LESS THAN (7) ENGINE = MEMORY, PARTITION Partc VALUES LESS THAN (10) ENGINE = MEMORY, PARTITION PartD VALUES LESS THAN (13) ENGINE = MEMORY, - PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = MEMORY) */ + PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = MEMORY) # Test of REORGANIZE PARTITIONS # Error since it must reorganize a consecutive range ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO @@ -658,11 +658,11 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION partD VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MEMORY, PARTITION partB VALUES LESS THAN (11) COMMENT = 'Previously partly Partc and partly PartD' ENGINE = MEMORY, - PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = MEMORY) */ + PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = MEMORY) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -738,11 +738,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION partB VALUES LESS THAN (7) ENGINE = MEMORY, PARTITION Partc VALUES LESS THAN (10) ENGINE = MEMORY, - PARTITION PartD VALUES LESS THAN (13) ENGINE = MEMORY) */ + PARTITION PartD VALUES LESS THAN (13) ENGINE = MEMORY) DROP TABLE tablea; # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; @@ -820,14 +820,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = MEMORY, PARTITION partB VALUES IN (2,10,11) ENGINE = MEMORY, PARTITION Partc VALUES IN (3,4,7) ENGINE = MEMORY, PARTITION PartD VALUES IN (5,6,12) ENGINE = MEMORY, PARTITION partE VALUES IN (16) ENGINE = MEMORY, PARTITION Partf VALUES IN (19) ENGINE = MEMORY, - PARTITION PartG VALUES IN (22) ENGINE = MEMORY) */ + PARTITION PartG VALUES IN (22) ENGINE = MEMORY) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION @@ -851,12 +851,12 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = MEMORY, PARTITION partB VALUES IN (2,10,11) ENGINE = MEMORY, PARTITION Partc VALUES IN (3,4,7) ENGINE = MEMORY, PARTITION PartD VALUES IN (5,6,12) ENGINE = MEMORY, - PARTITION PartE VALUES IN (13) ENGINE = MEMORY) */ + PARTITION PartE VALUES IN (13) ENGINE = MEMORY) # Test of REORGANIZE PARTITIONS ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO (PARTITION Partc VALUES IN (1,7) @@ -889,12 +889,12 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION Partc VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MEMORY, PARTITION parta VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MEMORY, PARTITION partB VALUES IN (4,8) COMMENT = 'Mix 3 of old parta and Partc' ENGINE = MEMORY, PARTITION PartD VALUES IN (5,6,12) ENGINE = MEMORY, - PARTITION PartE VALUES IN (13) ENGINE = MEMORY) */ + PARTITION PartE VALUES IN (13) ENGINE = MEMORY) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -961,11 +961,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = MEMORY, PARTITION partB VALUES IN (2,10,11) ENGINE = MEMORY, PARTITION Partc VALUES IN (3,4,7) ENGINE = MEMORY, - PARTITION PartD VALUES IN (5,6,12) ENGINE = MEMORY) */ + PARTITION PartD VALUES IN (5,6,12) ENGINE = MEMORY) DROP TABLE tablea; # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; @@ -1004,10 +1004,10 @@ t1 CREATE TABLE `t1` ( `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION LT1000 VALUES LESS THAN (1000) ENGINE = MEMORY, PARTITION LT2000 VALUES LESS THAN (2000) ENGINE = MEMORY, - PARTITION MAX VALUES LESS THAN MAXVALUE ENGINE = MEMORY) */ + PARTITION MAX VALUES LESS THAN MAXVALUE ENGINE = MEMORY) SELECT * FROM t1 ORDER BY a; a b 1 First diff --git a/mysql-test/suite/parts/r/partition_mgm_lc0_myisam.result b/mysql-test/suite/parts/r/partition_mgm_lc0_myisam.result index b01279017fe..40399ae3312 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc0_myisam.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc0_myisam.result @@ -56,14 +56,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MyISAM, PARTITION partB ENGINE = MyISAM, PARTITION Partc ENGINE = MyISAM, PARTITION PartD ENGINE = MyISAM, PARTITION partE ENGINE = MyISAM, PARTITION Partf ENGINE = MyISAM, - PARTITION PartG ENGINE = MyISAM) */ + PARTITION PartG ENGINE = MyISAM) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -84,10 +84,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MyISAM, PARTITION partB ENGINE = MyISAM, - PARTITION Partc ENGINE = MyISAM) */ + PARTITION Partc ENGINE = MyISAM) # Test of EXCHANGE PARTITION WITH TABLE SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME TABLE_ROWS @@ -112,10 +112,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MyISAM, PARTITION partB ENGINE = MyISAM, - PARTITION Partc ENGINE = MyISAM) */ + PARTITION Partc ENGINE = MyISAM) SELECT * FROM TableB; a 10 @@ -156,10 +156,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MyISAM, PARTITION partB ENGINE = MyISAM, - PARTITION Partc ENGINE = MyISAM) */ + PARTITION Partc ENGINE = MyISAM) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -192,10 +192,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = MyISAM, - PARTITION Partc ENGINE = MyISAM) */ + PARTITION Partc ENGINE = MyISAM) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -271,11 +271,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MyISAM, PARTITION partB ENGINE = MyISAM, PARTITION Partc ENGINE = MyISAM, - PARTITION PartD ENGINE = MyISAM) */ + PARTITION PartD ENGINE = MyISAM) DROP TABLE tablea; # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; @@ -364,14 +364,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = MyISAM, PARTITION partB ENGINE = MyISAM, PARTITION Partc ENGINE = MyISAM, PARTITION PartD ENGINE = MyISAM, PARTITION partE ENGINE = MyISAM, PARTITION Partf ENGINE = MyISAM, - PARTITION PartG ENGINE = MyISAM) */ + PARTITION PartG ENGINE = MyISAM) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -392,10 +392,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = MyISAM, PARTITION partB ENGINE = MyISAM, - PARTITION Partc ENGINE = MyISAM) */ + PARTITION Partc ENGINE = MyISAM) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -428,10 +428,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = MyISAM, - PARTITION Partc ENGINE = MyISAM) */ + PARTITION Partc ENGINE = MyISAM) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -507,11 +507,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = MyISAM, PARTITION partB ENGINE = MyISAM, PARTITION Partc ENGINE = MyISAM, - PARTITION PartD ENGINE = MyISAM) */ + PARTITION PartD ENGINE = MyISAM) DROP TABLE tablea; # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; @@ -589,14 +589,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION partB VALUES LESS THAN (7) ENGINE = MyISAM, PARTITION Partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION PartD VALUES LESS THAN (13) ENGINE = MyISAM, PARTITION partE VALUES LESS THAN (16) ENGINE = MyISAM, PARTITION Partf VALUES LESS THAN (19) ENGINE = MyISAM, - PARTITION PartG VALUES LESS THAN (22) ENGINE = MyISAM) */ + PARTITION PartG VALUES LESS THAN (22) ENGINE = MyISAM) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION @@ -620,12 +620,12 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION partB VALUES LESS THAN (7) ENGINE = MyISAM, PARTITION Partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION PartD VALUES LESS THAN (13) ENGINE = MyISAM, - PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = MyISAM) # Test of REORGANIZE PARTITIONS # Error since it must reorganize a consecutive range ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO @@ -658,11 +658,11 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION partD VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MyISAM, PARTITION partB VALUES LESS THAN (11) COMMENT = 'Previously partly Partc and partly PartD' ENGINE = MyISAM, - PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = MyISAM) */ + PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = MyISAM) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -738,11 +738,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION partB VALUES LESS THAN (7) ENGINE = MyISAM, PARTITION Partc VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION PartD VALUES LESS THAN (13) ENGINE = MyISAM) */ + PARTITION PartD VALUES LESS THAN (13) ENGINE = MyISAM) DROP TABLE tablea; # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; @@ -820,14 +820,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = MyISAM, PARTITION partB VALUES IN (2,10,11) ENGINE = MyISAM, PARTITION Partc VALUES IN (3,4,7) ENGINE = MyISAM, PARTITION PartD VALUES IN (5,6,12) ENGINE = MyISAM, PARTITION partE VALUES IN (16) ENGINE = MyISAM, PARTITION Partf VALUES IN (19) ENGINE = MyISAM, - PARTITION PartG VALUES IN (22) ENGINE = MyISAM) */ + PARTITION PartG VALUES IN (22) ENGINE = MyISAM) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION @@ -851,12 +851,12 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = MyISAM, PARTITION partB VALUES IN (2,10,11) ENGINE = MyISAM, PARTITION Partc VALUES IN (3,4,7) ENGINE = MyISAM, PARTITION PartD VALUES IN (5,6,12) ENGINE = MyISAM, - PARTITION PartE VALUES IN (13) ENGINE = MyISAM) */ + PARTITION PartE VALUES IN (13) ENGINE = MyISAM) # Test of REORGANIZE PARTITIONS ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO (PARTITION Partc VALUES IN (1,7) @@ -889,12 +889,12 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION Partc VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MyISAM, PARTITION parta VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MyISAM, PARTITION partB VALUES IN (4,8) COMMENT = 'Mix 3 of old parta and Partc' ENGINE = MyISAM, PARTITION PartD VALUES IN (5,6,12) ENGINE = MyISAM, - PARTITION PartE VALUES IN (13) ENGINE = MyISAM) */ + PARTITION PartE VALUES IN (13) ENGINE = MyISAM) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -961,11 +961,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = MyISAM, PARTITION partB VALUES IN (2,10,11) ENGINE = MyISAM, PARTITION Partc VALUES IN (3,4,7) ENGINE = MyISAM, - PARTITION PartD VALUES IN (5,6,12) ENGINE = MyISAM) */ + PARTITION PartD VALUES IN (5,6,12) ENGINE = MyISAM) DROP TABLE tablea; # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; @@ -1004,10 +1004,10 @@ t1 CREATE TABLE `t1` ( `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION LT1000 VALUES LESS THAN (1000) ENGINE = MyISAM, PARTITION LT2000 VALUES LESS THAN (2000) ENGINE = MyISAM, - PARTITION MAX VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION MAX VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1 ORDER BY a; a b 1 First diff --git a/mysql-test/suite/parts/r/partition_mgm_lc1_archive.result b/mysql-test/suite/parts/r/partition_mgm_lc1_archive.result index 66ba08cfbe0..40436328185 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc1_archive.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc1_archive.result @@ -56,14 +56,14 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = ARCHIVE, PARTITION partB ENGINE = ARCHIVE, PARTITION Partc ENGINE = ARCHIVE, PARTITION PartD ENGINE = ARCHIVE, PARTITION partE ENGINE = ARCHIVE, PARTITION Partf ENGINE = ARCHIVE, - PARTITION PartG ENGINE = ARCHIVE) */ + PARTITION PartG ENGINE = ARCHIVE) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -84,10 +84,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = ARCHIVE, PARTITION partB ENGINE = ARCHIVE, - PARTITION Partc ENGINE = ARCHIVE) */ + PARTITION Partc ENGINE = ARCHIVE) # Test of EXCHANGE PARTITION WITH TABLE SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME TABLE_ROWS @@ -112,10 +112,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = ARCHIVE, PARTITION partB ENGINE = ARCHIVE, - PARTITION Partc ENGINE = ARCHIVE) */ + PARTITION Partc ENGINE = ARCHIVE) SELECT * FROM TableB; a 10 @@ -156,10 +156,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = ARCHIVE, PARTITION partB ENGINE = ARCHIVE, - PARTITION Partc ENGINE = ARCHIVE) */ + PARTITION Partc ENGINE = ARCHIVE) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -192,10 +192,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = ARCHIVE, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = ARCHIVE, - PARTITION Partc ENGINE = ARCHIVE) */ + PARTITION Partc ENGINE = ARCHIVE) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -264,10 +264,10 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = ARCHIVE, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = ARCHIVE, - PARTITION Partc ENGINE = ARCHIVE) */ + PARTITION Partc ENGINE = ARCHIVE) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -355,14 +355,14 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = ARCHIVE, PARTITION partB ENGINE = ARCHIVE, PARTITION Partc ENGINE = ARCHIVE, PARTITION PartD ENGINE = ARCHIVE, PARTITION partE ENGINE = ARCHIVE, PARTITION Partf ENGINE = ARCHIVE, - PARTITION PartG ENGINE = ARCHIVE) */ + PARTITION PartG ENGINE = ARCHIVE) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -383,10 +383,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = ARCHIVE, PARTITION partB ENGINE = ARCHIVE, - PARTITION Partc ENGINE = ARCHIVE) */ + PARTITION Partc ENGINE = ARCHIVE) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -419,10 +419,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = ARCHIVE, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = ARCHIVE, - PARTITION Partc ENGINE = ARCHIVE) */ + PARTITION Partc ENGINE = ARCHIVE) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -491,10 +491,10 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = ARCHIVE, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = ARCHIVE, - PARTITION Partc ENGINE = ARCHIVE) */ + PARTITION Partc ENGINE = ARCHIVE) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -571,14 +571,14 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = ARCHIVE, PARTITION partB VALUES LESS THAN (7) ENGINE = ARCHIVE, PARTITION Partc VALUES LESS THAN (10) ENGINE = ARCHIVE, PARTITION PartD VALUES LESS THAN (13) ENGINE = ARCHIVE, PARTITION partE VALUES LESS THAN (16) ENGINE = ARCHIVE, PARTITION Partf VALUES LESS THAN (19) ENGINE = ARCHIVE, - PARTITION PartG VALUES LESS THAN (22) ENGINE = ARCHIVE) */ + PARTITION PartG VALUES LESS THAN (22) ENGINE = ARCHIVE) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION @@ -602,12 +602,12 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = ARCHIVE, PARTITION partB VALUES LESS THAN (7) ENGINE = ARCHIVE, PARTITION Partc VALUES LESS THAN (10) ENGINE = ARCHIVE, PARTITION PartD VALUES LESS THAN (13) ENGINE = ARCHIVE, - PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE) */ + PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE) # Test of REORGANIZE PARTITIONS # Error since it must reorganize a consecutive range ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO @@ -640,11 +640,11 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = ARCHIVE, PARTITION partD VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = ARCHIVE, PARTITION partB VALUES LESS THAN (11) COMMENT = 'Previously partly Partc and partly PartD' ENGINE = ARCHIVE, - PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = ARCHIVE) */ + PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = ARCHIVE) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -713,11 +713,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = ARCHIVE, PARTITION partD VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = ARCHIVE, PARTITION partB VALUES LESS THAN (11) COMMENT = 'Previously partly Partc and partly PartD' ENGINE = ARCHIVE, - PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = ARCHIVE) */ + PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = ARCHIVE) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -794,14 +794,14 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = ARCHIVE, PARTITION partB VALUES IN (2,10,11) ENGINE = ARCHIVE, PARTITION Partc VALUES IN (3,4,7) ENGINE = ARCHIVE, PARTITION PartD VALUES IN (5,6,12) ENGINE = ARCHIVE, PARTITION partE VALUES IN (16) ENGINE = ARCHIVE, PARTITION Partf VALUES IN (19) ENGINE = ARCHIVE, - PARTITION PartG VALUES IN (22) ENGINE = ARCHIVE) */ + PARTITION PartG VALUES IN (22) ENGINE = ARCHIVE) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION @@ -825,12 +825,12 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = ARCHIVE, PARTITION partB VALUES IN (2,10,11) ENGINE = ARCHIVE, PARTITION Partc VALUES IN (3,4,7) ENGINE = ARCHIVE, PARTITION PartD VALUES IN (5,6,12) ENGINE = ARCHIVE, - PARTITION PartE VALUES IN (13) ENGINE = ARCHIVE) */ + PARTITION PartE VALUES IN (13) ENGINE = ARCHIVE) # Test of REORGANIZE PARTITIONS ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO (PARTITION Partc VALUES IN (1,7) @@ -863,12 +863,12 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION Partc VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = ARCHIVE, PARTITION parta VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = ARCHIVE, PARTITION partB VALUES IN (4,8) COMMENT = 'Mix 3 of old parta and Partc' ENGINE = ARCHIVE, PARTITION PartD VALUES IN (5,6,12) ENGINE = ARCHIVE, - PARTITION PartE VALUES IN (13) ENGINE = ARCHIVE) */ + PARTITION PartE VALUES IN (13) ENGINE = ARCHIVE) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -928,12 +928,12 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION Partc VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = ARCHIVE, PARTITION parta VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = ARCHIVE, PARTITION partB VALUES IN (4,8) COMMENT = 'Mix 3 of old parta and Partc' ENGINE = ARCHIVE, PARTITION PartD VALUES IN (5,6,12) ENGINE = ARCHIVE, - PARTITION PartE VALUES IN (13) ENGINE = ARCHIVE) */ + PARTITION PartE VALUES IN (13) ENGINE = ARCHIVE) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; diff --git a/mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result b/mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result index e1c2d0a74bb..0aab26b189b 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result @@ -56,14 +56,14 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = InnoDB, PARTITION partB ENGINE = InnoDB, PARTITION Partc ENGINE = InnoDB, PARTITION PartD ENGINE = InnoDB, PARTITION partE ENGINE = InnoDB, PARTITION Partf ENGINE = InnoDB, - PARTITION PartG ENGINE = InnoDB) */ + PARTITION PartG ENGINE = InnoDB) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -84,10 +84,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = InnoDB, PARTITION partB ENGINE = InnoDB, - PARTITION Partc ENGINE = InnoDB) */ + PARTITION Partc ENGINE = InnoDB) # Test of EXCHANGE PARTITION WITH TABLE SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME TABLE_ROWS @@ -112,10 +112,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = InnoDB, PARTITION partB ENGINE = InnoDB, - PARTITION Partc ENGINE = InnoDB) */ + PARTITION Partc ENGINE = InnoDB) SELECT * FROM TableB; a 10 @@ -156,10 +156,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = InnoDB, PARTITION partB ENGINE = InnoDB, - PARTITION Partc ENGINE = InnoDB) */ + PARTITION Partc ENGINE = InnoDB) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -192,10 +192,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = InnoDB, - PARTITION Partc ENGINE = InnoDB) */ + PARTITION Partc ENGINE = InnoDB) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -264,10 +264,10 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = InnoDB, - PARTITION Partc ENGINE = InnoDB) */ + PARTITION Partc ENGINE = InnoDB) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -355,14 +355,14 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = InnoDB, PARTITION partB ENGINE = InnoDB, PARTITION Partc ENGINE = InnoDB, PARTITION PartD ENGINE = InnoDB, PARTITION partE ENGINE = InnoDB, PARTITION Partf ENGINE = InnoDB, - PARTITION PartG ENGINE = InnoDB) */ + PARTITION PartG ENGINE = InnoDB) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -383,10 +383,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = InnoDB, PARTITION partB ENGINE = InnoDB, - PARTITION Partc ENGINE = InnoDB) */ + PARTITION Partc ENGINE = InnoDB) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -419,10 +419,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = InnoDB, - PARTITION Partc ENGINE = InnoDB) */ + PARTITION Partc ENGINE = InnoDB) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -491,10 +491,10 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = InnoDB, - PARTITION Partc ENGINE = InnoDB) */ + PARTITION Partc ENGINE = InnoDB) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -571,14 +571,14 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION partB VALUES LESS THAN (7) ENGINE = InnoDB, PARTITION Partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION PartD VALUES LESS THAN (13) ENGINE = InnoDB, PARTITION partE VALUES LESS THAN (16) ENGINE = InnoDB, PARTITION Partf VALUES LESS THAN (19) ENGINE = InnoDB, - PARTITION PartG VALUES LESS THAN (22) ENGINE = InnoDB) */ + PARTITION PartG VALUES LESS THAN (22) ENGINE = InnoDB) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION @@ -602,12 +602,12 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION partB VALUES LESS THAN (7) ENGINE = InnoDB, PARTITION Partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION PartD VALUES LESS THAN (13) ENGINE = InnoDB, - PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = InnoDB) # Test of REORGANIZE PARTITIONS # Error since it must reorganize a consecutive range ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO @@ -640,11 +640,11 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION partD VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = InnoDB, PARTITION partB VALUES LESS THAN (11) COMMENT = 'Previously partly Partc and partly PartD' ENGINE = InnoDB, - PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = InnoDB) */ + PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = InnoDB) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -713,11 +713,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION partD VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = InnoDB, PARTITION partB VALUES LESS THAN (11) COMMENT = 'Previously partly Partc and partly PartD' ENGINE = InnoDB, - PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = InnoDB) */ + PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = InnoDB) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -794,14 +794,14 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = InnoDB, PARTITION partB VALUES IN (2,10,11) ENGINE = InnoDB, PARTITION Partc VALUES IN (3,4,7) ENGINE = InnoDB, PARTITION PartD VALUES IN (5,6,12) ENGINE = InnoDB, PARTITION partE VALUES IN (16) ENGINE = InnoDB, PARTITION Partf VALUES IN (19) ENGINE = InnoDB, - PARTITION PartG VALUES IN (22) ENGINE = InnoDB) */ + PARTITION PartG VALUES IN (22) ENGINE = InnoDB) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION @@ -825,12 +825,12 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = InnoDB, PARTITION partB VALUES IN (2,10,11) ENGINE = InnoDB, PARTITION Partc VALUES IN (3,4,7) ENGINE = InnoDB, PARTITION PartD VALUES IN (5,6,12) ENGINE = InnoDB, - PARTITION PartE VALUES IN (13) ENGINE = InnoDB) */ + PARTITION PartE VALUES IN (13) ENGINE = InnoDB) # Test of REORGANIZE PARTITIONS ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO (PARTITION Partc VALUES IN (1,7) @@ -863,12 +863,12 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION Partc VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = InnoDB, PARTITION parta VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = InnoDB, PARTITION partB VALUES IN (4,8) COMMENT = 'Mix 3 of old parta and Partc' ENGINE = InnoDB, PARTITION PartD VALUES IN (5,6,12) ENGINE = InnoDB, - PARTITION PartE VALUES IN (13) ENGINE = InnoDB) */ + PARTITION PartE VALUES IN (13) ENGINE = InnoDB) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -928,12 +928,12 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION Partc VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = InnoDB, PARTITION parta VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = InnoDB, PARTITION partB VALUES IN (4,8) COMMENT = 'Mix 3 of old parta and Partc' ENGINE = InnoDB, PARTITION PartD VALUES IN (5,6,12) ENGINE = InnoDB, - PARTITION PartE VALUES IN (13) ENGINE = InnoDB) */ + PARTITION PartE VALUES IN (13) ENGINE = InnoDB) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -971,10 +971,10 @@ t1 CREATE TABLE `t1` ( `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION LT1000 VALUES LESS THAN (1000) ENGINE = InnoDB, PARTITION LT2000 VALUES LESS THAN (2000) ENGINE = InnoDB, - PARTITION MAX VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION MAX VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1 ORDER BY a; a b 1 First diff --git a/mysql-test/suite/parts/r/partition_mgm_lc1_memory.result b/mysql-test/suite/parts/r/partition_mgm_lc1_memory.result index ecd89689435..5e7da61802e 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc1_memory.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc1_memory.result @@ -56,14 +56,14 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MEMORY, PARTITION partB ENGINE = MEMORY, PARTITION Partc ENGINE = MEMORY, PARTITION PartD ENGINE = MEMORY, PARTITION partE ENGINE = MEMORY, PARTITION Partf ENGINE = MEMORY, - PARTITION PartG ENGINE = MEMORY) */ + PARTITION PartG ENGINE = MEMORY) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -84,10 +84,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MEMORY, PARTITION partB ENGINE = MEMORY, - PARTITION Partc ENGINE = MEMORY) */ + PARTITION Partc ENGINE = MEMORY) # Test of EXCHANGE PARTITION WITH TABLE SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME TABLE_ROWS @@ -112,10 +112,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MEMORY, PARTITION partB ENGINE = MEMORY, - PARTITION Partc ENGINE = MEMORY) */ + PARTITION Partc ENGINE = MEMORY) SELECT * FROM TableB; a 10 @@ -156,10 +156,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MEMORY, PARTITION partB ENGINE = MEMORY, - PARTITION Partc ENGINE = MEMORY) */ + PARTITION Partc ENGINE = MEMORY) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -192,10 +192,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = MEMORY, - PARTITION Partc ENGINE = MEMORY) */ + PARTITION Partc ENGINE = MEMORY) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -264,10 +264,10 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = MEMORY, - PARTITION Partc ENGINE = MEMORY) */ + PARTITION Partc ENGINE = MEMORY) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -355,14 +355,14 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = MEMORY, PARTITION partB ENGINE = MEMORY, PARTITION Partc ENGINE = MEMORY, PARTITION PartD ENGINE = MEMORY, PARTITION partE ENGINE = MEMORY, PARTITION Partf ENGINE = MEMORY, - PARTITION PartG ENGINE = MEMORY) */ + PARTITION PartG ENGINE = MEMORY) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -383,10 +383,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = MEMORY, PARTITION partB ENGINE = MEMORY, - PARTITION Partc ENGINE = MEMORY) */ + PARTITION Partc ENGINE = MEMORY) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -419,10 +419,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = MEMORY, - PARTITION Partc ENGINE = MEMORY) */ + PARTITION Partc ENGINE = MEMORY) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -491,10 +491,10 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = MEMORY, - PARTITION Partc ENGINE = MEMORY) */ + PARTITION Partc ENGINE = MEMORY) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -571,14 +571,14 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION partB VALUES LESS THAN (7) ENGINE = MEMORY, PARTITION Partc VALUES LESS THAN (10) ENGINE = MEMORY, PARTITION PartD VALUES LESS THAN (13) ENGINE = MEMORY, PARTITION partE VALUES LESS THAN (16) ENGINE = MEMORY, PARTITION Partf VALUES LESS THAN (19) ENGINE = MEMORY, - PARTITION PartG VALUES LESS THAN (22) ENGINE = MEMORY) */ + PARTITION PartG VALUES LESS THAN (22) ENGINE = MEMORY) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION @@ -602,12 +602,12 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION partB VALUES LESS THAN (7) ENGINE = MEMORY, PARTITION Partc VALUES LESS THAN (10) ENGINE = MEMORY, PARTITION PartD VALUES LESS THAN (13) ENGINE = MEMORY, - PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = MEMORY) */ + PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = MEMORY) # Test of REORGANIZE PARTITIONS # Error since it must reorganize a consecutive range ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO @@ -640,11 +640,11 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION partD VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MEMORY, PARTITION partB VALUES LESS THAN (11) COMMENT = 'Previously partly Partc and partly PartD' ENGINE = MEMORY, - PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = MEMORY) */ + PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = MEMORY) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -713,11 +713,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION partD VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MEMORY, PARTITION partB VALUES LESS THAN (11) COMMENT = 'Previously partly Partc and partly PartD' ENGINE = MEMORY, - PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = MEMORY) */ + PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = MEMORY) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -794,14 +794,14 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = MEMORY, PARTITION partB VALUES IN (2,10,11) ENGINE = MEMORY, PARTITION Partc VALUES IN (3,4,7) ENGINE = MEMORY, PARTITION PartD VALUES IN (5,6,12) ENGINE = MEMORY, PARTITION partE VALUES IN (16) ENGINE = MEMORY, PARTITION Partf VALUES IN (19) ENGINE = MEMORY, - PARTITION PartG VALUES IN (22) ENGINE = MEMORY) */ + PARTITION PartG VALUES IN (22) ENGINE = MEMORY) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION @@ -825,12 +825,12 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = MEMORY, PARTITION partB VALUES IN (2,10,11) ENGINE = MEMORY, PARTITION Partc VALUES IN (3,4,7) ENGINE = MEMORY, PARTITION PartD VALUES IN (5,6,12) ENGINE = MEMORY, - PARTITION PartE VALUES IN (13) ENGINE = MEMORY) */ + PARTITION PartE VALUES IN (13) ENGINE = MEMORY) # Test of REORGANIZE PARTITIONS ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO (PARTITION Partc VALUES IN (1,7) @@ -863,12 +863,12 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION Partc VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MEMORY, PARTITION parta VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MEMORY, PARTITION partB VALUES IN (4,8) COMMENT = 'Mix 3 of old parta and Partc' ENGINE = MEMORY, PARTITION PartD VALUES IN (5,6,12) ENGINE = MEMORY, - PARTITION PartE VALUES IN (13) ENGINE = MEMORY) */ + PARTITION PartE VALUES IN (13) ENGINE = MEMORY) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -928,12 +928,12 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION Partc VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MEMORY, PARTITION parta VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MEMORY, PARTITION partB VALUES IN (4,8) COMMENT = 'Mix 3 of old parta and Partc' ENGINE = MEMORY, PARTITION PartD VALUES IN (5,6,12) ENGINE = MEMORY, - PARTITION PartE VALUES IN (13) ENGINE = MEMORY) */ + PARTITION PartE VALUES IN (13) ENGINE = MEMORY) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -971,10 +971,10 @@ t1 CREATE TABLE `t1` ( `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION LT1000 VALUES LESS THAN (1000) ENGINE = MEMORY, PARTITION LT2000 VALUES LESS THAN (2000) ENGINE = MEMORY, - PARTITION MAX VALUES LESS THAN MAXVALUE ENGINE = MEMORY) */ + PARTITION MAX VALUES LESS THAN MAXVALUE ENGINE = MEMORY) SELECT * FROM t1 ORDER BY a; a b 1 First diff --git a/mysql-test/suite/parts/r/partition_mgm_lc1_myisam.result b/mysql-test/suite/parts/r/partition_mgm_lc1_myisam.result index deecf320d7d..505bf6403a6 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc1_myisam.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc1_myisam.result @@ -56,14 +56,14 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MyISAM, PARTITION partB ENGINE = MyISAM, PARTITION Partc ENGINE = MyISAM, PARTITION PartD ENGINE = MyISAM, PARTITION partE ENGINE = MyISAM, PARTITION Partf ENGINE = MyISAM, - PARTITION PartG ENGINE = MyISAM) */ + PARTITION PartG ENGINE = MyISAM) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -84,10 +84,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MyISAM, PARTITION partB ENGINE = MyISAM, - PARTITION Partc ENGINE = MyISAM) */ + PARTITION Partc ENGINE = MyISAM) # Test of EXCHANGE PARTITION WITH TABLE SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME TABLE_ROWS @@ -112,10 +112,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MyISAM, PARTITION partB ENGINE = MyISAM, - PARTITION Partc ENGINE = MyISAM) */ + PARTITION Partc ENGINE = MyISAM) SELECT * FROM TableB; a 10 @@ -156,10 +156,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MyISAM, PARTITION partB ENGINE = MyISAM, - PARTITION Partc ENGINE = MyISAM) */ + PARTITION Partc ENGINE = MyISAM) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -192,10 +192,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = MyISAM, - PARTITION Partc ENGINE = MyISAM) */ + PARTITION Partc ENGINE = MyISAM) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -264,10 +264,10 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = MyISAM, - PARTITION Partc ENGINE = MyISAM) */ + PARTITION Partc ENGINE = MyISAM) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -355,14 +355,14 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = MyISAM, PARTITION partB ENGINE = MyISAM, PARTITION Partc ENGINE = MyISAM, PARTITION PartD ENGINE = MyISAM, PARTITION partE ENGINE = MyISAM, PARTITION Partf ENGINE = MyISAM, - PARTITION PartG ENGINE = MyISAM) */ + PARTITION PartG ENGINE = MyISAM) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -383,10 +383,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = MyISAM, PARTITION partB ENGINE = MyISAM, - PARTITION Partc ENGINE = MyISAM) */ + PARTITION Partc ENGINE = MyISAM) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -419,10 +419,10 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = MyISAM, - PARTITION Partc ENGINE = MyISAM) */ + PARTITION Partc ENGINE = MyISAM) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -491,10 +491,10 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = MyISAM, - PARTITION Partc ENGINE = MyISAM) */ + PARTITION Partc ENGINE = MyISAM) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -571,14 +571,14 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION partB VALUES LESS THAN (7) ENGINE = MyISAM, PARTITION Partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION PartD VALUES LESS THAN (13) ENGINE = MyISAM, PARTITION partE VALUES LESS THAN (16) ENGINE = MyISAM, PARTITION Partf VALUES LESS THAN (19) ENGINE = MyISAM, - PARTITION PartG VALUES LESS THAN (22) ENGINE = MyISAM) */ + PARTITION PartG VALUES LESS THAN (22) ENGINE = MyISAM) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION @@ -602,12 +602,12 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION partB VALUES LESS THAN (7) ENGINE = MyISAM, PARTITION Partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION PartD VALUES LESS THAN (13) ENGINE = MyISAM, - PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = MyISAM) # Test of REORGANIZE PARTITIONS # Error since it must reorganize a consecutive range ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO @@ -640,11 +640,11 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION partD VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MyISAM, PARTITION partB VALUES LESS THAN (11) COMMENT = 'Previously partly Partc and partly PartD' ENGINE = MyISAM, - PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = MyISAM) */ + PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = MyISAM) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -713,11 +713,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION partD VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MyISAM, PARTITION partB VALUES LESS THAN (11) COMMENT = 'Previously partly Partc and partly PartD' ENGINE = MyISAM, - PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = MyISAM) */ + PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = MyISAM) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -794,14 +794,14 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = MyISAM, PARTITION partB VALUES IN (2,10,11) ENGINE = MyISAM, PARTITION Partc VALUES IN (3,4,7) ENGINE = MyISAM, PARTITION PartD VALUES IN (5,6,12) ENGINE = MyISAM, PARTITION partE VALUES IN (16) ENGINE = MyISAM, PARTITION Partf VALUES IN (19) ENGINE = MyISAM, - PARTITION PartG VALUES IN (22) ENGINE = MyISAM) */ + PARTITION PartG VALUES IN (22) ENGINE = MyISAM) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION @@ -825,12 +825,12 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = MyISAM, PARTITION partB VALUES IN (2,10,11) ENGINE = MyISAM, PARTITION Partc VALUES IN (3,4,7) ENGINE = MyISAM, PARTITION PartD VALUES IN (5,6,12) ENGINE = MyISAM, - PARTITION PartE VALUES IN (13) ENGINE = MyISAM) */ + PARTITION PartE VALUES IN (13) ENGINE = MyISAM) # Test of REORGANIZE PARTITIONS ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO (PARTITION Partc VALUES IN (1,7) @@ -863,12 +863,12 @@ Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION Partc VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MyISAM, PARTITION parta VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MyISAM, PARTITION partB VALUES IN (4,8) COMMENT = 'Mix 3 of old parta and Partc' ENGINE = MyISAM, PARTITION PartD VALUES IN (5,6,12) ENGINE = MyISAM, - PARTITION PartE VALUES IN (13) ENGINE = MyISAM) */ + PARTITION PartE VALUES IN (13) ENGINE = MyISAM) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -928,12 +928,12 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION Partc VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MyISAM, PARTITION parta VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MyISAM, PARTITION partB VALUES IN (4,8) COMMENT = 'Mix 3 of old parta and Partc' ENGINE = MyISAM, PARTITION PartD VALUES IN (5,6,12) ENGINE = MyISAM, - PARTITION PartE VALUES IN (13) ENGINE = MyISAM) */ + PARTITION PartE VALUES IN (13) ENGINE = MyISAM) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -971,10 +971,10 @@ t1 CREATE TABLE `t1` ( `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION LT1000 VALUES LESS THAN (1000) ENGINE = MyISAM, PARTITION LT2000 VALUES LESS THAN (2000) ENGINE = MyISAM, - PARTITION MAX VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION MAX VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1 ORDER BY a; a b 1 First diff --git a/mysql-test/suite/parts/r/partition_mgm_lc2_archive.result b/mysql-test/suite/parts/r/partition_mgm_lc2_archive.result index f3503889699..799e69af458 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc2_archive.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc2_archive.result @@ -56,14 +56,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = ARCHIVE, PARTITION partB ENGINE = ARCHIVE, PARTITION Partc ENGINE = ARCHIVE, PARTITION PartD ENGINE = ARCHIVE, PARTITION partE ENGINE = ARCHIVE, PARTITION Partf ENGINE = ARCHIVE, - PARTITION PartG ENGINE = ARCHIVE) */ + PARTITION PartG ENGINE = ARCHIVE) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -84,10 +84,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = ARCHIVE, PARTITION partB ENGINE = ARCHIVE, - PARTITION Partc ENGINE = ARCHIVE) */ + PARTITION Partc ENGINE = ARCHIVE) # Test of EXCHANGE PARTITION WITH TABLE SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME TABLE_ROWS @@ -112,10 +112,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = ARCHIVE, PARTITION partB ENGINE = ARCHIVE, - PARTITION Partc ENGINE = ARCHIVE) */ + PARTITION Partc ENGINE = ARCHIVE) SELECT * FROM TableB; a 10 @@ -156,10 +156,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = ARCHIVE, PARTITION partB ENGINE = ARCHIVE, - PARTITION Partc ENGINE = ARCHIVE) */ + PARTITION Partc ENGINE = ARCHIVE) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -192,10 +192,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = ARCHIVE, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = ARCHIVE, - PARTITION Partc ENGINE = ARCHIVE) */ + PARTITION Partc ENGINE = ARCHIVE) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -264,10 +264,10 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = ARCHIVE, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = ARCHIVE, - PARTITION Partc ENGINE = ARCHIVE) */ + PARTITION Partc ENGINE = ARCHIVE) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -355,14 +355,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = ARCHIVE, PARTITION partB ENGINE = ARCHIVE, PARTITION Partc ENGINE = ARCHIVE, PARTITION PartD ENGINE = ARCHIVE, PARTITION partE ENGINE = ARCHIVE, PARTITION Partf ENGINE = ARCHIVE, - PARTITION PartG ENGINE = ARCHIVE) */ + PARTITION PartG ENGINE = ARCHIVE) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -383,10 +383,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = ARCHIVE, PARTITION partB ENGINE = ARCHIVE, - PARTITION Partc ENGINE = ARCHIVE) */ + PARTITION Partc ENGINE = ARCHIVE) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -419,10 +419,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = ARCHIVE, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = ARCHIVE, - PARTITION Partc ENGINE = ARCHIVE) */ + PARTITION Partc ENGINE = ARCHIVE) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -491,10 +491,10 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = ARCHIVE, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = ARCHIVE, - PARTITION Partc ENGINE = ARCHIVE) */ + PARTITION Partc ENGINE = ARCHIVE) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -571,14 +571,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = ARCHIVE, PARTITION partB VALUES LESS THAN (7) ENGINE = ARCHIVE, PARTITION Partc VALUES LESS THAN (10) ENGINE = ARCHIVE, PARTITION PartD VALUES LESS THAN (13) ENGINE = ARCHIVE, PARTITION partE VALUES LESS THAN (16) ENGINE = ARCHIVE, PARTITION Partf VALUES LESS THAN (19) ENGINE = ARCHIVE, - PARTITION PartG VALUES LESS THAN (22) ENGINE = ARCHIVE) */ + PARTITION PartG VALUES LESS THAN (22) ENGINE = ARCHIVE) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION @@ -602,12 +602,12 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = ARCHIVE, PARTITION partB VALUES LESS THAN (7) ENGINE = ARCHIVE, PARTITION Partc VALUES LESS THAN (10) ENGINE = ARCHIVE, PARTITION PartD VALUES LESS THAN (13) ENGINE = ARCHIVE, - PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE) */ + PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE) # Test of REORGANIZE PARTITIONS # Error since it must reorganize a consecutive range ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO @@ -640,11 +640,11 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = ARCHIVE, PARTITION partD VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = ARCHIVE, PARTITION partB VALUES LESS THAN (11) COMMENT = 'Previously partly Partc and partly PartD' ENGINE = ARCHIVE, - PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = ARCHIVE) */ + PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = ARCHIVE) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -713,11 +713,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = ARCHIVE, PARTITION partD VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = ARCHIVE, PARTITION partB VALUES LESS THAN (11) COMMENT = 'Previously partly Partc and partly PartD' ENGINE = ARCHIVE, - PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = ARCHIVE) */ + PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = ARCHIVE) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -794,14 +794,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = ARCHIVE, PARTITION partB VALUES IN (2,10,11) ENGINE = ARCHIVE, PARTITION Partc VALUES IN (3,4,7) ENGINE = ARCHIVE, PARTITION PartD VALUES IN (5,6,12) ENGINE = ARCHIVE, PARTITION partE VALUES IN (16) ENGINE = ARCHIVE, PARTITION Partf VALUES IN (19) ENGINE = ARCHIVE, - PARTITION PartG VALUES IN (22) ENGINE = ARCHIVE) */ + PARTITION PartG VALUES IN (22) ENGINE = ARCHIVE) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION diff --git a/mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result b/mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result index 50579e84d96..d25371615ef 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result @@ -56,14 +56,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = InnoDB, PARTITION partB ENGINE = InnoDB, PARTITION Partc ENGINE = InnoDB, PARTITION PartD ENGINE = InnoDB, PARTITION partE ENGINE = InnoDB, PARTITION Partf ENGINE = InnoDB, - PARTITION PartG ENGINE = InnoDB) */ + PARTITION PartG ENGINE = InnoDB) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -84,10 +84,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = InnoDB, PARTITION partB ENGINE = InnoDB, - PARTITION Partc ENGINE = InnoDB) */ + PARTITION Partc ENGINE = InnoDB) # Test of EXCHANGE PARTITION WITH TABLE SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME TABLE_ROWS @@ -112,10 +112,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = InnoDB, PARTITION partB ENGINE = InnoDB, - PARTITION Partc ENGINE = InnoDB) */ + PARTITION Partc ENGINE = InnoDB) SELECT * FROM TableB; a 10 @@ -156,10 +156,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = InnoDB, PARTITION partB ENGINE = InnoDB, - PARTITION Partc ENGINE = InnoDB) */ + PARTITION Partc ENGINE = InnoDB) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -192,10 +192,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = InnoDB, - PARTITION Partc ENGINE = InnoDB) */ + PARTITION Partc ENGINE = InnoDB) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -264,10 +264,10 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = InnoDB, - PARTITION Partc ENGINE = InnoDB) */ + PARTITION Partc ENGINE = InnoDB) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -355,14 +355,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = InnoDB, PARTITION partB ENGINE = InnoDB, PARTITION Partc ENGINE = InnoDB, PARTITION PartD ENGINE = InnoDB, PARTITION partE ENGINE = InnoDB, PARTITION Partf ENGINE = InnoDB, - PARTITION PartG ENGINE = InnoDB) */ + PARTITION PartG ENGINE = InnoDB) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -383,10 +383,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = InnoDB, PARTITION partB ENGINE = InnoDB, - PARTITION Partc ENGINE = InnoDB) */ + PARTITION Partc ENGINE = InnoDB) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -419,10 +419,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = InnoDB, - PARTITION Partc ENGINE = InnoDB) */ + PARTITION Partc ENGINE = InnoDB) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -491,10 +491,10 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = InnoDB, - PARTITION Partc ENGINE = InnoDB) */ + PARTITION Partc ENGINE = InnoDB) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -571,14 +571,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION partB VALUES LESS THAN (7) ENGINE = InnoDB, PARTITION Partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION PartD VALUES LESS THAN (13) ENGINE = InnoDB, PARTITION partE VALUES LESS THAN (16) ENGINE = InnoDB, PARTITION Partf VALUES LESS THAN (19) ENGINE = InnoDB, - PARTITION PartG VALUES LESS THAN (22) ENGINE = InnoDB) */ + PARTITION PartG VALUES LESS THAN (22) ENGINE = InnoDB) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION @@ -602,12 +602,12 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION partB VALUES LESS THAN (7) ENGINE = InnoDB, PARTITION Partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION PartD VALUES LESS THAN (13) ENGINE = InnoDB, - PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = InnoDB) # Test of REORGANIZE PARTITIONS # Error since it must reorganize a consecutive range ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO @@ -640,11 +640,11 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION partD VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = InnoDB, PARTITION partB VALUES LESS THAN (11) COMMENT = 'Previously partly Partc and partly PartD' ENGINE = InnoDB, - PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = InnoDB) */ + PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = InnoDB) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -713,11 +713,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION partD VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = InnoDB, PARTITION partB VALUES LESS THAN (11) COMMENT = 'Previously partly Partc and partly PartD' ENGINE = InnoDB, - PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = InnoDB) */ + PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = InnoDB) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -794,14 +794,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = InnoDB, PARTITION partB VALUES IN (2,10,11) ENGINE = InnoDB, PARTITION Partc VALUES IN (3,4,7) ENGINE = InnoDB, PARTITION PartD VALUES IN (5,6,12) ENGINE = InnoDB, PARTITION partE VALUES IN (16) ENGINE = InnoDB, PARTITION Partf VALUES IN (19) ENGINE = InnoDB, - PARTITION PartG VALUES IN (22) ENGINE = InnoDB) */ + PARTITION PartG VALUES IN (22) ENGINE = InnoDB) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION @@ -825,12 +825,12 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = InnoDB, PARTITION partB VALUES IN (2,10,11) ENGINE = InnoDB, PARTITION Partc VALUES IN (3,4,7) ENGINE = InnoDB, PARTITION PartD VALUES IN (5,6,12) ENGINE = InnoDB, - PARTITION PartE VALUES IN (13) ENGINE = InnoDB) */ + PARTITION PartE VALUES IN (13) ENGINE = InnoDB) # Test of REORGANIZE PARTITIONS ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO (PARTITION Partc VALUES IN (1,7) @@ -863,12 +863,12 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION Partc VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = InnoDB, PARTITION parta VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = InnoDB, PARTITION partB VALUES IN (4,8) COMMENT = 'Mix 3 of old parta and Partc' ENGINE = InnoDB, PARTITION PartD VALUES IN (5,6,12) ENGINE = InnoDB, - PARTITION PartE VALUES IN (13) ENGINE = InnoDB) */ + PARTITION PartE VALUES IN (13) ENGINE = InnoDB) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -928,12 +928,12 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION Partc VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = InnoDB, PARTITION parta VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = InnoDB, PARTITION partB VALUES IN (4,8) COMMENT = 'Mix 3 of old parta and Partc' ENGINE = InnoDB, PARTITION PartD VALUES IN (5,6,12) ENGINE = InnoDB, - PARTITION PartE VALUES IN (13) ENGINE = InnoDB) */ + PARTITION PartE VALUES IN (13) ENGINE = InnoDB) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -971,10 +971,10 @@ t1 CREATE TABLE `t1` ( `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION LT1000 VALUES LESS THAN (1000) ENGINE = InnoDB, PARTITION LT2000 VALUES LESS THAN (2000) ENGINE = InnoDB, - PARTITION MAX VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION MAX VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT * FROM t1 ORDER BY a; a b 1 First diff --git a/mysql-test/suite/parts/r/partition_mgm_lc2_memory.result b/mysql-test/suite/parts/r/partition_mgm_lc2_memory.result index e92aac28e79..076079ccb00 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc2_memory.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc2_memory.result @@ -56,14 +56,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MEMORY, PARTITION partB ENGINE = MEMORY, PARTITION Partc ENGINE = MEMORY, PARTITION PartD ENGINE = MEMORY, PARTITION partE ENGINE = MEMORY, PARTITION Partf ENGINE = MEMORY, - PARTITION PartG ENGINE = MEMORY) */ + PARTITION PartG ENGINE = MEMORY) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -84,10 +84,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MEMORY, PARTITION partB ENGINE = MEMORY, - PARTITION Partc ENGINE = MEMORY) */ + PARTITION Partc ENGINE = MEMORY) # Test of EXCHANGE PARTITION WITH TABLE SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME TABLE_ROWS @@ -112,10 +112,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MEMORY, PARTITION partB ENGINE = MEMORY, - PARTITION Partc ENGINE = MEMORY) */ + PARTITION Partc ENGINE = MEMORY) SELECT * FROM TableB; a 10 @@ -156,10 +156,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MEMORY, PARTITION partB ENGINE = MEMORY, - PARTITION Partc ENGINE = MEMORY) */ + PARTITION Partc ENGINE = MEMORY) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -192,10 +192,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = MEMORY, - PARTITION Partc ENGINE = MEMORY) */ + PARTITION Partc ENGINE = MEMORY) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -264,10 +264,10 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = MEMORY, - PARTITION Partc ENGINE = MEMORY) */ + PARTITION Partc ENGINE = MEMORY) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -355,14 +355,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = MEMORY, PARTITION partB ENGINE = MEMORY, PARTITION Partc ENGINE = MEMORY, PARTITION PartD ENGINE = MEMORY, PARTITION partE ENGINE = MEMORY, PARTITION Partf ENGINE = MEMORY, - PARTITION PartG ENGINE = MEMORY) */ + PARTITION PartG ENGINE = MEMORY) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -383,10 +383,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = MEMORY, PARTITION partB ENGINE = MEMORY, - PARTITION Partc ENGINE = MEMORY) */ + PARTITION Partc ENGINE = MEMORY) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -419,10 +419,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = MEMORY, - PARTITION Partc ENGINE = MEMORY) */ + PARTITION Partc ENGINE = MEMORY) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -491,10 +491,10 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = MEMORY, - PARTITION Partc ENGINE = MEMORY) */ + PARTITION Partc ENGINE = MEMORY) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -571,14 +571,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION partB VALUES LESS THAN (7) ENGINE = MEMORY, PARTITION Partc VALUES LESS THAN (10) ENGINE = MEMORY, PARTITION PartD VALUES LESS THAN (13) ENGINE = MEMORY, PARTITION partE VALUES LESS THAN (16) ENGINE = MEMORY, PARTITION Partf VALUES LESS THAN (19) ENGINE = MEMORY, - PARTITION PartG VALUES LESS THAN (22) ENGINE = MEMORY) */ + PARTITION PartG VALUES LESS THAN (22) ENGINE = MEMORY) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION @@ -602,12 +602,12 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION partB VALUES LESS THAN (7) ENGINE = MEMORY, PARTITION Partc VALUES LESS THAN (10) ENGINE = MEMORY, PARTITION PartD VALUES LESS THAN (13) ENGINE = MEMORY, - PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = MEMORY) */ + PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = MEMORY) # Test of REORGANIZE PARTITIONS # Error since it must reorganize a consecutive range ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO @@ -640,11 +640,11 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION partD VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MEMORY, PARTITION partB VALUES LESS THAN (11) COMMENT = 'Previously partly Partc and partly PartD' ENGINE = MEMORY, - PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = MEMORY) */ + PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = MEMORY) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -713,11 +713,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION partD VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MEMORY, PARTITION partB VALUES LESS THAN (11) COMMENT = 'Previously partly Partc and partly PartD' ENGINE = MEMORY, - PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = MEMORY) */ + PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = MEMORY) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -794,14 +794,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = MEMORY, PARTITION partB VALUES IN (2,10,11) ENGINE = MEMORY, PARTITION Partc VALUES IN (3,4,7) ENGINE = MEMORY, PARTITION PartD VALUES IN (5,6,12) ENGINE = MEMORY, PARTITION partE VALUES IN (16) ENGINE = MEMORY, PARTITION Partf VALUES IN (19) ENGINE = MEMORY, - PARTITION PartG VALUES IN (22) ENGINE = MEMORY) */ + PARTITION PartG VALUES IN (22) ENGINE = MEMORY) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION @@ -825,12 +825,12 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = MEMORY, PARTITION partB VALUES IN (2,10,11) ENGINE = MEMORY, PARTITION Partc VALUES IN (3,4,7) ENGINE = MEMORY, PARTITION PartD VALUES IN (5,6,12) ENGINE = MEMORY, - PARTITION PartE VALUES IN (13) ENGINE = MEMORY) */ + PARTITION PartE VALUES IN (13) ENGINE = MEMORY) # Test of REORGANIZE PARTITIONS ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO (PARTITION Partc VALUES IN (1,7) @@ -863,12 +863,12 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION Partc VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MEMORY, PARTITION parta VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MEMORY, PARTITION partB VALUES IN (4,8) COMMENT = 'Mix 3 of old parta and Partc' ENGINE = MEMORY, PARTITION PartD VALUES IN (5,6,12) ENGINE = MEMORY, - PARTITION PartE VALUES IN (13) ENGINE = MEMORY) */ + PARTITION PartE VALUES IN (13) ENGINE = MEMORY) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -928,12 +928,12 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION Partc VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MEMORY, PARTITION parta VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MEMORY, PARTITION partB VALUES IN (4,8) COMMENT = 'Mix 3 of old parta and Partc' ENGINE = MEMORY, PARTITION PartD VALUES IN (5,6,12) ENGINE = MEMORY, - PARTITION PartE VALUES IN (13) ENGINE = MEMORY) */ + PARTITION PartE VALUES IN (13) ENGINE = MEMORY) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -971,10 +971,10 @@ t1 CREATE TABLE `t1` ( `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION LT1000 VALUES LESS THAN (1000) ENGINE = MEMORY, PARTITION LT2000 VALUES LESS THAN (2000) ENGINE = MEMORY, - PARTITION MAX VALUES LESS THAN MAXVALUE ENGINE = MEMORY) */ + PARTITION MAX VALUES LESS THAN MAXVALUE ENGINE = MEMORY) SELECT * FROM t1 ORDER BY a; a b 1 First diff --git a/mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result b/mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result index 35c663caae3..e01f0e8d440 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result @@ -56,14 +56,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MyISAM, PARTITION partB ENGINE = MyISAM, PARTITION Partc ENGINE = MyISAM, PARTITION PartD ENGINE = MyISAM, PARTITION partE ENGINE = MyISAM, PARTITION Partf ENGINE = MyISAM, - PARTITION PartG ENGINE = MyISAM) */ + PARTITION PartG ENGINE = MyISAM) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -84,10 +84,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MyISAM, PARTITION partB ENGINE = MyISAM, - PARTITION Partc ENGINE = MyISAM) */ + PARTITION Partc ENGINE = MyISAM) # Test of EXCHANGE PARTITION WITH TABLE SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME TABLE_ROWS @@ -112,10 +112,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MyISAM, PARTITION partB ENGINE = MyISAM, - PARTITION Partc ENGINE = MyISAM) */ + PARTITION Partc ENGINE = MyISAM) SELECT * FROM TableB; a 10 @@ -156,10 +156,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION parta ENGINE = MyISAM, PARTITION partB ENGINE = MyISAM, - PARTITION Partc ENGINE = MyISAM) */ + PARTITION Partc ENGINE = MyISAM) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -192,10 +192,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = MyISAM, - PARTITION Partc ENGINE = MyISAM) */ + PARTITION Partc ENGINE = MyISAM) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -264,10 +264,10 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) + PARTITION BY KEY (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = MyISAM, - PARTITION Partc ENGINE = MyISAM) */ + PARTITION Partc ENGINE = MyISAM) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -355,14 +355,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = MyISAM, PARTITION partB ENGINE = MyISAM, PARTITION Partc ENGINE = MyISAM, PARTITION PartD ENGINE = MyISAM, PARTITION partE ENGINE = MyISAM, PARTITION Partf ENGINE = MyISAM, - PARTITION PartG ENGINE = MyISAM) */ + PARTITION PartG ENGINE = MyISAM) ALTER TABLE TableA COALESCE PARTITION 4; SELECT * FROM TableA; a @@ -383,10 +383,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION parta ENGINE = MyISAM, PARTITION partB ENGINE = MyISAM, - PARTITION Partc ENGINE = MyISAM) */ + PARTITION Partc ENGINE = MyISAM) # Test of REORGANIZE PARTITIONS # Should not work on HASH/KEY ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO @@ -419,10 +419,10 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = MyISAM, - PARTITION Partc ENGINE = MyISAM) */ + PARTITION Partc ENGINE = MyISAM) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -491,10 +491,10 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) + PARTITION BY HASH (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = MyISAM, - PARTITION Partc ENGINE = MyISAM) */ + PARTITION Partc ENGINE = MyISAM) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -571,14 +571,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION partB VALUES LESS THAN (7) ENGINE = MyISAM, PARTITION Partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION PartD VALUES LESS THAN (13) ENGINE = MyISAM, PARTITION partE VALUES LESS THAN (16) ENGINE = MyISAM, PARTITION Partf VALUES LESS THAN (19) ENGINE = MyISAM, - PARTITION PartG VALUES LESS THAN (22) ENGINE = MyISAM) */ + PARTITION PartG VALUES LESS THAN (22) ENGINE = MyISAM) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION @@ -602,12 +602,12 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION partB VALUES LESS THAN (7) ENGINE = MyISAM, PARTITION Partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION PartD VALUES LESS THAN (13) ENGINE = MyISAM, - PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION PartE VALUES LESS THAN MAXVALUE ENGINE = MyISAM) # Test of REORGANIZE PARTITIONS # Error since it must reorganize a consecutive range ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO @@ -640,11 +640,11 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION partD VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MyISAM, PARTITION partB VALUES LESS THAN (11) COMMENT = 'Previously partly Partc and partly PartD' ENGINE = MyISAM, - PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = MyISAM) */ + PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = MyISAM) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -713,11 +713,11 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION parta VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION partD VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MyISAM, PARTITION partB VALUES LESS THAN (11) COMMENT = 'Previously partly Partc and partly PartD' ENGINE = MyISAM, - PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = MyISAM) */ + PARTITION partC VALUES LESS THAN MAXVALUE COMMENT = 'Previously partly PartD' ENGINE = MyISAM) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -794,14 +794,14 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = MyISAM, PARTITION partB VALUES IN (2,10,11) ENGINE = MyISAM, PARTITION Partc VALUES IN (3,4,7) ENGINE = MyISAM, PARTITION PartD VALUES IN (5,6,12) ENGINE = MyISAM, PARTITION partE VALUES IN (16) ENGINE = MyISAM, PARTITION Partf VALUES IN (19) ENGINE = MyISAM, - PARTITION PartG VALUES IN (22) ENGINE = MyISAM) */ + PARTITION PartG VALUES IN (22) ENGINE = MyISAM) ALTER TABLE TableA DROP PARTITION partE, PartG; ALTER TABLE TableA DROP PARTITION Partf; ALTER TABLE TableA ADD PARTITION @@ -825,12 +825,12 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION parta VALUES IN (1,8,9) ENGINE = MyISAM, PARTITION partB VALUES IN (2,10,11) ENGINE = MyISAM, PARTITION Partc VALUES IN (3,4,7) ENGINE = MyISAM, PARTITION PartD VALUES IN (5,6,12) ENGINE = MyISAM, - PARTITION PartE VALUES IN (13) ENGINE = MyISAM) */ + PARTITION PartE VALUES IN (13) ENGINE = MyISAM) # Test of REORGANIZE PARTITIONS ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO (PARTITION Partc VALUES IN (1,7) @@ -863,12 +863,12 @@ Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION Partc VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MyISAM, PARTITION parta VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MyISAM, PARTITION partB VALUES IN (4,8) COMMENT = 'Mix 3 of old parta and Partc' ENGINE = MyISAM, PARTITION PartD VALUES IN (5,6,12) ENGINE = MyISAM, - PARTITION PartE VALUES IN (13) ENGINE = MyISAM) */ + PARTITION PartE VALUES IN (13) ENGINE = MyISAM) # Test of RENAME TABLE RENAME TABLE TableA to TableB; SELECT * FROM TableB; @@ -928,12 +928,12 @@ Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (a) + PARTITION BY LIST (a) (PARTITION Partc VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MyISAM, PARTITION parta VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MyISAM, PARTITION partB VALUES IN (4,8) COMMENT = 'Mix 3 of old parta and Partc' ENGINE = MyISAM, PARTITION PartD VALUES IN (5,6,12) ENGINE = MyISAM, - PARTITION PartE VALUES IN (13) ENGINE = MyISAM) */ + PARTITION PartE VALUES IN (13) ENGINE = MyISAM) # Test of REMOVE PARTITIONING ALTER TABLE TableA REMOVE PARTITIONING; SELECT * FROM TableA; @@ -971,10 +971,10 @@ t1 CREATE TABLE `t1` ( `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (a) + PARTITION BY RANGE (a) (PARTITION LT1000 VALUES LESS THAN (1000) ENGINE = MyISAM, PARTITION LT2000 VALUES LESS THAN (2000) ENGINE = MyISAM, - PARTITION MAX VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION MAX VALUES LESS THAN MAXVALUE ENGINE = MyISAM) SELECT * FROM t1 ORDER BY a; a b 1 First diff --git a/mysql-test/suite/parts/r/partition_special_innodb.result b/mysql-test/suite/parts/r/partition_special_innodb.result index 78d15373924..ace37228d8d 100644 --- a/mysql-test/suite/parts/r/partition_special_innodb.result +++ b/mysql-test/suite/parts/r/partition_special_innodb.result @@ -13,11 +13,11 @@ t1 CREATE TABLE `t1` ( `d` enum('m','w') NOT NULL, PRIMARY KEY (`a`,`b`,`c`,`d`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a,b,c,d) + PARTITION BY KEY (a,b,c,d) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) insert into t1 values ('1975-01-01', 'abcde', 'abcde','m'), ('1983-12-31', 'cdef', 'srtbvsr', 'w'), @@ -55,11 +55,11 @@ t1 CREATE TABLE `t1` ( `i` char(255) DEFAULT NULL, PRIMARY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a,b,c,d,e,f,g,h) + PARTITION BY KEY (a,b,c,d,e,f,g,h) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) insert into t1 values ('1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, 'tbhth nrzh ztfghgfh fzh ftzhj fztjh'), ('1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, 'liuugbzvdmrlti b itiortudirtfgtibm dfi'), @@ -105,11 +105,11 @@ t1 CREATE TABLE `t1` ( `i` char(255) DEFAULT NULL, PRIMARY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`,`a1`,`b1`,`c1`,`d1`,`e1`,`f1`,`g1`,`h1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1) + PARTITION BY KEY (a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) insert into t1 values ('1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113,'1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, 'tbhth nrzh ztfghgfh fzh ftzhj fztjh'), ('1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127,'1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, 'liuugbzvdmrlti b itiortudirtfgtibm dfi'), @@ -185,11 +185,11 @@ t1 CREATE TABLE `t1` ( `i` char(255) DEFAULT NULL, PRIMARY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`,`a1`,`b1`,`c1`,`d1`,`e1`,`f1`,`g1`,`h1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a,b,c,d,e,f,g,h) + PARTITION BY KEY (a,b,c,d,e,f,g,h) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) insert into t1 values ('1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113,'1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113,'1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, '1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, 'tbhth nrzh ztfghgfh fzh ftzhj fztjh'), ('1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127,'1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, '1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, '1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, 'liuugbzvdmrlti b itiortudirtfgtibm dfi'), diff --git a/mysql-test/suite/parts/r/partition_special_myisam.result b/mysql-test/suite/parts/r/partition_special_myisam.result index 9e82019e9bc..df184e385ae 100644 --- a/mysql-test/suite/parts/r/partition_special_myisam.result +++ b/mysql-test/suite/parts/r/partition_special_myisam.result @@ -13,11 +13,11 @@ t1 CREATE TABLE `t1` ( `d` enum('m','w') NOT NULL, PRIMARY KEY (`a`,`b`,`c`,`d`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a,b,c,d) + PARTITION BY KEY (a,b,c,d) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) insert into t1 values ('1975-01-01', 'abcde', 'abcde','m'), ('1983-12-31', 'cdef', 'srtbvsr', 'w'), @@ -55,11 +55,11 @@ t1 CREATE TABLE `t1` ( `i` char(255) DEFAULT NULL, PRIMARY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a,b,c,d,e,f,g,h) + PARTITION BY KEY (a,b,c,d,e,f,g,h) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) insert into t1 values ('1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, 'tbhth nrzh ztfghgfh fzh ftzhj fztjh'), ('1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, 'liuugbzvdmrlti b itiortudirtfgtibm dfi'), @@ -105,11 +105,11 @@ t1 CREATE TABLE `t1` ( `i` char(255) DEFAULT NULL, PRIMARY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`,`a1`,`b1`,`c1`,`d1`,`e1`,`f1`,`g1`,`h1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1) + PARTITION BY KEY (a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) insert into t1 values ('1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113,'1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, 'tbhth nrzh ztfghgfh fzh ftzhj fztjh'), ('1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127,'1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, 'liuugbzvdmrlti b itiortudirtfgtibm dfi'), @@ -185,11 +185,11 @@ t1 CREATE TABLE `t1` ( `i` char(255) DEFAULT NULL, PRIMARY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`,`a1`,`b1`,`c1`,`d1`,`e1`,`f1`,`g1`,`h1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a,b,c,d,e,f,g,h) + PARTITION BY KEY (a,b,c,d,e,f,g,h) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ + PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) insert into t1 values ('1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113,'1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113,'1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, '1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, 'tbhth nrzh ztfghgfh fzh ftzhj fztjh'), ('1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127,'1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, '1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, '1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, 'liuugbzvdmrlti b itiortudirtfgtibm dfi'), diff --git a/mysql-test/suite/parts/r/partition_syntax_innodb.result b/mysql-test/suite/parts/r/partition_syntax_innodb.result index 767f023d04e..f8de7ca5249 100644 --- a/mysql-test/suite/parts/r/partition_syntax_innodb.result +++ b/mysql-test/suite/parts/r/partition_syntax_innodb.result @@ -658,9 +658,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,2)) + PARTITION BY LIST (MOD(f_int1,2)) (PARTITION part1 VALUES IN (NULL) ENGINE = InnoDB, - PARTITION part3 VALUES IN (1) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (1) ENGINE = InnoDB) DROP TABLE t1; # 3.5.3 Reveal that IN (...NULL) is not mapped to IN(0) @@ -685,10 +685,10 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,2)) + PARTITION BY LIST (MOD(f_int1,2)) (PARTITION part1 VALUES IN (NULL) ENGINE = InnoDB, PARTITION part2 VALUES IN (0) ENGINE = InnoDB, - PARTITION part3 VALUES IN (1) ENGINE = InnoDB) */ + PARTITION part3 VALUES IN (1) ENGINE = InnoDB) DROP TABLE t1; @@ -719,7 +719,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) */ + PARTITION BY HASH (f_int1) DROP TABLE t1; # 4.1.2 no partition number, named partitions @@ -741,9 +741,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part1 ENGINE = InnoDB, - PARTITION part2 ENGINE = InnoDB) */ + PARTITION part2 ENGINE = InnoDB) DROP TABLE t1; # 4.1.3 variations on no partition/subpartition number, named partitions, @@ -826,7 +826,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) (PARTITION part1 VALUES LESS THAN (10) (SUBPARTITION subpart11 ENGINE = InnoDB, @@ -836,7 +836,7 @@ SUBPARTITION BY HASH (f_int1) SUBPARTITION subpart22 ENGINE = InnoDB), PARTITION part3 VALUES LESS THAN (2147483646) (SUBPARTITION subpart31 ENGINE = InnoDB, - SUBPARTITION subpart32 ENGINE = InnoDB)) */ + SUBPARTITION subpart32 ENGINE = InnoDB)) DROP TABLE t1; #------------------------------------------------------------------------ @@ -862,8 +862,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 DROP TABLE t1; CREATE TABLE t1 ( @@ -887,11 +887,11 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part1 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part2 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part2 VALUES LESS THAN (2147483646) ENGINE = InnoDB) DROP TABLE t1; CREATE TABLE t1 ( @@ -912,8 +912,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 1 */ + PARTITION BY HASH (f_int1) +PARTITIONS 1 DROP TABLE t1; CREATE TABLE t1 ( @@ -937,11 +937,11 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 1 (PARTITION part1 VALUES LESS THAN (10) ENGINE = InnoDB, - PARTITION part2 VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + PARTITION part2 VALUES LESS THAN (2147483646) ENGINE = InnoDB) DROP TABLE t1; CREATE TABLE t1 ( @@ -1681,9 +1681,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part1 ENGINE = InnoDB, - PARTITION part2 ENGINE = InnoDB) */ + PARTITION part2 ENGINE = InnoDB) DROP TABLE t1; CREATE TABLE t1 ( @@ -1710,14 +1710,14 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) (PARTITION part1 VALUES LESS THAN (1000) (SUBPARTITION subpart11 ENGINE = InnoDB, SUBPARTITION subpart12 ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (2147483646) (SUBPARTITION subpart21 ENGINE = InnoDB, - SUBPARTITION subpart22 ENGINE = InnoDB)) */ + SUBPARTITION subpart22 ENGINE = InnoDB)) DROP TABLE t1; # 4.3.2 (positive) number of partition/subpartition , diff --git a/mysql-test/suite/parts/r/partition_syntax_myisam.result b/mysql-test/suite/parts/r/partition_syntax_myisam.result index 97eabe7d2ce..e7ae727ea02 100644 --- a/mysql-test/suite/parts/r/partition_syntax_myisam.result +++ b/mysql-test/suite/parts/r/partition_syntax_myisam.result @@ -658,9 +658,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,2)) + PARTITION BY LIST (MOD(f_int1,2)) (PARTITION part1 VALUES IN (NULL) ENGINE = MyISAM, - PARTITION part3 VALUES IN (1) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (1) ENGINE = MyISAM) unified filelist t1#P#part1.MYD @@ -693,10 +693,10 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (MOD(f_int1,2)) + PARTITION BY LIST (MOD(f_int1,2)) (PARTITION part1 VALUES IN (NULL) ENGINE = MyISAM, PARTITION part2 VALUES IN (0) ENGINE = MyISAM, - PARTITION part3 VALUES IN (1) ENGINE = MyISAM) */ + PARTITION part3 VALUES IN (1) ENGINE = MyISAM) unified filelist t1#P#part1.MYD @@ -737,7 +737,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) */ + PARTITION BY HASH (f_int1) unified filelist t1#P#p0.MYD @@ -765,9 +765,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part1 ENGINE = MyISAM, - PARTITION part2 ENGINE = MyISAM) */ + PARTITION part2 ENGINE = MyISAM) unified filelist t1#P#part1.MYD @@ -858,7 +858,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) (PARTITION part1 VALUES LESS THAN (10) (SUBPARTITION subpart11 ENGINE = MyISAM, @@ -868,7 +868,7 @@ SUBPARTITION BY HASH (f_int1) SUBPARTITION subpart22 ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (2147483646) (SUBPARTITION subpart31 ENGINE = MyISAM, - SUBPARTITION subpart32 ENGINE = MyISAM)) */ + SUBPARTITION subpart32 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD @@ -910,8 +910,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 2 */ + PARTITION BY HASH (f_int1) +PARTITIONS 2 unified filelist t1#P#p0.MYD @@ -943,11 +943,11 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part1 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part2 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part2 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -980,8 +980,8 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) -PARTITIONS 1 */ + PARTITION BY HASH (f_int1) +PARTITIONS 1 unified filelist t1#P#p0.MYD @@ -1011,11 +1011,11 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 1 (PARTITION part1 VALUES LESS THAN (10) ENGINE = MyISAM, - PARTITION part2 VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + PARTITION part2 VALUES LESS THAN (2147483646) ENGINE = MyISAM) unified filelist t1#P#part1#SP#part1sp0.MYD @@ -1763,9 +1763,9 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (f_int1) + PARTITION BY HASH (f_int1) (PARTITION part1 ENGINE = MyISAM, - PARTITION part2 ENGINE = MyISAM) */ + PARTITION part2 ENGINE = MyISAM) unified filelist t1#P#part1.MYD @@ -1800,14 +1800,14 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (f_int1) + PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) (PARTITION part1 VALUES LESS THAN (1000) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483646) (SUBPARTITION subpart21 ENGINE = MyISAM, - SUBPARTITION subpart22 ENGINE = MyISAM)) */ + SUBPARTITION subpart22 ENGINE = MyISAM)) unified filelist t1#P#part1#SP#subpart11.MYD diff --git a/mysql-test/suite/parts/r/rpl_partition.result b/mysql-test/suite/parts/r/rpl_partition.result index 874b482cfb8..0afe1cb478d 100644 --- a/mysql-test/suite/parts/r/rpl_partition.result +++ b/mysql-test/suite/parts/r/rpl_partition.result @@ -128,14 +128,14 @@ show create table t3; Table t3 Create Table CREATE TABLE `t3` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` longblob DEFAULT NULL, `fkid` mediumint(9) DEFAULT NULL, `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1001 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (id) + PARTITION BY RANGE (id) SUBPARTITION BY HASH (id) SUBPARTITIONS 2 (PARTITION pa1 VALUES LESS THAN (10) ENGINE = InnoDB, @@ -148,7 +148,7 @@ SUBPARTITIONS 2 PARTITION pa8 VALUES LESS THAN (80) ENGINE = InnoDB, PARTITION pa9 VALUES LESS THAN (90) ENGINE = InnoDB, PARTITION pa10 VALUES LESS THAN (100) ENGINE = InnoDB, - PARTITION pa11 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION pa11 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) include/check_slave_is_running.inc SELECT count(*) "Slave norm" FROM t1; Slave norm 500 diff --git a/mysql-test/suite/perfschema/r/aggregate.result b/mysql-test/suite/perfschema/r/aggregate.result deleted file mode 100644 index c8fa1cc2b24..00000000000 --- a/mysql-test/suite/perfschema/r/aggregate.result +++ /dev/null @@ -1,121 +0,0 @@ -"General cleanup" -set @aria_checkpoint_interval_save= @@global.aria_checkpoint_interval; -set @@global.aria_checkpoint_interval= 0; -drop table if exists t1; -update performance_schema.setup_instruments set enabled = 'NO'; -update performance_schema.setup_consumers set enabled = 'NO'; -truncate table performance_schema.file_summary_by_event_name; -truncate table performance_schema.file_summary_by_instance; -truncate table performance_schema.socket_summary_by_event_name; -truncate table performance_schema.socket_summary_by_instance; -truncate table performance_schema.events_waits_summary_global_by_event_name; -truncate table performance_schema.events_waits_summary_by_instance; -truncate table performance_schema.events_waits_summary_by_thread_by_event_name; -update performance_schema.setup_consumers set enabled = 'YES'; -update performance_schema.setup_instruments -set enabled = 'YES', timed = 'YES'; -create table t1 ( -id INT PRIMARY KEY, -b CHAR(100) DEFAULT 'initial value') -ENGINE=MyISAM; -insert into t1 (id) values (1), (2), (3), (4), (5), (6), (7), (8); -update performance_schema.setup_instruments SET enabled = 'NO'; -update performance_schema.setup_consumers set enabled = 'NO'; -set @dump_all=FALSE; -"Verifying file aggregate consistency" -SELECT EVENT_NAME, e.COUNT_READ, SUM(i.COUNT_READ) -FROM performance_schema.file_summary_by_event_name AS e -JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.COUNT_READ <> SUM(i.COUNT_READ)) -OR @dump_all; -EVENT_NAME COUNT_READ SUM(i.COUNT_READ) -SELECT EVENT_NAME, e.COUNT_WRITE, SUM(i.COUNT_WRITE) -FROM performance_schema.file_summary_by_event_name AS e -JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.COUNT_WRITE <> SUM(i.COUNT_WRITE)) -OR @dump_all; -EVENT_NAME COUNT_WRITE SUM(i.COUNT_WRITE) -SELECT EVENT_NAME, e.COUNT_READ, SUM(i.COUNT_READ) -FROM performance_schema.socket_summary_by_event_name AS e -JOIN performance_schema.socket_summary_by_instance AS i USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.COUNT_READ <> SUM(i.COUNT_READ)) -OR @dump_all; -EVENT_NAME COUNT_READ SUM(i.COUNT_READ) -SELECT EVENT_NAME, e.COUNT_WRITE, SUM(i.COUNT_WRITE) -FROM performance_schema.socket_summary_by_event_name AS e -JOIN performance_schema.socket_summary_by_instance AS i USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.COUNT_WRITE <> SUM(i.COUNT_WRITE)) -OR @dump_all; -EVENT_NAME COUNT_WRITE SUM(i.COUNT_WRITE) -SELECT EVENT_NAME, e.SUM_NUMBER_OF_BYTES_READ, SUM(i.SUM_NUMBER_OF_BYTES_READ) -FROM performance_schema.file_summary_by_event_name AS e -JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.SUM_NUMBER_OF_BYTES_READ <> SUM(i.SUM_NUMBER_OF_BYTES_READ)) -OR @dump_all; -EVENT_NAME SUM_NUMBER_OF_BYTES_READ SUM(i.SUM_NUMBER_OF_BYTES_READ) -SELECT EVENT_NAME, e.SUM_NUMBER_OF_BYTES_WRITE, SUM(i.SUM_NUMBER_OF_BYTES_WRITE) -FROM performance_schema.file_summary_by_event_name AS e -JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.SUM_NUMBER_OF_BYTES_WRITE <> SUM(i.SUM_NUMBER_OF_BYTES_WRITE)) -OR @dump_all; -EVENT_NAME SUM_NUMBER_OF_BYTES_WRITE SUM(i.SUM_NUMBER_OF_BYTES_WRITE) -"Verifying waits aggregate consistency (instance)" -SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(i.SUM_TIMER_WAIT) -FROM performance_schema.events_waits_summary_global_by_event_name AS e -JOIN performance_schema.events_waits_summary_by_instance AS i USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.SUM_TIMER_WAIT < SUM(i.SUM_TIMER_WAIT)) -OR @dump_all; -EVENT_NAME SUM_TIMER_WAIT SUM(i.SUM_TIMER_WAIT) -SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(i.MIN_TIMER_WAIT) -FROM performance_schema.events_waits_summary_global_by_event_name AS e -JOIN performance_schema.events_waits_summary_by_instance AS i USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.MIN_TIMER_WAIT > MIN(i.MIN_TIMER_WAIT)) -AND (MIN(i.MIN_TIMER_WAIT) != 0) -OR @dump_all; -EVENT_NAME MIN_TIMER_WAIT MIN(i.MIN_TIMER_WAIT) -SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(i.MAX_TIMER_WAIT) -FROM performance_schema.events_waits_summary_global_by_event_name AS e -JOIN performance_schema.events_waits_summary_by_instance AS i USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.MAX_TIMER_WAIT < MAX(i.MAX_TIMER_WAIT)) -OR @dump_all; -EVENT_NAME MAX_TIMER_WAIT MAX(i.MAX_TIMER_WAIT) -"Verifying waits aggregate consistency (thread)" -SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(t.SUM_TIMER_WAIT) -FROM performance_schema.events_waits_summary_global_by_event_name AS e -JOIN performance_schema.events_waits_summary_by_thread_by_event_name AS t -USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.SUM_TIMER_WAIT < SUM(t.SUM_TIMER_WAIT)) -OR @dump_all; -EVENT_NAME SUM_TIMER_WAIT SUM(t.SUM_TIMER_WAIT) -SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(t.MIN_TIMER_WAIT) -FROM performance_schema.events_waits_summary_global_by_event_name AS e -JOIN performance_schema.events_waits_summary_by_thread_by_event_name AS t -USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.MIN_TIMER_WAIT > MIN(t.MIN_TIMER_WAIT)) -AND (MIN(t.MIN_TIMER_WAIT) != 0) -OR @dump_all; -EVENT_NAME MIN_TIMER_WAIT MIN(t.MIN_TIMER_WAIT) -SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(t.MAX_TIMER_WAIT) -FROM performance_schema.events_waits_summary_global_by_event_name AS e -JOIN performance_schema.events_waits_summary_by_thread_by_event_name AS t -USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.MAX_TIMER_WAIT < MAX(t.MAX_TIMER_WAIT)) -OR @dump_all; -EVENT_NAME MAX_TIMER_WAIT MAX(t.MAX_TIMER_WAIT) -update performance_schema.setup_consumers set enabled = 'YES'; -update performance_schema.setup_instruments -set enabled = 'YES', timed = 'YES'; -drop table test.t1; -set @@global.aria_checkpoint_interval= @aria_checkpoint_interval_save; diff --git a/mysql-test/suite/perfschema/r/part_table_io.result b/mysql-test/suite/perfschema/r/part_table_io.result index 2aa12851679..0fd8653734d 100644 --- a/mysql-test/suite/perfschema/r/part_table_io.result +++ b/mysql-test/suite/perfschema/r/part_table_io.result @@ -20,8 +20,8 @@ no_index_tab CREATE TABLE `no_index_tab` ( `a` varchar(255) NOT NULL, `b` int(11) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (b) -PARTITIONS 2 */ + PARTITION BY KEY (b) +PARTITIONS 2 insert into marker set a = 1; insert into test.no_index_tab set a = 'foo', b = 1; insert into marker set a = 1; diff --git a/mysql-test/suite/perfschema/r/threads_innodb.result b/mysql-test/suite/perfschema/r/threads_innodb.result index 3fb469ad00b..2229d972038 100644 --- a/mysql-test/suite/perfschema/r/threads_innodb.result +++ b/mysql-test/suite/perfschema/r/threads_innodb.result @@ -15,3 +15,4 @@ thread/innodb/srv_lock_timeout_thread BACKGROUND NULL NULL NULL NULL NULL NULL N thread/innodb/srv_master_thread BACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL NULL YES thread/innodb/srv_monitor_thread BACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL NULL YES thread/innodb/srv_purge_thread BACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL NULL YES +thread/innodb/thd_destructor_thread BACKGROUND NULL NULL NULL NULL NULL NULL NULL 1 NULL YES diff --git a/mysql-test/suite/perfschema/t/aggregate.test b/mysql-test/suite/perfschema/t/aggregate.test deleted file mode 100644 index fe30a7b8697..00000000000 --- a/mysql-test/suite/perfschema/t/aggregate.test +++ /dev/null @@ -1,197 +0,0 @@ -# Tests for PERFORMANCE_SCHEMA -# Verify that statistics aggregated by different criteria are consistent. - ---source include/not_embedded.inc ---source include/have_perfschema.inc - ---echo "General cleanup" - -# MDEV-7187 - test fails sporadically in buildbot -set @aria_checkpoint_interval_save= @@global.aria_checkpoint_interval; -set @@global.aria_checkpoint_interval= 0; - ---disable_warnings -drop table if exists t1; ---enable_warnings - -update performance_schema.setup_instruments set enabled = 'NO'; -update performance_schema.setup_consumers set enabled = 'NO'; - -# Cleanup statistics -truncate table performance_schema.file_summary_by_event_name; -truncate table performance_schema.file_summary_by_instance; -truncate table performance_schema.socket_summary_by_event_name; -truncate table performance_schema.socket_summary_by_instance; -truncate table performance_schema.events_waits_summary_global_by_event_name; -truncate table performance_schema.events_waits_summary_by_instance; -truncate table performance_schema.events_waits_summary_by_thread_by_event_name; - -# Start recording data -update performance_schema.setup_consumers set enabled = 'YES'; -update performance_schema.setup_instruments - set enabled = 'YES', timed = 'YES'; - - -create table t1 ( - id INT PRIMARY KEY, - b CHAR(100) DEFAULT 'initial value') - ENGINE=MyISAM; - -insert into t1 (id) values (1), (2), (3), (4), (5), (6), (7), (8); - -# Stop recording data, so the select below don't add noise. -update performance_schema.setup_instruments SET enabled = 'NO'; -# Disable all consumers, for long standing waits -update performance_schema.setup_consumers set enabled = 'NO'; - -# Helper to debug -set @dump_all=FALSE; - -# Note that in general: -# - COUNT/SUM/MAX(file_summary_by_event_name) >= -# COUNT/SUM/MAX(file_summary_by_instance). -# - MIN(file_summary_by_event_name) <= -# MIN(file_summary_by_instance). -# There will be equality only when file instances are not removed, -# aka when a file is not deleted from the file system, -# because doing so removes a row in file_summary_by_instance. - -# Likewise: -# - COUNT/SUM/MAX(events_waits_summary_global_by_event_name) >= -# COUNT/SUM/MAX(events_waits_summary_by_instance) -# - MIN(events_waits_summary_global_by_event_name) <= -# MIN(events_waits_summary_by_instance) -# There will be equality only when an instrument instance -# is not removed, which is next to impossible to predictably guarantee -# in the server. -# For example, a MyISAM table removed from the table cache -# will cause a mysql_mutex_destroy on myisam/MYISAM_SHARE::intern_lock. -# Another example, a thread terminating will cause a mysql_mutex_destroy -# on sql/LOCK_delete -# Both cause a row to be deleted from events_waits_summary_by_instance. - -# Likewise: -# - COUNT/SUM/MAX(events_waits_summary_global_by_event_name) >= -# COUNT/SUM/MAX(events_waits_summary_by_thread_by_event_name) -# - MIN(events_waits_summary_global_by_event_name) <= -# MIN(events_waits_summary_by_thread_by_event_name) -# There will be equality only when no thread is removed, -# that is if no thread disconnects, or no sub thread (for example insert -# delayed) ever completes. -# A thread completing will cause rows in -# events_waits_summary_by_thread_by_event_name to be removed. - ---echo "Verifying file aggregate consistency" - -# Since the code generating the load in this test does: -# - create table -# - insert -# - does not cause temporary tables to be used -# we can test for equality here for file aggregates. - -# If any of these queries returns data, the test failed. - -SELECT EVENT_NAME, e.COUNT_READ, SUM(i.COUNT_READ) -FROM performance_schema.file_summary_by_event_name AS e -JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.COUNT_READ <> SUM(i.COUNT_READ)) -OR @dump_all; - -SELECT EVENT_NAME, e.COUNT_WRITE, SUM(i.COUNT_WRITE) -FROM performance_schema.file_summary_by_event_name AS e -JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.COUNT_WRITE <> SUM(i.COUNT_WRITE)) -OR @dump_all; - -SELECT EVENT_NAME, e.COUNT_READ, SUM(i.COUNT_READ) -FROM performance_schema.socket_summary_by_event_name AS e -JOIN performance_schema.socket_summary_by_instance AS i USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.COUNT_READ <> SUM(i.COUNT_READ)) -OR @dump_all; - -SELECT EVENT_NAME, e.COUNT_WRITE, SUM(i.COUNT_WRITE) -FROM performance_schema.socket_summary_by_event_name AS e -JOIN performance_schema.socket_summary_by_instance AS i USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.COUNT_WRITE <> SUM(i.COUNT_WRITE)) -OR @dump_all; - -SELECT EVENT_NAME, e.SUM_NUMBER_OF_BYTES_READ, SUM(i.SUM_NUMBER_OF_BYTES_READ) -FROM performance_schema.file_summary_by_event_name AS e -JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.SUM_NUMBER_OF_BYTES_READ <> SUM(i.SUM_NUMBER_OF_BYTES_READ)) -OR @dump_all; - -SELECT EVENT_NAME, e.SUM_NUMBER_OF_BYTES_WRITE, SUM(i.SUM_NUMBER_OF_BYTES_WRITE) -FROM performance_schema.file_summary_by_event_name AS e -JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.SUM_NUMBER_OF_BYTES_WRITE <> SUM(i.SUM_NUMBER_OF_BYTES_WRITE)) -OR @dump_all; - ---echo "Verifying waits aggregate consistency (instance)" - -SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(i.SUM_TIMER_WAIT) -FROM performance_schema.events_waits_summary_global_by_event_name AS e -JOIN performance_schema.events_waits_summary_by_instance AS i USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.SUM_TIMER_WAIT < SUM(i.SUM_TIMER_WAIT)) -OR @dump_all; - -SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(i.MIN_TIMER_WAIT) -FROM performance_schema.events_waits_summary_global_by_event_name AS e -JOIN performance_schema.events_waits_summary_by_instance AS i USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.MIN_TIMER_WAIT > MIN(i.MIN_TIMER_WAIT)) -AND (MIN(i.MIN_TIMER_WAIT) != 0) -OR @dump_all; - -SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(i.MAX_TIMER_WAIT) -FROM performance_schema.events_waits_summary_global_by_event_name AS e -JOIN performance_schema.events_waits_summary_by_instance AS i USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.MAX_TIMER_WAIT < MAX(i.MAX_TIMER_WAIT)) -OR @dump_all; - ---echo "Verifying waits aggregate consistency (thread)" - -SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(t.SUM_TIMER_WAIT) -FROM performance_schema.events_waits_summary_global_by_event_name AS e -JOIN performance_schema.events_waits_summary_by_thread_by_event_name AS t -USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.SUM_TIMER_WAIT < SUM(t.SUM_TIMER_WAIT)) -OR @dump_all; - -SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(t.MIN_TIMER_WAIT) -FROM performance_schema.events_waits_summary_global_by_event_name AS e -JOIN performance_schema.events_waits_summary_by_thread_by_event_name AS t -USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.MIN_TIMER_WAIT > MIN(t.MIN_TIMER_WAIT)) -AND (MIN(t.MIN_TIMER_WAIT) != 0) -OR @dump_all; - -SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(t.MAX_TIMER_WAIT) -FROM performance_schema.events_waits_summary_global_by_event_name AS e -JOIN performance_schema.events_waits_summary_by_thread_by_event_name AS t -USING (EVENT_NAME) -GROUP BY EVENT_NAME -HAVING (e.MAX_TIMER_WAIT < MAX(t.MAX_TIMER_WAIT)) -OR @dump_all; - - -# Cleanup - -update performance_schema.setup_consumers set enabled = 'YES'; -update performance_schema.setup_instruments - set enabled = 'YES', timed = 'YES'; - -drop table test.t1; - -set @@global.aria_checkpoint_interval= @aria_checkpoint_interval_save; - diff --git a/mysql-test/suite/plugins/r/server_audit.result b/mysql-test/suite/plugins/r/server_audit.result index 9c7dc1490b1..45206c8bcb4 100644 --- a/mysql-test/suite/plugins/r/server_audit.result +++ b/mysql-test/suite/plugins/r/server_audit.result @@ -8,7 +8,6 @@ server_audit_file_rotate_now OFF server_audit_file_rotate_size 1000000 server_audit_file_rotations 9 server_audit_incl_users -server_audit_loc_info server_audit_logging OFF server_audit_mode 0 server_audit_output_type file @@ -77,7 +76,6 @@ server_audit_file_rotate_now OFF server_audit_file_rotate_size 1000000 server_audit_file_rotations 9 server_audit_incl_users odin, root, dva, tri -server_audit_loc_info server_audit_logging ON server_audit_mode 0 server_audit_output_type file @@ -227,7 +225,6 @@ server_audit_file_rotate_now OFF server_audit_file_rotate_size 1000000 server_audit_file_rotations 9 server_audit_incl_users odin, root, dva, tri -server_audit_loc_info server_audit_logging ON server_audit_mode 1 server_audit_output_type file diff --git a/mysql-test/suite/plugins/r/thread_pool_server_audit.result b/mysql-test/suite/plugins/r/thread_pool_server_audit.result index 9c7dc1490b1..45206c8bcb4 100644 --- a/mysql-test/suite/plugins/r/thread_pool_server_audit.result +++ b/mysql-test/suite/plugins/r/thread_pool_server_audit.result @@ -8,7 +8,6 @@ server_audit_file_rotate_now OFF server_audit_file_rotate_size 1000000 server_audit_file_rotations 9 server_audit_incl_users -server_audit_loc_info server_audit_logging OFF server_audit_mode 0 server_audit_output_type file @@ -77,7 +76,6 @@ server_audit_file_rotate_now OFF server_audit_file_rotate_size 1000000 server_audit_file_rotations 9 server_audit_incl_users odin, root, dva, tri -server_audit_loc_info server_audit_logging ON server_audit_mode 0 server_audit_output_type file @@ -227,7 +225,6 @@ server_audit_file_rotate_now OFF server_audit_file_rotate_size 1000000 server_audit_file_rotations 9 server_audit_incl_users odin, root, dva, tri -server_audit_loc_info server_audit_logging ON server_audit_mode 1 server_audit_output_type file diff --git a/mysql-test/suite/roles/create_and_drop_role.result b/mysql-test/suite/roles/create_and_drop_role.result index d9784bbb420..a163ee82f42 100644 --- a/mysql-test/suite/roles/create_and_drop_role.result +++ b/mysql-test/suite/roles/create_and_drop_role.result @@ -71,3 +71,19 @@ GRANT USAGE ON *.* TO 'r1'@'localhost' DROP USER u1; DROP ROLE r2; DROP USER r1@localhost; +create role 'foo '; +select concat(user, '__'), is_role from mysql.user where user like 'foo%'; +concat(user, '__') is_role +foo__ Y +select * from mysql.roles_mapping; +Host User Role Admin_option +localhost root foo Y +drop role foo; +select concat(user, '__'), is_role from mysql.user where user like 'foo%'; +concat(user, '__') is_role +select * from mysql.roles_mapping; +Host User Role Admin_option +show grants; +Grants for root@localhost +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION diff --git a/mysql-test/suite/roles/create_and_drop_role.test b/mysql-test/suite/roles/create_and_drop_role.test index 71d6de7053f..b6e5bd2b297 100644 --- a/mysql-test/suite/roles/create_and_drop_role.test +++ b/mysql-test/suite/roles/create_and_drop_role.test @@ -95,3 +95,15 @@ SHOW GRANTS FOR r1@localhost; # Related to MDEV-7774, also caused a crash, by DROP USER u1; DROP ROLE r2; DROP USER r1@localhost; + +# +# MDEV-11533: Roles with trailing white spaces are not cleared correctly +# +create role 'foo '; +select concat(user, '__'), is_role from mysql.user where user like 'foo%'; +select * from mysql.roles_mapping; +drop role foo; +select concat(user, '__'), is_role from mysql.user where user like 'foo%'; +select * from mysql.roles_mapping; +--sorted_result +show grants; diff --git a/mysql-test/suite/roles/definer.result b/mysql-test/suite/roles/definer.result index e3b2d6ac758..8346171ba3f 100644 --- a/mysql-test/suite/roles/definer.result +++ b/mysql-test/suite/roles/definer.result @@ -20,18 +20,18 @@ set role role1; create definer=current_role view test.v1 as select a+b,c from t1; show create view test.v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`role1` SQL SECURITY DEFINER VIEW `test`.`v1` AS select (`mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b`) AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`role1` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b` AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` latin1 latin1_swedish_ci set role none; create definer=role2 view test.v2 as select a+b,c,current_role() from t1; show create view test.v2; View Create View character_set_client collation_connection -v2 CREATE ALGORITHM=UNDEFINED DEFINER=`role2` SQL SECURITY DEFINER VIEW `test`.`v2` AS select (`mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b`) AS `a+b`,`mysqltest1`.`t1`.`c` AS `c`,current_role() AS `current_role()` from `mysqltest1`.`t1` latin1 latin1_swedish_ci +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`role2` SQL SECURITY DEFINER VIEW `test`.`v2` AS select `mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b` AS `a+b`,`mysqltest1`.`t1`.`c` AS `c`,current_role() AS `current_role()` from `mysqltest1`.`t1` latin1 latin1_swedish_ci create definer=role3 view test.v3 as select a+b,c from t1; Warnings: Note 1449 The user specified as a definer ('role3'@'%') does not exist show create view test.v3; View Create View character_set_client collation_connection -v3 CREATE ALGORITHM=UNDEFINED DEFINER=`role3`@`%` SQL SECURITY DEFINER VIEW `test`.`v3` AS select (`mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b`) AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` latin1 latin1_swedish_ci +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`role3`@`%` SQL SECURITY DEFINER VIEW `test`.`v3` AS select `mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b` AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` latin1 latin1_swedish_ci Warnings: Note 1449 The user specified as a definer ('role3'@'%') does not exist connect c1, localhost, foo,,mysqltest1; @@ -77,7 +77,7 @@ connection default; drop role role4; show create view test.v5; View Create View character_set_client collation_connection -v5 CREATE ALGORITHM=UNDEFINED DEFINER=`role4` SQL SECURITY DEFINER VIEW `test`.`v5` AS select (`mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b`) AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` latin1 latin1_swedish_ci +v5 CREATE ALGORITHM=UNDEFINED DEFINER=`role4` SQL SECURITY DEFINER VIEW `test`.`v5` AS select `mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b` AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` latin1 latin1_swedish_ci Warnings: Note 1449 The user specified as a definer ('role4'@'') does not exist select * from test.v5; @@ -86,7 +86,7 @@ create user role4; grant select on mysqltest1.t1 to role4; show create view test.v5; View Create View character_set_client collation_connection -v5 CREATE ALGORITHM=UNDEFINED DEFINER=`role4` SQL SECURITY DEFINER VIEW `test`.`v5` AS select (`mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b`) AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` latin1 latin1_swedish_ci +v5 CREATE ALGORITHM=UNDEFINED DEFINER=`role4` SQL SECURITY DEFINER VIEW `test`.`v5` AS select `mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b` AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` latin1 latin1_swedish_ci Warnings: Note 1449 The user specified as a definer ('role4'@'') does not exist select * from test.v5; @@ -94,7 +94,7 @@ ERROR HY000: The user specified as a definer ('role4'@'') does not exist flush tables; show create view test.v5; View Create View character_set_client collation_connection -v5 CREATE ALGORITHM=UNDEFINED DEFINER=`role4`@`%` SQL SECURITY DEFINER VIEW `test`.`v5` AS select (`mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b`) AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` latin1 latin1_swedish_ci +v5 CREATE ALGORITHM=UNDEFINED DEFINER=`role4`@`%` SQL SECURITY DEFINER VIEW `test`.`v5` AS select `mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b` AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` latin1 latin1_swedish_ci select * from test.v5; a+b c 11 100 @@ -543,7 +543,7 @@ USE `test`; /*!50001 SET character_set_client = latin1 */; /*!50001 SET character_set_results = latin1 */; /*!50001 SET collation_connection = latin1_swedish_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`role1` SQL SECURITY DEFINER VIEW `v1` AS select (`mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b`) AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` */; +/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`role1` SQL SECURITY DEFINER VIEW `v1` AS select `mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b` AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -554,7 +554,7 @@ USE `test`; /*!50001 SET character_set_client = latin1 */; /*!50001 SET character_set_results = latin1 */; /*!50001 SET collation_connection = latin1_swedish_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`role2` SQL SECURITY DEFINER VIEW `v2` AS select (`mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b`) AS `a+b`,`mysqltest1`.`t1`.`c` AS `c`,current_role() AS `current_role()` from `mysqltest1`.`t1` */; +/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`role2` SQL SECURITY DEFINER VIEW `v2` AS select `mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b` AS `a+b`,`mysqltest1`.`t1`.`c` AS `c`,current_role() AS `current_role()` from `mysqltest1`.`t1` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -567,7 +567,7 @@ USE `test`; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`role3`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v3` AS select (`mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b`) AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` */; +/*!50001 VIEW `v3` AS select `mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b` AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -580,7 +580,7 @@ USE `test`; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`foo`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v4` AS select (`mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b`) AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` */; +/*!50001 VIEW `v4` AS select `mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b` AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -593,7 +593,7 @@ USE `test`; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`role4`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v5` AS select (`mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b`) AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` */; +/*!50001 VIEW `v5` AS select `mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b` AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; diff --git a/mysql-test/suite/roles/role_case_sensitive-10744.result b/mysql-test/suite/roles/role_case_sensitive-10744.result new file mode 100644 index 00000000000..b898310e83c --- /dev/null +++ b/mysql-test/suite/roles/role_case_sensitive-10744.result @@ -0,0 +1,60 @@ +# +# MDEV-10744 Roles are not fully case-sensitive +# +# +# Test creating two case-different roles. +# +create user test_user@'%'; +create role test_ROLE; +create role test_role; +# +# Test if mysql.user has the roles created. +# +select user, host from mysql.user where is_role='y' and user like 'test%'; +user host +test_ROLE +test_role +create database secret_db; +create table secret_db.t1 (secret varchar(100)); +insert into secret_db.t1 values ("Some Secret P4ssw0rd"); +grant select on secret_db.* to test_role; +grant test_role to test_user; +show grants for test_user; +Grants for test_user@% +GRANT test_role TO 'test_user'@'%' +GRANT USAGE ON *.* TO 'test_user'@'%' +# +# Now test the UPPER case role. +# +grant test_ROLE to test_user; +grant insert on secret_db.t1 to test_ROLE; +show grants for test_user; +Grants for test_user@% +GRANT test_role TO 'test_user'@'%' +GRANT test_ROLE TO 'test_user'@'%' +GRANT USAGE ON *.* TO 'test_user'@'%' +connect test_user,localhost,test_user; +# +# Test users privileges when interacting with those roles; +# +show tables from secret_db; +ERROR 42000: Access denied for user 'test_user'@'%' to database 'secret_db' +set role test_ROLE; +show tables from secret_db; +Tables_in_secret_db +t1 +select * from secret_db.t1; +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 't1' +insert into secret_db.t1 values ("|-|4><"); +set role test_role; +select * from secret_db.t1 order by secret; +secret +Some Secret P4ssw0rd +|-|4>< +insert into secret_db.t1 values ("|_33T|-|4><"); +ERROR 42000: INSERT command denied to user 'test_user'@'localhost' for table 't1' +connection default; +drop role test_ROLE; +drop role test_role; +drop user test_user; +drop database secret_db; diff --git a/mysql-test/suite/roles/role_case_sensitive-10744.test b/mysql-test/suite/roles/role_case_sensitive-10744.test new file mode 100644 index 00000000000..281d61bce00 --- /dev/null +++ b/mysql-test/suite/roles/role_case_sensitive-10744.test @@ -0,0 +1,54 @@ +--source include/not_embedded.inc +--echo # +--echo # MDEV-10744 Roles are not fully case-sensitive +--echo # + +--echo # +--echo # Test creating two case-different roles. +--echo # +create user test_user@'%'; +create role test_ROLE; +create role test_role; +--echo # +--echo # Test if mysql.user has the roles created. +--echo # +--sorted_result +select user, host from mysql.user where is_role='y' and user like 'test%'; + +create database secret_db; +create table secret_db.t1 (secret varchar(100)); +insert into secret_db.t1 values ("Some Secret P4ssw0rd"); + +grant select on secret_db.* to test_role; +grant test_role to test_user; +show grants for test_user; +--echo # +--echo # Now test the UPPER case role. +--echo # +grant test_ROLE to test_user; +grant insert on secret_db.t1 to test_ROLE; +show grants for test_user; +connect (test_user,localhost,test_user); + +--echo # +--echo # Test users privileges when interacting with those roles; +--echo # +--error ER_DBACCESS_DENIED_ERROR +show tables from secret_db; +set role test_ROLE; +show tables from secret_db; +--error ER_TABLEACCESS_DENIED_ERROR +select * from secret_db.t1; +insert into secret_db.t1 values ("|-|4><"); +set role test_role; +select * from secret_db.t1 order by secret; +--error ER_TABLEACCESS_DENIED_ERROR +insert into secret_db.t1 values ("|_33T|-|4><"); + +connection default; + + +drop role test_ROLE; +drop role test_role; +drop user test_user; +drop database secret_db; diff --git a/mysql-test/suite/rpl/r/rpl_alter_extra_persistent.result b/mysql-test/suite/rpl/r/rpl_alter_extra_persistent.result new file mode 100644 index 00000000000..96df87d8ad4 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_alter_extra_persistent.result @@ -0,0 +1,203 @@ +include/master-slave.inc +[connection master] +connection master; +create table t1(a int primary key); +insert into t1 values(1); +insert into t1 values(2); +insert into t1 values(3); +insert into t1 values(4); +connection slave; +select * from t1 order by a; +a +1 +2 +3 +4 +alter table t1 add column z1 int as(a+1) virtual, add column z2 int as (a+2) persistent; +select * from t1 order by a; +a z1 z2 +1 2 3 +2 3 4 +3 4 5 +4 5 6 +connection master; +insert into t1 values(5); +insert into t1 values(6); +connection slave; +select * from t1 order by a; +a z1 z2 +1 2 3 +2 3 4 +3 4 5 +4 5 6 +5 6 7 +6 7 8 +#UPDATE query +connection master; +update t1 set a = a+10; +select * from t1 order by a; +a +11 +12 +13 +14 +15 +16 +connection slave; +select * from t1 order by a; +a z1 z2 +11 12 13 +12 13 14 +13 14 15 +14 15 16 +15 16 17 +16 17 18 +connection master; +update t1 set a = a-10; +select * from t1 order by a; +a +1 +2 +3 +4 +5 +6 +connection slave; +select * from t1 order by a; +a z1 z2 +1 2 3 +2 3 4 +3 4 5 +4 5 6 +5 6 7 +6 7 8 +#DELETE quert +connection master; +delete from t1 where a > 2 and a < 4; +select * from t1 order by a; +a +1 +2 +4 +5 +6 +connection slave; +select * from t1 order by a; +a z1 z2 +1 2 3 +2 3 4 +4 5 6 +5 6 7 +6 7 8 +#REPLACE query +connection master; +replace into t1 values(1); +replace into t1 values(3); +replace into t1 values(1); +connection slave; +select * from t1 order by a; +a z1 z2 +1 2 3 +2 3 4 +3 4 5 +4 5 6 +5 6 7 +6 7 8 +#SELECT query +connection master; +select * from t1 where a > 2 and a < 4; +a +3 +connection slave; +select * from t1 where a > 2 and a < 4; +a z1 z2 +3 4 5 +#UPDATE with SELECT query +connection master; +update t1 set a = a + 10 where a > 2 and a < 4; +select * from t1 order by a; +a +1 +2 +4 +5 +6 +13 +connection slave; +select * from t1 order by a; +a z1 z2 +1 2 3 +2 3 4 +4 5 6 +5 6 7 +6 7 8 +13 14 15 +connection master; +update t1 set a = a - 10 where a = 13; +select * from t1 order by a; +a +1 +2 +3 +4 +5 +6 +connection slave; +select * from t1 order by a; +a z1 z2 +1 2 3 +2 3 4 +3 4 5 +4 5 6 +5 6 7 +6 7 8 +#Break Unique Constraint +alter table t1 add column z4 int as (a % 6) persistent unique; +connection master; +#entering duplicate value for slave persistent column +insert into t1 values(7); +select * from t1 order by a; +a +1 +2 +3 +4 +5 +6 +7 +connection slave; +include/wait_for_slave_sql_error.inc [errno=1062] +select * from t1 order by a; +a z1 z2 z4 +1 2 3 1 +2 3 4 2 +3 4 5 3 +4 5 6 4 +5 6 7 5 +6 7 8 0 +alter table t1 drop column z4; +start slave; +include/wait_for_slave_sql_to_start.inc +connection master; +connection slave; +select * from t1 order by a; +a z1 z2 +1 2 3 +2 3 4 +3 4 5 +4 5 6 +5 6 7 +6 7 8 +7 8 9 +connection master; +select * from t1 order by a; +a +1 +2 +3 +4 +5 +6 +7 +drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_binlog_compress.result b/mysql-test/suite/rpl/r/rpl_binlog_compress.result new file mode 100644 index 00000000000..d729611e885 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_binlog_compress.result @@ -0,0 +1,76 @@ +include/master-slave.inc +[connection master] +set @old_log_bin_compress=@@log_bin_compress; +set @old_log_bin_compress_min_len=@@log_bin_compress_min_len; +set @old_binlog_format=@@binlog_format; +set @old_binlog_row_image=@@binlog_row_image; +set global log_bin_compress=on; +set global log_bin_compress_min_len=10; +drop table if exists t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1 (pr_id int(10) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, pr_page int(11) NOT NULL, pr_type varbinary(60) NOT NULL, test int, UNIQUE KEY pr_pagetype (pr_page,pr_type)) ENGINE=myisam AUTO_INCREMENT=136; +set binlog_format=statement; +insert into t1 (pr_page, pr_type, test) values(1,"one",0),(2,"two",0); +replace into t1 (pr_page, pr_type,test) values(1,"one",2); +update t1 set test=test+1 where pr_page > 1; +delete from t1 where test=1; +select * from t1; +pr_id pr_page pr_type test +138 1 one 2 +connection slave; +connection slave; +select * from t1; +pr_id pr_page pr_type test +138 1 one 2 +connection master; +set binlog_format=row; +insert into t1 (pr_page, pr_type, test) values(3,"three",0),(4,"four",4),(5, "five", 0); +replace into t1 (pr_page, pr_type,test) values(3,"one",2); +update t1 set test=test+1 where pr_page > 3; +delete from t1 where test=1; +select * from t1; +pr_id pr_page pr_type test +138 1 one 2 +140 4 four 5 +139 3 three 0 +142 3 one 2 +connection slave; +connection slave; +select * from t1; +pr_id pr_page pr_type test +138 1 one 2 +140 4 four 5 +139 3 three 0 +142 3 one 2 +connection master; +set binlog_row_image=minimal; +insert into t1 (pr_page, pr_type, test) values(6,"six",0),(7,"seven",7),(8, "eight", 0); +replace into t1 (pr_page, pr_type,test) values(6,"six",2); +update t1 set test=test+1 where pr_page > 6; +delete from t1 where test=1; +select * from t1; +pr_id pr_page pr_type test +138 1 one 2 +140 4 four 5 +139 3 three 0 +144 7 seven 8 +142 3 one 2 +146 6 six 2 +connection slave; +connection slave; +select * from t1; +pr_id pr_page pr_type test +138 1 one 2 +140 4 four 5 +139 3 three 0 +144 7 seven 8 +142 3 one 2 +146 6 six 2 +connection master; +drop table t1; +set global log_bin_compress=@old_log_bin_compress; +set global log_bin_compress_min_len=@old_log_bin_compress_min_len; +set binlog_format=@old_binlog_format; +set binlog_row_image=@old_binlog_row_image; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_binlog_errors.result b/mysql-test/suite/rpl/r/rpl_binlog_errors.result index 6c111eeaa3b..a54b84227e5 100644 --- a/mysql-test/suite/rpl/r/rpl_binlog_errors.result +++ b/mysql-test/suite/rpl/r/rpl_binlog_errors.result @@ -171,7 +171,7 @@ count(*) SET SQL_LOG_BIN=1; SET GLOBAL debug_dbug=@old_debug; ###################### TEST #10 -call mtr.add_suppression("MSYQL_BIN_LOG::open failed to sync the index file."); +call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file."); call mtr.add_suppression("Could not open .*"); RESET MASTER; SHOW WARNINGS; @@ -230,7 +230,7 @@ connection slave; call mtr.add_suppression("Slave I/O: Relay log write failure: could not queue event from master.*"); call mtr.add_suppression("Error writing file .*"); call mtr.add_suppression("Could not open .*"); -call mtr.add_suppression("MSYQL_BIN_LOG::open failed to sync the index file."); +call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file."); call mtr.add_suppression("Can't generate a unique log-filename .*"); ###################### TEST #13 SET @old_debug=@@global.debug; diff --git a/mysql-test/suite/rpl/r/rpl_checksum.result b/mysql-test/suite/rpl/r/rpl_checksum.result index 820224d99da..e74e5af9f84 100644 --- a/mysql-test/suite/rpl/r/rpl_checksum.result +++ b/mysql-test/suite/rpl/r/rpl_checksum.result @@ -79,7 +79,7 @@ connection slave; set @@global.debug_dbug='d,simulate_slave_unaware_checksum'; start slave; include/wait_for_slave_io_error.inc [errno=1236] -Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log; the first event 'master-bin.000009' at 368, the last event read from 'master-bin.000010' at 4, the last byte read from 'master-bin.000010' at 249.'' +Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log; the first event 'master-bin.000009' at 375, the last event read from 'master-bin.000010' at 4, the last byte read from 'master-bin.000010' at 256.'' select count(*) as zero from t1; zero 0 diff --git a/mysql-test/suite/rpl/r/rpl_default.result b/mysql-test/suite/rpl/r/rpl_default.result index a1629b99bb3..32e93a976ac 100644 --- a/mysql-test/suite/rpl/r/rpl_default.result +++ b/mysql-test/suite/rpl/r/rpl_default.result @@ -8,7 +8,7 @@ connection slave; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT (1+1), + `a` int(11) DEFAULT (1 + 1), `b` bigint(20) DEFAULT uuid_short(), `u` blob DEFAULT user() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 diff --git a/mysql-test/suite/rpl/r/rpl_delayed_slave,parallel.rdiff b/mysql-test/suite/rpl/r/rpl_delayed_slave,parallel.rdiff new file mode 100644 index 00000000000..aaadbb28ca3 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_delayed_slave,parallel.rdiff @@ -0,0 +1,17 @@ +--- mysql-test/suite/rpl/r/rpl_delayed_slave.result 2016-10-14 21:14:02.338075590 +0200 ++++ mysql-test/suite/rpl/r/rpl_delayed_slave,parallel.reject 2016-10-14 21:17:51.296986686 +0200 +@@ -45,7 +45,6 @@ + # wait for first query to execute + # sleep 1*T + # Asserted this: Second query executed +-# Asserted this: Status should be executing third query (i.e., 'User sleep') + # sleep 2*T + # Asserted this: Third query executed + # Asserted this: Status should be 'Has read all relay log...' +@@ -167,5 +166,5 @@ + conservative + SELECT @@GLOBAL.slave_parallel_threads; + @@GLOBAL.slave_parallel_threads +-0 ++10 + include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_delayed_slave.result b/mysql-test/suite/rpl/r/rpl_delayed_slave.result new file mode 100644 index 00000000000..bcfd49934b4 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_delayed_slave.result @@ -0,0 +1,192 @@ +include/master-slave.inc +[connection master] +call mtr.add_suppression("Unsafe statement written to the binary log using statement format"); +connection slave; +call mtr.add_suppression("Unsafe statement written to the binary log using statement format"); +connection master; +[on master] +CREATE TABLE t1 (a VARCHAR(100), b INT); +INSERT INTO t1 VALUES ("zero", 0); +==== Normal setup ==== +[on slave] +connection slave; +include/stop_slave.inc +# CHANGE MASTER TO MASTER_DELAY = 2*T +include/start_slave.inc +# Asserted this: SHOW SLAVE STATUS should return the same delay that we set with CHANGE MASTER +[on master] +connection master; +INSERT INTO t1 VALUES ('normal setup', 1); +connection master; +[on slave] +include/sync_slave_io_with_master.inc +# sleep 1*T +# Asserted this: Query 1 should not be executed +# Asserted this: Status should be 'Waiting until MASTER_DELAY...' +# sleep 1*T +# sync with master (with timeout 1*T) +include/wait_for_slave_param.inc [Relay_Master_Log_File] +include/wait_for_slave_param.inc [Exec_Master_Log_Pos] +# Asserted this: Query 1 should be executed +# Asserted this: Status should be 'Has read all relay log...' +include/check_slave_is_running.inc +==== Slave lags "naturally" after master ==== +[on master] +connection master; +# CREATE FUNCTION delay_on_slave(time_units INT) RETURNS INT BEGIN IF @@GLOBAL.server_id = 2 THEN RETURN SLEEP(time_units * T); ELSE RETURN 0; END IF; END +INSERT INTO t1 SELECT delay_on_slave(3), 2; +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave +INSERT INTO t1 VALUES ('slave is already lagging: this statement should execute immediately', 3); +INSERT INTO t1 SELECT delay_on_slave(2), 4; +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave +[on slave] +include/sync_slave_io_with_master.inc +# sleep 1*T +# Asserted this: No query executed +# Asserted this: Status should be 'Waiting until MASTER_DELAY...' +# wait for first query to execute +# sleep 1*T +# Asserted this: Second query executed +# Asserted this: Status should be executing third query (i.e., 'User sleep') +# sleep 2*T +# Asserted this: Third query executed +# Asserted this: Status should be 'Has read all relay log...' +==== Seconds_Behind_Master ==== +# Bring slave to sync. +include/stop_slave.inc +CHANGE MASTER TO MASTER_DELAY = 0; +include/start_slave.inc +connection master; +INSERT INTO t1 VALUES ('Syncing slave', 5); +connection slave; +include/stop_slave.inc +# CHANGE MASTER TO MASTER_DELAY = 2*T +include/start_slave.inc +connection master; +INSERT INTO t1 VALUES (delay_on_slave(1), 6); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave +connection slave; +# sleep 1*T +# Asserted this: Seconds_Behind_Master should be between 0 and the 2*T +# sleep 1*T +# Asserted this: Seconds_Behind_Master should be at least 2*T +==== STOP SLAVE / START SLAVE + DML ==== +include/stop_slave.inc +# CHANGE MASTER TO MASTER_DELAY = 3*T +include/start_slave.inc +[on master] +connection master; +INSERT INTO t1 VALUES ('stop slave and start slave: DML', 7); +[on slave] +connection slave; +# sleep 1*T +include/stop_slave.inc +# Asserted this: STOP SLAVE should finish quickly, not wait for the ongoing sleep to finish +# Asserted this: SQL thread position should not increase after STOP SLAVE +# Asserted this: Query should not be executed after STOP SLAVE +# Asserted this: Status should be '' after STOP SLAVE +include/start_slave.inc +# Asserted this: START SLAVE should finish quickly +connection master; +[on slave] +include/sync_slave_io_with_master.inc +# sleep 1*T +# Asserted this: Query 7 should not be executed +# Asserted this: Status should be 'Waiting until MASTER_DELAY...' +# sleep 1*T +# sync with master (with timeout 1*T) +include/wait_for_slave_param.inc [Relay_Master_Log_File] +include/wait_for_slave_param.inc [Exec_Master_Log_Pos] +# Asserted this: Query 7 should be executed +# Asserted this: Status should be 'Has read all relay log...' +include/check_slave_is_running.inc +==== STOP SLAVE / START SLAVE + DDL ==== +This verifies BUG#56442 +[on master] +connection master; +CREATE TABLE t_check_dml_not_executed_prematurely (a INT); +include/save_master_pos.inc +[on slave] +connection slave; +# sleep 1*T +include/stop_slave.inc +# Asserted this: STOP SLAVE should finish quickly, not wait for the ongoing sleep to finish +# Asserted this: SQL thread position should not increase after STOP SLAVE +# Asserted this: Query should not be executed after STOP SLAVE +# Asserted this: Status should be '' after STOP SLAVE +include/start_slave.inc +# Asserted this: START SLAVE should finish quickly +# sleep 1*T +# Asserted this: DDL Query should not be executed after START SLAVE +# Asserted this: Status should be 'Waiting until MASTER_DELAY...' +# sleep 1*T +# sync with master (with timeout 1*T) +include/wait_for_slave_param.inc [Relay_Master_Log_File] +include/wait_for_slave_param.inc [Exec_Master_Log_Pos] +# Asserted this: DDL Query should be executed +# Asserted this: Status should be 'Has read all relay log...' +include/check_slave_is_running.inc +==== Change back to no delay ==== +[on slave] +connection slave; +include/stop_slave.inc +CHANGE MASTER TO MASTER_DELAY = 0; +# Asserted this: Delay should be 0 when we set it to 0 +include/start_slave.inc +[on master] +connection master; +INSERT INTO t1 VALUES ('change back to no delay', 8); +[on slave] +include/sync_slave_io_with_master.inc +# sleep 1*T +# Asserted this: Query should be executed +# Asserted this: Status should be 'Slave has read all relay log...' +==== Reset delay with RESET SLAVE ==== +include/stop_slave.inc +CHANGE MASTER TO MASTER_DELAY = 71; +include/start_slave.inc +# Asserted this: Delay should be 71 when we set it to 71 +include/stop_slave.inc +RESET SLAVE; +[on master] +connection master; +RESET MASTER; +[on slave] +connection slave; +include/start_slave.inc +# Asserted this: Delay should be 0 after RESET SLAVE +==== Set an invalid value for the delay ==== +include/stop_slave.inc +# Expect error for setting negative delay +CHANGE MASTER TO MASTER_DELAY = -1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-1' at line 1 +# Expect that it's ok to set delay of 2^31-1 +CHANGE MASTER TO MASTER_DELAY = 2147483647; +# Expect error for setting delay between 2^31 and 2^32-1 +CHANGE MASTER TO MASTER_DELAY = 2147483648; +ERROR HY000: The requested value 2147483648 for the master delay exceeds the maximum 2147483647 +# Expect error for setting delay to nonsense +CHANGE MASTER TO MASTER_DELAY = blah; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'blah' at line 1 +CHANGE MASTER TO MASTER_DELAY = 0; +include/start_slave.inc +==== Clean up ==== +[on master] +connection master; +DROP TABLE t1, t_check_dml_not_executed_prematurely; +DROP FUNCTION delay_on_slave; +[on slave] +connection slave; +SELECT @@GLOBAL.slave_parallel_mode; +@@GLOBAL.slave_parallel_mode +conservative +SELECT @@GLOBAL.slave_parallel_threads; +@@GLOBAL.slave_parallel_threads +0 +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_delayed_slave2.result b/mysql-test/suite/rpl/r/rpl_delayed_slave2.result new file mode 100644 index 00000000000..998c7ab85b7 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_delayed_slave2.result @@ -0,0 +1,58 @@ +include/master-slave.inc +[connection master] +connection master; +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(100)); +INSERT INTO t1 VALUES (1, "a"); +connection slave; +include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=slave_pos; +SET @old_mode= @@GLOBAL.slave_parallel_mode; +SET GLOBAL slave_parallel_mode=optimistic; +SET @old_threads= @@GLOBAL.slave_parallel_threads; +SET GLOBAL slave_parallel_threads=10; +connection master; +INSERT INTO t1 VALUES (2, "b"); +INSERT INTO t1 VALUES (3, "b"); +INSERT INTO t1 VALUES (4, "b"); +SET timestamp= @@timestamp + 24*60*60; +INSERT INTO t1 VALUES (5, "c"); +INSERT INTO t1 VALUES (6, "c"); +SET timestamp= 0; +include/save_master_gtid.inc +connection slave; +CHANGE MASTER TO master_delay=1; +include/start_slave.inc +SELECT MASTER_GTID_WAIT('GTID1'); +MASTER_GTID_WAIT('GTID1') +0 +SELECT MASTER_GTID_WAIT('GTID2', 2); +MASTER_GTID_WAIT('GTID2', 2) +-1 +include/stop_slave.inc +SELECT * FROM t1 ORDER BY a; +a b +1 a +2 b +3 b +4 b +CHANGE MASTER TO master_delay=0; +include/start_slave.inc +include/sync_with_master_gtid.inc +SELECT * FROM t1 ORDER BY a; +a b +1 a +2 b +3 b +4 b +5 c +6 c +connection slave; +include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=no, master_delay=0; +SET GLOBAL slave_parallel_mode=@old_mode; +SET GLOBAL slave_parallel_threads=@old_threads; +include/start_slave.inc +connection master; +DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result b/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result index f4648160bbd..a07bac9340c 100644 --- a/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result @@ -662,8 +662,8 @@ t16 CREATE TABLE `t16` ( `c5` char(5) DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 4 */ + PARTITION BY KEY (c1) +PARTITIONS 4 *** Show table on Slave **** connection slave; SHOW CREATE TABLE t16; @@ -675,11 +675,11 @@ t16 CREATE TABLE `t16` ( `c4` blob DEFAULT NULL, `c5` char(5) DEFAULT NULL, `c6` int(11) DEFAULT 1, - `c7` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `c7` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 4 */ + PARTITION BY KEY (c1) +PARTITIONS 4 *** DROP TABLE t16 *** connection master; DROP TABLE t16; diff --git a/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result b/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result index f3863b27325..280afed0385 100644 --- a/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result @@ -662,8 +662,8 @@ t16 CREATE TABLE `t16` ( `c5` char(5) DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 4 */ + PARTITION BY KEY (c1) +PARTITIONS 4 *** Show table on Slave **** connection slave; SHOW CREATE TABLE t16; @@ -675,11 +675,11 @@ t16 CREATE TABLE `t16` ( `c4` blob DEFAULT NULL, `c5` char(5) DEFAULT NULL, `c6` int(11) DEFAULT 1, - `c7` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `c7` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`c1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (c1) -PARTITIONS 4 */ + PARTITION BY KEY (c1) +PARTITIONS 4 *** DROP TABLE t16 *** connection master; DROP TABLE t16; diff --git a/mysql-test/suite/rpl/r/rpl_incident.result b/mysql-test/suite/rpl/r/rpl_incident.result index 3917b5dcd92..8fb4aa907cc 100644 --- a/mysql-test/suite/rpl/r/rpl_incident.result +++ b/mysql-test/suite/rpl/r/rpl_incident.result @@ -1,8 +1,9 @@ include/master-slave.inc [connection master] -connection master; +SET @old_binlog_checksum=@@binlog_checksum; SET GLOBAL BINLOG_CHECKSUM=none; connection slave; +SET @old_binlog_checksum=@@binlog_checksum; SET GLOBAL BINLOG_CHECKSUM=none; connection master; **** On Master **** @@ -41,11 +42,8 @@ a 4 include/check_slave_is_running.inc connection master; +SET GLOBAL BINLOG_CHECKSUM=@old_binlog_checksum; DROP TABLE t1; connection slave; -connection master; -SET GLOBAL BINLOG_CHECKSUM=default; -connection slave; -SET GLOBAL BINLOG_CHECKSUM=default; -connection master; +SET GLOBAL BINLOG_CHECKSUM=@old_binlog_checksum; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result b/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result index 86607217019..eef77303c9a 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result @@ -114,14 +114,14 @@ show create table test.byrange_tbl; Table byrange_tbl Create Table CREATE TABLE `byrange_tbl` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` longblob DEFAULT NULL, `fkid` mediumint(9) DEFAULT NULL, `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1001 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (id) + PARTITION BY RANGE (id) SUBPARTITION BY HASH (id) SUBPARTITIONS 2 (PARTITION pa1 VALUES LESS THAN (10) ENGINE = InnoDB, @@ -134,7 +134,7 @@ SUBPARTITIONS 2 PARTITION pa8 VALUES LESS THAN (80) ENGINE = InnoDB, PARTITION pa9 VALUES LESS THAN (90) ENGINE = InnoDB, PARTITION pa10 VALUES LESS THAN (100) ENGINE = InnoDB, - PARTITION pa11 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION pa11 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT count(*) "Slave norm" FROM test.regular_tbl; Slave norm 500 SELECT count(*) "Slave bykey" FROM test.bykey_tbl; diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result index 1f140c3e2a5..35ba59730be 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result @@ -791,7 +791,7 @@ CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = 1; CREATE VIEW v2 AS SELECT * FROM t1 WHERE b <> UUID(); SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` where (`t1`.`a` = 1) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` where `t1`.`a` = 1 latin1 latin1_swedish_ci SELECT * FROM v1 ORDER BY a; a b 1 test1 @@ -799,7 +799,7 @@ connection slave; USE test_rpl; SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` where (`t1`.`a` = 1) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` where `t1`.`a` = 1 latin1 latin1_swedish_ci SELECT * FROM v1 ORDER BY a; a b 1 test1 @@ -807,7 +807,7 @@ connection master; ALTER VIEW v1 AS SELECT * FROM t1 WHERE a = 2; SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` where (`t1`.`a` = 2) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` where `t1`.`a` = 2 latin1 latin1_swedish_ci SELECT * FROM v1 ORDER BY a; a b 2 test2 @@ -815,7 +815,7 @@ connection slave; USE test_rpl; SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` where (`t1`.`a` = 2) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` where `t1`.`a` = 2 latin1 latin1_swedish_ci SELECT * FROM v1 ORDER BY a; a b 2 test2 diff --git a/mysql-test/suite/rpl/r/rpl_mdev10863.result b/mysql-test/suite/rpl/r/rpl_mdev10863.result new file mode 100644 index 00000000000..158d4a921b7 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_mdev10863.result @@ -0,0 +1,50 @@ +include/rpl_init.inc [topology=1->2] +connection server_2; +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +SET @old_max_relay= @@GLOBAL.max_relay_log_size; +SET GLOBAL max_relay_log_size = 4096; +CHANGE MASTER TO master_use_gtid=slave_pos; +include/start_slave.inc +connection server_1; +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t1 (a int PRIMARY KEY, b VARCHAR(100)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, "a"); +connection server_2; +*** Create a long transaction that will span a relay log file. *** +connection server_1; +SET @old_domain= @@gtid_domain_id; +SET gtid_domain_id=10; +INSERT INTO t1 VALUES (10000, "domain 10"); +SET gtid_domain_id=20; +INSERT INTO t1 VALUES (20000, "domain 20"); +SET gtid_domain_id=@old_domain; +BEGIN; +[lots of inserts omitted] +COMMIT; +connection server_2; +connection server_1; +BEGIN; +[lots of inserts omitted] +COMMIT; +connection server_2; +include/stop_slave_sql.inc +START SLAVE SQL_THREAD; +include/wait_for_slave_to_start.inc +connection server_1; +INSERT INTO t1 VALUES (100000, "More stuffs."); +INSERT INTO t1 VALUES (100001, "And even more"); +connection server_2; +SELECT * FROM t1 WHERE a >= 100000 ORDER BY a; +a b +100000 More stuffs. +100001 And even more +connection server_2; +include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +SET GLOBAL max_relay_log_size= @old_max_relay; +include/start_slave.inc +connection server_1; +DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_multi_engine.result b/mysql-test/suite/rpl/r/rpl_multi_engine.result index 075cbc14fe7..a000384909c 100644 --- a/mysql-test/suite/rpl/r/rpl_multi_engine.result +++ b/mysql-test/suite/rpl/r/rpl_multi_engine.result @@ -21,7 +21,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 connection slave; @@ -38,7 +38,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 connection master; @@ -80,7 +80,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 connection master; @@ -122,7 +122,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=MEMORY DEFAULT CHARSET=latin1 connection master; @@ -164,7 +164,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=MEMORY DEFAULT CHARSET=latin1 connection slave; @@ -181,7 +181,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 connection master; @@ -223,7 +223,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 connection master; @@ -265,7 +265,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=MEMORY DEFAULT CHARSET=latin1 connection master; @@ -307,7 +307,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 connection slave; @@ -324,7 +324,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 connection master; @@ -366,7 +366,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 connection master; @@ -408,7 +408,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=MEMORY DEFAULT CHARSET=latin1 connection master; diff --git a/mysql-test/suite/rpl/r/rpl_partition_archive.result b/mysql-test/suite/rpl/r/rpl_partition_archive.result index b2640d724e4..4dfd38bcbc6 100644 --- a/mysql-test/suite/rpl/r/rpl_partition_archive.result +++ b/mysql-test/suite/rpl/r/rpl_partition_archive.result @@ -62,9 +62,9 @@ byrange_tbl CREATE TABLE `byrange_tbl` ( `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=ARCHIVE AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (id) + PARTITION BY RANGE (id) (PARTITION pa100 VALUES LESS THAN (100) ENGINE = ARCHIVE, - PARTITION paMax VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE) */ + PARTITION paMax VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE) show create table test.regular_tbl; Table Create Table regular_tbl CREATE TABLE `regular_tbl` ( @@ -104,9 +104,9 @@ byrange_tbl CREATE TABLE `byrange_tbl` ( `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=ARCHIVE AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (id) + PARTITION BY RANGE (id) (PARTITION pa100 VALUES LESS THAN (100) ENGINE = ARCHIVE, - PARTITION paMax VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE) */ + PARTITION paMax VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE) show create table test.regular_tbl; Table Create Table regular_tbl CREATE TABLE `regular_tbl` ( diff --git a/mysql-test/suite/rpl/r/rpl_partition_innodb.result b/mysql-test/suite/rpl/r/rpl_partition_innodb.result index 382e09ac888..4657ed7dde5 100644 --- a/mysql-test/suite/rpl/r/rpl_partition_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_partition_innodb.result @@ -55,21 +55,21 @@ show create table test.byrange_tbl; Table Create Table byrange_tbl CREATE TABLE `byrange_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (id) + PARTITION BY RANGE (id) (PARTITION pa100 VALUES LESS THAN (100) ENGINE = InnoDB, - PARTITION paMax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION paMax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) show create table test.regular_tbl; Table Create Table regular_tbl CREATE TABLE `regular_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, @@ -99,21 +99,21 @@ show create table test.byrange_tbl; Table Create Table byrange_tbl CREATE TABLE `byrange_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (id) + PARTITION BY RANGE (id) (PARTITION pa100 VALUES LESS THAN (100) ENGINE = InnoDB, - PARTITION paMax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ + PARTITION paMax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) show create table test.regular_tbl; Table Create Table regular_tbl CREATE TABLE `regular_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, diff --git a/mysql-test/suite/rpl/r/rpl_partition_memory.result b/mysql-test/suite/rpl/r/rpl_partition_memory.result index 999f36fb47f..1d57c48ad78 100644 --- a/mysql-test/suite/rpl/r/rpl_partition_memory.result +++ b/mysql-test/suite/rpl/r/rpl_partition_memory.result @@ -55,21 +55,21 @@ show create table test.byrange_tbl; Table Create Table byrange_tbl CREATE TABLE `byrange_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MEMORY AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (id) + PARTITION BY RANGE (id) (PARTITION pa100 VALUES LESS THAN (100) ENGINE = MEMORY, - PARTITION paMax VALUES LESS THAN MAXVALUE ENGINE = MEMORY) */ + PARTITION paMax VALUES LESS THAN MAXVALUE ENGINE = MEMORY) show create table test.regular_tbl; Table Create Table regular_tbl CREATE TABLE `regular_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, @@ -99,21 +99,21 @@ show create table test.byrange_tbl; Table Create Table byrange_tbl CREATE TABLE `byrange_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MEMORY AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (id) + PARTITION BY RANGE (id) (PARTITION pa100 VALUES LESS THAN (100) ENGINE = MEMORY, - PARTITION paMax VALUES LESS THAN MAXVALUE ENGINE = MEMORY) */ + PARTITION paMax VALUES LESS THAN MAXVALUE ENGINE = MEMORY) show create table test.regular_tbl; Table Create Table regular_tbl CREATE TABLE `regular_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, diff --git a/mysql-test/suite/rpl/r/rpl_partition_myisam.result b/mysql-test/suite/rpl/r/rpl_partition_myisam.result index c760befed89..42ad10c8cf1 100644 --- a/mysql-test/suite/rpl/r/rpl_partition_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_partition_myisam.result @@ -55,21 +55,21 @@ show create table test.byrange_tbl; Table Create Table byrange_tbl CREATE TABLE `byrange_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (id) + PARTITION BY RANGE (id) (PARTITION pa100 VALUES LESS THAN (100) ENGINE = MyISAM, - PARTITION paMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION paMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) show create table test.regular_tbl; Table Create Table regular_tbl CREATE TABLE `regular_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, @@ -99,21 +99,21 @@ show create table test.byrange_tbl; Table Create Table byrange_tbl CREATE TABLE `byrange_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (id) + PARTITION BY RANGE (id) (PARTITION pa100 VALUES LESS THAN (100) ENGINE = MyISAM, - PARTITION paMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION paMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) show create table test.regular_tbl; Table Create Table regular_tbl CREATE TABLE `regular_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_8partition.result b/mysql-test/suite/rpl/r/rpl_row_basic_8partition.result index 37548cad4db..f2774d2fc62 100644 --- a/mysql-test/suite/rpl/r/rpl_row_basic_8partition.result +++ b/mysql-test/suite/rpl/r/rpl_row_basic_8partition.result @@ -28,13 +28,13 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (YEAR(t)) + PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, - PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) connection slave; SHOW CREATE TABLE t1; Table Create Table @@ -49,13 +49,13 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (YEAR(t)) + PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, - PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) connection master; "--- Insert into t1 --" as ""; --- Select from t1 on master --- @@ -116,13 +116,13 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (YEAR(t)) + PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, - PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) connection slave; SHOW CREATE TABLE t1; Table Create Table @@ -137,13 +137,13 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (YEAR(t)) + PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, - PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ + PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) connection master; "--- Insert into t1 --" as ""; --- Select from t1 on master --- @@ -213,10 +213,10 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (id) + PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, - PARTITION p2 VALUES IN (412) ENGINE = MyISAM) */ + PARTITION p2 VALUES IN (412) ENGINE = MyISAM) connection slave; SHOW CREATE TABLE t1; Table Create Table @@ -231,10 +231,10 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (id) + PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, - PARTITION p2 VALUES IN (412) ENGINE = MyISAM) */ + PARTITION p2 VALUES IN (412) ENGINE = MyISAM) connection master; "--- Insert into t1 --" as ""; --- Select from t1 on master --- @@ -295,10 +295,10 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (id) + PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, - PARTITION p2 VALUES IN (412) ENGINE = MyISAM) */ + PARTITION p2 VALUES IN (412) ENGINE = MyISAM) connection slave; SHOW CREATE TABLE t1; Table Create Table @@ -313,10 +313,10 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (id) + PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, - PARTITION p2 VALUES IN (412) ENGINE = MyISAM) */ + PARTITION p2 VALUES IN (412) ENGINE = MyISAM) connection master; "--- Insert into t1 --" as ""; --- Select from t1 on master --- @@ -384,8 +384,8 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH ( YEAR(t)) -PARTITIONS 4 */ + PARTITION BY HASH ( YEAR(t)) +PARTITIONS 4 connection slave; SHOW CREATE TABLE t1; Table Create Table @@ -400,8 +400,8 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH ( YEAR(t)) -PARTITIONS 4 */ + PARTITION BY HASH ( YEAR(t)) +PARTITIONS 4 connection master; "--- Insert into t1 --" as ""; --- Select from t1 on master --- @@ -461,8 +461,8 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH ( YEAR(t)) -PARTITIONS 4 */ + PARTITION BY HASH ( YEAR(t)) +PARTITIONS 4 connection slave; SHOW CREATE TABLE t1; Table Create Table @@ -477,8 +477,8 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH ( YEAR(t)) -PARTITIONS 4 */ + PARTITION BY HASH ( YEAR(t)) +PARTITIONS 4 connection master; "--- Insert into t1 --" as ""; --- Select from t1 on master --- @@ -547,8 +547,8 @@ t1 CREATE TABLE `t1` ( `t` date DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY () -PARTITIONS 4 */ + PARTITION BY KEY () +PARTITIONS 4 connection slave; SHOW CREATE TABLE t1; Table Create Table @@ -564,8 +564,8 @@ t1 CREATE TABLE `t1` ( `t` date DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY () -PARTITIONS 4 */ + PARTITION BY KEY () +PARTITIONS 4 connection master; "--- Insert into t1 --" as ""; --- Select from t1 on master --- @@ -627,8 +627,8 @@ t1 CREATE TABLE `t1` ( `t` date DEFAULT NULL, PRIMARY KEY (`id`,`total`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY () -PARTITIONS 4 */ + PARTITION BY KEY () +PARTITIONS 4 connection slave; SHOW CREATE TABLE t1; Table Create Table @@ -644,8 +644,8 @@ t1 CREATE TABLE `t1` ( `t` date DEFAULT NULL, PRIMARY KEY (`id`,`total`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY () -PARTITIONS 4 */ + PARTITION BY KEY () +PARTITIONS 4 connection master; "--- Insert into t1 --" as ""; --- Select from t1 on master --- @@ -707,8 +707,8 @@ t1 CREATE TABLE `t1` ( `t` date DEFAULT NULL, PRIMARY KEY (`id`,`total`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY () -PARTITIONS 4 */ + PARTITION BY KEY () +PARTITIONS 4 connection slave; SHOW CREATE TABLE t1; Table Create Table @@ -724,8 +724,8 @@ t1 CREATE TABLE `t1` ( `t` date DEFAULT NULL, PRIMARY KEY (`id`,`total`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY () -PARTITIONS 4 */ + PARTITION BY KEY () +PARTITIONS 4 connection master; "--- Insert into t1 --" as ""; --- Select from t1 on master --- diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result index 16827d45a8d..411a24278d5 100644 --- a/mysql-test/suite/rpl/r/rpl_sp.result +++ b/mysql-test/suite/rpl/r/rpl_sp.result @@ -279,7 +279,7 @@ connection master; delete from t2; alter table t2 add unique (a); Warnings: -Note 1831 Duplicate index 'a_2' defined on the table 'mysqltest1.t2'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a_2`. This is deprecated and will be disallowed in a future release drop function fn1; create function fn1(x int) returns int diff --git a/mysql-test/suite/rpl/r/rpl_stop_slave_error.result b/mysql-test/suite/rpl/r/rpl_stop_slave_error.result new file mode 100644 index 00000000000..956e53cf465 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_stop_slave_error.result @@ -0,0 +1,8 @@ +include/master-slave.inc +[connection master] +connection master; +connection slave; +include/stop_slave.inc +NOT FOUND /Error reading packet from server: Lost connection/ in slave_log.err +include/start_slave.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb.result b/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb.result index 41b3ca9d6fe..ac0a419b7e5 100644 --- a/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb.result +++ b/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb.result @@ -12,14 +12,14 @@ Table Create Table mysql050614_temporal0 CREATE TABLE `mysql050614_temporal0` ( `a` time DEFAULT NULL, `b` datetime DEFAULT NULL, - `c` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE TABLE mysql050614_temporal1; Table Create Table mysql050614_temporal1 CREATE TABLE `mysql050614_temporal1` ( `a` time(1) DEFAULT NULL, `b` datetime(1) DEFAULT NULL, - `c` timestamp(1) NOT NULL DEFAULT CURRENT_TIMESTAMP(1) ON UPDATE CURRENT_TIMESTAMP(1) + `c` timestamp(1) NOT NULL DEFAULT current_timestamp(1) ON UPDATE current_timestamp(1) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 connection slave; SELECT @@mysql56_temporal_format; diff --git a/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb53.result b/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb53.result index 2e3af3367ff..ace11d5bd6e 100644 --- a/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb53.result +++ b/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb53.result @@ -15,14 +15,14 @@ Table Create Table mysql050614_temporal0 CREATE TABLE `mysql050614_temporal0` ( `a` time DEFAULT NULL, `b` datetime DEFAULT NULL, - `c` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE TABLE mysql050614_temporal1; Table Create Table mysql050614_temporal1 CREATE TABLE `mysql050614_temporal1` ( `a` time(1) DEFAULT NULL, `b` datetime(1) DEFAULT NULL, - `c` timestamp(1) NOT NULL DEFAULT CURRENT_TIMESTAMP(1) ON UPDATE CURRENT_TIMESTAMP(1) + `c` timestamp(1) NOT NULL DEFAULT current_timestamp(1) ON UPDATE current_timestamp(1) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 connection slave; SELECT @@mysql56_temporal_format; diff --git a/mysql-test/suite/rpl/r/rpl_view.result b/mysql-test/suite/rpl/r/rpl_view.result index b6d9691f1d5..68a149720b0 100644 --- a/mysql-test/suite/rpl/r/rpl_view.result +++ b/mysql-test/suite/rpl/r/rpl_view.result @@ -125,11 +125,11 @@ CREATE TABLE t1 (a INT); /*!50002 WITH CASCADED CHECK OPTION */; SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` < 3) WITH CASCADED CHECK OPTION latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where `t1`.`a` < 3 WITH CASCADED CHECK OPTION latin1 latin1_swedish_ci connection slave; SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` < 3) WITH CASCADED CHECK OPTION latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where `t1`.`a` < 3 WITH CASCADED CHECK OPTION latin1 latin1_swedish_ci connection master; DROP VIEW v1; DROP TABLE t1; diff --git a/mysql-test/suite/rpl/t/rpl_alter_extra_persistent.test b/mysql-test/suite/rpl/t/rpl_alter_extra_persistent.test new file mode 100644 index 00000000000..3b2fff1cb13 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_alter_extra_persistent.test @@ -0,0 +1,106 @@ +--source include/master-slave.inc +--source include/have_binlog_format_row.inc + +--enable_connect_log +--connection master +create table t1(a int primary key); +insert into t1 values(1); +insert into t1 values(2); +insert into t1 values(3); +insert into t1 values(4); + +--sync_slave_with_master +select * from t1 order by a; +alter table t1 add column z1 int as(a+1) virtual, add column z2 int as (a+2) persistent; +select * from t1 order by a; + +--connection master +insert into t1 values(5); +insert into t1 values(6); + +--sync_slave_with_master +select * from t1 order by a; + + +--echo #UPDATE query + +--connection master +update t1 set a = a+10; +select * from t1 order by a; + +--sync_slave_with_master +select * from t1 order by a; + +--connection master +update t1 set a = a-10; +select * from t1 order by a; + +--sync_slave_with_master +select * from t1 order by a; + +--echo #DELETE quert +--connection master +delete from t1 where a > 2 and a < 4; +select * from t1 order by a; + +--sync_slave_with_master +select * from t1 order by a; + +--echo #REPLACE query +--connection master +replace into t1 values(1); +replace into t1 values(3); +replace into t1 values(1); + +--sync_slave_with_master +select * from t1 order by a; + +--echo #SELECT query +--connection master +select * from t1 where a > 2 and a < 4; + +--connection slave +select * from t1 where a > 2 and a < 4; + +--echo #UPDATE with SELECT query +--connection master +update t1 set a = a + 10 where a > 2 and a < 4; +select * from t1 order by a; + +--sync_slave_with_master +select * from t1 order by a; + +--connection master +update t1 set a = a - 10 where a = 13; +select * from t1 order by a; + +--sync_slave_with_master +select * from t1 order by a; + +--echo #Break Unique Constraint +alter table t1 add column z4 int as (a % 6) persistent unique; + +--connection master + +--echo #entering duplicate value for slave persistent column +insert into t1 values(7); +select * from t1 order by a; + +--connection slave +--let $slave_sql_errno= 1062 +--source include/wait_for_slave_sql_error.inc +select * from t1 order by a; +alter table t1 drop column z4; +start slave; + +--source include/wait_for_slave_sql_to_start.inc + +--connection master +--sync_slave_with_master +select * from t1 order by a; + +--connection master +select * from t1 order by a; +drop table t1; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_binlog_compress.test b/mysql-test/suite/rpl/t/rpl_binlog_compress.test new file mode 100644 index 00000000000..ef1e45084b6 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_binlog_compress.test @@ -0,0 +1,61 @@ +# +# Test of compressed binlog with replication +# + +source include/master-slave.inc; + +set @old_log_bin_compress=@@log_bin_compress; +set @old_log_bin_compress_min_len=@@log_bin_compress_min_len; +set @old_binlog_format=@@binlog_format; +set @old_binlog_row_image=@@binlog_row_image; + +set global log_bin_compress=on; +set global log_bin_compress_min_len=10; + +drop table if exists t1; +CREATE TABLE t1 (pr_id int(10) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, pr_page int(11) NOT NULL, pr_type varbinary(60) NOT NULL, test int, UNIQUE KEY pr_pagetype (pr_page,pr_type)) ENGINE=myisam AUTO_INCREMENT=136; + +set binlog_format=statement; +insert into t1 (pr_page, pr_type, test) values(1,"one",0),(2,"two",0); +replace into t1 (pr_page, pr_type,test) values(1,"one",2); +update t1 set test=test+1 where pr_page > 1; +delete from t1 where test=1; + +select * from t1; +sync_slave_with_master; +connection slave; +select * from t1; +connection master; + + +set binlog_format=row; +insert into t1 (pr_page, pr_type, test) values(3,"three",0),(4,"four",4),(5, "five", 0); +replace into t1 (pr_page, pr_type,test) values(3,"one",2); +update t1 set test=test+1 where pr_page > 3; +delete from t1 where test=1; + +select * from t1; +sync_slave_with_master; +connection slave; +select * from t1; +connection master; + + +set binlog_row_image=minimal; +insert into t1 (pr_page, pr_type, test) values(6,"six",0),(7,"seven",7),(8, "eight", 0); +replace into t1 (pr_page, pr_type,test) values(6,"six",2); +update t1 set test=test+1 where pr_page > 6; +delete from t1 where test=1; + +select * from t1; +sync_slave_with_master; +connection slave; +select * from t1; +connection master; +drop table t1; + +set global log_bin_compress=@old_log_bin_compress; +set global log_bin_compress_min_len=@old_log_bin_compress_min_len; +set binlog_format=@old_binlog_format; +set binlog_row_image=@old_binlog_row_image; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_binlog_errors.test b/mysql-test/suite/rpl/t/rpl_binlog_errors.test index 72de3a1ef37..6a2cf20d756 100644 --- a/mysql-test/suite/rpl/t/rpl_binlog_errors.test +++ b/mysql-test/suite/rpl/t/rpl_binlog_errors.test @@ -1,403 +1 @@ -# BUG#46166: MYSQL_BIN_LOG::new_file_impl is not propagating error -# when generating new name. -# -# WHY -# === -# -# We want to check whether error is reported or not when -# new_file_impl fails (this may happen when rotation is not -# possible because there is some problem finding an -# unique filename). -# -# HOW -# === -# -# Test cases are documented inline. - --- source include/have_innodb.inc --- source include/have_debug.inc --- source include/master-slave.inc - --- echo ####################################################################### --- echo ####################### PART 1: MASTER TESTS ########################## --- echo ####################################################################### - - -### ACTION: stopping slave as it is not needed for the first part of -### the test - --- connection slave --- source include/stop_slave.inc --- connection master - -call mtr.add_suppression("Can't generate a unique log-filename"); -call mtr.add_suppression("Writing one row to the row-based binary log failed.*"); -call mtr.add_suppression("Error writing file .*"); - -SET @old_debug= @@global.debug; - -### ACTION: create a large file (> 4096 bytes) that will be later used -### in LOAD DATA INFILE to check binlog errors in its vacinity --- let $load_file= $MYSQLTEST_VARDIR/tmp/bug_46166.data --- let $MYSQLD_DATADIR= `select @@datadir` --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- eval SELECT repeat('x',8192) INTO OUTFILE '$load_file' - -### ACTION: create a small file (< 4096 bytes) that will be later used -### in LOAD DATA INFILE to check for absence of binlog errors -### when file loading this file does not force flushing and -### rotating the binary log --- let $load_file2= $MYSQLTEST_VARDIR/tmp/bug_46166-2.data --- let $MYSQLD_DATADIR= `select @@datadir` --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- eval SELECT repeat('x',10) INTO OUTFILE '$load_file2' - -RESET MASTER; - --- echo ###################### TEST #1 - -### ASSERTION: no problem flushing logs (should show two binlogs) -FLUSH LOGS; --- echo # assert: must show two binlogs --- source include/show_binary_logs.inc - --- echo ###################### TEST #2 - -### ASSERTION: check that FLUSH LOGS actually fails and reports -### failure back to the user if find_uniq_filename fails -### (should show just one binlog) - -RESET MASTER; -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; --- error ER_NO_UNIQUE_LOGFILE -FLUSH LOGS; --- echo # assert: must show one binlog --- source include/show_binary_logs.inc - -### ACTION: clean up and move to next test -SET GLOBAL debug_dbug=@old_debug; -RESET MASTER; - --- echo ###################### TEST #3 - -### ACTION: create some tables (t1, t2, t4) and insert some values in -### table t1 -CREATE TABLE t1 (a INT); -CREATE TABLE t2 (a VARCHAR(16384)) Engine=InnoDB; -CREATE TABLE t4 (a VARCHAR(16384)); -INSERT INTO t1 VALUES (1); -RESET MASTER; - -### ASSERTION: we force rotation of the binary log because it exceeds -### the max_binlog_size option (should show two binary -### logs) - --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 - -# shows two binary logs --- echo # assert: must show two binlog --- source include/show_binary_logs.inc - -# clean up the table and the binlog to be used in next part of test -SET GLOBAL debug_dbug=@old_debug; -DELETE FROM t2; -RESET MASTER; - --- echo ###################### TEST #4 - -### ASSERTION: load the big file into a transactional table and check -### that it reports error. The table will contain the -### changes performed despite the fact that it reported an -### error. - -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- error ER_NO_UNIQUE_LOGFILE --- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 - -# show table --- echo # assert: must show one entry -SELECT count(*) FROM t2; - -# clean up the table and the binlog to be used in next part of test -SET GLOBAL debug_dbug=@old_debug; -DELETE FROM t2; -RESET MASTER; - --- echo ###################### TEST #5 - -### ASSERTION: load the small file into a transactional table and -### check that it succeeds - -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- eval LOAD DATA INFILE '$load_file2' INTO TABLE t2 - -# show table --- echo # assert: must show one entry -SELECT count(*) FROM t2; - -# clean up the table and the binlog to be used in next part of test -SET GLOBAL debug_dbug=@old_debug; -DELETE FROM t2; -RESET MASTER; - --- echo ###################### TEST #6 - -### ASSERTION: check that even if one is using a transactional table -### and explicit transactions (no autocommit) if rotation -### fails we get the error. Transaction is not rolledback -### because rotation happens after the commit. - -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; -SET AUTOCOMMIT=0; -INSERT INTO t2 VALUES ('muse'); --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 -INSERT INTO t2 VALUES ('muse'); --- error ER_NO_UNIQUE_LOGFILE -COMMIT; - -### ACTION: Show the contents of the table after the test --- echo # assert: must show three entries -SELECT count(*) FROM t2; - -### ACTION: clean up and move to the next test -SET AUTOCOMMIT= 1; -SET GLOBAL debug_dbug=@old_debug; -DELETE FROM t2; -RESET MASTER; - --- echo ###################### TEST #7 - -### ASSERTION: check that on a non-transactional table, if rotation -### fails then an error is reported and an incident event -### is written to the current binary log. - -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; -SELECT count(*) FROM t4; --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- error ER_NO_UNIQUE_LOGFILE --- eval LOAD DATA INFILE '$load_file' INTO TABLE t4 - --- echo # assert: must show 1 entry -SELECT count(*) FROM t4; - --- echo ### check that the incident event is written to the current log -SET GLOBAL debug_dbug=@old_debug; --- let $binlog_limit= 4,1 --- source include/show_binlog_events.inc - -# clean up and move to next test -DELETE FROM t4; -RESET MASTER; - --- echo ###################### TEST #8 - -### ASSERTION: check that statements end up in error but they succeed -### on changing the data. - -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; --- echo # must show 0 entries -SELECT count(*) FROM t4; -SELECT count(*) FROM t2; - --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- error ER_NO_UNIQUE_LOGFILE --- eval LOAD DATA INFILE '$load_file' INTO TABLE t4 --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- error ER_NO_UNIQUE_LOGFILE --- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 --- error ER_NO_UNIQUE_LOGFILE -INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'); - --- echo # INFO: Count(*) Before Offending DELETEs --- echo # assert: must show 1 entry -SELECT count(*) FROM t4; --- echo # assert: must show 4 entries -SELECT count(*) FROM t2; - --- error ER_NO_UNIQUE_LOGFILE -DELETE FROM t4; --- error ER_NO_UNIQUE_LOGFILE -DELETE FROM t2; - --- echo # INFO: Count(*) After Offending DELETEs --- echo # assert: must show zero entries -SELECT count(*) FROM t4; -SELECT count(*) FROM t2; - -# remove fault injection -SET GLOBAL debug_dbug=@old_debug; - --- echo ###################### TEST #9 - -### ASSERTION: check that if we disable binlogging, then statements -### succeed. -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; -SET SQL_LOG_BIN=0; -INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd'); -INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh'); --- echo # assert: must show four entries -SELECT count(*) FROM t2; -SELECT count(*) FROM t4; -DELETE FROM t2; -DELETE FROM t4; --- echo # assert: must show zero entries -SELECT count(*) FROM t2; -SELECT count(*) FROM t4; -SET SQL_LOG_BIN=1; -SET GLOBAL debug_dbug=@old_debug; - --- echo ###################### TEST #10 - -### ASSERTION: check that error is reported if there is a failure -### while registering the index file and the binary log -### file or failure to write the rotate event. - -call mtr.add_suppression("MSYQL_BIN_LOG::open failed to sync the index file."); -call mtr.add_suppression("Could not open .*"); - -RESET MASTER; -SHOW WARNINGS; - -# +d,fault_injection_registering_index => injects fault on MYSQL_BIN_LOG::open -SET GLOBAL debug_dbug="+d,fault_injection_registering_index"; --- replace_regex /\.[\\\/]master/master/ --- error ER_CANT_OPEN_FILE -FLUSH LOGS; -SET GLOBAL debug_dbug="-d,fault_injection_registering_index"; - --- error ER_NO_BINARY_LOGGING -SHOW BINARY LOGS; - -# issue some statements and check that they don't fail -CREATE TABLE t5 (a INT); -INSERT INTO t4 VALUES ('bbbbb'); -INSERT INTO t2 VALUES ('aaaaa'); -DELETE FROM t4; -DELETE FROM t2; -DROP TABLE t5; - --- echo ###################### TEST #11 - -### ASSERTION: check that error is reported if there is a failure -### while opening the index file and the binary log file or -### failure to write the rotate event. - -# restart the server so that we have binlog again ---let $rpl_server_number= 1 ---source include/rpl_restart_server.inc - -# +d,fault_injection_openning_index => injects fault on MYSQL_BIN_LOG::open_index_file -SET GLOBAL debug_dbug="+d,fault_injection_openning_index"; --- replace_regex /\.[\\\/]master/master/ --- error ER_CANT_OPEN_FILE -FLUSH LOGS; -SET GLOBAL debug_dbug="-d,fault_injection_openning_index"; - --- error ER_FLUSH_MASTER_BINLOG_CLOSED -RESET MASTER; - -# issue some statements and check that they don't fail -CREATE TABLE t5 (a INT); -INSERT INTO t4 VALUES ('bbbbb'); -INSERT INTO t2 VALUES ('aaaaa'); -DELETE FROM t4; -DELETE FROM t2; -DROP TABLE t5; - -# restart the server so that we have binlog again ---let $rpl_server_number= 1 ---source include/rpl_restart_server.inc - --- echo ###################### TEST #12 - -### ASSERTION: check that error is reported if there is a failure -### while writing the rotate event when creating a new log -### file. - -# +d,fault_injection_new_file_rotate_event => injects fault on MYSQL_BIN_LOG::MYSQL_BIN_LOG::new_file_impl -SET GLOBAL debug_dbug="+d,fault_injection_new_file_rotate_event"; --- error ER_ERROR_ON_WRITE -FLUSH LOGS; -SET GLOBAL debug_dbug="-d,fault_injection_new_file_rotate_event"; - --- error ER_FLUSH_MASTER_BINLOG_CLOSED -RESET MASTER; - -# issue some statements and check that they don't fail -CREATE TABLE t5 (a INT); -INSERT INTO t4 VALUES ('bbbbb'); -INSERT INTO t2 VALUES ('aaaaa'); -DELETE FROM t4; -DELETE FROM t2; -DROP TABLE t5; - -# restart the server so that we have binlog again ---let $rpl_server_number= 1 ---source include/rpl_restart_server.inc - -## clean up -DROP TABLE t1, t2, t4; -RESET MASTER; - -# restart slave again --- connection slave --- source include/start_slave.inc --- connection master - --- echo ####################################################################### --- echo ####################### PART 2: SLAVE TESTS ########################### --- echo ####################################################################### - -### setup ---source include/rpl_reset.inc --- connection slave - -# slave suppressions - -call mtr.add_suppression("Slave I/O: Relay log write failure: could not queue event from master.*"); -call mtr.add_suppression("Error writing file .*"); -call mtr.add_suppression("Could not open .*"); -call mtr.add_suppression("MSYQL_BIN_LOG::open failed to sync the index file."); -call mtr.add_suppression("Can't generate a unique log-filename .*"); --- echo ###################### TEST #13 - -#### ASSERTION: check against unique log filename error --- let $io_thd_injection_fault_flag= error_unique_log_filename --- let $slave_io_errno= 1595 --- let $show_slave_io_error= 1 --- source include/io_thd_fault_injection.inc - --- echo ###################### TEST #14 - -#### ASSERTION: check against rotate failing --- let $io_thd_injection_fault_flag= fault_injection_new_file_rotate_event --- let $slave_io_errno= 1595 --- let $show_slave_io_error= 1 --- source include/io_thd_fault_injection.inc - --- echo ###################### TEST #15 - -#### ASSERTION: check against relay log open failure --- let $io_thd_injection_fault_flag= fault_injection_registering_index --- let $slave_io_errno= 1595 --- let $show_slave_io_error= 1 --- source include/io_thd_fault_injection.inc - --- echo ###################### TEST #16 - -#### ASSERTION: check against relay log index open failure --- let $io_thd_injection_fault_flag= fault_injection_openning_index --- let $slave_io_errno= 1595 --- let $show_slave_io_error= 1 --- source include/io_thd_fault_injection.inc - -### clean up --- source include/stop_slave_sql.inc -RESET SLAVE; -RESET MASTER; ---let $rpl_only_running_threads= 1 ---source include/rpl_end.inc +--source extra/rpl_tests/rpl_binlog_errors.inc diff --git a/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test b/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test index a97801f9ab0..6d222cba115 100644 --- a/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test +++ b/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test @@ -1,77 +1 @@ -# -# Bug#11747416 : 32228 A disk full makes binary log corrupt. -# -# -# The test demonstrates reading from binlog error propagation to slave -# and reporting there. -# Conditions for the bug include a crash at time of the last event to -# the binlog was written partly. With the fixes the event is not sent out -# any longer, but rather the dump thread sends out a sound error message. -# -# Crash is not simulated. A binlog with partly written event in its end is installed -# and replication is started from it. -# - ---source include/master-slave.inc ---source include/have_binlog_format_mixed.inc - ---connection slave -# Make sure the slave is stopped while we are messing with master. -# Otherwise we get occasional failures as the slave manages to re-connect -# to the newly started master and we get extra events applied, causing -# conflicts. ---source include/stop_slave.inc - ---connection master -call mtr.add_suppression("Error in Log_event::read_log_event()"); ---let $datadir= `SELECT @@datadir` - ---let $rpl_server_number= 1 ---source include/rpl_stop_server.inc - ---remove_file $datadir/master-bin.000001 ---copy_file $MYSQL_TEST_DIR/std_data/bug11747416_32228_binlog.000001 $datadir/master-bin.000001 - ---let $rpl_server_number= 1 ---source include/rpl_start_server.inc - ---source include/wait_until_connected_again.inc - -# evidence of the partial binlog ---error ER_ERROR_WHEN_EXECUTING_COMMAND -show binlog events; - ---connection slave -call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log"); -reset slave; -start slave; - -# ER_MASTER_FATAL_ERROR_READING_BINLOG 1236 ---let $slave_param=Last_IO_Errno ---let $slave_param_value=1236 ---source include/wait_for_slave_param.inc - ---let $slave_field_result_replace= / at [0-9]*/ at XXX/ ---let $status_items= Last_IO_Errno, Last_IO_Error ---source include/show_slave_status.inc - -# -# Cleanup -# - ---connection master -reset master; - ---connection slave -stop slave; -reset slave; -# Table was created from binlog, it may not be created if SQL thread is running -# slowly and IO thread reaches incident before SQL thread applies it. ---disable_warnings -drop table if exists t; ---enable_warnings -reset master; - ---echo End of the tests ---let $rpl_only_running_threads= 1 ---source include/rpl_end.inc +--source extra/rpl_tests/rpl_cant_read_event_incident.inc diff --git a/mysql-test/suite/rpl/t/rpl_checksum.test b/mysql-test/suite/rpl/t/rpl_checksum.test index 50b6e712b90..8e006b1b6a0 100644 --- a/mysql-test/suite/rpl/t/rpl_checksum.test +++ b/mysql-test/suite/rpl/t/rpl_checksum.test @@ -1,327 +1 @@ -# WL2540 replication events checksum -# Testing configuration parameters - ---source include/master-slave.inc ---source include/have_debug.inc ---source include/have_binlog_format_mixed.inc - -call mtr.add_suppression('Slave can not handle replication events with the checksum that master is configured to log'); -call mtr.add_suppression('Replication event checksum verification failed'); -# due to C failure simulation -call mtr.add_suppression('Relay log write failure: could not queue event from master'); -call mtr.add_suppression('Master is configured to log replication events with checksum, but will not send such events to slaves that cannot process them'); - -# A. read/write access to the global vars: -# binlog_checksum master_verify_checksum slave_sql_verify_checksum - -connection master; - -set @master_save_binlog_checksum= @@global.binlog_checksum; -set @save_master_verify_checksum = @@global.master_verify_checksum; - -select @@global.binlog_checksum as 'must be CRC32 because of the command line option'; ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -select @@session.binlog_checksum as 'no session var'; - -select @@global.master_verify_checksum as 'must be zero because of default'; ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -select @@session.master_verify_checksum as 'no session var'; - -connection slave; - -set @slave_save_binlog_checksum= @@global.binlog_checksum; -set @save_slave_sql_verify_checksum = @@global.slave_sql_verify_checksum; - -select @@global.slave_sql_verify_checksum as 'must be one because of default'; ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -select @@session.slave_sql_verify_checksum as 'no session var'; - -connection master; - -source include/show_binary_logs.inc; -set @@global.binlog_checksum = NONE; -select @@global.binlog_checksum; ---echo *** must be rotations seen *** -source include/show_binary_logs.inc; - -set @@global.binlog_checksum = default; -select @@global.binlog_checksum; - -# testing lack of side-effects in non-effective update of binlog_checksum: -set @@global.binlog_checksum = CRC32; -select @@global.binlog_checksum; -set @@global.binlog_checksum = CRC32; - -set @@global.master_verify_checksum = 0; -set @@global.master_verify_checksum = default; - ---error ER_WRONG_VALUE_FOR_VAR -set @@global.binlog_checksum = ADLER32; ---error ER_WRONG_VALUE_FOR_VAR -set @@global.master_verify_checksum = 2; # the var is of bool type - -connection slave; - -set @@global.slave_sql_verify_checksum = 0; -set @@global.slave_sql_verify_checksum = default; ---error ER_WRONG_VALUE_FOR_VAR -set @@global.slave_sql_verify_checksum = 2; # the var is of bool type - -# -# B. Old Slave to New master conditions -# -# while master does not send a checksum-ed binlog the Old Slave can -# work with the New Master - -connection master; - -set @@global.binlog_checksum = NONE; -create table t1 (a int); - -# testing that binlog rotation preserves opt_binlog_checksum value -flush logs; -flush logs; -flush logs; - -sync_slave_with_master; -#connection slave; -# checking that rotation on the slave side leaves slave stable -flush logs; -flush logs; -flush logs; -select count(*) as zero from t1; - -source include/stop_slave.inc; - -connection master; -set @@global.binlog_checksum = CRC32; --- source include/wait_for_binlog_checkpoint.inc -insert into t1 values (1) /* will not be applied on slave due to simulation */; - -# instruction to the dump thread - -connection slave; -set @@global.debug_dbug='d,simulate_slave_unaware_checksum'; -start slave; ---let $slave_io_errno= 1236 ---let $show_slave_io_error= 1 -source include/wait_for_slave_io_error.inc; - -select count(*) as zero from t1; - -###connection master; -set @@global.debug_dbug=''; - -connection slave; -source include/start_slave.inc; - -# -# C. checksum failure simulations -# - -# C1. Failure by a client thread -connection master; -set @@global.master_verify_checksum = 1; -set @@session.debug_dbug='d,simulate_checksum_test_failure'; ---error ER_ERROR_WHEN_EXECUTING_COMMAND -show binlog events; -set @@session.debug_dbug=''; -set @@global.master_verify_checksum = default; - -#connection master; -sync_slave_with_master; - -connection slave; -source include/stop_slave.inc; - -connection master; -create table t2 (a int); -let $pos_master= query_get_value(SHOW MASTER STATUS, Position, 1); - -connection slave; - -# C2. Failure by IO thread -# instruction to io thread -set @@global.debug_dbug='d,simulate_checksum_test_failure'; -start slave io_thread; -# When the checksum error is detected, the slave sets error code 1913 -# (ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE) in queue_event(), then immediately -# sets error 1595 (ER_SLAVE_RELAY_LOG_WRITE_FAILURE) in handle_slave_io(). -# So we usually get 1595, but it is occasionally possible to get 1913. ---let $slave_io_errno= 1595,1913 ---let $show_slave_io_error= 0 -source include/wait_for_slave_io_error.inc; -set @@global.debug_dbug=''; - -# to make IO thread re-read it again w/o the failure -start slave io_thread; -let $slave_param= Read_Master_Log_Pos; -let $slave_param_value= $pos_master; -source include/wait_for_slave_param.inc; - -# C3. Failure by SQL thread -# instruction to sql thread; -set @@global.slave_sql_verify_checksum = 1; - -set @@global.debug_dbug='d,simulate_checksum_test_failure'; - -start slave sql_thread; ---let $slave_sql_errno= 1593 ---let $show_slave_sql_error= 1 -source include/wait_for_slave_sql_error.inc; - -# resuming SQL thread to parse out the event w/o the failure - -set @@global.debug_dbug=''; -source include/start_slave.inc; - -connection master; -sync_slave_with_master; - -#connection slave; -select count(*) as 'must be zero' from t2; - -# -# D. Reset slave, Change-Master, Binlog & Relay-log rotations with -# random value on binlog_checksum on both master and slave -# -connection slave; -stop slave; -reset slave; - -# randomize slave server's own checksum policy -set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE"); -flush logs; - -connection master; -set @@global.binlog_checksum= CRC32; -reset master; -flush logs; -create table t3 (a int, b char(5)); - -connection slave; -source include/start_slave.inc; - -connection master; -sync_slave_with_master; - -#connection slave; -select count(*) as 'must be zero' from t3; -source include/stop_slave.inc; ---replace_result $MASTER_MYPORT MASTER_PORT -eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root'; - -connection master; -flush logs; -reset master; -insert into t3 value (1, @@global.binlog_checksum); - -connection slave; -source include/start_slave.inc; -flush logs; - -connection master; -sync_slave_with_master; - -#connection slave; -select count(*) as 'must be one' from t3; - -connection master; -set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE"); -insert into t3 value (1, @@global.binlog_checksum); -sync_slave_with_master; - -#connection slave; - -#clean-up - -connection master; -drop table t1, t2, t3; -set @@global.binlog_checksum = @master_save_binlog_checksum; -set @@global.master_verify_checksum = @save_master_verify_checksum; - -# -# BUG#58564: flush_read_lock fails in mysql-trunk-bugfixing after merging with WL#2540 -# -# Sanity check that verifies that no assertions are triggered because -# of old FD events (generated by versions prior to server released with -# checksums feature) -# -# There is no need for query log, if something wrong this should trigger -# an assertion - ---disable_query_log - -BINLOG ' -MfmqTA8BAAAAZwAAAGsAAAABAAQANS41LjctbTMtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAx+apMEzgNAAgAEgAEBAQEEgAAVAAEGggAAAAICAgCAA== -'; - ---enable_query_log - -#connection slave; -sync_slave_with_master; - - ---echo *** Bug#59123 / MDEV-5799: INCIDENT_EVENT checksum written to error log as garbage characters *** - ---connection master - ---source include/wait_for_binlog_checkpoint.inc -CREATE TABLE t4 (a INT PRIMARY KEY); -INSERT INTO t4 VALUES (1); - -SET sql_log_bin=0; -CALL mtr.add_suppression("\\[ERROR\\] Can't generate a unique log-filename"); -SET sql_log_bin=1; -SET @old_dbug= @@GLOBAL.debug_dbug; -SET debug_dbug= '+d,binlog_inject_new_name_error'; ---error ER_NO_UNIQUE_LOGFILE -FLUSH LOGS; -SET debug_dbug= @old_dbug; - -INSERT INTO t4 VALUES (2); - ---connection slave ---let $slave_sql_errno= 1590 ---source include/wait_for_slave_sql_error.inc - -# Search the error log for the error message. -# The bug was that 4 garbage bytes were output in the middle of the error -# message; by searching for a pattern that spans that location, we can -# catch the error. -let $log_error_= `SELECT @@GLOBAL.log_error`; -if(!$log_error_) -{ - # MySQL Server on windows is started with --console and thus - # does not know the location of its .err log, use default location - let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.2.err; -} ---let SEARCH_FILE= $log_error_ ---let SEARCH_RANGE=-50000 ---let SEARCH_PATTERN= Slave SQL: The incident LOST_EVENTS occurred on the master\. Message: error writing to the binary log, Internal MariaDB error code: 1590 ---source include/search_pattern_in_file.inc - -SELECT * FROM t4 ORDER BY a; -STOP SLAVE IO_THREAD; -SET sql_slave_skip_counter= 1; ---source include/start_slave.inc - ---connection master ---save_master_pos - ---connection slave ---sync_with_master -SELECT * FROM t4 ORDER BY a; - - ---connection slave -set @@global.binlog_checksum = @slave_save_binlog_checksum; -set @@global.slave_sql_verify_checksum = @save_slave_sql_verify_checksum; - ---echo End of tests - ---connection master -DROP TABLE t4; - ---source include/rpl_end.inc +--source extra/rpl_tests/rpl_checksum.inc diff --git a/mysql-test/suite/rpl/t/rpl_checksum_cache.test b/mysql-test/suite/rpl/t/rpl_checksum_cache.test index 5667d599aff..56c3e1e1cb5 100644 --- a/mysql-test/suite/rpl/t/rpl_checksum_cache.test +++ b/mysql-test/suite/rpl/t/rpl_checksum_cache.test @@ -1,255 +1 @@ --- source include/have_innodb.inc --- source include/master-slave.inc - ---disable_warnings -call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. Statement: insert into t2 set data=repeat.*'a', @act_size.*"); -call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. Statement: insert into t1 values.* NAME_CONST.*'n',.*, @data .*"); ---enable_warnings - -connection master; -set @save_binlog_cache_size = @@global.binlog_cache_size; -set @save_binlog_checksum = @@global.binlog_checksum; -set @save_master_verify_checksum = @@global.master_verify_checksum; -set @@global.binlog_cache_size = 4096; -set @@global.binlog_checksum = CRC32; -set @@global.master_verify_checksum = 1; - -# restart slave to force the dump thread to verify events (on master side) -connection slave; -source include/stop_slave.inc; -source include/start_slave.inc; - -connection master; - -# -# Testing a critical part of checksum handling dealing with transaction cache. -# The cache's buffer size is set to be less than the transaction's footprint -# in binlog. -# -# To verify combined buffer-by-buffer read out of the file and fixing crc per event -# there are the following parts: -# -# 1. the event size is much less than the cache's buffer -# 2. the event size is bigger than the cache's buffer -# 3. the event size if approximately the same as the cache's buffer -# 4. all in above - -# -# 1. the event size is much less than the cache's buffer -# - -flush status; -show status like "binlog_cache_use"; -show status like "binlog_cache_disk_use"; ---disable_warnings -drop table if exists t1; ---enable_warnings - -# -# parameter to ensure the test slightly varies binlog content -# between different invocations -# -let $deviation_size=32; -eval create table t1 (a int PRIMARY KEY, b CHAR($deviation_size)) engine=innodb; - -# Now we are going to create transaction which is long enough so its -# transaction binlog will be flushed to disk... - -delimiter |; -create procedure test.p_init (n int, size int) -begin - while n > 0 do - select round(RAND() * size) into @act_size; - set @data = repeat('a', @act_size); - insert into t1 values(n, @data ); - set n= n-1; - end while; -end| - -delimiter ;| - -let $1 = 4000; # PB2 can run it slow to time out on following sync_slave_with_master:s - -begin; ---disable_warnings -# todo: check if it is really so. -#+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -eval call test.p_init($1, $deviation_size); ---enable_warnings -commit; - -show status like "binlog_cache_use"; ---echo *** binlog_cache_disk_use must be non-zero *** -show status like "binlog_cache_disk_use"; - -sync_slave_with_master; - -let $diff_tables=master:test.t1, slave:test.t1; -source include/diff_tables.inc; - -# undoing changes with verifying the above once again -connection master; - -begin; -delete from t1; -commit; - -sync_slave_with_master; - - -# -# 2. the event size is bigger than the cache's buffer -# -connection master; - -flush status; -let $t2_data_size= `select 3 * @@global.binlog_cache_size`; -let $t2_aver_size= `select 2 * @@global.binlog_cache_size`; -let $t2_max_rand= `select 1 * @@global.binlog_cache_size`; - -eval create table t2(a int auto_increment primary key, data VARCHAR($t2_data_size)) ENGINE=Innodb; -let $1=100; ---disable_query_log -begin; -while ($1) -{ - eval select round($t2_aver_size + RAND() * $t2_max_rand) into @act_size; - set @data = repeat('a', @act_size); - insert into t2 set data = @data; - dec $1; -} -commit; ---enable_query_log -show status like "binlog_cache_use"; ---echo *** binlog_cache_disk_use must be non-zero *** -show status like "binlog_cache_disk_use"; - -sync_slave_with_master; - -let $diff_tables=master:test.t2, slave:test.t2; -source include/diff_tables.inc; - -# undoing changes with verifying the above once again -connection master; - -begin; -delete from t2; -commit; - -sync_slave_with_master; - -# -# 3. the event size if approximately the same as the cache's buffer -# - -connection master; - -flush status; -let $t3_data_size= `select 2 * @@global.binlog_cache_size`; -let $t3_aver_size= `select (9 * @@global.binlog_cache_size) / 10`; -let $t3_max_rand= `select (2 * @@global.binlog_cache_size) / 10`; - -eval create table t3(a int auto_increment primary key, data VARCHAR($t3_data_size)) engine=innodb; - -let $1= 300; ---disable_query_log -begin; -while ($1) -{ - eval select round($t3_aver_size + RAND() * $t3_max_rand) into @act_size; - insert into t3 set data= repeat('a', @act_size); - dec $1; -} -commit; ---enable_query_log -show status like "binlog_cache_use"; ---echo *** binlog_cache_disk_use must be non-zero *** -show status like "binlog_cache_disk_use"; - -sync_slave_with_master; - -let $diff_tables=master:test.t3, slave:test.t3; -source include/diff_tables.inc; - -# undoing changes with verifying the above once again -connection master; - -begin; -delete from t3; -commit; - -sync_slave_with_master; - - -# -# 4. all in above -# - -connection master; -flush status; - -delimiter |; -eval create procedure test.p1 (n int) -begin - while n > 0 do - case (select (round(rand()*100) % 3) + 1) - when 1 then - select round(RAND() * $deviation_size) into @act_size; - set @data = repeat('a', @act_size); - insert into t1 values(n, @data); - when 2 then - begin - select round($t2_aver_size + RAND() * $t2_max_rand) into @act_size; - insert into t2 set data=repeat('a', @act_size); - end; - when 3 then - begin - select round($t3_aver_size + RAND() * $t3_max_rand) into @act_size; - insert into t3 set data= repeat('a', @act_size); - end; - end case; - set n= n-1; - end while; -end| -delimiter ;| - -let $1= 1000; -set autocommit= 0; -begin; ---disable_warnings -eval call test.p1($1); ---enable_warnings -commit; - -show status like "binlog_cache_use"; ---echo *** binlog_cache_disk_use must be non-zero *** -show status like "binlog_cache_disk_use"; - -sync_slave_with_master; - -let $diff_tables=master:test.t1, slave:test.t1; -source include/diff_tables.inc; - -let $diff_tables=master:test.t2, slave:test.t2; -source include/diff_tables.inc; - -let $diff_tables=master:test.t3, slave:test.t3; -source include/diff_tables.inc; - - -connection master; - -begin; -delete from t1; -delete from t2; -delete from t3; -commit; - -drop table t1, t2, t3; -set @@global.binlog_cache_size = @save_binlog_cache_size; -set @@global.binlog_checksum = @save_binlog_checksum; -set @@global.master_verify_checksum = @save_master_verify_checksum; -drop procedure test.p_init; -drop procedure test.p1; - ---source include/rpl_end.inc +--source extra/rpl_tests/rpl_checksum_cache.inc diff --git a/mysql-test/suite/rpl/t/rpl_corruption.test b/mysql-test/suite/rpl/t/rpl_corruption.test index da87b133cb5..310b0cef8e8 100644 --- a/mysql-test/suite/rpl/t/rpl_corruption.test +++ b/mysql-test/suite/rpl/t/rpl_corruption.test @@ -1,170 +1 @@ -############################################################ -# Purpose: WL#5064 Testing with corrupted events. -# The test emulates the corruption at the vary stages -# of replication: -# - in binlog file -# - in network -# - in relay log -############################################################ - -# -# The tests intensively utilize @@global.debug. Note, -# Bug#11765758 - 58754, -# @@global.debug is read by the slave threads through dbug-interface. -# Hence, before a client thread set @@global.debug we have to ensure that: -# (a) the slave threads are stopped, or (b) the slave threads are in -# sync and waiting. - ---source include/have_debug.inc ---source include/master-slave.inc - -# Block legal errors for MTR -call mtr.add_suppression('Found invalid event in binary log'); -call mtr.add_suppression('Slave I/O: Relay log write failure: could not queue event from master'); -call mtr.add_suppression('event read from binlog did not pass crc check'); -call mtr.add_suppression('Replication event checksum verification failed'); -call mtr.add_suppression('Event crc check failed! Most likely there is event corruption'); -call mtr.add_suppression('Slave SQL: Error initializing relay log position: I/O error reading event at position .*, error.* 1593'); - -SET @old_master_verify_checksum = @@master_verify_checksum; - -# Creating test table/data and set corruption position for testing ---echo # 1. Creating test table/data and set corruption position for testing ---connection master ---echo * insert/update/delete rows in table t1 * -# Corruption algorithm modifies only the first event and -# then will be reset. To avoid checking always the first event -# from binlog (usually it is FD) we randomly execute different -# statements and set position for corruption inside events. - -CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c VARCHAR(100)); ---disable_query_log -let $i=`SELECT 3+CEILING(10*RAND())`; -let $j=1; -let $pos=0; -while ($i) { - eval INSERT INTO t1 VALUES ($j, 'a', NULL); - if (`SELECT RAND() > 0.7`) - { - eval UPDATE t1 SET c = REPEAT('a', 20) WHERE a = $j; - } - if (`SELECT RAND() > 0.8`) - { - eval DELETE FROM t1 WHERE a = $j; - } - if (!$pos) { - let $pos= query_get_value(SHOW MASTER STATUS, Position, 1); - --sync_slave_with_master - --source include/stop_slave.inc - --disable_query_log - --connection master - } - dec $i; - inc $j; -} ---enable_query_log - - -# Emulate corruption in binlog file when SHOW BINLOG EVENTS is executing ---echo # 2. Corruption in master binlog and SHOW BINLOG EVENTS -SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char"; ---echo SHOW BINLOG EVENTS; ---disable_query_log -send_eval SHOW BINLOG EVENTS FROM $pos; ---enable_query_log ---error ER_ERROR_WHEN_EXECUTING_COMMAND -reap; - -SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char"; - -# Emulate corruption on master with crc checking on master ---echo # 3. Master read a corrupted event from binlog and send the error to slave - -# We have a rare but nasty potential race here: if the dump thread on -# the master for the _old_ slave connection has not yet discovered -# that the slave has disconnected, we will inject the corrupt event on -# the wrong connection, and the test will fail -# (+d,corrupt_read_log_event2 corrupts only one event). -# So kill any lingering dump thread (we need to kill; otherwise dump thread -# could manage to send all events down the socket before seeing it close, and -# hang forever waiting for new binlog events to be created). -let $id= `select id from information_schema.processlist where command = "Binlog Dump"`; -if ($id) -{ - --disable_query_log - --error 0,1094 - eval kill $id; - --enable_query_log -} -let $wait_condition= - SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE command = 'Binlog Dump'; ---source include/wait_condition.inc - -SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set"; ---connection slave -START SLAVE IO_THREAD; -let $slave_io_errno= 1236; ---let $slave_timeout= 10 ---source include/wait_for_slave_io_error.inc ---connection master -SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; - -# Emulate corruption on master without crc checking on master ---echo # 4. Master read a corrupted event from binlog and send it to slave ---connection master -SET GLOBAL master_verify_checksum=0; -SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set"; ---connection slave -START SLAVE IO_THREAD; -# When the checksum error is detected, the slave sets error code 1913 -# (ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE) in queue_event(), then immediately -# sets error 1595 (ER_SLAVE_RELAY_LOG_WRITE_FAILURE) in handle_slave_io(). -# So we usually get 1595, but it is occasionally possible to get 1913. -let $slave_io_errno= 1595,1913; ---source include/wait_for_slave_io_error.inc ---connection master -SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; -SET GLOBAL debug_dbug= ""; -SET GLOBAL master_verify_checksum=1; - -# Emulate corruption in network ---echo # 5. Slave. Corruption in network ---connection slave -SET GLOBAL debug_dbug="+d,corrupt_queue_event"; -START SLAVE IO_THREAD; -let $slave_io_errno= 1595,1913; ---source include/wait_for_slave_io_error.inc -SET GLOBAL debug_dbug="-d,corrupt_queue_event"; - -# Emulate corruption in relay log ---echo # 6. Slave. Corruption in relay log - -SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char"; - -START SLAVE SQL_THREAD; -let $slave_sql_errno= 1593; ---source include/wait_for_slave_sql_error.inc - -SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char"; -SET GLOBAL debug_dbug= ""; - -# Start normal replication and compare same table on master -# and slave ---echo # 7. Seek diff for tables on master and slave ---connection slave ---source include/start_slave.inc ---connection master ---sync_slave_with_master -let $diff_tables= master:test.t1, slave:test.t1; ---source include/diff_tables.inc - -# Clean up ---echo # 8. Clean up ---connection master -SET GLOBAL debug_dbug= ""; -SET GLOBAL master_verify_checksum = @old_master_verify_checksum; -DROP TABLE t1; ---sync_slave_with_master -SET GLOBAL debug_dbug= ""; - ---source include/rpl_end.inc +--source extra/rpl_tests/rpl_corruption.inc diff --git a/mysql-test/suite/rpl/t/rpl_delayed_slave.combinations b/mysql-test/suite/rpl/t/rpl_delayed_slave.combinations new file mode 100644 index 00000000000..8adc75e834f --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_delayed_slave.combinations @@ -0,0 +1,5 @@ +[nonparallel] + +[parallel] +--slave-parallel-mode=conservative +--slave-parallel-threads=10 diff --git a/mysql-test/suite/rpl/t/rpl_delayed_slave.test b/mysql-test/suite/rpl/t/rpl_delayed_slave.test new file mode 100644 index 00000000000..2400a821e2b --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_delayed_slave.test @@ -0,0 +1,424 @@ +# ==== Purpose ==== +# +# Test the time-delayed replication feature, i.e., +# CHANGE MASTER TO MASTER_DELAY=X: +# +# - Verify that slave has executed the events after but not before the +# delay timeout. +# +# - Verify that delay is correct when slave is already lagging +# due to slow queries. +# +# - Verify that Seconds_Behind_Master is greater than or equal to the +# delay if the slave still has unprocessed events in the relay log +# and more time than the delay has elapsed since the last event was +# executed on the master. +# +# - Verify that STOP SLAVE works instantly even during a delay, and +# that it does not cause the waited-for event to be executed too +# early on slave. +# +# - Verify that changing back to no delay works. +# +# - Verify that RESET SLAVE sets the delay to 0. +# +# - Verify that setting a bad value for the delay gives an error. +# +# ==== Implementation ==== +# +# We run the slave with 10 seconds lag. +# +# In general, to test that a query has not been executed by the slave +# before this time, we wait until the slave IO thread has received the +# event, and then 5 seconds more, and check that the table has not +# been updated. To test that a query has been executed after this +# time, we wait 10 seconds more. +# +# To simulate that the slave lags due to slow queries, we invoke a +# stored function that executes SLEEP if @@gloval.server_id==2. This +# requires that we run with binlog_format=STATEMENT. +# +# ==== Related Bugs and Worklogs ==== +# +# WL#344: Time-delayed replication +# BUG#28760: Simulating a replication lag +# [duplicate] BUG#22072: configurable delayed replication +# [duplicate] BUG#21639: Add Replication Delay parameter +# BUG#56442: Slave executes delayed statements when STOP SLAVE is issued +# +# ==== Issues with this Test Case ==== +# +# The test is inherently timing-sensitive (i.e., contains races) and +# is likely to fail sporadically on a loaded host. +# +# The test takes a long time; it sleeps for around 20*10 seconds. + +--source include/big_test.inc +--source include/not_valgrind.inc +--source include/master-slave.inc +# Needed so that sleeps get executed in the slave SQL thread. +--source include/have_binlog_format_statement.inc + + +call mtr.add_suppression("Unsafe statement written to the binary log using statement format"); +--connection slave +call mtr.add_suppression("Unsafe statement written to the binary log using statement format"); +--connection master + + +# We assume that any simple operation takes zero time, with an error +# margin of $time1 seconds. Hence, if we run with a delay of $time2 +# seconds, we expect that: +# - If we execute a query on master and wait $time1 seconds, then the +# query has been copied to slave but not yet executed. +# - If we execute a query on master and wait $time3 seconds, then the +# query has been executed. +--let $time1= 10 +if (`SELECT '$max_query_execution_time' > 0`) { + --let $time1= $max_query_execution_time +} +--let $time2= `SELECT 2 * $time1` +--let $time3= `SELECT 3 * $time1` + + +--echo [on master] +CREATE TABLE t1 (a VARCHAR(100), b INT); +INSERT INTO t1 VALUES ("zero", 0); + + +--echo ==== Normal setup ==== + +--echo [on slave] +--sync_slave_with_master + +--source include/stop_slave.inc + +--echo # CHANGE MASTER TO MASTER_DELAY = 2*T +--disable_query_log +eval CHANGE MASTER TO MASTER_DELAY = $time2; +--enable_query_log + +--source include/start_slave.inc + +--let $assert_text= SHOW SLAVE STATUS should return the same delay that we set with CHANGE MASTER +--let $assert_cond= [SHOW SLAVE STATUS, SQL_Delay, 1] = $time2 +--source include/rpl_assert.inc + +--echo [on master] +--connection master +INSERT INTO t1 VALUES ('normal setup', 1); + +--let $query_number= 1 +--source extra/rpl_tests/delayed_slave_wait_on_query.inc + + +--echo ==== Slave lags "naturally" after master ==== + +--echo [on master] +--connection master + +--disable_query_log +--echo # CREATE FUNCTION delay_on_slave(time_units INT) RETURNS INT BEGIN IF @@GLOBAL.server_id = 2 THEN RETURN SLEEP(time_units * T); ELSE RETURN 0; END IF; END +--eval CREATE FUNCTION delay_on_slave(time_units INT) RETURNS INT BEGIN IF @@GLOBAL.server_id = 2 THEN RETURN SLEEP(time_units * $time1); ELSE RETURN 0; END IF; END +--enable_query_log + +INSERT INTO t1 SELECT delay_on_slave(3), 2; + +--save_master_pos +INSERT INTO t1 VALUES ('slave is already lagging: this statement should execute immediately', 3); +INSERT INTO t1 SELECT delay_on_slave(2), 4; + +--echo [on slave] +--source include/sync_slave_io_with_master.inc +--echo # sleep 1*T +--sleep $time1 + +--let $assert_text= No query executed +--let $assert_cond= MAX(b) = 1 FROM t1 +--source include/rpl_assert.inc + +--let $assert_text= Status should be 'Waiting until MASTER_DELAY...' +--let $assert_cond= "[SHOW SLAVE STATUS, Slave_SQL_Running_State, 1]" LIKE "Waiting until MASTER_DELAY%" +--source include/rpl_assert.inc + +--echo # wait for first query to execute +--sync_with_master + +--echo # sleep 1*T +--sleep $time1 + +--let $assert_text= Second query executed +--let $assert_cond= MAX(b) = 3 FROM t1 +--source include/rpl_assert.inc + +let $parallel= `SELECT @@GLOBAL.slave_parallel_threads`; +if (!$parallel) +{ + let $assert_text= Status should be executing third query (i.e., 'User sleep'); + let $assert_cond= "[SHOW SLAVE STATUS, Slave_SQL_Running_State, 1]" = "User sleep"; + source include/rpl_assert.inc; +} + +--echo # sleep 2*T +--sleep $time2 + +--let $assert_text= Third query executed +--let $assert_cond= MAX(b) = 4 FROM t1 +--source include/rpl_assert.inc + +--let $assert_text= Status should be 'Has read all relay log...' +--let $assert_cond= "[SHOW SLAVE STATUS, Slave_SQL_Running_State, 1]" LIKE "Slave has read all relay log%" +--source include/rpl_assert.inc + + +--echo ==== Seconds_Behind_Master ==== + +--echo # Bring slave to sync. +--source include/stop_slave.inc +CHANGE MASTER TO MASTER_DELAY = 0; +--source include/start_slave.inc + +--connection master +INSERT INTO t1 VALUES ('Syncing slave', 5); +--sync_slave_with_master + +--source include/stop_slave.inc +--echo # CHANGE MASTER TO MASTER_DELAY = 2*T +--disable_query_log +eval CHANGE MASTER TO MASTER_DELAY = $time2; +--enable_query_log +--source include/start_slave.inc + +--connection master +INSERT INTO t1 VALUES (delay_on_slave(1), 6); +--save_master_pos +--connection slave + +--echo # sleep 1*T +--sleep $time1 + +--let $assert_cond= [SHOW SLAVE STATUS, Seconds_Behind_Master, 1] >= 0 AND <1> < $time2 +--let $assert_text= Seconds_Behind_Master should be between 0 and the 2*T +--source include/rpl_assert.inc + +--echo # sleep 1*T +--sleep $time1 + +--let $assert_cond= [SHOW SLAVE STATUS, Seconds_Behind_Master, 1] >= $time2 +--let $assert_text= Seconds_Behind_Master should be at least 2*T +--source include/rpl_assert.inc + +--sync_with_master + + +--echo ==== STOP SLAVE / START SLAVE + DML ==== + +# Set up a longer delay. +--source include/stop_slave.inc + +--echo # CHANGE MASTER TO MASTER_DELAY = 3*T +--disable_query_log +eval CHANGE MASTER TO MASTER_DELAY = $time3; +--enable_query_log + +--source include/start_slave.inc + +--echo [on master] +--connection master +INSERT INTO t1 VALUES ('stop slave and start slave: DML', 7); + +--echo [on slave] +--connection slave +--echo # sleep 1*T +--sleep $time1 +--let $timestamp_before_stop= `SELECT UNIX_TIMESTAMP()` +--let $relay_log_pos_before_stop= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1) +--source include/stop_slave.inc + +--let $assert_text= STOP SLAVE should finish quickly, not wait for the ongoing sleep to finish +--let $assert_cond= UNIX_TIMESTAMP() - $timestamp_before_stop < $time1 +--source include/rpl_assert.inc + +--let $assert_text= SQL thread position should not increase after STOP SLAVE +--let $assert_cond= [SHOW SLAVE STATUS, Relay_Log_Pos, 1] = $relay_log_pos_before_stop +--source include/rpl_assert.inc + +--let $assert_text= Query should not be executed after STOP SLAVE +--let $assert_cond= MAX(b) = 6 FROM t1 +--source include/rpl_assert.inc + +--let $assert_text= Status should be '' after STOP SLAVE +--let $assert_cond= "[SHOW SLAVE STATUS, Slave_SQL_Running_State, 1]" = "" +--source include/rpl_assert.inc + +--source include/start_slave.inc + +--let $assert_text= START SLAVE should finish quickly +--let $assert_cond= UNIX_TIMESTAMP() - $timestamp_before_stop < $time1 +--source include/rpl_assert.inc + +--let $query_number= 7 +--source extra/rpl_tests/delayed_slave_wait_on_query.inc + + +--echo ==== STOP SLAVE / START SLAVE + DDL ==== + +--echo This verifies BUG#56442 + +--echo [on master] +--connection master +CREATE TABLE t_check_dml_not_executed_prematurely (a INT); +--source include/save_master_pos.inc + +--echo [on slave] +--connection slave +--echo # sleep 1*T +--sleep $time1 + +--let $timestamp_before_stop= `SELECT UNIX_TIMESTAMP()` +--let $relay_log_pos_before_stop= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1) +--source include/stop_slave.inc + +--let $assert_text= STOP SLAVE should finish quickly, not wait for the ongoing sleep to finish +--let $assert_cond= UNIX_TIMESTAMP() - $timestamp_before_stop < $time1 +--source include/rpl_assert.inc + +--let $assert_text= SQL thread position should not increase after STOP SLAVE +--let $assert_cond= [SHOW SLAVE STATUS, Relay_Log_Pos, 1] = $relay_log_pos_before_stop +--source include/rpl_assert.inc + +--let $assert_text= Query should not be executed after STOP SLAVE +--let $assert_cond= COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = "t_check_dml_not_executed_prematurely" +--source include/rpl_assert.inc + +--let $assert_text= Status should be '' after STOP SLAVE +--let $assert_cond= "[SHOW SLAVE STATUS, Slave_SQL_Running_State, 1]" = "" +--source include/rpl_assert.inc + +--source include/start_slave.inc + +--let $assert_text= START SLAVE should finish quickly +--let $assert_cond= UNIX_TIMESTAMP() - $timestamp_before_stop < $time1 +--source include/rpl_assert.inc + +--echo # sleep 1*T +--sleep $time1 + +--let $assert_text= DDL Query should not be executed after START SLAVE +--let $assert_cond= COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = "t_check_dml_not_executed_prematurely" +--source include/rpl_assert.inc + +--let $assert_text= Status should be 'Waiting until MASTER_DELAY...' +--let $assert_cond= "[SHOW SLAVE STATUS, Slave_SQL_Running_State, 1]" LIKE "Waiting until MASTER_DELAY%" +--source include/rpl_assert.inc + +--echo # sleep 1*T +--sleep $time1 + +--echo # sync with master (with timeout 1*T) +--source include/sync_with_master.inc + +--let $assert_text= DDL Query should be executed +--let $assert_cond= COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = "t_check_dml_not_executed_prematurely" +--source include/rpl_assert.inc + +--let $assert_text= Status should be 'Has read all relay log...' +--let $assert_cond= "[SHOW SLAVE STATUS, Slave_SQL_Running_State, 1]" LIKE "Slave has read all relay log%" +--source include/rpl_assert.inc + +--source include/check_slave_is_running.inc + + +--echo ==== Change back to no delay ==== + +--echo [on slave] +--connection slave +--source include/stop_slave.inc +CHANGE MASTER TO MASTER_DELAY = 0; + +--let $assert_text= Delay should be 0 when we set it to 0 +--let $assert_cond= [SHOW SLAVE STATUS, SQL_Delay, 1] = 0 +--source include/rpl_assert.inc + +--source include/start_slave.inc + +--echo [on master] +--connection master +INSERT INTO t1 VALUES ('change back to no delay', 8); + +--echo [on slave] +--source include/sync_slave_io_with_master.inc +--echo # sleep 1*T +--sleep $time1 + +--let $assert_text= Query should be executed +--let $assert_cond= MAX(b) = 8 FROM t1 +--source include/rpl_assert.inc + +--let $assert_text= Status should be 'Slave has read all relay log...' +--let $assert_cond= "[SHOW SLAVE STATUS, Slave_SQL_Running_State, 1]" Like "Slave has read all relay log%" +--source include/rpl_assert.inc + + +--echo ==== Reset delay with RESET SLAVE ==== + +--source include/stop_slave.inc +CHANGE MASTER TO MASTER_DELAY = 71; +--source include/start_slave.inc + +--let $assert_text= Delay should be 71 when we set it to 71 +--let $assert_cond= [SHOW SLAVE STATUS, SQL_Delay, 1] = 71 +--source include/rpl_assert.inc + +--source include/stop_slave.inc +RESET SLAVE; +--echo [on master] +--connection master +RESET MASTER; +--echo [on slave] +--connection slave +--source include/start_slave.inc + +--let $assert_text= Delay should be 0 after RESET SLAVE +--let $assert_cond= [SHOW SLAVE STATUS, SQL_Delay, 1] = 0 +--source include/rpl_assert.inc + + +--echo ==== Set an invalid value for the delay ==== + +--source include/stop_slave.inc + +--echo # Expect error for setting negative delay +--error ER_PARSE_ERROR +CHANGE MASTER TO MASTER_DELAY = -1; + +--echo # Expect that it's ok to set delay of 2^31-1 +CHANGE MASTER TO MASTER_DELAY = 2147483647; +--echo # Expect error for setting delay between 2^31 and 2^32-1 +--error ER_MASTER_DELAY_VALUE_OUT_OF_RANGE +CHANGE MASTER TO MASTER_DELAY = 2147483648; + +--echo # Expect error for setting delay to nonsense +--error ER_PARSE_ERROR +CHANGE MASTER TO MASTER_DELAY = blah; + +# todo: CHANGE MASTER TO MASTER_DELAY = 999999999999999999999999999 +# should give error + +CHANGE MASTER TO MASTER_DELAY = 0; +--source include/start_slave.inc + + +--echo ==== Clean up ==== + +--echo [on master] +--connection master +DROP TABLE t1, t_check_dml_not_executed_prematurely; +DROP FUNCTION delay_on_slave; + +--echo [on slave] +--sync_slave_with_master +SELECT @@GLOBAL.slave_parallel_mode; +SELECT @@GLOBAL.slave_parallel_threads; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_delayed_slave2.test b/mysql-test/suite/rpl/t/rpl_delayed_slave2.test new file mode 100644 index 00000000000..68e8f8e1c46 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_delayed_slave2.test @@ -0,0 +1,65 @@ +--source include/have_innodb.inc +--source include/master-slave.inc + +# This test file tests delayed slave for parallel replication (and GTID). +# Uses a different approach from rpl_delayed_slave.test, setting @@timestamp +# to simulate events logged on master at different times. + +--connection master +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(100)); +INSERT INTO t1 VALUES (1, "a"); +--save_master_pos + +--connection slave +--sync_with_master +--source include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=slave_pos; +SET @old_mode= @@GLOBAL.slave_parallel_mode; +SET GLOBAL slave_parallel_mode=optimistic; +SET @old_threads= @@GLOBAL.slave_parallel_threads; +SET GLOBAL slave_parallel_threads=10; + +--connection master +INSERT INTO t1 VALUES (2, "b"); +INSERT INTO t1 VALUES (3, "b"); +INSERT INTO t1 VALUES (4, "b"); +--let $gtid1= `SELECT @@gtid_binlog_pos` +# Simulate an event a days in the future, for delayed slave to wait on. +SET timestamp= @@timestamp + 24*60*60; +INSERT INTO t1 VALUES (5, "c"); +INSERT INTO t1 VALUES (6, "c"); +SET timestamp= 0; +--let $gtid2= `SELECT @@gtid_binlog_pos` +--source include/save_master_gtid.inc + +--connection slave +CHANGE MASTER TO master_delay=1; +--source include/start_slave.inc +--replace_result $gtid1 GTID1 +# First sync halfways, to avoid timing-dependent test failures. +eval SELECT MASTER_GTID_WAIT('$gtid1'); +# Try to sync up, should timeout because slave is waiting for one day. +--replace_result $gtid2 GTID2 +eval SELECT MASTER_GTID_WAIT('$gtid2', 2); + +# Check that we can stop slave while delaying. +--source include/stop_slave.inc +SELECT * FROM t1 ORDER BY a; +CHANGE MASTER TO master_delay=0; +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc +SELECT * FROM t1 ORDER BY a; + + +--connection slave +--source include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=no, master_delay=0; +SET GLOBAL slave_parallel_mode=@old_mode; +SET GLOBAL slave_parallel_threads=@old_threads; +--source include/start_slave.inc + +--connection master +DROP TABLE t1; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_drop_db.test b/mysql-test/suite/rpl/t/rpl_drop_db.test index a67850a66dd..f66187b12f5 100644 --- a/mysql-test/suite/rpl/t/rpl_drop_db.test +++ b/mysql-test/suite/rpl/t/rpl_drop_db.test @@ -13,7 +13,7 @@ insert into mysqltest1.t1 values (1); select * from mysqltest1.t1 into outfile 'mysqltest1/f1.txt'; create table mysqltest1.t2 (n int); create table mysqltest1.t3 (n int); ---replace_result \\ / 66 39 17 39 "File exists" "Directory not empty" +--replace_result \\ / 66 39 93 39 17 39 247 39 "File exists" "Directory not empty" --error 1010 drop database mysqltest1; use mysqltest1; @@ -30,7 +30,7 @@ while ($1) } --enable_query_log ---replace_result \\ / 66 39 17 39 "File exists" "Directory not empty" +--replace_result \\ / 66 39 93 39 17 39 247 39 "File exists" "Directory not empty" --error 1010 drop database mysqltest1; use mysqltest1; diff --git a/mysql-test/suite/rpl/t/rpl_gtid_basic.test b/mysql-test/suite/rpl/t/rpl_gtid_basic.test index 7a4659fb824..b04f82e1725 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_basic.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_basic.test @@ -1,565 +1,4 @@ ---source include/have_innodb.inc ---let $rpl_topology=1->2->3->4 ---source include/rpl_init.inc - -# Set up a 4-deep replication topology, then test various fail-overs -# using GTID. -# -# A -> B -> C -> D - -connection server_1; ---source include/wait_for_binlog_checkpoint.inc ---let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1) ---let $binlog_pos = query_get_value(SHOW MASTER STATUS,Position,1) ---echo *** GTID position should be empty here *** ---replace_result $binlog_file $binlog_pos -eval SELECT BINLOG_GTID_POS('$binlog_file',$binlog_pos); - -CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM; -CREATE TABLE t2 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, "m1"); -INSERT INTO t1 VALUES (2, "m2"), (3, "m3"), (4, "m4"); -INSERT INTO t2 VALUES (1, "i1"); -BEGIN; -INSERT INTO t2 VALUES (2, "i2"), (3, "i3"); -INSERT INTO t2 VALUES (4, "i4"); -COMMIT; -save_master_pos; -source include/wait_for_binlog_checkpoint.inc; ---let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1) ---let $binlog_pos = query_get_value(SHOW MASTER STATUS,Position,1) ---let $gtid_pos_server_1 = `SELECT @@gtid_binlog_pos` ---echo *** GTID position should be non-empty here *** ---replace_result $binlog_file $binlog_pos $gtid_pos_server_1 -eval SELECT BINLOG_GTID_POS('$binlog_file',$binlog_pos); - -connection server_2; -sync_with_master; -source include/wait_for_binlog_checkpoint.inc; ---let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1) ---let $binlog_pos = query_get_value(SHOW MASTER STATUS,Position,1) ---echo *** GTID position should be the same as on server_1 *** ---replace_result $binlog_file $binlog_pos $gtid_pos_server_1 -eval SELECT BINLOG_GTID_POS('$binlog_file',$binlog_pos); -SELECT * FROM t1 ORDER BY a; -SELECT * FROM t2 ORDER BY a; -save_master_pos; - -connection server_3; -sync_with_master; -SELECT * FROM t1 ORDER BY a; -SELECT * FROM t2 ORDER BY a; -save_master_pos; - -connection server_4; -sync_with_master; -SELECT * FROM t1 ORDER BY a; -SELECT * FROM t2 ORDER BY a; - - ---echo *** Now take out D, let it fall behind a bit, and then test re-attaching it to A *** -connection server_4; ---source include/stop_slave.inc - -connection server_1; -INSERT INTO t1 VALUES (5, "m1a"); -INSERT INTO t2 VALUES (5, "i1a"); -save_master_pos; - -connection server_4; ---replace_result $MASTER_MYPORT MASTER_PORT -eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT, - MASTER_USE_GTID=CURRENT_POS; ---source include/start_slave.inc -sync_with_master; -SELECT * FROM t1 ORDER BY a; -SELECT * FROM t2 ORDER BY a; - ---echo *** Now move B to D (C is still replicating from B) *** -connection server_2; ---source include/stop_slave.inc ---replace_result $SERVER_MYPORT_4 SERVER_MYPORT_4 -eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_4, - MASTER_USE_GTID=CURRENT_POS; ---source include/start_slave.inc - -connection server_4; -UPDATE t2 SET b="j1a" WHERE a=5; -save_master_pos; - -connection server_2; -sync_with_master; -SELECT * FROM t1 ORDER BY a; -SELECT * FROM t2 ORDER BY a; - ---echo *** Now move C to D, after letting it fall a little behind *** -connection server_3; ---source include/stop_slave.inc - -connection server_1; -INSERT INTO t2 VALUES (6, "i6b"); -INSERT INTO t2 VALUES (7, "i7b"); ---source include/save_master_gtid.inc - -connection server_3; ---replace_result $SERVER_MYPORT_4 SERVER_MYPORT_4 -eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_4, - MASTER_USE_GTID=CURRENT_POS; ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc -SELECT * FROM t2 ORDER BY a; - ---echo *** Now change everything back to what it was, to make rpl_end.inc happy -# Also check that MASTER_USE_GTID=CURRENT_POS is still enabled. -connection server_2; -# We need to sync up server_2 before switching. If it happened to have reached -# the point 'UPDATE t2 SET b="j1a" WHERE a=5' it will fail to connect to -# server_1, which is (deliberately) missing that transaction. ---source include/sync_with_master_gtid.inc ---source include/stop_slave.inc ---replace_result $MASTER_MYPORT MASTER_MYPORT -eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT; ---source include/start_slave.inc ---source include/wait_for_slave_to_start.inc - -connection server_3; ---source include/stop_slave.inc ---replace_result $SLAVE_MYPORT SLAVE_MYPORT -eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SLAVE_MYPORT; ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc - -connection server_4; ---source include/stop_slave.inc ---replace_result $SERVER_MYPORT_3 SERVER_MYPORT_3 -eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_3; ---source include/start_slave.inc - -connection server_1; -DROP TABLE t1,t2; ---source include/save_master_gtid.inc - ---echo *** A few more checks for BINLOG_GTID_POS function *** ---let $valid_binlog_name = query_get_value(SHOW BINARY LOGS,Log_name,1) ---error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT -SELECT BINLOG_GTID_POS(); ---error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT -SELECT BINLOG_GTID_POS('a'); ---error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT -SELECT BINLOG_GTID_POS('a',1,NULL); -SELECT BINLOG_GTID_POS(1,'a'); -SELECT BINLOG_GTID_POS(NULL,NULL); -SELECT BINLOG_GTID_POS('',1); -SELECT BINLOG_GTID_POS('a',1); -eval SELECT BINLOG_GTID_POS('$valid_binlog_name',-1); -eval SELECT BINLOG_GTID_POS('$valid_binlog_name',0); -eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551615); -eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551616); - - ---echo *** Some tests of @@GLOBAL.gtid_binlog_state *** ---connection server_2 ---source include/sync_with_master_gtid.inc ---source include/stop_slave.inc - ---connection server_1 -SET @old_state= @@GLOBAL.gtid_binlog_state; - ---error ER_BINLOG_MUST_BE_EMPTY -SET GLOBAL gtid_binlog_state = ''; -RESET MASTER; -SET GLOBAL gtid_binlog_state = ''; -FLUSH LOGS; ---source include/show_binary_logs.inc -SET GLOBAL gtid_binlog_state = '0-1-10,1-2-20,0-3-30'; ---source include/show_binary_logs.inc ---let $binlog_file= master-bin.000001 ---let $binlog_start= 4 ---source include/show_binlog_events.inc -#SELECT @@GLOBAL.gtid_binlog_pos; -#SELECT @@GLOBAL.gtid_binlog_state; ---error ER_BINLOG_MUST_BE_EMPTY -SET GLOBAL gtid_binlog_state = @old_state; -RESET MASTER; -SET GLOBAL gtid_binlog_state = @old_state; - -# Check that slave can reconnect again, despite the RESET MASTER, as we -# restored the state. - -CREATE TABLE t1 (a INT PRIMARY KEY); -SET gtid_seq_no=100; -INSERT INTO t1 VALUES (1); ---source include/save_master_gtid.inc - ---connection server_2 ---source include/start_slave.inc -# We cannot just use sync_with_master as we've done RESET MASTER, so -# slave old-style position is wrong. -# So sync on gtid position instead. ---source include/sync_with_master_gtid.inc - -SELECT * FROM t1; -# Check that the IO gtid position in SHOW SLAVE STATUS is also correct. ---let $status_items= Gtid_IO_Pos ---source include/show_slave_status.inc - ---echo *** Test @@LAST_GTID and MASTER_GTID_WAIT() *** - ---connection server_1 -DROP TABLE t1; -CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; ---save_master_pos - ---connection server_2 ---sync_with_master ---source include/stop_slave.inc - ---connect (m1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) -SELECT @@last_gtid; -SET gtid_seq_no=110; -SELECT @@last_gtid; -BEGIN; -SELECT @@last_gtid; -INSERT INTO t1 VALUES (2); -SELECT @@last_gtid; -COMMIT; -SELECT @@last_gtid; ---let $pos= `SELECT @@gtid_binlog_pos` - ---connect (s1,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -eval SET @pos= '$pos'; -# Check NULL argument. -SELECT master_gtid_wait(NULL); -# Check empty argument returns immediately. -SELECT master_gtid_wait('', NULL); -# Check this gets counted -SHOW STATUS LIKE 'Master_gtid_wait_count'; -SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; -SHOW STATUS LIKE 'Master_gtid_wait_time'; -# Let's check that we get a timeout -SELECT master_gtid_wait(@pos, 0.5); -SELECT * FROM t1 ORDER BY a; -# Now actually wait until the slave reaches the position -send SELECT master_gtid_wait(@pos); - ---connection server_2 ---source include/start_slave.inc - ---connection s1 -reap; -SELECT * FROM t1 ORDER BY a; - -# Test waiting on a domain that does not exist yet. ---source include/stop_slave.inc - ---connection server_1 -SET gtid_domain_id= 1; -INSERT INTO t1 VALUES (3); ---let $pos= `SELECT @@gtid_binlog_pos` - ---connection s1 ---replace_result $pos POS -eval SET @pos= '$pos'; -SELECT master_gtid_wait(@pos, 0); -SELECT * FROM t1 WHERE a >= 3; -send SELECT master_gtid_wait(@pos, -1); - ---connection server_2 ---source include/start_slave.inc - ---connection s1 -reap; -SELECT * FROM t1 WHERE a >= 3; -# Waiting for only part of the position. -SELECT master_gtid_wait('1-1-1', 0); - -# Now test a lot of parallel master_gtid_wait() calls, completing in different -# order, and some of which time out or get killed on the way. - ---connection s1 -send SELECT master_gtid_wait('2-1-1,1-1-4,0-1-110'); - ---connect (s2,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -# This will time out. No event 0-1-1000 exists -send SELECT master_gtid_wait('0-1-1000', 0.5); - ---connect (s3,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -# This one we will kill ---let $kill1_id= `SELECT connection_id()` -send SELECT master_gtid_wait('0-1-2000'); - ---connect (s4,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -send SELECT master_gtid_wait('2-1-10'); - ---connect (s5,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -send SELECT master_gtid_wait('2-1-6', 1); - -# This one we will kill also. ---connect (s6,127.0.0.1,root,,test,$SERVER_MYPORT_2,) ---let $kill2_id= `SELECT connection_id()` -send SELECT master_gtid_wait('2-1-5'); - ---connect (s7,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -send SELECT master_gtid_wait('2-1-10'); - ---connect (s8,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -send SELECT master_gtid_wait('2-1-5,1-1-4,0-1-110'); - ---connect (s9,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -send SELECT master_gtid_wait('2-1-2'); - ---connection server_2 -# This one completes immediately. -SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; -SHOW STATUS LIKE 'Master_gtid_wait_count'; -SELECT master_gtid_wait('1-1-1'); -SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; -SHOW STATUS LIKE 'Master_gtid_wait_count'; -let $wait_time = query_get_value(SHOW STATUS LIKE 'Master_gtid_wait_time', Value, 1); ---replace_result $wait_time MASTER_GTID_WAIT_TIME -eval SET @a= $wait_time; -SELECT IF(@a <= 100*1000*1000, "OK", CONCAT("Error: wait time ", @a, " is larger than expected")) - AS Master_gtid_wait_time_as_expected; - - ---connect (s10,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -send SELECT master_gtid_wait('0-1-109'); - ---connection server_2 -# This one should time out. -SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; -SHOW STATUS LIKE 'Master_gtid_wait_count'; -SELECT master_gtid_wait('2-1-2', 0.5); -SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; -SHOW STATUS LIKE 'Master_gtid_wait_count'; -let $wait_time = query_get_value(SHOW STATUS LIKE 'Master_gtid_wait_time', Value, 1); ---replace_result $wait_time MASTER_GTID_WAIT_TIME -eval SET @a= $wait_time; -# We expect a wait time of just a bit over 0.5 seconds. But thread scheduling -# and timer inaccuracies could introduce significant jitter. So allow a -# generous interval. -SELECT IF(@a BETWEEN 0.4*1000*1000 AND 100*1000*1000, "OK", CONCAT("Error: wait time ", @a, " not as expected")) AS Master_gtid_wait_time_as_expected; - ---replace_result $kill1_id KILL_ID -eval KILL QUERY $kill1_id; ---connection s3 ---error ER_QUERY_INTERRUPTED -reap; - ---connection server_1 -SET gtid_domain_id=2; -SET gtid_seq_no=2; -INSERT INTO t1 VALUES (4); - ---connection s9 -reap; - ---connection server_2 ---replace_result $kill2_id KILL_ID -eval KILL CONNECTION $kill2_id; - ---connection s6 ---error 2013,ER_CONNECTION_KILLED -reap; - ---connection server_1 -SET gtid_domain_id=1; -SET gtid_seq_no=4; -INSERT INTO t1 VALUES (5); -SET gtid_domain_id=2; -SET gtid_seq_no=5; -INSERT INTO t1 VALUES (6); - ---connection s8 -reap; ---connection s1 -reap; ---connection s2 -reap; ---connection s5 -reap; ---connection s10 -reap; - ---connection server_1 -SET gtid_domain_id=2; -SET gtid_seq_no=10; -INSERT INTO t1 VALUES (7); - ---connection s4 -reap; ---connection s7 -reap; - - ---echo *** Test gtid_slave_pos when used with GTID *** - ---connection server_2 ---source include/stop_slave.inc - ---connection server_1 -SET gtid_domain_id=2; -SET gtid_seq_no=1000; -INSERT INTO t1 VALUES (10); -INSERT INTO t1 VALUES (11); ---save_master_pos - ---connection server_2 -SET sql_slave_skip_counter= 1; ---source include/start_slave.inc ---sync_with_master -SELECT * FROM t1 WHERE a >= 10 ORDER BY a; -SELECT IF(LOCATE("2-1-1001", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1001 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; - ---source include/stop_slave.inc - ---connection server_1 -SET gtid_domain_id=2; -SET gtid_seq_no=1010; -INSERT INTO t1 VALUES (12); -INSERT INTO t1 VALUES (13); ---save_master_pos - ---connection server_2 -SET sql_slave_skip_counter= 2; ---source include/start_slave.inc ---sync_with_master -SELECT * FROM t1 WHERE a >= 10 ORDER BY a; -SELECT IF(LOCATE("2-1-1011", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1011 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; - ---source include/stop_slave.inc - ---connection server_1 -SET gtid_domain_id=2; -SET gtid_seq_no=1020; -INSERT INTO t1 VALUES (14); -INSERT INTO t1 VALUES (15); -INSERT INTO t1 VALUES (16); ---save_master_pos - ---connection server_2 -SET sql_slave_skip_counter= 3; ---source include/start_slave.inc ---sync_with_master -SELECT * FROM t1 WHERE a >= 10 ORDER BY a; -SELECT IF(LOCATE("2-1-1022", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1022 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; - ---source include/stop_slave.inc - ---connection server_1 -SET gtid_domain_id=2; -SET gtid_seq_no=1030; -INSERT INTO t1 VALUES (17); -INSERT INTO t1 VALUES (18); -INSERT INTO t1 VALUES (19); ---save_master_pos - ---connection server_2 -SET sql_slave_skip_counter= 5; ---source include/start_slave.inc ---sync_with_master -SELECT * FROM t1 WHERE a >= 10 ORDER BY a; -SELECT IF(LOCATE("2-1-1032", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1032 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; - - ---source include/stop_slave.inc - ---connection server_1 -SET gtid_domain_id=3; -SET gtid_seq_no=100; -CREATE TABLE t2 (a INT PRIMARY KEY); -DROP TABLE t2; -SET gtid_domain_id=2; -SET gtid_seq_no=1040; -INSERT INTO t1 VALUES (20); ---save_master_pos - ---connection server_2 -SET @saved_mode= @@GLOBAL.slave_ddl_exec_mode; -SET GLOBAL slave_ddl_exec_mode=STRICT; -SET sql_slave_skip_counter=1; -START SLAVE UNTIL master_gtid_pos="3-1-100"; ---let $master_pos=3-1-100 ---source include/sync_with_master_gtid.inc ---source include/wait_for_slave_to_stop.inc ---error ER_NO_SUCH_TABLE -SELECT * FROM t2; -SELECT IF(LOCATE("3-1-100", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-100 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; - -# Start the slave again, it should fail on the DROP TABLE as the table is not there. -SET sql_log_bin=0; -CALL mtr.add_suppression("Slave: Unknown table 'test\\.t2' Error_code: 1051"); -SET sql_log_bin=1; -START SLAVE; ---let $slave_sql_errno=1051 ---source include/wait_for_slave_sql_error.inc -SELECT IF(LOCATE("3-1-100", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-100 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; - -STOP SLAVE IO_THREAD; -SET sql_slave_skip_counter=2; ---source include/start_slave.inc ---sync_with_master - -SELECT * FROM t1 WHERE a >= 20 ORDER BY a; -SELECT IF(LOCATE("3-1-101", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-101 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; -SELECT IF(LOCATE("2-1-1040", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1040 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; - -SET GLOBAL slave_ddl_exec_mode= @saved_mode; - - ---echo *** Test GTID-connecting to a master with out-of-order sequence numbers in the binlog. *** - -# Create an out-of-order binlog on server 2. -# Let server 3 replicate to an out-of-order point, stop it, restart it, -# and check that it replicates correctly despite the out-of-order. - ---connection server_1 -SET gtid_domain_id= @@GLOBAL.gtid_domain_id; -INSERT INTO t1 VALUES (31); ---save_master_pos - ---connection server_2 ---sync_with_master -SET gtid_domain_id= @@GLOBAL.gtid_domain_id; -INSERT INTO t1 VALUES (32); - ---connection server_1 -INSERT INTO t1 VALUES (33); ---save_master_pos - ---connection server_2 ---sync_with_master ---save_master_pos - ---connection server_3 ---sync_with_master ---source include/stop_slave.inc - ---connection server_1 -INSERT INTO t1 VALUES (34); ---save_master_pos - ---connection server_2 ---sync_with_master ---save_master_pos - ---connection server_3 ---source include/start_slave.inc ---sync_with_master -SELECT * FROM t1 WHERE a >= 30 ORDER BY a; ---save_master_pos - ---connection server_4 ---sync_with_master -SELECT * FROM t1 WHERE a >= 30 ORDER BY a; - - -# Clean up. ---connection server_1 -DROP TABLE t1; - - ---source include/rpl_end.inc +--source extra/rpl_tests/rpl_gtid_basic.inc --echo # --echo # Start of 10.2 tests @@ -569,7 +8,7 @@ DROP TABLE t1; --echo # MDEV-10134 Add full support for DEFAULT --echo # ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a VARCHAR(100) DEFAULT BINLOG_GTID_POS("master-bin.000001", 600)); --echo # diff --git a/mysql-test/suite/rpl/t/rpl_incident.test b/mysql-test/suite/rpl/t/rpl_incident.test index 0666be816f2..9be855e1a8b 100644 --- a/mysql-test/suite/rpl/t/rpl_incident.test +++ b/mysql-test/suite/rpl/t/rpl_incident.test @@ -1,59 +1 @@ ---source include/master-slave.inc ---source include/have_debug.inc - -connection master; -SET GLOBAL BINLOG_CHECKSUM=none; -connection slave; -SET GLOBAL BINLOG_CHECKSUM=none; -connection master; - ---echo **** On Master **** -CREATE TABLE t1 (a INT); - -INSERT INTO t1 VALUES (1),(2),(3); -SELECT * FROM t1; - -let $debug_save= `SELECT @@GLOBAL.debug`; -SET GLOBAL debug_dbug= '+d,incident_database_resync_on_replace,*'; - -# This will generate an incident log event and store it in the binary -# log before the replace statement. -REPLACE INTO t1 VALUES (4); ---save_master_pos -SELECT * FROM t1; - ---disable_query_log -eval SET GLOBAL debug_dbug= '$debug_save'; ---enable_query_log - -connection slave; -# Wait until SQL thread stops with error LOST_EVENT on master -call mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occurred on the master.* 1590"); -let $slave_sql_errno= 1590; -let $show_slave_sql_error= 1; -source include/wait_for_slave_sql_error.inc; - -# The 4 should not be inserted into the table, since the incident log -# event should have stop the slave. ---echo **** On Slave **** -SELECT * FROM t1; - -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -START SLAVE; ---sync_with_master - -# Now, we should have inserted the row into the table and the slave -# should be running. We should also have rotated to a new binary log. - -SELECT * FROM t1; -source include/check_slave_is_running.inc; - -connection master; -DROP TABLE t1; ---sync_slave_with_master -connection master; -SET GLOBAL BINLOG_CHECKSUM=default; -connection slave; -SET GLOBAL BINLOG_CHECKSUM=default; -connection master; ---source include/rpl_end.inc +--source extra/rpl_tests/rpl_incident.inc diff --git a/mysql-test/suite/rpl/t/rpl_init_slave_errors.test b/mysql-test/suite/rpl/t/rpl_init_slave_errors.test index 067d21a4e46..6f515b9390a 100644 --- a/mysql-test/suite/rpl/t/rpl_init_slave_errors.test +++ b/mysql-test/suite/rpl/t/rpl_init_slave_errors.test @@ -1,89 +1 @@ -###################################################################### -# Some errors that cause the slave SQL thread to stop are not shown in -# the Slave_SQL_Error column of "SHOW SLAVE STATUS". Instead, the error -# is only in the server's error log. -# -# Two failures and their respective reporting are verified: -# -# 1 - Failures during slave thread initialization -# 2 - Failures while processing queries passed through the init_slave -# option. -# -# In order to check the first type of failure, we inject a fault in the -# SQL/IO Threads through SET GLOBAL debug. -# -# To check the second type, we set @@global.init_slave to an invalid -# command thus preventing the initialization of the SQL Thread. -# -# Obs: -# 1 - Note that testing failures while initializing the relay log position -# is hard as the same function is called before the code reaches the point -# that we want to test. -# -# 2 - This test does not target failures that are reported while applying -# events such as duplicate keys, errors while reading the relay-log.bin*, -# etc. Such errors are already checked on other tests. -###################################################################### - -###################################################################### -# Configuring the Environment -###################################################################### -source include/have_debug.inc; -source include/master-slave.inc; -source include/have_log_bin.inc; - -connection slave; - ---disable_warnings -stop slave; ---enable_warnings -reset slave; - -###################################################################### -# Injecting faults in the threads' initialization -###################################################################### -connection slave; - -# Set debug flags on slave to force errors to occur -SET GLOBAL debug_dbug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; - -start slave; - -# -# slave is going to stop because of emulated failures -# but there won't be any crashes nor asserts hit. -# -# 1593 = ER_SLAVE_FATAL_ERROR ---let $slave_sql_errno= 1593 ---let $show_slave_sql_error= 1 ---source include/wait_for_slave_sql_error.inc - -call mtr.add_suppression("Failed during slave.* thread initialization"); - -SET GLOBAL debug_dbug= ""; - -###################################################################### -# Injecting faults in the init_slave option -###################################################################### -connection slave; - -reset slave; - -SET GLOBAL init_slave= "garbage"; - -start slave; -# 1064 = ER_PARSE_ERROR ---let $slave_sql_errno= 1064 ---let $show_slave_sql_error= 1 ---source include/wait_for_slave_sql_error.inc - -###################################################################### -# Clean up -###################################################################### -SET GLOBAL init_slave= ""; - -# Clean up Last_SQL_Error ---source include/stop_slave_io.inc -RESET SLAVE; ---let $rpl_only_running_threads= 1 ---source include/rpl_end.inc +--source extra/rpl_tests/rpl_init_slave_errors.inc diff --git a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test index d3a5c9f7cc6..8d90afaed27 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test +++ b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test @@ -1,226 +1 @@ -# See if "LOAD DATA LOCAL INFILE" is well replicated -# (LOAD DATA LOCAL INFILE is not written to the binlog -# the same way as LOAD DATA INFILE : Append_blocks are smaller). -# In MySQL 4.0 <4.0.12 there were 2 bugs with LOAD DATA LOCAL INFILE : -# - the loaded file was not written entirely to the master's binlog, -# only the first 4KB, 8KB or 16KB usually. -# - the loaded file's first line was not written entirely to the -# master's binlog (1st char was absent) -source include/master-slave.inc; - -create table t1(a int); -let $1=10000; -disable_query_log; -set SQL_LOG_BIN=0; -while ($1) -{ - insert into t1 values(1); - dec $1; -} -set SQL_LOG_BIN=1; -enable_query_log; -let $MYSQLD_DATADIR= `select @@datadir`; ---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; -#This will generate a 20KB file, now test LOAD DATA LOCAL -truncate table t1; ---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1; ---remove_file $MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile -sync_slave_with_master; -select a,count(*) from t1 group by a; -connection master; -drop table t1; -sync_slave_with_master; - -# End of 4.1 tests - -# -# Now let us test how well we replicate LOAD DATA LOCAL in situation when -# we met duplicates in tables to which we are adding rows. -# (It supposed that LOAD DATA LOCAL ignores such errors) -# -connection master; -create table t1(a int); -insert into t1 values (1), (2), (2), (3); ---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; -drop table t1; -create table t1(a int primary key); ---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1; ---remove_file $MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile -SELECT * FROM t1 ORDER BY a; -save_master_pos; -connection slave; -sync_with_master; -SELECT * FROM t1 ORDER BY a; -connection master; -drop table t1; -save_master_pos; -connection slave; -sync_with_master; - - -# -# Bug22504 load data infile sql statement in replication architecture get error -# ---echo ==== Bug22504 Initialize ==== - ---connection master - -SET sql_mode='ignore_space'; -CREATE TABLE t1(a int); -insert into t1 values (1), (2), (3), (4); ---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; -truncate table t1; ---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1; ---remove_file $MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile -SELECT * FROM t1 ORDER BY a; - -sync_slave_with_master; -SELECT * FROM t1 ORDER BY a; - ---echo ==== Clean up ==== - -connection master; -DROP TABLE t1; - -sync_slave_with_master; - ---echo ---echo Bug #43746: ---echo "return wrong query string when parse 'load data infile' sql statement" ---echo - -connection master; -let $MYSQLD_DATADIR= `select @@datadir`; -SELECT @@SESSION.sql_mode INTO @old_mode; - -SET sql_mode='ignore_space'; - -CREATE TABLE t1(a int); -INSERT INTO t1 VALUES (1), (2), (3), (4); - ---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -eval SELECT * INTO OUTFILE '$MYSQLD_DATADIR/bug43746.sql' FROM t1; -TRUNCATE TABLE t1; - ---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1; - ---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -eval LOAD/* look mum, with comments in weird places! */DATA/* oh hai */LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql'/* we are */INTO/* from the internets */TABLE t1; - ---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -eval LOAD DATA/*!10000 LOCAL */INFILE '$MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1; - ---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql' /*!10000 INTO */ TABLE t1; - ---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql' /*!10000 INTO TABLE */ t1; - ---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -eval LOAD DATA /*!10000 LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql' INTO TABLE */ t1; - ---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -eval LOAD DATA/*!10000 LOCAL */INFILE '$MYSQLD_DATADIR/bug43746.sql'/*!10000 INTO*/TABLE t1; - ---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -eval LOAD DATA/*!10000 LOCAL */INFILE '$MYSQLD_DATADIR/bug43746.sql'/* empty */INTO TABLE t1; - ---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -eval LOAD DATA/*!10000 LOCAL */INFILE '$MYSQLD_DATADIR/bug43746.sql' INTO/* empty */TABLE t1; - ---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -eval LOAD/*!999999 special comments that do not expand */DATA/*!999999 code from the future */LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql'/*!999999 have flux capacitor */INTO/*!999999 will travel */TABLE t1; - -SET sql_mode='PIPES_AS_CONCAT,ANSI_QUOTES,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER'; - ---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1; - -sync_slave_with_master; - ---echo ---echo Bug #59267: ---echo "LOAD DATA LOCAL INFILE not executed on slave with SBR" ---echo - -connection master; - ---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -eval SELECT * INTO OUTFILE '$MYSQLD_DATADIR/bug59267.sql' FROM t1; -TRUNCATE TABLE t1; - ---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug59267.sql' INTO TABLE t1; - -SELECT 'Master', COUNT(*) FROM t1; - ---sync_slave_with_master -SELECT 'Slave', COUNT(*) FROM t1; - -# cleanup -connection master; - ---remove_file $MYSQLD_DATADIR/bug43746.sql ---remove_file $MYSQLD_DATADIR/bug59267.sql - -DROP TABLE t1; -SET SESSION sql_mode=@old_mode; - -sync_slave_with_master; - -connection master; - ---echo ---echo Bug #60580/#11902767: ---echo "statement improperly replicated crashes slave sql thread" ---echo - -connection master; -let $MYSQLD_DATADIR= `select @@datadir`; - -CREATE TABLE t1(f1 INT, f2 INT); -CREATE TABLE t2(f1 INT, f2 TIMESTAMP); - -INSERT INTO t2 VALUES(1, '2011-03-22 21:01:28'); -INSERT INTO t2 VALUES(2, '2011-03-21 21:01:28'); -INSERT INTO t2 VALUES(3, '2011-03-20 21:01:28'); - -CREATE TABLE t3 AS SELECT * FROM t2; - -CREATE VIEW v1 AS SELECT * FROM t2 - WHERE f1 IN (SELECT f1 FROM t3 WHERE (t3.f2 IS NULL)); - ---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -eval SELECT 1 INTO OUTFILE '$MYSQLD_DATADIR/bug60580.csv' FROM DUAL; - ---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug60580.csv' INTO TABLE t1 (@f1) SET f2 = (SELECT f1 FROM v1 WHERE f1=@f1); - -SELECT * FROM t1; - -sleep 1; - -sync_slave_with_master; - -SELECT * FROM t1; - ---remove_file $MYSQLD_DATADIR/bug60580.csv - -connection master; - -DROP VIEW v1; -DROP TABLE t1, t2, t3; - -sync_slave_with_master; - -connection master; ---source include/rpl_end.inc - ---echo # End of 5.1 tests +--source extra/rpl_tests/rpl_loaddata_local.inc diff --git a/mysql-test/suite/rpl/t/rpl_loadfile.test b/mysql-test/suite/rpl/t/rpl_loadfile.test index 30a7ae2f613..babf4208b3d 100644 --- a/mysql-test/suite/rpl/t/rpl_loadfile.test +++ b/mysql-test/suite/rpl/t/rpl_loadfile.test @@ -1,114 +1 @@ -############################################################################# -# Original Author: JBM # -# Original Date: Aug/18/2005 # -############################################################################# -# TEST: To test the LOAD_FILE() in rbr # -############################################################################# -# Change Author: JBM -# Change Date: 2006-01-16 -########## - -# Includes --- source include/have_binlog_format_mixed_or_row.inc --- source include/master-slave.inc - --- source extra/rpl_tests/rpl_loadfile.test - -# BUG#39701: Mixed binlog format does not switch to row mode on LOAD_FILE -# -# DESCRIPTION -# -# Problem: when using load_file string function and mixed binlogging format -# there was no switch to row based binlogging format. This leads -# to scenarios on which the slave replicates the statement and it -# will try to load the file from local file system, which in most -# likely it will not exist. -# -# Solution: -# Marking this function as unsafe for statement format, makes the -# statement using it to be logged in row based format. As such, data -# replicated from the master, becomes the content of the loaded file. -# Consequently, the slave receives the necessary data to complete -# the load_file instruction correctly. -# -# IMPLEMENTATION -# -# The test is implemented as follows: -# -# On Master, -# i) write to file the desired content. -# ii) create table and stored procedure with load_file -# iii) stop slave -# iii) execute load_file -# iv) remove file -# -# On Slave, -# v) start slave -# vi) sync it with master so that it gets the updates from binlog (which -# should have bin logged in row format). -# -# If the the binlog format does not change to row, then the assertion -# done in the following step fails. This happens because tables differ -# since the file does not exist anymore, meaning that when slave -# attempts to execute LOAD_FILE statement it inserts NULL on table -# instead of the same contents that the master loaded when it executed -# the procedure (which was executed when file existed). -# -# vii) assert that the contents of master and slave -# table are the same - ---source include/rpl_reset.inc - -connection master; -let $file= $MYSQLTEST_VARDIR/tmp/bug_39701.data; - ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---eval SELECT repeat('x',20) INTO OUTFILE '$file' - -disable_warnings; -DROP TABLE IF EXISTS t1; -enable_warnings; - -CREATE TABLE t1 (t text); -DELIMITER |; -CREATE PROCEDURE p(file varchar(4096)) - BEGIN - INSERT INTO t1 VALUES (LOAD_FILE(file)); - END| -DELIMITER ;| - -# stop slave before issuing the load_file on master -connection slave; -source include/stop_slave.inc; - -connection master; - -# test: check that logging falls back to rbr. ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---eval CALL p('$file') - -# test: remove the file from the filesystem and assert that slave still -# gets the loaded file -remove_file $file; - -# now that the file is removed it is safe (regarding what we want to test) -# to start slave -connection slave; -source include/start_slave.inc; - -connection master; -sync_slave_with_master; - -# assertion: assert that the slave got the updates even -# if the file was removed before the slave started, -# meaning that contents were indeed transfered -# through binlog (in row format) -let $diff_tables= master:t1, slave:t1; -source include/diff_tables.inc; - -# CLEAN UP ---connection master -DROP TABLE t1; -DROP PROCEDURE p; - ---source include/rpl_end.inc +--source extra/rpl_tests/rpl_loadfile.inc diff --git a/mysql-test/suite/rpl/t/rpl_mdev10863.test b/mysql-test/suite/rpl/t/rpl_mdev10863.test new file mode 100644 index 00000000000..796e770672d --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_mdev10863.test @@ -0,0 +1,104 @@ +--source include/have_innodb.inc +--let $rpl_topology=1->2 +--source include/rpl_init.inc + +# Test various aspects of parallel replication. + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +SET @old_max_relay= @@GLOBAL.max_relay_log_size; +SET GLOBAL max_relay_log_size = 4096; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t1 (a int PRIMARY KEY, b VARCHAR(100)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, "a"); +--save_master_pos + +--connection server_2 +--sync_with_master + +--echo *** Create a long transaction that will span a relay log file. *** +--connection server_1 + +# Add some transactions in separate domains, that will cause the need to +# have a multi-valued restart position in the relay log for the SQL thread. +SET @old_domain= @@gtid_domain_id; +SET gtid_domain_id=10; +INSERT INTO t1 VALUES (10000, "domain 10"); +SET gtid_domain_id=20; +INSERT INTO t1 VALUES (20000, "domain 20"); +SET gtid_domain_id=@old_domain; + +BEGIN; +--echo [lots of inserts omitted] +--disable_query_log +--let $count = 500 +while ($count) { + eval INSERT INTO t1 VALUES (1000+$count, REPEAT("hulubulu??!?", 8)); + dec $count; +} +--enable_query_log +COMMIT; + +--save_master_pos + +--connection server_2 +--sync_with_master + +--connection server_1 +# Now do another one, to make the inuse_relaylog proceed to somewhere inside +# the first large transaction. + +BEGIN; +--echo [lots of inserts omitted] +--disable_query_log +--let $count = 500 +while ($count) { + eval INSERT INTO t1 VALUES (2000+$count, REPEAT("hulubulu??!?", 8)); + dec $count; +} +--enable_query_log +COMMIT; + +--save_master_pos + +--connection server_2 +--sync_with_master + + +# Stop and restart the SQL thread only. +# The bug was that the SQL thread would restart at the start +# of a relay log file, which could be in the middle of an event group. +# This way, part of that event group could be wrongly re-applied. + +--source include/stop_slave_sql.inc +START SLAVE SQL_THREAD; +--source include/wait_for_slave_to_start.inc + + +--connection server_1 +INSERT INTO t1 VALUES (100000, "More stuffs."); +INSERT INTO t1 VALUES (100001, "And even more"); +--save_master_pos + +--connection server_2 +--sync_with_master +SELECT * FROM t1 WHERE a >= 100000 ORDER BY a; + + +# Clean up. +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +SET GLOBAL max_relay_log_size= @old_max_relay; +--source include/start_slave.inc + +--connection server_1 +DROP TABLE t1; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_packet.test b/mysql-test/suite/rpl/t/rpl_packet.test index 0e74481bb61..31357cb148e 100644 --- a/mysql-test/suite/rpl/t/rpl_packet.test +++ b/mysql-test/suite/rpl/t/rpl_packet.test @@ -1,177 +1 @@ -# ==== Purpose ==== -# -# Check replication protocol packet size handling -# -# ==== Related bugs ==== -# Bug#19402 SQL close to the size of the max_allowed_packet fails on slave -# BUG#23755: Replicated event larger that max_allowed_packet infinitely re-transmits -# BUG#42914: No LAST_IO_ERROR for max_allowed_packet errors -# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET - -# max-out size db name -source include/master-slave.inc; -source include/have_binlog_format_row.inc; -call mtr.add_suppression("Slave I/O: Got a packet bigger than 'slave_max_allowed_packet' bytes, .*error.* 1153"); -call mtr.add_suppression("Log entry on master is longer than slave_max_allowed_packet"); -let $db= DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________; -disable_warnings; -eval drop database if exists $db; -enable_warnings; -eval create database $db; - -connection master; -let $old_max_allowed_packet= `SELECT @@global.max_allowed_packet`; -let $old_net_buffer_length= `SELECT @@global.net_buffer_length`; -let $old_slave_max_allowed_packet= `SELECT @@global.slave_max_allowed_packet`; -SET @@global.max_allowed_packet=1024; -SET @@global.net_buffer_length=1024; - -sync_slave_with_master; -# Restart slave for setting to take effect -source include/stop_slave.inc; -source include/start_slave.inc; - -# Reconnect to master for new setting to take effect -disconnect master; - -# alas, can't use eval here; if db name changed apply the change here -connect (master,localhost,root,,DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________); - -connection master; -select @@net_buffer_length, @@max_allowed_packet; - -create table `t1` (`f1` LONGTEXT) ENGINE=MyISAM; - -INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1023'); -sync_slave_with_master; - -eval select count(*) from `$db`.`t1` /* must be 1 */; - -SHOW STATUS LIKE 'Slave_running'; -select * from information_schema.session_status where variable_name= 'SLAVE_RUNNING'; -connection master; -eval drop database $db; -sync_slave_with_master; - -# -# Bug #23755: Replicated event larger that max_allowed_packet infinitely re-transmits -# -# Check that a situation when the size of event on the master is greater than -# max_allowed_packet on the slave does not lead to infinite re-transmits. - -connection master; - -# Change the max packet size on master - -SET @@global.max_allowed_packet=4096; -SET @@global.net_buffer_length=4096; - -# Restart slave for new setting to take effect -connection slave; -source include/stop_slave.inc; -source include/start_slave.inc; - -# Reconnect to master for new setting to take effect -disconnect master; -connect (master, localhost, root); -connection master; - -CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM; - -sync_slave_with_master; - -connection master; - -INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048'); - - -# -# Bug#42914: The slave I/O thread must stop after trying to read the above -# event, However there is no Last_IO_Error report. -# - -# The slave I/O thread must stop after trying to read the above event -connection slave; -# 1153 = ER_NET_PACKET_TOO_LARGE ---let $slave_io_errno= 1153 ---let $show_slave_io_error= 1 ---source include/wait_for_slave_io_error.inc - -# TODO: this is needed because of BUG#55790. Remove once that is fixed. ---source include/stop_slave_sql.inc - -# -# Bug#42914: On the master, if a binary log event is larger than -# max_allowed_packet, the error message ER_MASTER_FATAL_ERROR_READING_BINLOG -# is sent to a slave when it requests a dump from the master, thus leading the -# I/O thread to stop. However, there is no Last_IO_Error reported. -# - ---let $rpl_only_running_threads= 1 ---source include/rpl_reset.inc ---connection master -DROP TABLE t1; ---sync_slave_with_master - - -connection master; -CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM; -sync_slave_with_master; - -connection master; -INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), REPEAT('b', @@global.max_allowed_packet)); - -connection slave; -# The slave I/O thread must stop after receiving -# 1153 = ER_NET_PACKET_TOO_LARGE ---let $slave_io_errno= 1153 ---let $show_slave_io_error= 1 ---source include/wait_for_slave_io_error.inc - -# Remove the bad binlog and clear error status on slave. -STOP SLAVE; -RESET SLAVE; ---connection master -RESET MASTER; - - -# -# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET -# -# In BUG#55322, @@session.max_allowed_packet increased each time SHOW -# BINLOG EVENTS was issued. To verify that this bug is fixed, we -# execute SHOW BINLOG EVENTS twice and check that max_allowed_packet -# never changes. We turn off the result log because we don't care -# about the contents of the binlog. - ---disable_result_log -SET @max_allowed_packet_0= @@session.max_allowed_packet; -SHOW BINLOG EVENTS; -SET @max_allowed_packet_1= @@session.max_allowed_packet; -SHOW BINLOG EVENTS; -SET @max_allowed_packet_2= @@session.max_allowed_packet; ---enable_result_log -if (`SELECT NOT(@max_allowed_packet_0 = @max_allowed_packet_1 AND @max_allowed_packet_1 = @max_allowed_packet_2)`) -{ - --echo ERROR: max_allowed_packet changed after executing SHOW BINLOG EVENTS - --source include/show_rpl_debug_info.inc - SELECT @max_allowed_packet_0, @max_allowed_packet_1, @max_allowed_packet_2; - --die @max_allowed_packet changed after executing SHOW BINLOG EVENTS -} - - ---echo ==== clean up ==== -connection master; -DROP TABLE t1; -eval SET @@global.max_allowed_packet= $old_max_allowed_packet; -eval SET @@global.net_buffer_length= $old_net_buffer_length; -eval SET @@global.slave_max_allowed_packet= $old_slave_max_allowed_packet; -# slave is stopped -connection slave; -DROP TABLE t1; - -# Clear Last_IO_Error -RESET SLAVE; - ---source include/rpl_end.inc -# End of tests +--source extra/rpl_tests/rpl_packet.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel.test b/mysql-test/suite/rpl/t/rpl_parallel.test index 5d2232269cc..b7c4bb429a4 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel.test +++ b/mysql-test/suite/rpl/t/rpl_parallel.test @@ -1,2212 +1 @@ ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/master-slave.inc - -# Test various aspects of parallel replication. - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; ---error ER_SLAVE_MUST_STOP -SET GLOBAL slave_parallel_threads=10; ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=10; - -# Check that we do not spawn any worker threads when no slave is running. -SELECT IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; - -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - -# Check that worker threads get spawned when slave starts. -SELECT IF(COUNT(*) >= 10, "OK", CONCAT("Found too few system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; -# ... and that worker threads get removed when slave stops. ---source include/stop_slave.inc -SELECT IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; ---source include/start_slave.inc -SELECT IF(COUNT(*) >= 10, "OK", CONCAT("Found too few system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; - ---echo *** Test long-running query in domain 1 can run in parallel with short queries in domain 0 *** - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; -CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1); -INSERT INTO t2 VALUES (1); ---save_master_pos - ---connection server_2 ---sync_with_master - -# Block the table t1 to simulate a replicated query taking a long time. ---connect (con_temp1,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -LOCK TABLE t1 WRITE; - ---connection server_1 -SET gtid_domain_id=1; -# This query will be blocked on the slave until UNLOCK TABLES. -INSERT INTO t1 VALUES (2); -SET gtid_domain_id=0; -# These t2 queries can be replicated in parallel with the prior t1 query, as -# they are in a separate replication domain. -INSERT INTO t2 VALUES (2); -INSERT INTO t2 VALUES (3); -BEGIN; -INSERT INTO t2 VALUES (4); -INSERT INTO t2 VALUES (5); -COMMIT; -INSERT INTO t2 VALUES (6); - ---connection server_2 ---let $wait_condition= SELECT COUNT(*) = 6 FROM t2 ---source include/wait_condition.inc - -SELECT * FROM t2 ORDER by a; - ---connection con_temp1 -SELECT * FROM t1; -UNLOCK TABLES; - ---connection server_2 ---let $wait_condition= SELECT COUNT(*) = 2 FROM t1 ---source include/wait_condition.inc - -SELECT * FROM t1 ORDER BY a; - - ---echo *** Test two transactions in different domains committed in opposite order on slave but in a single group commit. *** ---connection server_2 ---source include/stop_slave.inc - ---connection server_1 -# Use a stored function to inject a debug_sync into the appropriate THD. -# The function does nothing on the master, and on the slave it injects the -# desired debug_sync action(s). -SET sql_log_bin=0; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - -SET @old_format= @@SESSION.binlog_format; -SET binlog_format='statement'; -SET gtid_domain_id=1; -INSERT INTO t2 VALUES (foo(10, - 'commit_before_enqueue SIGNAL ready1 WAIT_FOR cont1', - 'commit_after_release_LOCK_prepare_ordered SIGNAL ready2')); - ---connection server_2 -FLUSH LOGS; ---source include/wait_for_binlog_checkpoint.inc -SET sql_log_bin=0; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - IF d1 != '' THEN - SET debug_sync = d1; - END IF; - IF d2 != '' THEN - SET debug_sync = d2; - END IF; - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; -SET @old_format=@@GLOBAL.binlog_format; -SET GLOBAL binlog_format=statement; -# We need to restart all parallel threads for the new global setting to -# be copied to the session-level values. -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; ---source include/start_slave.inc - -# First make sure the first insert is ready to commit, but not queued yet. -SET debug_sync='now WAIT_FOR ready1'; - ---connection server_1 -SET gtid_domain_id=2; -INSERT INTO t2 VALUES (foo(11, - 'commit_before_enqueue SIGNAL ready3 WAIT_FOR cont3', - 'commit_after_release_LOCK_prepare_ordered SIGNAL ready4 WAIT_FOR cont4')); -SET gtid_domain_id=0; -SELECT * FROM t2 WHERE a >= 10 ORDER BY a; - ---connection server_2 -# Now wait for the second insert to queue itself as the leader, and then -# wait for more commits to queue up. -SET debug_sync='now WAIT_FOR ready3'; -SET debug_sync='now SIGNAL cont3'; -SET debug_sync='now WAIT_FOR ready4'; -# Now allow the first insert to queue up to participate in group commit. -SET debug_sync='now SIGNAL cont1'; -SET debug_sync='now WAIT_FOR ready2'; -# Finally allow the second insert to proceed and do the group commit. -SET debug_sync='now SIGNAL cont4'; - ---let $wait_condition= SELECT COUNT(*) = 2 FROM t2 WHERE a >= 10 ---source include/wait_condition.inc -SELECT * FROM t2 WHERE a >= 10 ORDER BY a; -# The two INSERT transactions should have been committed in opposite order, -# but in the same group commit (seen by precense of cid=# in the SHOW -# BINLOG output). ---let $binlog_file= slave-bin.000002 ---source include/show_binlog_events.inc -FLUSH LOGS; ---source include/wait_for_binlog_checkpoint.inc - -# Restart all the slave parallel worker threads, to clear all debug_sync actions. ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; -SET debug_sync='RESET'; ---source include/start_slave.inc - - ---echo *** Test that group-committed transactions on the master can replicate in parallel on the slave. *** ---connection server_1 -SET debug_sync='RESET'; -FLUSH LOGS; ---source include/wait_for_binlog_checkpoint.inc -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; -# Create some sentinel rows so that the rows inserted in parallel fall into -# separate gaps and do not cause gap lock conflicts. -INSERT INTO t3 VALUES (1,1), (3,3), (5,5), (7,7); ---save_master_pos ---connection server_2 ---sync_with_master - -# We want to test that the transactions can execute out-of-order on -# the slave, but still end up committing in-order, and in a single -# group commit. -# -# The idea is to group-commit three transactions together on the master: -# A, B, and C. On the slave, C will execute the insert first, then A, -# and then B. But B manages to complete before A has time to commit, so -# all three end up committing together. -# -# So we start by setting up some row locks that will block transactions -# A and B from executing, allowing C to run first. - ---connection con_temp1 -BEGIN; -INSERT INTO t3 VALUES (2,102); ---connect (con_temp2,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -BEGIN; -INSERT INTO t3 VALUES (4,104); - -# On the master, queue three INSERT transactions as a single group commit. ---connect (con_temp3,127.0.0.1,root,,test,$SERVER_MYPORT_1,) -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -SET binlog_format=statement; -send INSERT INTO t3 VALUES (2, foo(12, - 'commit_after_release_LOCK_prepare_ordered SIGNAL slave_queued1 WAIT_FOR slave_cont1', - '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connect (con_temp4,127.0.0.1,root,,test,$SERVER_MYPORT_1,) -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -SET binlog_format=statement; -send INSERT INTO t3 VALUES (4, foo(14, - 'commit_after_release_LOCK_prepare_ordered SIGNAL slave_queued2', - '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; - ---connect (con_temp5,127.0.0.1,root,,test,$SERVER_MYPORT_1,) -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; -SET binlog_format=statement; -send INSERT INTO t3 VALUES (6, foo(16, - 'group_commit_waiting_for_prior SIGNAL slave_queued3', - '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued3'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con_temp3 -REAP; ---connection con_temp4 -REAP; ---connection con_temp5 -REAP; -SET debug_sync='RESET'; - ---connection server_1 -SELECT * FROM t3 ORDER BY a; ---let $binlog_file= master-bin.000002 ---source include/show_binlog_events.inc - -# First, wait until insert 3 is ready to queue up for group commit, but is -# waiting for insert 2 to commit before it can do so itself. ---connection server_2 -SET debug_sync='now WAIT_FOR slave_queued3'; - -# Next, let insert 1 proceed, and allow it to queue up as the group commit -# leader, but let it wait for insert 2 to also queue up before proceeding. ---connection con_temp1 -ROLLBACK; ---connection server_2 -SET debug_sync='now WAIT_FOR slave_queued1'; - -# Now let insert 2 proceed and queue up. ---connection con_temp2 -ROLLBACK; ---connection server_2 -SET debug_sync='now WAIT_FOR slave_queued2'; -# And finally, we can let insert 1 proceed and do the group commit with all -# three insert transactions together. -SET debug_sync='now SIGNAL slave_cont1'; - -# Wait for the commit to complete and check that all three transactions -# group-committed together (will be seen in the binlog as all three having -# cid=# on their GTID event). ---let $wait_condition= SELECT COUNT(*) = 3 FROM t3 WHERE a IN (2,4,6) ---source include/wait_condition.inc -SELECT * FROM t3 ORDER BY a; ---let $binlog_file= slave-bin.000003 ---source include/show_binlog_events.inc - - ---echo *** Test STOP SLAVE in parallel mode *** ---connection server_2 ---source include/stop_slave.inc -# Respawn all worker threads to clear any left-over debug_sync or other stuff. -SET debug_sync='RESET'; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; - ---connection server_1 -# Set up a couple of transactions. The first will be blocked halfway -# through on a lock, and while it is blocked we initiate STOP SLAVE. -# We then test that the halfway-initiated transaction is allowed to -# complete, but no subsequent ones. -# We have to use statement-based mode and set -# binlog_direct_non_transactional_updates=0; otherwise the binlog will -# be split into two event groups, one for the MyISAM part and one for the -# InnoDB part. -SET binlog_direct_non_transactional_updates=0; -SET sql_log_bin=0; -CALL mtr.add_suppression("Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction"); -SET sql_log_bin=1; -BEGIN; -INSERT INTO t2 VALUES (20); ---disable_warnings -INSERT INTO t1 VALUES (20); ---enable_warnings -INSERT INTO t2 VALUES (21); -INSERT INTO t3 VALUES (20, 20); -COMMIT; -INSERT INTO t3 VALUES(21, 21); -INSERT INTO t3 VALUES(22, 22); -SET binlog_format=@old_format; ---save_master_pos - -# Start a connection that will block the replicated transaction halfway. ---connection con_temp1 -BEGIN; -INSERT INTO t2 VALUES (21); - ---connection server_2 -START SLAVE; -# Wait for the MyISAM change to be visible, after which replication will wait -# for con_temp1 to roll back. ---let $wait_condition= SELECT COUNT(*) = 1 FROM t1 WHERE a=20 ---source include/wait_condition.inc - ---connection con_temp2 -# Initiate slave stop. It will have to wait for the current event group -# to complete. -# The dbug injection causes debug_sync to signal 'wait_for_done_waiting' -# when the SQL driver thread is ready. -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug="+d,rpl_parallel_wait_for_done_trigger"; -send STOP SLAVE; - ---connection con_temp1 -SET debug_sync='now WAIT_FOR wait_for_done_waiting'; -ROLLBACK; - ---connection con_temp2 -reap; -SET GLOBAL debug_dbug=@old_dbug; -SET debug_sync='RESET'; - ---connection server_2 ---source include/wait_for_slave_to_stop.inc -# We should see the first transaction applied, but not the two others. -SELECT * FROM t1 WHERE a >= 20 ORDER BY a; -SELECT * FROM t2 WHERE a >= 20 ORDER BY a; -SELECT * FROM t3 WHERE a >= 20 ORDER BY a; - ---source include/start_slave.inc ---sync_with_master -SELECT * FROM t1 WHERE a >= 20 ORDER BY a; -SELECT * FROM t2 WHERE a >= 20 ORDER BY a; -SELECT * FROM t3 WHERE a >= 20 ORDER BY a; - - ---connection server_2 -# Respawn all worker threads to clear any left-over debug_sync or other stuff. ---source include/stop_slave.inc -SET GLOBAL binlog_format=@old_format; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; ---source include/start_slave.inc - - ---echo *** Test killing slave threads at various wait points *** ---echo *** 1. Test killing transaction waiting in commit for previous transaction to commit *** - -# Set up three transactions on the master that will be group-committed -# together so they can be replicated in parallel on the slave. ---connection con_temp3 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -SET binlog_format=statement; -send INSERT INTO t3 VALUES (31, foo(31, - 'commit_before_prepare_ordered WAIT_FOR t2_waiting', - 'commit_after_prepare_ordered SIGNAL t1_ready WAIT_FOR t1_cont')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con_temp4 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -SET binlog_format=statement; -BEGIN; -# This insert is just so we can get T2 to wait while a query is running that we -# can see in SHOW PROCESSLIST so we can get its thread_id to kill later. -INSERT INTO t3 VALUES (32, foo(32, - 'ha_write_row_end SIGNAL t2_query WAIT_FOR t2_cont', - '')); -# This insert sets up debug_sync points so that T2 will tell when it is at its -# wait point where we want to kill it - and when it has been killed. -INSERT INTO t3 VALUES (33, foo(33, - 'group_commit_waiting_for_prior SIGNAL t2_waiting', - 'group_commit_waiting_for_prior_killed SIGNAL t2_killed')); -send COMMIT; - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; - ---connection con_temp5 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; -SET binlog_format=statement; -send INSERT INTO t3 VALUES (34, foo(34, - '', - '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued3'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con_temp3 -REAP; ---connection con_temp4 -REAP; ---connection con_temp5 -REAP; - ---connection server_1 -SELECT * FROM t3 WHERE a >= 30 ORDER BY a; -SET debug_sync='RESET'; - ---connection server_2 -SET sql_log_bin=0; -CALL mtr.add_suppression("Query execution was interrupted"); -CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); -CALL mtr.add_suppression("Slave: Connection was killed"); -SET sql_log_bin=1; -# Wait until T2 is inside executing its insert of 32, then find it in SHOW -# PROCESSLIST to know its thread id for KILL later. -SET debug_sync='now WAIT_FOR t2_query'; ---let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(32%' AND INFO NOT LIKE '%LIKE%'` -SET debug_sync='now SIGNAL t2_cont'; - -# Wait until T2 has entered its wait for T1 to commit, and T1 has -# progressed into its commit phase. -SET debug_sync='now WAIT_FOR t1_ready'; - -# Now kill the transaction T2. ---replace_result $thd_id THD_ID -eval KILL $thd_id; - -# Wait until T2 has reacted on the kill. -SET debug_sync='now WAIT_FOR t2_killed'; - -# Now we can allow T1 to proceed. -SET debug_sync='now SIGNAL t1_cont'; - ---let $slave_sql_errno= 1317,1927,1964 ---source include/wait_for_slave_sql_error.inc -STOP SLAVE IO_THREAD; -SELECT * FROM t3 WHERE a >= 30 ORDER BY a; - -# Now we have to disable the debug_sync statements, so they do not trigger -# when the events are retried. -SET debug_sync='RESET'; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; -SET sql_log_bin=0; -DROP FUNCTION foo; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---connection server_1 -INSERT INTO t3 VALUES (39,0); ---save_master_pos - ---connection server_2 ---source include/start_slave.inc ---sync_with_master -SELECT * FROM t3 WHERE a >= 30 ORDER BY a; -# Restore the foo() function. -SET sql_log_bin=0; -DROP FUNCTION foo; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - IF d1 != '' THEN - SET debug_sync = d1; - END IF; - IF d2 != '' THEN - SET debug_sync = d2; - END IF; - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - - ---connection server_2 -# Respawn all worker threads to clear any left-over debug_sync or other stuff. ---source include/stop_slave.inc -SET GLOBAL binlog_format=@old_format; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; ---source include/start_slave.inc - - ---echo *** 2. Same as (1), but without restarting IO thread after kill of SQL threads *** - -# Set up three transactions on the master that will be group-committed -# together so they can be replicated in parallel on the slave. ---connection con_temp3 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -SET binlog_format=statement; -send INSERT INTO t3 VALUES (41, foo(41, - 'commit_before_prepare_ordered WAIT_FOR t2_waiting', - 'commit_after_prepare_ordered SIGNAL t1_ready WAIT_FOR t1_cont')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con_temp4 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -SET binlog_format=statement; -BEGIN; -# This insert is just so we can get T2 to wait while a query is running that we -# can see in SHOW PROCESSLIST so we can get its thread_id to kill later. -INSERT INTO t3 VALUES (42, foo(42, - 'ha_write_row_end SIGNAL t2_query WAIT_FOR t2_cont', - '')); -# This insert sets up debug_sync points so that T2 will tell when it is at its -# wait point where we want to kill it - and when it has been killed. -INSERT INTO t3 VALUES (43, foo(43, - 'group_commit_waiting_for_prior SIGNAL t2_waiting', - 'group_commit_waiting_for_prior_killed SIGNAL t2_killed')); -send COMMIT; - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; - ---connection con_temp5 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; -SET binlog_format=statement; -send INSERT INTO t3 VALUES (44, foo(44, - '', - '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued3'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con_temp3 -REAP; ---connection con_temp4 -REAP; ---connection con_temp5 -REAP; - ---connection server_1 -SELECT * FROM t3 WHERE a >= 40 ORDER BY a; -SET debug_sync='RESET'; - ---connection server_2 -# Wait until T2 is inside executing its insert of 42, then find it in SHOW -# PROCESSLIST to know its thread id for KILL later. -SET debug_sync='now WAIT_FOR t2_query'; ---let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(42%' AND INFO NOT LIKE '%LIKE%'` -SET debug_sync='now SIGNAL t2_cont'; - -# Wait until T2 has entered its wait for T1 to commit, and T1 has -# progressed into its commit phase. -SET debug_sync='now WAIT_FOR t1_ready'; - -# Now kill the transaction T2. ---replace_result $thd_id THD_ID -eval KILL $thd_id; - -# Wait until T2 has reacted on the kill. -SET debug_sync='now WAIT_FOR t2_killed'; - -# Now we can allow T1 to proceed. -SET debug_sync='now SIGNAL t1_cont'; - ---let $slave_sql_errno= 1317,1927,1964 ---source include/wait_for_slave_sql_error.inc - -# Now we have to disable the debug_sync statements, so they do not trigger -# when the events are retried. -SET debug_sync='RESET'; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; -SET sql_log_bin=0; -DROP FUNCTION foo; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---connection server_1 -INSERT INTO t3 VALUES (49,0); ---save_master_pos - ---connection server_2 -START SLAVE SQL_THREAD; ---sync_with_master -SELECT * FROM t3 WHERE a >= 40 ORDER BY a; -# Restore the foo() function. -SET sql_log_bin=0; -DROP FUNCTION foo; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - IF d1 != '' THEN - SET debug_sync = d1; - END IF; - IF d2 != '' THEN - SET debug_sync = d2; - END IF; - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - - ---connection server_2 -# Respawn all worker threads to clear any left-over debug_sync or other stuff. ---source include/stop_slave.inc -SET GLOBAL binlog_format=@old_format; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; ---source include/start_slave.inc - - ---echo *** 3. Same as (2), but not using gtid mode *** - ---connection server_2 ---source include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=no; ---source include/start_slave.inc - ---connection server_1 -# Set up three transactions on the master that will be group-committed -# together so they can be replicated in parallel on the slave. ---connection con_temp3 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -SET binlog_format=statement; -send INSERT INTO t3 VALUES (51, foo(51, - 'commit_before_prepare_ordered WAIT_FOR t2_waiting', - 'commit_after_prepare_ordered SIGNAL t1_ready WAIT_FOR t1_cont')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con_temp4 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -SET binlog_format=statement; -BEGIN; -# This insert is just so we can get T2 to wait while a query is running that we -# can see in SHOW PROCESSLIST so we can get its thread_id to kill later. -INSERT INTO t3 VALUES (52, foo(52, - 'ha_write_row_end SIGNAL t2_query WAIT_FOR t2_cont', - '')); -# This insert sets up debug_sync points so that T2 will tell when it is at its -# wait point where we want to kill it - and when it has been killed. -INSERT INTO t3 VALUES (53, foo(53, - 'group_commit_waiting_for_prior SIGNAL t2_waiting', - 'group_commit_waiting_for_prior_killed SIGNAL t2_killed')); -send COMMIT; - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; - ---connection con_temp5 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; -SET binlog_format=statement; -send INSERT INTO t3 VALUES (54, foo(54, - '', - '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued3'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con_temp3 -REAP; ---connection con_temp4 -REAP; ---connection con_temp5 -REAP; - ---connection server_1 -SELECT * FROM t3 WHERE a >= 50 ORDER BY a; -SET debug_sync='RESET'; - ---connection server_2 -# Wait until T2 is inside executing its insert of 52, then find it in SHOW -# PROCESSLIST to know its thread id for KILL later. -SET debug_sync='now WAIT_FOR t2_query'; ---let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(52%' AND INFO NOT LIKE '%LIKE%'` -SET debug_sync='now SIGNAL t2_cont'; - -# Wait until T2 has entered its wait for T1 to commit, and T1 has -# progressed into its commit phase. -SET debug_sync='now WAIT_FOR t1_ready'; - -# Now kill the transaction T2. ---replace_result $thd_id THD_ID -eval KILL $thd_id; - -# Wait until T2 has reacted on the kill. -SET debug_sync='now WAIT_FOR t2_killed'; - -# Now we can allow T1 to proceed. -SET debug_sync='now SIGNAL t1_cont'; - ---let $slave_sql_errno= 1317,1927,1964 ---source include/wait_for_slave_sql_error.inc -SELECT * FROM t3 WHERE a >= 50 ORDER BY a; - -# Now we have to disable the debug_sync statements, so they do not trigger -# when the events are retried. -SET debug_sync='RESET'; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; -SET sql_log_bin=0; -DROP FUNCTION foo; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---connection server_1 -INSERT INTO t3 VALUES (59,0); ---save_master_pos - ---connection server_2 -START SLAVE SQL_THREAD; ---sync_with_master -SELECT * FROM t3 WHERE a >= 50 ORDER BY a; -# Restore the foo() function. -SET sql_log_bin=0; -DROP FUNCTION foo; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - IF d1 != '' THEN - SET debug_sync = d1; - END IF; - IF d2 != '' THEN - SET debug_sync = d2; - END IF; - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - - ---source include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_2 -# Respawn all worker threads to clear any left-over debug_sync or other stuff. ---source include/stop_slave.inc -SET GLOBAL binlog_format=@old_format; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=4; ---source include/start_slave.inc - - ---echo *** 4. Test killing thread that is waiting to start transaction until previous transaction commits *** - -# We set up four transactions T1, T2, T3, and T4 on the master. T2, T3, and T4 -# can run in parallel with each other (same group commit and commit id), -# but not in parallel with T1. -# -# We use four worker threads, each Ti will be queued on each their own -# worker thread. We will delay T1 commit, T3 will wait for T1 to begin -# commit before it can start. We will kill T3 during this wait, and -# check that everything works correctly. -# -# It is rather tricky to get the correct thread id of the worker to kill. -# We start by injecting four dummy transactions in a debug_sync-controlled -# manner to be able to get known thread ids for the workers in a pool with -# just 4 worker threads. Then we let in each of the real test transactions -# T1-T4 one at a time in a way which allows us to know which transaction -# ends up with which thread id. - ---connection server_1 -SET binlog_format=statement; -SET gtid_domain_id=2; -BEGIN; -# This debug_sync will linger on and be used to control T4 later. -INSERT INTO t3 VALUES (70, foo(70, - 'rpl_parallel_start_waiting_for_prior SIGNAL t4_waiting', '')); -INSERT INTO t3 VALUES (60, foo(60, - 'ha_write_row_end SIGNAL d2_query WAIT_FOR d2_cont2', - 'rpl_parallel_end_of_group SIGNAL d2_done WAIT_FOR d2_cont')); -COMMIT; -SET gtid_domain_id=0; - ---connection server_2 -SET debug_sync='now WAIT_FOR d2_query'; ---let $d2_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(60%' AND INFO NOT LIKE '%LIKE%'` - ---connection server_1 -SET gtid_domain_id=1; -BEGIN; -# These debug_sync's will linger on and be used to control T3 later. -INSERT INTO t3 VALUES (61, foo(61, - 'rpl_parallel_start_waiting_for_prior SIGNAL t3_waiting', - 'rpl_parallel_start_waiting_for_prior_killed SIGNAL t3_killed')); -INSERT INTO t3 VALUES (62, foo(62, - 'ha_write_row_end SIGNAL d1_query WAIT_FOR d1_cont2', - 'rpl_parallel_end_of_group SIGNAL d1_done WAIT_FOR d1_cont')); -COMMIT; -SET gtid_domain_id=0; - ---connection server_2 -SET debug_sync='now WAIT_FOR d1_query'; ---let $d1_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(62%' AND INFO NOT LIKE '%LIKE%'` - ---connection server_1 -SET gtid_domain_id=0; -INSERT INTO t3 VALUES (63, foo(63, - 'ha_write_row_end SIGNAL d0_query WAIT_FOR d0_cont2', - 'rpl_parallel_end_of_group SIGNAL d0_done WAIT_FOR d0_cont')); - ---connection server_2 -SET debug_sync='now WAIT_FOR d0_query'; ---let $d0_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(63%' AND INFO NOT LIKE '%LIKE%'` - ---connection server_1 -SET gtid_domain_id=3; -BEGIN; -# These debug_sync's will linger on and be used to control T2 later. -INSERT INTO t3 VALUES (68, foo(68, - 'rpl_parallel_start_waiting_for_prior SIGNAL t2_waiting', '')); -INSERT INTO t3 VALUES (69, foo(69, - 'ha_write_row_end SIGNAL d3_query WAIT_FOR d3_cont2', - 'rpl_parallel_end_of_group SIGNAL d3_done WAIT_FOR d3_cont')); -COMMIT; -SET gtid_domain_id=0; - ---connection server_2 -SET debug_sync='now WAIT_FOR d3_query'; ---let $d3_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(69%' AND INFO NOT LIKE '%LIKE%'` - -SET debug_sync='now SIGNAL d2_cont2'; -SET debug_sync='now WAIT_FOR d2_done'; -SET debug_sync='now SIGNAL d1_cont2'; -SET debug_sync='now WAIT_FOR d1_done'; -SET debug_sync='now SIGNAL d0_cont2'; -SET debug_sync='now WAIT_FOR d0_done'; -SET debug_sync='now SIGNAL d3_cont2'; -SET debug_sync='now WAIT_FOR d3_done'; - -# Now prepare the real transactions T1, T2, T3, T4 on the master. - ---connection con_temp3 -# Create transaction T1. -SET binlog_format=statement; -INSERT INTO t3 VALUES (64, foo(64, - 'rpl_parallel_before_mark_start_commit SIGNAL t1_waiting WAIT_FOR t1_cont', '')); - -# Create transaction T2, as a group commit leader on the master. -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2 WAIT_FOR master_cont2'; -send INSERT INTO t3 VALUES (65, foo(65, '', '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; - ---connection con_temp4 -# Create transaction T3, participating in T2's group commit. -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; -send INSERT INTO t3 VALUES (66, foo(66, '', '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued3'; - ---connection con_temp5 -# Create transaction T4, participating in group commit with T2 and T3. -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued4'; -send INSERT INTO t3 VALUES (67, foo(67, '', '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued4'; -SET debug_sync='now SIGNAL master_cont2'; - ---connection con_temp3 -REAP; ---connection con_temp4 -REAP; ---connection con_temp5 -REAP; - ---connection server_1 -SELECT * FROM t3 WHERE a >= 60 ORDER BY a; -SET debug_sync='RESET'; - ---connection server_2 -# Now we have the four transactions pending for replication on the slave. -# Let them be queued for our three worker threads in a controlled fashion. -# We put them at a stage where T1 is delayed and T3 is waiting for T1 to -# commit before T3 can start. Then we kill T3. - -# Make the worker D0 free, and wait for T1 to be queued in it. -SET debug_sync='now SIGNAL d0_cont'; -SET debug_sync='now WAIT_FOR t1_waiting'; - -# Make the worker D3 free, and wait for T2 to be queued in it. -SET debug_sync='now SIGNAL d3_cont'; -SET debug_sync='now WAIT_FOR t2_waiting'; - -# Now release worker D1, and wait for T3 to be queued in it. -# T3 will wait for T1 to commit before it can start. -SET debug_sync='now SIGNAL d1_cont'; -SET debug_sync='now WAIT_FOR t3_waiting'; - -# Release worker D2. Wait for T4 to be queued, so we are sure it has -# received the debug_sync signal (else we might overwrite it with the -# next debug_sync). -SET debug_sync='now SIGNAL d2_cont'; -SET debug_sync='now WAIT_FOR t4_waiting'; - -# Now we kill the waiting transaction T3 in worker D1. ---replace_result $d1_thd_id THD_ID -eval KILL $d1_thd_id; - -# Wait until T3 has reacted on the kill. -SET debug_sync='now WAIT_FOR t3_killed'; - -# Now we can allow T1 to proceed. -SET debug_sync='now SIGNAL t1_cont'; - ---let $slave_sql_errno= 1317,1927,1964 ---source include/wait_for_slave_sql_error.inc -STOP SLAVE IO_THREAD; -# Since T2, T3, and T4 run in parallel, we can not be sure if T2 will have time -# to commit or not before the stop. However, T1 should commit, and T3/T4 may -# not have committed. (After slave restart we check that all become committed -# eventually). -SELECT * FROM t3 WHERE a >= 60 AND a != 65 ORDER BY a; - -# Now we have to disable the debug_sync statements, so they do not trigger -# when the events are retried. -SET debug_sync='RESET'; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; -SET sql_log_bin=0; -DROP FUNCTION foo; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---connection server_1 -UPDATE t3 SET b=b+1 WHERE a=60; ---save_master_pos - ---connection server_2 ---source include/start_slave.inc ---sync_with_master -SELECT * FROM t3 WHERE a >= 60 ORDER BY a; -# Restore the foo() function. -SET sql_log_bin=0; -DROP FUNCTION foo; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - IF d1 != '' THEN - SET debug_sync = d1; - END IF; - IF d2 != '' THEN - SET debug_sync = d2; - END IF; - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---connection server_2 -# Respawn all worker threads to clear any left-over debug_sync or other stuff. ---source include/stop_slave.inc -SET GLOBAL binlog_format=@old_format; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; ---source include/start_slave.inc - - ---echo *** 5. Test killing thread that is waiting for queue of max length to shorten *** - -# Find the thread id of the driver SQL thread that we want to kill. ---let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Slave has read all relay log%' ---source include/wait_condition.inc ---let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Slave has read all relay log%'` -SET @old_max_queued= @@GLOBAL.slave_parallel_max_queued; -SET GLOBAL slave_parallel_max_queued=9000; - ---connection server_1 ---let bigstring= `SELECT REPEAT('x', 10000)` -SET binlog_format=statement; -# Create an event that will wait to be signalled. -INSERT INTO t3 VALUES (80, foo(0, - 'ha_write_row_end SIGNAL query_waiting WAIT_FOR query_cont', '')); - ---connection server_2 -SET debug_sync='now WAIT_FOR query_waiting'; -# Inject that the SQL driver thread will signal `wait_queue_ready' to debug_sync -# as it goes to wait for the event queue to become smaller than the value of -# @@slave_parallel_max_queued. -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug="+d,rpl_parallel_wait_queue_max"; - ---connection server_1 ---disable_query_log -# Create an event that will fill up the queue. -# The Xid event at the end of the event group will have to wait for the Query -# event with the INSERT to drain so the queue becomes shorter. However that in -# turn waits for the prior event group to continue. -eval INSERT INTO t3 VALUES (81, LENGTH('$bigstring')); ---enable_query_log -SELECT * FROM t3 WHERE a >= 80 ORDER BY a; - ---connection server_2 -SET debug_sync='now WAIT_FOR wait_queue_ready'; - ---replace_result $thd_id THD_ID -eval KILL $thd_id; - -SET debug_sync='now WAIT_FOR wait_queue_killed'; -SET debug_sync='now SIGNAL query_cont'; - ---let $slave_sql_errno= 1317,1927,1964 ---source include/wait_for_slave_sql_error.inc -STOP SLAVE IO_THREAD; - -SET GLOBAL debug_dbug=@old_dbug; -SET GLOBAL slave_parallel_max_queued= @old_max_queued; - ---connection server_1 -INSERT INTO t3 VALUES (82,0); -SET binlog_format=@old_format; ---save_master_pos - ---connection server_2 -SET debug_sync='RESET'; ---source include/start_slave.inc ---sync_with_master -SELECT * FROM t3 WHERE a >= 80 ORDER BY a; - - ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL binlog_format=@old_format; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; ---source include/start_slave.inc - ---echo *** MDEV-5788 Incorrect free of rgi->deferred_events in parallel replication *** - ---connection server_2 -# Use just two worker threads, so we are sure to get the rpl_group_info added -# to the free list, which is what triggered the bug. ---source include/stop_slave.inc -SET GLOBAL replicate_ignore_table="test.t3"; -SET GLOBAL slave_parallel_threads=2; ---source include/start_slave.inc - ---connection server_1 -INSERT INTO t3 VALUES (100, rand()); -INSERT INTO t3 VALUES (101, rand()); - ---save_master_pos - ---connection server_2 ---sync_with_master - ---connection server_1 -INSERT INTO t3 VALUES (102, rand()); -INSERT INTO t3 VALUES (103, rand()); -INSERT INTO t3 VALUES (104, rand()); -INSERT INTO t3 VALUES (105, rand()); - ---save_master_pos - ---connection server_2 ---sync_with_master ---source include/stop_slave.inc -SET GLOBAL replicate_ignore_table=""; ---source include/start_slave.inc - ---connection server_1 -INSERT INTO t3 VALUES (106, rand()); -INSERT INTO t3 VALUES (107, rand()); ---save_master_pos - ---connection server_2 ---sync_with_master ---replace_column 2 # -SELECT * FROM t3 WHERE a >= 100 ORDER BY a; - - ---echo *** MDEV-5921: In parallel replication, an error is not correctly signalled to the next transaction *** - ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=10; ---source include/start_slave.inc - ---connection server_1 -INSERT INTO t3 VALUES (110, 1); ---save_master_pos - ---connection server_2 ---sync_with_master -SELECT * FROM t3 WHERE a >= 110 ORDER BY a; -# Inject a duplicate key error. -SET sql_log_bin=0; -INSERT INTO t3 VALUES (111, 666); -SET sql_log_bin=1; - ---connection server_1 - -# Create a group commit with two inserts, the first one conflicts with a row on the slave ---connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -send INSERT INTO t3 VALUES (111, 2); ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connect (con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,) -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -send INSERT INTO t3 VALUES (112, 3); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con1 -REAP; ---connection con2 -REAP; -SET debug_sync='RESET'; ---save_master_pos - ---connection server_2 ---let $slave_sql_errno= 1062 ---source include/wait_for_slave_sql_error.inc ---source include/wait_for_slave_sql_to_stop.inc -# We should not see the row (112,3) here, it should be rolled back due to -# error signal from the prior transaction. -SELECT * FROM t3 WHERE a >= 110 ORDER BY a; -SET sql_log_bin=0; -DELETE FROM t3 WHERE a=111 AND b=666; -SET sql_log_bin=1; -START SLAVE SQL_THREAD; ---sync_with_master -SELECT * FROM t3 WHERE a >= 110 ORDER BY a; - - ---echo ***MDEV-5914: Parallel replication deadlock due to InnoDB lock conflicts *** ---connection server_2 ---source include/stop_slave.inc - ---connection server_1 -CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; -INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); - -# Create a group commit with UPDATE and DELETE, in that order. -# The bug was that while the UPDATE's row lock does not block the DELETE, the -# DELETE's gap lock _does_ block the UPDATE. This could cause a deadlock -# on the slave. ---connection con1 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -send UPDATE t4 SET b=NULL WHERE a=6; ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con2 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -send DELETE FROM t4 WHERE b <= 3; - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con1 -REAP; ---connection con2 -REAP; -SET debug_sync='RESET'; ---save_master_pos - ---connection server_2 ---source include/start_slave.inc ---sync_with_master ---source include/stop_slave.inc - -SELECT * FROM t4 ORDER BY a; - - -# Another example, this one with INSERT vs. DELETE ---connection server_1 -DELETE FROM t4; -INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); - -# Create a group commit with INSERT and DELETE, in that order. -# The bug was that while the INSERT's insert intention lock does not block -# the DELETE, the DELETE's gap lock _does_ block the INSERT. This could cause -# a deadlock on the slave. ---connection con1 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -send INSERT INTO t4 VALUES (7, NULL); ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con2 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -send DELETE FROM t4 WHERE b <= 3; - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con1 -REAP; ---connection con2 -REAP; -SET debug_sync='RESET'; ---save_master_pos - ---connection server_2 ---source include/start_slave.inc ---sync_with_master ---source include/stop_slave.inc - -SELECT * FROM t4 ORDER BY a; - - -# MDEV-6549, failing to update gtid_slave_pos for a transaction that was retried. -# The problem was that when a transaction updates the mysql.gtid_slave_pos -# table, it clears the flag that marks that there is a GTID position that -# needs to be updated. Then, if the transaction got killed after that due -# to a deadlock, the subsequent retry would fail to notice that the GTID needs -# to be recorded in gtid_slave_pos. -# -# (In the original bug report, the symptom was an assertion; this was however -# just a side effect of the missing update of gtid_slave_pos, which also -# happened to cause a missing clear of OPTION_GTID_BEGIN). ---connection server_1 -DELETE FROM t4; -INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); - -# Create two transactions that can run in parallel on the slave but cause -# a deadlock if the second runs before the first. ---connection con1 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -send UPDATE t4 SET b=NULL WHERE a=6; ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con2 -# Must use statement-based binlogging. Otherwise the transaction will not be -# binlogged at all, as it modifies no rows. -SET @old_format= @@SESSION.binlog_format; -SET binlog_format='statement'; -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -send DELETE FROM t4 WHERE b <= 1; - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con1 -REAP; ---connection con2 -REAP; -SET @old_format=@@GLOBAL.binlog_format; -SET debug_sync='RESET'; ---save_master_pos ---let $last_gtid= `SELECT @@last_gtid` - ---connection server_2 -# Disable the usual skip of gap locks for transactions that are run in -# parallel, using DBUG. This allows the deadlock to occur, and this in turn -# triggers a retry of the second transaction, and the code that was buggy and -# caused the gtid_slave_pos update to be skipped in the retry. -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug="+d,disable_thd_need_ordering_with"; ---source include/start_slave.inc ---sync_with_master -SET GLOBAL debug_dbug=@old_dbug; - -SELECT * FROM t4 ORDER BY a; -# Check that the GTID of the second transaction was correctly recorded in -# gtid_slave_pos, in the variable as well as in the table. ---replace_result $last_gtid GTID -eval SET @last_gtid= '$last_gtid'; -SELECT IF(@@gtid_slave_pos LIKE CONCAT('%',@last_gtid,'%'), "GTID found ok", - CONCAT("GTID ", @last_gtid, " not found in gtid_slave_pos=", @@gtid_slave_pos)) - AS result; -SELECT "ROW FOUND" AS `Is the row found?` - FROM mysql.gtid_slave_pos - WHERE CONCAT(domain_id, "-", server_id, "-", seq_no) = @last_gtid; - - ---echo *** MDEV-5938: Exec_master_log_pos not updated at log rotate in parallel replication *** ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=1; -SET DEBUG_SYNC= 'RESET'; ---source include/start_slave.inc - ---connection server_1 -CREATE TABLE t5 (a INT PRIMARY KEY, b INT); -INSERT INTO t5 VALUES (1,1); -INSERT INTO t5 VALUES (2,2), (3,8); -INSERT INTO t5 VALUES (4,16); ---save_master_pos - ---connection server_2 ---sync_with_master -let $io_file= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1); -let $io_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); -let $sql_file= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1); -let $sql_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1); ---disable_query_log -eval SELECT IF('$io_file' = '$sql_file', "OK", "Not ok, $io_file <> $sql_file") AS test_check; -eval SELECT IF('$io_pos' = '$sql_pos', "OK", "Not ok, $io_pos <> $sql_pos") AS test_check; ---enable_query_log - ---connection server_1 -FLUSH LOGS; ---source include/wait_for_binlog_checkpoint.inc ---save_master_pos - ---connection server_2 ---sync_with_master -let $io_file= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1); -let $io_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); -let $sql_file= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1); -let $sql_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1); ---disable_query_log -eval SELECT IF('$io_file' = '$sql_file', "OK", "Not ok, $io_file <> $sql_file") AS test_check; -eval SELECT IF('$io_pos' = '$sql_pos', "OK", "Not ok, $io_pos <> $sql_pos") AS test_check; ---enable_query_log - - ---echo *** MDEV_6435: Incorrect error handling when query binlogged partially on master with "killed" error *** - ---connection server_1 -CREATE TABLE t6 (a INT) ENGINE=MyISAM; -CREATE TRIGGER tr AFTER INSERT ON t6 FOR EACH ROW SET @a = 1; - ---connection con1 -SET @old_format= @@binlog_format; -SET binlog_format= statement; ---let $conid = `SELECT CONNECTION_ID()` -SET debug_sync='sp_head_execute_before_loop SIGNAL ready WAIT_FOR cont'; -send INSERT INTO t6 VALUES (1), (2), (3); - ---connection server_1 -SET debug_sync='now WAIT_FOR ready'; ---replace_result $conid CONID -eval KILL QUERY $conid; -SET debug_sync='now SIGNAL cont'; - ---connection con1 ---error ER_QUERY_INTERRUPTED ---reap -SET binlog_format= @old_format; -SET debug_sync='RESET'; ---let $after_error_gtid_pos= `SELECT @@gtid_binlog_pos` - ---connection server_1 -SET debug_sync='RESET'; - - ---connection server_2 ---let $slave_sql_errno= 1317 ---source include/wait_for_slave_sql_error.inc -STOP SLAVE IO_THREAD; ---replace_result $after_error_gtid_pos AFTER_ERROR_GTID_POS -eval SET GLOBAL gtid_slave_pos= '$after_error_gtid_pos'; ---source include/start_slave.inc - ---connection server_1 -INSERT INTO t6 VALUES (4); -SELECT * FROM t6 ORDER BY a; ---save_master_pos - ---connection server_2 ---sync_with_master -SELECT * FROM t6 ORDER BY a; - - ---echo *** MDEV-6551: Some replication errors are ignored if slave_parallel_threads > 0 *** - ---connection server_1 -INSERT INTO t2 VALUES (31); ---let $gtid1= `SELECT @@LAST_GTID` ---source include/save_master_gtid.inc - ---connection server_2 ---source include/sync_with_master_gtid.inc ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads= 0; ---source include/start_slave.inc - -# Force a duplicate key error on the slave. -SET sql_log_bin= 0; -INSERT INTO t2 VALUES (32); -SET sql_log_bin= 1; - ---connection server_1 -INSERT INTO t2 VALUES (32); ---let $gtid2= `SELECT @@LAST_GTID` -# Rotate the binlog; the bug is triggered when the master binlog file changes -# after the event group that causes the duplicate key error. -FLUSH LOGS; -INSERT INTO t2 VALUES (33); -INSERT INTO t2 VALUES (34); -SELECT * FROM t2 WHERE a >= 30 ORDER BY a; ---source include/save_master_gtid.inc - ---connection server_2 ---let $slave_sql_errno= 1062 ---source include/wait_for_slave_sql_error.inc - ---connection server_2 ---source include/stop_slave_io.inc -SET GLOBAL slave_parallel_threads=10; -START SLAVE; - ---let $slave_sql_errno= 1062 ---source include/wait_for_slave_sql_error.inc - -# Note: IO thread is still running at this point. -# The bug seems to have been that restarting the SQL thread after an error with -# the IO thread still running, somehow picks up a later relay log position and -# thus ends up skipping the failing event, rather than re-executing. - -START SLAVE SQL_THREAD; ---let $slave_sql_errno= 1062 ---source include/wait_for_slave_sql_error.inc - -SELECT * FROM t2 WHERE a >= 30 ORDER BY a; - -# Skip the duplicate error, so we can proceed. ---error ER_SLAVE_SKIP_NOT_IN_GTID -SET sql_slave_skip_counter= 1; ---source include/stop_slave_io.inc ---disable_query_log -eval SET GLOBAL gtid_slave_pos = REPLACE(@@gtid_slave_pos, "$gtid1", "$gtid2"); ---enable_query_log ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc - -SELECT * FROM t2 WHERE a >= 30 ORDER BY a; - - ---echo *** MDEV-6775: Wrong binlog order in parallel replication *** ---connection server_1 -# A bit tricky bug to reproduce. On the master, we binlog in statement-mode -# two transactions, an UPDATE followed by a DELETE. On the slave, we replicate -# with binlog-mode set to ROW, which means the DELETE, which modifies no rows, -# is not binlogged. Then we inject a wait in the group commit code on the -# slave, shortly before the actual commit of the UPDATE. The bug was that the -# DELETE could wake up from wait_for_prior_commit() before the commit of the -# UPDATE. So the test could see the slave position updated to after DELETE, -# while the UPDATE was still not visible. -DELETE FROM t4; -INSERT INTO t4 VALUES (1,NULL), (3,NULL), (4,4), (5, NULL), (6, 6); ---source include/save_master_gtid.inc - ---connection server_2 ---source include/sync_with_master_gtid.inc ---source include/stop_slave.inc -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug="+d,inject_binlog_commit_before_get_LOCK_log"; -SET @old_format=@@GLOBAL.binlog_format; -SET GLOBAL binlog_format=ROW; -# Re-spawn the worker threads to be sure they pick up the new binlog format -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; - ---connection con1 -SET @old_format= @@binlog_format; -SET binlog_format= statement; -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -send UPDATE t4 SET b=NULL WHERE a=6; ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con2 -SET @old_format= @@binlog_format; -SET binlog_format= statement; -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -send DELETE FROM t4 WHERE b <= 3; - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con1 -REAP; -SET binlog_format= @old_format; ---connection con2 -REAP; -SET binlog_format= @old_format; -SET debug_sync='RESET'; ---save_master_pos -SELECT * FROM t4 ORDER BY a; - ---connection server_2 ---source include/start_slave.inc -SET debug_sync= 'now WAIT_FOR waiting'; ---sync_with_master -SELECT * FROM t4 ORDER BY a; -SET debug_sync= 'now SIGNAL cont'; - -# Re-spawn the worker threads to remove any DBUG injections or DEBUG_SYNC. ---source include/stop_slave.inc -SET GLOBAL debug_dbug=@old_dbug; -SET GLOBAL binlog_format= @old_format; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; ---source include/start_slave.inc - - ---echo *** MDEV-7237: Parallel replication: incorrect relaylog position after stop/start the slave *** ---connection server_1 -INSERT INTO t2 VALUES (40); ---save_master_pos - ---connection server_2 ---sync_with_master ---source include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=no; -SET @old_dbug= @@GLOBAL.debug_dbug; -# This DBUG injection causes a DEBUG_SYNC signal "scheduled_gtid_0_x_100" when -# GTID 0-1-100 has been scheduled for and fetched by a worker thread. -SET GLOBAL debug_dbug="+d,rpl_parallel_scheduled_gtid_0_x_100"; -# This DBUG injection causes a DEBUG_SYNC signal "wait_for_done_waiting" when -# STOP SLAVE has signalled all worker threads to stop. -SET GLOBAL debug_dbug="+d,rpl_parallel_wait_for_done_trigger"; -# Reset worker threads to make DBUG setting catch on. -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; - - ---connection server_1 -# Setup some transaction for the slave to replicate. -INSERT INTO t2 VALUES (41); -INSERT INTO t2 VALUES (42); -# Need to log the DELETE in statement format, so we can see it in processlist. -SET @old_format= @@binlog_format; -SET binlog_format= statement; -DELETE FROM t2 WHERE a=40; -SET binlog_format= @old_format; -INSERT INTO t2 VALUES (43); -INSERT INTO t2 VALUES (44); -# Force the slave to switch to a new relay log file. -FLUSH LOGS; -INSERT INTO t2 VALUES (45); -# Inject a GTID 0-1-100, which will trigger a DEBUG_SYNC signal when this -# transaction has been fetched by a worker thread. -SET gtid_seq_no=100; -INSERT INTO t2 VALUES (46); ---save_master_pos - ---connection con_temp2 -# Temporarily block the DELETE on a=40 from completing. -BEGIN; -SELECT * FROM t2 WHERE a=40 FOR UPDATE; - - ---connection server_2 ---source include/start_slave.inc - -# Wait for a worker thread to start on the DELETE that will be blocked -# temporarily by the SELECT FOR UPDATE. ---let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE state='updating' and info LIKE '%DELETE FROM t2 WHERE a=40%' ---source include/wait_condition.inc - -# The DBUG injection set above will make the worker thread signal the following -# debug_sync when the GTID 0-1-100 has been reached by a worker thread. -# Thus, at this point, the SQL driver thread has reached the next -# relay log file name, while a worker thread is still processing a -# transaction in the previous relay log file, blocked on the SELECT FOR -# UPDATE. -SET debug_sync= 'now WAIT_FOR scheduled_gtid_0_x_100'; -# At this point, the SQL driver thread is in the new relay log file, while -# the DELETE from the old relay log file is not yet complete. We will stop -# the slave at this point. The bug was that the DELETE statement would -# update the slave position to the _new_ relay log file name instead of -# its own old file name. Thus, by stoping and restarting the slave at this -# point, we would get an error at restart due to incorrect position. (If -# we would let the slave catch up before stopping, the incorrect position -# would be corrected by a later transaction). - -send STOP SLAVE; - ---connection con_temp2 -# Wait for STOP SLAVE to have proceeded sufficiently that it has signalled -# all worker threads to stop; this ensures that we will stop after the DELETE -# transaction (and not after a later transaction that might have been able -# to set a fixed position). -SET debug_sync= 'now WAIT_FOR wait_for_done_waiting'; -# Now release the row lock that was blocking the replication of DELETE. -ROLLBACK; - ---connection server_2 -reap; ---source include/wait_for_slave_sql_to_stop.inc -SELECT * FROM t2 WHERE a >= 40 ORDER BY a; -# Now restart the slave. With the bug present, this would start at an -# incorrect relay log position, causing relay log read error (or if unlucky, -# silently skip a number of events). ---source include/start_slave.inc ---sync_with_master -SELECT * FROM t2 WHERE a >= 40 ORDER BY a; ---source include/stop_slave.inc -SET GLOBAL debug_dbug=@old_dbug; -SET DEBUG_SYNC= 'RESET'; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - - ---echo *** MDEV-7326 Server deadlock in connection with parallel replication *** -# We use three transactions, each in a separate group commit. -# T1 does mark_start_commit(), then gets a deadlock error. -# T2 wakes up and starts running -# T1 does unmark_start_commit() -# T3 goes to wait for T2 to start its commit -# T2 does mark_start_commit() -# The bug was that at this point, T3 got deadlocked. Because T1 has unmarked(), -# T3 did not yet see the count_committing_event_groups reach its target value -# yet. But when T1 later re-did mark_start_commit(), it failed to send a wakeup -# to T3. - ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=3; -SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_xid"; ---source include/start_slave.inc - ---connection server_1 -SET @old_format= @@SESSION.binlog_format; -SET binlog_format= STATEMENT; -# This debug_sync will linger on and be used to control T3 later. -INSERT INTO t1 VALUES (foo(50, - "rpl_parallel_start_waiting_for_prior SIGNAL t3_ready", - "rpl_parallel_end_of_group SIGNAL prep_ready WAIT_FOR prep_cont")); ---save_master_pos ---connection server_2 -# Wait for the debug_sync point for T3 to be set. But let the preparation -# transaction remain hanging, so that T1 and T2 will be scheduled for the -# remaining two worker threads. -SET DEBUG_SYNC= "now WAIT_FOR prep_ready"; - ---connection server_1 -INSERT INTO t2 VALUES (foo(50, - "rpl_parallel_simulate_temp_err_xid SIGNAL t1_ready1 WAIT_FOR t1_cont1", - "rpl_parallel_retry_after_unmark SIGNAL t1_ready2 WAIT_FOR t1_cont2")); ---save_master_pos - ---connection server_2 -SET DEBUG_SYNC= "now WAIT_FOR t1_ready1"; -# T1 has now done mark_start_commit(). It will later do a rollback and retry. - ---connection server_1 -# Use a MyISAM table for T2 and T3, so they do not trigger the -# rpl_parallel_simulate_temp_err_xid DBUG insertion on XID event. -INSERT INTO t1 VALUES (foo(51, - "rpl_parallel_before_mark_start_commit SIGNAL t2_ready1 WAIT_FOR t2_cont1", - "rpl_parallel_after_mark_start_commit SIGNAL t2_ready2")); - ---connection server_2 -SET DEBUG_SYNC= "now WAIT_FOR t2_ready1"; -# T2 has now started running, but has not yet done mark_start_commit() -SET DEBUG_SYNC= "now SIGNAL t1_cont1"; -SET DEBUG_SYNC= "now WAIT_FOR t1_ready2"; -# T1 has now done unmark_start_commit() in preparation for its retry. - ---connection server_1 -INSERT INTO t1 VALUES (52); -SET BINLOG_FORMAT= @old_format; -SELECT * FROM t2 WHERE a>=50 ORDER BY a; -SELECT * FROM t1 WHERE a>=50 ORDER BY a; - ---connection server_2 -# Let the preparation transaction complete, so that the same worker thread -# can continue with the transaction T3. -SET DEBUG_SYNC= "now SIGNAL prep_cont"; -SET DEBUG_SYNC= "now WAIT_FOR t3_ready"; -# T3 has now gone to wait for T2 to start committing -SET DEBUG_SYNC= "now SIGNAL t2_cont1"; -SET DEBUG_SYNC= "now WAIT_FOR t2_ready2"; -# T2 has now done mark_start_commit(). -# Let things run, and check that T3 does not get deadlocked. -SET DEBUG_SYNC= "now SIGNAL t1_cont2"; ---sync_with_master - ---connection server_1 ---save_master_pos ---connection server_2 ---sync_with_master -SELECT * FROM t2 WHERE a>=50 ORDER BY a; -SELECT * FROM t1 WHERE a>=50 ORDER BY a; -SET DEBUG_SYNC="reset"; - -# Re-spawn the worker threads to remove any DBUG injections or DEBUG_SYNC. ---source include/stop_slave.inc -SET GLOBAL debug_dbug=@old_dbug; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; ---source include/start_slave.inc - - ---echo *** MDEV-7326 Server deadlock in connection with parallel replication *** -# Similar to the previous test, but with T2 and T3 in the same GCO. -# We use three transactions, T1 in one group commit and T2/T3 in another. -# T1 does mark_start_commit(), then gets a deadlock error. -# T2 wakes up and starts running -# T1 does unmark_start_commit() -# T3 goes to wait for T1 to start its commit -# T2 does mark_start_commit() -# The bug was that at this point, T3 got deadlocked. T2 increments the -# count_committing_event_groups but does not signal T3, as they are in -# the same GCO. Then later when T1 increments, it would also not signal -# T3, because now the count_committing_event_groups is not equal to the -# wait_count of T3 (it is one larger). - ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=3; -SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_xid"; ---source include/start_slave.inc - ---connection server_1 -SET @old_format= @@SESSION.binlog_format; -SET binlog_format= STATEMENT; -# This debug_sync will linger on and be used to control T3 later. -INSERT INTO t1 VALUES (foo(60, - "rpl_parallel_start_waiting_for_prior SIGNAL t3_ready", - "rpl_parallel_end_of_group SIGNAL prep_ready WAIT_FOR prep_cont")); ---save_master_pos ---connection server_2 -# Wait for the debug_sync point for T3 to be set. But let the preparation -# transaction remain hanging, so that T1 and T2 will be scheduled for the -# remaining two worker threads. -SET DEBUG_SYNC= "now WAIT_FOR prep_ready"; - ---connection server_1 -INSERT INTO t2 VALUES (foo(60, - "rpl_parallel_simulate_temp_err_xid SIGNAL t1_ready1 WAIT_FOR t1_cont1", - "rpl_parallel_retry_after_unmark SIGNAL t1_ready2 WAIT_FOR t1_cont2")); ---save_master_pos - ---connection server_2 -SET DEBUG_SYNC= "now WAIT_FOR t1_ready1"; -# T1 has now done mark_start_commit(). It will later do a rollback and retry. - -# Do T2 and T3 in a single group commit. -# Use a MyISAM table for T2 and T3, so they do not trigger the -# rpl_parallel_simulate_temp_err_xid DBUG insertion on XID event. ---connection con_temp3 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -SET binlog_format=statement; -send INSERT INTO t1 VALUES (foo(61, - "rpl_parallel_before_mark_start_commit SIGNAL t2_ready1 WAIT_FOR t2_cont1", - "rpl_parallel_after_mark_start_commit SIGNAL t2_ready2")); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con_temp4 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -send INSERT INTO t6 VALUES (62); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con_temp3 -REAP; ---connection con_temp4 -REAP; - ---connection server_1 -SET debug_sync='RESET'; -SET BINLOG_FORMAT= @old_format; -SELECT * FROM t2 WHERE a>=60 ORDER BY a; -SELECT * FROM t1 WHERE a>=60 ORDER BY a; -SELECT * FROM t6 WHERE a>=60 ORDER BY a; - ---connection server_2 -SET DEBUG_SYNC= "now WAIT_FOR t2_ready1"; -# T2 has now started running, but has not yet done mark_start_commit() -SET DEBUG_SYNC= "now SIGNAL t1_cont1"; -SET DEBUG_SYNC= "now WAIT_FOR t1_ready2"; -# T1 has now done unmark_start_commit() in preparation for its retry. - ---connection server_2 -# Let the preparation transaction complete, so that the same worker thread -# can continue with the transaction T3. -SET DEBUG_SYNC= "now SIGNAL prep_cont"; -SET DEBUG_SYNC= "now WAIT_FOR t3_ready"; -# T3 has now gone to wait for T2 to start committing -SET DEBUG_SYNC= "now SIGNAL t2_cont1"; -SET DEBUG_SYNC= "now WAIT_FOR t2_ready2"; -# T2 has now done mark_start_commit(). -# Let things run, and check that T3 does not get deadlocked. -SET DEBUG_SYNC= "now SIGNAL t1_cont2"; ---sync_with_master - ---connection server_1 ---save_master_pos ---connection server_2 ---sync_with_master -SELECT * FROM t2 WHERE a>=60 ORDER BY a; -SELECT * FROM t1 WHERE a>=60 ORDER BY a; -SELECT * FROM t6 WHERE a>=60 ORDER BY a; -SET DEBUG_SYNC="reset"; - -# Re-spawn the worker threads to remove any DBUG injections or DEBUG_SYNC. ---source include/stop_slave.inc -SET GLOBAL debug_dbug=@old_dbug; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; ---source include/start_slave.inc - ---echo *** MDEV-7335: Potential parallel slave deadlock with specific binlog corruption *** - ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=1; -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000"; - ---connection server_1 -INSERT INTO t2 VALUES (101); -INSERT INTO t2 VALUES (102); -INSERT INTO t2 VALUES (103); -INSERT INTO t2 VALUES (104); -INSERT INTO t2 VALUES (105); -# Inject a partial event group (missing XID at the end). The bug was that such -# partial group was not handled appropriately, leading to server deadlock. -SET gtid_seq_no=1000; -INSERT INTO t2 VALUES (106); -INSERT INTO t2 VALUES (107); -INSERT INTO t2 VALUES (108); -INSERT INTO t2 VALUES (109); -INSERT INTO t2 VALUES (110); -INSERT INTO t2 VALUES (111); -INSERT INTO t2 VALUES (112); -INSERT INTO t2 VALUES (113); -INSERT INTO t2 VALUES (114); -INSERT INTO t2 VALUES (115); -INSERT INTO t2 VALUES (116); -INSERT INTO t2 VALUES (117); -INSERT INTO t2 VALUES (118); -INSERT INTO t2 VALUES (119); -INSERT INTO t2 VALUES (120); -INSERT INTO t2 VALUES (121); -INSERT INTO t2 VALUES (122); -INSERT INTO t2 VALUES (123); -INSERT INTO t2 VALUES (124); -INSERT INTO t2 VALUES (125); -INSERT INTO t2 VALUES (126); -INSERT INTO t2 VALUES (127); -INSERT INTO t2 VALUES (128); -INSERT INTO t2 VALUES (129); -INSERT INTO t2 VALUES (130); ---source include/save_master_gtid.inc - ---connection server_2 ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc -# The partial event group (a=106) should be rolled back and thus missing. -SELECT * FROM t2 WHERE a >= 100 ORDER BY a; - ---source include/stop_slave.inc -SET GLOBAL debug_dbug=@old_dbug; -SET GLOBAL slave_parallel_threads=10; ---source include/start_slave.inc - ---echo *** MDEV-6676 - test syntax of @@slave_parallel_mode *** ---connection server_2 - ---let $status_items= Parallel_Mode ---source include/show_slave_status.inc ---source include/stop_slave.inc -SET GLOBAL slave_parallel_mode='aggressive'; ---let $status_items= Parallel_Mode ---source include/show_slave_status.inc -SET GLOBAL slave_parallel_mode='conservative'; ---let $status_items= Parallel_Mode ---source include/show_slave_status.inc - - ---echo *** MDEV-6676 - test that empty parallel_mode does not replicate in parallel *** ---connection server_1 -INSERT INTO t2 VALUES (1040); ---source include/save_master_gtid.inc - ---connection server_2 -SET GLOBAL slave_parallel_mode='none'; -# Test that we do not use parallel apply, by injecting an unconditional -# crash in the parallel apply code. -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug="+d,slave_crash_if_parallel_apply"; ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc -SELECT * FROM t2 WHERE a >= 1040 ORDER BY a; ---source include/stop_slave.inc -SET GLOBAL debug_dbug=@old_dbug; - - ---echo *** MDEV-6676 - test disabling domain-based parallel replication *** ---connection server_1 -# Let's do a bunch of transactions that will conflict if run out-of-order in -# domain-based parallel replication mode. -SET gtid_domain_id = 1; -INSERT INTO t2 VALUES (1041); -INSERT INTO t2 VALUES (1042); -INSERT INTO t2 VALUES (1043); -INSERT INTO t2 VALUES (1044); -INSERT INTO t2 VALUES (1045); -INSERT INTO t2 VALUES (1046); -DELETE FROM t2 WHERE a >= 1041; -SET gtid_domain_id = 2; -INSERT INTO t2 VALUES (1041); -INSERT INTO t2 VALUES (1042); -INSERT INTO t2 VALUES (1043); -INSERT INTO t2 VALUES (1044); -INSERT INTO t2 VALUES (1045); -INSERT INTO t2 VALUES (1046); -SET gtid_domain_id = 0; ---source include/save_master_gtid.inc ---connection server_2 -SET GLOBAL slave_parallel_mode=minimal; ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc -SELECT * FROM t2 WHERE a >= 1040 ORDER BY a; - ---echo *** MDEV-7888: ANALYZE TABLE does wakeup_subsequent_commits(), causing wrong binlog order and parallel replication hang *** - ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_mode='conservative'; -SET GLOBAL slave_parallel_threads=10; - -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug= '+d,inject_analyze_table_sleep'; - ---connection server_1 -# Inject two group commits. The bug was that ANALYZE TABLE would call -# wakeup_subsequent_commits() too early, allowing the following transaction -# in the same group to run ahead and binlog and free the GCO. Then we get -# wrong binlog order and later access freed GCO, which causes lost wakeup -# of following GCO and thus replication hang. -# We injected a small sleep in ANALYZE to make the race easier to hit (this -# can only cause false negatives in versions with the bug, not false positives, -# so sleep is ok here. And it's in general not possible to trigger reliably -# the race with debug_sync, since the bugfix makes the race impossible). - -SET @old_dbug= @@SESSION.debug_dbug; -SET SESSION debug_dbug="+d,binlog_force_commit_id"; - -# Group commit with cid=10000, two event groups. -SET @commit_id= 10000; -ANALYZE TABLE t2; -INSERT INTO t3 VALUES (120, 0); - -# Group commit with cid=10001, one event group. -SET @commit_id= 10001; -INSERT INTO t3 VALUES (121, 0); - -SET SESSION debug_dbug=@old_dbug; - -SELECT * FROM t3 WHERE a >= 120 ORDER BY a; ---source include/save_master_gtid.inc - ---connection server_2 ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc - -SELECT * FROM t3 WHERE a >= 120 ORDER BY a; - ---source include/stop_slave.inc -SET GLOBAL debug_dbug= @old_dbug; ---source include/start_slave.inc - - ---echo *** MDEV-7929: record_gtid() for non-transactional event group calls wakeup_subsequent_commits() too early, causing slave hang. *** - ---connection server_2 ---source include/stop_slave.inc -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug= '+d,inject_record_gtid_serverid_100_sleep'; - ---connection server_1 -# Inject two group commits. The bug was that record_gtid for a -# non-transactional event group would commit its own transaction, which would -# cause ha_commit_trans() to call wakeup_subsequent_commits() too early. This -# in turn lead to access to freed group_commit_orderer object, losing a wakeup -# and causing slave threads to hang. -# We inject a small sleep in the corresponding record_gtid() to make the race -# easier to hit. - -SET @old_dbug= @@SESSION.debug_dbug; -SET SESSION debug_dbug="+d,binlog_force_commit_id"; - -# Group commit with cid=10010, two event groups. -SET @old_server_id= @@SESSION.server_id; -SET SESSION server_id= 100; -SET @commit_id= 10010; -ALTER TABLE t1 COMMENT "Hulubulu!"; -SET SESSION server_id= @old_server_id; -INSERT INTO t3 VALUES (130, 0); - -# Group commit with cid=10011, one event group. -SET @commit_id= 10011; -INSERT INTO t3 VALUES (131, 0); - -SET SESSION debug_dbug=@old_dbug; - -SELECT * FROM t3 WHERE a >= 130 ORDER BY a; ---source include/save_master_gtid.inc - ---connection server_2 ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc - -SELECT * FROM t3 WHERE a >= 130 ORDER BY a; - ---source include/stop_slave.inc -SET GLOBAL debug_dbug= @old_dbug; ---source include/start_slave.inc - - ---echo *** MDEV-8031: Parallel replication stops on "connection killed" error (probably incorrectly handled deadlock kill) *** - ---connection server_1 -INSERT INTO t3 VALUES (201,0), (202,0); ---source include/save_master_gtid.inc - ---connection server_2 ---source include/sync_with_master_gtid.inc ---source include/stop_slave.inc -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug= '+d,inject_mdev8031'; - ---connection server_1 -# We artificially create a situation that hopefully resembles the original -# bug which was only seen "in the wild", and only once. -# Setup a fake group commit with lots of conflicts that will lead to deadloc -# kill. The slave DBUG injection causes the slave to be deadlock killed at -# a particular point during the retry, and then later do a small sleep at -# another critical point where the prior transaction then has a chance to -# complete. Finally an extra KILL check catches an unhandled, lingering -# deadlock kill. So rather artificial, but at least it exercises the -# relevant code paths. -SET @old_dbug= @@SESSION.debug_dbug; -SET SESSION debug_dbug="+d,binlog_force_commit_id"; - -SET @commit_id= 10200; -INSERT INTO t3 VALUES (203, 1); -INSERT INTO t3 VALUES (204, 1); -INSERT INTO t3 VALUES (205, 1); -UPDATE t3 SET b=b+1 WHERE a=201; -UPDATE t3 SET b=b+1 WHERE a=201; -UPDATE t3 SET b=b+1 WHERE a=201; -UPDATE t3 SET b=b+1 WHERE a=202; -UPDATE t3 SET b=b+1 WHERE a=202; -UPDATE t3 SET b=b+1 WHERE a=202; -UPDATE t3 SET b=b+1 WHERE a=202; -UPDATE t3 SET b=b+1 WHERE a=203; -UPDATE t3 SET b=b+1 WHERE a=203; -UPDATE t3 SET b=b+1 WHERE a=204; -UPDATE t3 SET b=b+1 WHERE a=204; -UPDATE t3 SET b=b+1 WHERE a=204; -UPDATE t3 SET b=b+1 WHERE a=203; -UPDATE t3 SET b=b+1 WHERE a=205; -UPDATE t3 SET b=b+1 WHERE a=205; -SET SESSION debug_dbug=@old_dbug; - -SELECT * FROM t3 WHERE a>=200 ORDER BY a; ---source include/save_master_gtid.inc - ---connection server_2 ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc - -SELECT * FROM t3 WHERE a>=200 ORDER BY a; ---source include/stop_slave.inc -SET GLOBAL debug_dbug= @old_dbug; ---source include/start_slave.inc - - ---echo *** Check getting deadlock killed inside open_binlog() during retry. *** - ---connection server_2 ---source include/stop_slave.inc -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug= '+d,inject_retry_event_group_open_binlog_kill'; -SET @old_max= @@GLOBAL.max_relay_log_size; -SET GLOBAL max_relay_log_size= 4096; - ---connection server_1 -SET @old_dbug= @@SESSION.debug_dbug; -SET SESSION debug_dbug="+d,binlog_force_commit_id"; - ---let $large= `SELECT REPEAT("*", 8192)` -SET @commit_id= 10210; ---echo Omit long queries that cause relaylog rotations and transaction retries... ---disable_query_log -eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=205 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=205 /* $large */; ---enable_query_log -SET SESSION debug_dbug=@old_dbug; - -SELECT * FROM t3 WHERE a>=200 ORDER BY a; ---source include/save_master_gtid.inc - ---connection server_2 ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc - -SELECT * FROM t3 WHERE a>=200 ORDER BY a; ---source include/stop_slave.inc -SET GLOBAL debug_dbug= @old_debg; -SET GLOBAL max_relay_log_size= @old_max; ---source include/start_slave.inc - ---echo *** MDEV-8725: Assertion on ROLLBACK statement in the binary log *** ---connection server_1 -# Inject an event group terminated by ROLLBACK, by mixing MyISAM and InnoDB -# in a transaction. The bug was an assertion on the ROLLBACK due to -# mark_start_commit() being already called. ---disable_warnings -BEGIN; -INSERT INTO t2 VALUES (2000); -INSERT INTO t1 VALUES (2000); -INSERT INTO t2 VALUES (2001); -ROLLBACK; ---enable_warnings -SELECT * FROM t1 WHERE a>=2000 ORDER BY a; -SELECT * FROM t2 WHERE a>=2000 ORDER BY a; ---source include/save_master_gtid.inc - ---connection server_2 ---source include/sync_with_master_gtid.inc -SELECT * FROM t1 WHERE a>=2000 ORDER BY a; -SELECT * FROM t2 WHERE a>=2000 ORDER BY a; - -# Clean up. ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc -SET DEBUG_SYNC= 'RESET'; - ---connection server_1 -DROP function foo; -DROP TABLE t1,t2,t3,t4,t5,t6; -SET DEBUG_SYNC= 'RESET'; - ---source include/rpl_end.inc +--source extra/rpl_tests/rpl_parallel.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test b/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test index a540aedc70c..9e93b0b56e9 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test @@ -1,31 +1 @@ -# BUG#13979418: SHOW BINLOG EVENTS MAY CRASH THE SERVER -# -# The function mysql_show_binlog_events has a local stack variable -# 'LOG_INFO linfo;', which is assigned to thd->current_linfo, however -# this variable goes out of scope and is destroyed before clean -# thd->current_linfo. -# -# This test case runs SHOW BINLOG EVENTS and FLUSH LOGS to make sure -# that with the fix local variable linfo is valid along all -# mysql_show_binlog_events function scope. -# ---source include/have_debug_sync.inc ---source include/master-slave.inc - ---connection slave -SET DEBUG_SYNC= 'after_show_binlog_events SIGNAL on_show_binlog_events WAIT_FOR end'; ---send SHOW BINLOG EVENTS - ---connection slave1 -SET DEBUG_SYNC= 'now WAIT_FOR on_show_binlog_events'; -FLUSH LOGS; -SET DEBUG_SYNC= 'now SIGNAL end'; - ---connection slave ---disable_result_log ---reap ---enable_result_log -SET DEBUG_SYNC= 'RESET'; - ---connection master ---source include/rpl_end.inc +--source extra/rpl_tests/rpl_parallel_show_binlog_events_purge_logs.inc diff --git a/mysql-test/suite/rpl/t/rpl_relayrotate.test b/mysql-test/suite/rpl/t/rpl_relayrotate.test index 4c0840446ec..5e3bcdcd711 100644 --- a/mysql-test/suite/rpl/t/rpl_relayrotate.test +++ b/mysql-test/suite/rpl/t/rpl_relayrotate.test @@ -1,12 +1 @@ -####################################################### -# Wrapper for rpl_relayrotate.test to allow multi # -# Engines to reuse test code. By JBM 2006-02-15 # -####################################################### --- source include/have_innodb.inc -# Slow test, don't run during staging part --- source include/not_staging.inc --- source include/master-slave.inc - -let $engine_type=innodb; --- source extra/rpl_tests/rpl_relayrotate.test ---source include/rpl_end.inc +--source extra/rpl_tests/rpl_relayrotate.inc diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test index 117ee567869..d5f80619aeb 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test @@ -1,545 +1 @@ -source include/have_semisync.inc; -source include/not_embedded.inc; -source include/have_innodb.inc; -source include/master-slave.inc; - -let $engine_type= InnoDB; -#let $engine_type= MyISAM; - -# Suppress warnings that might be generated during the test -connection master; -call mtr.add_suppression("Timeout waiting for reply of binlog"); -call mtr.add_suppression("Read semi-sync reply"); -call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT."); -connection slave; -call mtr.add_suppression("Master server does not support semi-sync"); -call mtr.add_suppression("Semi-sync slave .* reply"); -call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); -connection master; - -# wait for dying connections (if any) to disappear -let $wait_condition= select count(*) = 0 from information_schema.processlist where command='killed'; ---source include/wait_condition.inc - -# After fix of BUG#45848, semi-sync slave should not create any extra -# connections on master, save the count of connections before start -# semi-sync slave for comparison below. -let $_connections_normal_slave= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1); - ---echo # ---echo # Uninstall semi-sync plugins on master and slave ---echo # -connection slave; -source include/stop_slave.inc; -reset slave; -set global rpl_semi_sync_master_enabled= 0; -set global rpl_semi_sync_slave_enabled= 0; - -connection master; -reset master; -set global rpl_semi_sync_master_enabled= 0; -set global rpl_semi_sync_slave_enabled= 0; - ---echo # ---echo # Main test of semi-sync replication start here ---echo # - -connection master; - -set global rpl_semi_sync_master_timeout= 60000; # 60s - -echo [ default state of semi-sync on master should be OFF ]; -show variables like 'rpl_semi_sync_master_enabled'; - -echo [ enable semi-sync on master ]; -set global rpl_semi_sync_master_enabled = 1; -show variables like 'rpl_semi_sync_master_enabled'; - -echo [ status of semi-sync on master should be ON even without any semi-sync slaves ]; -show status like 'Rpl_semi_sync_master_clients'; -show status like 'Rpl_semi_sync_master_status'; -show status like 'Rpl_semi_sync_master_yes_tx'; - ---echo # ---echo # BUG#45672 Semisync repl: ActiveTranx:insert_tranx_node: transaction node allocation failed ---echo # BUG#45673 Semisynch reports correct operation even if no slave is connected ---echo # - -# BUG#45672 When semi-sync is enabled on master, it would allocate -# transaction node even without semi-sync slave connected, and would -# finally result in transaction node allocation error. -# -# Semi-sync master will pre-allocate 'max_connections' transaction -# nodes, so here we do more than that much transactions to check if it -# will fail or not. -# select @@global.max_connections + 1; -let $i= `select @@global.max_connections + 1`; -disable_query_log; -eval create table t1 (a int) engine=$engine_type; -while ($i) -{ - eval insert into t1 values ($i); - dec $i; -} -drop table t1; -enable_query_log; - -# BUG#45673 -echo [ status of semi-sync on master should be OFF ]; -show status like 'Rpl_semi_sync_master_clients'; -show status like 'Rpl_semi_sync_master_status'; ---replace_result 305 304 -show status like 'Rpl_semi_sync_master_yes_tx'; - -# reset master to make sure the following test will start with a clean environment -reset master; - -connection slave; - -echo [ default state of semi-sync on slave should be OFF ]; -show variables like 'rpl_semi_sync_slave_enabled'; - -echo [ enable semi-sync on slave ]; -set global rpl_semi_sync_slave_enabled = 1; -show variables like 'rpl_semi_sync_slave_enabled'; -source include/start_slave.inc; - -connection master; - -# NOTE: Rpl_semi_sync_master_client will only be updated when -# semi-sync slave has started binlog dump request -let $status_var= Rpl_semi_sync_master_clients; -let $status_var_value= 1; -source include/wait_for_status_var.inc; - -echo [ initial master state after the semi-sync slave connected ]; -show status like 'Rpl_semi_sync_master_clients'; -show status like 'Rpl_semi_sync_master_status'; -show status like 'Rpl_semi_sync_master_no_tx'; -show status like 'Rpl_semi_sync_master_yes_tx'; - -replace_result $engine_type ENGINE_TYPE; -eval create table t1(a int) engine = $engine_type; - -echo [ master state after CREATE TABLE statement ]; -show status like 'Rpl_semi_sync_master_status'; -show status like 'Rpl_semi_sync_master_no_tx'; -show status like 'Rpl_semi_sync_master_yes_tx'; - -# After fix of BUG#45848, semi-sync slave should not create any extra -# connections on master. -let $_connections_semisync_slave= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1); -replace_result $_connections_normal_slave CONNECTIONS_NORMAL_SLAVE $_connections_semisync_slave CONNECTIONS_SEMISYNC_SLAVE; -eval select $_connections_semisync_slave - $_connections_normal_slave as 'Should be 0'; - -echo [ insert records to table ]; -insert t1 values (10); -insert t1 values (9); -insert t1 values (8); -insert t1 values (7); -insert t1 values (6); -insert t1 values (5); -insert t1 values (4); -insert t1 values (3); -insert t1 values (2); -insert t1 values (1); - -echo [ master status after inserts ]; -show status like 'Rpl_semi_sync_master_status'; -show status like 'Rpl_semi_sync_master_no_tx'; -show status like 'Rpl_semi_sync_master_yes_tx'; - -sync_slave_with_master; - -echo [ slave status after replicated inserts ]; -show status like 'Rpl_semi_sync_slave_status'; - -select count(distinct a) from t1; -select min(a) from t1; -select max(a) from t1; - ---echo ---echo # BUG#50157 ---echo # semi-sync replication crashes when replicating a transaction which ---echo # include 'CREATE TEMPORARY TABLE `MyISAM_t` SELECT * FROM `Innodb_t` ; - -connection master; -SET SESSION AUTOCOMMIT= 0; -CREATE TABLE t2(c1 INT) ENGINE=innodb; -sync_slave_with_master; - -connection master; -BEGIN; ---echo ---echo # Even though it is in a transaction, this statement is binlogged into binlog ---echo # file immediately. ---disable_warnings -CREATE TEMPORARY TABLE t3 SELECT c1 FROM t2 where 1=1; ---enable_warnings ---echo ---echo # These statements will not be binlogged until the transaction is committed -INSERT INTO t2 VALUES(11); -INSERT INTO t2 VALUES(22); -COMMIT; - -DROP TABLE t2, t3; -SET SESSION AUTOCOMMIT= 1; -sync_slave_with_master; - - ---echo # ---echo # Test semi-sync master will switch OFF after one transaction ---echo # timeout waiting for slave reply. ---echo # -connection slave; -source include/stop_slave.inc; - -connection master; -set global rpl_semi_sync_master_timeout= 5000; - -# The first semi-sync check should be on because after slave stop, -# there are no transactions on the master. -echo [ master status should be ON ]; -show status like 'Rpl_semi_sync_master_status'; -show status like 'Rpl_semi_sync_master_no_tx'; ---replace_result 305 304 -show status like 'Rpl_semi_sync_master_yes_tx'; -show status like 'Rpl_semi_sync_master_clients'; - -echo [ semi-sync replication of these transactions will fail ]; -insert into t1 values (500); - -# Wait for the semi-sync replication of this transaction to timeout -let $status_var= Rpl_semi_sync_master_status; -let $status_var_value= OFF; -source include/wait_for_status_var.inc; - -# The second semi-sync check should be off because one transaction -# times out during waiting. -echo [ master status should be OFF ]; -show status like 'Rpl_semi_sync_master_status'; -show status like 'Rpl_semi_sync_master_no_tx'; ---replace_result 305 304 -show status like 'Rpl_semi_sync_master_yes_tx'; - -# Semi-sync status on master is now OFF, so all these transactions -# will be replicated asynchronously. -delete from t1 where a=10; -delete from t1 where a=9; -delete from t1 where a=8; -delete from t1 where a=7; -delete from t1 where a=6; -delete from t1 where a=5; -delete from t1 where a=4; -delete from t1 where a=3; -delete from t1 where a=2; -delete from t1 where a=1; - -insert into t1 values (100); - -echo [ master status should be OFF ]; -show status like 'Rpl_semi_sync_master_status'; -show status like 'Rpl_semi_sync_master_no_tx'; ---replace_result 305 304 -show status like 'Rpl_semi_sync_master_yes_tx'; - ---echo # ---echo # Test semi-sync status on master will be ON again when slave catches up ---echo # - -# Save the master position for later use. -save_master_pos; - -connection slave; - -echo [ slave status should be OFF ]; -show status like 'Rpl_semi_sync_slave_status'; -source include/start_slave.inc; -sync_with_master; - -echo [ slave status should be ON ]; -show status like 'Rpl_semi_sync_slave_status'; - -select count(distinct a) from t1; -select min(a) from t1; -select max(a) from t1; - -connection master; - -# The master semi-sync status should be on again after slave catches up. -echo [ master status should be ON again after slave catches up ]; -show status like 'Rpl_semi_sync_master_status'; -show status like 'Rpl_semi_sync_master_no_tx'; ---replace_result 305 304 -show status like 'Rpl_semi_sync_master_yes_tx'; -show status like 'Rpl_semi_sync_master_clients'; - ---echo # ---echo # Test disable/enable master semi-sync on the fly. ---echo # - -drop table t1; -sync_slave_with_master; - -source include/stop_slave.inc; - ---echo # ---echo # Flush status ---echo # -connection master; -echo [ Semi-sync master status variables before FLUSH STATUS ]; -SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx'; -SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx'; -# Do not write the FLUSH STATUS to binlog, to make sure we'll get a -# clean status after this. -FLUSH NO_WRITE_TO_BINLOG STATUS; -echo [ Semi-sync master status variables after FLUSH STATUS ]; -SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx'; -SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx'; - -connection master; - -source include/show_master_logs.inc; -show variables like 'rpl_semi_sync_master_enabled'; - -echo [ disable semi-sync on the fly ]; -set global rpl_semi_sync_master_enabled=0; -show variables like 'rpl_semi_sync_master_enabled'; -show status like 'Rpl_semi_sync_master_status'; - -echo [ enable semi-sync on the fly ]; -set global rpl_semi_sync_master_enabled=1; -show variables like 'rpl_semi_sync_master_enabled'; -show status like 'Rpl_semi_sync_master_status'; - ---echo # ---echo # Test RESET MASTER/SLAVE ---echo # - -connection slave; - -source include/start_slave.inc; - -connection master; - -replace_result $engine_type ENGINE_TYPE; -eval create table t1 (a int) engine = $engine_type; -drop table t1; - -##show status like 'Rpl_semi_sync_master_status'; - -sync_slave_with_master; ---replace_column 2 # -show status like 'Rpl_relay%'; - -echo [ test reset master ]; -connection master; - -reset master; - -show status like 'Rpl_semi_sync_master_status'; -show status like 'Rpl_semi_sync_master_no_tx'; -show status like 'Rpl_semi_sync_master_yes_tx'; - -connection slave; - -source include/stop_slave.inc; -reset slave; - -# Kill the dump thread on master for previous slave connection and -# wait for it to exit -connection master; -let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`; -if ($_tid) -{ - --replace_result $_tid _tid - eval kill query $_tid; - - # After dump thread exit, Rpl_semi_sync_master_clients will be 0 - let $status_var= Rpl_semi_sync_master_clients; - let $status_var_value= 0; - source include/wait_for_status_var.inc; -} - -connection slave; -source include/start_slave.inc; - -connection master; - -# Wait for dump thread to start, Rpl_semi_sync_master_clients will be -# 1 after dump thread started. -let $status_var= Rpl_semi_sync_master_clients; -let $status_var_value= 1; -source include/wait_for_status_var.inc; - -replace_result $engine_type ENGINE_TYPE; -eval create table t1 (a int) engine = $engine_type; -insert into t1 values (1); -insert into t1 values (2), (3); - -sync_slave_with_master; - -select * from t1; - -connection master; - -echo [ master semi-sync status should be ON ]; -show status like 'Rpl_semi_sync_master_status'; -show status like 'Rpl_semi_sync_master_no_tx'; -show status like 'Rpl_semi_sync_master_yes_tx'; - ---echo # ---echo # Start semi-sync replication without SUPER privilege ---echo # -connection slave; -source include/stop_slave.inc; -reset slave; -connection master; -reset master; - -# Kill the dump thread on master for previous slave connection and wait for it to exit -let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`; -if ($_tid) -{ - --replace_result $_tid _tid - eval kill query $_tid; - - # After dump thread exit, Rpl_semi_sync_master_clients will be 0 - let $status_var= Rpl_semi_sync_master_clients; - let $status_var_value= 0; - source include/wait_for_status_var.inc; -} - -# Do not binlog the following statement because it will generate -# different events for ROW and STATEMENT format -set sql_log_bin=0; -grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password'; -flush privileges; -set sql_log_bin=1; -connection slave; -grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password'; -flush privileges; -change master to master_user='rpl',master_password='rpl_password'; -source include/start_slave.inc; -show status like 'Rpl_semi_sync_slave_status'; -connection master; - -# Wait for the semi-sync binlog dump thread to start -let $status_var= Rpl_semi_sync_master_clients; -let $status_var_value= 1; -source include/wait_for_status_var.inc; -echo [ master semi-sync should be ON ]; -show status like 'Rpl_semi_sync_master_clients'; -show status like 'Rpl_semi_sync_master_status'; -show status like 'Rpl_semi_sync_master_no_tx'; -show status like 'Rpl_semi_sync_master_yes_tx'; -insert into t1 values (4); -insert into t1 values (5); -echo [ master semi-sync should be ON ]; -show status like 'Rpl_semi_sync_master_clients'; -show status like 'Rpl_semi_sync_master_status'; -show status like 'Rpl_semi_sync_master_no_tx'; -show status like 'Rpl_semi_sync_master_yes_tx'; - ---echo # ---echo # Test semi-sync slave connect to non-semi-sync master ---echo # - -# Disable semi-sync on master -connection slave; -source include/stop_slave.inc; -SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; - -connection master; - -# Kill the dump thread on master for previous slave connection and wait for it to exit -let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`; -if ($_tid) -{ - --replace_result $_tid _tid - eval kill query $_tid; - - # After dump thread exit, Rpl_semi_sync_master_clients will be 0 - let $status_var= Rpl_semi_sync_master_clients; - let $status_var_value= 0; - source include/wait_for_status_var.inc; -} - -echo [ Semi-sync status on master should be ON ]; -show status like 'Rpl_semi_sync_master_clients'; -show status like 'Rpl_semi_sync_master_status'; -set global rpl_semi_sync_master_enabled= 0; - -connection slave; -SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; -source include/start_slave.inc; -connection master; -insert into t1 values (8); -let $status_var= Rpl_semi_sync_master_clients; -let $status_var_value= 1; -source include/wait_for_status_var.inc; -echo [ master semi-sync clients should be 1, status should be OFF ]; -show status like 'Rpl_semi_sync_master_clients'; -show status like 'Rpl_semi_sync_master_status'; -sync_slave_with_master; -show status like 'Rpl_semi_sync_slave_status'; - -# Uninstall semi-sync plugin on master -connection slave; -source include/stop_slave.inc; -connection master; -set global rpl_semi_sync_master_enabled= 0; - -connection slave; -SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; -source include/start_slave.inc; - -connection master; -insert into t1 values (10); -sync_slave_with_master; - ---echo # ---echo # Test non-semi-sync slave connect to semi-sync master ---echo # - -connection master; -set global rpl_semi_sync_master_timeout= 5000; # 5s -set global rpl_semi_sync_master_enabled= 1; - -connection slave; -source include/stop_slave.inc; -SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; - -echo [ uninstall semi-sync slave plugin ]; -set global rpl_semi_sync_slave_enabled= 0; - -echo [ reinstall semi-sync slave plugin and disable semi-sync ]; -SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; -SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; -source include/start_slave.inc; -SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; - ---echo # ---echo # Clean up ---echo # - -connection slave; -source include/stop_slave.inc; -set global rpl_semi_sync_slave_enabled= 0; - -connection master; -set global rpl_semi_sync_master_enabled= 0; - -connection slave; -change master to master_user='root',master_password=''; -source include/start_slave.inc; - -connection master; -drop table t1; -sync_slave_with_master; - -connection master; -drop user rpl@127.0.0.1; -flush privileges; -set global rpl_semi_sync_master_timeout= default; ---source include/rpl_end.inc +--source extra/rpl_tests/rpl_semi_sync.inc diff --git a/mysql-test/suite/rpl/t/rpl_skip_replication.test b/mysql-test/suite/rpl/t/rpl_skip_replication.test index f815554d4af..c57256780a4 100644 --- a/mysql-test/suite/rpl/t/rpl_skip_replication.test +++ b/mysql-test/suite/rpl/t/rpl_skip_replication.test @@ -1,377 +1 @@ ---source include/master-slave.inc ---source include/have_innodb.inc - -connection slave; -# Test that SUPER is required to change @@replicate_events_marked_for_skip. -CREATE USER 'nonsuperuser'@'127.0.0.1'; -GRANT ALTER,CREATE,DELETE,DROP,EVENT,INSERT,PROCESS,REPLICATION SLAVE, - SELECT,UPDATE ON *.* TO 'nonsuperuser'@'127.0.0.1'; -connect(nonpriv, 127.0.0.1, nonsuperuser,, test, $SLAVE_MYPORT,); -connection nonpriv; ---error ER_SPECIFIC_ACCESS_DENIED_ERROR -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; -disconnect nonpriv; -connection slave; -DROP USER'nonsuperuser'@'127.0.0.1'; - -SELECT @@global.replicate_events_marked_for_skip; ---error ER_SLAVE_MUST_STOP -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; -SELECT @@global.replicate_events_marked_for_skip; -STOP SLAVE; ---error ER_GLOBAL_VARIABLE -SET SESSION replicate_events_marked_for_skip=FILTER_ON_MASTER; -SELECT @@global.replicate_events_marked_for_skip; -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; -SELECT @@global.replicate_events_marked_for_skip; -START SLAVE; - -connection master; -SELECT @@skip_replication; ---error ER_LOCAL_VARIABLE -SET GLOBAL skip_replication=1; -SELECT @@skip_replication; - -CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=myisam; -CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=innodb; -INSERT INTO t1(a) VALUES (1); -INSERT INTO t2(a) VALUES (1); - - -# Test that master-side filtering works. -SET skip_replication=1; - -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam; -INSERT INTO t1(a) VALUES (2); -INSERT INTO t2(a) VALUES (2); - -# Inject a rotate event in the binlog stream sent to slave (otherwise we will -# fail sync_slave_with_master as the last event on the master is not present -# on the slave). -FLUSH NO_WRITE_TO_BINLOG LOGS; - -sync_slave_with_master; -connection slave; -SHOW TABLES; -SELECT * FROM t1; -SELECT * FROM t2; - -connection master; -DROP TABLE t3; - -FLUSH NO_WRITE_TO_BINLOG LOGS; -sync_slave_with_master; - - -# Test that slave-side filtering works. -connection slave; -STOP SLAVE; -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; -START SLAVE; - -connection master; -SET skip_replication=1; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam; -INSERT INTO t1(a) VALUES (3); -INSERT INTO t2(a) VALUES (3); - -# Inject a rotate event in the binlog stream sent to slave (otherwise we will -# fail sync_slave_with_master as the last event on the master is not present -# on the slave). -FLUSH NO_WRITE_TO_BINLOG LOGS; - -sync_slave_with_master; -connection slave; -SHOW TABLES; -SELECT * FROM t1; -SELECT * FROM t2; - -connection master; -DROP TABLE t3; - -FLUSH NO_WRITE_TO_BINLOG LOGS; -sync_slave_with_master; -connection slave; -STOP SLAVE; -SET GLOBAL replicate_events_marked_for_skip=REPLICATE; -START SLAVE; - - -# Test that events with @@skip_replication=1 are not filtered when filtering is -# not set on slave. -connection master; -SET skip_replication=1; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam; -INSERT INTO t3(a) VALUES(2); -sync_slave_with_master; -connection slave; -SELECT * FROM t3; -connection master; -DROP TABLE t3; - -# -# Test that the slave will preserve the @@skip_replication flag in its -# own binlog. -# - -TRUNCATE t1; -sync_slave_with_master; -connection slave; -RESET MASTER; - -connection master; -SET skip_replication=0; -INSERT INTO t1 VALUES (1,0); -SET skip_replication=1; -INSERT INTO t1 VALUES (2,0); -SET skip_replication=0; -INSERT INTO t1 VALUES (3,0); - -sync_slave_with_master; -connection slave; -# Since slave has @@replicate_events_marked_for_skip=REPLICATE, it should have -# applied all events. -SELECT * FROM t1 ORDER by a; - -STOP SLAVE; -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; -let $SLAVE_DATADIR= `select @@datadir`; - -connection master; -TRUNCATE t1; - -# Now apply the slave binlog to the master, to check that both the slave -# and mysqlbinlog will preserve the @@skip_replication flag. ---exec $MYSQL_BINLOG $SLAVE_DATADIR/slave-bin.000001 > $MYSQLTEST_VARDIR/tmp/rpl_skip_replication.binlog ---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/rpl_skip_replication.binlog - -# The master should have all three events. -SELECT * FROM t1 ORDER by a; - -# The slave should be missing event 2, which is marked with the -# @@skip_replication flag. - -connection slave; -START SLAVE; - -connection master; -sync_slave_with_master; - -connection slave; -SELECT * FROM t1 ORDER by a; - -# -# Test that @@sql_slave_skip_counter does not count skipped @@skip_replication -# events. -# - -connection master; -TRUNCATE t1; - -sync_slave_with_master; -connection slave; -STOP SLAVE; -# We will skip two INSERTs (in addition to any skipped due to -# @@skip_replication). Since from 5.5 every statement is wrapped in -# BEGIN ... END, we need to skip 6 events for this. -SET GLOBAL sql_slave_skip_counter=6; -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; -START SLAVE; - -connection master; -# Need to fix @@binlog_format to get consistent event count. -SET @old_binlog_format= @@binlog_format; -SET binlog_format= statement; -SET skip_replication=0; -INSERT INTO t1 VALUES (1,5); -SET skip_replication=1; -INSERT INTO t1 VALUES (2,5); -SET skip_replication=0; -INSERT INTO t1 VALUES (3,5); -INSERT INTO t1 VALUES (4,5); -SET binlog_format= @old_binlog_format; - -sync_slave_with_master; -connection slave; - -# The slave should have skipped the first three inserts (number 1 and 3 due -# to @@sql_slave_skip_counter=2, number 2 due to -# @@replicate_events_marked_for_skip=FILTER_ON_SLAVE). So only number 4 -# should be left. -SELECT * FROM t1; - - -# -# Check that BINLOG statement preserves the @@skip_replication flag. -# -connection slave; -# Need row @@binlog_format for BINLOG statements containing row events. ---source include/stop_slave.inc -SET @old_slave_binlog_format= @@global.binlog_format; -SET GLOBAL binlog_format= row; ---source include/start_slave.inc - -connection master; -TRUNCATE t1; - -SET @old_binlog_format= @@binlog_format; -SET binlog_format= row; -# Format description log event. -BINLOG 'wlZOTw8BAAAA8QAAAPUAAAAAAAQANS41LjIxLU1hcmlhREItZGVidWctbG9nAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAA2QAEGggAAAAICAgCAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAA371saA=='; -# INSERT INTO t1 VALUES (1,8) # with @@skip_replication=1 -BINLOG 'wlZOTxMBAAAAKgAAAGMBAAAAgCkAAAAAAAEABHRlc3QAAnQxAAIDAwAC -wlZOTxcBAAAAJgAAAIkBAAAAgCkAAAAAAAEAAv/8AQAAAAgAAAA='; -# INSERT INTO t1 VALUES (2,8) # with @@skip_replication=0 -BINLOG 'wlZOTxMBAAAAKgAAADwCAAAAACkAAAAAAAEABHRlc3QAAnQxAAIDAwAC -wlZOTxcBAAAAJgAAAGICAAAAACkAAAAAAAEAAv/8AgAAAAgAAAA='; -SET binlog_format= @old_binlog_format; - -SELECT * FROM t1 ORDER BY a; -sync_slave_with_master; -connection slave; -# Slave should have only the second insert, the first should be ignored due to -# the @@skip_replication flag. -SELECT * FROM t1 ORDER by a; - ---source include/stop_slave.inc -SET GLOBAL binlog_format= @old_slave_binlog_format; ---source include/start_slave.inc - - -# Test that it is not possible to change @@skip_replication inside a -# transaction or statement, thereby replicating only parts of statements -# or transactions. -connection master; -SET skip_replication=0; - -BEGIN; ---error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION -SET skip_replication=0; ---error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION -SET skip_replication=1; -ROLLBACK; -SET skip_replication=1; -BEGIN; ---error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION -SET skip_replication=0; ---error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION -SET skip_replication=1; -COMMIT; -SET autocommit=0; -INSERT INTO t2(a) VALUES(100); ---error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION -SET skip_replication=1; -ROLLBACK; -SET autocommit=1; - -SET skip_replication=1; ---delimiter | -CREATE FUNCTION foo (x INT) RETURNS INT BEGIN SET SESSION skip_replication=x; RETURN x; END| -CREATE PROCEDURE bar(x INT) BEGIN SET SESSION skip_replication=x; END| -CREATE FUNCTION baz (x INT) RETURNS INT BEGIN CALL bar(x); RETURN x; END| ---delimiter ; ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -SELECT foo(0); ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -SELECT baz(0); ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -SET @a= foo(1); ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -SET @a= baz(1); ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -UPDATE t2 SET b=foo(0); ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -UPDATE t2 SET b=baz(0); ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -INSERT INTO t1 VALUES (101, foo(1)); ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -INSERT INTO t1 VALUES (101, baz(0)); -SELECT @@skip_replication; -CALL bar(0); -SELECT @@skip_replication; -CALL bar(1); -SELECT @@skip_replication; -DROP FUNCTION foo; -DROP PROCEDURE bar; -DROP FUNCTION baz; - - -# Test that master-side filtering happens on the master side, and that -# slave-side filtering happens on the slave. - -# First test that events do not reach the slave when master-side filtering -# is configured. Do this by replicating first with only the IO thread running -# and master-side filtering; then change to no filtering and start the SQL -# thread. This should still skip the events, as master-side filtering -# means the events never reached the slave. -connection master; -SET skip_replication= 0; -TRUNCATE t1; -sync_slave_with_master; -connection slave; -STOP SLAVE; -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; -START SLAVE IO_THREAD; -connection master; -SET skip_replication= 1; -INSERT INTO t1(a) VALUES (1); -SET skip_replication= 0; -INSERT INTO t1(a) VALUES (2); ---source include/save_master_pos.inc -connection slave; ---source include/sync_io_with_master.inc -STOP SLAVE IO_THREAD; -SET GLOBAL replicate_events_marked_for_skip=REPLICATE; -START SLAVE; -connection master; -sync_slave_with_master; -connection slave; -# Now only the second insert of (2) should be visible, as the first was -# filtered on the master, so even though the SQL thread ran without skipping -# events, it will never see the event in the first place. -SELECT * FROM t1; - -# Now tests that when slave-side filtering is configured, events _do_ reach -# the slave. -connection master; -SET skip_replication= 0; -TRUNCATE t1; -sync_slave_with_master; -connection slave; -STOP SLAVE; -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; -START SLAVE IO_THREAD; -connection master; -SET skip_replication= 1; -INSERT INTO t1(a) VALUES (1); -SET skip_replication= 0; -INSERT INTO t1(a) VALUES (2); ---source include/save_master_pos.inc -connection slave; ---source include/sync_io_with_master.inc -STOP SLAVE IO_THREAD; -SET GLOBAL replicate_events_marked_for_skip=REPLICATE; -START SLAVE; -connection master; -sync_slave_with_master; -connection slave; -# Now both inserts should be visible. Since filtering was configured to be -# slave-side, the event is in the relay log, and when the SQL thread ran we -# had disabled filtering again. -SELECT * FROM t1 ORDER BY a; - - -# Clean up. -connection master; -SET skip_replication=0; -DROP TABLE t1,t2; -connection slave; -STOP SLAVE; -SET GLOBAL replicate_events_marked_for_skip=REPLICATE; -START SLAVE; - ---source include/rpl_end.inc +--source extra/rpl_tests/rpl_skip_replication.inc diff --git a/mysql-test/suite/rpl/t/rpl_special_charset.test b/mysql-test/suite/rpl/t/rpl_special_charset.test index 8ccb1b4183f..6f196005711 100644 --- a/mysql-test/suite/rpl/t/rpl_special_charset.test +++ b/mysql-test/suite/rpl/t/rpl_special_charset.test @@ -1,26 +1 @@ -################################################################################ -# Bug#19855907 IO THREAD AUTHENTICATION ISSUE WITH SOME CHARACTER SETS -# Problem: IO thread fails to connect to master if servers are configured with -# special character sets like utf16, utf32, ucs2. -# -# Analysis: MySQL server does not support few special character sets like -# utf16,utf32 and ucs2 as "client's character set"(eg: utf16,utf32, ucs2). -# When IO thread is trying to connect to Master, it sets server's character -# set as client's character set. When Slave server is started with these -# special character sets, IO thread (a connection to Master) fails because -# of the above said reason. -# -# Fix: If server's character set is not supported as client's character set, -# then set default's client character set(latin1) as client's character set. -############################################################################### ---source include/master-slave.inc -call mtr.add_suppression("Cannot use utf16 as character_set_client"); -CREATE TABLE t1(i VARCHAR(20)); -INSERT INTO t1 VALUES (0xFFFF); ---sync_slave_with_master ---let diff_tables=master:t1, slave:t1 ---source include/diff_tables.inc -# Cleanup ---connection master -DROP TABLE t1; ---source include/rpl_end.inc +--source extra/rpl_tests/rpl_special_charset.inc diff --git a/mysql-test/suite/rpl/t/rpl_sporadic_master.test b/mysql-test/suite/rpl/t/rpl_sporadic_master.test index 592d13e67b0..0a756982047 100644 --- a/mysql-test/suite/rpl/t/rpl_sporadic_master.test +++ b/mysql-test/suite/rpl/t/rpl_sporadic_master.test @@ -1,26 +1 @@ -# test to see if replication can continue when master sporadically fails on -# COM_BINLOG_DUMP and additionally limits the number of events per dump - -source include/master-slave.inc; - -create table t2(n int); -create table t1(n int not null auto_increment primary key); -insert into t1 values (NULL),(NULL); -truncate table t1; -# We have to use 4 in the following to make this test work with all table types -insert into t1 values (4),(NULL); -sync_slave_with_master; ---source include/stop_slave.inc ---source include/start_slave.inc -connection master; -insert into t1 values (NULL),(NULL); -flush logs; -truncate table t1; -insert into t1 values (10),(NULL),(NULL),(NULL),(NULL),(NULL); -sync_slave_with_master; -select * from t1 ORDER BY n; -connection master; -drop table t1,t2; -sync_slave_with_master; - ---source include/rpl_end.inc +--source extra/rpl_tests/rpl_sporadic_master.inc diff --git a/mysql-test/suite/rpl/t/rpl_ssl.test b/mysql-test/suite/rpl/t/rpl_ssl.test index ca9f61ec5de..883b367e9f2 100644 --- a/mysql-test/suite/rpl/t/rpl_ssl.test +++ b/mysql-test/suite/rpl/t/rpl_ssl.test @@ -1,109 +1 @@ -source include/have_ssl_communication.inc; -source include/master-slave.inc; - -# create a user for replication that requires ssl encryption -connection master; -create user replssl@localhost; -grant replication slave on *.* to replssl@localhost require ssl; -create table t1 (t int auto_increment, KEY(t)); - -sync_slave_with_master; - -# Set slave to use SSL for connection to master -stop slave; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval change master to - master_user='replssl', - master_password='', - master_ssl=1, - master_ssl_ca ='$MYSQL_TEST_DIR/std_data/cacert.pem', - master_ssl_cert='$MYSQL_TEST_DIR/std_data/client-cert.pem', - master_ssl_key='$MYSQL_TEST_DIR/std_data/client-key.pem'; -start slave; - -# Switch to master and insert one record, then sync it to slave -connection master; -insert into t1 values(1); -sync_slave_with_master; - -# The record should now be on slave -select * from t1; - -# The slave is synced and waiting/reading from master -# SHOW SLAVE STATUS will show "Waiting for master to send event" -let $status_items= Master_SSL_Allowed, Master_SSL_CA_Path, Master_SSL_CA_File, Master_SSL_Cert, Master_SSL_Key; -source include/show_slave_status.inc; -source include/check_slave_is_running.inc; - -# Stop the slave, as reported in bug#21871 it would hang -STOP SLAVE; - -select * from t1; - -# Do the same thing a number of times -disable_query_log; -disable_result_log; -# 2007-11-27 mats Bug #32756 Starting and stopping the slave in a loop can lose rows -# After discussions with Engineering, I'm disabling this part of the test to avoid it causing -# red trees. -disable_parsing; -let $i= 100; -while ($i) -{ - start slave; - connection master; - insert into t1 values (NULL); - select * from t1; # Some variance - connection slave; - select * from t1; # Some variance - stop slave; - dec $i; -} -enable_parsing; -START SLAVE; -enable_query_log; -enable_result_log; -connection master; -# INSERT one more record to make sure -# the sync has something to do -insert into t1 values (NULL); -let $master_count= `select count(*) from t1`; - -sync_slave_with_master; ---source include/wait_for_slave_to_start.inc -source include/show_slave_status.inc; -source include/check_slave_is_running.inc; - -let $slave_count= `select count(*) from t1`; - -if ($slave_count != $master_count) -{ - echo master and slave differed in number of rows; - echo master: $master_count; - echo slave: $slave_count; - - connection master; - select count(*) t1; - select * from t1; - connection slave; - select count(*) t1; - select * from t1; - query_vertical show slave status; -} - -connection master; -drop user replssl@localhost; -drop table t1; -sync_slave_with_master; - ---source include/stop_slave.inc -CHANGE MASTER TO - master_user = 'root', - master_ssl = 0, - master_ssl_ca = '', - master_ssl_cert = '', - master_ssl_key = ''; - ---echo End of 5.0 tests ---let $rpl_only_running_threads= 1 ---source include/rpl_end.inc +--source extra/rpl_tests/rpl_ssl.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test b/mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test index db6e6bd14bf..f72300ee2de 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test +++ b/mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test @@ -1,101 +1 @@ -# -# BUG#12400313 / BUG#64503 test case -# -# -# Description -# ----------- -# -# This test case starts the slave server with: -# --relay-log-space-limit=8192 --relay-log-purge --max-relay-log-size=4096 -# -# Then it issues some queries that will cause the slave to reach -# relay-log-space-limit. We lock the table so that the SQL thread is -# not able to purge the log and then we issue some more statements. -# -# The purpose is to show that the IO thread will honor the limits -# while the SQL thread is not able to purge the relay logs, which did -# not happen before this patch. In addition we assert that while -# ignoring the limit (SQL thread needs to rotate before purging), the -# IO thread does not do it in an uncontrolled manner. - ---source include/have_binlog_format_statement.inc ---source include/master-slave.inc ---source include/have_innodb.inc - ---disable_query_log -CREATE TABLE t1 (c1 TEXT) engine=InnoDB; - -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); - ---sync_slave_with_master - -# wait for the SQL thread to sleep ---let $show_statement= SHOW PROCESSLIST ---let $field= State ---let $condition= = 'Slave has read all relay log; waiting for the slave I/O thread to update it' ---source include/wait_show_condition.inc - -# now the io thread has set rli->ignore_space_limit -# lets lock the table so that once the SQL thread awakes -# it blocks there and does not set rli->ignore_space_limit -# back to zero -LOCK TABLE t1 WRITE; - -# now issue more statements that will overflow the -# rli->log_space_limit (in this case ~10K) ---connection master - -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); - ---connection slave - -# ASSERT that the IO thread waits for the SQL thread to release some -# space before continuing ---let $show_statement= SHOW PROCESSLIST ---let $field= State ---let $condition= LIKE 'Waiting for %' -# before the patch (IO would have transfered everything) -#--let $condition= = 'Waiting for master to send event' -# after the patch (now it waits for space to be freed) -#--let $condition= = 'Waiting for the slave SQL thread to free enough relay log space' ---source include/wait_show_condition.inc - -# without the patch we can uncomment the following two lines and -# watch the IO thread synchronize with the master, thus writing -# relay logs way over the space limit -#--connection master -#--source include/sync_slave_io_with_master.inc - -## ASSERT that the IO thread has honored the limit+few bytes required to be able to purge ---let $relay_log_space_while_sql_is_executing = query_get_value(SHOW SLAVE STATUS, Relay_Log_Space, 1) ---let $relay_log_space_limit = query_get_value(SHOW VARIABLES LIKE "relay_log_space_limit", Value, 1) ---let $assert_text= Assert that relay log space is close to the limit ---let $assert_cond= $relay_log_space_while_sql_is_executing <= $relay_log_space_limit * 1.15 ---source include/assert.inc - -# unlock the table and let SQL thread continue applying events -UNLOCK TABLES; - ---connection master ---sync_slave_with_master ---let $diff_tables=master:test.t1,slave:test.t1 ---source include/diff_tables.inc - ---connection master -DROP TABLE t1; ---enable_query_log ---sync_slave_with_master - ---source include/rpl_end.inc +--source extra/rpl_tests/rpl_stm_relay_ign_space.inc diff --git a/mysql-test/suite/rpl/t/rpl_stop_slave_error-slave.opt b/mysql-test/suite/rpl/t/rpl_stop_slave_error-slave.opt new file mode 100644 index 00000000000..32c4527a915 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_stop_slave_error-slave.opt @@ -0,0 +1 @@ +--log-error=$MYSQLTEST_VARDIR/tmp/slave_log.err diff --git a/mysql-test/suite/rpl/t/rpl_stop_slave_error.test b/mysql-test/suite/rpl/t/rpl_stop_slave_error.test new file mode 100644 index 00000000000..a88981c15c4 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_stop_slave_error.test @@ -0,0 +1,17 @@ +# +# MDEV-8345 STOP SLAVE should not cause an ERROR to be logged to the error log +# +source include/have_binlog_format_mixed.inc; # don't repeat the test three times +source include/master-slave.inc; + +connection master; +sync_slave_with_master; +source include/stop_slave.inc; +let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/slave_log.err; +let SEARCH_PATTERN=Error reading packet from server: Lost connection; +let SEARCH_RANGE= -50000; +source include/search_pattern_in_file.inc; + +source include/start_slave.inc; +source include/rpl_end.inc; + diff --git a/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test b/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test index 575fdb2e89d..cd826c6be1e 100644 --- a/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test +++ b/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test @@ -1,625 +1 @@ -# -# rpl_switch_stm_row_mixed tests covers -# -# - Master is switching explicitly between STATEMENT, ROW, and MIXED -# binlog format showing when it is possible and when not. -# - Master switching from MIXED to RBR implicitly listing all use -# cases, e.g a query invokes UUID(), thereafter to serve as the -# definition of MIXED binlog format -# - correctness of execution - - --- source include/have_binlog_format_mixed_or_row.inc --- source include/master-slave.inc - -# Since this test generates row-based events in the binary log, the -# slave SQL thread cannot be in STATEMENT mode to execute this test, -# so we only execute it for MIXED and ROW as default value of -# BINLOG_FORMAT. - -connection slave; - -connection master; ---disable_warnings -drop database if exists mysqltest1; -create database mysqltest1; ---enable_warnings -use mysqltest1; - -# Save binlog format -set @my_binlog_format= @@global.binlog_format; - -# play with switching -set session binlog_format=mixed; -show session variables like "binlog_format%"; -set session binlog_format=statement; -show session variables like "binlog_format%"; -set session binlog_format=row; -show session variables like "binlog_format%"; - -set global binlog_format=DEFAULT; -show global variables like "binlog_format%"; -set global binlog_format=MIXED; -show global variables like "binlog_format%"; -set global binlog_format=STATEMENT; -show global variables like "binlog_format%"; -set global binlog_format=ROW; -show global variables like "binlog_format%"; -show session variables like "binlog_format%"; -select @@global.binlog_format, @@session.binlog_format; - -CREATE TABLE t1 (a varchar(100)); - -prepare stmt1 from 'insert into t1 select concat(UUID(),?)'; -set @string="emergency_1_"; -insert into t1 values("work_2_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -prepare stmt1 from 'insert into t1 select ?'; -insert into t1 values(concat(UUID(),"work_3_")); -execute stmt1 using @string; -deallocate prepare stmt1; - -insert into t1 values(concat("for_4_",UUID())); -insert into t1 select "yesterday_5_"; - -# verify that temp tables prevent a switch to SBR -create temporary table tmp(a char(100)); -insert into tmp values("see_6_"); ---error ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR -set binlog_format=statement; -insert into t1 select * from tmp; -drop temporary table tmp; - -# Now we go to SBR -set binlog_format=statement; -show global variables like "binlog_format%"; -show session variables like "binlog_format%"; -select @@global.binlog_format, @@session.binlog_format; -set global binlog_format=statement; -show global variables like "binlog_format%"; -show session variables like "binlog_format%"; -select @@global.binlog_format, @@session.binlog_format; - -prepare stmt1 from 'insert into t1 select ?'; -set @string="emergency_7_"; -insert into t1 values("work_8_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -prepare stmt1 from 'insert into t1 select ?'; -insert into t1 values("work_9_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -insert into t1 values("for_10_"); -insert into t1 select "yesterday_11_"; - -# test statement (is not default after wl#3368) -set binlog_format=statement; -select @@global.binlog_format, @@session.binlog_format; -set global binlog_format=statement; -select @@global.binlog_format, @@session.binlog_format; - -prepare stmt1 from 'insert into t1 select ?'; -set @string="emergency_12_"; -insert into t1 values("work_13_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -prepare stmt1 from 'insert into t1 select ?'; -insert into t1 values("work_14_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -insert into t1 values("for_15_"); -insert into t1 select "yesterday_16_"; - -# and now the mixed mode - -set global binlog_format=mixed; -select @@global.binlog_format, @@session.binlog_format; -set binlog_format=default; -select @@global.binlog_format, @@session.binlog_format; - -prepare stmt1 from 'insert into t1 select concat(UUID(),?)'; -set @string="emergency_17_"; -insert into t1 values("work_18_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -prepare stmt1 from 'insert into t1 select ?'; -insert into t1 values(concat(UUID(),"work_19_")); -execute stmt1 using @string; -deallocate prepare stmt1; - -insert into t1 values(concat("for_20_",UUID())); -insert into t1 select "yesterday_21_"; - -prepare stmt1 from 'insert into t1 select ?'; -insert into t1 values(concat(UUID(),"work_22_")); -execute stmt1 using @string; -deallocate prepare stmt1; - -insert into t1 values(concat("for_23_",UUID())); -insert into t1 select "yesterday_24_"; - -# Test of CREATE TABLE SELECT - -create table t2 ENGINE=MyISAM select rpad(UUID(),100,' '); -create table t3 select 1 union select UUID(); ---disable_warnings -create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3); ---enable_warnings -create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3); -# what if UUID() is first: ---disable_warnings -insert into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4); ---enable_warnings - -# inside a stored procedure - -delimiter |; -create procedure foo() -begin -insert into t1 values("work_25_"); -insert into t1 values(concat("for_26_",UUID())); -insert into t1 select "yesterday_27_"; -end| -create procedure foo2() -begin -insert into t1 values(concat("emergency_28_",UUID())); -insert into t1 values("work_29_"); -insert into t1 values(concat("for_30_",UUID())); -set session binlog_format=row; # accepted for stored procs -insert into t1 values("more work_31_"); -set session binlog_format=mixed; -end| -create function foo3() returns bigint unsigned -begin - set session binlog_format=row; # rejected for stored funcs - insert into t1 values("alarm"); - return 100; -end| -create procedure foo4(x varchar(100)) -begin -insert into t1 values(concat("work_250_",x)); -insert into t1 select "yesterday_270_"; -end| -delimiter ;| -call foo(); -call foo2(); -call foo4("hello"); -call foo4(UUID()); -call foo4("world"); - -# test that can't SET in a stored function ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT -select foo3(); -select * from t1 where a="alarm"; - -# Tests of stored functions/triggers/views for BUG#20930 "Mixed -# binlogging mode does not work with stored functions, triggers, -# views" - -# Function which calls procedure -drop function foo3; -delimiter |; -create function foo3() returns bigint unsigned -begin - insert into t1 values("foo3_32_"); - call foo(); - return 100; -end| -delimiter ;| -insert into t2 select foo3(); - -prepare stmt1 from 'insert into t2 select foo3()'; -execute stmt1; -execute stmt1; -deallocate prepare stmt1; - -# Test if stored function calls stored function which calls procedure -# which requires row-based. - -delimiter |; -create function foo4() returns bigint unsigned -begin - insert into t2 select foo3(); - return 100; -end| -delimiter ;| -select foo4(); - -prepare stmt1 from 'select foo4()'; -execute stmt1; -execute stmt1; -deallocate prepare stmt1; - -# A simple stored function -delimiter |; -create function foo5() returns bigint unsigned -begin - insert into t2 select UUID(); - return 100; -end| -delimiter ;| -select foo5(); - -prepare stmt1 from 'select foo5()'; -execute stmt1; -execute stmt1; -deallocate prepare stmt1; - -# A simple stored function where UUID() is in the argument -delimiter |; -create function foo6(x varchar(100)) returns bigint unsigned -begin - insert into t2 select x; - return 100; -end| -delimiter ;| -select foo6("foo6_1_"); -select foo6(concat("foo6_2_",UUID())); - -prepare stmt1 from 'select foo6(concat("foo6_3_",UUID()))'; -execute stmt1; -execute stmt1; -deallocate prepare stmt1; - - -# Test of views using UUID() - -create view v1 as select uuid(); -create table t11 (data varchar(255)); -insert into t11 select * from v1; -# Test of querying INFORMATION_SCHEMA which parses the view's body, -# to verify that it binlogs statement-based (is not polluted by -# the parsing of the view's body). -insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11'); -prepare stmt1 from "insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')"; -execute stmt1; -execute stmt1; -deallocate prepare stmt1; - -# Test of triggers with UUID() -delimiter |; -create trigger t11_bi before insert on t11 for each row -begin - set NEW.data = concat(NEW.data,UUID()); -end| -delimiter ;| -insert into t11 values("try_560_"); - -# Test that INSERT DELAYED works in mixed mode (BUG#20649) -insert delayed into t2 values("delay_1_"); -insert delayed into t2 values(concat("delay_2_",UUID())); -insert delayed into t2 values("delay_6_"); - -# Test for BUG#20633 (INSERT DELAYED RAND()/user_variable does not -# replicate fine in statement-based ; we test that in mixed mode it -# works). -insert delayed into t2 values(rand()); -set @a=2.345; -insert delayed into t2 values(@a); - -# With INSERT DELAYED, rows are written to the binlog after they are -# written to the table. Therefore, it is not enough to wait until the -# rows make it to t2 on the master (the rows may not be in the binlog -# at that time, and may still not be in the binlog when -# sync_slave_with_master is later called). Instead, we wait until the -# rows make it to t2 on the slave. We first call -# sync_slave_with_master, so that we are sure that t2 has been created -# on the slave. -sync_slave_with_master; -let $wait_condition= SELECT COUNT(*) = 19 FROM mysqltest1.t2; ---source include/wait_condition.inc -connection master; - -# If you want to do manual testing of the mixed mode regarding UDFs (not -# testable automatically as quite platform- and compiler-dependent), -# you just need to set the variable below to 1, and to -# "make udf_example.so" in sql/, and to copy sql/udf_example.so to -# MYSQL_TEST_DIR/lib/mysql. -let $you_want_to_test_UDF=0; -if ($you_want_to_test_UDF) -{ - CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so'; - prepare stmt1 from 'insert into t1 select metaphon(?)'; - set @string="emergency_133_"; - insert into t1 values("work_134_"); - execute stmt1 using @string; - deallocate prepare stmt1; - prepare stmt1 from 'insert into t1 select ?'; - insert into t1 values(metaphon("work_135_")); - execute stmt1 using @string; - deallocate prepare stmt1; - insert into t1 values(metaphon("for_136_")); - insert into t1 select "yesterday_137_"; - create table t6 select metaphon("for_138_"); - create table t7 select 1 union select metaphon("for_139_"); - create table t8 select * from t1 where 3 in (select 1 union select 2 union select metaphon("for_140_") union select 3); - create table t9 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3); -} - -create table t20 select * from t1; # save for comparing later -create table t21 select * from t2; -create table t22 select * from t3; -drop table t1,t2,t3; - -# This tests the fix to -# BUG#19630 stored function inserting into two auto_increment breaks statement-based binlog -# We verify that under the mixed binlog mode, a stored function -# modifying at least two tables having an auto_increment column, -# is binlogged row-based. Indeed in statement-based binlogging, -# only the auto_increment value generated for the first table -# is recorded in the binlog, the value generated for the 2nd table -# lacking. - -create table t1 (a int primary key auto_increment, b varchar(100)); -create table t2 (a int primary key auto_increment, b varchar(100)); -create table t3 (b varchar(100)); -delimiter |; -create function f (x varchar(100)) returns int deterministic -begin - insert into t1 values(null,x); - insert into t2 values(null,x); - return 1; -end| -delimiter ;| -select f("try_41_"); -# Two operations which compensate each other except that their net -# effect is that they advance the auto_increment counter of t2 on slave: -sync_slave_with_master; -use mysqltest1; -insert into t2 values(2,null),(3,null),(4,null); -delete from t2 where a>=2; - -connection master; -# this is the call which didn't replicate well -select f("try_42_"); -sync_slave_with_master; - -# now use prepared statement and test again, just to see that the RBB -# mode isn't set at PREPARE but at EXECUTE. - -insert into t2 values(3,null),(4,null); -delete from t2 where a>=3; - -connection master; -prepare stmt1 from 'select f(?)'; -set @string="try_43_"; -insert into t1 values(null,"try_44_"); # should be SBB -execute stmt1 using @string; # should be RBB -deallocate prepare stmt1; -sync_slave_with_master; - -# verify that if only one table has auto_inc, it does not trigger RBB -# (we'll check in binlog further below) - -connection master; -create table t12 select * from t1; # save for comparing later -drop table t1; -create table t1 (a int, b varchar(100), key(a)); -select f("try_45_"); - -# restore table's key -create table t13 select * from t1; -drop table t1; -create table t1 (a int primary key auto_increment, b varchar(100)); - -# now test if it's two functions, each of them inserts in one table - -drop function f; -# we need a unique key to have sorting of rows by mysqldump -create table t14 (unique (a)) select * from t2; -truncate table t2; -delimiter |; -create function f1 (x varchar(100)) returns int deterministic -begin - insert into t1 values(null,x); - return 1; -end| -create function f2 (x varchar(100)) returns int deterministic -begin - insert into t2 values(null,x); - return 1; -end| -delimiter ;| -select f1("try_46_"),f2("try_47_"); - -sync_slave_with_master; -insert into t2 values(2,null),(3,null),(4,null); -delete from t2 where a>=2; - -connection master; -# Test with SELECT and INSERT -select f1("try_48_"),f2("try_49_"); -insert into t3 values(concat("try_50_",f1("try_51_"),f2("try_52_"))); -sync_slave_with_master; - -# verify that if f2 does only read on an auto_inc table, this does not -# switch to RBB -connection master; -drop function f2; -delimiter |; -create function f2 (x varchar(100)) returns int deterministic -begin - declare y int; - insert into t1 values(null,x); - set y = (select count(*) from t2); - return y; -end| -delimiter ;| -select f1("try_53_"),f2("try_54_"); -sync_slave_with_master; - -# And now, a normal statement with a trigger (no stored functions) - -connection master; -drop function f2; -delimiter |; -create trigger t1_bi before insert on t1 for each row -begin - insert into t2 values(null,"try_55_"); -end| -delimiter ;| -insert into t1 values(null,"try_56_"); -# and now remove one auto_increment and verify SBB -alter table t1 modify a int, drop primary key; -insert into t1 values(null,"try_57_"); -sync_slave_with_master; - -# Test for BUG#20499 "mixed mode with temporary table breaks binlog" -# Slave used to have only 2 rows instead of 3. -connection master; -CREATE TEMPORARY TABLE t15 SELECT UUID(); -create table t16 like t15; -INSERT INTO t16 SELECT * FROM t15; -# we'll verify that this one is done RBB -insert into t16 values("try_65_"); -drop table t15; -# we'll verify that this one is done SBB -insert into t16 values("try_66_"); -sync_slave_with_master; - -# and now compare: - -connection master; - -# first check that data on master is sensible -select count(*) from t1; -select count(*) from t2; -select count(*) from t3; -select count(*) from t4; -select count(*) from t5; -select count(*) from t11; -select count(*) from t20; -select count(*) from t21; -select count(*) from t22; -select count(*) from t12; -select count(*) from t13; -select count(*) from t14; -select count(*) from t16; -if ($you_want_to_test_UDF) -{ - select count(*) from t6; - select count(*) from t7; - select count(*) from t8; - select count(*) from t9; -} - -sync_slave_with_master; - -# -# Bug#20863 If binlog format is changed between update and unlock of -# tables, wrong binlog -# - -connection master; -DROP TABLE IF EXISTS t11; -SET SESSION BINLOG_FORMAT=STATEMENT; -CREATE TABLE t11 (song VARCHAR(255)); -LOCK TABLES t11 WRITE; -SET SESSION BINLOG_FORMAT=ROW; -INSERT INTO t11 VALUES('Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict'); -SET SESSION BINLOG_FORMAT=STATEMENT; -INSERT INTO t11 VALUES('Careful With That Axe, Eugene'); -UNLOCK TABLES; - ---query_vertical SELECT * FROM t11 -sync_slave_with_master; -USE mysqltest1; ---query_vertical SELECT * FROM t11 - -connection master; -DROP TABLE IF EXISTS t12; -SET SESSION BINLOG_FORMAT=MIXED; -CREATE TABLE t12 (data LONG); -LOCK TABLES t12 WRITE; -INSERT INTO t12 VALUES(UUID()); -UNLOCK TABLES; -sync_slave_with_master; - -# -# BUG#28086: SBR of USER() becomes corrupted on slave -# - -connection master; - -# Just to get something that is non-trivial, albeit still simple, we -# stuff the result of USER() and CURRENT_USER() into a variable. ---delimiter $$ -CREATE FUNCTION my_user() - RETURNS CHAR(64) -BEGIN - DECLARE user CHAR(64); - SELECT USER() INTO user; - RETURN user; -END $$ ---delimiter ; - ---delimiter $$ -CREATE FUNCTION my_current_user() - RETURNS CHAR(64) -BEGIN - DECLARE user CHAR(64); - SELECT CURRENT_USER() INTO user; - RETURN user; -END $$ ---delimiter ; - -DROP TABLE IF EXISTS t13; -CREATE TABLE t13 (data CHAR(64)); -INSERT INTO t13 VALUES (USER()); -INSERT INTO t13 VALUES (my_user()); -INSERT INTO t13 VALUES (CURRENT_USER()); -INSERT INTO t13 VALUES (my_current_user()); - -sync_slave_with_master; - -# as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql - -# Let's compare. Note: If they match test will pass, if they do not match -# the test will show that the diff statement failed and not reject file -# will be created. You will need to go to the mysql-test dir and diff -# the files your self to see what is not matching - -diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql; - -connection master; - -# Now test that mysqlbinlog works fine on a binlog generated by the -# mixed mode - -# BUG#11312 "DELIMITER is not written to the binary log that causes -# syntax error" makes that mysqlbinlog will fail if we pass it the -# text of queries; this forces us to use --base64-output here. - -# BUG#20929 "BINLOG command causes invalid free plus assertion -# failure" makes mysqld segfault when receiving --base64-output - -# So I can't enable this piece of test -# SIGH - -if ($enable_when_11312_or_20929_fixed) -{ ---exec $MYSQL_BINLOG --base64-output $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql -drop database mysqltest1; ---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql -# the old mysqldump output on slave is the same as what it was on -# master before restoring on master. -diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql; -} - -drop database mysqltest1; -sync_slave_with_master; - -connection master; -# Restore binlog format setting -set global binlog_format =@my_binlog_format; ---source include/rpl_end.inc +--source extra/rpl_tests/rpl_switch_stm_row_mixed.inc diff --git a/mysql-test/suite/rpl/t/rpl_sync.test b/mysql-test/suite/rpl/t/rpl_sync.test index 820ec19925f..ec98a344282 100644 --- a/mysql-test/suite/rpl/t/rpl_sync.test +++ b/mysql-test/suite/rpl/t/rpl_sync.test @@ -1,153 +1,2 @@ -######################################################################################## -# This test verifies the options --sync-relay-log-info and --relay-log-recovery by -# crashing the slave in two different situations: -# (case-1) - Corrupt the relay log with changes which were not processed by -# the SQL Thread and crashes it. -# (case-2) - Corrupt the master.info with wrong coordinates and crashes it. -# -# Case 1: -# 1 - Stops the SQL Thread -# 2 - Inserts new records into the master. -# 3 - Corrupts the relay-log.bin* which most likely has such changes. -# 4 - Crashes the slave -# 5 - Verifies if the slave is sync with the master which means that the information -# loss was circumvented by the recovery process. -# -# Case 2: -# 1 - Stops the SQL/IO Threads -# 2 - Inserts new records into the master. -# 3 - Corrupts the master.info with wrong coordinates. -# 4 - Crashes the slave -# 5 - Verifies if the slave is sync with the master which means that the information -# loss was circumvented by the recovery process. -######################################################################################## - -######################################################################################## -# Configuring the environment -######################################################################################## ---echo =====Configuring the enviroment=======; ---source include/master-slave.inc ---source include/not_embedded.inc ---source include/not_valgrind.inc ---source include/have_debug.inc ---source include/have_innodb.inc ---source include/not_crashrep.inc - -call mtr.add_suppression('Attempting backtrace'); -call mtr.add_suppression("Recovery from master pos .* and file master-bin.000001"); -# Use innodb so we do not get "table should be repaired" issues. -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -flush tables; -CREATE TABLE t1(a INT, PRIMARY KEY(a)) engine=innodb; - -insert into t1(a) values(1); -insert into t1(a) values(2); -insert into t1(a) values(3); - -######################################################################################## -# Case 1: Corrupt a relay-log.bin* -######################################################################################## ---echo =====Inserting data on the master but without the SQL Thread being running=======; -sync_slave_with_master; - -connection slave; -let $MYSQLD_SLAVE_DATADIR= `select @@datadir`; ---replace_result $MYSQLD_SLAVE_DATADIR MYSQLD_SLAVE_DATADIR ---copy_file $MYSQLD_SLAVE_DATADIR/master.info $MYSQLD_SLAVE_DATADIR/master.backup ---source include/stop_slave_sql.inc - -connection master; -insert into t1(a) values(4); -insert into t1(a) values(5); -insert into t1(a) values(6); - ---echo =====Removing relay log files and crashing/recoverying the slave=======; -connection slave; ---source include/stop_slave_io.inc - -let $file= query_get_value("SHOW SLAVE STATUS", Relay_Log_File, 1); - ---let FILE_TO_CORRUPT= $MYSQLD_SLAVE_DATADIR/$file -perl; -$file= $ENV{'FILE_TO_CORRUPT'}; -open(FILE, ">$file") || die "Unable to open $file."; -truncate(FILE,0); -print FILE "failure"; -close ($file); -EOF - ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect -SET SESSION debug_dbug="d,crash_before_rotate_relaylog"; ---error 2013 -FLUSH LOGS; - ---let $rpl_server_number= 2 ---source include/rpl_reconnect.inc - ---echo =====Dumping and comparing tables=======; ---source include/start_slave.inc - -connection master; -sync_slave_with_master; - -let $diff_tables=master:t1,slave:t1; -source include/diff_tables.inc; - -######################################################################################## -# Case 2: Corrupt a master.info -######################################################################################## ---echo =====Corrupting the master.info=======; -connection slave; ---source include/stop_slave.inc - -connection master; -FLUSH LOGS; - -insert into t1(a) values(7); -insert into t1(a) values(8); -insert into t1(a) values(9); - -connection slave; -let MYSQLD_SLAVE_DATADIR=`select @@datadir`; - ---perl -use strict; -use warnings; -my $src= "$ENV{'MYSQLD_SLAVE_DATADIR'}/master.backup"; -my $dst= "$ENV{'MYSQLD_SLAVE_DATADIR'}/master.info"; -open(FILE, "<", $src) or die; -my @content= ; -close FILE; -open(FILE, ">", $dst) or die; -binmode FILE; -print FILE @content; -close FILE; -EOF - ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect -SET SESSION debug_dbug="d,crash_before_rotate_relaylog"; ---error 2013 -FLUSH LOGS; - ---let $rpl_server_number= 2 ---source include/rpl_reconnect.inc - ---echo =====Dumping and comparing tables=======; ---source include/start_slave.inc - -connection master; -sync_slave_with_master; - -let $diff_tables=master:t1,slave:t1; -source include/diff_tables.inc; - -######################################################################################## -# Clean up -######################################################################################## ---echo =====Clean up=======; -connection master; -drop table t1; - ---remove_file $MYSQLD_SLAVE_DATADIR/master.backup ---source include/rpl_end.inc +--source extra/rpl_tests/rpl_sync.inc diff --git a/mysql-test/suite/rpl/t/rpl_temporal_format_default_to_default.test b/mysql-test/suite/rpl/t/rpl_temporal_format_default_to_default.test index af4ce104af4..99a70e011c4 100644 --- a/mysql-test/suite/rpl/t/rpl_temporal_format_default_to_default.test +++ b/mysql-test/suite/rpl/t/rpl_temporal_format_default_to_default.test @@ -1,76 +1 @@ ---source include/master-slave.inc - -if ($force_master_mysql56_temporal_format) -{ - connection master; - eval SET @@global.mysql56_temporal_format=$force_master_mysql56_temporal_format; -} - -if ($force_slave_mysql56_temporal_format) -{ - connection slave; - eval SET @@global.mysql56_temporal_format=$force_slave_mysql56_temporal_format; -} - -connection master; -SELECT @@global.mysql56_temporal_format AS on_master; -connection slave; -SELECT @@global.mysql56_temporal_format AS on_slave; -connection master; - -CREATE TABLE t1 -( - c0 TIME(0), - c1 TIME(1), - c2 TIME(2), - c3 TIME(3), - c4 TIME(4), - c5 TIME(5), - c6 TIME(6) -); -CREATE TABLE t2 -( - c0 TIMESTAMP(0), - c1 TIMESTAMP(1), - c2 TIMESTAMP(2), - c3 TIMESTAMP(3), - c4 TIMESTAMP(4), - c5 TIMESTAMP(5), - c6 TIMESTAMP(6) -); - -CREATE TABLE t3 -( - c0 DATETIME(0), - c1 DATETIME(1), - c2 DATETIME(2), - c3 DATETIME(3), - c4 DATETIME(4), - c5 DATETIME(5), - c6 DATETIME(6) -); -INSERT INTO t1 VALUES ('01:01:01','01:01:01.1','01:01:01.11','01:01:01.111','01:01:01.1111','01:01:01.11111','01:01:01.111111'); -INSERT INTO t2 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111'); -INSERT INTO t3 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111'); -SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME; -sync_slave_with_master; - -connection slave; ---query_vertical SELECT * FROM t1; ---query_vertical SELECT * FROM t2; ---query_vertical SELECT * FROM t3; -SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME; - -connection master; -DROP TABLE t1; -DROP TABLE t2; -DROP TABLE t3; - -connection slave; -SET @@global.mysql56_temporal_format=DEFAULT; -connection master; -SET @@global.mysql56_temporal_format=DEFAULT; - ---source include/rpl_end.inc +--source extra/rpl_tests/rpl_temporal_format_default_to_default.inc diff --git a/mysql-test/suite/rpl/t/rpl_typeconv.test b/mysql-test/suite/rpl/t/rpl_typeconv.test index 59d75dd47f5..4dbfc27d088 100644 --- a/mysql-test/suite/rpl/t/rpl_typeconv.test +++ b/mysql-test/suite/rpl/t/rpl_typeconv.test @@ -1,72 +1 @@ ---source include/have_binlog_format_row.inc ---source include/master-slave.inc - -connection slave; -set @saved_slave_type_conversions = @@global.slave_type_conversions; -CREATE TABLE type_conversions ( - TestNo INT AUTO_INCREMENT PRIMARY KEY, - Source TEXT, - Target TEXT, - Flags TEXT, - On_Master TEXT, - On_Slave TEXT, - Expected TEXT, - Compare INT, - Error TEXT); - -SELECT @@global.slave_type_conversions; -SET GLOBAL SLAVE_TYPE_CONVERSIONS=''; -SELECT @@global.slave_type_conversions; -SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY'; -SELECT @@global.slave_type_conversions; -SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY'; -SELECT @@global.slave_type_conversions; -SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY'; -SELECT @@global.slave_type_conversions; ---error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY,NONEXISTING_BIT'; -SELECT @@global.slave_type_conversions; - -# Checking strict interpretation of type conversions -connection slave; -SET GLOBAL SLAVE_TYPE_CONVERSIONS=''; -source extra/rpl_tests/type_conversions.test; - -# Checking lossy integer type conversions -connection slave; -SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY'; -source extra/rpl_tests/type_conversions.test; - -# Checking non-lossy integer type conversions -connection slave; -SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY'; -source extra/rpl_tests/type_conversions.test; - -# Checking all type conversions -connection slave; -SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY'; -source extra/rpl_tests/type_conversions.test; - -connection slave; ---echo **** Result of conversions **** -disable_query_log; -SELECT RPAD(Source, 15, ' ') AS Source_Type, - RPAD(Target, 15, ' ') AS Target_Type, - RPAD(Flags, 25, ' ') AS All_Type_Conversion_Flags, - IF(Compare IS NULL AND Error IS NOT NULL, '', - IF(Compare, '', - CONCAT("'", On_Slave, "' != '", Expected, "'"))) - AS Value_On_Slave - FROM type_conversions; -enable_query_log; -DROP TABLE type_conversions; - -call mtr.add_suppression("Slave SQL.*Column 1 of table .test.t1. cannot be converted from type.* error.* 1677"); - -connection master; -DROP TABLE t1; -sync_slave_with_master; - -set global slave_type_conversions = @saved_slave_type_conversions; - ---source include/rpl_end.inc +--source extra/rpl_tests/rpl_typeconv.inc diff --git a/mysql-test/suite/storage_engine/parts/truncate_table.result b/mysql-test/suite/storage_engine/parts/truncate_table.result index e3b18d57989..fc409b805e2 100644 --- a/mysql-test/suite/storage_engine/parts/truncate_table.result +++ b/mysql-test/suite/storage_engine/parts/truncate_table.result @@ -14,8 +14,8 @@ t1 CREATE TABLE `t1` ( `c` char(8) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE= DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) -PARTITIONS 2 */ + PARTITION BY HASH (a) +PARTITIONS 2 INSERT INTO t1 (c) VALUES ('a'),('b'),('c'); SHOW CREATE TABLE t1; Table Create Table @@ -24,8 +24,8 @@ t1 CREATE TABLE `t1` ( `c` char(8) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE= AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) -PARTITIONS 2 */ + PARTITION BY HASH (a) +PARTITIONS 2 TRUNCATE TABLE t1; SHOW CREATE TABLE t1; Table Create Table @@ -34,8 +34,8 @@ t1 CREATE TABLE `t1` ( `c` char(8) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE= DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) -PARTITIONS 2 */ + PARTITION BY HASH (a) +PARTITIONS 2 INSERT INTO t1 (c) VALUES ('d'); SHOW CREATE TABLE t1; Table Create Table @@ -44,8 +44,8 @@ t1 CREATE TABLE `t1` ( `c` char(8) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE= AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (a) -PARTITIONS 2 */ + PARTITION BY HASH (a) +PARTITIONS 2 SELECT a,c FROM t1; a c 1 d diff --git a/mysql-test/suite/sys_vars/disabled.def b/mysql-test/suite/sys_vars/disabled.def index a009bc5c174..e4a2699f031 100644 --- a/mysql-test/suite/sys_vars/disabled.def +++ b/mysql-test/suite/sys_vars/disabled.def @@ -11,5 +11,4 @@ ############################################################################## innodb_flush_checkpoint_debug_basic: removed from XtraDB-26.0 -table_open_cache_instances_basic: no such variable in MariaDB all_vars: obsolete, see sysvars_* tests diff --git a/mysql-test/suite/sys_vars/inc/sysvars_server.inc b/mysql-test/suite/sys_vars/inc/sysvars_server.inc index cb06b40f8c9..76d35f0fd55 100644 --- a/mysql-test/suite/sys_vars/inc/sysvars_server.inc +++ b/mysql-test/suite/sys_vars/inc/sysvars_server.inc @@ -1,3 +1,4 @@ +--source include/have_perfschema.inc --source include/word_size.inc --vertical_results diff --git a/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_off.result b/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_off.result index cdf612e6db8..f214e6d7dac 100644 --- a/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_off.result +++ b/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_off.result @@ -2,7 +2,7 @@ CREATE TABLE t1 (a TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NULL); @@ -32,7 +32,7 @@ CREATE TABLE t1 (a TIMESTAMP DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP + `a` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NULL DEFAULT NULL); @@ -60,7 +60,7 @@ CREATE TABLE t1 (a TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NULL DEFAULT CURRENT_TIMESTAMP + `a` timestamp NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'); @@ -81,14 +81,14 @@ CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP + `a` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NOT NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -96,7 +96,7 @@ CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -104,7 +104,7 @@ CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP DEFAULT '0000-00-00 00:00:00'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -112,7 +112,7 @@ CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -120,7 +120,7 @@ CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00') SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -128,39 +128,39 @@ CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `b` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `b` timestamp NULL DEFAULT CURRENT_TIMESTAMP + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `b` timestamp NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `b` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP) AS SELECT 1 AS i; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `i` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 (b TIMESTAMP) AS SELECT a FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; DROP TABLE t1; @@ -170,6 +170,6 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; diff --git a/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_on.result b/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_on.result index 1c42da57bfc..5219fd4e9c4 100644 --- a/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_on.result +++ b/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_on.result @@ -37,7 +37,7 @@ CREATE TABLE t1 (a TIMESTAMP DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NULL DEFAULT CURRENT_TIMESTAMP + `a` timestamp NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NULL DEFAULT NULL); @@ -65,7 +65,7 @@ CREATE TABLE t1 (a TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NULL DEFAULT CURRENT_TIMESTAMP + `a` timestamp NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'); @@ -86,7 +86,7 @@ CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP + `a` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NOT NULL); @@ -134,7 +134,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT NULL, - `b` timestamp NULL DEFAULT CURRENT_TIMESTAMP + `b` timestamp NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP); @@ -142,7 +142,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT NULL, - `b` timestamp NULL DEFAULT CURRENT_TIMESTAMP + `b` timestamp NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP); @@ -150,7 +150,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT NULL, - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP + `b` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP) AS SELECT 1 AS i; diff --git a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_dump_pct_basic.result b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_dump_pct_basic.result index b2cc55ce71e..485136ccc4c 100644 --- a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_dump_pct_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_dump_pct_basic.result @@ -1,3 +1,4 @@ +SET @orig = @@global.innodb_buffer_pool_dump_pct; SELECT @@global.innodb_buffer_pool_dump_pct; @@global.innodb_buffer_pool_dump_pct 25 @@ -33,3 +34,4 @@ SET GLOBAL innodb_buffer_pool_dump_pct='foo'; ERROR 42000: Incorrect argument type to variable 'innodb_buffer_pool_dump_pct' SET innodb_buffer_pool_dump_pct=50; ERROR HY000: Variable 'innodb_buffer_pool_dump_pct' is a GLOBAL variable and should be set with SET GLOBAL +SET GLOBAL innodb_buffer_pool_dump_pct=@orig; diff --git a/mysql-test/suite/sys_vars/r/innodb_cleaner_eviction_factor_basic.result b/mysql-test/suite/sys_vars/r/innodb_cleaner_eviction_factor_basic.result deleted file mode 100644 index 8f017ea40ec..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_cleaner_eviction_factor_basic.result +++ /dev/null @@ -1,31 +0,0 @@ -SET @start_value = @@GLOBAL.innodb_cleaner_eviction_factor; -SELECT @@GLOBAL.innodb_cleaner_eviction_factor; -@@GLOBAL.innodb_cleaner_eviction_factor -0 -SELECT @@SESSION.innodb_cleaner_eviction_factor; -ERROR HY000: Variable 'innodb_cleaner_eviction_factor' is a GLOBAL variable -SET GLOBAL innodb_cleaner_eviction_factor='OFF'; -SELECT @@GLOBAL.innodb_cleaner_eviction_factor; -@@GLOBAL.innodb_cleaner_eviction_factor -0 -SET GLOBAL innodb_cleaner_eviction_factor='ON'; -SELECT @@GLOBAL.innodb_cleaner_eviction_factor; -@@GLOBAL.innodb_cleaner_eviction_factor -1 -SET GLOBAL innodb_cleaner_eviction_factor=0; -SELECT @@GLOBAL.innodb_cleaner_eviction_factor; -@@GLOBAL.innodb_cleaner_eviction_factor -0 -SET GLOBAL innodb_cleaner_eviction_factor=1; -SELECT @@GLOBAL.innodb_cleaner_eviction_factor; -@@GLOBAL.innodb_cleaner_eviction_factor -1 -SET GLOBAL innodb_cleaner_eviction_factor=1.1; -ERROR 42000: Incorrect argument type to variable 'innodb_cleaner_eviction_factor' -SET GLOBAL innodb_cleaner_eviction_factor=1e1; -ERROR 42000: Incorrect argument type to variable 'innodb_cleaner_eviction_factor' -SET GLOBAL innodb_cleaner_eviction_factor=2; -ERROR 42000: Variable 'innodb_cleaner_eviction_factor' can't be set to the value of '2' -SET GLOBAL innodb_cleaner_eviction_factor='foo'; -ERROR 42000: Variable 'innodb_cleaner_eviction_factor' can't be set to the value of 'foo' -SET GLOBAL innodb_cleaner_eviction_factor = @start_value; diff --git a/mysql-test/suite/sys_vars/r/innodb_cleaner_flush_chunk_size_basic.result b/mysql-test/suite/sys_vars/r/innodb_cleaner_flush_chunk_size_basic.result deleted file mode 100644 index 651023d7a38..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_cleaner_flush_chunk_size_basic.result +++ /dev/null @@ -1,31 +0,0 @@ -SET @start_value = @@GLOBAL.innodb_cleaner_flush_chunk_size; -SELECT @@GLOBAL.innodb_cleaner_flush_chunk_size; -@@GLOBAL.innodb_cleaner_flush_chunk_size -100 -SELECT @@SESSION.innodb_cleaner_flush_chunk_size; -ERROR HY000: Variable 'innodb_cleaner_flush_chunk_size' is a GLOBAL variable -SET GLOBAL innodb_cleaner_flush_chunk_size=1; -SELECT @@GLOBAL.innodb_cleaner_flush_chunk_size; -@@GLOBAL.innodb_cleaner_flush_chunk_size -1 -SET GLOBAL innodb_cleaner_flush_chunk_size=1000; -SELECT @@GLOBAL.innodb_cleaner_flush_chunk_size; -@@GLOBAL.innodb_cleaner_flush_chunk_size -1000 -SET GLOBAL innodb_cleaner_flush_chunk_size=4294967295; -SELECT @@GLOBAL.innodb_cleaner_flush_chunk_size; -@@GLOBAL.innodb_cleaner_flush_chunk_size -4294967295 -SET GLOBAL innodb_cleaner_flush_chunk_size=0; -Warnings: -Warning 1292 Truncated incorrect innodb_cleaner_flush_chunk_size value: '0' -SELECT @@GLOBAL.innodb_cleaner_flush_chunk_size; -@@GLOBAL.innodb_cleaner_flush_chunk_size -1 -SET GLOBAL innodb_cleaner_flush_chunk_size=1.1; -ERROR 42000: Incorrect argument type to variable 'innodb_cleaner_flush_chunk_size' -SET GLOBAL innodb_cleaner_flush_chunk_size=1e1; -ERROR 42000: Incorrect argument type to variable 'innodb_cleaner_flush_chunk_size' -SET GLOBAL innodb_cleaner_flush_chunk_size='foo'; -ERROR 42000: Incorrect argument type to variable 'innodb_cleaner_flush_chunk_size' -SET GLOBAL innodb_cleaner_flush_chunk_size = @start_value; diff --git a/mysql-test/suite/sys_vars/r/innodb_cleaner_free_list_lwm_basic.result b/mysql-test/suite/sys_vars/r/innodb_cleaner_free_list_lwm_basic.result deleted file mode 100644 index 2d7883b7d83..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_cleaner_free_list_lwm_basic.result +++ /dev/null @@ -1,35 +0,0 @@ -SET @start_value = @@GLOBAL.innodb_cleaner_free_list_lwm; -SELECT @@GLOBAL.innodb_cleaner_free_list_lwm; -@@GLOBAL.innodb_cleaner_free_list_lwm -10 -SELECT @@SESSION.innodb_cleaner_free_list_lwm; -ERROR HY000: Variable 'innodb_cleaner_free_list_lwm' is a GLOBAL variable -SET GLOBAL innodb_cleaner_free_list_lwm=0; -SELECT @@GLOBAL.innodb_cleaner_free_list_lwm; -@@GLOBAL.innodb_cleaner_free_list_lwm -0 -SET GLOBAL innodb_cleaner_free_list_lwm=1; -SELECT @@GLOBAL.innodb_cleaner_free_list_lwm; -@@GLOBAL.innodb_cleaner_free_list_lwm -1 -SET GLOBAL innodb_cleaner_free_list_lwm=99; -SELECT @@GLOBAL.innodb_cleaner_free_list_lwm; -@@GLOBAL.innodb_cleaner_free_list_lwm -99 -SET GLOBAL innodb_cleaner_free_list_lwm=100; -SELECT @@GLOBAL.innodb_cleaner_free_list_lwm; -@@GLOBAL.innodb_cleaner_free_list_lwm -100 -SET GLOBAL innodb_cleaner_free_list_lwm=101; -Warnings: -Warning 1292 Truncated incorrect innodb_cleaner_free_list_lwm value: '101' -SELECT @@innodb_cleaner_free_list_lwm; -@@innodb_cleaner_free_list_lwm -100 -SET GLOBAL innodb_cleaner_free_list_lwm=1.1; -ERROR 42000: Incorrect argument type to variable 'innodb_cleaner_free_list_lwm' -SET GLOBAL innodb_cleaner_free_list_lwm=1e1; -ERROR 42000: Incorrect argument type to variable 'innodb_cleaner_free_list_lwm' -SET GLOBAL innodb_cleaner_free_list_lwm='foo'; -ERROR 42000: Incorrect argument type to variable 'innodb_cleaner_free_list_lwm' -SET GLOBAL innodb_cleaner_free_list_lwm = @start_value; diff --git a/mysql-test/suite/sys_vars/r/innodb_cleaner_lru_chunk_size_basic.result b/mysql-test/suite/sys_vars/r/innodb_cleaner_lru_chunk_size_basic.result deleted file mode 100644 index 5dfc6738e11..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_cleaner_lru_chunk_size_basic.result +++ /dev/null @@ -1,31 +0,0 @@ -SET @start_value = @@GLOBAL.innodb_cleaner_lru_chunk_size; -SELECT @@GLOBAL.innodb_cleaner_lru_chunk_size; -@@GLOBAL.innodb_cleaner_lru_chunk_size -100 -SELECT @@SESSION.innodb_cleaner_lru_chunk_size; -ERROR HY000: Variable 'innodb_cleaner_lru_chunk_size' is a GLOBAL variable -SET GLOBAL innodb_cleaner_lru_chunk_size=1; -SELECT @@GLOBAL.innodb_cleaner_lru_chunk_size; -@@GLOBAL.innodb_cleaner_lru_chunk_size -1 -SET GLOBAL innodb_cleaner_lru_chunk_size=1000; -SELECT @@GLOBAL.innodb_cleaner_lru_chunk_size; -@@GLOBAL.innodb_cleaner_lru_chunk_size -1000 -SET GLOBAL innodb_cleaner_lru_chunk_size=4294967295; -SELECT @@GLOBAL.innodb_cleaner_lru_chunk_size; -@@GLOBAL.innodb_cleaner_lru_chunk_size -4294967295 -SET GLOBAL innodb_cleaner_lru_chunk_size=0; -Warnings: -Warning 1292 Truncated incorrect innodb_cleaner_lru_chunk_size value: '0' -SELECT @@GLOBAL.innodb_cleaner_lru_chunk_size; -@@GLOBAL.innodb_cleaner_lru_chunk_size -1 -SET GLOBAL innodb_cleaner_lru_chunk_size=1.1; -ERROR 42000: Incorrect argument type to variable 'innodb_cleaner_lru_chunk_size' -SET GLOBAL innodb_cleaner_lru_chunk_size=1e1; -ERROR 42000: Incorrect argument type to variable 'innodb_cleaner_lru_chunk_size' -SET GLOBAL innodb_cleaner_lru_chunk_size='foo'; -ERROR 42000: Incorrect argument type to variable 'innodb_cleaner_lru_chunk_size' -SET GLOBAL innodb_cleaner_lru_chunk_size = @start_value; diff --git a/mysql-test/suite/sys_vars/r/innodb_cleaner_lsn_age_factor_basic.result b/mysql-test/suite/sys_vars/r/innodb_cleaner_lsn_age_factor_basic.result deleted file mode 100644 index 65046d93344..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_cleaner_lsn_age_factor_basic.result +++ /dev/null @@ -1,21 +0,0 @@ -SET @start_value = @@GLOBAL.innodb_cleaner_lsn_age_factor; -SELECT @@GLOBAL.innodb_cleaner_lsn_age_factor; -@@GLOBAL.innodb_cleaner_lsn_age_factor -HIGH_CHECKPOINT -SELECT @@SESSION.innodb_cleaner_lsn_age_factor; -ERROR HY000: Variable 'innodb_cleaner_lsn_age_factor' is a GLOBAL variable -SET GLOBAL innodb_cleaner_lsn_age_factor='legacy'; -SELECT @@GLOBAL.innodb_cleaner_lsn_age_factor; -@@GLOBAL.innodb_cleaner_lsn_age_factor -LEGACY -SET GLOBAL innodb_cleaner_lsn_age_factor='high_checkpoint'; -SELECT @@GLOBAL.innodb_cleaner_lsn_age_factor; -@@GLOBAL.innodb_cleaner_lsn_age_factor -HIGH_CHECKPOINT -SET GLOBAL innodb_cleaner_lsn_age_factor=1.1; -ERROR 42000: Incorrect argument type to variable 'innodb_cleaner_lsn_age_factor' -SET GLOBAL innodb_cleaner_lsn_age_factor=1e1; -ERROR 42000: Incorrect argument type to variable 'innodb_cleaner_lsn_age_factor' -SET GLOBAL innodb_cleaner_lsn_age_factor='foo'; -ERROR 42000: Variable 'innodb_cleaner_lsn_age_factor' can't be set to the value of 'foo' -SET GLOBAL innodb_cleaner_lsn_age_factor = @start_value; diff --git a/mysql-test/suite/sys_vars/r/innodb_cleaner_max_flush_time_basic.result b/mysql-test/suite/sys_vars/r/innodb_cleaner_max_flush_time_basic.result deleted file mode 100644 index e4a3fa26e73..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_cleaner_max_flush_time_basic.result +++ /dev/null @@ -1,25 +0,0 @@ -SET @start_value = @@GLOBAL.innodb_cleaner_max_flush_time; -SELECT @@GLOBAL.innodb_cleaner_max_flush_time; -@@GLOBAL.innodb_cleaner_max_flush_time -1000 -SELECT @@SESSION.innodb_cleaner_max_flush_time; -ERROR HY000: Variable 'innodb_cleaner_max_flush_time' is a GLOBAL variable -SET GLOBAL innodb_cleaner_max_flush_time=0; -SELECT @@GLOBAL.innodb_cleaner_max_flush_time; -@@GLOBAL.innodb_cleaner_max_flush_time -0 -SET GLOBAL innodb_cleaner_max_flush_time=1000; -SELECT @@GLOBAL.innodb_cleaner_max_flush_time; -@@GLOBAL.innodb_cleaner_max_flush_time -1000 -SET GLOBAL innodb_cleaner_max_flush_time=4294967295; -SELECT @@GLOBAL.innodb_cleaner_max_flush_time; -@@GLOBAL.innodb_cleaner_max_flush_time -4294967295 -SET GLOBAL innodb_cleaner_max_flush_time=1.1; -ERROR 42000: Incorrect argument type to variable 'innodb_cleaner_max_flush_time' -SET GLOBAL innodb_cleaner_max_flush_time=1e1; -ERROR 42000: Incorrect argument type to variable 'innodb_cleaner_max_flush_time' -SET GLOBAL innodb_cleaner_max_flush_time='foo'; -ERROR 42000: Incorrect argument type to variable 'innodb_cleaner_max_flush_time' -SET GLOBAL innodb_cleaner_max_flush_time = @start_value; diff --git a/mysql-test/suite/sys_vars/r/innodb_cleaner_max_lru_time_basic.result b/mysql-test/suite/sys_vars/r/innodb_cleaner_max_lru_time_basic.result deleted file mode 100644 index f7bacbbd62e..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_cleaner_max_lru_time_basic.result +++ /dev/null @@ -1,25 +0,0 @@ -SET @start_value = @@GLOBAL.innodb_cleaner_max_lru_time; -SELECT @@GLOBAL.innodb_cleaner_max_lru_time; -@@GLOBAL.innodb_cleaner_max_lru_time -1000 -SELECT @@SESSION.innodb_cleaner_max_lru_time; -ERROR HY000: Variable 'innodb_cleaner_max_lru_time' is a GLOBAL variable -SET GLOBAL innodb_cleaner_max_lru_time=0; -SELECT @@GLOBAL.innodb_cleaner_max_lru_time; -@@GLOBAL.innodb_cleaner_max_lru_time -0 -SET GLOBAL innodb_cleaner_max_lru_time=1000; -SELECT @@GLOBAL.innodb_cleaner_max_lru_time; -@@GLOBAL.innodb_cleaner_max_lru_time -1000 -SET GLOBAL innodb_cleaner_max_lru_time=4294967295; -SELECT @@GLOBAL.innodb_cleaner_max_lru_time; -@@GLOBAL.innodb_cleaner_max_lru_time -4294967295 -SET GLOBAL innodb_cleaner_max_lru_time=1.1; -ERROR 42000: Incorrect argument type to variable 'innodb_cleaner_max_lru_time' -SET GLOBAL innodb_cleaner_max_lru_time=1e1; -ERROR 42000: Incorrect argument type to variable 'innodb_cleaner_max_lru_time' -SET GLOBAL innodb_cleaner_max_lru_time='foo'; -ERROR 42000: Incorrect argument type to variable 'innodb_cleaner_max_lru_time' -SET GLOBAL innodb_cleaner_max_lru_time = @start_value; diff --git a/mysql-test/suite/sys_vars/r/innodb_empty_free_list_algorithm_basic.result b/mysql-test/suite/sys_vars/r/innodb_empty_free_list_algorithm_basic.result deleted file mode 100644 index 0730055d104..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_empty_free_list_algorithm_basic.result +++ /dev/null @@ -1,23 +0,0 @@ -SET @start_value = @@GLOBAL.innodb_empty_free_list_algorithm; -SELECT @@GLOBAL.innodb_empty_free_list_algorithm; -@@GLOBAL.innodb_empty_free_list_algorithm -BACKOFF -SELECT @@SESSION.innodb_empty_free_list_algorithm; -ERROR HY000: Variable 'innodb_empty_free_list_algorithm' is a GLOBAL variable -SET GLOBAL innodb_empty_free_list_algorithm='legacy'; -SELECT @@GLOBAL.innodb_empty_free_list_algorithm; -@@GLOBAL.innodb_empty_free_list_algorithm -LEGACY -SET GLOBAL innodb_empty_free_list_algorithm='backoff'; -SELECT @@GLOBAL.innodb_empty_free_list_algorithm; -@@GLOBAL.innodb_empty_free_list_algorithm -BACKOFF -SET GLOBAL innodb_empty_free_list_algorithm=1.1; -ERROR 42000: Incorrect argument type to variable 'innodb_empty_free_list_algorithm' -SET GLOBAL innodb_empty_free_list_algorithm=1e1; -ERROR 42000: Incorrect argument type to variable 'innodb_empty_free_list_algorithm' -SET GLOBAL innodb_empty_free_list_algorithm=2; -ERROR 42000: Variable 'innodb_empty_free_list_algorithm' can't be set to the value of '2' -SET GLOBAL innodb_empty_free_list_algorithm='foo'; -ERROR 42000: Variable 'innodb_empty_free_list_algorithm' can't be set to the value of 'foo' -SET GLOBAL innodb_empty_free_list_algorithm = @start_value; diff --git a/mysql-test/suite/sys_vars/r/innodb_foreground_preflush_basic.result b/mysql-test/suite/sys_vars/r/innodb_foreground_preflush_basic.result deleted file mode 100644 index 17e67d2b861..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_foreground_preflush_basic.result +++ /dev/null @@ -1,23 +0,0 @@ -SET @start_value = @@GLOBAL.innodb_foreground_preflush; -SELECT @@GLOBAL.innodb_foreground_preflush; -@@GLOBAL.innodb_foreground_preflush -EXPONENTIAL_BACKOFF -SELECT @@SESSION.innodb_foreground_preflush; -ERROR HY000: Variable 'innodb_foreground_preflush' is a GLOBAL variable -SET GLOBAL innodb_foreground_preflush='sync_preflush'; -SELECT @@GLOBAL.innodb_foreground_preflush; -@@GLOBAL.innodb_foreground_preflush -SYNC_PREFLUSH -SET GLOBAL innodb_foreground_preflush='exponential_backoff'; -SELECT @@GLOBAL.innodb_foreground_preflush; -@@GLOBAL.innodb_foreground_preflush -EXPONENTIAL_BACKOFF -SET GLOBAL innodb_foreground_preflush=1.1; -ERROR 42000: Incorrect argument type to variable 'innodb_foreground_preflush' -SET GLOBAL innodb_foreground_preflush=1e1; -ERROR 42000: Incorrect argument type to variable 'innodb_foreground_preflush' -SET GLOBAL innodb_foreground_preflush=2; -ERROR 42000: Variable 'innodb_foreground_preflush' can't be set to the value of '2' -SET GLOBAL innodb_foreground_preflush='foo'; -ERROR 42000: Variable 'innodb_foreground_preflush' can't be set to the value of 'foo' -SET GLOBAL innodb_foreground_preflush = @start_value; diff --git a/mysql-test/suite/sys_vars/r/innodb_log_arch_dir_basic.result b/mysql-test/suite/sys_vars/r/innodb_log_arch_dir_basic.result deleted file mode 100644 index bead0303520..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_log_arch_dir_basic.result +++ /dev/null @@ -1,38 +0,0 @@ -SELECT @@GLOBAL.innodb_log_arch_dir; -@@GLOBAL.innodb_log_arch_dir -./ -NULL Expected -SET @@GLOBAL.innodb_log_arch_dir=1; -ERROR HY000: Variable 'innodb_log_arch_dir' is a read only variable -Expected error 'Read only variable' -SELECT @@GLOBAL.innodb_log_arch_dir; -@@GLOBAL.innodb_log_arch_dir -./ -NULL Expected -SELECT VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='innodb_log_arch_dir'; -VARIABLE_VALUE -./ -empty string Expected -SELECT @@innodb_log_arch_dir; -@@innodb_log_arch_dir -./ -NULL Expected -SELECT @@innodb_log_arch_dir; -@@innodb_log_arch_dir -./ -NULL Expected -SELECT @@local.innodb_log_arch_dir; -ERROR HY000: Variable 'innodb_log_arch_dir' is a GLOBAL variable -Expected error 'Variable is a GLOBAL variable' -SELECT @@SESSION.innodb_log_arch_dir; -ERROR HY000: Variable 'innodb_log_arch_dir' is a GLOBAL variable -Expected error 'Variable is a GLOBAL variable' -SELECT @@GLOBAL.innodb_log_arch_dir; -@@GLOBAL.innodb_log_arch_dir -./ -NULL Expected -SELECT innodb_log_arch_dir = @@SESSION.innodb_log_arch_dir; -ERROR 42S22: Unknown column 'innodb_log_arch_dir' in 'field list' -Expected error Unknown column 'innodb_log_arch_dir' in 'field list' diff --git a/mysql-test/suite/sys_vars/r/innodb_log_arch_expire_sec_basic.result b/mysql-test/suite/sys_vars/r/innodb_log_arch_expire_sec_basic.result deleted file mode 100644 index 97bff097252..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_log_arch_expire_sec_basic.result +++ /dev/null @@ -1,38 +0,0 @@ -SELECT @@GLOBAL.innodb_log_arch_expire_sec INTO @save; -SELECT @@GLOBAL.innodb_log_arch_expire_sec; -@@GLOBAL.innodb_log_arch_expire_sec -0 -0 Expected -SET @@GLOBAL.innodb_log_arch_expire_sec=1; -SELECT @@GLOBAL.innodb_log_arch_expire_sec; -@@GLOBAL.innodb_log_arch_expire_sec -1 -1 Expected -SELECT VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='innodb_log_arch_expire_sec'; -VARIABLE_VALUE -1 -1 Expected -SELECT @@innodb_log_arch_expire_sec; -@@innodb_log_arch_expire_sec -1 -1 Expected -SELECT @@innodb_log_arch_expire_sec; -@@innodb_log_arch_expire_sec -1 -1 Expected -SELECT @@local.innodb_log_arch_expire_sec; -ERROR HY000: Variable 'innodb_log_arch_expire_sec' is a GLOBAL variable -Expected error 'Variable is a GLOBAL variable' -SELECT @@SESSION.innodb_log_arch_expire_sec; -ERROR HY000: Variable 'innodb_log_arch_expire_sec' is a GLOBAL variable -Expected error 'Variable is a GLOBAL variable' -SELECT @@GLOBAL.innodb_log_arch_expire_sec; -@@GLOBAL.innodb_log_arch_expire_sec -1 -1 Expected -SELECT innodb_log_arch_expire_sec = @@SESSION.innodb_log_arch_expire_sec; -ERROR 42S22: Unknown column 'innodb_log_arch_expire_sec' in 'field list' -Expected error Unknown column 'innodb_log_arch_expire_sec' in 'field list' -SET @@GLOBAL.innodb_log_arch_expire_sec = @save; diff --git a/mysql-test/suite/sys_vars/r/innodb_log_archive_basic.result b/mysql-test/suite/sys_vars/r/innodb_log_archive_basic.result deleted file mode 100644 index bb9b53482fa..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_log_archive_basic.result +++ /dev/null @@ -1,38 +0,0 @@ -SELECT @@GLOBAL.innodb_log_archive; -@@GLOBAL.innodb_log_archive -0 -0 Expected -SET @save_innodb_log_archive = @@GLOBAL.innodb_log_archive; -SET @@GLOBAL.innodb_log_archive=1; -SELECT @@GLOBAL.innodb_log_archive; -@@GLOBAL.innodb_log_archive -1 -1 Expected -SELECT VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='innodb_log_archive'; -VARIABLE_VALUE -ON -ON Expected -SET @@GLOBAL.innodb_log_archive = @save_innodb_log_archive; -SELECT @@innodb_log_archive; -@@innodb_log_archive -0 -0 Expected -SELECT @@innodb_log_archive; -@@innodb_log_archive -0 -0 Expected -SELECT @@local.innodb_log_archive; -ERROR HY000: Variable 'innodb_log_archive' is a GLOBAL variable -Expected error 'Variable is a GLOBAL variable' -SELECT @@SESSION.innodb_log_archive; -ERROR HY000: Variable 'innodb_log_archive' is a GLOBAL variable -Expected error 'Variable is a GLOBAL variable' -SELECT @@GLOBAL.innodb_log_archive; -@@GLOBAL.innodb_log_archive -0 -0 Expected -SELECT innodb_log_archive = @@SESSION.innodb_log_archive; -ERROR 42S22: Unknown column 'innodb_log_archive' in 'field list' -Expected error Unknown column 'innodb_log_archive' in 'field list' diff --git a/mysql-test/suite/sys_vars/r/innodb_log_checksum_algorithm_basic.result b/mysql-test/suite/sys_vars/r/innodb_log_checksum_algorithm_basic.result deleted file mode 100644 index 4497e8f208a..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_log_checksum_algorithm_basic.result +++ /dev/null @@ -1,47 +0,0 @@ -SET @orig = @@global.innodb_log_checksum_algorithm; -SELECT @orig; -@orig -INNODB -SET GLOBAL innodb_log_checksum_algorithm = 'crc32'; -SELECT @@global.innodb_log_checksum_algorithm; -@@global.innodb_log_checksum_algorithm -CRC32 -SET GLOBAL innodb_log_checksum_algorithm = 'strict_crc32'; -SELECT @@global.innodb_log_checksum_algorithm; -@@global.innodb_log_checksum_algorithm -STRICT_CRC32 -SET GLOBAL innodb_log_checksum_algorithm = 'innodb'; -SELECT @@global.innodb_log_checksum_algorithm; -@@global.innodb_log_checksum_algorithm -INNODB -SET GLOBAL innodb_log_checksum_algorithm = 'strict_innodb'; -SELECT @@global.innodb_log_checksum_algorithm; -@@global.innodb_log_checksum_algorithm -STRICT_INNODB -SET GLOBAL innodb_log_checksum_algorithm = 'none'; -SELECT @@global.innodb_log_checksum_algorithm; -@@global.innodb_log_checksum_algorithm -NONE -SET GLOBAL innodb_log_checksum_algorithm = 'strict_none'; -SELECT @@global.innodb_log_checksum_algorithm; -@@global.innodb_log_checksum_algorithm -STRICT_NONE -SET GLOBAL innodb_log_checksum_algorithm = ''; -ERROR 42000: Variable 'innodb_log_checksum_algorithm' can't be set to the value of '' -SELECT @@global.innodb_log_checksum_algorithm; -@@global.innodb_log_checksum_algorithm -STRICT_NONE -SET GLOBAL innodb_log_checksum_algorithm = 'foobar'; -ERROR 42000: Variable 'innodb_log_checksum_algorithm' can't be set to the value of 'foobar' -SELECT @@global.innodb_log_checksum_algorithm; -@@global.innodb_log_checksum_algorithm -STRICT_NONE -SET GLOBAL innodb_log_checksum_algorithm = 123; -ERROR 42000: Variable 'innodb_log_checksum_algorithm' can't be set to the value of '123' -SELECT @@global.innodb_log_checksum_algorithm; -@@global.innodb_log_checksum_algorithm -STRICT_NONE -SET GLOBAL innodb_log_checksum_algorithm = @orig; -SELECT @@global.innodb_log_checksum_algorithm; -@@global.innodb_log_checksum_algorithm -INNODB diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result index 3764b00688b..2a66a0d0931 100644 --- a/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result @@ -39,6 +39,7 @@ buffer_pages_written disabled buffer_index_pages_written disabled buffer_non_index_pages_written disabled buffer_pages_read disabled +buffer_pages0_read disabled buffer_index_sec_rec_cluster_reads disabled buffer_index_sec_rec_cluster_reads_avoided disabled buffer_data_reads disabled diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result index 3764b00688b..2a66a0d0931 100644 --- a/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result @@ -39,6 +39,7 @@ buffer_pages_written disabled buffer_index_pages_written disabled buffer_non_index_pages_written disabled buffer_pages_read disabled +buffer_pages0_read disabled buffer_index_sec_rec_cluster_reads disabled buffer_index_sec_rec_cluster_reads_avoided disabled buffer_data_reads disabled diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result index 3764b00688b..2a66a0d0931 100644 --- a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result @@ -39,6 +39,7 @@ buffer_pages_written disabled buffer_index_pages_written disabled buffer_non_index_pages_written disabled buffer_pages_read disabled +buffer_pages0_read disabled buffer_index_sec_rec_cluster_reads disabled buffer_index_sec_rec_cluster_reads_avoided disabled buffer_data_reads disabled diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result index 3764b00688b..2a66a0d0931 100644 --- a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result @@ -39,6 +39,7 @@ buffer_pages_written disabled buffer_index_pages_written disabled buffer_non_index_pages_written disabled buffer_pages_read disabled +buffer_pages0_read disabled buffer_index_sec_rec_cluster_reads disabled buffer_index_sec_rec_cluster_reads_avoided disabled buffer_data_reads disabled diff --git a/mysql-test/suite/sys_vars/r/innodb_numa_interleave_basic.result b/mysql-test/suite/sys_vars/r/innodb_numa_interleave_basic.result new file mode 100644 index 00000000000..21ed16c1dab --- /dev/null +++ b/mysql-test/suite/sys_vars/r/innodb_numa_interleave_basic.result @@ -0,0 +1,10 @@ +SELECT @@GLOBAL.innodb_numa_interleave; +@@GLOBAL.innodb_numa_interleave +1 +SET @@GLOBAL.innodb_numa_interleave=off; +ERROR HY000: Variable 'innodb_numa_interleave' is a read only variable +SELECT @@GLOBAL.innodb_numa_interleave; +@@GLOBAL.innodb_numa_interleave +1 +SELECT @@SESSION.innodb_numa_interleave; +ERROR HY000: Variable 'innodb_numa_interleave' is a GLOBAL variable diff --git a/mysql-test/suite/sys_vars/r/innodb_priority_cleaner_basic.result b/mysql-test/suite/sys_vars/r/innodb_priority_cleaner_basic.result deleted file mode 100644 index ae5e12ee64a..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_priority_cleaner_basic.result +++ /dev/null @@ -1,31 +0,0 @@ -SET @start_value = @@GLOBAL.innodb_priority_cleaner; -SELECT @@GLOBAL.innodb_priority_cleaner; -@@GLOBAL.innodb_priority_cleaner -0 -SELECT @@SESSION.innodb_priority_cleaner; -ERROR HY000: Variable 'innodb_priority_cleaner' is a GLOBAL variable -SET GLOBAL innodb_priority_cleaner='OFF'; -SELECT @@GLOBAL.innodb_priority_cleaner; -@@GLOBAL.innodb_priority_cleaner -0 -SET GLOBAL innodb_priority_cleaner='ON'; -SELECT @@GLOBAL.innodb_priority_cleaner; -@@GLOBAL.innodb_priority_cleaner -1 -SET GLOBAL innodb_priority_cleaner=0; -SELECT @@GLOBAL.innodb_priority_cleaner; -@@GLOBAL.innodb_priority_cleaner -0 -SET GLOBAL innodb_priority_cleaner=1; -SELECT @@GLOBAL.innodb_priority_cleaner; -@@GLOBAL.innodb_priority_cleaner -1 -SET GLOBAL innodb_priority_cleaner=1.1; -ERROR 42000: Incorrect argument type to variable 'innodb_priority_cleaner' -SET GLOBAL innodb_priority_cleaner=1e1; -ERROR 42000: Incorrect argument type to variable 'innodb_priority_cleaner' -SET GLOBAL innodb_priority_cleaner=2; -ERROR 42000: Variable 'innodb_priority_cleaner' can't be set to the value of '2' -SET GLOBAL innodb_priority_cleaner='foo'; -ERROR 42000: Variable 'innodb_priority_cleaner' can't be set to the value of 'foo' -SET GLOBAL innodb_priority_cleaner = @start_value; diff --git a/mysql-test/suite/sys_vars/r/innodb_priority_io_basic.result b/mysql-test/suite/sys_vars/r/innodb_priority_io_basic.result deleted file mode 100644 index 70ccb5e4cf4..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_priority_io_basic.result +++ /dev/null @@ -1,31 +0,0 @@ -SET @start_value = @@GLOBAL.innodb_priority_io; -SELECT @@GLOBAL.innodb_priority_io; -@@GLOBAL.innodb_priority_io -0 -SELECT @@SESSION.innodb_priority_io; -ERROR HY000: Variable 'innodb_priority_io' is a GLOBAL variable -SET GLOBAL innodb_priority_io='OFF'; -SELECT @@GLOBAL.innodb_priority_io; -@@GLOBAL.innodb_priority_io -0 -SET GLOBAL innodb_priority_io='ON'; -SELECT @@GLOBAL.innodb_priority_io; -@@GLOBAL.innodb_priority_io -1 -SET GLOBAL innodb_priority_io=0; -SELECT @@GLOBAL.innodb_priority_io; -@@GLOBAL.innodb_priority_io -0 -SET GLOBAL innodb_priority_io=1; -SELECT @@GLOBAL.innodb_priority_io; -@@GLOBAL.innodb_priority_io -1 -SET GLOBAL innodb_priority_io=1.1; -ERROR 42000: Incorrect argument type to variable 'innodb_priority_io' -SET GLOBAL innodb_priority_io=1e1; -ERROR 42000: Incorrect argument type to variable 'innodb_priority_io' -SET GLOBAL innodb_priority_io=2; -ERROR 42000: Variable 'innodb_priority_io' can't be set to the value of '2' -SET GLOBAL innodb_priority_io='foo'; -ERROR 42000: Variable 'innodb_priority_io' can't be set to the value of 'foo' -SET GLOBAL innodb_priority_io = @start_value; diff --git a/mysql-test/suite/sys_vars/r/innodb_priority_master_basic.result b/mysql-test/suite/sys_vars/r/innodb_priority_master_basic.result deleted file mode 100644 index d26ead2ff7e..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_priority_master_basic.result +++ /dev/null @@ -1,31 +0,0 @@ -SET @start_value = @@GLOBAL.innodb_priority_master; -SELECT @@GLOBAL.innodb_priority_master; -@@GLOBAL.innodb_priority_master -0 -SELECT @@SESSION.innodb_priority_master; -ERROR HY000: Variable 'innodb_priority_master' is a GLOBAL variable -SET GLOBAL innodb_priority_master='OFF'; -SELECT @@GLOBAL.innodb_priority_master; -@@GLOBAL.innodb_priority_master -0 -SET GLOBAL innodb_priority_master='ON'; -SELECT @@GLOBAL.innodb_priority_master; -@@GLOBAL.innodb_priority_master -1 -SET GLOBAL innodb_priority_master=0; -SELECT @@GLOBAL.innodb_priority_master; -@@GLOBAL.innodb_priority_master -0 -SET GLOBAL innodb_priority_master=1; -SELECT @@GLOBAL.innodb_priority_master; -@@GLOBAL.innodb_priority_master -1 -SET GLOBAL innodb_priority_master=1.1; -ERROR 42000: Incorrect argument type to variable 'innodb_priority_master' -SET GLOBAL innodb_priority_master=1e1; -ERROR 42000: Incorrect argument type to variable 'innodb_priority_master' -SET GLOBAL innodb_priority_master=2; -ERROR 42000: Variable 'innodb_priority_master' can't be set to the value of '2' -SET GLOBAL innodb_priority_master='foo'; -ERROR 42000: Variable 'innodb_priority_master' can't be set to the value of 'foo' -SET GLOBAL innodb_priority_master = @start_value; diff --git a/mysql-test/suite/sys_vars/r/innodb_priority_purge_basic.result b/mysql-test/suite/sys_vars/r/innodb_priority_purge_basic.result deleted file mode 100644 index 57153ebf82a..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_priority_purge_basic.result +++ /dev/null @@ -1,31 +0,0 @@ -SET @start_value = @@GLOBAL.innodb_priority_purge; -SELECT @@GLOBAL.innodb_priority_purge; -@@GLOBAL.innodb_priority_purge -0 -SELECT @@SESSION.innodb_priority_purge; -ERROR HY000: Variable 'innodb_priority_purge' is a GLOBAL variable -SET GLOBAL innodb_priority_purge='OFF'; -SELECT @@GLOBAL.innodb_priority_purge; -@@GLOBAL.innodb_priority_purge -0 -SET GLOBAL innodb_priority_purge='ON'; -SELECT @@GLOBAL.innodb_priority_purge; -@@GLOBAL.innodb_priority_purge -1 -SET GLOBAL innodb_priority_purge=0; -SELECT @@GLOBAL.innodb_priority_purge; -@@GLOBAL.innodb_priority_purge -0 -SET GLOBAL innodb_priority_purge=1; -SELECT @@GLOBAL.innodb_priority_purge; -@@GLOBAL.innodb_priority_purge -1 -SET GLOBAL innodb_priority_purge=1.1; -ERROR 42000: Incorrect argument type to variable 'innodb_priority_purge' -SET GLOBAL innodb_priority_purge=1e1; -ERROR 42000: Incorrect argument type to variable 'innodb_priority_purge' -SET GLOBAL innodb_priority_purge=2; -ERROR 42000: Variable 'innodb_priority_purge' can't be set to the value of '2' -SET GLOBAL innodb_priority_purge='foo'; -ERROR 42000: Variable 'innodb_priority_purge' can't be set to the value of 'foo' -SET GLOBAL innodb_priority_purge = @start_value; diff --git a/mysql-test/suite/sys_vars/r/innodb_use_fallocate_basic.result b/mysql-test/suite/sys_vars/r/innodb_use_fallocate_basic.result deleted file mode 100644 index 57b4b9eb94c..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_use_fallocate_basic.result +++ /dev/null @@ -1,21 +0,0 @@ -select @@global.innodb_use_fallocate; -@@global.innodb_use_fallocate -0 -select @@session.innodb_use_fallocate; -ERROR HY000: Variable 'innodb_use_fallocate' is a GLOBAL variable -show global variables like 'innodb_use_fallocate'; -Variable_name Value -innodb_use_fallocate OFF -show session variables like 'innodb_use_fallocate'; -Variable_name Value -innodb_use_fallocate OFF -select * from information_schema.global_variables where variable_name='innodb_use_fallocate'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_USE_FALLOCATE OFF -select * from information_schema.session_variables where variable_name='innodb_use_fallocate'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_USE_FALLOCATE OFF -set global innodb_use_fallocate=1; -ERROR HY000: Variable 'innodb_use_fallocate' is a read only variable -set session innodb_use_fallocate=1; -ERROR HY000: Variable 'innodb_use_fallocate' is a read only variable diff --git a/mysql-test/suite/sys_vars/r/replicate_do_db_basic.result b/mysql-test/suite/sys_vars/r/replicate_do_db_basic.result index b964d3d14a1..a05b85a9bfd 100644 --- a/mysql-test/suite/sys_vars/r/replicate_do_db_basic.result +++ b/mysql-test/suite/sys_vars/r/replicate_do_db_basic.result @@ -33,5 +33,9 @@ SET @@GLOBAL.replicate_do_db=""; SELECT @@GLOBAL.replicate_do_db; @@GLOBAL.replicate_do_db +SET @@GLOBAL.replicate_do_db=null; +SELECT @@GLOBAL.replicate_do_db; +@@GLOBAL.replicate_do_db + # Cleanup. SET @@GLOBAL.replicate_do_db = @save_replicate_do_db; diff --git a/mysql-test/suite/sys_vars/r/replicate_do_table_basic.result b/mysql-test/suite/sys_vars/r/replicate_do_table_basic.result index fac237228ac..e67b1eeca01 100644 --- a/mysql-test/suite/sys_vars/r/replicate_do_table_basic.result +++ b/mysql-test/suite/sys_vars/r/replicate_do_table_basic.result @@ -40,5 +40,9 @@ SET @@GLOBAL.replicate_do_table=""; SELECT @@GLOBAL.replicate_do_table; @@GLOBAL.replicate_do_table +SET @@GLOBAL.replicate_do_table=null; +SELECT @@GLOBAL.replicate_do_table; +@@GLOBAL.replicate_do_table + # Cleanup. SET @@GLOBAL.replicate_do_table = @save_replicate_do_table; diff --git a/mysql-test/suite/sys_vars/r/replicate_ignore_db_basic.result b/mysql-test/suite/sys_vars/r/replicate_ignore_db_basic.result index c4d7a37321e..c7ff697b34f 100644 --- a/mysql-test/suite/sys_vars/r/replicate_ignore_db_basic.result +++ b/mysql-test/suite/sys_vars/r/replicate_ignore_db_basic.result @@ -33,5 +33,9 @@ SET @@GLOBAL.replicate_ignore_db=""; SELECT @@GLOBAL.replicate_ignore_db; @@GLOBAL.replicate_ignore_db +SET @@GLOBAL.replicate_ignore_db=null; +SELECT @@GLOBAL.replicate_ignore_db; +@@GLOBAL.replicate_ignore_db + # Cleanup. SET @@GLOBAL.replicate_ignore_db = @save_replicate_ignore_db; diff --git a/mysql-test/suite/sys_vars/r/replicate_ignore_table_basic.result b/mysql-test/suite/sys_vars/r/replicate_ignore_table_basic.result index bc463d07319..db97ce14c93 100644 --- a/mysql-test/suite/sys_vars/r/replicate_ignore_table_basic.result +++ b/mysql-test/suite/sys_vars/r/replicate_ignore_table_basic.result @@ -40,5 +40,9 @@ SET @@GLOBAL.replicate_ignore_table=""; SELECT @@GLOBAL.replicate_ignore_table; @@GLOBAL.replicate_ignore_table +SET @@GLOBAL.replicate_ignore_table=null; +SELECT @@GLOBAL.replicate_ignore_table; +@@GLOBAL.replicate_ignore_table + # Cleanup. SET @@GLOBAL.replicate_ignore_table = @save_replicate_ignore_table; diff --git a/mysql-test/suite/sys_vars/r/replicate_wild_do_table_basic.result b/mysql-test/suite/sys_vars/r/replicate_wild_do_table_basic.result index 5647cc964fb..8c55103080f 100644 --- a/mysql-test/suite/sys_vars/r/replicate_wild_do_table_basic.result +++ b/mysql-test/suite/sys_vars/r/replicate_wild_do_table_basic.result @@ -40,5 +40,9 @@ SET @@GLOBAL.replicate_wild_do_table=""; SELECT @@GLOBAL.replicate_wild_do_table; @@GLOBAL.replicate_wild_do_table +SET @@GLOBAL.replicate_wild_do_table=null; +SELECT @@GLOBAL.replicate_wild_do_table; +@@GLOBAL.replicate_wild_do_table + # Cleanup. SET @@GLOBAL.replicate_wild_do_table = @save_replicate_wild_do_table; diff --git a/mysql-test/suite/sys_vars/r/replicate_wild_ignore_table_basic.result b/mysql-test/suite/sys_vars/r/replicate_wild_ignore_table_basic.result index c6829b792a4..0f46ce38805 100644 --- a/mysql-test/suite/sys_vars/r/replicate_wild_ignore_table_basic.result +++ b/mysql-test/suite/sys_vars/r/replicate_wild_ignore_table_basic.result @@ -40,5 +40,9 @@ SET @@GLOBAL.replicate_wild_ignore_table=""; SELECT @@GLOBAL.replicate_wild_ignore_table; @@GLOBAL.replicate_wild_ignore_table +SET @@GLOBAL.replicate_wild_ignore_table=null; +SELECT @@GLOBAL.replicate_wild_ignore_table; +@@GLOBAL.replicate_wild_ignore_table + # Cleanup. SET @@GLOBAL.replicate_wild_ignore_table = @save_replicate_wild_ignore_table; diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled index 930fa18541f..285caafb3d0 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled @@ -107,7 +107,7 @@ +DEFAULT_VALUE OFF +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BOOLEAN -+VARIABLE_COMMENT Depricated. This option is temporary alias of --innodb-numa-interleave. ++VARIABLE_COMMENT Deprecated. This option has no effect and will be removed in MariaDB 10.2.3. +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL @@ -288,7 +288,7 @@ +DEFAULT_VALUE assert +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE ENUM -+VARIABLE_COMMENT Warn corruptions of user tables as 'corrupt table' instead of not crashing itself, when used with file_per_table. All file io for the datafile after detected as corrupt are disabled, except for the deletion ++VARIABLE_COMMENT Warn corruptions of user tables as 'corrupt table' instead of not crashing itself, when used with file_per_table. All file io for the datafile after detected as corrupt are disabled, except for the deletion. +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL @@ -1227,8 +1227,8 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_VERSION SESSION_VALUE NULL --GLOBAL_VALUE 5.6.32 -+GLOBAL_VALUE 5.6.31-77.0 +-GLOBAL_VALUE 5.6.33 ++GLOBAL_VALUE 5.6.34-79.1 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE NULL VARIABLE_SCOPE GLOBAL diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled index aafc0a9e806..a2e6c1d5c4c 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled @@ -32,7 +32,7 @@ +DEFAULT_VALUE OFF +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BOOLEAN -+VARIABLE_COMMENT Depricated. This option is temporary alias of --innodb-numa-interleave. ++VARIABLE_COMMENT Deprecated. This option has no effect and will be removed in MariaDB 10.2.3. +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL @@ -167,7 +167,7 @@ +DEFAULT_VALUE assert +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE ENUM -+VARIABLE_COMMENT Warn corruptions of user tables as 'corrupt table' instead of not crashing itself, when used with file_per_table. All file io for the datafile after detected as corrupt are disabled, except for the deletion ++VARIABLE_COMMENT Warn corruptions of user tables as 'corrupt table' instead of not crashing itself, when used with file_per_table. All file io for the datafile after detected as corrupt are disabled, except for the deletion. +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL @@ -661,8 +661,8 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_VERSION SESSION_VALUE NULL --GLOBAL_VALUE 5.6.32 -+GLOBAL_VALUE 5.6.31-77.0 +-GLOBAL_VALUE 5.6.33 ++GLOBAL_VALUE 5.6.34-79.1 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE NULL VARIABLE_SCOPE GLOBAL diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index f586b7b294a..87e000faf02 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -488,7 +488,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE crc32 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE ENUM -VARIABLE_COMMENT The algorithm InnoDB uses for page checksumming. Possible values are CRC32 (hardware accelerated if the CPU supports it) write crc32, allow any of the other checksums to match when reading; STRICT_CRC32 write crc32, do not allow other algorithms to match when reading; INNODB write a software calculated checksum, allow any other checksums to match when reading; STRICT_INNODB write a software calculated checksum, do not allow other algorithms to match when reading; NONE write a constant magic number, do not do any checksum verification when reading (same as innodb_checksums=OFF); STRICT_NONE write a constant magic number, do not allow values other than that magic number when reading; Files updated when this option is set to crc32 or strict_crc32 will not be readable by MySQL versions older than 5.6.3 +VARIABLE_COMMENT The algorithm InnoDB uses for page checksumming. Possible values are CRC32 (hardware accelerated if the CPU supports it) write crc32, allow any of the other checksums to match when reading; STRICT_CRC32 write crc32, do not allow other algorithms to match when reading; INNODB write a software calculated checksum, allow any other checksums to match when reading; STRICT_INNODB write a software calculated checksum, do not allow other algorithms to match when reading; NONE write a constant magic number, do not do any checksum verification when reading (same as innodb_checksums=OFF); STRICT_NONE write a constant magic number, do not allow values other than that magic number when reading; Files updated when this option is set to crc32 or strict_crc32 will not be readable by MariaDB versions older than 10.0.4 NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL @@ -537,6 +537,20 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST none,zlib,lz4,lzo,lzma,bzip2,snappy READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME INNODB_COMPRESSION_DEFAULT +SESSION_VALUE OFF +GLOBAL_VALUE OFF +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE OFF +VARIABLE_SCOPE SESSION +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT Is compression the default for new tables +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_COMPRESSION_FAILURE_THRESHOLD_PCT SESSION_VALUE NULL GLOBAL_VALUE 5 @@ -621,6 +635,20 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME INNODB_DATA_FILE_SIZE_DEBUG +SESSION_VALUE NULL +GLOBAL_VALUE 0 +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE 0 +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_COMMENT InnoDB system tablespace size to be set in recovery. +NUMERIC_MIN_VALUE 0 +NUMERIC_MAX_VALUE 4294967295 +NUMERIC_BLOCK_SIZE 0 +ENUM_VALUE_LIST NULL +READ_ONLY YES +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_DATA_HOME_DIR SESSION_VALUE NULL GLOBAL_VALUE @@ -1447,6 +1475,20 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT NONE +VARIABLE_NAME INNODB_LOCK_SCHEDULE_ALGORITHM +SESSION_VALUE NULL +GLOBAL_VALUE vats +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE vats +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE ENUM +VARIABLE_COMMENT The algorithm Innodb uses for deciding which locks to grant next when a lock is released. Possible values are FCFS grant the locks in First-Come-First-Served order; VATS use the Variance-Aware-Transaction-Scheduling algorithm, which uses an Eldest-Transaction-First heuristic. +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST fcfs,vats +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_LOCK_WAIT_TIMEOUT SESSION_VALUE 50 GLOBAL_VALUE 50 @@ -1902,7 +1944,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE OFF VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT Print all deadlocks to MySQL error log (off by default) +VARIABLE_COMMENT Print all deadlocks to MariaDB error log (off by default) NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL @@ -2560,7 +2602,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE OFF VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT Preallocate files fast, using operating system functionality. On POSIX systems, posix_fallocate system call is used. +VARIABLE_COMMENT Use posix_fallocate() to allocate files. DEPRECATED, has no effect. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff index 588d38d9c73..0f34179a16d 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff @@ -894,7 +894,7 @@ NUMERIC_MAX_VALUE 256 @@ -2829,7 +2829,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME - DEFAULT_VALUE 184 + DEFAULT_VALUE 185 VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED @@ -1147,7 +1147,7 @@ +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT The number of cached open tables NUMERIC_MIN_VALUE 1 - NUMERIC_MAX_VALUE 524288 + NUMERIC_MAX_VALUE 1048576 @@ -3893,7 +3893,7 @@ GLOBAL_VALUE_ORIGIN AUTO DEFAULT_VALUE 256 diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index 98c846f0b57..f37ca909836 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -1619,6 +1619,34 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT NULL +VARIABLE_NAME LOG_BIN_COMPRESS +SESSION_VALUE NULL +GLOBAL_VALUE OFF +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE OFF +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT Whether the binary log can be compressed +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME LOG_BIN_COMPRESS_MIN_LEN +SESSION_VALUE NULL +GLOBAL_VALUE 256 +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE 256 +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE INT UNSIGNED +VARIABLE_COMMENT Minimum length of sql statement(in statement mode) or record(in row mode)that can be compressed. +NUMERIC_MIN_VALUE 10 +NUMERIC_MAX_VALUE 1024 +NUMERIC_BLOCK_SIZE 1 +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME LOG_BIN_TRUST_FUNCTION_CREATORS SESSION_VALUE NULL GLOBAL_VALUE ON @@ -2825,9 +2853,9 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STATEMENT_CLASSES SESSION_VALUE NULL -GLOBAL_VALUE 184 +GLOBAL_VALUE 185 GLOBAL_VALUE_ORIGIN COMPILE-TIME -DEFAULT_VALUE 184 +DEFAULT_VALUE 185 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Maximum number of statement instruments. @@ -3882,7 +3910,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The number of cached open tables NUMERIC_MIN_VALUE 1 -NUMERIC_MAX_VALUE 524288 +NUMERIC_MAX_VALUE 1048576 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff index 82b5b7bf38f..88216992587 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff @@ -1,5 +1,5 @@ ---- suite/sys_vars/r/sysvars_server_notembedded.result -+++ suite/sys_vars/r/sysvars_server_notembedded.reject +--- suite/sys_vars/r/sysvars_server_notembedded.result 2016-11-03 17:27:47.664855681 +0100 ++++ suite/sys_vars/r/sysvars_server_notembedded.reject 2016-11-03 17:23:05.686196749 +0100 @@ -57,7 +57,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE 1 @@ -296,7 +296,7 @@ VARIABLE_COMMENT Timeout in seconds to wait for a lock before returning an error. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -1877,7 +1877,7 @@ +@@ -1905,7 +1905,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -305,7 +305,7 @@ VARIABLE_COMMENT Write to slow log every #th slow query. Set to 1 to log everything. Increase it to reduce the size of the slow or the performance impact of slow logging NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -1919,7 +1919,7 @@ +@@ -1947,7 +1947,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -314,7 +314,7 @@ VARIABLE_COMMENT Log some not critical warnings to the general log file.Value can be between 0 and 11. Higher values mean more verbosity NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -1975,7 +1975,7 @@ +@@ -2003,7 +2003,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4194304 VARIABLE_SCOPE SESSION @@ -323,7 +323,7 @@ VARIABLE_COMMENT Max packet length to send to or receive from the server NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1073741824 -@@ -1985,14 +1985,14 @@ +@@ -2013,14 +2013,14 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_BINLOG_CACHE_SIZE SESSION_VALUE NULL @@ -341,7 +341,7 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2003,7 +2003,7 @@ +@@ -2031,7 +2031,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1073741824 VARIABLE_SCOPE GLOBAL @@ -350,7 +350,7 @@ VARIABLE_COMMENT Binary log will be rotated automatically when the size exceeds this value. NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 1073741824 -@@ -2013,14 +2013,14 @@ +@@ -2041,14 +2041,14 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_BINLOG_STMT_CACHE_SIZE SESSION_VALUE NULL @@ -368,7 +368,7 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2031,7 +2031,7 @@ +@@ -2059,7 +2059,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 151 VARIABLE_SCOPE GLOBAL @@ -377,7 +377,7 @@ VARIABLE_COMMENT The number of simultaneous clients allowed NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 100000 -@@ -2045,7 +2045,7 @@ +@@ -2073,7 +2073,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE GLOBAL @@ -386,7 +386,7 @@ VARIABLE_COMMENT If there is more than this number of interrupted connections from a host this host will be blocked from further connections NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2059,7 +2059,7 @@ +@@ -2087,7 +2087,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 20 VARIABLE_SCOPE SESSION @@ -395,7 +395,7 @@ VARIABLE_COMMENT Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -2087,7 +2087,7 @@ +@@ -2115,7 +2115,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 64 VARIABLE_SCOPE SESSION @@ -404,7 +404,7 @@ VARIABLE_COMMENT Max number of errors/warnings to store for a statement NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 65535 -@@ -2104,7 +2104,7 @@ +@@ -2132,7 +2132,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Don't allow creation of heap tables bigger than this NUMERIC_MIN_VALUE 16384 @@ -413,7 +413,7 @@ NUMERIC_BLOCK_SIZE 1024 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2115,7 +2115,7 @@ +@@ -2143,7 +2143,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 20 VARIABLE_SCOPE SESSION @@ -422,7 +422,7 @@ VARIABLE_COMMENT Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -2143,7 +2143,7 @@ +@@ -2171,7 +2171,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE SESSION @@ -431,7 +431,7 @@ VARIABLE_COMMENT Max number of bytes in sorted records NUMERIC_MIN_VALUE 4 NUMERIC_MAX_VALUE 8388608 -@@ -2157,7 +2157,7 @@ +@@ -2185,7 +2185,7 @@ GLOBAL_VALUE_ORIGIN AUTO DEFAULT_VALUE 1048576 VARIABLE_SCOPE GLOBAL @@ -440,7 +440,7 @@ VARIABLE_COMMENT The maximum BLOB length to send to server from mysql_send_long_data API. Deprecated option; use max_allowed_packet instead. NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 4294967295 -@@ -2171,7 +2171,7 @@ +@@ -2199,7 +2199,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 16382 VARIABLE_SCOPE GLOBAL @@ -449,7 +449,7 @@ VARIABLE_COMMENT Maximum number of prepared statements in the server NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -2171,7 +2171,7 @@ +@@ -2213,7 +2213,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4294967295 VARIABLE_SCOPE SESSION @@ -458,7 +458,7 @@ VARIABLE_COMMENT Maximum number of iterations when executing recursive queries NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -2199,7 +2199,7 @@ +@@ -2241,7 +2241,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4294967295 VARIABLE_SCOPE SESSION @@ -467,7 +467,7 @@ VARIABLE_COMMENT Limit assumed max number of seeks when looking up rows based on a key NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2213,7 +2213,7 @@ +@@ -2255,7 +2255,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE SESSION @@ -476,7 +476,7 @@ VARIABLE_COMMENT The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored) NUMERIC_MIN_VALUE 4 NUMERIC_MAX_VALUE 8388608 -@@ -2227,7 +2227,7 @@ +@@ -2269,7 +2269,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION @@ -485,7 +485,7 @@ VARIABLE_COMMENT Maximum stored procedure recursion depth NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 255 -@@ -2255,7 +2255,7 @@ +@@ -2297,7 +2297,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 32 VARIABLE_SCOPE SESSION @@ -494,7 +494,7 @@ VARIABLE_COMMENT Unused, will be removed. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2283,7 +2283,7 @@ +@@ -2325,7 +2325,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4294967295 VARIABLE_SCOPE GLOBAL @@ -503,7 +503,7 @@ VARIABLE_COMMENT After this many write locks, allow some read locks to run in between NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2297,7 +2297,7 @@ +@@ -2339,7 +2339,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE GLOBAL @@ -512,7 +512,7 @@ VARIABLE_COMMENT Unused NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1048576 -@@ -2311,7 +2311,7 @@ +@@ -2353,7 +2353,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 8 VARIABLE_SCOPE GLOBAL @@ -521,7 +521,7 @@ VARIABLE_COMMENT Unused NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1024 -@@ -2325,7 +2325,7 @@ +@@ -2367,7 +2367,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION @@ -530,7 +530,7 @@ VARIABLE_COMMENT Don't write queries to slow log that examine fewer rows than that NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -2339,7 +2339,7 @@ +@@ -2381,7 +2381,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 262144 VARIABLE_SCOPE SESSION @@ -539,7 +539,7 @@ VARIABLE_COMMENT Size of buffer to use when using MRR with range access NUMERIC_MIN_VALUE 8192 NUMERIC_MAX_VALUE 2147483647 -@@ -2353,10 +2353,10 @@ +@@ -2395,10 +2395,10 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 256 VARIABLE_SCOPE SESSION @@ -552,7 +552,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2367,7 +2367,7 @@ +@@ -2409,7 +2409,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE GLOBAL @@ -561,7 +561,7 @@ VARIABLE_COMMENT Block size to be used for MyISAM index pages NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 16384 -@@ -2381,7 +2381,7 @@ +@@ -2423,7 +2423,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 6 VARIABLE_SCOPE GLOBAL @@ -570,7 +570,7 @@ VARIABLE_COMMENT Default pointer size to be used for MyISAM tables NUMERIC_MIN_VALUE 2 NUMERIC_MAX_VALUE 7 -@@ -2391,9 +2391,9 @@ +@@ -2433,9 +2433,9 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MYISAM_MAX_SORT_FILE_SIZE SESSION_VALUE NULL @@ -582,7 +582,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Don't use the fast sort index method to created index if the temporary file would get bigger than this -@@ -2405,14 +2405,14 @@ +@@ -2447,14 +2447,14 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MYISAM_MMAP_SIZE SESSION_VALUE NULL @@ -600,7 +600,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY YES -@@ -2437,10 +2437,10 @@ +@@ -2479,10 +2479,10 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -613,7 +613,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2454,7 +2454,7 @@ +@@ -2496,7 +2496,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE NUMERIC_MIN_VALUE 4096 @@ -622,7 +622,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2507,7 +2507,7 @@ +@@ -2549,7 +2549,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 16384 VARIABLE_SCOPE SESSION @@ -631,7 +631,7 @@ VARIABLE_COMMENT Buffer length for TCP/IP and socket communication NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1048576 -@@ -2521,7 +2521,7 @@ +@@ -2563,7 +2563,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 30 VARIABLE_SCOPE SESSION @@ -640,7 +640,7 @@ VARIABLE_COMMENT Number of seconds to wait for more data from a connection before aborting the read NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -2535,7 +2535,7 @@ +@@ -2577,7 +2577,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE SESSION @@ -649,7 +649,7 @@ VARIABLE_COMMENT If a read on a communication port is interrupted, retry this many times before giving up NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2549,7 +2549,7 @@ +@@ -2591,7 +2591,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 60 VARIABLE_SCOPE SESSION @@ -658,7 +658,7 @@ VARIABLE_COMMENT Number of seconds to wait for a block to be written to a connection before aborting the write NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -2619,7 +2619,7 @@ +@@ -2661,7 +2661,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -667,7 +667,7 @@ VARIABLE_COMMENT Controls the heuristic(s) applied during query optimization to prune less-promising partial plans from the optimizer search space. Meaning: 0 - do not apply any heuristic, thus perform exhaustive search; 1 - prune plans based on number of retrieved rows NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1 -@@ -2633,7 +2633,7 @@ +@@ -2675,7 +2675,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 62 VARIABLE_SCOPE SESSION @@ -676,7 +676,7 @@ VARIABLE_COMMENT Maximum depth of search performed by the query optimizer. Values larger than the number of relations in a query result in better query plans, but take longer to compile a query. Values smaller than the number of tables in a relation result in faster optimization, but may produce very bad query plans. If set to 0, the system will automatically pick a reasonable value NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 62 -@@ -2647,7 +2647,7 @@ +@@ -2689,7 +2689,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE SESSION @@ -685,7 +685,7 @@ VARIABLE_COMMENT Controls number of record samples to check condition selectivity NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 4294967295 -@@ -2675,7 +2675,7 @@ +@@ -2717,7 +2717,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -694,7 +694,7 @@ VARIABLE_COMMENT Controls selectivity of which conditions the optimizer takes into account to calculate cardinality of a partial join when it searches for the best execution plan Meaning: 1 - use selectivity of index backed range conditions to calculate the cardinality of a partial join if the last joined table is accessed by full table scan or an index scan, 2 - use selectivity of index backed range conditions to calculate the cardinality of a partial join in any case, 3 - additionally always use selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join, 4 - use histograms to calculate selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join.5 - additionally use selectivity of certain non-range predicates calculated on record samples NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 5 -@@ -2703,7 +2703,7 @@ +@@ -2745,7 +2745,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -703,7 +703,7 @@ VARIABLE_COMMENT Maximum number of instrumented user@host accounts. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2717,7 +2717,7 @@ +@@ -2759,7 +2759,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -712,7 +712,7 @@ VARIABLE_COMMENT Size of the statement digest. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 200 -@@ -2731,7 +2731,7 @@ +@@ -2773,7 +2773,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -721,7 +721,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_STAGES_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2745,7 +2745,7 @@ +@@ -2787,7 +2787,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -730,7 +730,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_STAGES_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2759,7 +2759,7 @@ +@@ -2801,7 +2801,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -739,7 +739,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_STATEMENTS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2773,7 +2773,7 @@ +@@ -2815,7 +2815,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -748,7 +748,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_STATEMENTS_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2787,7 +2787,7 @@ +@@ -2829,7 +2829,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -757,7 +757,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_WAITS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2801,7 +2801,7 @@ +@@ -2843,7 +2843,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -766,7 +766,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_WAITS_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2815,7 +2815,7 @@ +@@ -2857,7 +2857,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -775,7 +775,7 @@ VARIABLE_COMMENT Maximum number of instrumented hosts. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2829,7 +2829,7 @@ +@@ -2871,7 +2871,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 80 VARIABLE_SCOPE GLOBAL @@ -784,7 +784,7 @@ VARIABLE_COMMENT Maximum number of condition instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2843,7 +2843,7 @@ +@@ -2885,7 +2885,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -793,7 +793,7 @@ VARIABLE_COMMENT Maximum number of instrumented condition objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2857,7 +2857,7 @@ +@@ -2899,7 +2899,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE GLOBAL @@ -802,7 +802,7 @@ VARIABLE_COMMENT Maximum length considered for digest text, when stored in performance_schema tables. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -2871,7 +2871,7 @@ +@@ -2913,7 +2913,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 50 VARIABLE_SCOPE GLOBAL @@ -811,7 +811,7 @@ VARIABLE_COMMENT Maximum number of file instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2885,7 +2885,7 @@ +@@ -2927,7 +2927,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 32768 VARIABLE_SCOPE GLOBAL @@ -820,7 +820,7 @@ VARIABLE_COMMENT Maximum number of opened instrumented files. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -2899,7 +2899,7 @@ +@@ -2941,7 +2941,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -829,7 +829,7 @@ VARIABLE_COMMENT Maximum number of instrumented files. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2913,7 +2913,7 @@ +@@ -2955,7 +2955,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 200 VARIABLE_SCOPE GLOBAL @@ -838,7 +838,7 @@ VARIABLE_COMMENT Maximum number of mutex instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2927,7 +2927,7 @@ +@@ -2969,7 +2969,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -847,7 +847,7 @@ VARIABLE_COMMENT Maximum number of instrumented MUTEX objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 104857600 -@@ -2941,7 +2941,7 @@ +@@ -2983,7 +2983,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 40 VARIABLE_SCOPE GLOBAL @@ -856,7 +856,7 @@ VARIABLE_COMMENT Maximum number of rwlock instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2955,7 +2955,7 @@ +@@ -2997,7 +2997,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -865,7 +865,7 @@ VARIABLE_COMMENT Maximum number of instrumented RWLOCK objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 104857600 -@@ -2969,7 +2969,7 @@ +@@ -3011,7 +3011,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE GLOBAL @@ -874,7 +874,7 @@ VARIABLE_COMMENT Maximum number of socket instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2983,7 +2983,7 @@ +@@ -3025,7 +3025,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -883,7 +883,7 @@ VARIABLE_COMMENT Maximum number of opened instrumented sockets. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2997,7 +2997,7 @@ +@@ -3039,7 +3039,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 150 VARIABLE_SCOPE GLOBAL @@ -892,49 +892,22 @@ VARIABLE_COMMENT Maximum number of stage instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -3011,7 +3011,7 @@ +@@ -3053,7 +3053,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME - DEFAULT_VALUE 181 + DEFAULT_VALUE 185 VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT Maximum number of statement instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -3025,7 +3025,7 @@ - GLOBAL_VALUE_ORIGIN CONFIG - DEFAULT_VALUE -1 - VARIABLE_SCOPE GLOBAL --VARIABLE_TYPE BIGINT -+VARIABLE_TYPE INT - VARIABLE_COMMENT Maximum number of opened instrumented tables. Use 0 to disable, -1 for automated sizing. - NUMERIC_MIN_VALUE -1 - NUMERIC_MAX_VALUE 1048576 -@@ -3039,7 +3039,7 @@ - GLOBAL_VALUE_ORIGIN CONFIG - DEFAULT_VALUE -1 - VARIABLE_SCOPE GLOBAL --VARIABLE_TYPE BIGINT -+VARIABLE_TYPE INT - VARIABLE_COMMENT Maximum number of instrumented tables. Use 0 to disable, -1 for automated sizing. - NUMERIC_MIN_VALUE -1 - NUMERIC_MAX_VALUE 1048576 -@@ -3053,7 +3053,7 @@ - GLOBAL_VALUE_ORIGIN COMPILE-TIME - DEFAULT_VALUE 50 - VARIABLE_SCOPE GLOBAL --VARIABLE_TYPE BIGINT UNSIGNED -+VARIABLE_TYPE INT UNSIGNED - VARIABLE_COMMENT Maximum number of thread instruments. - NUMERIC_MIN_VALUE 0 - NUMERIC_MAX_VALUE 256 @@ -3067,7 +3067,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT +VARIABLE_TYPE INT - VARIABLE_COMMENT Maximum number of instrumented threads. Use 0 to disable, -1 for automated sizing. + VARIABLE_COMMENT Maximum number of opened instrumented tables. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 @@ -3081,7 +3081,7 @@ @@ -943,10 +916,37 @@ VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT +VARIABLE_TYPE INT - VARIABLE_COMMENT Size of session attribute string buffer per thread. Use 0 to disable, -1 for automated sizing. + VARIABLE_COMMENT Maximum number of instrumented tables. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 @@ -3095,7 +3095,7 @@ + GLOBAL_VALUE_ORIGIN COMPILE-TIME + DEFAULT_VALUE 50 + VARIABLE_SCOPE GLOBAL +-VARIABLE_TYPE BIGINT UNSIGNED ++VARIABLE_TYPE INT UNSIGNED + VARIABLE_COMMENT Maximum number of thread instruments. + NUMERIC_MIN_VALUE 0 + NUMERIC_MAX_VALUE 256 +@@ -3109,7 +3109,7 @@ + GLOBAL_VALUE_ORIGIN CONFIG + DEFAULT_VALUE -1 + VARIABLE_SCOPE GLOBAL +-VARIABLE_TYPE BIGINT ++VARIABLE_TYPE INT + VARIABLE_COMMENT Maximum number of instrumented threads. Use 0 to disable, -1 for automated sizing. + NUMERIC_MIN_VALUE -1 + NUMERIC_MAX_VALUE 1048576 +@@ -3123,7 +3123,7 @@ + GLOBAL_VALUE_ORIGIN CONFIG + DEFAULT_VALUE -1 + VARIABLE_SCOPE GLOBAL +-VARIABLE_TYPE BIGINT ++VARIABLE_TYPE INT + VARIABLE_COMMENT Size of session attribute string buffer per thread. Use 0 to disable, -1 for automated sizing. + NUMERIC_MIN_VALUE -1 + NUMERIC_MAX_VALUE 1048576 +@@ -3137,7 +3137,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE GLOBAL @@ -955,7 +955,7 @@ VARIABLE_COMMENT Maximum number of rows in SETUP_ACTORS. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1024 -@@ -3109,7 +3109,7 @@ +@@ -3151,7 +3151,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE GLOBAL @@ -964,7 +964,7 @@ VARIABLE_COMMENT Maximum number of rows in SETUP_OBJECTS. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -3123,7 +3123,7 @@ +@@ -3165,7 +3165,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -973,7 +973,7 @@ VARIABLE_COMMENT Maximum number of instrumented users. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -3193,7 +3193,7 @@ +@@ -3235,7 +3235,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 32768 VARIABLE_SCOPE SESSION @@ -982,7 +982,7 @@ VARIABLE_COMMENT The size of the buffer that is allocated when preloading indexes NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1073741824 -@@ -3221,7 +3221,7 @@ +@@ -3263,7 +3263,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 15 VARIABLE_SCOPE SESSION @@ -991,7 +991,7 @@ VARIABLE_COMMENT Limit of query profiling memory NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 100 -@@ -3235,7 +3235,7 @@ +@@ -3277,7 +3277,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 5 VARIABLE_SCOPE SESSION @@ -1000,7 +1000,7 @@ VARIABLE_COMMENT Seconds between sending progress reports to the client for time-consuming statements. Set to 0 to disable progress reporting. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3305,7 +3305,7 @@ +@@ -3347,7 +3347,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 16384 VARIABLE_SCOPE SESSION @@ -1009,7 +1009,7 @@ VARIABLE_COMMENT Allocation block size for query parsing and execution NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 4294967295 -@@ -3319,7 +3319,7 @@ +@@ -3361,7 +3361,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1048576 VARIABLE_SCOPE GLOBAL @@ -1018,7 +1018,7 @@ VARIABLE_COMMENT Don't cache results that are bigger than this NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3333,7 +3333,7 @@ +@@ -3375,7 +3375,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4096 VARIABLE_SCOPE GLOBAL @@ -1027,7 +1027,7 @@ VARIABLE_COMMENT The minimum size for blocks allocated by the query cache NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3350,7 +3350,7 @@ +@@ -3392,7 +3392,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The memory allocated to store results from old queries NUMERIC_MIN_VALUE 0 @@ -1036,7 +1036,7 @@ NUMERIC_BLOCK_SIZE 1024 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3403,7 +3403,7 @@ +@@ -3445,7 +3445,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 24576 VARIABLE_SCOPE SESSION @@ -1045,7 +1045,7 @@ VARIABLE_COMMENT Persistent buffer for query parsing and execution NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 4294967295 -@@ -3417,7 +3417,7 @@ +@@ -3459,7 +3459,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4096 VARIABLE_SCOPE SESSION @@ -1054,7 +1054,16 @@ VARIABLE_COMMENT Allocation block size for storing ranges during optimization NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 4294967295 -@@ -3431,7 +3431,7 @@ +@@ -3476,7 +3476,7 @@ + VARIABLE_TYPE BIGINT UNSIGNED + VARIABLE_COMMENT Maximum speed(KB/s) to read binlog from master (0 = no limit) + NUMERIC_MIN_VALUE 0 +-NUMERIC_MAX_VALUE 18446744073709551615 ++NUMERIC_MAX_VALUE 4294967295 + NUMERIC_BLOCK_SIZE 1 + ENUM_VALUE_LIST NULL + READ_ONLY NO +@@ -3487,7 +3487,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 131072 VARIABLE_SCOPE SESSION @@ -1063,7 +1072,7 @@ VARIABLE_COMMENT Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value NUMERIC_MIN_VALUE 8192 NUMERIC_MAX_VALUE 2147483647 -@@ -3459,7 +3459,7 @@ +@@ -3515,7 +3515,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 262144 VARIABLE_SCOPE SESSION @@ -1072,7 +1081,7 @@ VARIABLE_COMMENT When reading rows in sorted order after a sort, the rows are read through this buffer to avoid a disk seeks NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 2147483647 -@@ -3739,10 +3739,10 @@ +@@ -3795,10 +3795,10 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 8388608 VARIABLE_SCOPE SESSION @@ -1085,16 +1094,16 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3781,7 +3781,7 @@ +@@ -3837,7 +3837,7 @@ GLOBAL_VALUE_ORIGIN CONFIG - DEFAULT_VALUE 0 + DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT Uniquely identifies the server instance in the community of replication partners - NUMERIC_MIN_VALUE 0 + NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -3907,7 +3907,7 @@ +@@ -4019,7 +4019,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -1103,7 +1112,7 @@ VARIABLE_COMMENT Maximum number of parallel threads to use on slave for events in a single replication domain. When using multiple domains, this can be used to limit a single domain from grabbing all threads and thus stalling other domains. The default of 0 means to allow a domain to grab as many threads as it wants, up to the value of slave_parallel_threads. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16383 -@@ -3949,7 +3949,7 @@ +@@ -4061,7 +4061,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1073741824 VARIABLE_SCOPE GLOBAL @@ -1112,7 +1121,7 @@ VARIABLE_COMMENT The maximum packet length to sent successfully from the master to slave. NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1073741824 -@@ -3977,7 +3977,7 @@ +@@ -4089,7 +4089,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 131072 VARIABLE_SCOPE GLOBAL @@ -1121,7 +1130,7 @@ VARIABLE_COMMENT Limit on how much memory SQL threads should use per parallel replication thread when reading ahead in the relay log looking for opportunities for parallel replication. Only used when --slave-parallel-threads > 0. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 2147483647 -@@ -4005,7 +4005,7 @@ +@@ -4117,7 +4117,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -1130,7 +1139,7 @@ VARIABLE_COMMENT If non-zero, number of threads to spawn to apply in parallel events on the slave that were group-committed on the master or were logged with GTID in different replication domains. Note that these threads are in addition to the IO and SQL threads, which are always created by a replication slave NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16383 -@@ -4019,7 +4019,7 @@ +@@ -4131,7 +4131,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -1139,7 +1148,7 @@ VARIABLE_COMMENT Alias for slave_parallel_threads NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16383 -@@ -4075,7 +4075,7 @@ +@@ -4187,7 +4187,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE GLOBAL @@ -1148,7 +1157,7 @@ VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout, before giving up and stopping NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -4103,7 +4103,7 @@ +@@ -4215,7 +4215,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 2 VARIABLE_SCOPE GLOBAL @@ -1157,7 +1166,7 @@ VARIABLE_COMMENT If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 31536000 -@@ -4162,7 +4162,7 @@ +@@ -4274,7 +4274,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Each thread that needs to do a sort allocates a buffer of this size NUMERIC_MIN_VALUE 1024 @@ -1166,7 +1175,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -4453,7 +4453,7 @@ +@@ -4579,7 +4579,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 256 VARIABLE_SCOPE GLOBAL @@ -1175,7 +1184,7 @@ VARIABLE_COMMENT The soft upper limit for number of cached stored routines for one connection. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 524288 -@@ -4551,7 +4551,7 @@ +@@ -4677,7 +4677,7 @@ GLOBAL_VALUE_ORIGIN AUTO DEFAULT_VALUE 400 VARIABLE_SCOPE GLOBAL @@ -1184,7 +1193,7 @@ VARIABLE_COMMENT The number of cached table definitions NUMERIC_MIN_VALUE 400 NUMERIC_MAX_VALUE 524288 -@@ -4565,7 +4565,7 @@ +@@ -4691,7 +4691,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 2000 VARIABLE_SCOPE GLOBAL @@ -1192,8 +1201,8 @@ +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT The number of cached open tables NUMERIC_MIN_VALUE 1 - NUMERIC_MAX_VALUE 524288 -@@ -4579,7 +4579,7 @@ + NUMERIC_MAX_VALUE 1048576 +@@ -4719,7 +4719,7 @@ GLOBAL_VALUE_ORIGIN AUTO DEFAULT_VALUE 256 VARIABLE_SCOPE GLOBAL @@ -1202,7 +1211,7 @@ VARIABLE_COMMENT How many threads we should keep in a cache for reuse. These are freed after 5 minutes of idle time NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -4593,7 +4593,7 @@ +@@ -4733,7 +4733,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE GLOBAL @@ -1211,7 +1220,7 @@ VARIABLE_COMMENT Permits the application to give the threads system a hint for the desired number of threads that should be run at the same time.This variable has no effect, and is deprecated. It will be removed in a future release. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 512 -@@ -4778,7 +4778,7 @@ +@@ -4946,7 +4946,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM or Aria table NUMERIC_MIN_VALUE 1024 @@ -1220,7 +1229,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -4789,7 +4789,7 @@ +@@ -4957,7 +4957,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 8192 VARIABLE_SCOPE SESSION @@ -1229,7 +1238,7 @@ VARIABLE_COMMENT Allocation block size for transactions to be stored in binary log NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 134217728 -@@ -4803,7 +4803,7 @@ +@@ -4971,7 +4971,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4096 VARIABLE_SCOPE SESSION @@ -1238,7 +1247,7 @@ VARIABLE_COMMENT Persistent buffer for transactions to be stored in binary log NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 134217728 -@@ -4901,7 +4901,7 @@ +@@ -5069,7 +5069,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 28800 VARIABLE_SCOPE SESSION @@ -1247,7 +1256,7 @@ VARIABLE_COMMENT The number of seconds the server waits for activity on a connection before closing it NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -5089,7 +5089,7 @@ +@@ -5173,7 +5173,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME OPEN_FILES_LIMIT VARIABLE_SCOPE GLOBAL @@ -1256,7 +1265,7 @@ VARIABLE_COMMENT If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit(). If this value is 0 then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of file descriptors NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -5102,7 +5102,7 @@ +@@ -5186,7 +5186,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes NUMERIC_MIN_VALUE 0 @@ -1265,7 +1274,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -5112,7 +5112,7 @@ +@@ -5196,7 +5196,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes NUMERIC_MIN_VALUE 0 @@ -1274,7 +1283,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -5197,7 +5197,7 @@ +@@ -5281,7 +5281,7 @@ VARIABLE_NAME LOG_TC_SIZE GLOBAL_VALUE_ORIGIN AUTO VARIABLE_SCOPE GLOBAL diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index 9b31ae23613..15373702057 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -1759,6 +1759,34 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL READ_ONLY YES COMMAND_LINE_ARGUMENT NULL +VARIABLE_NAME LOG_BIN_COMPRESS +SESSION_VALUE NULL +GLOBAL_VALUE OFF +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE OFF +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT Whether the binary log can be compressed +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME LOG_BIN_COMPRESS_MIN_LEN +SESSION_VALUE NULL +GLOBAL_VALUE 256 +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE 256 +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE INT UNSIGNED +VARIABLE_COMMENT Minimum length of sql statement(in statement mode) or record(in row mode)that can be compressed. +NUMERIC_MIN_VALUE 10 +NUMERIC_MAX_VALUE 1024 +NUMERIC_BLOCK_SIZE 1 +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME LOG_BIN_INDEX SESSION_VALUE NULL GLOBAL_VALUE @@ -3021,9 +3049,9 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STATEMENT_CLASSES SESSION_VALUE NULL -GLOBAL_VALUE 184 +GLOBAL_VALUE 185 GLOBAL_VALUE_ORIGIN COMPILE-TIME -DEFAULT_VALUE 184 +DEFAULT_VALUE 185 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Maximum number of statement instruments. @@ -3439,6 +3467,20 @@ NUMERIC_BLOCK_SIZE 1024 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME READ_BINLOG_SPEED_LIMIT +SESSION_VALUE NULL +GLOBAL_VALUE 0 +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE 0 +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_COMMENT Maximum speed(KB/s) to read binlog from master (0 = no limit) +NUMERIC_MIN_VALUE 0 +NUMERIC_MAX_VALUE 18446744073709551615 +NUMERIC_BLOCK_SIZE 1 +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME READ_BUFFER_SIZE SESSION_VALUE 131072 GLOBAL_VALUE 131072 @@ -4652,7 +4694,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The number of cached open tables NUMERIC_MIN_VALUE 1 -NUMERIC_MAX_VALUE 524288 +NUMERIC_MAX_VALUE 1048576 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO diff --git a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result index 36d04afb80d..53838366a16 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result +++ b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result @@ -143,18 +143,18 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME WSREP_DIRTY_READS SESSION_VALUE OFF -GLOBAL_VALUE NULL +GLOBAL_VALUE OFF GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE OFF -VARIABLE_SCOPE SESSION ONLY +VARIABLE_SCOPE SESSION VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT Do not reject SELECT queries even when the node is not ready. +VARIABLE_COMMENT Allow reads even when the node is not in the primary component. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST OFF,ON READ_ONLY NO -COMMAND_LINE_ARGUMENT NULL +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME WSREP_DRUPAL_282555_WORKAROUND SESSION_VALUE NULL GLOBAL_VALUE OFF diff --git a/mysql-test/suite/sys_vars/r/table_open_cache_basic.result b/mysql-test/suite/sys_vars/r/table_open_cache_basic.result index d940ed69901..4c635783753 100644 --- a/mysql-test/suite/sys_vars/r/table_open_cache_basic.result +++ b/mysql-test/suite/sys_vars/r/table_open_cache_basic.result @@ -27,7 +27,7 @@ Warnings: Warning 1292 Truncated incorrect table_open_cache value: '1073741824' SELECT @@global.table_open_cache ; @@global.table_open_cache -524288 +1048576 SET @@global.table_open_cache = 18000; SELECT @@global.table_open_cache ; @@global.table_open_cache @@ -48,7 +48,7 @@ Warnings: Warning 1292 Truncated incorrect table_open_cache value: '100000000000' SELECT @@global.table_open_cache ; @@global.table_open_cache -524288 +1048576 SET @@global.table_open_cache = -1024; Warnings: Warning 1292 Truncated incorrect table_open_cache value: '-1024' diff --git a/mysql-test/suite/sys_vars/r/table_open_cache_instances_basic.result b/mysql-test/suite/sys_vars/r/table_open_cache_instances_basic.result deleted file mode 100644 index e735c5ccbc6..00000000000 --- a/mysql-test/suite/sys_vars/r/table_open_cache_instances_basic.result +++ /dev/null @@ -1,3 +0,0 @@ -select @@table_open_cache_instances; -@@table_open_cache_instances -1 diff --git a/mysql-test/suite/sys_vars/r/wsrep_dirty_reads_basic.result b/mysql-test/suite/sys_vars/r/wsrep_dirty_reads_basic.result index d2a62d6136f..1968103873a 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_dirty_reads_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_dirty_reads_basic.result @@ -5,12 +5,13 @@ SET @wsrep_dirty_reads_session_saved = @@session.wsrep_dirty_reads; # default SELECT @@global.wsrep_dirty_reads; -ERROR HY000: Variable 'wsrep_dirty_reads' is a SESSION variable +@@global.wsrep_dirty_reads +0 SELECT @@session.wsrep_dirty_reads; @@session.wsrep_dirty_reads 0 -# scope and valid values +# valid values for session SET @@session.wsrep_dirty_reads=OFF; SELECT @@session.wsrep_dirty_reads; @@session.wsrep_dirty_reads @@ -24,11 +25,29 @@ SELECT @@session.wsrep_dirty_reads; @@session.wsrep_dirty_reads 0 +# valid values for global +SET @@global.wsrep_dirty_reads=OFF; +SELECT @@global.wsrep_dirty_reads; +@@global.wsrep_dirty_reads +0 +SET @@global.wsrep_dirty_reads=ON; +SELECT @@global.wsrep_dirty_reads; +@@global.wsrep_dirty_reads +1 +SET @@global.wsrep_dirty_reads=default; +SELECT @@global.wsrep_dirty_reads; +@@global.wsrep_dirty_reads +0 + # invalid values SET @@session.wsrep_dirty_reads=NULL; ERROR 42000: Variable 'wsrep_dirty_reads' can't be set to the value of 'NULL' SET @@session.wsrep_dirty_reads='junk'; ERROR 42000: Variable 'wsrep_dirty_reads' can't be set to the value of 'junk' +SET @@global.wsrep_dirty_reads=NULL; +ERROR 42000: Variable 'wsrep_dirty_reads' can't be set to the value of 'NULL' +SET @@global.wsrep_dirty_reads='junk'; +ERROR 42000: Variable 'wsrep_dirty_reads' can't be set to the value of 'junk' # restore the initial values SET @@session.wsrep_dirty_reads = @wsrep_dirty_reads_session_saved; diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_pct_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_pct_basic.test index ae45be7f2a3..99d3f79fb27 100644 --- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_pct_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_pct_basic.test @@ -9,6 +9,9 @@ -- source include/have_innodb.inc +# Save the default value +SET @orig = @@global.innodb_buffer_pool_dump_pct; + # Check the default value SELECT @@global.innodb_buffer_pool_dump_pct; @@ -55,3 +58,6 @@ SET GLOBAL innodb_buffer_pool_dump_pct='foo'; # Set without using Global --error ER_GLOBAL_VARIABLE SET innodb_buffer_pool_dump_pct=50; + +# Restore original value +SET GLOBAL innodb_buffer_pool_dump_pct=@orig; diff --git a/mysql-test/suite/sys_vars/t/innodb_cleaner_eviction_factor_basic.test b/mysql-test/suite/sys_vars/t/innodb_cleaner_eviction_factor_basic.test deleted file mode 100644 index 8e0af20a47e..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_cleaner_eviction_factor_basic.test +++ /dev/null @@ -1,35 +0,0 @@ ---source include/have_debug.inc ---source include/have_xtradb.inc - -# A dynamic, global variable - -SET @start_value = @@GLOBAL.innodb_cleaner_eviction_factor; - -# Default value -SELECT @@GLOBAL.innodb_cleaner_eviction_factor; - -# Global only ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@SESSION.innodb_cleaner_eviction_factor; - -# Correct values -SET GLOBAL innodb_cleaner_eviction_factor='OFF'; -SELECT @@GLOBAL.innodb_cleaner_eviction_factor; -SET GLOBAL innodb_cleaner_eviction_factor='ON'; -SELECT @@GLOBAL.innodb_cleaner_eviction_factor; -SET GLOBAL innodb_cleaner_eviction_factor=0; -SELECT @@GLOBAL.innodb_cleaner_eviction_factor; -SET GLOBAL innodb_cleaner_eviction_factor=1; -SELECT @@GLOBAL.innodb_cleaner_eviction_factor; - -# Incorrect values ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_cleaner_eviction_factor=1.1; ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_cleaner_eviction_factor=1e1; ---error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL innodb_cleaner_eviction_factor=2; ---error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL innodb_cleaner_eviction_factor='foo'; - -SET GLOBAL innodb_cleaner_eviction_factor = @start_value; diff --git a/mysql-test/suite/sys_vars/t/innodb_cleaner_flush_chunk_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_cleaner_flush_chunk_size_basic.test deleted file mode 100644 index c65fc63c20f..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_cleaner_flush_chunk_size_basic.test +++ /dev/null @@ -1,33 +0,0 @@ ---source include/have_debug.inc ---source include/have_xtradb.inc - -# A dynamic, global variable - -SET @start_value = @@GLOBAL.innodb_cleaner_flush_chunk_size; - -# Default value -SELECT @@GLOBAL.innodb_cleaner_flush_chunk_size; - -# Global only ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@SESSION.innodb_cleaner_flush_chunk_size; - -# Correct values -SET GLOBAL innodb_cleaner_flush_chunk_size=1; -SELECT @@GLOBAL.innodb_cleaner_flush_chunk_size; -SET GLOBAL innodb_cleaner_flush_chunk_size=1000; -SELECT @@GLOBAL.innodb_cleaner_flush_chunk_size; -SET GLOBAL innodb_cleaner_flush_chunk_size=4294967295; -SELECT @@GLOBAL.innodb_cleaner_flush_chunk_size; - -# Incorrect values -SET GLOBAL innodb_cleaner_flush_chunk_size=0; -SELECT @@GLOBAL.innodb_cleaner_flush_chunk_size; ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_cleaner_flush_chunk_size=1.1; ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_cleaner_flush_chunk_size=1e1; ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_cleaner_flush_chunk_size='foo'; - -SET GLOBAL innodb_cleaner_flush_chunk_size = @start_value; diff --git a/mysql-test/suite/sys_vars/t/innodb_cleaner_free_list_lwm_basic.test b/mysql-test/suite/sys_vars/t/innodb_cleaner_free_list_lwm_basic.test deleted file mode 100644 index fa9d1e9f574..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_cleaner_free_list_lwm_basic.test +++ /dev/null @@ -1,35 +0,0 @@ ---source include/have_debug.inc ---source include/have_xtradb.inc - -# A dynamic, global variable - -SET @start_value = @@GLOBAL.innodb_cleaner_free_list_lwm; - -# Default value -SELECT @@GLOBAL.innodb_cleaner_free_list_lwm; - -# Global only ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@SESSION.innodb_cleaner_free_list_lwm; - -# Correct values -SET GLOBAL innodb_cleaner_free_list_lwm=0; -SELECT @@GLOBAL.innodb_cleaner_free_list_lwm; -SET GLOBAL innodb_cleaner_free_list_lwm=1; -SELECT @@GLOBAL.innodb_cleaner_free_list_lwm; -SET GLOBAL innodb_cleaner_free_list_lwm=99; -SELECT @@GLOBAL.innodb_cleaner_free_list_lwm; -SET GLOBAL innodb_cleaner_free_list_lwm=100; -SELECT @@GLOBAL.innodb_cleaner_free_list_lwm; - -# Incorrect values -SET GLOBAL innodb_cleaner_free_list_lwm=101; -SELECT @@innodb_cleaner_free_list_lwm; ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_cleaner_free_list_lwm=1.1; ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_cleaner_free_list_lwm=1e1; ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_cleaner_free_list_lwm='foo'; - -SET GLOBAL innodb_cleaner_free_list_lwm = @start_value; diff --git a/mysql-test/suite/sys_vars/t/innodb_cleaner_lru_chunk_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_cleaner_lru_chunk_size_basic.test deleted file mode 100644 index 12da590446c..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_cleaner_lru_chunk_size_basic.test +++ /dev/null @@ -1,33 +0,0 @@ ---source include/have_debug.inc ---source include/have_xtradb.inc - -# A dynamic, global variable - -SET @start_value = @@GLOBAL.innodb_cleaner_lru_chunk_size; - -# Default value -SELECT @@GLOBAL.innodb_cleaner_lru_chunk_size; - -# Global only ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@SESSION.innodb_cleaner_lru_chunk_size; - -# Correct values -SET GLOBAL innodb_cleaner_lru_chunk_size=1; -SELECT @@GLOBAL.innodb_cleaner_lru_chunk_size; -SET GLOBAL innodb_cleaner_lru_chunk_size=1000; -SELECT @@GLOBAL.innodb_cleaner_lru_chunk_size; -SET GLOBAL innodb_cleaner_lru_chunk_size=4294967295; -SELECT @@GLOBAL.innodb_cleaner_lru_chunk_size; - -# Incorrect values -SET GLOBAL innodb_cleaner_lru_chunk_size=0; -SELECT @@GLOBAL.innodb_cleaner_lru_chunk_size; ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_cleaner_lru_chunk_size=1.1; ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_cleaner_lru_chunk_size=1e1; ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_cleaner_lru_chunk_size='foo'; - -SET GLOBAL innodb_cleaner_lru_chunk_size = @start_value; diff --git a/mysql-test/suite/sys_vars/t/innodb_cleaner_lsn_age_factor_basic.test b/mysql-test/suite/sys_vars/t/innodb_cleaner_lsn_age_factor_basic.test deleted file mode 100644 index b34fcc94494..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_cleaner_lsn_age_factor_basic.test +++ /dev/null @@ -1,28 +0,0 @@ ---source include/have_xtradb.inc - -# A dynamic, global variable - -SET @start_value = @@GLOBAL.innodb_cleaner_lsn_age_factor; - -# Default value -SELECT @@GLOBAL.innodb_cleaner_lsn_age_factor; - -# Global only ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@SESSION.innodb_cleaner_lsn_age_factor; - -# Correct values -SET GLOBAL innodb_cleaner_lsn_age_factor='legacy'; -SELECT @@GLOBAL.innodb_cleaner_lsn_age_factor; -SET GLOBAL innodb_cleaner_lsn_age_factor='high_checkpoint'; -SELECT @@GLOBAL.innodb_cleaner_lsn_age_factor; - -# Incorrect values ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_cleaner_lsn_age_factor=1.1; ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_cleaner_lsn_age_factor=1e1; ---error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL innodb_cleaner_lsn_age_factor='foo'; - -SET GLOBAL innodb_cleaner_lsn_age_factor = @start_value; diff --git a/mysql-test/suite/sys_vars/t/innodb_cleaner_max_flush_time_basic.test b/mysql-test/suite/sys_vars/t/innodb_cleaner_max_flush_time_basic.test deleted file mode 100644 index 283c651d0c5..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_cleaner_max_flush_time_basic.test +++ /dev/null @@ -1,31 +0,0 @@ ---source include/have_debug.inc ---source include/have_xtradb.inc - -# A dynamic, global variable - -SET @start_value = @@GLOBAL.innodb_cleaner_max_flush_time; - -# Default value -SELECT @@GLOBAL.innodb_cleaner_max_flush_time; - -# Global only ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@SESSION.innodb_cleaner_max_flush_time; - -# Correct values -SET GLOBAL innodb_cleaner_max_flush_time=0; -SELECT @@GLOBAL.innodb_cleaner_max_flush_time; -SET GLOBAL innodb_cleaner_max_flush_time=1000; -SELECT @@GLOBAL.innodb_cleaner_max_flush_time; -SET GLOBAL innodb_cleaner_max_flush_time=4294967295; -SELECT @@GLOBAL.innodb_cleaner_max_flush_time; - -# Incorrect values ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_cleaner_max_flush_time=1.1; ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_cleaner_max_flush_time=1e1; ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_cleaner_max_flush_time='foo'; - -SET GLOBAL innodb_cleaner_max_flush_time = @start_value; diff --git a/mysql-test/suite/sys_vars/t/innodb_cleaner_max_lru_time_basic.test b/mysql-test/suite/sys_vars/t/innodb_cleaner_max_lru_time_basic.test deleted file mode 100644 index d0621e77df3..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_cleaner_max_lru_time_basic.test +++ /dev/null @@ -1,31 +0,0 @@ ---source include/have_debug.inc ---source include/have_xtradb.inc - -# A dynamic, global variable - -SET @start_value = @@GLOBAL.innodb_cleaner_max_lru_time; - -# Default value -SELECT @@GLOBAL.innodb_cleaner_max_lru_time; - -# Global only ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@SESSION.innodb_cleaner_max_lru_time; - -# Correct values -SET GLOBAL innodb_cleaner_max_lru_time=0; -SELECT @@GLOBAL.innodb_cleaner_max_lru_time; -SET GLOBAL innodb_cleaner_max_lru_time=1000; -SELECT @@GLOBAL.innodb_cleaner_max_lru_time; -SET GLOBAL innodb_cleaner_max_lru_time=4294967295; -SELECT @@GLOBAL.innodb_cleaner_max_lru_time; - -# Incorrect values ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_cleaner_max_lru_time=1.1; ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_cleaner_max_lru_time=1e1; ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_cleaner_max_lru_time='foo'; - -SET GLOBAL innodb_cleaner_max_lru_time = @start_value; diff --git a/mysql-test/suite/sys_vars/t/innodb_empty_free_list_algorithm_basic.opt b/mysql-test/suite/sys_vars/t/innodb_empty_free_list_algorithm_basic.opt deleted file mode 100644 index c788dc76ac7..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_empty_free_list_algorithm_basic.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-innodb-buffer-pool-size=20M diff --git a/mysql-test/suite/sys_vars/t/innodb_empty_free_list_algorithm_basic.test b/mysql-test/suite/sys_vars/t/innodb_empty_free_list_algorithm_basic.test deleted file mode 100644 index 6bb34f36a4f..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_empty_free_list_algorithm_basic.test +++ /dev/null @@ -1,30 +0,0 @@ ---source include/have_xtradb.inc - -# A dynamic, global variable - -SET @start_value = @@GLOBAL.innodb_empty_free_list_algorithm; - -# Default value -SELECT @@GLOBAL.innodb_empty_free_list_algorithm; - -# Global only ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@SESSION.innodb_empty_free_list_algorithm; - -# Correct values -SET GLOBAL innodb_empty_free_list_algorithm='legacy'; -SELECT @@GLOBAL.innodb_empty_free_list_algorithm; -SET GLOBAL innodb_empty_free_list_algorithm='backoff'; -SELECT @@GLOBAL.innodb_empty_free_list_algorithm; - -# Incorrect values ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_empty_free_list_algorithm=1.1; ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_empty_free_list_algorithm=1e1; ---error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL innodb_empty_free_list_algorithm=2; ---error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL innodb_empty_free_list_algorithm='foo'; - -SET GLOBAL innodb_empty_free_list_algorithm = @start_value; diff --git a/mysql-test/suite/sys_vars/t/innodb_foreground_preflush_basic.test b/mysql-test/suite/sys_vars/t/innodb_foreground_preflush_basic.test deleted file mode 100644 index f388b392f9b..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_foreground_preflush_basic.test +++ /dev/null @@ -1,30 +0,0 @@ ---source include/have_xtradb.inc - -# A dynamic, global variable - -SET @start_value = @@GLOBAL.innodb_foreground_preflush; - -# Default value -SELECT @@GLOBAL.innodb_foreground_preflush; - -# Global only ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@SESSION.innodb_foreground_preflush; - -# Correct values -SET GLOBAL innodb_foreground_preflush='sync_preflush'; -SELECT @@GLOBAL.innodb_foreground_preflush; -SET GLOBAL innodb_foreground_preflush='exponential_backoff'; -SELECT @@GLOBAL.innodb_foreground_preflush; - -# Incorrect values ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_foreground_preflush=1.1; ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_foreground_preflush=1e1; ---error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL innodb_foreground_preflush=2; ---error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL innodb_foreground_preflush='foo'; - -SET GLOBAL innodb_foreground_preflush = @start_value; diff --git a/mysql-test/suite/sys_vars/t/innodb_log_arch_dir_basic.test b/mysql-test/suite/sys_vars/t/innodb_log_arch_dir_basic.test deleted file mode 100644 index 084d97fa460..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_log_arch_dir_basic.test +++ /dev/null @@ -1,68 +0,0 @@ -####################################################### -# Basic test for innodb_log_arch_dir variable # -####################################################### - ---source include/have_xtradb.inc - -let $datadir= `select @@datadir`; - -#################################################################### -# Displaying default value # -#################################################################### ---replace_result $datadir ./ -SELECT @@GLOBAL.innodb_log_arch_dir; ---echo NULL Expected - - -#################################################################### -# Check if Value can set # -#################################################################### - ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SET @@GLOBAL.innodb_log_arch_dir=1; ---echo Expected error 'Read only variable' - ---replace_result $datadir ./ -SELECT @@GLOBAL.innodb_log_arch_dir; ---echo NULL Expected - ---replace_result $datadir ./ -SELECT VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='innodb_log_arch_dir'; ---echo empty string Expected - -############################################ -# Check accessing variable without GLOBAL # -############################################ ---replace_result $datadir ./ -SELECT @@innodb_log_arch_dir; ---echo NULL Expected - - - -########################################################################## -# Check if innodb_log_arch_dir can be accessed without @@ sign # -########################################################################## - ---replace_result $datadir ./ -SELECT @@innodb_log_arch_dir; ---echo NULL Expected - ---Error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@local.innodb_log_arch_dir; ---echo Expected error 'Variable is a GLOBAL variable' - ---Error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@SESSION.innodb_log_arch_dir; ---echo Expected error 'Variable is a GLOBAL variable' - ---replace_result $datadir ./ -SELECT @@GLOBAL.innodb_log_arch_dir; ---echo NULL Expected - ---Error ER_BAD_FIELD_ERROR -SELECT innodb_log_arch_dir = @@SESSION.innodb_log_arch_dir; ---echo Expected error Unknown column 'innodb_log_arch_dir' in 'field list' - - diff --git a/mysql-test/suite/sys_vars/t/innodb_log_arch_expire_sec_basic.test b/mysql-test/suite/sys_vars/t/innodb_log_arch_expire_sec_basic.test deleted file mode 100644 index 87c374ea886..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_log_arch_expire_sec_basic.test +++ /dev/null @@ -1,60 +0,0 @@ -############################################################### -# Basic test for innodb_log_arch_expire_sec variable # -############################################################### - ---source include/have_xtradb.inc - -SELECT @@GLOBAL.innodb_log_arch_expire_sec INTO @save; - -#################################################################### -# Displaying default value # -#################################################################### -SELECT @@GLOBAL.innodb_log_arch_expire_sec; ---echo 0 Expected - - -#################################################################### -# Check if Value can set # -#################################################################### - -SET @@GLOBAL.innodb_log_arch_expire_sec=1; - -SELECT @@GLOBAL.innodb_log_arch_expire_sec; ---echo 1 Expected - -SELECT VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='innodb_log_arch_expire_sec'; ---echo 1 Expected - -############################################ -# Check accessing variable without GLOBAL # -############################################ -SELECT @@innodb_log_arch_expire_sec; ---echo 1 Expected - - - -################################################################################## -# Check if innodb_log_arch_expire_sec can be accessed without @@ sign # -################################################################################## - -SELECT @@innodb_log_arch_expire_sec; ---echo 1 Expected - ---Error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@local.innodb_log_arch_expire_sec; ---echo Expected error 'Variable is a GLOBAL variable' - ---Error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@SESSION.innodb_log_arch_expire_sec; ---echo Expected error 'Variable is a GLOBAL variable' - -SELECT @@GLOBAL.innodb_log_arch_expire_sec; ---echo 1 Expected - ---Error ER_BAD_FIELD_ERROR -SELECT innodb_log_arch_expire_sec = @@SESSION.innodb_log_arch_expire_sec; ---echo Expected error Unknown column 'innodb_log_arch_expire_sec' in 'field list' - -SET @@GLOBAL.innodb_log_arch_expire_sec = @save; diff --git a/mysql-test/suite/sys_vars/t/innodb_log_archive_basic.test b/mysql-test/suite/sys_vars/t/innodb_log_archive_basic.test deleted file mode 100644 index cbc885123ce..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_log_archive_basic.test +++ /dev/null @@ -1,61 +0,0 @@ -################################################### -# Basic test for innodb_log_archive variable # -################################################### - ---source include/have_xtradb.inc - -#################################################################### -# Displaying default value # -#################################################################### -SELECT @@GLOBAL.innodb_log_archive; ---echo 0 Expected - - -#################################################################### -# Check if Value can set # -#################################################################### - -SET @save_innodb_log_archive = @@GLOBAL.innodb_log_archive; -SET @@GLOBAL.innodb_log_archive=1; - -SELECT @@GLOBAL.innodb_log_archive; ---echo 1 Expected - -SELECT VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='innodb_log_archive'; ---echo ON Expected - -SET @@GLOBAL.innodb_log_archive = @save_innodb_log_archive; - -############################################ -# Check accessing variable without GLOBAL # -############################################ -SELECT @@innodb_log_archive; ---echo 0 Expected - - - -########################################################################## -# Check if innodb_log_archive can be accessed without @@ sign # -########################################################################## - -SELECT @@innodb_log_archive; ---echo 0 Expected - ---Error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@local.innodb_log_archive; ---echo Expected error 'Variable is a GLOBAL variable' - ---Error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@SESSION.innodb_log_archive; ---echo Expected error 'Variable is a GLOBAL variable' - -SELECT @@GLOBAL.innodb_log_archive; ---echo 0 Expected - ---Error ER_BAD_FIELD_ERROR -SELECT innodb_log_archive = @@SESSION.innodb_log_archive; ---echo Expected error Unknown column 'innodb_log_archive' in 'field list' - - diff --git a/mysql-test/suite/sys_vars/t/innodb_log_checksum_algorithm_basic.test b/mysql-test/suite/sys_vars/t/innodb_log_checksum_algorithm_basic.test deleted file mode 100644 index 1a83d4f2602..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_log_checksum_algorithm_basic.test +++ /dev/null @@ -1,38 +0,0 @@ ---source include/have_xtradb.inc - -# Check the default value -SET @orig = @@global.innodb_log_checksum_algorithm; -SELECT @orig; - -SET GLOBAL innodb_log_checksum_algorithm = 'crc32'; -SELECT @@global.innodb_log_checksum_algorithm; - -SET GLOBAL innodb_log_checksum_algorithm = 'strict_crc32'; -SELECT @@global.innodb_log_checksum_algorithm; - -SET GLOBAL innodb_log_checksum_algorithm = 'innodb'; -SELECT @@global.innodb_log_checksum_algorithm; - -SET GLOBAL innodb_log_checksum_algorithm = 'strict_innodb'; -SELECT @@global.innodb_log_checksum_algorithm; - -SET GLOBAL innodb_log_checksum_algorithm = 'none'; -SELECT @@global.innodb_log_checksum_algorithm; - -SET GLOBAL innodb_log_checksum_algorithm = 'strict_none'; -SELECT @@global.innodb_log_checksum_algorithm; - --- error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL innodb_log_checksum_algorithm = ''; -SELECT @@global.innodb_log_checksum_algorithm; - --- error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL innodb_log_checksum_algorithm = 'foobar'; -SELECT @@global.innodb_log_checksum_algorithm; - --- error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL innodb_log_checksum_algorithm = 123; -SELECT @@global.innodb_log_checksum_algorithm; - -SET GLOBAL innodb_log_checksum_algorithm = @orig; -SELECT @@global.innodb_log_checksum_algorithm; diff --git a/mysql-test/suite/sys_vars/t/innodb_numa_interleave_basic-master.opt b/mysql-test/suite/sys_vars/t/innodb_numa_interleave_basic-master.opt new file mode 100644 index 00000000000..c1c2bb26b8a --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_numa_interleave_basic-master.opt @@ -0,0 +1 @@ +--loose-innodb_numa_interleave=1 diff --git a/mysql-test/suite/sys_vars/t/innodb_numa_interleave_basic.test b/mysql-test/suite/sys_vars/t/innodb_numa_interleave_basic.test new file mode 100644 index 00000000000..518b5ebba17 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_numa_interleave_basic.test @@ -0,0 +1,14 @@ +--source include/have_innodb.inc +--source include/have_numa.inc +--source include/have_64bit.inc + +SELECT @@GLOBAL.innodb_numa_interleave; + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_numa_interleave=off; + +SELECT @@GLOBAL.innodb_numa_interleave; + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@SESSION.innodb_numa_interleave; + diff --git a/mysql-test/suite/sys_vars/t/innodb_priority_cleaner_basic.test b/mysql-test/suite/sys_vars/t/innodb_priority_cleaner_basic.test deleted file mode 100644 index a305978a280..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_priority_cleaner_basic.test +++ /dev/null @@ -1,36 +0,0 @@ ---source include/have_debug.inc ---source include/have_xtradb.inc ---source include/linux.inc - -# A dynamic, global variable - -SET @start_value = @@GLOBAL.innodb_priority_cleaner; - -# Default value -SELECT @@GLOBAL.innodb_priority_cleaner; - -# Global only ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@SESSION.innodb_priority_cleaner; - -# Correct values -SET GLOBAL innodb_priority_cleaner='OFF'; -SELECT @@GLOBAL.innodb_priority_cleaner; -SET GLOBAL innodb_priority_cleaner='ON'; -SELECT @@GLOBAL.innodb_priority_cleaner; -SET GLOBAL innodb_priority_cleaner=0; -SELECT @@GLOBAL.innodb_priority_cleaner; -SET GLOBAL innodb_priority_cleaner=1; -SELECT @@GLOBAL.innodb_priority_cleaner; - -# Incorrect values ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_priority_cleaner=1.1; ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_priority_cleaner=1e1; ---error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL innodb_priority_cleaner=2; ---error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL innodb_priority_cleaner='foo'; - -SET GLOBAL innodb_priority_cleaner = @start_value; diff --git a/mysql-test/suite/sys_vars/t/innodb_priority_io_basic.test b/mysql-test/suite/sys_vars/t/innodb_priority_io_basic.test deleted file mode 100644 index d8a04cccf1e..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_priority_io_basic.test +++ /dev/null @@ -1,36 +0,0 @@ ---source include/have_debug.inc ---source include/have_xtradb.inc ---source include/linux.inc - -# A dynamic, global variable - -SET @start_value = @@GLOBAL.innodb_priority_io; - -# Default value -SELECT @@GLOBAL.innodb_priority_io; - -# Global only ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@SESSION.innodb_priority_io; - -# Correct values -SET GLOBAL innodb_priority_io='OFF'; -SELECT @@GLOBAL.innodb_priority_io; -SET GLOBAL innodb_priority_io='ON'; -SELECT @@GLOBAL.innodb_priority_io; -SET GLOBAL innodb_priority_io=0; -SELECT @@GLOBAL.innodb_priority_io; -SET GLOBAL innodb_priority_io=1; -SELECT @@GLOBAL.innodb_priority_io; - -# Incorrect values ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_priority_io=1.1; ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_priority_io=1e1; ---error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL innodb_priority_io=2; ---error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL innodb_priority_io='foo'; - -SET GLOBAL innodb_priority_io = @start_value; diff --git a/mysql-test/suite/sys_vars/t/innodb_priority_master_basic.test b/mysql-test/suite/sys_vars/t/innodb_priority_master_basic.test deleted file mode 100644 index f202738f4e1..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_priority_master_basic.test +++ /dev/null @@ -1,36 +0,0 @@ ---source include/have_debug.inc ---source include/have_xtradb.inc ---source include/linux.inc - -# A dynamic, global variable - -SET @start_value = @@GLOBAL.innodb_priority_master; - -# Default value -SELECT @@GLOBAL.innodb_priority_master; - -# Global only ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@SESSION.innodb_priority_master; - -# Correct values -SET GLOBAL innodb_priority_master='OFF'; -SELECT @@GLOBAL.innodb_priority_master; -SET GLOBAL innodb_priority_master='ON'; -SELECT @@GLOBAL.innodb_priority_master; -SET GLOBAL innodb_priority_master=0; -SELECT @@GLOBAL.innodb_priority_master; -SET GLOBAL innodb_priority_master=1; -SELECT @@GLOBAL.innodb_priority_master; - -# Incorrect values ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_priority_master=1.1; ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_priority_master=1e1; ---error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL innodb_priority_master=2; ---error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL innodb_priority_master='foo'; - -SET GLOBAL innodb_priority_master = @start_value; diff --git a/mysql-test/suite/sys_vars/t/innodb_priority_purge_basic.test b/mysql-test/suite/sys_vars/t/innodb_priority_purge_basic.test deleted file mode 100644 index b17a97838a5..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_priority_purge_basic.test +++ /dev/null @@ -1,36 +0,0 @@ ---source include/have_debug.inc ---source include/have_xtradb.inc ---source include/linux.inc - -# A dynamic, global variable - -SET @start_value = @@GLOBAL.innodb_priority_purge; - -# Default value -SELECT @@GLOBAL.innodb_priority_purge; - -# Global only ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@SESSION.innodb_priority_purge; - -# Correct values -SET GLOBAL innodb_priority_purge='OFF'; -SELECT @@GLOBAL.innodb_priority_purge; -SET GLOBAL innodb_priority_purge='ON'; -SELECT @@GLOBAL.innodb_priority_purge; -SET GLOBAL innodb_priority_purge=0; -SELECT @@GLOBAL.innodb_priority_purge; -SET GLOBAL innodb_priority_purge=1; -SELECT @@GLOBAL.innodb_priority_purge; - -# Incorrect values ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_priority_purge=1.1; ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL innodb_priority_purge=1e1; ---error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL innodb_priority_purge=2; ---error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL innodb_priority_purge='foo'; - -SET GLOBAL innodb_priority_purge = @start_value; diff --git a/mysql-test/suite/sys_vars/t/innodb_use_fallocate_basic.test b/mysql-test/suite/sys_vars/t/innodb_use_fallocate_basic.test deleted file mode 100644 index 655893be98e..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_use_fallocate_basic.test +++ /dev/null @@ -1,22 +0,0 @@ ---source include/have_innodb.inc -# bool readonly - -# -# show values; -# -select @@global.innodb_use_fallocate; ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -select @@session.innodb_use_fallocate; -show global variables like 'innodb_use_fallocate'; -show session variables like 'innodb_use_fallocate'; -select * from information_schema.global_variables where variable_name='innodb_use_fallocate'; -select * from information_schema.session_variables where variable_name='innodb_use_fallocate'; - -# -# show that it's read-only -# ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -set global innodb_use_fallocate=1; ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -set session innodb_use_fallocate=1; - diff --git a/mysql-test/suite/sys_vars/t/replicate_do_db_basic.test b/mysql-test/suite/sys_vars/t/replicate_do_db_basic.test index ccf50b1d6ab..59d0176add2 100644 --- a/mysql-test/suite/sys_vars/t/replicate_do_db_basic.test +++ b/mysql-test/suite/sys_vars/t/replicate_do_db_basic.test @@ -35,5 +35,8 @@ SELECT @@GLOBAL.replicate_do_db; SET @@GLOBAL.replicate_do_db=""; SELECT @@GLOBAL.replicate_do_db; +SET @@GLOBAL.replicate_do_db=null; +SELECT @@GLOBAL.replicate_do_db; + --echo # Cleanup. SET @@GLOBAL.replicate_do_db = @save_replicate_do_db; diff --git a/mysql-test/suite/sys_vars/t/replicate_do_table_basic.test b/mysql-test/suite/sys_vars/t/replicate_do_table_basic.test index f3b1585613e..346bdf3b038 100644 --- a/mysql-test/suite/sys_vars/t/replicate_do_table_basic.test +++ b/mysql-test/suite/sys_vars/t/replicate_do_table_basic.test @@ -44,5 +44,8 @@ SELECT @@GLOBAL.replicate_do_table; SET @@GLOBAL.replicate_do_table=""; SELECT @@GLOBAL.replicate_do_table; +SET @@GLOBAL.replicate_do_table=null; +SELECT @@GLOBAL.replicate_do_table; + --echo # Cleanup. SET @@GLOBAL.replicate_do_table = @save_replicate_do_table; diff --git a/mysql-test/suite/sys_vars/t/replicate_ignore_db_basic.test b/mysql-test/suite/sys_vars/t/replicate_ignore_db_basic.test index 3a0bc88109a..376397d1635 100644 --- a/mysql-test/suite/sys_vars/t/replicate_ignore_db_basic.test +++ b/mysql-test/suite/sys_vars/t/replicate_ignore_db_basic.test @@ -35,5 +35,8 @@ SELECT @@GLOBAL.replicate_ignore_db; SET @@GLOBAL.replicate_ignore_db=""; SELECT @@GLOBAL.replicate_ignore_db; +SET @@GLOBAL.replicate_ignore_db=null; +SELECT @@GLOBAL.replicate_ignore_db; + --echo # Cleanup. SET @@GLOBAL.replicate_ignore_db = @save_replicate_ignore_db; diff --git a/mysql-test/suite/sys_vars/t/replicate_ignore_table_basic.test b/mysql-test/suite/sys_vars/t/replicate_ignore_table_basic.test index aebe90732d2..56cf7f17c7f 100644 --- a/mysql-test/suite/sys_vars/t/replicate_ignore_table_basic.test +++ b/mysql-test/suite/sys_vars/t/replicate_ignore_table_basic.test @@ -44,5 +44,8 @@ SELECT @@GLOBAL.replicate_ignore_table; SET @@GLOBAL.replicate_ignore_table=""; SELECT @@GLOBAL.replicate_ignore_table; +SET @@GLOBAL.replicate_ignore_table=null; +SELECT @@GLOBAL.replicate_ignore_table; + --echo # Cleanup. SET @@GLOBAL.replicate_ignore_table = @save_replicate_ignore_table; diff --git a/mysql-test/suite/sys_vars/t/replicate_wild_do_table_basic.test b/mysql-test/suite/sys_vars/t/replicate_wild_do_table_basic.test index b96a62f8dd1..832d3397f89 100644 --- a/mysql-test/suite/sys_vars/t/replicate_wild_do_table_basic.test +++ b/mysql-test/suite/sys_vars/t/replicate_wild_do_table_basic.test @@ -44,5 +44,8 @@ SELECT @@GLOBAL.replicate_wild_do_table; SET @@GLOBAL.replicate_wild_do_table=""; SELECT @@GLOBAL.replicate_wild_do_table; +SET @@GLOBAL.replicate_wild_do_table=null; +SELECT @@GLOBAL.replicate_wild_do_table; + --echo # Cleanup. SET @@GLOBAL.replicate_wild_do_table = @save_replicate_wild_do_table; diff --git a/mysql-test/suite/sys_vars/t/replicate_wild_ignore_table_basic.test b/mysql-test/suite/sys_vars/t/replicate_wild_ignore_table_basic.test index 2900deab4d1..5cb1ff6c820 100644 --- a/mysql-test/suite/sys_vars/t/replicate_wild_ignore_table_basic.test +++ b/mysql-test/suite/sys_vars/t/replicate_wild_ignore_table_basic.test @@ -44,5 +44,8 @@ SELECT @@GLOBAL.replicate_wild_ignore_table; SET @@GLOBAL.replicate_wild_ignore_table=""; SELECT @@GLOBAL.replicate_wild_ignore_table; +SET @@GLOBAL.replicate_wild_ignore_table=null; +SELECT @@GLOBAL.replicate_wild_ignore_table; + --echo # Cleanup. SET @@GLOBAL.replicate_wild_ignore_table = @save_replicate_wild_ignore_table; diff --git a/mysql-test/suite/sys_vars/t/table_open_cache_instances_basic.test b/mysql-test/suite/sys_vars/t/table_open_cache_instances_basic.test deleted file mode 100644 index f7616c2c4e9..00000000000 --- a/mysql-test/suite/sys_vars/t/table_open_cache_instances_basic.test +++ /dev/null @@ -1 +0,0 @@ -select @@table_open_cache_instances; diff --git a/mysql-test/suite/sys_vars/t/wsrep_dirty_reads_basic.test b/mysql-test/suite/sys_vars/t/wsrep_dirty_reads_basic.test index a47524fcfe3..ffe767a051b 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_dirty_reads_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_dirty_reads_basic.test @@ -8,12 +8,12 @@ SET @wsrep_dirty_reads_session_saved = @@session.wsrep_dirty_reads; --echo # default ---error ER_INCORRECT_GLOBAL_LOCAL_VAR + SELECT @@global.wsrep_dirty_reads; SELECT @@session.wsrep_dirty_reads; --echo ---echo # scope and valid values +--echo # valid values for session SET @@session.wsrep_dirty_reads=OFF; SELECT @@session.wsrep_dirty_reads; SET @@session.wsrep_dirty_reads=ON; @@ -21,12 +21,25 @@ SELECT @@session.wsrep_dirty_reads; SET @@session.wsrep_dirty_reads=default; SELECT @@session.wsrep_dirty_reads; +--echo +--echo # valid values for global +SET @@global.wsrep_dirty_reads=OFF; +SELECT @@global.wsrep_dirty_reads; +SET @@global.wsrep_dirty_reads=ON; +SELECT @@global.wsrep_dirty_reads; +SET @@global.wsrep_dirty_reads=default; +SELECT @@global.wsrep_dirty_reads; + --echo --echo # invalid values --error ER_WRONG_VALUE_FOR_VAR SET @@session.wsrep_dirty_reads=NULL; --error ER_WRONG_VALUE_FOR_VAR SET @@session.wsrep_dirty_reads='junk'; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_dirty_reads=NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_dirty_reads='junk'; --echo --echo # restore the initial values diff --git a/mysql-test/suite/vcol/inc/vcol_keys.inc b/mysql-test/suite/vcol/inc/vcol_keys.inc index 6d859a4b0c3..4d4773ec3a6 100644 --- a/mysql-test/suite/vcol/inc/vcol_keys.inc +++ b/mysql-test/suite/vcol/inc/vcol_keys.inc @@ -23,22 +23,21 @@ --echo # - CHECK (allowed but not used) --echo # UNIQUE ---error ER_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN create table t1 (a int, b int as (a*2) unique); +drop table t1; create table t1 (a int, b int as (a*2) persistent unique); show create table t1; describe t1; drop table t1; ---error ER_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN create table t1 (a int, b int as (a*2), unique key (b)); +drop table t1; create table t1 (a int, b int as (a*2) persistent, unique (b)); show create table t1; describe t1; drop table t1; create table t1 (a int, b int as (a*2)); ---error ER_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN alter table t1 add unique key (b); drop table t1; create table t1 (a int, b int as (a*2) persistent); @@ -52,10 +51,10 @@ drop table t1; --echo # --echo # INDEX ---error ER_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN create table t1 (a int, b int as (a*2), index (b)); ---error ER_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN +drop table t1; create table t1 (a int, b int as (a*2), index (a,b)); +drop table t1; create table t1 (a int, b int as (a*2) persistent, index (b)); show create table t1; @@ -68,9 +67,7 @@ describe t1; drop table t1; create table t1 (a int, b int as (a*2)); ---error ER_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN alter table t1 add index (b); ---error ER_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN alter table t1 add index (a,b); drop table t1; @@ -106,33 +103,35 @@ if (!$skip_spatial_index_check) --echo # FOREIGN KEY --echo # Rejected FK options. ---error ER_WRONG_FK_OPTION_FOR_VIRTUAL_COLUMN +--error ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN create table t1 (a int, b int as (a+1) persistent, foreign key (b) references t2(a) on update set null); ---error ER_WRONG_FK_OPTION_FOR_VIRTUAL_COLUMN +--error ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN create table t1 (a int, b int as (a+1) persistent, foreign key (b) references t2(a) on update cascade); ---error ER_WRONG_FK_OPTION_FOR_VIRTUAL_COLUMN +--error ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN create table t1 (a int, b int as (a+1) persistent, foreign key (b) references t2(a) on delete set null); create table t1 (a int, b int as (a+1) persistent); ---error ER_WRONG_FK_OPTION_FOR_VIRTUAL_COLUMN +--error ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN alter table t1 add foreign key (b) references t2(a) on update set null; ---error ER_WRONG_FK_OPTION_FOR_VIRTUAL_COLUMN +--error ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN alter table t1 add foreign key (b) references t2(a) on update cascade; ---error ER_WRONG_FK_OPTION_FOR_VIRTUAL_COLUMN +--error ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN alter table t1 add foreign key (b) references t2(a) on delete set null; drop table t1; ---error ER_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN -create table t1 (a int, b int as (a+1), - foreign key (b) references t2(a)); +if ($with_foreign_keys) { +--error ER_CANT_CREATE_TABLE +create table t1 (a int, b int as (a+1), foreign key (b) references t2(a)); create table t1 (a int, b int as (a+1)); ---error ER_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN +--replace_regex /`#sql-.*`/`#sql-temporary`/ +--error ER_CANT_CREATE_TABLE alter table t1 add foreign key (b) references t2(a); drop table t1; +} --echo # Allowed FK options. create table t2 (a int primary key, b char(5)); @@ -158,6 +157,27 @@ drop table t1; --echo # - vcol_ins_upd.inc --echo # - vcol_select.inc ---echo # ---echo # TODO: CHECK +# +# Restrictions when indexed: +# +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b timestamp as (now()), key (b)); +create table t1 (a int, b timestamp as (now())); +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +alter table t1 add index (b); +drop table t1; + +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b varchar(100) as (user()), key (b)); +create table t1 (a int, b varchar(100) as (user())); +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +alter table t1 add index (b); +drop table t1; + +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b double as (rand()), key (b)); +create table t1 (a int, b double as (rand())); +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +alter table t1 add index (b); +drop table t1; diff --git a/mysql-test/suite/vcol/inc/vcol_non_stored_columns.inc b/mysql-test/suite/vcol/inc/vcol_non_stored_columns.inc index 5074d672ec4..771053fad7e 100644 --- a/mysql-test/suite/vcol/inc/vcol_non_stored_columns.inc +++ b/mysql-test/suite/vcol/inc/vcol_non_stored_columns.inc @@ -71,14 +71,14 @@ drop table t1; --echo # Case 7. ALTER. Modify virtual stored -> virtual non-stored create table t1 (a int, b int as (a % 2) persistent); ---error ER_UNSUPPORTED_ACTION_ON_VIRTUAL_COLUMN +--error ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN alter table t1 modify b int as (a % 2); show create table t1; drop table t1; --echo # Case 8. ALTER. Modify virtual non-stored -> virtual stored create table t1 (a int, b int as (a % 2)); ---error ER_UNSUPPORTED_ACTION_ON_VIRTUAL_COLUMN +--error ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN alter table t1 modify b int as (a % 2) persistent; show create table t1; drop table t1; diff --git a/mysql-test/suite/vcol/inc/vcol_partition.inc b/mysql-test/suite/vcol/inc/vcol_partition.inc index b2c0c90ff69..8a667b6e149 100644 --- a/mysql-test/suite/vcol/inc/vcol_partition.inc +++ b/mysql-test/suite/vcol/inc/vcol_partition.inc @@ -126,3 +126,14 @@ select * from t1; select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1'; drop table t1; + +# +# Restrictions when partitioned +# + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +create table t1 (a int, b datetime as (now())) partition by hash(b+1) partitions 3; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +create table t1 (a int, b varchar(100) as (user())) partition by hash(b+1) partitions 3; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +create table t1 (a int, b double as (rand())) partition by hash(b+1) partitions 3; diff --git a/mysql-test/suite/vcol/inc/vcol_unsupported_storage_engines.inc b/mysql-test/suite/vcol/inc/vcol_unsupported_storage_engines.inc index 4ec98ebf3f4..f012ccf135d 100644 --- a/mysql-test/suite/vcol/inc/vcol_unsupported_storage_engines.inc +++ b/mysql-test/suite/vcol/inc/vcol_unsupported_storage_engines.inc @@ -13,9 +13,9 @@ # Change: Syntax changed ################################################################################ ---error ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS +--error ER_UNSUPPORTED_ENGINE_FOR_GENERATED_COLUMNS create table t1 (a int, b int as (a+1)); create table t1 (a int not null); ---error ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS +--error ER_UNSUPPORTED_ENGINE_FOR_GENERATED_COLUMNS alter table t1 add column b int as (a+1); drop table t1; diff --git a/mysql-test/suite/vcol/r/delayed.result b/mysql-test/suite/vcol/r/delayed.result new file mode 100644 index 00000000000..ba3ac5c1c65 --- /dev/null +++ b/mysql-test/suite/vcol/r/delayed.result @@ -0,0 +1,7 @@ +create table t (a int primary key, b int, c int as (b), index (c)); +insert t (a,b) values (10,1); +replace delayed t (a,b) values (10,5); +check table t; +Table Op Msg_type Msg_text +test.t check status OK +drop table t; diff --git a/mysql-test/suite/vcol/r/innodb_autoinc_vcol.result b/mysql-test/suite/vcol/r/innodb_autoinc_vcol.result index f2d6b4105ff..d980c26dfb1 100644 --- a/mysql-test/suite/vcol/r/innodb_autoinc_vcol.result +++ b/mysql-test/suite/vcol/r/innodb_autoinc_vcol.result @@ -1,15 +1,15 @@ -create table t1 (c2 int as (-c1), c1 int primary key auto_increment) engine=innodb; +create table t1 (c2 int as (1+1), c1 int primary key auto_increment) engine=innodb; insert into t1(c1) values (null),(null),(null); select * from t1; c2 c1 --1 1 --2 2 --3 3 +2 1 +2 2 +2 3 alter table t1 auto_increment = 3; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c2` int(11) AS (-c1) VIRTUAL, + `c2` int(11) GENERATED ALWAYS AS (1 + 1) VIRTUAL, `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 diff --git a/mysql-test/suite/vcol/r/mrr.result b/mysql-test/suite/vcol/r/mrr.result new file mode 100644 index 00000000000..39337f32963 --- /dev/null +++ b/mysql-test/suite/vcol/r/mrr.result @@ -0,0 +1,25 @@ +CREATE TABLE t1 ( +pk INT AUTO_INCREMENT PRIMARY KEY, +col_int_nokey INT NULL, +col_int_key INT AS (col_int_nokey) VIRTUAL, +KEY (col_int_key) +); +INSERT INTO t1 (col_int_nokey) +VALUES (0), (5), (4), (3), (7), (42), (5), (0), (3); +SELECT * FROM t1 WHERE col_int_key IN (3, 4) AND col_int_key <= 83 ORDER BY 1; +pk col_int_nokey col_int_key +3 4 4 +4 3 3 +9 3 3 +set optimizer_switch='index_condition_pushdown=off'; +SELECT * FROM t1 WHERE col_int_key IN (3, 4) ORDER BY 1; +pk col_int_nokey col_int_key +3 4 4 +4 3 3 +9 3 3 +SELECT * FROM t1 WHERE col_int_key IN (3, 4) AND col_int_key <= 83 ORDER BY 1; +pk col_int_nokey col_int_key +3 4 4 +4 3 3 +9 3 3 +DROP TABLE t1; diff --git a/mysql-test/suite/vcol/r/partition.result b/mysql-test/suite/vcol/r/partition.result new file mode 100644 index 00000000000..349deed653d --- /dev/null +++ b/mysql-test/suite/vcol/r/partition.result @@ -0,0 +1,20 @@ +CREATE TABLE t1 ( +id INT NOT NULL, +store_id INT NOT NULL, +x INT GENERATED ALWAYS AS (id + store_id) +) +PARTITION BY RANGE (store_id) ( +PARTITION p0 VALUES LESS THAN (6), +PARTITION p1 VALUES LESS THAN (11), +PARTITION p2 VALUES LESS THAN (16), +PARTITION p3 VALUES LESS THAN (21) +); +INSERT t1 (id, store_id) VALUES(1, 2), (3, 4), (3, 12), (4, 18); +CREATE INDEX idx ON t1(x); +SELECT x FROM t1; +x +3 +7 +15 +22 +DROP TABLE t1; diff --git a/mysql-test/suite/vcol/r/range.result b/mysql-test/suite/vcol/r/range.result new file mode 100644 index 00000000000..ad7a39bc11c --- /dev/null +++ b/mysql-test/suite/vcol/r/range.result @@ -0,0 +1,9 @@ +create table t1 (pk int, i int, v int as (i*2) virtual, primary key (pk), key (v)) engine=myisam; +insert into t1 (pk,i) values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8); +create table t2 (a int, b int) engine=myisam; +insert into t2 values (1,2),(2,4); +select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk ); +pk i v a b +1 1 0 1 2 +2 2 0 2 4 +drop table t1, t2; diff --git a/mysql-test/suite/vcol/r/rpl_vcol.result b/mysql-test/suite/vcol/r/rpl_vcol.result index a20719ad813..b3f764da22c 100644 --- a/mysql-test/suite/vcol/r/rpl_vcol.result +++ b/mysql-test/suite/vcol/r/rpl_vcol.result @@ -7,7 +7,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a+1) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (2,default); diff --git a/mysql-test/suite/vcol/r/update.result b/mysql-test/suite/vcol/r/update.result new file mode 100644 index 00000000000..1dd80ae92b4 --- /dev/null +++ b/mysql-test/suite/vcol/r/update.result @@ -0,0 +1,156 @@ +create table t1 (a int, b int as (a+1), c int as (b+1) stored); +insert t1 set a=1; +select * from t1; +a b c +1 2 3 +update t1 set a=2; +select * from t1; +a b c +2 3 4 +drop table t1; +create table t1 (a int, c int as(a), p varchar(20) as(y), y char(20), index (p,c)); +insert into t1 (a,y) values(1, "yyy"); +update t1 set a = 100 where a = 1; +drop table t1; +create table t1 ( +a varchar(10000), +b varchar(3000), +c varchar(14000) generated always as (concat(a,b)) virtual, +d varchar(5000) generated always as (b) virtual, +e int(11) generated always as (10) virtual, +h int(11) not null primary key, +index(c(100), d(20))); +insert t1 (a,b,h) values (repeat('g', 10000), repeat('x', 2800), 1); +update t1 set a = repeat(cast(1 as char), 2000); +drop table t1; +create table t1 ( +a varchar(10000), +b varchar(3000), +c varchar(14000) generated always as (concat(a,b)) virtual, +i varchar(5000) generated always as (b) virtual, +d varchar(5000) generated always as (i) virtual, +e int(11) generated always as (10) virtual, +h int(11) not null primary key, +index(c(100), d(20))); +insert t1 (a,b,h) values (repeat('g', 10000), repeat('x', 2800), 1); +update t1 set a = repeat(cast(1 as char), 2000); +drop table t1; +create table t1(a blob not null, b int, c varbinary (10) generated always as (a) virtual, unique (c(9))); +insert t1 (a,b) values ('a', 1); +replace t1 set a = 'a',b =1; +insert t1 (a,b) values ('a', 1) on duplicate key update a='b', b=2; +select * from t1; +a b c +b 2 b +drop table t1; +create table t (a int primary key, b int, c int as (b), index (c)); +insert t (a,b) values (9,0); +create table t2 select * from t; +update t, t2 set t.b=10 where t.a=t2.a; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +select * from t; +a b c +9 10 10 +drop table t, t2; +create table t1 (a int, b int, c int, d int, e int); +insert t1 values (1,2,3,4,5), (1,2,3,4,5); +create table t (a int primary key, +b int, c blob as (b), index (c(57)), +d blob, e blob as (d), index (e(57))) +replace select * from t1; +Warnings: +Warning 1906 The value specified for generated column 'c' in table 't' ignored +Warning 1906 The value specified for generated column 'e' in table 't' ignored +Warning 1906 The value specified for generated column 'c' in table 't' ignored +Warning 1906 The value specified for generated column 'e' in table 't' ignored +check table t; +Table Op Msg_type Msg_text +test.t check status OK +select * from t; +a b c d e +1 2 2 4 4 +update t set a=10, b=1, d=1; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +select * from t; +a b c d e +10 1 1 1 1 +replace t (a,b,d) values (10,2,2); +check table t; +Table Op Msg_type Msg_text +test.t check status OK +select * from t; +a b c d e +10 2 2 2 2 +insert t(a,b,d) values (10) on duplicate key update b=3; +ERROR 21S01: Column count doesn't match value count at row 1 +insert t(a,b,d) values (10,2,2) on duplicate key update b=3, d=3; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +select * from t; +a b c d e +10 3 3 3 3 +replace t (a,b,d) select 10,4,4; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +select * from t; +a b c d e +10 4 4 4 4 +insert t(a,b,d) select 10,4,4 on duplicate key update b=5, d=5; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +select * from t; +a b c d e +10 5 5 5 5 +replace delayed t (a,b,d) values (10,6,6); +flush tables; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +select * from t; +a b c d e +10 6 6 6 6 +insert delayed t(a,b,d) values (10,6,6) on duplicate key update b=7, d=7; +flush tables; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +select * from t; +a b c d e +10 7 7 7 7 +load data infile 'MYSQLTEST_VARDIR/tmp/vblobs.txt' replace into table t; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +select * from t; +a b c d e +10 8 8 8 8 +update t set a=11, b=9, d=9 where a>5; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +select * from t; +a b c d e +11 9 9 9 9 +create table t2 select * from t; +update t, t2 set t.b=10, t.d=10 where t.a=t2.a; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +select * from t; +a b c d e +11 10 10 10 10 +update t, t tt set t.b=11, tt.d=11 where t.a=tt.a; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +select * from t; +a b c d e +11 11 11 11 11 +drop table t, t1, t2; diff --git a/mysql-test/suite/vcol/r/vcol_archive.result b/mysql-test/suite/vcol/r/vcol_archive.result index 5ed2f3768ca..ec743088ec2 100644 --- a/mysql-test/suite/vcol/r/vcol_archive.result +++ b/mysql-test/suite/vcol/r/vcol_archive.result @@ -1,7 +1,7 @@ SET @@session.storage_engine = 'archive'; create table t1 (a int, b int as (a+1)); -ERROR HY000: ARCHIVE storage engine does not support computed columns +ERROR HY000: ARCHIVE storage engine does not support generated columns create table t1 (a int not null); alter table t1 add column b int as (a+1); -ERROR HY000: ARCHIVE storage engine does not support computed columns +ERROR HY000: ARCHIVE storage engine does not support generated columns drop table t1; diff --git a/mysql-test/suite/vcol/r/vcol_blackhole.result b/mysql-test/suite/vcol/r/vcol_blackhole.result index 2d33937a2f1..52d40e9a2b8 100644 --- a/mysql-test/suite/vcol/r/vcol_blackhole.result +++ b/mysql-test/suite/vcol/r/vcol_blackhole.result @@ -1,7 +1,7 @@ SET @@session.storage_engine = 'blackhole'; create table t1 (a int, b int as (a+1)); -ERROR HY000: BLACKHOLE storage engine does not support computed columns +ERROR HY000: BLACKHOLE storage engine does not support generated columns create table t1 (a int not null); alter table t1 add column b int as (a+1); -ERROR HY000: BLACKHOLE storage engine does not support computed columns +ERROR HY000: BLACKHOLE storage engine does not support generated columns drop table t1; diff --git a/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs.result b/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs.result index 0e03d80014d..6605f7c99b4 100644 --- a/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs.result +++ b/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs.result @@ -21,25 +21,25 @@ create or replace table t1 (a datetime as (current_time()) PERSISTENT); ERROR HY000: Function or expression 'curtime()' cannot be used in the GENERATED ALWAYS AS clause of `a` # CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP create or replace table t1 (a datetime as (current_timestamp()) PERSISTENT); -ERROR HY000: Function or expression 'now()' cannot be used in the GENERATED ALWAYS AS clause of `a` +ERROR HY000: Function or expression 'current_timestamp()' cannot be used in the GENERATED ALWAYS AS clause of `a` create or replace table t1 (a datetime as (current_timestamp) PERSISTENT); -ERROR HY000: Function or expression 'now()' cannot be used in the GENERATED ALWAYS AS clause of `a` +ERROR HY000: Function or expression 'current_timestamp()' cannot be used in the GENERATED ALWAYS AS clause of `a` # CURTIME() create or replace table t1 (a datetime as (curtime()) PERSISTENT); ERROR HY000: Function or expression 'curtime()' cannot be used in the GENERATED ALWAYS AS clause of `a` # LOCALTIME(), LOCALTIME create or replace table t1 (a datetime, b varchar(10) as (localtime()) PERSISTENT); -ERROR HY000: Function or expression 'now()' cannot be used in the GENERATED ALWAYS AS clause of `b` +ERROR HY000: Function or expression 'current_timestamp()' cannot be used in the GENERATED ALWAYS AS clause of `b` create or replace table t1 (a datetime, b varchar(10) as (localtime) PERSISTENT); -ERROR HY000: Function or expression 'now()' cannot be used in the GENERATED ALWAYS AS clause of `b` +ERROR HY000: Function or expression 'current_timestamp()' cannot be used in the GENERATED ALWAYS AS clause of `b` # LOCALTIMESTAMP, LOCALTIMESTAMP()(v4.0.6) create or replace table t1 (a datetime, b varchar(10) as (localtimestamp()) PERSISTENT); -ERROR HY000: Function or expression 'now()' cannot be used in the GENERATED ALWAYS AS clause of `b` +ERROR HY000: Function or expression 'current_timestamp()' cannot be used in the GENERATED ALWAYS AS clause of `b` create or replace table t1 (a datetime, b varchar(10) as (localtimestamp) PERSISTENT); -ERROR HY000: Function or expression 'now()' cannot be used in the GENERATED ALWAYS AS clause of `b` +ERROR HY000: Function or expression 'current_timestamp()' cannot be used in the GENERATED ALWAYS AS clause of `b` # NOW() create or replace table t1 (a datetime, b varchar(10) as (now()) PERSISTENT); -ERROR HY000: Function or expression 'now()' cannot be used in the GENERATED ALWAYS AS clause of `b` +ERROR HY000: Function or expression 'current_timestamp()' cannot be used in the GENERATED ALWAYS AS clause of `b` # SYSDATE() create or replace table t1 (a int, b varchar(10) as (sysdate()) PERSISTENT); ERROR HY000: Function or expression 'sysdate()' cannot be used in the GENERATED ALWAYS AS clause of `b` @@ -57,7 +57,7 @@ create or replace table t1 (a datetime, b datetime as (utc_timestamp()) PERSISTE ERROR HY000: Function or expression 'utc_timestamp()' cannot be used in the GENERATED ALWAYS AS clause of `b` # WEEK() - one argument version create or replace table t1 (a datetime, b datetime as (week(a)) PERSISTENT); -ERROR HY000: Function or expression '@@default_week_format' cannot be used in the GENERATED ALWAYS AS clause of `b` +ERROR HY000: Function or expression 'week()' cannot be used in the GENERATED ALWAYS AS clause of `b` # MATCH() create or replace table t1 (a varchar(32), b bool as (match a against ('sample text')) PERSISTENT); ERROR HY000: Function or expression 'match ... against()' cannot be used in the GENERATED ALWAYS AS clause of `b` @@ -242,7 +242,7 @@ drop function sub1; create or replace table t1 (a int, b varchar(300) as (concat(a,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'))); drop table t1; create or replace table t1 (a int, b varchar(16384) as (concat(a,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'))); -ERROR HY000: Table definition is too large +ERROR HY000: Expression in the GENERATED ALWAYS AS clause is too big # # Constant expression create or replace table t1 (a int as (PI()) PERSISTENT); diff --git a/mysql-test/suite/vcol/r/vcol_column_def_options_innodb.result b/mysql-test/suite/vcol/r/vcol_column_def_options_innodb.result index e66c2d3a3c3..8bfb8f0429c 100644 --- a/mysql-test/suite/vcol/r/vcol_column_def_options_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_column_def_options_innodb.result @@ -54,12 +54,12 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL COMMENT 'my comment' + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL COMMENT 'my comment' ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra a int(11) YES NULL -b int(11) YES NULL VIRTUAL +b int(11) YES NULL VIRTUAL GENERATED drop table t1; create table t1 (a int, b int as (a % 2)); alter table t1 modify b int as (a % 2) comment 'my comment'; @@ -67,12 +67,12 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL COMMENT 'my comment' + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL COMMENT 'my comment' ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra a int(11) YES NULL -b int(11) YES NULL VIRTUAL +b int(11) YES NULL VIRTUAL GENERATED insert into t1 (a) values (1); select * from t1; a b @@ -87,12 +87,12 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL COMMENT 'my comment' + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL COMMENT 'my comment' ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t2; Field Type Null Key Default Extra a int(11) YES NULL -b int(11) YES NULL VIRTUAL +b int(11) YES NULL VIRTUAL GENERATED insert into t2 (a) values (1); select * from t2; a b @@ -109,12 +109,12 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) PERSISTENT + `b` int(11) GENERATED ALWAYS AS (`a` % 2) STORED ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra a int(11) YES NULL -b int(11) YES NULL PERSISTENT +b int(11) YES NULL STORED GENERATED insert into t1 (a) values (1); select * from t1; a b @@ -131,7 +131,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) PERSISTENT + `b` int(11) GENERATED ALWAYS AS (`a` % 2) STORED ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; create table t1 (a int, b int as (a % 2)); @@ -141,6 +141,6 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; diff --git a/mysql-test/suite/vcol/r/vcol_column_def_options_myisam.result b/mysql-test/suite/vcol/r/vcol_column_def_options_myisam.result index d60a3cf1a51..96eb2bdc02f 100644 --- a/mysql-test/suite/vcol/r/vcol_column_def_options_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_column_def_options_myisam.result @@ -54,12 +54,12 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL COMMENT 'my comment' + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL COMMENT 'my comment' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra a int(11) YES NULL -b int(11) YES NULL VIRTUAL +b int(11) YES NULL VIRTUAL GENERATED drop table t1; create table t1 (a int, b int as (a % 2)); alter table t1 modify b int as (a % 2) comment 'my comment'; @@ -67,12 +67,12 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL COMMENT 'my comment' + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL COMMENT 'my comment' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra a int(11) YES NULL -b int(11) YES NULL VIRTUAL +b int(11) YES NULL VIRTUAL GENERATED insert into t1 (a) values (1); select * from t1; a b @@ -87,12 +87,12 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL COMMENT 'my comment' + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL COMMENT 'my comment' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t2; Field Type Null Key Default Extra a int(11) YES NULL -b int(11) YES NULL VIRTUAL +b int(11) YES NULL VIRTUAL GENERATED insert into t2 (a) values (1); select * from t2; a b @@ -109,12 +109,12 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) PERSISTENT + `b` int(11) GENERATED ALWAYS AS (`a` % 2) STORED ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra a int(11) YES NULL -b int(11) YES NULL PERSISTENT +b int(11) YES NULL STORED GENERATED insert into t1 (a) values (1); select * from t1; a b @@ -131,7 +131,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) PERSISTENT + `b` int(11) GENERATED ALWAYS AS (`a` % 2) STORED ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a int, b int as (a % 2)); @@ -141,6 +141,6 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; diff --git a/mysql-test/suite/vcol/r/vcol_csv.result b/mysql-test/suite/vcol/r/vcol_csv.result index 920e614c0b1..9a0a76576f6 100644 --- a/mysql-test/suite/vcol/r/vcol_csv.result +++ b/mysql-test/suite/vcol/r/vcol_csv.result @@ -1,7 +1,7 @@ SET @@session.storage_engine = 'CSV'; create table t1 (a int, b int as (a+1)); -ERROR HY000: CSV storage engine does not support computed columns +ERROR HY000: CSV storage engine does not support generated columns create table t1 (a int not null); alter table t1 add column b int as (a+1); -ERROR HY000: CSV storage engine does not support computed columns +ERROR HY000: CSV storage engine does not support generated columns drop table t1; diff --git a/mysql-test/suite/vcol/r/vcol_handler_maria.result b/mysql-test/suite/vcol/r/vcol_handler_aria.result similarity index 100% rename from mysql-test/suite/vcol/r/vcol_handler_maria.result rename to mysql-test/suite/vcol/r/vcol_handler_aria.result diff --git a/mysql-test/suite/vcol/r/vcol_ins_upd_innodb.result b/mysql-test/suite/vcol/r/vcol_ins_upd_innodb.result index af03cc4d482..d6793e22668 100644 --- a/mysql-test/suite/vcol/r/vcol_ins_upd_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_ins_upd_innodb.result @@ -25,8 +25,8 @@ a b c # INSERT INTO tbl_name VALUES... a non-NULL value is specified against vcols insert into t1 values (1,2,3); Warnings: -Warning 1906 The value specified for computed column 'b' in table 't1' ignored -Warning 1906 The value specified for computed column 'c' in table 't1' ignored +Warning 1906 The value specified for generated column 'b' in table 't1' ignored +Warning 1906 The value specified for generated column 'c' in table 't1' ignored select * from t1; a b c 1 -1 -1 @@ -65,8 +65,8 @@ a b c # against vcols insert into t1 (a,b) values (1,3), (2,4); Warnings: -Warning 1906 The value specified for computed column 'b' in table 't1' ignored -Warning 1906 The value specified for computed column 'b' in table 't1' ignored +Warning 1906 The value specified for generated column 'b' in table 't1' ignored +Warning 1906 The value specified for generated column 'b' in table 't1' ignored select * from t1; a b c 1 -1 -1 @@ -107,8 +107,8 @@ a b c create table t2 like t1; insert into t2 select * from t1; Warnings: -Warning 1906 The value specified for computed column 'b' in table 't2' ignored -Warning 1906 The value specified for computed column 'c' in table 't2' ignored +Warning 1906 The value specified for generated column 'b' in table 't2' ignored +Warning 1906 The value specified for generated column 'c' in table 't2' ignored select * from t1; a b c 2 -2 -2 @@ -123,8 +123,8 @@ a b c create table t2 like t1; insert into t2 (a,b) select a,b from t1; Warnings: -Warning 1906 The value specified for computed column 'b' in table 't2' ignored -Warning 1906 The value specified for computed column 'b' in table 't2' ignored +Warning 1906 The value specified for generated column 'b' in table 't2' ignored +Warning 1906 The value specified for generated column 'b' in table 't2' ignored select * from t2; a b c 2 -2 -2 @@ -159,7 +159,7 @@ a b c 2 -2 -2 update t1 set c=3 where a=2; Warnings: -Warning 1906 The value specified for computed column 'c' in table 't1' ignored +Warning 1906 The value specified for generated column 'c' in table 't1' ignored select * from t1; a b c 1 -1 -1 @@ -189,7 +189,7 @@ a b c 2 -2 -2 update t1 set c=3 where b=-2; Warnings: -Warning 1906 The value specified for computed column 'c' in table 't1' ignored +Warning 1906 The value specified for generated column 'c' in table 't1' ignored select * from t1; a b c 1 -1 -1 diff --git a/mysql-test/suite/vcol/r/vcol_ins_upd_myisam.result b/mysql-test/suite/vcol/r/vcol_ins_upd_myisam.result index 351dfd2858c..97f6b9be563 100644 --- a/mysql-test/suite/vcol/r/vcol_ins_upd_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_ins_upd_myisam.result @@ -25,8 +25,8 @@ a b c # INSERT INTO tbl_name VALUES... a non-NULL value is specified against vcols insert into t1 values (1,2,3); Warnings: -Warning 1906 The value specified for computed column 'b' in table 't1' ignored -Warning 1906 The value specified for computed column 'c' in table 't1' ignored +Warning 1906 The value specified for generated column 'b' in table 't1' ignored +Warning 1906 The value specified for generated column 'c' in table 't1' ignored select * from t1; a b c 1 -1 -1 @@ -65,8 +65,8 @@ a b c # against vcols insert into t1 (a,b) values (1,3), (2,4); Warnings: -Warning 1906 The value specified for computed column 'b' in table 't1' ignored -Warning 1906 The value specified for computed column 'b' in table 't1' ignored +Warning 1906 The value specified for generated column 'b' in table 't1' ignored +Warning 1906 The value specified for generated column 'b' in table 't1' ignored select * from t1; a b c 1 -1 -1 @@ -107,8 +107,8 @@ a b c create table t2 like t1; insert into t2 select * from t1; Warnings: -Warning 1906 The value specified for computed column 'b' in table 't2' ignored -Warning 1906 The value specified for computed column 'c' in table 't2' ignored +Warning 1906 The value specified for generated column 'b' in table 't2' ignored +Warning 1906 The value specified for generated column 'c' in table 't2' ignored select * from t1; a b c 2 -2 -2 @@ -123,8 +123,8 @@ a b c create table t2 like t1; insert into t2 (a,b) select a,b from t1; Warnings: -Warning 1906 The value specified for computed column 'b' in table 't2' ignored -Warning 1906 The value specified for computed column 'b' in table 't2' ignored +Warning 1906 The value specified for generated column 'b' in table 't2' ignored +Warning 1906 The value specified for generated column 'b' in table 't2' ignored select * from t2; a b c 2 -2 -2 @@ -159,7 +159,7 @@ a b c 2 -2 -2 update t1 set c=3 where a=2; Warnings: -Warning 1906 The value specified for computed column 'c' in table 't1' ignored +Warning 1906 The value specified for generated column 'c' in table 't1' ignored select * from t1; a b c 1 -1 -1 @@ -189,7 +189,7 @@ a b c 2 -2 -2 update t1 set c=3 where b=-2; Warnings: -Warning 1906 The value specified for computed column 'c' in table 't1' ignored +Warning 1906 The value specified for generated column 'c' in table 't1' ignored select * from t1; a b c 1 -1 -1 diff --git a/mysql-test/suite/vcol/r/vcol_keys_aria.result b/mysql-test/suite/vcol/r/vcol_keys_aria.result new file mode 100644 index 00000000000..ef8cb3c7b30 --- /dev/null +++ b/mysql-test/suite/vcol/r/vcol_keys_aria.result @@ -0,0 +1,2 @@ +create table t1 (a int, b int as (a+1), c int, index(b)) engine=aria; +ERROR HY000: Key/Index cannot be defined on a virtual generated column diff --git a/mysql-test/suite/vcol/r/vcol_keys_innodb.result b/mysql-test/suite/vcol/r/vcol_keys_innodb.result index 5070981f08f..43c911118c2 100644 --- a/mysql-test/suite/vcol/r/vcol_keys_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_keys_innodb.result @@ -7,38 +7,37 @@ SET @@session.storage_engine = 'InnoDB'; # - CHECK (allowed but not used) # UNIQUE create table t1 (a int, b int as (a*2) unique); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column +drop table t1; create table t1 (a int, b int as (a*2) persistent unique); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, UNIQUE KEY `b` (`b`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra a int(11) YES NULL -b int(11) YES UNI NULL PERSISTENT +b int(11) YES UNI NULL STORED GENERATED drop table t1; create table t1 (a int, b int as (a*2), unique key (b)); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column +drop table t1; create table t1 (a int, b int as (a*2) persistent, unique (b)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, UNIQUE KEY `b` (`b`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra a int(11) YES NULL -b int(11) YES UNI NULL PERSISTENT +b int(11) YES UNI NULL STORED GENERATED drop table t1; create table t1 (a int, b int as (a*2)); alter table t1 add unique key (b); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column drop table t1; create table t1 (a int, b int as (a*2) persistent); alter table t1 add unique key (b); @@ -50,40 +49,38 @@ drop table t1; # # INDEX create table t1 (a int, b int as (a*2), index (b)); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column +drop table t1; create table t1 (a int, b int as (a*2), index (a,b)); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column +drop table t1; create table t1 (a int, b int as (a*2) persistent, index (b)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, KEY `b` (`b`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra a int(11) YES NULL -b int(11) YES MUL NULL PERSISTENT +b int(11) YES MUL NULL STORED GENERATED drop table t1; create table t1 (a int, b int as (a*2) persistent, index (a,b)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, KEY `a` (`a`,`b`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra a int(11) YES MUL NULL -b int(11) YES NULL PERSISTENT +b int(11) YES NULL STORED GENERATED drop table t1; create table t1 (a int, b int as (a*2)); alter table t1 add index (b); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column alter table t1 add index (a,b); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column drop table t1; create table t1 (a int, b int as (a*2) persistent); alter table t1 add index (b); @@ -99,31 +96,37 @@ drop table t1; # # TODO: FULLTEXT INDEX # SPATIAL INDEX +# Error "All parts of a SPATIAL index must be NOT NULL" +create table t1 (a int, b geometry as (a+1) persistent, spatial index (b)); +ERROR 42000: All parts of a SPATIAL index must be NOT NULL +create table t1 (a int, b int as (a+1) persistent); +alter table t1 add spatial index (b); +ERROR HY000: Incorrect arguments to SPATIAL INDEX +drop table t1; # FOREIGN KEY # Rejected FK options. create table t1 (a int, b int as (a+1) persistent, foreign key (b) references t2(a) on update set null); -ERROR HY000: Cannot define foreign key with ON UPDATE SET NULL clause on a computed column +ERROR HY000: Cannot define foreign key with ON UPDATE SET NULL clause on a generated column create table t1 (a int, b int as (a+1) persistent, foreign key (b) references t2(a) on update cascade); -ERROR HY000: Cannot define foreign key with ON UPDATE CASCADE clause on a computed column +ERROR HY000: Cannot define foreign key with ON UPDATE CASCADE clause on a generated column create table t1 (a int, b int as (a+1) persistent, foreign key (b) references t2(a) on delete set null); -ERROR HY000: Cannot define foreign key with ON DELETE SET NULL clause on a computed column +ERROR HY000: Cannot define foreign key with ON DELETE SET NULL clause on a generated column create table t1 (a int, b int as (a+1) persistent); alter table t1 add foreign key (b) references t2(a) on update set null; -ERROR HY000: Cannot define foreign key with ON UPDATE SET NULL clause on a computed column +ERROR HY000: Cannot define foreign key with ON UPDATE SET NULL clause on a generated column alter table t1 add foreign key (b) references t2(a) on update cascade; -ERROR HY000: Cannot define foreign key with ON UPDATE CASCADE clause on a computed column +ERROR HY000: Cannot define foreign key with ON UPDATE CASCADE clause on a generated column alter table t1 add foreign key (b) references t2(a) on delete set null; -ERROR HY000: Cannot define foreign key with ON DELETE SET NULL clause on a computed column +ERROR HY000: Cannot define foreign key with ON DELETE SET NULL clause on a generated column drop table t1; -create table t1 (a int, b int as (a+1), -foreign key (b) references t2(a)); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column +create table t1 (a int, b int as (a+1), foreign key (b) references t2(a)); +ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") create table t1 (a int, b int as (a+1)); alter table t1 add foreign key (b) references t2(a); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column +ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed") drop table t1; # Allowed FK options. create table t2 (a int primary key, b char(5)); @@ -147,5 +150,21 @@ drop table t1; # on virtual columns can be found in: # - vcol_ins_upd.inc # - vcol_select.inc -# -# TODO: CHECK +create table t1 (a int, b timestamp as (now()), key (b)); +ERROR HY000: Function or expression 'current_timestamp()' cannot be used in the GENERATED ALWAYS AS clause of `b` +create table t1 (a int, b timestamp as (now())); +alter table t1 add index (b); +ERROR HY000: Function or expression 'current_timestamp()' cannot be used in the GENERATED ALWAYS AS clause of `b` +drop table t1; +create table t1 (a int, b varchar(100) as (user()), key (b)); +ERROR HY000: Function or expression 'user()' cannot be used in the GENERATED ALWAYS AS clause of `b` +create table t1 (a int, b varchar(100) as (user())); +alter table t1 add index (b); +ERROR HY000: Function or expression 'user()' cannot be used in the GENERATED ALWAYS AS clause of `b` +drop table t1; +create table t1 (a int, b double as (rand()), key (b)); +ERROR HY000: Function or expression 'rand()' cannot be used in the GENERATED ALWAYS AS clause of `b` +create table t1 (a int, b double as (rand())); +alter table t1 add index (b); +ERROR HY000: Function or expression 'rand()' cannot be used in the GENERATED ALWAYS AS clause of `b` +drop table t1; diff --git a/mysql-test/suite/vcol/r/vcol_keys_myisam.result b/mysql-test/suite/vcol/r/vcol_keys_myisam.result index dccdf7f73e5..efca19db5bb 100644 --- a/mysql-test/suite/vcol/r/vcol_keys_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_keys_myisam.result @@ -1,3 +1,119 @@ +create table t1 (a int, b int as (a+1), c int, index(b)); +insert t1 (a,c) values (0x7890abcd, 0x76543210); +insert t1 (a,c) select seq, sin(seq)*10000 from seq_1_to_1000; +explain select * from t1 where b=10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref b b 5 const 1 +select * from t1 where b=10; +a b c +9 10 4121 + +MyISAM file: datadir/test/t1 +Record format: Fixed length +Character set: latin1_swedish_ci (8) +Data records: 1001 Deleted blocks: 0 +Recordlength: 9 + +table description: +Key Start Len Index Type +1 10 4 multip. long NULL +update t1 set a=20 where b=10; +select * from t1 where b=10; +a b c +select * from t1 where b=21; +a b c +20 21 4121 +20 21 9129 +delete from t1 where b=21; +select * from t1 where b=21; +a b c +alter table t1 add column d char(20) as (concat(a,c)); +select * from t1 where b=11; +a b c d +10 11 -5440 10-5440 +create index i on t1 (d); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select * from t1 where b=11; +a b c d +10 11 -5440 10-5440 +check table t1 quick; +Table Op Msg_type Msg_text +test.t1 check status OK +select * from t1 where b=11; +a b c d +10 11 -5440 10-5440 +check table t1 medium; +Table Op Msg_type Msg_text +test.t1 check status OK +select * from t1 where b=11; +a b c d +10 11 -5440 10-5440 +check table t1 extended; +Table Op Msg_type Msg_text +test.t1 check status OK +show keys from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +t1 1 b 1 b A 999 NULL NULL YES BTREE +t1 1 i 1 d A 999 NULL NULL YES BTREE +select * from t1 where b=11; +a b c d +10 11 -5440 10-5440 +delete from t1 where b=12; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +show keys from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +t1 1 b 1 b A 998 NULL NULL YES BTREE +t1 1 i 1 d A 998 NULL NULL YES BTREE +select * from t1 where b=11; +a b c d +10 11 -5440 10-5440 +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +show keys from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +t1 1 b 1 b A 998 NULL NULL YES BTREE +t1 1 i 1 d A 998 NULL NULL YES BTREE +select * from t1 where b=11; +a b c d +10 11 -5440 10-5440 +repair table t1; +Table Op Msg_type Msg_text +test.t1 repair status OK +select * from t1 where b=11; +a b c d +10 11 -5440 10-5440 +repair table t1 quick; +Table Op Msg_type Msg_text +test.t1 repair status OK +select * from t1 where b=11; +a b c d +10 11 -5440 10-5440 +repair table t1 extended; +Table Op Msg_type Msg_text +test.t1 repair status OK +select * from t1 where b=11; +a b c d +10 11 -5440 10-5440 +repair table t1 use_frm; +Table Op Msg_type Msg_text +test.t1 repair warning Number of rows changed from 0 to 998 +test.t1 repair status OK +select * from t1 where b=11; +a b c d +10 11 -5440 10-5440 +update t1 set a=30 where b=11; +select * from t1 where b=11; +a b c d +select * from t1 where b=31; +a b c d +30 31 -5440 30-5440 +30 31 -9880 30-9880 +drop table t1; SET @@session.storage_engine = 'MyISAM'; # - UNIQUE KEY # - INDEX @@ -7,38 +123,37 @@ SET @@session.storage_engine = 'MyISAM'; # - CHECK (allowed but not used) # UNIQUE create table t1 (a int, b int as (a*2) unique); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column +drop table t1; create table t1 (a int, b int as (a*2) persistent unique); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, UNIQUE KEY `b` (`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra a int(11) YES NULL -b int(11) YES UNI NULL PERSISTENT +b int(11) YES UNI NULL STORED GENERATED drop table t1; create table t1 (a int, b int as (a*2), unique key (b)); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column +drop table t1; create table t1 (a int, b int as (a*2) persistent, unique (b)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, UNIQUE KEY `b` (`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra a int(11) YES NULL -b int(11) YES UNI NULL PERSISTENT +b int(11) YES UNI NULL STORED GENERATED drop table t1; create table t1 (a int, b int as (a*2)); alter table t1 add unique key (b); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column drop table t1; create table t1 (a int, b int as (a*2) persistent); alter table t1 add unique key (b); @@ -50,40 +165,38 @@ drop table t1; # # INDEX create table t1 (a int, b int as (a*2), index (b)); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column +drop table t1; create table t1 (a int, b int as (a*2), index (a,b)); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column +drop table t1; create table t1 (a int, b int as (a*2) persistent, index (b)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, KEY `b` (`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra a int(11) YES NULL -b int(11) YES MUL NULL PERSISTENT +b int(11) YES MUL NULL STORED GENERATED drop table t1; create table t1 (a int, b int as (a*2) persistent, index (a,b)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, KEY `a` (`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra a int(11) YES MUL NULL -b int(11) YES NULL PERSISTENT +b int(11) YES NULL STORED GENERATED drop table t1; create table t1 (a int, b int as (a*2)); alter table t1 add index (b); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column alter table t1 add index (a,b); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column drop table t1; create table t1 (a int, b int as (a*2) persistent); alter table t1 add index (b); @@ -110,27 +223,20 @@ drop table t1; # Rejected FK options. create table t1 (a int, b int as (a+1) persistent, foreign key (b) references t2(a) on update set null); -ERROR HY000: Cannot define foreign key with ON UPDATE SET NULL clause on a computed column +ERROR HY000: Cannot define foreign key with ON UPDATE SET NULL clause on a generated column create table t1 (a int, b int as (a+1) persistent, foreign key (b) references t2(a) on update cascade); -ERROR HY000: Cannot define foreign key with ON UPDATE CASCADE clause on a computed column +ERROR HY000: Cannot define foreign key with ON UPDATE CASCADE clause on a generated column create table t1 (a int, b int as (a+1) persistent, foreign key (b) references t2(a) on delete set null); -ERROR HY000: Cannot define foreign key with ON DELETE SET NULL clause on a computed column +ERROR HY000: Cannot define foreign key with ON DELETE SET NULL clause on a generated column create table t1 (a int, b int as (a+1) persistent); alter table t1 add foreign key (b) references t2(a) on update set null; -ERROR HY000: Cannot define foreign key with ON UPDATE SET NULL clause on a computed column +ERROR HY000: Cannot define foreign key with ON UPDATE SET NULL clause on a generated column alter table t1 add foreign key (b) references t2(a) on update cascade; -ERROR HY000: Cannot define foreign key with ON UPDATE CASCADE clause on a computed column +ERROR HY000: Cannot define foreign key with ON UPDATE CASCADE clause on a generated column alter table t1 add foreign key (b) references t2(a) on delete set null; -ERROR HY000: Cannot define foreign key with ON DELETE SET NULL clause on a computed column -drop table t1; -create table t1 (a int, b int as (a+1), -foreign key (b) references t2(a)); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column -create table t1 (a int, b int as (a+1)); -alter table t1 add foreign key (b) references t2(a); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column +ERROR HY000: Cannot define foreign key with ON DELETE SET NULL clause on a generated column drop table t1; # Allowed FK options. create table t2 (a int primary key, b char(5)); @@ -154,5 +260,21 @@ drop table t1; # on virtual columns can be found in: # - vcol_ins_upd.inc # - vcol_select.inc -# -# TODO: CHECK +create table t1 (a int, b timestamp as (now()), key (b)); +ERROR HY000: Function or expression 'current_timestamp()' cannot be used in the GENERATED ALWAYS AS clause of `b` +create table t1 (a int, b timestamp as (now())); +alter table t1 add index (b); +ERROR HY000: Function or expression 'current_timestamp()' cannot be used in the GENERATED ALWAYS AS clause of `b` +drop table t1; +create table t1 (a int, b varchar(100) as (user()), key (b)); +ERROR HY000: Function or expression 'user()' cannot be used in the GENERATED ALWAYS AS clause of `b` +create table t1 (a int, b varchar(100) as (user())); +alter table t1 add index (b); +ERROR HY000: Function or expression 'user()' cannot be used in the GENERATED ALWAYS AS clause of `b` +drop table t1; +create table t1 (a int, b double as (rand()), key (b)); +ERROR HY000: Function or expression 'rand()' cannot be used in the GENERATED ALWAYS AS clause of `b` +create table t1 (a int, b double as (rand())); +alter table t1 add index (b); +ERROR HY000: Function or expression 'rand()' cannot be used in the GENERATED ALWAYS AS clause of `b` +drop table t1; diff --git a/mysql-test/suite/vcol/r/vcol_memory.result b/mysql-test/suite/vcol/r/vcol_memory.result index 4503c51e39a..1324be82101 100644 --- a/mysql-test/suite/vcol/r/vcol_memory.result +++ b/mysql-test/suite/vcol/r/vcol_memory.result @@ -1,7 +1,7 @@ SET @@session.storage_engine = 'memory'; create table t1 (a int, b int as (a+1)); -ERROR HY000: MEMORY storage engine does not support computed columns +ERROR HY000: MEMORY storage engine does not support generated columns create table t1 (a int not null); alter table t1 add column b int as (a+1); -ERROR HY000: MEMORY storage engine does not support computed columns +ERROR HY000: MEMORY storage engine does not support generated columns drop table t1; diff --git a/mysql-test/suite/vcol/r/vcol_merge.result b/mysql-test/suite/vcol/r/vcol_merge.result index e127ec35e8c..2629c65f688 100644 --- a/mysql-test/suite/vcol/r/vcol_merge.result +++ b/mysql-test/suite/vcol/r/vcol_merge.result @@ -4,5 +4,5 @@ create table t2 (a int, b int as (a % 10)); insert into t1 values (1,default); insert into t2 values (2,default); create table t3 (a int, b int as (a % 10)) engine=MERGE UNION=(t1,t2); -ERROR HY000: MRG_MyISAM storage engine does not support computed columns +ERROR HY000: MRG_MyISAM storage engine does not support generated columns drop table t1,t2; diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result index d4a583c34b2..a917159249b 100644 --- a/mysql-test/suite/vcol/r/vcol_misc.result +++ b/mysql-test/suite/vcol/r/vcol_misc.result @@ -108,10 +108,10 @@ DROP TABLE t1,t2; CREATE TABLE t1 (p int, a double NOT NULL, v double AS (ROUND(a,p)) VIRTUAL); INSERT INTO t1 VALUES (0,1,0); Warnings: -Warning 1906 The value specified for computed column 'v' in table 't1' ignored +Warning 1906 The value specified for generated column 'v' in table 't1' ignored INSERT INTO t1 VALUES (NULL,0,0); Warnings: -Warning 1906 The value specified for computed column 'v' in table 't1' ignored +Warning 1906 The value specified for generated column 'v' in table 't1' ignored SELECT a, p, v, ROUND(a,p), ROUND(a,p+NULL) FROM t1; a p v ROUND(a,p) ROUND(a,p+NULL) 1 0 1 1 NULL @@ -130,7 +130,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(32) DEFAULT NULL, - `v` char(32) CHARACTER SET ucs2 AS (a) VIRTUAL + `v` char(32) CHARACTER SET ucs2 GENERATED ALWAYS AS (`a`) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a int, b int); @@ -144,7 +144,7 @@ SELECT table_schema, table_name, column_name, column_type, extra FROM information_schema.columns WHERE table_name = 't2'; table_schema table_name column_name column_type extra test t2 a int(11) -test t2 b int(11) VIRTUAL +test t2 b int(11) VIRTUAL GENERATED DROP TABLE t1,t2; create table t1 ( a int not null, b char(2) not null, @@ -155,7 +155,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` char(2) NOT NULL, - `c` enum('Y','N') AS (case when b = 'aa' then 'Y' else 'N' end) PERSISTENT + `c` enum('Y','N') GENERATED ALWAYS AS (case when `b` = 'aa' then 'Y' else 'N' end) STORED ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1(a,b) values (1,'bb'), (2,'aa'), (3,'cc'); select * from t1; @@ -173,7 +173,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` set('y','n') AS (if(a=0,if(b=0,('n,n'),('n,y')),if(b=0,('y,n'),('y,y')))) PERSISTENT + `c` set('y','n') GENERATED ALWAYS AS (if(`a` = 0,if(`b` = 0,'n,n','n,y'),if(`b` = 0,'y,n','y,y'))) STORED ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t2(a,b) values (7,0), (2,3), (0,1); select * from t2; @@ -227,7 +227,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL, - `b` bigint(20) AS (a > '2') VIRTUAL + `b` bigint(20) GENERATED ALWAYS AS (`a` > '2') VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 (a) values (1),(3); select * from t1; @@ -244,7 +244,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL, - `b` bigint(20) AS (a between 0 and 2) VIRTUAL + `b` bigint(20) GENERATED ALWAYS AS (`a` between 0 and 2) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 (a) values (1),(3); select * from t1; @@ -261,7 +261,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) DEFAULT NULL, - `b` char(10) AS (a between 0 and 2) VIRTUAL + `b` char(10) GENERATED ALWAYS AS (`a` between 0 and 2) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 (a) values (1),(3); select * from t1; @@ -284,33 +284,33 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` varchar(32) DEFAULT NULL, - `c` int(11) AS (a MOD 10) VIRTUAL, - `d` varchar(5) AS (LEFT(b,5)) PERSISTENT + `c` int(11) GENERATED ALWAYS AS (`a` % 10) VIRTUAL, + `d` varchar(5) GENERATED ALWAYS AS (left(`b`,5)) STORED ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra a int(11) NO NULL b varchar(32) YES NULL -c int(11) YES NULL VIRTUAL -d varchar(5) YES NULL PERSISTENT +c int(11) YES NULL VIRTUAL GENERATED +d varchar(5) YES NULL STORED GENERATED show full columns from t1; Field Type Collation Null Key Default Extra Privileges Comment a int(11) NULL NO NULL # b varchar(32) latin1_swedish_ci YES NULL # -c int(11) NULL YES NULL VIRTUAL # -d varchar(5) latin1_swedish_ci YES NULL PERSISTENT # +c int(11) NULL YES NULL VIRTUAL GENERATED # +d varchar(5) latin1_swedish_ci YES NULL STORED GENERATED # INSERT INTO `test`.`t1`(`a`,`b`,`c`,`d`) VALUES ( '1','a',NULL,NULL); UPDATE `test`.`t1` SET `d`='b' WHERE `a`='1' AND `b`='a' AND `c`='1' AND `d`='a'; Warnings: -Warning 1906 The value specified for computed column 'd' in table 't1' ignored +Warning 1906 The value specified for generated column 'd' in table 't1' ignored INSERT INTO `test`.`t1`(`a`,`b`,`c`,`d`) VALUES ( '1','a',NULL,'a'); Warnings: -Warning 1906 The value specified for computed column 'd' in table 't1' ignored +Warning 1906 The value specified for generated column 'd' in table 't1' ignored set sql_mode='strict_all_tables'; UPDATE `test`.`t1` SET `d`='b' WHERE `a`='1' AND `b`='a' AND `c`='1' AND `d`='a'; -ERROR HY000: The value specified for computed column 'd' in table 't1' ignored +ERROR HY000: The value specified for generated column 'd' in table 't1' ignored INSERT INTO `test`.`t1`(`a`,`b`,`c`,`d`) VALUES ( '1','a',NULL,'a'); -ERROR HY000: The value specified for computed column 'd' in table 't1' ignored +ERROR HY000: The value specified for generated column 'd' in table 't1' ignored drop table t1; # # MDEV-5611: self-referencing virtual column @@ -324,7 +324,7 @@ create table t1 (v1 varchar(255) as (c1) persistent, c1 varchar(50)) collate=lat show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `v1` varchar(255) AS (c1) PERSISTENT, + `v1` varchar(255) GENERATED ALWAYS AS (`c1`) STORED, `c1` varchar(50) COLLATE latin1_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci drop table t1; @@ -339,7 +339,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` timestamp AS (TIMESTAMP(a)) VIRTUAL + `b` timestamp GENERATED ALWAYS AS (cast(`a` as datetime)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a DATETIME, b TIMESTAMP AS (TIMESTAMP(a)),c TIMESTAMP); @@ -347,7 +347,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` timestamp AS (TIMESTAMP(a)) VIRTUAL, + `b` timestamp GENERATED ALWAYS AS (cast(`a` as datetime)) VIRTUAL, `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; diff --git a/mysql-test/suite/vcol/r/vcol_non_stored_columns_innodb.result b/mysql-test/suite/vcol/r/vcol_non_stored_columns_innodb.result index 76482b39d79..f4cbb5bd662 100644 --- a/mysql-test/suite/vcol/r/vcol_non_stored_columns_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_non_stored_columns_innodb.result @@ -76,23 +76,23 @@ drop table t1; # Case 7. ALTER. Modify virtual stored -> virtual non-stored create table t1 (a int, b int as (a % 2) persistent); alter table t1 modify b int as (a % 2); -ERROR HY000: This is not yet supported for computed columns +ERROR HY000: This is not yet supported for generated columns show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) PERSISTENT + `b` int(11) GENERATED ALWAYS AS (`a` % 2) STORED ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; # Case 8. ALTER. Modify virtual non-stored -> virtual stored create table t1 (a int, b int as (a % 2)); alter table t1 modify b int as (a % 2) persistent; -ERROR HY000: This is not yet supported for computed columns +ERROR HY000: This is not yet supported for generated columns show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; # Case 9. CREATE LIKE @@ -173,7 +173,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `c` int(11) AS (dayofyear(b)) VIRTUAL, + `c` int(11) GENERATED ALWAYS AS (dayofyear(`b`)) VIRTUAL, `b` datetime DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; @@ -194,7 +194,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `c` int(11) AS (dayofyear(b)) PERSISTENT, + `c` int(11) GENERATED ALWAYS AS (dayofyear(`b`)) STORED, `b` datetime DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; @@ -216,7 +216,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` datetime DEFAULT NULL, - `c` int(11) AS (week(b,1)) PERSISTENT + `c` int(11) GENERATED ALWAYS AS (week(`b`,1)) STORED ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; # Case 15. ALTER. Changing the expression of a virtual non-stored column. @@ -237,7 +237,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` datetime DEFAULT NULL, - `c` int(11) AS (week(b,1)) VIRTUAL + `c` int(11) GENERATED ALWAYS AS (week(`b`,1)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; # diff --git a/mysql-test/suite/vcol/r/vcol_non_stored_columns_myisam.result b/mysql-test/suite/vcol/r/vcol_non_stored_columns_myisam.result index 233f6778ca9..87bd1bcf530 100644 --- a/mysql-test/suite/vcol/r/vcol_non_stored_columns_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_non_stored_columns_myisam.result @@ -76,23 +76,23 @@ drop table t1; # Case 7. ALTER. Modify virtual stored -> virtual non-stored create table t1 (a int, b int as (a % 2) persistent); alter table t1 modify b int as (a % 2); -ERROR HY000: This is not yet supported for computed columns +ERROR HY000: This is not yet supported for generated columns show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) PERSISTENT + `b` int(11) GENERATED ALWAYS AS (`a` % 2) STORED ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; # Case 8. ALTER. Modify virtual non-stored -> virtual stored create table t1 (a int, b int as (a % 2)); alter table t1 modify b int as (a % 2) persistent; -ERROR HY000: This is not yet supported for computed columns +ERROR HY000: This is not yet supported for generated columns show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (`a` % 2) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; # Case 9. CREATE LIKE @@ -173,7 +173,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `c` int(11) AS (dayofyear(b)) VIRTUAL, + `c` int(11) GENERATED ALWAYS AS (dayofyear(`b`)) VIRTUAL, `b` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; @@ -194,7 +194,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `c` int(11) AS (dayofyear(b)) PERSISTENT, + `c` int(11) GENERATED ALWAYS AS (dayofyear(`b`)) STORED, `b` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; @@ -216,7 +216,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` datetime DEFAULT NULL, - `c` int(11) AS (week(b,1)) PERSISTENT + `c` int(11) GENERATED ALWAYS AS (week(`b`,1)) STORED ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; # Case 15. ALTER. Changing the expression of a virtual non-stored column. @@ -237,7 +237,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` datetime DEFAULT NULL, - `c` int(11) AS (week(b,1)) VIRTUAL + `c` int(11) GENERATED ALWAYS AS (week(`b`,1)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; # diff --git a/mysql-test/suite/vcol/r/vcol_partition_innodb.result b/mysql-test/suite/vcol/r/vcol_partition_innodb.result index 6a7978a8bf4..4c869a0a37d 100644 --- a/mysql-test/suite/vcol/r/vcol_partition_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_partition_innodb.result @@ -81,3 +81,9 @@ p0 1 16384 p1 1 16384 p2 0 16384 drop table t1; +create table t1 (a int, b datetime as (now())) partition by hash(b+1) partitions 3; +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +create table t1 (a int, b varchar(100) as (user())) partition by hash(b+1) partitions 3; +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +create table t1 (a int, b double as (rand())) partition by hash(b+1) partitions 3; +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed diff --git a/mysql-test/suite/vcol/r/vcol_partition_myisam.result b/mysql-test/suite/vcol/r/vcol_partition_myisam.result index cb6f7fe1eca..aeeaec2ac22 100644 --- a/mysql-test/suite/vcol/r/vcol_partition_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_partition_myisam.result @@ -81,3 +81,9 @@ p0 1 7 p1 1 7 p2 0 0 drop table t1; +create table t1 (a int, b datetime as (now())) partition by hash(b+1) partitions 3; +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +create table t1 (a int, b varchar(100) as (user())) partition by hash(b+1) partitions 3; +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +create table t1 (a int, b double as (rand())) partition by hash(b+1) partitions 3; +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed diff --git a/mysql-test/suite/vcol/r/vcol_select_myisam.result b/mysql-test/suite/vcol/r/vcol_select_myisam.result index d6d01150e0b..4dee9f4fca6 100644 --- a/mysql-test/suite/vcol/r/vcol_select_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_select_myisam.result @@ -273,16 +273,16 @@ INSERT INTO t1 VALUES (NULL),( 78), (185), (0), (154); CREATE TABLE t2 (a int, b int AS (a) VIRTUAL); INSERT INTO t2 VALUES (187,187), (9,9), (187,187); Warnings: -Warning 1906 The value specified for computed column 'b' in table 't2' ignored -Warning 1906 The value specified for computed column 'b' in table 't2' ignored -Warning 1906 The value specified for computed column 'b' in table 't2' ignored +Warning 1906 The value specified for generated column 'b' in table 't2' ignored +Warning 1906 The value specified for generated column 'b' in table 't2' ignored +Warning 1906 The value specified for generated column 'b' in table 't2' ignored EXPLAIN EXTENDED SELECT * FROM t1 JOIN t2 USING (b); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`b` = `test`.`t2`.`b`) +Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`b` = `test`.`t2`.`b` SELECT * FROM t1 JOIN t2 USING (b); b a EXPLAIN EXTENDED @@ -291,7 +291,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`b` = `test`.`t2`.`b`) +Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`b` = `test`.`t2`.`b` SELECT * FROM t1 NATURAL JOIN t2; b a DROP TABLE t1,t2; diff --git a/mysql-test/suite/vcol/r/vcol_supported_sql_funcs.result b/mysql-test/suite/vcol/r/vcol_supported_sql_funcs.result index 2e6dbc38b6f..d6161751fd4 100644 --- a/mysql-test/suite/vcol/r/vcol_supported_sql_funcs.result +++ b/mysql-test/suite/vcol/r/vcol_supported_sql_funcs.result @@ -9,7 +9,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (abs(a)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (abs(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-1, default); select * from t1; @@ -24,7 +24,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(acos(a),6)) VIRTUAL + `b` double GENERATED ALWAYS AS (format(acos(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1, default); insert into t1 values (1.0001,default); @@ -43,7 +43,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(asin(a),6)) VIRTUAL + `b` double GENERATED ALWAYS AS (format(asin(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (0.2, default); insert into t1 values (1.0001,default); @@ -61,7 +61,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, - `c` double AS (format(atan(a,b),6)) VIRTUAL + `c` double GENERATED ALWAYS AS (format(atan(`a`,`b`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-2,2,default); insert into t1 values (format(PI(),6),0,default); @@ -77,7 +77,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `c` double AS (format(atan(a),6)) VIRTUAL + `c` double GENERATED ALWAYS AS (format(atan(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-2,default); insert into t1 values (format(PI(),6),default); @@ -95,7 +95,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, - `c` double AS (format(atan2(a,b),6)) VIRTUAL + `c` double GENERATED ALWAYS AS (format(atan(`a`,`b`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-2,2,default); insert into t1 values (format(PI(),6),0,default); @@ -112,7 +112,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` int(11) AS (ceil(a)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (ceiling(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1.23,default); insert into t1 values (-1.23,default); @@ -131,7 +131,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL, - `d` varchar(10) AS (conv(a,b,c)) VIRTUAL + `d` varchar(10) GENERATED ALWAYS AS (conv(`a`,`b`,`c`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('a',16,2,default); insert into t1 values ('6e',18,8,default); @@ -152,7 +152,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(cos(a),6)) VIRTUAL + `b` double GENERATED ALWAYS AS (format(cos(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (format(PI(),6),default); select * from t1; @@ -167,7 +167,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(cot(a),6)) VIRTUAL + `b` double GENERATED ALWAYS AS (format(cot(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (12,default); insert into t1 values (1,default); @@ -184,7 +184,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` mediumtext AS (crc32(a)) VIRTUAL + `b` mediumtext GENERATED ALWAYS AS (crc32(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); insert into t1 values ('mysql',default); @@ -201,7 +201,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(degrees(a),6)) VIRTUAL + `b` double GENERATED ALWAYS AS (format(degrees(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (format(PI(),6),default); insert into t1 values (format(PI()/2,6),default); @@ -218,7 +218,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (a/2) VIRTUAL + `b` double GENERATED ALWAYS AS (`a` / 2) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2,default); select * from t1; @@ -233,7 +233,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(exp(a),6)) VIRTUAL + `b` double GENERATED ALWAYS AS (format(exp(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2,default); insert into t1 values (-2,default); @@ -252,7 +252,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` mediumtext AS (floor(a)) VIRTUAL + `b` mediumtext GENERATED ALWAYS AS (floor(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1.23,default); insert into t1 values (-1.23,default); @@ -269,7 +269,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(ln(a),6)) VIRTUAL + `b` double GENERATED ALWAYS AS (format(ln(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2,default); insert into t1 values (-2,default); @@ -287,7 +287,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, - `c` double AS (format(log(a,b),6)) VIRTUAL + `c` double GENERATED ALWAYS AS (format(log(`a`,`b`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2,65536,default); insert into t1 values (10,100,default); @@ -305,7 +305,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(log(a),6)) VIRTUAL + `b` double GENERATED ALWAYS AS (format(log(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2,default); insert into t1 values (-2,default); @@ -322,7 +322,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(log2(a),6)) VIRTUAL + `b` double GENERATED ALWAYS AS (format(log2(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (65536,default); insert into t1 values (-100,default); @@ -339,7 +339,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(log10(a),6)) VIRTUAL + `b` double GENERATED ALWAYS AS (format(log10(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2,default); insert into t1 values (100,default); @@ -358,7 +358,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (a-1) VIRTUAL + `b` double GENERATED ALWAYS AS (`a` - 1) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2,default); select * from t1; @@ -373,7 +373,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (mod(a,10)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (`a` % 10) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (11,default); @@ -390,7 +390,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 10) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (`a` % 10) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (11,default); @@ -407,7 +407,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` varchar(10) AS (oct(a)) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (conv(`a`,10,8)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (12,default); select * from t1; @@ -422,7 +422,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(PI()*a*a,6)) VIRTUAL + `b` double GENERATED ALWAYS AS (format(pi() * `a` * `a`,6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); select * from t1; @@ -437,7 +437,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a+1) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); select * from t1; @@ -452,8 +452,8 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (pow(a,2)) VIRTUAL, - `c` int(11) AS (power(a,2)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (pow(`a`,2)) VIRTUAL, + `c` int(11) GENERATED ALWAYS AS (pow(`a`,2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default,default); insert into t1 values (2,default,default); @@ -470,7 +470,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(radians(a),6)) VIRTUAL + `b` double GENERATED ALWAYS AS (format(radians(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (90,default); select * from t1; @@ -485,7 +485,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` int(11) AS (round(a)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (round(`a`,0)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-1.23,default); insert into t1 values (-1.58,default); @@ -504,7 +504,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, - `c` int(11) AS (round(a,b)) VIRTUAL + `c` int(11) GENERATED ALWAYS AS (round(`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1.298,1,default); insert into t1 values (1.298,0,default); @@ -523,7 +523,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` int(11) AS (sign(a)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (sign(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-32,default); insert into t1 values (0,default); @@ -542,7 +542,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(sin(a),6)) VIRTUAL + `b` double GENERATED ALWAYS AS (format(sin(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (format(PI()/2,6),default); select * from t1; @@ -557,7 +557,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(sqrt(a),6)) VIRTUAL + `b` double GENERATED ALWAYS AS (format(sqrt(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (4,default); insert into t1 values (20,default); @@ -576,7 +576,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(tan(a),6)) VIRTUAL + `b` double GENERATED ALWAYS AS (format(tan(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (format(PI(),6),default); insert into t1 values (format(PI()+1,6),default); @@ -593,7 +593,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (a*3) VIRTUAL + `b` double GENERATED ALWAYS AS (`a` * 3) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (0,default); insert into t1 values (1,default); @@ -612,7 +612,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (truncate(a,4)) VIRTUAL + `b` double GENERATED ALWAYS AS (truncate(`a`,4)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1.223,default); insert into t1 values (1.999,default); @@ -633,7 +633,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (-a) VIRTUAL + `b` double GENERATED ALWAYS AS (-`a`) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (-1,default); @@ -653,7 +653,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(2) DEFAULT NULL, - `b` int(11) AS (ascii(a)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (ascii(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2',default); insert into t1 values (2,default); @@ -672,7 +672,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` varchar(10) AS (bin(a)) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (conv(`a`,10,2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (12,default); select * from t1; @@ -687,7 +687,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` mediumtext AS (bit_length(a)) VIRTUAL + `b` mediumtext GENERATED ALWAYS AS (bit_length(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('text',default); select * from t1; @@ -702,7 +702,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` mediumtext AS (char_length(a)) VIRTUAL + `b` mediumtext GENERATED ALWAYS AS (char_length(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('text',default); select * from t1; @@ -718,7 +718,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` varbinary(10) AS (char(a,b)) VIRTUAL + `c` varbinary(10) GENERATED ALWAYS AS (char(`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (77,121,default); select * from t1; @@ -733,7 +733,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` mediumtext AS (character_length(a)) VIRTUAL + `b` mediumtext GENERATED ALWAYS AS (char_length(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('text',default); select * from t1; @@ -749,7 +749,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` varchar(20) AS (concat_ws(',',a,b)) VIRTUAL + `c` varchar(20) GENERATED ALWAYS AS (concat_ws(',',`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('value1','value2',default); select * from t1; @@ -765,7 +765,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` varchar(20) AS (concat(a,',',b)) VIRTUAL + `c` varchar(20) GENERATED ALWAYS AS (concat(`a`,',',`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('value1','value2',default); select * from t1; @@ -782,7 +782,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` int(11) DEFAULT NULL, - `d` varchar(10) AS (elt(c,a,b)) VIRTUAL + `d` varchar(10) GENERATED ALWAYS AS (elt(`c`,`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('value1','value2',1,default); insert into t1 values ('value1','value2',2,default); @@ -799,7 +799,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` varchar(10) AS (export_set(a,'1','0','',10)) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (export_set(`a`,'1','0','',10)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (6,default); select * from t1; @@ -815,7 +815,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` int(11) AS (field('aa',a,b)) VIRTUAL + `c` int(11) GENERATED ALWAYS AS (field('aa',`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('aa','bb',default); insert into t1 values ('bb','aa',default); @@ -833,7 +833,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` int(11) AS (find_in_set(a,b)) VIRTUAL + `c` int(11) GENERATED ALWAYS AS (find_in_set(`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('aa','aa,bb,cc',default); insert into t1 values ('aa','bb,aa,cc',default); @@ -850,7 +850,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` varchar(20) AS (format(a,2)) VIRTUAL + `b` varchar(20) GENERATED ALWAYS AS (format(`a`,2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (12332.123456,default); select * from t1; @@ -865,7 +865,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` varchar(10) AS (hex(a)) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (hex(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (17,default); select * from t1; @@ -879,7 +879,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (hex(a)) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (hex(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('abc',default); select * from t1; @@ -895,7 +895,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` varchar(20) AS (insert(a,length(a),length(b),b)) VIRTUAL + `c` varchar(20) GENERATED ALWAYS AS (insert(`a`,length(`a`),length(`b`),`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('start,','end',default); select * from t1; @@ -911,7 +911,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` int(11) AS (instr(a,b)) VIRTUAL + `c` int(11) GENERATED ALWAYS AS (locate(`b`,`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar,','bar',default); insert into t1 values ('xbar,','foobar',default); @@ -928,7 +928,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (lcase(a)) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (lcase(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -943,7 +943,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(5) AS (left(a,5)) VIRTUAL + `b` varchar(5) GENERATED ALWAYS AS (left(`a`,5)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar',default); select * from t1; @@ -958,7 +958,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) AS (length(a)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (length(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('text',default); select * from t1; @@ -973,7 +973,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a like 'H%!o' escape '!') VIRTUAL + `b` tinyint(1) GENERATED ALWAYS AS (`a` like 'H%!o' escape '!') VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('MySQL',default); @@ -990,7 +990,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (locate('bar',a)) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (locate('bar',`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar',default); select * from t1; @@ -1005,7 +1005,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (lower(a)) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (lcase(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -1020,7 +1020,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (lpad(a,4,' ')) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (lpad(`a`,4,' ')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); insert into t1 values ('M',default); @@ -1037,7 +1037,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (ltrim(a)) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (ltrim(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (' MySQL',default); insert into t1 values ('MySQL',default); @@ -1056,7 +1056,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` int(11) DEFAULT NULL, - `d` varchar(30) AS (make_set(c,a,b)) VIRTUAL + `d` varchar(30) GENERATED ALWAYS AS (make_set(`c`,`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('a','b',1,default); insert into t1 values ('a','b',3,default); @@ -1073,7 +1073,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (mid(a,1,2)) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (substr(`a`,1,2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar',default); select * from t1; @@ -1088,7 +1088,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a not like 'H%o') VIRTUAL + `b` tinyint(1) GENERATED ALWAYS AS (`a` not like 'H%o') VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('MySQL',default); @@ -1105,7 +1105,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a not regexp 'H.+o') VIRTUAL + `b` tinyint(1) GENERATED ALWAYS AS (!(`a` regexp 'H.+o')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('hello',default); @@ -1122,7 +1122,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) AS (octet_length(a)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (length(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('text',default); select * from t1; @@ -1137,7 +1137,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` mediumtext AS (ord(a)) VIRTUAL + `b` mediumtext GENERATED ALWAYS AS (ord(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2',default); select * from t1; @@ -1152,7 +1152,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (position('bar' in a)) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (locate('bar',`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar',default); select * from t1; @@ -1167,7 +1167,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (quote(a)) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (quote(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Don\'t',default); select * from t1; @@ -1182,7 +1182,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a regexp 'H.+o') VIRTUAL + `b` tinyint(1) GENERATED ALWAYS AS (`a` regexp 'H.+o') VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('hello',default); @@ -1199,7 +1199,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(30) AS (repeat(a,3)) VIRTUAL + `b` varchar(30) GENERATED ALWAYS AS (repeat(`a`,3)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -1214,7 +1214,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(30) AS (replace(a,'aa','bb')) VIRTUAL + `b` varchar(30) GENERATED ALWAYS AS (replace(`a`,'aa','bb')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('maa',default); select * from t1; @@ -1229,7 +1229,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(30) AS (reverse(a)) VIRTUAL + `b` varchar(30) GENERATED ALWAYS AS (reverse(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('maa',default); select * from t1; @@ -1244,7 +1244,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (right(a,4)) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (right(`a`,4)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar',default); select * from t1; @@ -1259,7 +1259,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a rlike 'H.+o') VIRTUAL + `b` tinyint(1) GENERATED ALWAYS AS (`a` regexp 'H.+o') VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('MySQL',default); @@ -1276,7 +1276,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (rpad(a,4,'??')) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (rpad(`a`,4,'??')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('He',default); select * from t1; @@ -1291,7 +1291,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (rtrim(a)) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (rtrim(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello ',default); select * from t1; @@ -1306,7 +1306,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(20) AS (soundex(a)) VIRTUAL + `b` varchar(20) GENERATED ALWAYS AS (soundex(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); select * from t1; @@ -1322,7 +1322,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a sounds like b) VIRTUAL + `c` tinyint(1) GENERATED ALWAYS AS (soundex(`a`) = soundex(`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello','Hello',default); insert into t1 values ('Hello','MySQL',default); @@ -1341,7 +1341,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, - `b` varchar(10) AS (concat(a,space(5))) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (concat(`a`,space(5))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello', default); select * from t1; @@ -1357,7 +1357,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(9) DEFAULT NULL, `b` varchar(9) DEFAULT NULL, - `c` tinyint(1) AS (strcmp(a,b)) VIRTUAL + `c` tinyint(1) GENERATED ALWAYS AS (strcmp(`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello','Hello', default); insert into t1 values ('Hello','Hello1', default); @@ -1374,7 +1374,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, - `b` varchar(10) AS (substr(a,2)) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (substr(`a`,2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); select * from t1; @@ -1389,7 +1389,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(15) DEFAULT NULL, - `b` varchar(10) AS (substring_index(a,'.',2)) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (substring_index(`a`,'.',2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('www.mysql.com',default); select * from t1; @@ -1404,7 +1404,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, - `b` varchar(10) AS (substring(a from 2 for 2)) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (substr(`a`,2,2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); select * from t1; @@ -1419,7 +1419,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(15) DEFAULT NULL, - `b` varchar(10) AS (trim(a)) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (trim(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (' aa ',default); select * from t1; @@ -1434,7 +1434,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, - `b` varchar(10) AS (ucase(a)) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (ucase(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -1449,7 +1449,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(15) DEFAULT NULL, - `b` varchar(10) AS (unhex(a)) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (unhex(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('4D7953514C',default); select * from t1; @@ -1464,7 +1464,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, - `b` varchar(10) AS (upper(a)) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (ucase(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -1482,7 +1482,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(16) AS (case a when NULL then 'asd' when 'b' then 'B' else a end) VIRTUAL + `b` varchar(16) GENERATED ALWAYS AS (case `a` when NULL then 'asd' when 'b' then 'B' else `a` end) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (NULL,default); insert into t1 values ('b',default); @@ -1502,7 +1502,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) AS (if(a=1,a,b)) VIRTUAL + `c` int(11) GENERATED ALWAYS AS (if(`a` = 1,`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,2,default); insert into t1 values (3,4,default); @@ -1520,7 +1520,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` varchar(10) AS (ifnull(a,'DEFAULT')) VIRTUAL + `c` varchar(10) GENERATED ALWAYS AS (ifnull(`a`,'DEFAULT')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (NULL,'adf',default); insert into t1 values ('a','adf',default); @@ -1537,7 +1537,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (nullif(a,'DEFAULT')) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (nullif(`a`,'DEFAULT')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('DEFAULT',default); insert into t1 values ('a',default); @@ -1557,7 +1557,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` tinyint(1) AS (a>0 && a<2) VIRTUAL + `b` tinyint(1) GENERATED ALWAYS AS (`a` > 0 and `a` < 2) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-1,default); insert into t1 values (1,default); @@ -1574,7 +1574,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` tinyint(1) AS (a between 0 and 2) VIRTUAL + `b` tinyint(1) GENERATED ALWAYS AS (`a` between 0 and 2) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-1,default); insert into t1 values (1,default); @@ -1591,7 +1591,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varbinary(10) AS (binary a) VIRTUAL + `b` varbinary(10) GENERATED ALWAYS AS (cast(`a` as char charset binary)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('11',default); insert into t1 values (1,default); @@ -1608,7 +1608,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a & 5) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (`a` & 5) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (0,default); @@ -1625,7 +1625,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (~a) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (~`a`) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); Warnings: @@ -1642,7 +1642,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a | 5) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (`a` | 5) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (0,default); @@ -1661,7 +1661,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a ^ 5) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (`a` ^ 5) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (0,default); @@ -1680,7 +1680,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a div 5) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (`a` DIV 5) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (7,default); @@ -1698,7 +1698,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` tinyint(1) AS (a <=> b) VIRTUAL + `c` tinyint(1) GENERATED ALWAYS AS (`a` <=> `b`) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,1,default); insert into t1 values (NULL,NULL,default); @@ -1718,7 +1718,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a=b) VIRTUAL + `c` tinyint(1) GENERATED ALWAYS AS (`a` = `b`) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('a','b',default); insert into t1 values ('a','a',default); @@ -1736,7 +1736,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a >= b) VIRTUAL + `c` tinyint(1) GENERATED ALWAYS AS (`a` >= `b`) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('a','b',default); insert into t1 values ('a','a',default); @@ -1754,7 +1754,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a > b) VIRTUAL + `c` tinyint(1) GENERATED ALWAYS AS (`a` > `b`) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('a','b',default); insert into t1 values ('a','a',default); @@ -1771,7 +1771,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` tinyint(1) AS (a is not null) VIRTUAL + `b` tinyint(1) GENERATED ALWAYS AS (`a` is not null) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (NULL,default); @@ -1788,7 +1788,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` tinyint(1) AS (a is null) VIRTUAL + `b` tinyint(1) GENERATED ALWAYS AS (`a` is null) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (NULL,default); @@ -1805,7 +1805,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a << 2) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (`a` << 2) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (3,default); @@ -1823,7 +1823,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a <= b) VIRTUAL + `c` tinyint(1) GENERATED ALWAYS AS (`a` <= `b`) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); @@ -1843,7 +1843,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a < b) VIRTUAL + `c` tinyint(1) GENERATED ALWAYS AS (`a` < `b`) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); @@ -1862,7 +1862,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` tinyint(1) AS (a not between 0 and 2) VIRTUAL + `b` tinyint(1) GENERATED ALWAYS AS (`a` not between 0 and 2) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-1,default); insert into t1 values (1,default); @@ -1880,7 +1880,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a <> b) VIRTUAL + `c` tinyint(1) GENERATED ALWAYS AS (`a` <> `b`) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); @@ -1900,7 +1900,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a != b) VIRTUAL + `c` tinyint(1) GENERATED ALWAYS AS (`a` <> `b`) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); @@ -1919,7 +1919,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a>5 || a<3) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (`a` > 5 or `a` < 3) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (4,default); @@ -1936,7 +1936,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a >> 2) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (`a` >> 2) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (8,default); insert into t1 values (3,default); @@ -1953,7 +1953,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a xor 5) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (`a` xor 5) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (0,default); insert into t1 values (1,default); @@ -1975,7 +1975,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (adddate(a,interval 1 month)) VIRTUAL + `b` datetime GENERATED ALWAYS AS (`a` + interval 1 month) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -1990,7 +1990,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (addtime(a,'02:00:00')) VIRTUAL + `b` datetime GENERATED ALWAYS AS (addtime(`a`,'02:00:00')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2005,7 +2005,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (convert_tz(a,'MET','UTC')) VIRTUAL + `b` datetime GENERATED ALWAYS AS (convert_tz(`a`,'MET','UTC')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2020,7 +2020,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (date_add(a,interval 1 month)) VIRTUAL + `b` datetime GENERATED ALWAYS AS (`a` + interval 1 month) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2035,7 +2035,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (date_sub(a,interval 1 month)) VIRTUAL + `b` datetime GENERATED ALWAYS AS (`a` - interval 1 month) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2050,7 +2050,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (date(a)) VIRTUAL + `b` datetime GENERATED ALWAYS AS (cast(`a` as date)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31 02:00:00',default); select * from t1; @@ -2065,7 +2065,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` mediumtext AS (datediff(a,'2000-01-01')) VIRTUAL + `b` mediumtext GENERATED ALWAYS AS (to_days(`a`) - to_days('2000-01-01')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2080,7 +2080,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (day(a)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (dayofmonth(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2095,7 +2095,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (dayofmonth(a)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (dayofmonth(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2110,7 +2110,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (dayofweek(a)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (dayofweek(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2125,7 +2125,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (dayofyear(a)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (dayofyear(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2140,7 +2140,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (extract(year from a)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (extract(year from `a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2155,7 +2155,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumtext DEFAULT NULL, - `b` datetime AS (from_days(a)) VIRTUAL + `b` datetime GENERATED ALWAYS AS (from_days(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (730669,default); select * from t1; @@ -2171,7 +2171,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumtext DEFAULT NULL, - `b` datetime AS (from_unixtime(a)) VIRTUAL + `b` datetime GENERATED ALWAYS AS (from_unixtime(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1196440219,default); select * from t1; @@ -2186,7 +2186,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, - `b` mediumtext AS (hour(a)) VIRTUAL + `b` mediumtext GENERATED ALWAYS AS (hour(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('10:05:03',default); select * from t1; @@ -2201,7 +2201,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (last_day(a)) VIRTUAL + `b` datetime GENERATED ALWAYS AS (last_day(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2003-02-05',default); insert into t1 values ('2003-02-32',default); @@ -2220,7 +2220,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` datetime AS (makedate(a,1)) VIRTUAL + `b` datetime GENERATED ALWAYS AS (makedate(`a`,1)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2001,default); select * from t1; @@ -2235,7 +2235,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` time AS (maketime(a,1,3)) VIRTUAL + `b` time GENERATED ALWAYS AS (maketime(`a`,1,3)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (12,default); select * from t1; @@ -2250,7 +2250,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` mediumtext AS (microsecond(a)) VIRTUAL + `b` mediumtext GENERATED ALWAYS AS (microsecond(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2009-12-31 12:00:00.123456',default); insert into t1 values ('2009-12-31 23:59:59.000010',default); @@ -2267,7 +2267,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (minute(a)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (minute(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2009-12-31 23:59:59.000010',default); select * from t1; @@ -2282,7 +2282,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (month(a)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (month(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2009-12-31 23:59:59.000010',default); select * from t1; @@ -2297,7 +2297,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (period_add(a,2)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (period_add(`a`,2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (200801,default); select * from t1; @@ -2313,7 +2313,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) AS (period_diff(a,b)) VIRTUAL + `c` int(11) GENERATED ALWAYS AS (period_diff(`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (200802,200703,default); select * from t1; @@ -2328,7 +2328,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (quarter(a)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (quarter(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2343,7 +2343,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumtext DEFAULT NULL, - `b` time AS (sec_to_time(a)) VIRTUAL + `b` time GENERATED ALWAYS AS (sec_to_time(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2378,default); select * from t1; @@ -2358,7 +2358,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (second(a)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (second(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('10:05:03',default); select * from t1; @@ -2373,7 +2373,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(64) DEFAULT NULL, - `b` datetime AS (str_to_date(a,'%m/%d/%Y')) VIRTUAL + `b` datetime GENERATED ALWAYS AS (str_to_date(`a`,'%m/%d/%Y')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('04/30/2004',default); select * from t1; @@ -2388,7 +2388,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (subdate(a,interval 1 month)) VIRTUAL + `b` datetime GENERATED ALWAYS AS (`a` - interval 1 month) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2403,7 +2403,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (subtime(a,'02:00:00')) VIRTUAL + `b` datetime GENERATED ALWAYS AS (subtime(`a`,'02:00:00')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2418,7 +2418,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, - `b` mediumtext AS (time_to_sec(a)) VIRTUAL + `b` mediumtext GENERATED ALWAYS AS (time_to_sec(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('22:23:00',default); select * from t1; @@ -2433,7 +2433,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` time AS (time(a)) VIRTUAL + `b` time GENERATED ALWAYS AS (cast(`a` as time)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31 02:03:04',default); select * from t1; @@ -2449,7 +2449,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime DEFAULT NULL, - `c` mediumtext AS (timediff(a,b)) VIRTUAL + `c` mediumtext GENERATED ALWAYS AS (timediff(`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-12-31 23:59:59.000001','2008-12-30 01:01:01.000002',default); select * from t1; @@ -2464,7 +2464,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` timestamp AS (timestamp(a)) VIRTUAL + `b` timestamp GENERATED ALWAYS AS (cast(`a` as datetime)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-12-31',default); select * from t1; @@ -2479,7 +2479,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` timestamp AS (timestampadd(minute,1,a)) VIRTUAL + `b` timestamp GENERATED ALWAYS AS (`a` + interval 1 minute) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2003-01-02',default); select * from t1; @@ -2493,9 +2493,9 @@ create table t1 (a timestamp, b timestamp, c long as (timestampdiff(MONTH, a,b)) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `c` mediumtext AS (timestampdiff(MONTH, a,b)) VIRTUAL + `c` mediumtext GENERATED ALWAYS AS (timestampdiff(MONTH,`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2003-02-01','2003-05-01',default); select * from t1; @@ -2510,7 +2510,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` mediumtext AS (to_days(a)) VIRTUAL + `b` mediumtext GENERATED ALWAYS AS (to_days(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2007-10-07',default); select * from t1; @@ -2525,7 +2525,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (week(a,0)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (week(`a`,0)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-09-01',default); select * from t1; @@ -2540,7 +2540,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (weekday(a)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (weekday(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-09-01',default); select * from t1; @@ -2555,7 +2555,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (weekofyear(a)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (week(`a`,3)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-09-01',default); select * from t1; @@ -2570,7 +2570,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (year(a)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (year(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-09-01',default); select * from t1; @@ -2585,7 +2585,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (yearweek(a)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (yearweek(`a`,0)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-09-01',default); select * from t1; @@ -2607,7 +2607,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` mediumtext AS (cast(a as unsigned)) VIRTUAL + `b` mediumtext GENERATED ALWAYS AS (cast(`a` as unsigned)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (-1,default); @@ -2619,7 +2619,6 @@ a b -1 18446744073709551615 Warnings: Note 1105 Cast to unsigned converted negative integer to it's positive complement -Note 1105 Cast to unsigned converted negative integer to it's positive complement drop table t1; set sql_warnings = 0; # Convert() @@ -2629,7 +2628,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` mediumtext AS (convert(a,unsigned)) VIRTUAL + `b` mediumtext GENERATED ALWAYS AS (cast(`a` as unsigned)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (-1,default); @@ -2641,7 +2640,6 @@ a b -1 18446744073709551615 Warnings: Note 1105 Cast to unsigned converted negative integer to it's positive complement -Note 1105 Cast to unsigned converted negative integer to it's positive complement drop table t1; set sql_warnings = 0; # @@ -2658,7 +2656,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (aes_encrypt(aes_decrypt(a,'adf'),'adf')) VIRTUAL + `b` varchar(1024) GENERATED ALWAYS AS (aes_encrypt(aes_decrypt(`a`,'adf'),'adf')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -2673,7 +2671,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (bit_count(a)) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (bit_count(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (5,default); select * from t1; @@ -2688,7 +2686,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (uncompress(compress(a))) VIRTUAL + `b` varchar(1024) GENERATED ALWAYS AS (uncompress(compress(`a`))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -2703,7 +2701,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (decode(encode(a,'abc'),'abc')) VIRTUAL + `b` varchar(1024) GENERATED ALWAYS AS (decode(encode(`a`,'abc'),'abc')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -2718,7 +2716,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT 'aaa', - `b` varchar(1024) AS (ifnull(a,default(a))) VIRTUAL + `b` varchar(1024) GENERATED ALWAYS AS (ifnull(`a`,default(`a`))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('any value',default); select * from t1; @@ -2733,7 +2731,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (inet_ntoa(inet_aton(a))) VIRTUAL + `b` varchar(1024) GENERATED ALWAYS AS (inet_ntoa(inet_aton(`a`))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('127.0.0.1',default); select * from t1; @@ -2748,7 +2746,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varbinary(32) AS (md5(a)) VIRTUAL + `b` varbinary(32) GENERATED ALWAYS AS (md5(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('testing',default); select * from t1; @@ -2763,7 +2761,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (old_password(a)) VIRTUAL + `b` varchar(1024) GENERATED ALWAYS AS (old_password(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('badpwd',default); select * from t1; @@ -2778,7 +2776,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (password(a)) VIRTUAL + `b` varchar(1024) GENERATED ALWAYS AS (password(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('badpwd',default); select * from t1; @@ -2793,7 +2791,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (sha1(a)) VIRTUAL + `b` varchar(1024) GENERATED ALWAYS AS (sha(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('abc',default); select * from t1; @@ -2808,7 +2806,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (sha(a)) VIRTUAL + `b` varchar(1024) GENERATED ALWAYS AS (sha(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('abc',default); select * from t1; @@ -2823,7 +2821,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(1) DEFAULT NULL, - `b` varchar(1024) AS (uncompressed_length(compress(repeat(a,30)))) VIRTUAL + `b` varchar(1024) GENERATED ALWAYS AS (uncompressed_length(compress(repeat(`a`,30)))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('a',default); select * from t1; @@ -2838,7 +2836,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` varchar(100) AS (monthname(a)) VIRTUAL + `b` varchar(100) GENERATED ALWAYS AS (monthname(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2010-10-10',default); select * from t1; @@ -2853,7 +2851,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` varchar(100) AS (dayname(a)) VIRTUAL + `b` varchar(100) GENERATED ALWAYS AS (dayname(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2011-11-11',default); select * from t1; @@ -2868,7 +2866,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` varchar(100) AS (date_format(a, '%W %a %M %b')) VIRTUAL + `b` varchar(100) GENERATED ALWAYS AS (date_format(`a`,'%W %a %M %b')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2012-12-12',default); select * from t1; @@ -2883,7 +2881,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(1) DEFAULT NULL, - `b` varchar(32) AS (current_user()) VIRTUAL + `b` varchar(32) GENERATED ALWAYS AS (current_user()) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('a', default); select * from t1; @@ -2898,7 +2896,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` varchar(10) AS (time_format(a,"%d.%m.%Y")) VIRTUAL + `b` varchar(10) GENERATED ALWAYS AS (time_format(`a`,'%d.%m.%Y')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2001-01-01 02:02:02',default); select * from t1; diff --git a/mysql-test/suite/vcol/r/vcol_syntax.result b/mysql-test/suite/vcol/r/vcol_syntax.result index 8515d790359..16e30e57230 100644 --- a/mysql-test/suite/vcol/r/vcol_syntax.result +++ b/mysql-test/suite/vcol/r/vcol_syntax.result @@ -5,7 +5,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a+1) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a int, b int as (a+1) virtual); @@ -13,7 +13,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a+1) VIRTUAL + `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a int, b int generated always as (a+1) persistent); @@ -21,7 +21,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a+1) PERSISTENT + `b` int(11) GENERATED ALWAYS AS (`a` + 1) STORED ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; set session sql_mode='ORACLE'; @@ -30,7 +30,7 @@ show create table t1; Table Create Table t1 CREATE TABLE "t1" ( "a" int(11) DEFAULT NULL, - "b" int(11) AS (a+1) VIRTUAL + "b" int(11) GENERATED ALWAYS AS ("a" + 1) VIRTUAL ) drop table t1; create table t1 (a int, b int generated always as (a+1) virtual); @@ -38,7 +38,7 @@ show create table t1; Table Create Table t1 CREATE TABLE "t1" ( "a" int(11) DEFAULT NULL, - "b" int(11) AS (a+1) VIRTUAL + "b" int(11) GENERATED ALWAYS AS ("a" + 1) VIRTUAL ) drop table t1; create table t1 (a int, b int as (a+1) persistent); @@ -46,7 +46,7 @@ show create table t1; Table Create Table t1 CREATE TABLE "t1" ( "a" int(11) DEFAULT NULL, - "b" int(11) AS (a+1) PERSISTENT + "b" int(11) GENERATED ALWAYS AS ("a" + 1) STORED ) drop table t1; set session sql_mode=@OLD_SQL_MODE; diff --git a/mysql-test/suite/vcol/r/vcol_view_innodb.result b/mysql-test/suite/vcol/r/vcol_view_innodb.result index 447e2fd89b6..091cdc02fb3 100644 --- a/mysql-test/suite/vcol/r/vcol_view_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_view_innodb.result @@ -48,7 +48,7 @@ explain extended select * from v3; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Warnings: -Note 1003 select (abs(`test`.`t1`.`b`) * 2) AS `d`,(abs(`test`.`t1`.`c`) * 2) AS `e` from `test`.`t1` +Note 1003 select abs(`test`.`t1`.`b`) * 2 AS `d`,abs(`test`.`t1`.`c`) * 2 AS `e` from `test`.`t1` drop view v1,v2,v3; drop table t1; create table t1 (a int not null, diff --git a/mysql-test/suite/vcol/r/vcol_view_myisam.result b/mysql-test/suite/vcol/r/vcol_view_myisam.result index 1b665e91a0f..8ad1853faa4 100644 --- a/mysql-test/suite/vcol/r/vcol_view_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_view_myisam.result @@ -48,7 +48,7 @@ explain extended select * from v3; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Warnings: -Note 1003 select (abs(`test`.`t1`.`b`) * 2) AS `d`,(abs(`test`.`t1`.`c`) * 2) AS `e` from `test`.`t1` +Note 1003 select abs(`test`.`t1`.`b`) * 2 AS `d`,abs(`test`.`t1`.`c`) * 2 AS `e` from `test`.`t1` drop view v1,v2,v3; drop table t1; create table t1 (a int not null, diff --git a/mysql-test/suite/vcol/t/delayed.test b/mysql-test/suite/vcol/t/delayed.test new file mode 100644 index 00000000000..62065abdba8 --- /dev/null +++ b/mysql-test/suite/vcol/t/delayed.test @@ -0,0 +1,5 @@ +create table t (a int primary key, b int, c int as (b), index (c)); +insert t (a,b) values (10,1); +replace delayed t (a,b) values (10,5); +check table t; +drop table t; diff --git a/mysql-test/suite/vcol/t/innodb_autoinc_vcol.test b/mysql-test/suite/vcol/t/innodb_autoinc_vcol.test index 2f2ac3d08e1..d499a06c3d7 100644 --- a/mysql-test/suite/vcol/t/innodb_autoinc_vcol.test +++ b/mysql-test/suite/vcol/t/innodb_autoinc_vcol.test @@ -1,6 +1,6 @@ --source include/have_innodb.inc -create table t1 (c2 int as (-c1), c1 int primary key auto_increment) engine=innodb; +create table t1 (c2 int as (1+1), c1 int primary key auto_increment) engine=innodb; insert into t1(c1) values (null),(null),(null); select * from t1; alter table t1 auto_increment = 3; diff --git a/mysql-test/suite/vcol/t/mrr.test b/mysql-test/suite/vcol/t/mrr.test new file mode 100644 index 00000000000..d7772ba5a78 --- /dev/null +++ b/mysql-test/suite/vcol/t/mrr.test @@ -0,0 +1,13 @@ +CREATE TABLE t1 ( + pk INT AUTO_INCREMENT PRIMARY KEY, + col_int_nokey INT NULL, + col_int_key INT AS (col_int_nokey) VIRTUAL, + KEY (col_int_key) +); +INSERT INTO t1 (col_int_nokey) +VALUES (0), (5), (4), (3), (7), (42), (5), (0), (3); +SELECT * FROM t1 WHERE col_int_key IN (3, 4) AND col_int_key <= 83 ORDER BY 1; +set optimizer_switch='index_condition_pushdown=off'; +SELECT * FROM t1 WHERE col_int_key IN (3, 4) ORDER BY 1; +SELECT * FROM t1 WHERE col_int_key IN (3, 4) AND col_int_key <= 83 ORDER BY 1; +DROP TABLE t1; diff --git a/mysql-test/suite/vcol/t/not_supported.test b/mysql-test/suite/vcol/t/not_supported.test index b6902780a02..b7544cb33a4 100644 --- a/mysql-test/suite/vcol/t/not_supported.test +++ b/mysql-test/suite/vcol/t/not_supported.test @@ -13,16 +13,16 @@ set time_zone='+10:00'; set div_precision_increment=20; create table t1 (a int, b int, v decimal(20,19) as (a/3)); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create table t2 (a int, b int, v int as (a+@a)); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create table t2 (a int, b int, v int as (a+@a) PERSISTENT); create table t3_ok (a int, b int, v int as (a+@@error_count)); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create table t3 (a int, b int, v int as (a+@@error_count) PERSISTENT); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create table t4 (a int, b int, v int as (@a:=a)); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create table t4 (a int, b int, v int as (@a:=a) PERSISTENT); create table t8 (a int, b int, v varchar(100) as (from_unixtime(a))); diff --git a/mysql-test/suite/vcol/t/partition.test b/mysql-test/suite/vcol/t/partition.test new file mode 100644 index 00000000000..67cda6b6d8b --- /dev/null +++ b/mysql-test/suite/vcol/t/partition.test @@ -0,0 +1,20 @@ +# +# test keyread on an indexed vcol +# +--source include/have_partition.inc + +CREATE TABLE t1 ( + id INT NOT NULL, + store_id INT NOT NULL, + x INT GENERATED ALWAYS AS (id + store_id) +) +PARTITION BY RANGE (store_id) ( + PARTITION p0 VALUES LESS THAN (6), + PARTITION p1 VALUES LESS THAN (11), + PARTITION p2 VALUES LESS THAN (16), + PARTITION p3 VALUES LESS THAN (21) +); +INSERT t1 (id, store_id) VALUES(1, 2), (3, 4), (3, 12), (4, 18); +CREATE INDEX idx ON t1(x); +SELECT x FROM t1; +DROP TABLE t1; diff --git a/mysql-test/suite/vcol/t/range.test b/mysql-test/suite/vcol/t/range.test new file mode 100644 index 00000000000..a4593d8b40a --- /dev/null +++ b/mysql-test/suite/vcol/t/range.test @@ -0,0 +1,10 @@ +# +# MDEV-11518 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed in Field_long::val_int() +# +create table t1 (pk int, i int, v int as (i*2) virtual, primary key (pk), key (v)) engine=myisam; +insert into t1 (pk,i) values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8); +create table t2 (a int, b int) engine=myisam; +insert into t2 values (1,2),(2,4); +select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk ); +drop table t1, t2; + diff --git a/mysql-test/suite/vcol/t/update.test b/mysql-test/suite/vcol/t/update.test new file mode 100644 index 00000000000..8326afe214f --- /dev/null +++ b/mysql-test/suite/vcol/t/update.test @@ -0,0 +1,112 @@ +# +# Test how UPDATE detects what columns need to be read (or generated) in a row +# +# stored column depends on virtual column depends on updated column. +# this tests TABLE::mark_virtual_columns_for_write() +# +create table t1 (a int, b int as (a+1), c int as (b+1) stored); +insert t1 set a=1; +select * from t1; +update t1 set a=2; +select * from t1; +drop table t1; +# +# one keypart is virtual, the other keypart is updated +# this tests TABLE::mark_columns_needed_for_update() +# +create table t1 (a int, c int as(a), p varchar(20) as(y), y char(20), index (p,c)); +insert into t1 (a,y) values(1, "yyy"); +update t1 set a = 100 where a = 1; +drop table t1; + +# +# note: prefix keys below +# +create table t1 ( + a varchar(10000), + b varchar(3000), + c varchar(14000) generated always as (concat(a,b)) virtual, + d varchar(5000) generated always as (b) virtual, + e int(11) generated always as (10) virtual, + h int(11) not null primary key, + index(c(100), d(20))); +insert t1 (a,b,h) values (repeat('g', 10000), repeat('x', 2800), 1); +update t1 set a = repeat(cast(1 as char), 2000); +drop table t1; + +create table t1 ( + a varchar(10000), + b varchar(3000), + c varchar(14000) generated always as (concat(a,b)) virtual, + i varchar(5000) generated always as (b) virtual, + d varchar(5000) generated always as (i) virtual, + e int(11) generated always as (10) virtual, + h int(11) not null primary key, + index(c(100), d(20))); +insert t1 (a,b,h) values (repeat('g', 10000), repeat('x', 2800), 1); +update t1 set a = repeat(cast(1 as char), 2000); +drop table t1; +# +# UPDATE disguised as INSERT +# +create table t1(a blob not null, b int, c varbinary (10) generated always as (a) virtual, unique (c(9))); +insert t1 (a,b) values ('a', 1); +replace t1 set a = 'a',b =1; +insert t1 (a,b) values ('a', 1) on duplicate key update a='b', b=2; +select * from t1; +drop table t1; + +# +# multi-UPDATE and const tables +# +create table t (a int primary key, b int, c int as (b), index (c)); +insert t (a,b) values (9,0); +create table t2 select * from t; +update t, t2 set t.b=10 where t.a=t2.a; +check table t; select * from t; +drop table t, t2; + +# +# blobs +# This tests BLOB_VALUE_ORPHANAGE +# +create table t1 (a int, b int, c int, d int, e int); +insert t1 values (1,2,3,4,5), (1,2,3,4,5); +create table t (a int primary key, + b int, c blob as (b), index (c(57)), + d blob, e blob as (d), index (e(57))) + replace select * from t1; +check table t; select * from t; +update t set a=10, b=1, d=1; +check table t; select * from t; +replace t (a,b,d) values (10,2,2); +check table t; select * from t; +--error ER_WRONG_VALUE_COUNT_ON_ROW +insert t(a,b,d) values (10) on duplicate key update b=3; +insert t(a,b,d) values (10,2,2) on duplicate key update b=3, d=3; +check table t; select * from t; +replace t (a,b,d) select 10,4,4; +check table t; select * from t; +insert t(a,b,d) select 10,4,4 on duplicate key update b=5, d=5; +check table t; select * from t; +replace delayed t (a,b,d) values (10,6,6); +flush tables; +check table t; select * from t; +insert delayed t(a,b,d) values (10,6,6) on duplicate key update b=7, d=7; +flush tables; +check table t; select * from t; +--write_file $MYSQLTEST_VARDIR/tmp/vblobs.txt +10 8 foo 8 foo +EOF +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval load data infile '$MYSQLTEST_VARDIR/tmp/vblobs.txt' replace into table t +--remove_file $MYSQLTEST_VARDIR/tmp/vblobs.txt +check table t; select * from t; +update t set a=11, b=9, d=9 where a>5; +check table t; select * from t; +create table t2 select * from t; +update t, t2 set t.b=10, t.d=10 where t.a=t2.a; +check table t; select * from t; +update t, t tt set t.b=11, tt.d=11 where t.a=tt.a; +check table t; select * from t; +drop table t, t1, t2; diff --git a/mysql-test/suite/vcol/t/vcol_blocked_sql_funcs_main.inc b/mysql-test/suite/vcol/t/vcol_blocked_sql_funcs_main.inc index 492082af30c..766d0c7410c 100644 --- a/mysql-test/suite/vcol/t/vcol_blocked_sql_funcs_main.inc +++ b/mysql-test/suite/vcol/t/vcol_blocked_sql_funcs_main.inc @@ -21,85 +21,85 @@ --echo # RAND() create or replace table t1 (b double as (rand())); --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (b double as (rand()) PERSISTENT); --echo # LOAD_FILE() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a varchar(64), b varchar(1024) as (load_file(a))); --echo # CURDATE() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a datetime as (curdate()) PERSISTENT); --echo # CURRENT_DATE(), CURRENT_DATE --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a datetime as (current_date) PERSISTENT); --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a datetime as (current_date()) PERSISTENT); --echo # CURRENT_TIME(), CURRENT_TIME --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a datetime as (current_time) PERSISTENT); --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a datetime as (current_time()) PERSISTENT); --echo # CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a datetime as (current_timestamp()) PERSISTENT); --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a datetime as (current_timestamp) PERSISTENT); --echo # CURTIME() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a datetime as (curtime()) PERSISTENT); --echo # LOCALTIME(), LOCALTIME --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a datetime, b varchar(10) as (localtime()) PERSISTENT); --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a datetime, b varchar(10) as (localtime) PERSISTENT); --echo # LOCALTIMESTAMP, LOCALTIMESTAMP()(v4.0.6) --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a datetime, b varchar(10) as (localtimestamp()) PERSISTENT); --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a datetime, b varchar(10) as (localtimestamp) PERSISTENT); --echo # NOW() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a datetime, b varchar(10) as (now()) PERSISTENT); --echo # SYSDATE() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int, b varchar(10) as (sysdate()) PERSISTENT); --echo # UNIX_TIMESTAMP() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a datetime, b datetime as (unix_timestamp()) PERSISTENT); --echo # UTC_DATE() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a datetime, b datetime as (utc_date()) PERSISTENT); --echo # UTC_TIME() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a datetime, b datetime as (utc_time()) PERSISTENT); --echo # UTC_TIMESTAMP() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a datetime, b datetime as (utc_timestamp()) PERSISTENT); --echo # WEEK() - one argument version --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a datetime, b datetime as (week(a)) PERSISTENT); --echo # MATCH() ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a varchar(32), b bool as (match a against ('sample text')) PERSISTENT); --echo # BENCHMARK() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a varchar(1024), b varchar(1024) as (benchmark(a,3))); --echo # CHARSET() @@ -113,84 +113,84 @@ create or replace table t1 (a varchar(64), b varchar(64) as (collation(a)) PERSI --echo # CONNECTION_ID() create or replace table t1 (a int as (connection_id())); --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int as (connection_id()) PERSISTENT); --echo # DATABASE() create or replace table t1 (a varchar(32) as (database())); --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a varchar(1024), b varchar(1024) as (database()) PERSISTENT); --echo # FOUND_ROWS() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a varchar(1024), b varchar(1024) as (found_rows())); --echo # GET_LOCK() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a varchar(1024), b varchar(1024) as (get_lock(a,10))); --echo # IS_FREE_LOCK() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a varchar(1024), b varchar(1024) as (is_free_lock(a))); --echo # IS_USED_LOCK() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a varchar(1024), b varchar(1024) as (is_used_lock(a))); --echo # LAST_INSERT_ID() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int as (last_insert_id())); --echo # MASTER_POS_WAIT() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a varchar(32), b int as (master_pos_wait(a,0,2))); --echo # NAME_CONST() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a varchar(32) as (name_const('test',1))); --echo # RELEASE_LOCK() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a varchar(32), b int as (release_lock(a))); --echo # ROW_COUNT() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int as (row_count())); --echo # SCHEMA() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a varchar(32) as (schema()) PERSISTENT); --echo # SESSION_USER() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a varchar(32) as (session_user()) PERSISTENT); --echo # SLEEP() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int, b int as (sleep(a))); --echo # SYSTEM_USER() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a varchar(32) as (system_user()) PERSISTENT); --echo # USER() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a varchar(1024), b varchar(1024) as (user()) PERSISTENT); --echo # UUID_SHORT() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a varchar(1024) as (uuid_short()) PERSISTENT); --echo # UUID() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a varchar(1024) as (uuid()) PERSISTENT); --echo # VALUES() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a varchar(1024), b varchar(1024) as (values(a))); --echo # VERSION() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a varchar(1024), b varchar(1024) as (version()) PERSISTENT); --echo # ENCRYPT() @@ -212,16 +212,16 @@ end // delimiter ;// --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int as (p1()) PERSISTENT); --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int as (f1()) PERSISTENT); drop procedure p1; drop function f1; --echo # Unknown functions --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int as (f1()) PERSISTENT); --echo # @@ -229,71 +229,71 @@ create or replace table t1 (a int as (f1()) PERSISTENT); --echo # --echo # AVG() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int, b int as (avg(a))); --echo # BIT_AND() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int, b int as (bit_and(a))); --echo # BIT_OR() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int, b int as (bit_or(a))); --echo # BIT_XOR() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int, b int as (bit_xor(a))); --echo # COUNT(DISTINCT) --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int, b int as (count(distinct a))); --echo # COUNT() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int, b int as (count(a))); --echo # GROUP_CONCAT() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a varchar(32), b int as (group_concat(a,''))); --echo # MAX() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int, b int as (max(a))); --echo # MIN() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int, b int as (min(a))); --echo # STD() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int, b int as (std(a))); --echo # STDDEV_POP() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int, b int as (stddev_pop(a))); --echo # STDDEV_SAMP() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int, b int as (stddev_samp(a))); --echo # STDDEV() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int, b int as (stddev(a))); --echo # SUM() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int, b int as (sum(a))); --echo # VAR_POP() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int, b int as (var_pop(a))); --echo # VAR_SAMP() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int, b int as (var_samp(a))); --echo # VARIANCE() --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int, b int as (variance(a))); --echo # @@ -311,13 +311,13 @@ create or replace table t1 (a varchar(1024), b varchar(1024) as (UpdateXML(a,'/a --echo # create or replace table t1 (a int); --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t2 (a int, b int as (select count(*) from t1)); drop table t1; --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int, b int as ((select 1))); --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int, b int as (a+(select 1))); --echo # @@ -330,7 +330,7 @@ drop function if exists sub1; create function sub1(i int) returns int deterministic return i+1; select sub1(1); --- error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a int, b int as (a+sub3(1))); drop function sub1; @@ -345,7 +345,7 @@ eval create or replace table t1 (a int, b varchar(16384) as (concat(a,'$tmp_long --disable_query_log let $tmp_long_string = `SELECT repeat('a',65535)`; ---error ER_TOO_MANY_FIELDS +--error ER_EXPRESSION_IS_TOO_BIG eval create or replace table t1 (a int, b varchar(16384) as (concat(a,'$tmp_long_string'))); --enable_query_log diff --git a/mysql-test/suite/vcol/t/vcol_handler_maria.test b/mysql-test/suite/vcol/t/vcol_handler_aria.test similarity index 100% rename from mysql-test/suite/vcol/t/vcol_handler_maria.test rename to mysql-test/suite/vcol/t/vcol_handler_aria.test diff --git a/mysql-test/suite/vcol/t/vcol_keys_aria.test b/mysql-test/suite/vcol/t/vcol_keys_aria.test new file mode 100644 index 00000000000..b7ac0d26550 --- /dev/null +++ b/mysql-test/suite/vcol/t/vcol_keys_aria.test @@ -0,0 +1,3 @@ +--source include/have_maria.inc +--error ER_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN +create table t1 (a int, b int as (a+1), c int, index(b)) engine=aria; diff --git a/mysql-test/suite/vcol/t/vcol_keys_innodb.test b/mysql-test/suite/vcol/t/vcol_keys_innodb.test index e408672ac07..8eeef96b43f 100644 --- a/mysql-test/suite/vcol/t/vcol_keys_innodb.test +++ b/mysql-test/suite/vcol/t/vcol_keys_innodb.test @@ -34,14 +34,14 @@ ##### Storage engine to be tested # Set the session storage engine --source include/have_innodb.inc -eval SET @@session.storage_engine = 'InnoDB'; +SET @@session.storage_engine = 'InnoDB'; ##### Workarounds for known open engine specific bugs # none #------------------------------------------------------------------------------# # Execute the tests to be applied to all storage engines -let $skip_spatial_index_check = 1; +let $with_foreign_keys = 1; --source suite/vcol/inc/vcol_keys.inc #------------------------------------------------------------------------------# diff --git a/mysql-test/suite/vcol/t/vcol_keys_myisam.test b/mysql-test/suite/vcol/t/vcol_keys_myisam.test index 87d7b79aa1c..68fd7e1731b 100644 --- a/mysql-test/suite/vcol/t/vcol_keys_myisam.test +++ b/mysql-test/suite/vcol/t/vcol_keys_myisam.test @@ -1,3 +1,57 @@ + +--source include/have_sequence.inc +--let $datadir= `select @@datadir` + +create table t1 (a int, b int as (a+1), c int, index(b)); +insert t1 (a,c) values (0x7890abcd, 0x76543210); +insert t1 (a,c) select seq, sin(seq)*10000 from seq_1_to_1000; +explain select * from t1 where b=10; +select * from t1 where b=10; +--replace_result $datadir datadir +--exec $MYISAMCHK -d $datadir/test/t1 +update t1 set a=20 where b=10; +select * from t1 where b=10; +select * from t1 where b=21; +delete from t1 where b=21; +select * from t1 where b=21; +alter table t1 add column d char(20) as (concat(a,c)); +select * from t1 where b=11; +create index i on t1 (d); +check table t1; +select * from t1 where b=11; +check table t1 quick; +select * from t1 where b=11; +check table t1 medium; +select * from t1 where b=11; +check table t1 extended; +show keys from t1; +select * from t1 where b=11; +delete from t1 where b=12; +analyze table t1; +show keys from t1; +select * from t1 where b=11; +optimize table t1; +show keys from t1; +select * from t1 where b=11; +repair table t1; +select * from t1 where b=11; +repair table t1 quick; +select * from t1 where b=11; +repair table t1 extended; +select * from t1 where b=11; +repair table t1 use_frm; +select * from t1 where b=11; +update t1 set a=30 where b=11; +select * from t1 where b=11; +select * from t1 where b=31; + +--error 1 +--exec $MYISAMCHK $datadir/test/t1 +--error 1 +--exec $MYISAMCHK -r $datadir/test/t1 + +drop table t1; + ################################################################################ # t/vcol_keys_myisam.test # # # @@ -33,7 +87,7 @@ ##### Storage engine to be tested # Set the session storage engine -eval SET @@session.storage_engine = 'MyISAM'; +SET @@session.storage_engine = 'MyISAM'; ##### Workarounds for known open engine specific bugs # none diff --git a/mysql-test/suite/vcol/t/vcol_merge.test b/mysql-test/suite/vcol/t/vcol_merge.test index a1d3c628c8e..ee1511ee26f 100644 --- a/mysql-test/suite/vcol/t/vcol_merge.test +++ b/mysql-test/suite/vcol/t/vcol_merge.test @@ -48,7 +48,7 @@ create table t1 (a int, b int as (a % 10)); create table t2 (a int, b int as (a % 10)); insert into t1 values (1,default); insert into t2 values (2,default); ---error ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS +--error ER_UNSUPPORTED_ENGINE_FOR_GENERATED_COLUMNS create table t3 (a int, b int as (a % 10)) engine=MERGE UNION=(t1,t2); drop table t1,t2; diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test index 4ca9562221c..2387000c3ef 100644 --- a/mysql-test/suite/vcol/t/vcol_misc.test +++ b/mysql-test/suite/vcol/t/vcol_misc.test @@ -269,9 +269,9 @@ INSERT INTO `test`.`t1`(`a`,`b`,`c`,`d`) VALUES ( '1','a',NULL,NULL); UPDATE `test`.`t1` SET `d`='b' WHERE `a`='1' AND `b`='a' AND `c`='1' AND `d`='a'; INSERT INTO `test`.`t1`(`a`,`b`,`c`,`d`) VALUES ( '1','a',NULL,'a'); set sql_mode='strict_all_tables'; ---error ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN +--error ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN UPDATE `test`.`t1` SET `d`='b' WHERE `a`='1' AND `b`='a' AND `c`='1' AND `d`='a'; ---error ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN +--error ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN INSERT INTO `test`.`t1`(`a`,`b`,`c`,`d`) VALUES ( '1','a',NULL,'a'); drop table t1; diff --git a/mysql-test/suite/wsrep/r/mdev_10186.result b/mysql-test/suite/wsrep/r/mdev_10186.result index f966c443569..778c064d208 100644 --- a/mysql-test/suite/wsrep/r/mdev_10186.result +++ b/mysql-test/suite/wsrep/r/mdev_10186.result @@ -7,5 +7,5 @@ SELECT @@wsrep_on; 0 SELECT @@GLOBAL.wsrep_provider; @@GLOBAL.wsrep_provider -/usr/lib/galera/libgalera_smm.so +libgalera_smm.so SET @@GLOBAL.wsrep_cluster_address='gcomm://'; diff --git a/mysql-test/suite/wsrep/r/wsrep_rpl.result b/mysql-test/suite/wsrep/r/wsrep_rpl.result new file mode 100644 index 00000000000..20ebb4802de --- /dev/null +++ b/mysql-test/suite/wsrep/r/wsrep_rpl.result @@ -0,0 +1,33 @@ +include/master-slave.inc +[connection master] +# +# MDEV-10714: Could not execute Delete_rows event on table; +# wsrep_max_ws_rows exceeded. Error_Code 1180 +# +connection master; +connection slave; +connection master; +CREATE TABLE t1(i INT) ENGINE = INNODB; +SET @@GLOBAL.wsrep_max_ws_rows = 1; +INSERT INTO t1 VALUES(1), (2); +connection slave; +SELECT COUNT(*) = 2 FROM t1; +COUNT(*) = 2 +1 +connection slave; +SET @@GLOBAL.wsrep_max_ws_rows = 1; +connection master; +DELETE FROM t1; +connection slave; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +connection master; +DROP TABLE t1; +connection slave; +connection master; +SET @@GLOBAL.wsrep_max_ws_rows = 0; +connection slave; +SET @@GLOBAL.wsrep_max_ws_rows = 0; +include/rpl_end.inc +# End of test. diff --git a/mysql-test/suite/wsrep/t/mdev_10186.test b/mysql-test/suite/wsrep/t/mdev_10186.test index 90665d3c97f..98ea5192634 100644 --- a/mysql-test/suite/wsrep/t/mdev_10186.test +++ b/mysql-test/suite/wsrep/t/mdev_10186.test @@ -7,7 +7,7 @@ --echo # SELECT @@wsrep_on; ---replace_result /usr/lib64/ /usr/lib/ +--replace_regex /.*libgalera_smm.so/libgalera_smm.so/ SELECT @@GLOBAL.wsrep_provider; SET @@GLOBAL.wsrep_cluster_address='gcomm://'; diff --git a/mysql-test/suite/wsrep/t/wsrep_rpl.cnf b/mysql-test/suite/wsrep/t/wsrep_rpl.cnf new file mode 100644 index 00000000000..56e874f22e1 --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep_rpl.cnf @@ -0,0 +1 @@ +!include ../../rpl/my.cnf diff --git a/mysql-test/suite/wsrep/t/wsrep_rpl.test b/mysql-test/suite/wsrep/t/wsrep_rpl.test new file mode 100644 index 00000000000..1cc7214325d --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep_rpl.test @@ -0,0 +1,50 @@ +--source include/have_wsrep.inc +--source include/have_innodb.inc +--source include/master-slave.inc + +--echo # +--echo # MDEV-10714: Could not execute Delete_rows event on table; +--echo # wsrep_max_ws_rows exceeded. Error_Code 1180 +--echo # +# Save wsrep_max_ws_rows on master and slave. +connection master; +let $wsrep_max_ws_rows_master = `SELECT @@GLOBAL.wsrep_max_ws_rows`; +connection slave; +let $wsrep_max_ws_rows_slave = `SELECT @@GLOBAL.wsrep_max_ws_rows`; + +connection master; +CREATE TABLE t1(i INT) ENGINE = INNODB; + +# Setting wsrep_max_ws_rows should have no impact on replication master +# unless its a cluster node. +SET @@GLOBAL.wsrep_max_ws_rows = 1; +INSERT INTO t1 VALUES(1), (2); + +sync_slave_with_master; +SELECT COUNT(*) = 2 FROM t1; + +connection slave; +# Setting wsrep_max_ws_rows should have no impact on replication slave +# unless its a cluster node. +SET @@GLOBAL.wsrep_max_ws_rows = 1; + +connection master; +DELETE FROM t1; + +sync_slave_with_master; +SELECT COUNT(*) = 0 FROM t1; + +connection master; +DROP TABLE t1; + +sync_slave_with_master; + +# Restore wsrep_max_ws_rows on master and slave +connection master; +eval SET @@GLOBAL.wsrep_max_ws_rows = $wsrep_max_ws_rows_master; +connection slave; +eval SET @@GLOBAL.wsrep_max_ws_rows = $wsrep_max_ws_rows_slave; + +--source include/rpl_end.inc +--echo # End of test. + diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index a84b22c69b6..b48841d9407 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -1710,6 +1710,35 @@ CREATE TABLE t1 ( ALTER TABLE t1 ADD PRIMARY KEY IF NOT EXISTS event_id (event_id,market_id); DROP TABLE t1; +--echo # +--echo # MDEV-11126 Crash while altering persistent virtual column +--echo # + +CREATE TABLE `tab1` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `field2` set('option1','option2','option3','option4') NOT NULL, + `field3` set('option1','option2','option3','option4','option5') NOT NULL, + `field4` set('option1','option2','option3','option4') NOT NULL, + `field5` varchar(32) NOT NULL, + `field6` varchar(32) NOT NULL, + `field7` varchar(32) NOT NULL, + `field8` varchar(32) NOT NULL, + `field9` int(11) NOT NULL DEFAULT '1', + `field10` varchar(16) NOT NULL, + `field11` enum('option1','option2','option3') NOT NULL DEFAULT 'option1', + `v_col` varchar(128) AS (IF(field11='option1',CONCAT_WS(":","field1",field2,field3,field4,field5,field6,field7,field8,field9,field10), CONCAT_WS(":","field1",field11,field2,field3,field4,field5,field6,field7,field8,field9,field10))) PERSISTENT, + PRIMARY KEY (`id`) +) DEFAULT CHARSET=latin1; + +ALTER TABLE `tab1` CHANGE COLUMN v_col `v_col` varchar(128); +SHOW CREATE TABLE `tab1`; +ALTER TABLE `tab1` CHANGE COLUMN v_col `v_col` varchar(128) AS (IF(field11='option1',CONCAT_WS(":","field1",field2,field3,field4,field5,field6,field7,field8,field9,field10), CONCAT_WS(":","field1",field11,field2,field3,field4,field5,field6,field7,field8,field9,field10))) PERSISTENT; +SHOW CREATE TABLE `tab1`; +DROP TABLE `tab1`; +--echo # +--echo # Start of 10.1 tests +--echo # + --echo # --echo # MDEV-7374 : Losing connection to MySQL while running ALTER TABLE --echo # @@ -1719,10 +1748,6 @@ INSERT INTO t1 SELECT a.* FROM t1 a, t1 b, t1 c, t1 d, t1 e; ALTER TABLE t1 MODIFY i FLOAT; DROP TABLE t1; ---echo # ---echo # Start of 10.1 tests ---echo # - --echo # --echo # MDEV-7816 ALTER with DROP INDEX and ADD INDEX .. COMMENT='comment2' ignores the new comment --echo # diff --git a/mysql-test/t/analyze_stmt_slow_query_log.test b/mysql-test/t/analyze_stmt_slow_query_log.test index 7346ac3b2c5..44865b652cb 100644 --- a/mysql-test/t/analyze_stmt_slow_query_log.test +++ b/mysql-test/t/analyze_stmt_slow_query_log.test @@ -2,6 +2,21 @@ drop table if exists t1; --enable_warnings +# +# Remove old log file +# +let SLOW_LOG_FILE= `select @@slow_query_log_file`; + +SET @@global.slow_query_log = OFF; + +perl; + my $slow_log_file= $ENV{'SLOW_LOG_FILE'} or die "SLOW_LOG_FILE not set"; + unlink($slow_log_file); +EOF + +FLUSH SLOW LOGS; +SET @@global.slow_query_log = ON; + create table t1 (a int); INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); select * from t1 where a<3; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index d619fed240f..0be9537350b 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -1761,3 +1761,9 @@ drop function f1; # --error ER_TABLE_MUST_HAVE_COLUMNS create table t1; + +# +# MDEV-11231 Server crashes in check_duplicate_key on CREATE TABLE ... SELECT +# +create table t1 (i int, j int, key(i), key(i)) as select 1 as i, 2 as j; +drop table t1; diff --git a/mysql-test/t/create_drop_server.test b/mysql-test/t/create_drop_server.test index d634cc1ccf1..1b9e9b2a788 100644 --- a/mysql-test/t/create_drop_server.test +++ b/mysql-test/t/create_drop_server.test @@ -23,3 +23,12 @@ CREATE OR REPLACE SERVER IF NOT EXISTS server_1 FOREIGN DATA WRAPPER mysql OPTIO CREATE OR REPLACE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test4'); SELECT server_name, username, db FROM mysql.servers; DROP SERVER server_1; + + +# MDEV-726 convert host names to lowercase + +CREATE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'Remote', HOST 'Server.Example.Com', DATABASE 'test'); +SELECT Host FROM mysql.servers WHERE Server_Name = 'server_1'; +ALTER SERVER server_1 OPTIONS(HOST 'Server.Example.Org'); +SELECT Host FROM mysql.servers WHERE Server_Name = 'server_1'; +DROP SERVER server_1; diff --git a/mysql-test/t/create_or_replace.test b/mysql-test/t/create_or_replace.test index 6d744679d67..abf470b62d5 100644 --- a/mysql-test/t/create_or_replace.test +++ b/mysql-test/t/create_or_replace.test @@ -384,3 +384,15 @@ drop table t1; # Cleanup # DROP TABLE t2; + +--echo # +--echo # MDEV-10824 - Crash in CREATE OR REPLACE TABLE t1 AS SELECT spfunc() +--echo # +CREATE TABLE t1(a INT); +CREATE FUNCTION f1() RETURNS VARCHAR(16383) RETURN 'test'; +CREATE OR REPLACE TABLE t1 AS SELECT f1(); +LOCK TABLE t1 WRITE; +CREATE OR REPLACE TABLE t1 AS SELECT f1(); +UNLOCK TABLES; +DROP FUNCTION f1; +DROP TABLE t1; diff --git a/mysql-test/t/create_or_replace2.test b/mysql-test/t/create_or_replace2.test index be1bd9a3d81..6cee7fac2e9 100644 --- a/mysql-test/t/create_or_replace2.test +++ b/mysql-test/t/create_or_replace2.test @@ -5,7 +5,7 @@ --source include/have_debug.inc --source include/master-slave.inc --source include/have_binlog_format_row.inc ---source include/have_xtradb.inc +--source include/have_innodb.inc --disable_warnings drop table if exists t1; diff --git a/mysql-test/t/cte_recursive.test b/mysql-test/t/cte_recursive.test index 8a07b3ae75a..63bcfbffeb9 100644 --- a/mysql-test/t/cte_recursive.test +++ b/mysql-test/t/cte_recursive.test @@ -1361,4 +1361,126 @@ select * from t1; drop table t1,t2; +--echo # +--echo # MDEV-11278: non-mergeable view in the spec of recursive CTE +--echo # +create table t1 (a int); +insert into t1 values + (0), (1), (2), (3), (4); +create table t2 (a int); +insert into t2 values + (1), (2), (3), (4), (5); + +create view v1 as + select a from t2 where a < 3 + union + select a from t2 where a > 4; + +with recursive +t1 as +( +select a from v1 where a=1 +union +select v1.a from t1,v1 where t1.a+1=v1.a +) +select * from t1; + +drop view v1; +drop table t1,t2; + + +--echo # +--echo # MDEV-11259: recursive CTE with concatenation operation +--echo # + +DROP TABLE IF EXISTS edges; +CREATE TABLE edges( + a int(10) unsigned NOT NULL, + b int(10) unsigned NOT NULL, + PRIMARY KEY (a,b), + KEY b(b) +); + +INSERT INTO edges + VALUES (1,3),(2,1),(2,4),(3,4),(3,5),(3,6),(4,7),(5,1),(5,6),(6,1); + +DROP TABLE IF EXISTS edges2; +CREATE VIEW edges2 (a, b) AS + SELECT a, b FROM edges UNION ALL SELECT b, a FROM edges; + +--sorted_result +WITH RECURSIVE transitive_closure(a, b, distance, path_string) AS +( SELECT a, b, 1 AS distance, + concat(a, '.', b, '.') AS path_string + FROM edges + + UNION ALL + + SELECT tc.a, e.b, tc.distance + 1, + concat(tc.path_string, e.b, '.') AS path_string + FROM edges AS e + JOIN transitive_closure AS tc + ON e.a = tc.b + WHERE tc.path_string NOT LIKE concat('%', e.b, '.%') +) +SELECT * FROM transitive_closure +ORDER BY a, b, distance; + +--sorted_result +WITH RECURSIVE transitive_closure(a, b, distance, path_string) AS +( SELECT a, b, 1 AS distance, + concat(a, '.', b, '.') AS path_string + FROM edges + WHERE a = 1 -- source + + UNION ALL + + SELECT tc.a, e.b, tc.distance + 1, + concat(tc.path_string, e.b, '.') AS path_string + FROM edges AS e + JOIN transitive_closure AS tc ON e.a = tc.b + WHERE tc.path_string NOT LIKE concat('%', e.b, '.%') +) + SELECT * FROM transitive_closure + WHERE b = 6 -- destination +ORDER BY a, b, distance; + +--sorted_result +WITH RECURSIVE transitive_closure(a, b, distance, path_string) AS +( SELECT a, b, 1 AS distance, + concat(a, '.', b, '.') AS path_string + FROM edges2 + + UNION ALL + + SELECT tc.a, e.b, tc.distance + 1, + concat(tc.path_string, e.b, '.') AS path_string + FROM edges2 AS e + JOIN transitive_closure AS tc ON e.a = tc.b + WHERE tc.path_string NOT LIKE concat('%', e.b, '.%') +) +SELECT * FROM transitive_closure +ORDER BY a, b, distance; + +--sorted_result +WITH RECURSIVE transitive_closure(a, b, distance, path_string) +AS +( SELECT a, b, 1 AS distance, + concat(a, '.', b, '.') AS path_string + FROM edges2 + + UNION ALL + + SELECT tc.a, e.b, tc.distance + 1, + concat(tc.path_string, e.b, '.') AS path_string + FROM edges2 AS e + JOIN transitive_closure AS tc ON e.a = tc.b + WHERE tc.path_string NOT LIKE concat('%', e.b, '.%') +) +SELECT a, b, min(distance) AS dist FROM transitive_closure +GROUP BY a, b +ORDER BY a, dist, b; + +DROP VIEW edges2; +DROP TABLE edges; diff --git a/mysql-test/t/ctype_ldml.test b/mysql-test/t/ctype_ldml.test index 956e48ba4af..1d58daa89e4 100644 --- a/mysql-test/t/ctype_ldml.test +++ b/mysql-test/t/ctype_ldml.test @@ -499,3 +499,106 @@ SELECT HEX(a), REPLACE(a,' ','') FROM t1 WHERE a='a'; SELECT HEX(a), REPLACE(a,' ','') FROM t1 ORDER BY a; SELECT HEX(a), REPLACE(a,' ','') FROM t1 ORDER BY a DESC; DROP TABLE t1; + + +SET NAMES utf8 COLLATE utf8_czech_test_w2; +CREATE TABLE t1 AS SELECT SPACE(10) AS c1 LIMIT 0; +--source include/ctype_unicode_latin.inc +INSERT INTO t1 VALUES ('a '); +SELECT c1, HEX(WEIGHT_STRING(c1 LEVEL 1)), HEX(WEIGHT_STRING(c1 LEVEL 2)) FROM t1 ORDER BY c1, BINARY c1; +SELECT c1, HEX(WEIGHT_STRING(c1 AS CHAR(3) LEVEL 1)), HEX(WEIGHT_STRING(c1 AS CHAR(3) LEVEL 2)) FROM t1 WHERE c1 BETWEEN 'a' AND 'aZ' ORDER BY c1, BINARY c1; +DROP TABLE t1; + +SELECT 'a' = 'a '; +SELECT 'a' < 'á'; +SELECT 'áa' < 'ab'; +SELECT 'á' < 'ä'; +SELECT 'äa' < 'áb'; +SELECT 'c' < 'Ä'; +SELECT 'cb' < 'Äa'; +SELECT 'd' < 'Ä'; +SELECT 'Äa' < 'db'; +SELECT 'e' < 'é'; +SELECT 'éa' < 'eb'; +SELECT 'é' < 'Ä›'; +SELECT 'Ä›a' < 'éb'; +SELECT 'i' < 'í'; +SELECT 'ía' < 'ib'; +SELECT 'n' < 'ň'; +SELECT 'ňa' < 'nb'; +SELECT 'o' < 'ó'; +SELECT 'óa' < 'ob'; +SELECT 'ó' < 'ö'; +SELECT 'öa' < 'ób'; +SELECT 'r' < 'Å™'; +SELECT 'rb' < 'Å™a'; +SELECT 's' < 'Å¡'; +SELECT 'sb' < 'Å¡a'; +SELECT 't' < 'Å¥'; +SELECT 'Å¥a' < 'tb'; +SELECT 'u' < 'ú'; +SELECT 'úa' < 'ub'; +SELECT 'ú' < 'ů'; +SELECT 'ůa' < 'úb'; +SELECT 'ů' < 'ü'; +SELECT 'üa' < 'ůb'; +SELECT 'y' < 'ý'; +SELECT 'ýa' < 'yb'; +SELECT 'z' < 'ž'; +SELECT 'zb' < 'ža'; +SELECT 'hž' < 'ch'; +SELECT 'chž'< 'i'; + + + +SET NAMES utf8 COLLATE utf8_czech_test_nopad_w2; +CREATE TABLE t1 AS SELECT SPACE(10) AS c1 LIMIT 0; +--source include/ctype_unicode_latin.inc +INSERT INTO t1 VALUES ('a '); +SELECT c1, HEX(WEIGHT_STRING(c1 LEVEL 1)), HEX(WEIGHT_STRING(c1 LEVEL 2)) FROM t1 ORDER BY c1, BINARY c1; +SELECT c1, HEX(WEIGHT_STRING(c1 AS CHAR(3) LEVEL 1)), HEX(WEIGHT_STRING(c1 AS CHAR(3) LEVEL 2)) FROM t1 WHERE c1 BETWEEN 'a' AND 'aZ' ORDER BY c1, BINARY c1; +DROP TABLE t1; + +SELECT 'a' = 'a '; +SELECT 'a' < 'á'; +SELECT 'áa' < 'ab'; +SELECT 'á' < 'ä'; +SELECT 'äa' < 'áb'; +SELECT 'c' < 'Ä'; +SELECT 'cb' < 'Äa'; +SELECT 'd' < 'Ä'; +SELECT 'Äa' < 'db'; +SELECT 'e' < 'é'; +SELECT 'éa' < 'eb'; +SELECT 'é' < 'Ä›'; +SELECT 'Ä›a' < 'éb'; +SELECT 'i' < 'í'; +SELECT 'ía' < 'ib'; +SELECT 'n' < 'ň'; +SELECT 'ňa' < 'nb'; +SELECT 'o' < 'ó'; +SELECT 'óa' < 'ob'; +SELECT 'ó' < 'ö'; +SELECT 'öa' < 'ób'; +SELECT 'r' < 'Å™'; +SELECT 'rb' < 'Å™a'; +SELECT 's' < 'Å¡'; +SELECT 'sb' < 'Å¡a'; +SELECT 't' < 'Å¥'; +SELECT 'Å¥a' < 'tb'; +SELECT 'u' < 'ú'; +SELECT 'úa' < 'ub'; +SELECT 'ú' < 'ů'; +SELECT 'ůa' < 'úb'; +SELECT 'ů' < 'ü'; +SELECT 'üa' < 'ůb'; +SELECT 'y' < 'ý'; +SELECT 'ýa' < 'yb'; +SELECT 'z' < 'ž'; +SELECT 'zb' < 'ža'; +SELECT 'hž' < 'ch'; +SELECT 'chž'< 'i'; + + +--error ER_UNKNOWN_COLLATION +SELECT 'a' COLLATE utf8_czech_test_bad_w2; diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index aa5838e7c6d..cad82222ac7 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -974,6 +974,46 @@ let $coll='ucs2_nopad_bin'; let $coll_pad='ucs2_bin'; --source include/ctype_pad_all_engines.inc +--echo # +--echo # MDEV-10585 EXECUTE IMMEDIATE statement +--echo # +SET character_set_connection=ucs2; +EXECUTE IMMEDIATE 'SELECT COLLATION("a")'; + +SET @stmt='SELECT COLLATION("a")'; +EXECUTE IMMEDIATE @stmt; + +--echo # +--echo # MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions +--echo # +SET NAMES utf8, collation_connection=ucs2_bin; +SET @stmt='SELECT COLLATION(''a'')'; +EXECUTE IMMEDIATE @stmt; + +SET NAMES utf8, character_set_connection=ucs2; +SET @stmt='SELECT COLLATION(''a'')'; +EXECUTE IMMEDIATE @stmt; + +EXECUTE IMMEDIATE CONCAT('SELECT ''a'' FROM DUAL'); + +SELECT HEX('aä') FROM DUAL; +EXECUTE IMMEDIATE 'SELECT HEX(''aä'') FROM DUAL'; +EXECUTE IMMEDIATE CONCAT('SELECT HEX(''aä'') FROM DUAL'); +EXECUTE IMMEDIATE CONCAT('SELECT HEX(''aä'') FROM ', 'DUAL'); +PREPARE stmt FROM 'SELECT HEX(''aä'') FROM DUAL'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; + +SET @table='DUAL'; +SELECT HEX(@table); +EXECUTE IMMEDIATE CONCAT('SELECT HEX(''aä'') FROM ', @table); +EXECUTE IMMEDIATE CONCAT('SELECT HEX(''aä'') FROM ', CONVERT(@table USING utf8)); +SET @stmt='SELECT HEX(''aä'') FROM DUAL'; +EXECUTE IMMEDIATE @stmt; +PREPARE stmt FROM @stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; + --echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/t/ctype_utf32.test b/mysql-test/t/ctype_utf32.test index 2fe075f24ef..f364f1bd3a5 100644 --- a/mysql-test/t/ctype_utf32.test +++ b/mysql-test/t/ctype_utf32.test @@ -889,6 +889,11 @@ SELECT CHAR_LENGTH(TRIM(BOTH 0x0001 FROM _utf32 0x00000061)); SELECT CHAR_LENGTH(TRIM(BOTH 0x61 FROM _utf32 0x00000061)); SELECT CHAR_LENGTH(TRIM(BOTH 0x00 FROM _utf32 0x00000061)); +# +# potential signedness issue +# +select hex(lower(cast(0xffff0000 as char character set utf32))) as c; + --echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 352359a03b6..0b0e5dc37b2 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1701,6 +1701,20 @@ SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65535) AS data) AS sub; SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65536) AS data) AS sub; SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65537) AS data) AS sub; +--echo # +--echo # MDEV-10717 Assertion `!null_value' failed in virtual bool Item::send(Protocol*, String*) +--echo # +CREATE TABLE t1 (i INT, KEY(i)); +INSERT INTO t1 VALUES (20081205),(20050327); +SELECT HEX(i), HEX(CHAR(i USING utf8)) FROM t1; +SET sql_mode='STRICT_ALL_TABLES'; +SELECT HEX(i), HEX(CHAR(i USING utf8)) FROM t1; +# Avoid garbage in the output +--replace_column 1 ### +SELECT CHAR(i USING utf8) FROM t1; +SET sql_mode=DEFAULT; +DROP TABLE t1; + --echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/ctype_utf8mb4.test b/mysql-test/t/ctype_utf8mb4.test index 12fb5455e20..55aad5b1454 100644 --- a/mysql-test/t/ctype_utf8mb4.test +++ b/mysql-test/t/ctype_utf8mb4.test @@ -1868,6 +1868,14 @@ set @@collation_connection=utf8mb4_bin; --echo # Start of 10.0 tests --echo # +--echo # +--echo # MDEV-11343 LOAD DATA INFILE fails to load data with an escape character followed by a multi-byte character +--echo # +CREATE TABLE t1 (a TEXT CHARACTER SET utf8mb4); +LOAD DATA INFILE '../../std_data/loaddata/mdev-11343.txt' INTO TABLE t1 CHARACTER SET utf8mb4; +SELECT HEX(a) FROM t1; +DROP TABLE t1; + --echo # --echo # MDEV-6566 Different INSERT behaviour on bad bytes with and without character set conversion --echo # @@ -1909,10 +1917,6 @@ DROP TABLE t1; --echo # End of 10.0 tests --echo # ---echo # ---echo # End of tests ---echo # - --echo # --echo # Start of 10.1 tests --echo # @@ -1964,6 +1968,21 @@ let $coll='utf8mb4_nopad_bin'; let $coll_pad='utf8mb4_bin'; --source include/ctype_pad_all_engines.inc +--echo # +--echo # MDEV-10867 PREPARE..EXECUTE is not consistent about non-ASCII characters +--echo # +SET NAMES utf8mb4; +SELECT '😎' AS c; + +SET @src='SELECT ''😎'' AS c'; +PREPARE stmt FROM @src; +EXECUTE stmt; +EXECUTE IMMEDIATE @src; + +PREPARE stmt FROM 'SELECT ''😎'' AS c'; +EXECUTE stmt; +EXECUTE IMMEDIATE 'SELECT ''😎'' AS c'; + --echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/t/debug_sync.test b/mysql-test/t/debug_sync.test index aead6f3ac2e..89414939f59 100644 --- a/mysql-test/t/debug_sync.test +++ b/mysql-test/t/debug_sync.test @@ -381,21 +381,40 @@ DROP TABLE IF EXISTS t1; --enable_warnings # # Test. -CREATE TABLE t1 (c1 INT); -LOCK TABLE t1 READ; - connect (con1,localhost,root,,); - # Retain action after use. First used by general_log. - SET DEBUG_SYNC= 'wait_for_lock SIGNAL locked EXECUTE 2'; - send INSERT INTO t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1); +SELECT GET_LOCK('mysqltest_lock', 100); + +connect (con1,localhost,root,,); +--echo # Sending: +--send UPDATE t1 SET c1=GET_LOCK('mysqltest_lock', 100); + +connect (con2,localhost,root,,); +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "User lock" and + info = "UPDATE t1 SET c1=GET_LOCK('mysqltest_lock', 100)"; +--source include/wait_condition.inc + +# Retain action after use. First used by general_log. +SET DEBUG_SYNC= 'wait_for_lock SIGNAL locked EXECUTE 2'; +send INSERT INTO t1 VALUES (1); + connection default; # Wait until INSERT waits for lock. SET DEBUG_SYNC= 'now WAIT_FOR locked'; -# let INSERT continue. -UNLOCK TABLES; - connection con1; - --echo retrieve INSERT result. - reap; - disconnect con1; +# let UPDATE continue. +SELECT RELEASE_LOCK('mysqltest_lock'); +connection con1; +--echo # Reaping UPDATE +reap; +SELECT RELEASE_LOCK('mysqltest_lock'); + +connection con2; +--echo retrieve INSERT result. +reap; +disconnect con1; +disconnect con2; connection default; DROP TABLE t1; diff --git a/mysql-test/t/default.test b/mysql-test/t/default.test index 6c871527212..41ed1613448 100644 --- a/mysql-test/t/default.test +++ b/mysql-test/t/default.test @@ -168,6 +168,49 @@ drop table t1, t2; --echo # End of 5.0 tests +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-11265 Access defied when CREATE VIIEW v1 AS SELECT DEFAULT(column) FROM t1 +--echo # + +CREATE TABLE t1 (a INT DEFAULT 10); +INSERT INTO t1 VALUES (11); +CREATE VIEW v1 AS SELECT a AS a FROM t1; +CREATE VIEW v2 AS SELECT DEFAULT(a) AS a FROM t1; +CREATE VIEW v3 AS SELECT VALUES(a) AS a FROM t1; +SELECT * FROM v1; +SELECT * FROM v2; +SELECT * FROM v3; +--error ER_NONUPDATEABLE_COLUMN +UPDATE v2 SET a=123; +--error ER_NONUPDATEABLE_COLUMN +UPDATE v3 SET a=123; +DROP VIEW v3; +DROP VIEW v2; +DROP VIEW v1; +DROP TABLE t1; + +--echo # +--echo # MDEV-10780 Server crashes in in create_tmp_table +--echo # + +# Note, the problem was not repeatable with a non-fresh connection. +--connect (con1,localhost,root,,test) +CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=MyISAM; +INSERT INTO t1 VALUES (); +INSERT INTO t1 VALUES (); +SELECT DISTINCT DEFAULT (pk) FROM t1 GROUP BY RAND() WITH ROLLUP; +--disconnect con1 +--connection default +DROP TABLE t1; + +--echo # +--echo # End of 10.0 tests +--echo # + --echo # --echo # Start of 10.1 tests --echo # @@ -321,9 +364,9 @@ drop table t1; --echo # Error handling --echo # ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a bigint default xxx()); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t1 (a bigint default (select (1))); --error ER_OPERAND_COLUMNS create or replace table t1 (a bigint default (1,2,3)); @@ -338,13 +381,13 @@ CREATE TABLE t1 (a INT, b INT DEFAULT -a); --echo # Invalid DEFAULT expressions --echo # ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT ((SELECT 1))); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT (EXISTS (SELECT 1))); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT (1=ANY (SELECT 1))); --error ER_OPERAND_COLUMNS @@ -364,39 +407,39 @@ CREATE TABLE t1 (a INT DEFAULT(?)); --error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD CREATE TABLE t1 (a INT DEFAULT (b), b INT DEFAULT(a)); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT @v); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT @v:=1); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT(NAME_CONST('xxx', 'yyy')); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT COUNT(*)); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT COUNT(1)); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT AVG(1)); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT MIN(1)); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT GROUP_CONCAT(1)); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT ROW_NUMBER() OVER ()); CREATE FUNCTION f1() RETURNS INT RETURN 1; ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT f1()); DROP FUNCTION f1; ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE PROCEDURE p1(par INT) CREATE TABLE t1 (a INT DEFAULT par); --error ER_BAD_FIELD_ERROR @@ -407,18 +450,18 @@ CREATE PROCEDURE p1() CREATE TABLE t1 (a INT DEFAULT par); CALL p1; DROP PROCEDURE p1; ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT VALUES(a)); CREATE TABLE t1 (a INT); # "Explicit or implicit commit is not allowed in stored function or trigger # because the entire CREATE TABLE is actually not allowed in triggers! ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW CREATE TABLE t2 (a INT DEFAULT NEW.a); # This is OK to return Function or expression is not allowed for 'DEFAULT' # because CREATE TEMPORARY TABLE is allowed in triggers ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW CREATE TEMPORARY TABLE t2 (a INT DEFAULT NEW.a); DROP TABLE t1; @@ -448,11 +491,12 @@ DEALLOCATE PREPARE stmt; # We can't have an expression for prepared statements # -PREPARE stmt FROM 'CREATE TABLE t1 (a INT DEFAULT(?+?))'; +prepare stmt from 'create table t1 (a int default(?+?))'; set @a=1; ---error ER_PARSE_ERROR execute stmt using @a,@a; -DEALLOCATE PREPARE stmt; +deallocate prepare stmt; +show create table t1; +drop table t1; --echo # --echo # Parenthesized Item_basic_constant @@ -929,37 +973,37 @@ INSERT INTO t1 VALUES (); SELECT a>0 FROM t1; DROP TABLE t1; ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT BENCHMARK(1,1)); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT GET_LOCK('a',1)); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT RELEASE_LOCK('a')); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT IS_USED_LOCK('a')); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT IS_FREE_LOCK('a')); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT SLEEP(1)); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT ROW_COUNT()); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT FOUND_ROWS()); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT MASTER_POS_WAIT('test',100)); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT MASTER_GTID_WAIT('test')); ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a VARCHAR(30), b DOUBLE DEFAULT MATCH (a) AGAINST('bbbb' IN BOOLEAN MODE)); --echo # @@ -1593,7 +1637,7 @@ INSERT INTO t1 VALUES (0x50006,'Y','N','',64,DEFAULT); SELECT * FROM t1; DROP TABLE t1; ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a VARCHAR(30), b BLOB DEFAULT LOAD_FILE(a)); --echo # @@ -1721,7 +1765,7 @@ DROP TABLE t1; --echo # # QQ: LAST_INSERT_ID() should probably be allowed ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 ( id SERIAL PRIMARY KEY, @@ -1836,3 +1880,159 @@ create table t3 as select max(a), max(b), max(c) from t1; show create table t2; show create table t3; drop table t1, t2, t3; + +--echo # MDEV-11359: Implement IGNORE for bulk operation +create table t1 (a int primary key default 0, b int default 3); +insert into t1 values (1, ignore); +insert into t1 values (2, ignore); +replace into t1 values (2, ignore); +replace into t1 values (3, ignore); +replace into t1 values (4, 6); +replace into t1 values (5, 7); +update t1 set a=6,b=ignore where a=5; +insert into t1 values (ignore, ignore); +--error ER_DUP_ENTRY +insert into t1 values (ignore, ignore); +select * from t1 order by a; +delete from t1 where a < 4; +--echo # actually insert default instead of ignoring +--echo # (but REPLACE is non standard operator) +replace into t1 values (4, ignore); +select * from t1 order by a; +drop table t1; + +#using in load +create table t1 (a int default 100, b int, c varchar(60) default 'x'); +load data infile '../../std_data/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10, c=ignore; +select * from t1; +drop table t1; + +#using in duplicate +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT); +CREATE TABLE t2 (a INT); +INSERT INTO t2 VALUES (1),(2),(3),(2); +INSERT INTO t1 SELECT a FROM t2 ON DUPLICATE KEY UPDATE a=DEFAULT; +SELECT * FROM t1 order by a; +truncate table t1; +# efectively it is DEFALT +INSERT INTO t1 SELECT a FROM t2 ON DUPLICATE KEY UPDATE a=IGNORE; +SELECT * FROM t1 order by a; +DROP TABLE t1,t2; + +create table t1 (a int primary key default 0, b int default 3); +prepare insstmt from "insert into t1 values (?, ?)"; +prepare repstmt from "replace into t1 values (?, ?)"; +prepare updstmt from "update t1 set a=6,b=? where a=5"; +execute insstmt using 1, ignore; +execute insstmt using 2, ignore; +execute repstmt using 2, ignore; +execute repstmt using 3, ignore; +execute repstmt using 4, 6; +execute repstmt using 5, 7; +execute updstmt using ignore; +execute insstmt using ignore, ignore; +--error ER_DUP_ENTRY +execute insstmt using ignore, ignore; +select * from t1 order by a; +delete from t1 where a < 4; +execute repstmt using 4, ignore; +select * from t1 order by a; +drop table t1; + +--echo # +--echo # DEVAULT & PS adoption +--echo # + + +# Correct usage +CREATE TABLE t1 (a INT DEFAULT 10, b INT DEFAULT NULL); +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?,?)' USING IGNORE, IGNORE; +SELECT * FROM t1; +UPDATE t1 SET a=20, b=30; +SELECT * FROM t1; +EXECUTE IMMEDIATE 'UPDATE t1 SET a=?,b=?' USING IGNORE, IGNORE; +SELECT * FROM t1; +DROP TABLE t1; + +# Incorrect usage in a expression in INSERT..VALUES +CREATE TABLE t1 (a INT DEFAULT 10); +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?+1)' USING IGNORE; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (CONCAT(?,?))' USING IGNORE, 'test'; +DROP TABLE t1; + +# Incorrect usage in UPDATE..SET +CREATE TABLE t1 (a INT DEFAULT 10); +INSERT INTO t1 VALUES (20); +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'UPDATE t1 SET a=?+1' USING IGNORE; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'UPDATE t1 SET a=CONCAT(?,?)' USING IGNORE, 'test'; +DROP TABLE t1; + + +# Incorrect usage in not an UPDATE/INSERT query at all +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CAST(? AS SIGNED)' USING IGNORE; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CAST(? AS DOUBLE)' USING IGNORE; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CAST(? AS CHAR)' USING IGNORE; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CAST(? AS DECIMAL(10,1))' USING IGNORE; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CAST(? AS TIME)' USING IGNORE; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CAST(? AS DATE)' USING IGNORE; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CAST(? AS DATETIME)' USING IGNORE; + +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT ?+1' USING IGNORE; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CONCAT(?,?)' USING IGNORE,'test'; + + +# Incorrect usage in the LIMIT clause +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT 1 LIMIT ?' USING IGNORE; +CREATE TABLE t1 (a INT DEFAULT 10); +INSERT INTO t1 VALUES (1),(2),(3); +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT * FROM t1 LIMIT ?' USING IGNORE; +DROP TABLE t1; + + +--echo # The output of this query in 'Note' is a syntactically incorrect query. +--echo # But as it's never logged, it's ok. It should be human readable only. +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT ?' USING IGNORE; + + +# This tests Item_param::eq() for IGNORE as a bound value +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>?+a' USING DEFAULT,DEFAULT; +DROP TABLE t1; + + +--echo # end of 10.2 test + +# +# ANSI_QUOTES +# +set sql_mode=ansi_quotes; +create table t1 (a int, b int default (a+1)); +show create table t1; +insert t1 (a) values (10); +set sql_mode=''; +show create table t1; +insert t1 (a) values (20); +flush tables; +show create table t1; +insert t1 (a) values (30); +select * from t1; +drop table t1; +set sql_mode=default; + diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index c78613e4304..28781ad6fdb 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -830,6 +830,53 @@ DROP TABLES t1,t2; set optimizer_switch=@save_derived_optimizer_switch; +--echo # +--echo # MDEV-10663: Use of Inline table columns in HAVING clause +--echo # throws 1463 Error +--echo # + +set @save_sql_mode = @@sql_mode; +set sql_mode='ONLY_FULL_GROUP_BY,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; + +CREATE TABLE `example1463` ( + `Customer` varchar(255) NOT NULL, + `DeliveryStatus` varchar(255) NOT NULL, + `OrderSize` int(11) NOT NULL +); +INSERT INTO example1463 VALUES ('Charlie', 'Success', 100); +INSERT INTO example1463 VALUES ('David', 'Success', 110); +INSERT INTO example1463 VALUES ('Charlie', 'Failed', 200); +INSERT INTO example1463 VALUES ('David', 'Success', 100); +INSERT INTO example1463 VALUES ('David', 'Unknown', 100); +INSERT INTO example1463 VALUES ('Edward', 'Success', 150); +INSERT INTO example1463 VALUES ('Edward', 'Pending', 150); + +SELECT Customer, Success, SUM(OrderSize) + FROM (SELECT Customer, + CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success, + OrderSize + FROM example1463) as subQ + GROUP BY Success, Customer + WITH ROLLUP; +SELECT Customer, Success, SUM(OrderSize) + FROM (SELECT Customer, + CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success, + OrderSize + FROM example1463) as subQ + GROUP BY Success, Customer; +SELECT Customer, Success, SUM(OrderSize) + FROM (SELECT Customer, + CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success, + OrderSize + FROM example1463) as subQ + GROUP BY Success, Customer + HAVING Success IS NOT NULL; + +DROP TABLE example1463; +set sql_mode= @save_sql_mode; + +--echo # end of 5.5 + --echo # --echo # Start of 10.1 tests --echo # diff --git a/mysql-test/t/derived_cond_pushdown.test b/mysql-test/t/derived_cond_pushdown.test index 9aef1d768be..e43751472db 100644 --- a/mysql-test/t/derived_cond_pushdown.test +++ b/mysql-test/t/derived_cond_pushdown.test @@ -951,3 +951,371 @@ select * from order by a limit 5) t where t.a not in (2,9); drop table t1; + +--echo # +--echo # MDEV-11072: pushdown of the condition obtained +--echo # after constant row substitution +--echo # + +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2; +CREATE TABLE t3 (c INT) ENGINE=MyISAM; +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t3; + +SELECT * FROM t1 WHERE a IN ( + SELECT b FROM v2 WHERE b < a OR b IN ( + SELECT c FROM v3 WHERE c = a + ) +); + +INSERT INTO t1 VALUES (2); +INSERT INTO t2 VALUES (3), (2); +INSERT INTO t3 VALUES (4), (1), (2), (7); + +SELECT * FROM t1 WHERE a IN ( + SELECT b FROM v2 WHERE b < a OR b IN ( + SELECT c FROM v3 WHERE c = a + ) +); + +EXPLAIN FORMAT=JSON +SELECT * FROM t1 WHERE a IN ( + SELECT b FROM v2 WHERE b < a OR b IN ( + SELECT c FROM v3 WHERE c = a + ) +); + +CREATE TABLE t4 (d INT, e INT) ENGINE=MyISAM; +INSERT INTO t4 VALUES (1,10),(3,11),(2,10),(2,20),(3,21); +CREATE OR REPLACE VIEW v4 AS +SELECT d, sum(e) AS s FROM t4 GROUP BY d; + +let $query = +SELECT * FROM t1 WHERE a IN ( + SELECT b FROM v2 WHERE b < a OR b IN ( + SELECT d FROM v4 WHERE s > a + ) +); + +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +DROP VIEW v2,v3,v4; +DROP TABLE t1,t2,t3,t4; + +--echo # +--echo # MDEV-10800: pushdown of the condition obtained +--echo # after constant row substitution +--echo # + + +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1); + +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3),(4); +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; + +SELECT * FROM +( SELECT * FROM t1 + WHERE EXISTS ( SELECT * FROM v2 WHERE b = a ) ) AS sq; + +EXPLAIN FORMAT=JSON +SELECT * FROM +( SELECT * FROM t1 + WHERE EXISTS ( SELECT * FROM v2 WHERE b = a ) ) AS sq; + +DROP VIEW v2; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-11102: condition pushdown into materialized inner table +--echo # of outer join is not applied as not being valid +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0),(2); + +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (1),(2); + +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; + +SELECT * FROM t1 LEFT JOIN t2 ON a = b WHERE b IS NULL; + +SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL; + +EXPLAIN FORMAT=JSON +SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL; + +DROP VIEW v2; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-11103: pushdown condition with ANY subquery +--echo # + +CREATE TABLE t1 (i INT); +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (1),(2); + +EXPLAIN FORMAT=JSON +SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 ); + +SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 ); + +DROP VIEW v1; +DROP TABLE t1; + +--echo # +--echo # MDEV-11315: condition with outer reference to mergeable derived +--echo # + +CREATE TABLE t1 (pk1 INT PRIMARY KEY, a INT, b INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (10,7,1),(11,0,2); + +CREATE TABLE t2 (pk2 INT PRIMARY KEY, c INT, d DATETIME) ENGINE=MyISAM; +INSERT INTO t2 VALUES + (1,4,'2008-09-27 00:34:58'), + (2,5,'2007-05-28 00:00:00'), + (3,6,'2009-07-25 09:21:20'); + +CREATE VIEW v1 AS SELECT * FROM t1; +CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; + +SELECT * FROM v1 AS sq + WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; +EXPLAIN FORMAT=JSON +SELECT * FROM v1 AS sq + WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; + +SELECT * FROM ( SELECT * FROM t1 ) AS sq + WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT * FROM t1 ) AS sq + WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; + +DROP VIEW v1,v2; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-11313: pushdown of the condition obtained +--echo # after constant row substitution +--echo # + +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (50); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; + +SELECT ( SELECT COUNT(*) FROM v1 WHERE a = t2.b ) AS f FROM t2 GROUP BY f; +EXPLAIN FORMAT=JSON +SELECT ( SELECT COUNT(*) FROM v1 WHERE a = t2.b ) AS f FROM t2 GROUP BY f; + +CREATE TABLE t3 (a INT, b INT) ENGINE=MYISAM; +INSERT INTO t3 VALUES (1,10),(3,11),(2,10),(2,20),(3,21); +CREATE VIEW v2 AS SELECT a, sum(b) AS s FROM t3 GROUP BY a ; +SELECT ( SELECT COUNT(*) FROM v2 WHERE s < t2.b ) AS f FROM t2 GROUP BY f; +EXPLAIN FORMAT=JSON +SELECT ( SELECT COUNT(*) FROM v2 WHERE s < t2.b ) AS f FROM t2 GROUP BY f; + + +DROP VIEW v1,v2; +DROP TABLE t1,t2,t3; + +--echo # +--echo # MDEV-10882: pushdown of the predicate with cached value +--echo # + +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL) ENGINE=MyISAM; +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (1,2),(3,4); + +CREATE TABLE t2 (c INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t2 VALUES (5),(6); + +SELECT a, GROUP_CONCAT(b) FROM v1 + WHERE b IN ( SELECT COUNT(c) FROM t2 ) GROUP BY a; + +EXPLAIN FORMAT=JSON +SELECT a, GROUP_CONCAT(b) FROM v1 + WHERE b IN ( SELECT COUNT(c) FROM t2 ) GROUP BY a; + +DROP VIEW v1; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-10836: pushdown of the predicate with cached value +--echo # + +CREATE TABLE t (pk INT PRIMARY KEY, f INT) ENGINE=MyISAM; +CREATE ALGORITHM=TEMPTABLE VIEW v AS SELECT * FROM t; +INSERT INTO t VALUES (1,1),(3,2); + +SELECT * FROM v AS v1, v AS v2 + WHERE v2.pk > v1.f AND v1.f IN ( SELECT COUNT(pk) FROM t ); + +EXPLAIN FORMAT=JSON +SELECT * FROM v AS v1, v AS v2 + WHERE v2.pk > v1.f AND v1.f IN ( SELECT COUNT(pk) FROM t ); + +DROP VIEW v; +DROP TABLE t; + +--echo # +--echo # MDEV-11488: pushdown of the predicate with cached value +--echo # + +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(3),(2); + +CREATE TABLE t2 (j INT, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3),(4); + +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +UPDATE t2 SET j = 2 WHERE j = 3; +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +DROP TABLE t1,t2; + +CREATE TABLE t1 (i FLOAT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1.5),(3.2),(2.71); + +CREATE TABLE t2 (j FLOAT, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3.2),(2.71); + +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +DROP TABLE t1,t2; + +CREATE TABLE t1 (i DECIMAL(10,2)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1.5),(3.21),(2.47); + +CREATE TABLE t2 (j DECIMAL(10,2), KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3.21),(4.55); + +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +DROP TABLE t1,t2; + +CREATE TABLE t1 (i VARCHAR(32)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('cc'),('aa'),('ddd'); + +CREATE TABLE t2 (j VARCHAR(16), KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('bbb'),('aa'); + +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +DROP TABLE t1,t2; + +CREATE TABLE t1 (i DATETIME) ENGINE=MyISAM; +INSERT INTO t1 VALUES + ('2008-09-27 00:34:58'),('2007-05-28 00:00:00'), ('2009-07-25 09:21:20'); + +CREATE TABLE t2 (j DATETIME, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES + ('2007-05-28 00:00:00'), ('2010-08-25 00:00:00'); + +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +DROP TABLE t1,t2; + +CREATE TABLE t1 (i DATE) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('2008-09-27'),('2007-05-28'), ('2009-07-25'); + +CREATE TABLE t2 (j DATE, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('2007-05-28'), ('2010-08-25'); + +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +DROP TABLE t1,t2; + +CREATE TABLE t1 (i TIME) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('00:34:58'),('10:00:02'), ('09:21:20'); + +CREATE TABLE t2 (j TIME, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('10:00:02'), ('11:00:10'); + +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-11593: pushdown of condition with NULLIF +--echo # + +CREATE TABLE t1 (i INT); +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; + +INSERT INTO t1 VALUES (2), (1); + +SELECT * FROM v1 WHERE NULLIF(1, i); +EXPLAIN FORMAT=JSON +SELECT * FROM v1 WHERE NULLIF(1, i); + +DROP VIEW v1; +DROP TABLE t1; + +--echo # +--echo # MDEV-11608: pushdown of the predicate with cached null value +--echo # + +CREATE TABLE t1 (c VARCHAR(3)); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES ('foo'),('bar'); + +CREATE TABLE t2 (c VARCHAR(3)); +INSERT INTO t2 VALUES ('foo'),('xyz'); + +SELECT * FROM v1 WHERE v1.c IN ( SELECT MIN(c) FROM t2 WHERE 0 ); +EXPLAIN FORMAT=JSON +SELECT * FROM v1 WHERE v1.c IN ( SELECT MIN(c) FROM t2 WHERE 0 ); + +DROP VIEW v1; +DROP TABLE t1,t2; + +CREATE TABLE t1 (d DECIMAL(10,2)); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (5.37),(1.1); + +CREATE TABLE t2 (d DECIMAL(10,2)); +INSERT INTO t2 VALUES ('1.1'),('2.23'); + +SELECT * FROM v1 WHERE v1.d IN ( SELECT MIN(d) FROM t2 WHERE 0 ); + +DROP VIEW v1; +DROP TABLE t1,t2; diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test index e94ab7073a6..3a18e9a086e 100644 --- a/mysql-test/t/derived_view.test +++ b/mysql-test/t/derived_view.test @@ -1845,6 +1845,60 @@ DROP TABLE t1,t2; --echo # end of 5.3 tests --echo # +--echo # +--echo # Bug mdev-11161: The second execution of prepared statement +--echo # does not use generated key for materialized +--echo # derived table / view +--echo # (actually this is a 5.3 bug.) +--echo # + +create table t1 ( + mat_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + matintnum CHAR(6) NOT NULL, + test MEDIUMINT UNSIGNED NULL +); +create table t2 ( + mat_id MEDIUMINT UNSIGNED NOT NULL, + pla_id MEDIUMINT UNSIGNED NOT NULL +); +insert into t1 values + (NULL, 'a', 1), (NULL, 'b', 2), (NULL, 'c', 3), (NULL, 'd', 4), + (NULL, 'e', 5), (NULL, 'f', 6), (NULL, 'g', 7), (NULL, 'h', 8), + (NULL, 'i', 9); +insert into t2 values + (1, 100), (1, 101), (1, 102), (2, 100), (2, 103), (2, 104), + (3, 101), (3, 102), (3, 105); + +explain + SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id + FROM t1 m2 + INNER JOIN + (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum + FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id + GROUP BY mp.pla_id) d + ON d.matintnum=m2.matintnum; + +prepare stmt1 from +"SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id + FROM t1 m2 + INNER JOIN + (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum + FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id + GROUP BY mp.pla_id) d + ON d.matintnum=m2.matintnum"; + +flush status; +execute stmt1; +show status like '%Handler_read%'; + +flush status; +execute stmt1; +show status like '%Handler_read%'; + +deallocate prepare stmt1; + +drop table t1,t2; + # The following command must be the last one the file set optimizer_switch=@exit_optimizer_switch; set join_cache_level=@exit_join_cache_level; diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test index d9784bc819a..a3e96953bac 100644 --- a/mysql-test/t/drop.test +++ b/mysql-test/t/drop.test @@ -313,3 +313,12 @@ INSERT INTO table1 VALUES (1); DROP TABLE table1,table2; --echo # End BUG#34750 + +--echo # +--echo # MDEV-11105 Table named 'db' has weird side effect. +--echo # + +CREATE DATABASE mysqltest; +CREATE TABLE mysqltest.db(id INT); +DROP DATABASE mysqltest; + diff --git a/mysql-test/t/dyncol.test b/mysql-test/t/dyncol.test index 49b2c5542d3..c0d22e9d1c4 100644 --- a/mysql-test/t/dyncol.test +++ b/mysql-test/t/dyncol.test @@ -805,24 +805,24 @@ select column_json(column_create(1, "val", 2, column_create(3, "val2"))); --echo # Time encoding --echo # select hex(column_create("t", "800:46:06.23434" AS time)) as hex, - column_json(column_create("t", "800:46:06.23434" AS time)) as json; + column_json(column_create("t", "800:46:06.23434" AS time)) as js; select hex(column_create(1, "800:46:06.23434" AS time)) as hex, - column_json(column_create(1, "800:46:06.23434" AS time)) as json; + column_json(column_create(1, "800:46:06.23434" AS time)) as js; select hex(column_create("t", "800:46:06" AS time)) as hex, - column_json(column_create("t", "800:46:06" AS time)) as json; + column_json(column_create("t", "800:46:06" AS time)) as js; select hex(column_create(1, "800:46:06" AS time)) as hex, - column_json(column_create(1, "800:46:06" AS time)) as json; + column_json(column_create(1, "800:46:06" AS time)) as js; select hex(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as hex, - column_json(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as json; + column_json(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as js; select hex(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as hex, - column_json(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as json; + column_json(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as js; select hex(column_create("t", "2012-12-21 10:46:06" AS datetime)) as hex, - column_json(column_create("t", "2012-12-21 10:46:06" AS datetime)) as json; + column_json(column_create("t", "2012-12-21 10:46:06" AS datetime)) as js; select hex(column_create(1, "2012-12-21 10:46:06" AS datetime)) as hex, - column_json(column_create(1, "2012-12-21 10:46:06" AS datetime)) as json; + column_json(column_create(1, "2012-12-21 10:46:06" AS datetime)) as js; --echo # --echo # MDEV-4849: Out of memory error and valgrind warnings on COLUMN_ADD @@ -928,6 +928,14 @@ SELECT COLUMN_JSON(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL)); --echo # Start of 10.2 tests --echo # +# +# Item_func_dyncol_add::print +# +create view v1 as select column_get(column_add(column_create(1 , 'blue' as char), 2, 'ttt'), 1 as char); +show create view v1; +select * from v1; +drop view v1; + --echo # --echo # MDEV-10134 Add full support for DEFAULT --echo # diff --git a/mysql-test/t/fulltext_charsets.test b/mysql-test/t/fulltext_charsets.test new file mode 100644 index 00000000000..3ac9791bd1a --- /dev/null +++ b/mysql-test/t/fulltext_charsets.test @@ -0,0 +1,10 @@ +# +# MDEV-11241 Certain combining marks cause MariaDB to crash when doing Full-Text searches +# +set names utf8mb4; + +create table t1 (a int, b text, fulltext (b)) charset=utf8mb4 collate=utf8mb4_unicode_ci; +insert t1 values (1000, 'C͓̙̯͔̩ͅͅi̩̘̜̲a̯̲̬̳̜̖̤o͕͓̜͓̺̖̗,̠̬͚ ̺T͇̲h͈̱e ̬̜DÌ–o̦̖͔̗͖̩̘c̣̼tÌ͉̫̮̗o͉̫̭r̙͎̗.͓̪̥'); +select a from t1 where match(b) against ('ciao' in boolean mode); +drop table t1; + diff --git a/mysql-test/t/func_compress.test b/mysql-test/t/func_compress.test index 50eb14777a7..3fd9cad467b 100644 --- a/mysql-test/t/func_compress.test +++ b/mysql-test/t/func_compress.test @@ -153,6 +153,25 @@ set global max_allowed_packet=default; --echo # End of 5.5 tests --echo # +--echo # +--echo # Start of 10.1 tests +--echo # + +--echo # +--echo # MDEV-10864 Wrong result for WHERE .. (f2=COMPRESS('test') OR f2=COMPRESS('TEST')) +--echo # + +CREATE TABLE t1 (f1 VARCHAR(4), f2 VARCHAR(64), UNIQUE KEY k1 (f1,f2)); +INSERT INTO t1 VALUES ('test',compress('test')), ('TEST', compress('TEST')); +SELECT f1,HEX(f2) FROM t1 ignore index(k1) WHERE f1='test' AND (f2= compress("test") OR f2= compress("TEST")); +SELECT f1,HEX(f2) FROM t1 WHERE f1='test' AND (f2= compress("test") OR f2= compress("TEST")); +SELECT f1,HEX(f2) FROM t1 WHERE f1='test' AND (f2= compress("TEST") OR f2= compress("test")); +DROP TABLE t1; + +--echo # +--echo # End of 10.1 tests +--echo # + --echo # --echo # Start of 10.2 tests --echo # diff --git a/mysql-test/t/func_crypt.test b/mysql-test/t/func_crypt.test index 6232f019e6b..ab5be573932 100644 --- a/mysql-test/t/func_crypt.test +++ b/mysql-test/t/func_crypt.test @@ -69,8 +69,29 @@ INSERT INTO t1 VALUES (REPEAT('a', 1024)); SELECT OLD_PASSWORD(c1), PASSWORD(c1) FROM t1; DROP TABLE t1; ---echo End of 5.0 tests ---echo Start of 10.2 tests +--echo # End of 5.0 tests + +--echo # +--echo # Start of 10.1 tests +--echo # + +--let func=password +--source include/func_str_ascii_checksum.inc +--let func=old_password +--source include/func_str_ascii_checksum.inc + +--echo # +--echo # MDEV-10864 Wrong result for WHERE .. (f2=COMPRESS('test') OR f2=COMPRESS('TEST')) +--echo # + +CREATE TABLE t1 (f1 VARCHAR(4), f2 VARCHAR(64), UNIQUE KEY k1 (f1,f2)); +INSERT INTO t1 VALUES ('test',encrypt('test','key')), ('TEST', encrypt('TEST','key')); +SELECT f1 FROM t1 ignore index(k1) WHERE f1='test' AND (f2= encrypt('test','key') OR f2= encrypt('TEST','key')); +SELECT f1 FROM t1 WHERE f1='test' AND (f2= encrypt('test','key') OR f2= encrypt('TEST','key')); +SELECT f1 FROM t1 WHERE f1='test' AND (f2= encrypt('TEST','key') OR f2= encrypt('test','key')); +DROP TABLE t1; + +--echo # Start of 10.2 tests CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(30) DEFAULT ENCRYPT(a,123)); SHOW CREATE TABLE t1; diff --git a/mysql-test/t/func_date_add.test b/mysql-test/t/func_date_add.test index 5f27978347c..3106889fde6 100644 --- a/mysql-test/t/func_date_add.test +++ b/mysql-test/t/func_date_add.test @@ -100,3 +100,34 @@ drop table t1; --echo End of 5.5 tests +# +# how + interval is printed +# + +create or replace view v1 as select 3 & 20010101 + interval 2 day as x; +show create view v1; +select 3 & 20010101 + interval 2 day, x from v1; + +create or replace view v1 as select (3 & 20010101) + interval 2 day as x; +show create view v1; +select (3 & 20010101) + interval 2 day, x from v1; + +create or replace view v1 as select 3 & (20010101 + interval 2 day) as x; +show create view v1; +select 3 & (20010101 + interval 2 day), x from v1; + +create or replace view v1 as select 30 + 20010101 + interval 2 day as x; +show create view v1; +select 30 + 20010101 + interval 2 day, x from v1; + +create or replace view v1 as select (30 + 20010101) + interval 2 day as x; +show create view v1; +select (30 + 20010101) + interval 2 day, x from v1; + +create or replace view v1 as select 30 + (20010101 + interval 2 day) as x; +show create view v1; +select 30 + (20010101 + interval 2 day), x from v1; + +drop view v1; + +--echo End of 10.2 tests diff --git a/mysql-test/t/func_digest.test b/mysql-test/t/func_digest.test index 384b238523a..e7d73b4f368 100644 --- a/mysql-test/t/func_digest.test +++ b/mysql-test/t/func_digest.test @@ -494,6 +494,29 @@ SET NAMES latin1; SELECT sha2('1',224); --disable_metadata +--echo # +--echo # Start of 10.1 tests +--echo # + +--echo # +--echo # MDEV-10850 Wrong result for WHERE .. (f2=TO_BASE64('test') OR f2=TO_BAS E64('TEST')) +--echo # + +CREATE TABLE t1 (f1 VARCHAR(4), f2 VARCHAR(64), UNIQUE KEY k1 (f1,f2)); +INSERT INTO t1 VALUES ('test',SHA2('test',224)), ('TEST', SHA2('TEST',224)); +SELECT * FROM t1 IGNORE INDEX(k1) WHERE f1='test' AND (f2= SHA2("test",224) OR f2= SHA2("TEST",224)); +SELECT * FROM t1 WHERE f1='test' AND (f2= SHA2("test",224) OR f2= SHA2("TEST",224)); +SELECT * FROM t1 WHERE f1='test' AND (f2= SHA2("TEST",224) OR f2= SHA2("test",224)); +DROP TABLE t1; + +--echo # +--echo # MDEV-10425 Assertion `collation.derivation == DERIVATION_IMPLICIT' failed in Item_func_conv_charset::fix_length_and_dec() +--echo # + +PREPARE stmt FROM "SELECT SHA2(CONVERT('foo' USING latin1), 224)"; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; + --echo # --echo # Start of 10.2 tests --echo # diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index 7e342928ef8..1e75099a1fe 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -1679,6 +1679,15 @@ select c1 from t1 having c1 >= (select t.c1 as c from t2 t order by (select min( select c1 from t1 having c1 >= (select t.c1 as c from t2 t order by (select min(t1.c1+tt.c1) from t2 tt)); drop table t1,t2; +--echo # +--echo # MDEV-10556 Assertion `0' failed in virtual void Item_sum_field::set_result_field(Field*) +--echo # + +CREATE TABLE t1 (i INT, KEY(i)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (10),(20),(30); +SELECT DISTINCT STDDEV(1) FROM t1 GROUP BY i ORDER BY BENCHMARK(0, BIT_XOR(i)); +DROP TABLE t1; + --echo # --echo # End of 10.1 tests --echo # diff --git a/mysql-test/t/func_json.test b/mysql-test/t/func_json.test new file mode 100644 index 00000000000..7ab136f177c --- /dev/null +++ b/mysql-test/t/func_json.test @@ -0,0 +1,179 @@ +select json_valid('[1, 2]'); +select json_valid('"string"}'); +select json_valid('{"key1":1, "key2":[2,3]}'); +select json_valid('[false, true, null]'); +select json_valid(repeat('[', 1000)); +select json_valid(repeat('{"a":', 1000)); + +select json_value('{"key1":123}', '$.key2'); +select json_value('{"key1":123}', '$.key1'); +select json_value('{"key1":[1,2,3]}', '$.key1'); +select json_value('{"key1": [1,2,3], "key1":123}', '$.key1'); + +select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2'); +select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key1'); +select json_query('{"key1": 1}', '$.key1'); +select json_query('{"key1":123, "key1": [1,2,3]}', '$.key1'); +select json_query('{"key1":123, "key1": [1,2,3]}', concat('$', repeat('.k', 1000))); + +select json_array(); +select json_array(1); +select json_array(1, "text", false, null); + +select json_array_append('["a", "b"]', '$', FALSE); +select json_array_append('{"k1":1, "k2":["a", "b"]}', '$.k2', 2); +select json_array_append('["a", ["b", "c"], "d"]', '$[0]', 2); + +select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1]', 'x'); +select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2]', 'x'); +select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[3]', 'x'); +select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[4]', 'x'); +select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1].b[0]', 'x'); +select json_array_insert('true', '$', 1); +select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2][1]', 'y'); + +select json_contains('{"k1":123, "k2":345}', '123', '$.k1'); +select json_contains('"you"', '"you"'); +select json_contains('"youth"', '"you"'); +--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT +select json_contains('[1]', '[1]', '$', '$[0]'); +select json_contains('', '', '$'); +select json_contains('null', 'null', '$'); +select json_contains('"10"', '"10"', '$'); +select json_contains('"10"', '10', '$'); +select json_contains('10.1', '10', '$'); +select json_contains('10.0', '10', '$'); +select json_contains('[1]', '1'); +select json_contains('[2, 1]', '1'); +select json_contains('[2, [2, 3], 1]', '1'); +select json_contains('[4, [2, 3], 1]', '2'); +select json_contains('[2, 1]', '[1, 2]'); +select json_contains('[2, 1]', '[1, 0, 2]'); +select json_contains('[2, 0, 3, 1]', '[1, 2]'); +select json_contains('{"b":[1,2], "a":1}', '{"a":1, "b":2}'); +select json_contains('{"a":1}', '{}'); +select json_contains('[1, {"a":1}]', '{}'); +select json_contains('[1, {"a":1}]', '{"a":1}'); +select json_contains('[{"abc":"def", "def":"abc"}]', '["foo","bar"]'); +select json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]'); + +select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]"); +select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[10]"); +select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.ma"); +select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1"); +select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1", "$.ma"); +select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.ma"); +select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.key2"); +select json_contains_path('{ "a": true }', NULL, '$.a' ); +select json_contains_path('{ "a": true }', 'all', NULL ); +select json_contains_path('{"a":{"b":"c"}}', 'one', '$.a.*'); + +select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1"); +select json_extract('{"key1":"asd", "key2":[2,3]}', "$.keyX", "$.keyY"); +select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1", "$.key2"); +select json_extract('{"key1":5, "key2":[2,3]}', "$.key1", "$.key2"); +select json_extract('{"key0":true, "key1":"qwe"}', "$.key1"); +select json_extract(json_object('foo', 'foobar'),'$'); +select json_extract('[10, 20, [30, 40]]', '$[2][*]'); +select json_extract('[10, 20, [{"a":3}, 30, 40]]', '$[2][*]'); +select json_extract('1', '$'); +select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]'); + +select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word'); +select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.d[3]', 3); +select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.a[2]', 2); +select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.c', 'word'); + +select json_set('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]'); + +select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]'); +select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.b', '[true, false]'); + +set @j = '["a", ["b", "c"], "d"]'; +select json_remove(@j, '$[0]'); +select json_remove(@j, '$[1]'); +select json_remove(@j, '$[2]'); +set @j = '{"a": 1, "b": [2, 3]}'; +select json_remove(@j, '$.b'); +select json_remove(@j, '$.a'); + +select json_object(); +select json_object("ki", 1, "mi", "ya"); +create table t1 as select json_object('id', 87, 'name', 'carrot') as f; +show create table t1; +select * from t1; +drop table t1; + +select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2"); +select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[1]"); +select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[10]"); + +select json_quote('"string"'); +create table t1 as select json_quote('foo'); +select * from t1; +show create table t1; +drop table t1; + +--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT +select json_merge('string'); +select json_merge('string', 123); +select json_merge('"string"', 123); +select json_merge('[1, 2]', '[true, false]'); +select json_merge('{"1": 2}', '{"true": false}'); +select json_merge('{"1": 2}', '{"true": false}', '{"3": 4}'); +select json_merge(NULL,json_object('foo', 1)); +select json_merge('a','b'); +select json_merge('{"a":"b"}','{"c":"d"}'); +SELECT JSON_MERGE('[1, 2]', '{"id": 47}'); + +select json_type('{"k1":123, "k2":345}'); +select json_type('[123, "k2", 345]'); +select json_type("true"); +select json_type('123'); +select json_type('123.12'); + +select json_keys('{"a":{"c":1, "d":2}, "b":2}'); +select json_keys('{"a":{"c":1, "d":2}, "b":2}', "$.a"); +select json_keys('{"a":{"c":1, "d":2}, "b":2}', "$.b"); +select json_keys('foo'); + +SET @j = '["abc", [{"k": "10"}, "def"], {"x":"abc"}, {"y":"bcd"}]'; +select json_search(@j, 'one', 'abc'); +select json_search(@j, 'all', 'abc'); +select json_search(@j, 'all', 'abc', NULL, '$[2]'); +select json_search(@j, 'all', 'abc', NULL, '$'); +select json_search(@j, 'all', '10', NULL, '$'); +select json_search(@j, 'all', '10', NULL, '$[*]'); +select json_search(@j, 'all', '10', NULL, '$[*][0].k'); +select json_search(@j, 'all', '10', NULL, '$**.k'); +create table t1( json_col text ); +insert into t1 values +('{ "a": "foobar" }'), + ('{ "a": "foobar", "b": "focus", "c": [ "arm", "foot", "shoulder" ] }'); +select json_search( json_col, 'all', 'foot' ) from t1; +drop table t1; + + +select json_unquote('"abc"'); +select json_unquote('abc'); + +select json_object("a", json_object("b", "abcd")); +select json_object("a", '{"b": "abcd"}'); +select json_object("a", cast('{"b": "abcd"}' as json)); + +select cast(NULL AS JSON); +select json_depth(cast(NULL as JSON)); +select json_depth('[[], {}]'); +select json_depth('[[[1,2,3],"s"], {}, []]'); +select json_depth('[10, {"a": 20}]'); + +select json_length(''); +select json_length('{}'); +select json_length('[1, 2, {"a": 3}]'); +select json_length('{"a": 1, "b": {"c": 30}}', '$.b'); +select json_length('{"a": 1, "b": {"c": 30}}'); + +create table json (j INT); +show create table json; +drop table json; + diff --git a/mysql-test/t/func_like.test b/mysql-test/t/func_like.test index d1b9b170a3b..b65bff63298 100644 --- a/mysql-test/t/func_like.test +++ b/mysql-test/t/func_like.test @@ -185,3 +185,25 @@ DROP TABLE t1; --echo # --echo # End of 10.1 tests --echo # + +# +# Item_func_line::print() +# +create view v1 as select 'foo!' like 'foo!!', 'foo!' like 'foo!!' escape '!'; +show create view v1; +select * from v1; +drop view v1; + +create table t1 (a varchar(100), + b int default (a like '%f\\_'), + c int default (a like '%f\\_' escape ''), + d int default (a like '%f\\_' escape '\\')); +show create table t1; +insert t1 (a) values ('1 f_'), ('1 f\\_'); +set sql_mode=no_backslash_escapes; +insert t1 (a) values ('2 f_'), ('2 f\_'); +flush tables; +insert t1 (a) values ('3 f_'), ('3 f\_'); +set sql_mode=default; +select * from t1; +drop table t1; diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index 2645417f3e5..48872edcd4b 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -1783,6 +1783,24 @@ INSERT INTO t1 VALUES (0),(0),(1),(0),(0); SELECT COUNT(*) FROM t1, t1 t2 GROUP BY INSERT('', t2.a, t1.a, @@global.max_binlog_size); DROP TABLE t1; +--let func=hex +--source include/func_str_ascii_checksum.inc + +--let func=to_base64 +--source include/func_str_ascii_checksum.inc + +--echo # +--echo # MDEV-10864 Wrong result for WHERE .. (f2=COMPRESS('test') OR f2=COMPRESS('TEST')) +--echo # + +CREATE TABLE t1 (f1 VARCHAR(4), f2 VARCHAR(128), UNIQUE KEY k1 (f1,f2)); +INSERT INTO t1 VALUES ('YQ==',from_base64('YQ==')), ('Yq==', from_base64('Yq==')); +SELECT f1,HEX(f2) FROM t1 ignore index(k1) WHERE f1='YQ==' AND (f2= from_base64("YQ==") OR f2= from_base64("Yq==")); +SELECT f1,HEX(f2) FROM t1 WHERE f1='YQ==' AND (f2= from_base64("YQ==") OR f2= from_base64("Yq==")); +SELECT f1,HEX(f2) FROM t1 WHERE f1='YQ==' AND (f2= from_base64("Yq==") OR f2= from_base64("YQ==")); +DROP TABLE t1; + + --echo # --echo # End of 10.1 tests --echo # diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 12b7c92688f..40a6c387448 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -1709,6 +1709,31 @@ SELECT TIMEDIFF(20140101000000.000 , 20140302010000.000 ) AS dec_dec, TIMEDIFF(20140101000000.000 , '2014-03-02 01:00:00' ) AS dec_str; + +--echo # +--echo # MDEV-10787 Assertion `ltime->neg == 0' failed in void date_to_datetime(MYSQL_TIME*) +--echo # +CREATE TABLE t1 (d DATE); +INSERT INTO t1 VALUES ('2005-07-20'),('2012-12-21'); +SELECT REPLACE( ADDDATE( d, INTERVAL 0.6732771076944444 HOUR_SECOND ), '2', 'x' ) FROM t1; +SELECT REPLACE( ADDDATE( d, INTERVAL '0.6732771076944444' HOUR_SECOND ), '2', 'x' ) FROM t1; +SELECT CAST(ADDDATE( d, INTERVAL 6732771076944444 SECOND) AS CHAR) FROM t1; +SELECT CAST(ADDDATE( d, INTERVAL '67327710769444:44' HOUR_SECOND) AS CHAR) FROM t1; +SELECT CAST(ADDDATE( d, INTERVAL '673277107694:44:44' HOUR_SECOND) AS CHAR) FROM t1; +DROP TABLE t1; + +# Maximum possible DAY_SECOND values in various formats +SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:23:59:59' DAY_SECOND); +SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:59:59' DAY_SECOND); +SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:59' DAY_SECOND); +SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:0:315569433599' DAY_SECOND); + +# Out-of-range INTERVAL DAY_SECOND values +SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND); +SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND); +SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND); + + --echo # --echo # End of 10.0 tests --echo # diff --git a/mysql-test/t/func_weight_string.test b/mysql-test/t/func_weight_string.test index ddaf14dc75d..b376b996556 100644 --- a/mysql-test/t/func_weight_string.test +++ b/mysql-test/t/func_weight_string.test @@ -161,6 +161,13 @@ INSERT INTO t1 (a) VALUES ('a'); SELECT a, HEX(b) FROM t1; DROP TABLE t1; +# +# Item_func_weight_string::print() +# +create view v1 as select weight_string("MySQL" as char(4)); +select * from v1; +drop view v1; + --echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/t/gis-debug.test b/mysql-test/t/gis-debug.test index 30fcb3661c4..4b36a8e20e0 100644 --- a/mysql-test/t/gis-debug.test +++ b/mysql-test/t/gis-debug.test @@ -14,7 +14,7 @@ SET @tmp=ST_GIS_DEBUG(1); --echo # MDEV-10134 Add full support for DEFAULT --echo # ---error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 (a INT DEFAULT ST_GIS_DEBUG(1)); --echo # diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index 12b3e607e96..09d7a29744f 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -1530,6 +1530,14 @@ DROP TABLE t1,t2; --echo # Start of 10.2 tests --echo # +# +# Item_func_spatial_collection::print() +# +create view v1 as select AsWKT(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))); +show create view v1; +select * from v1; +drop view v1; + --echo # --echo # MDEV-10134 Add full support for DEFAULT --echo # diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index a1a73d15e1a..a97d8ef4248 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1739,6 +1739,18 @@ SELECT MAX(i), c FROM t1 WHERE c != 'qux' AND ( SELECT SUM(j) FROM t1, t2 ) IS NOT NULL GROUP BY c; drop table t1,t2; +--echo # +--echo # ONLY_FULL_GROUP_BY references +--echo # + +set @save_sql_mode = @@sql_mode; +set sql_mode='ONLY_FULL_GROUP_BY'; +create table t1 (a int, b int); +select a+b as x from t1 group by x having x > 1; +select a as x from t1 group by x having x > 1; +select a from t1 group by a having a > 1; +drop table t1; +set sql_mode= @save_sql_mode; # # End of MariaDB 5.5 tests # diff --git a/mysql-test/t/group_by_innodb.test b/mysql-test/t/group_by_innodb.test index ed65e0c3e57..f7e035a1b54 100644 --- a/mysql-test/t/group_by_innodb.test +++ b/mysql-test/t/group_by_innodb.test @@ -125,6 +125,15 @@ ORDER BY id DESC; DROP TABLE t1, t2; +--echo # +--echo # MDEV-11162: Assertion `num_records == m_idx_array.size()' failed in Filesort_buffer::alloc_sort_buffer(uint, uint) +--echo # + +CREATE TABLE t1 (i INT) ENGINE=InnoDB; +SELECT ( SELECT DISTINCT GROUP_CONCAT(SLEEP(0)) FROM t1 GROUP BY i ); +SELECT i FROM t1 order by i LIMIT 1; +DROP TABLE t1; + --echo # Port of testcase: --echo # --echo # Bug#20819199 ASSERTION FAILED IN TEST_IF_SKIP_SORT_ORDER @@ -156,3 +165,4 @@ eval $query; DROP TABLE t0, t1; --echo # End of tests + diff --git a/mysql-test/t/group_min_max_innodb.test b/mysql-test/t/group_min_max_innodb.test index 6967f847147..91e0bd3279f 100644 --- a/mysql-test/t/group_min_max_innodb.test +++ b/mysql-test/t/group_min_max_innodb.test @@ -230,3 +230,16 @@ eval EXPLAIN $query; eval $query; DROP TABLE t0,t1,t2; + +--echo # +--echo # MDEV-MariaDB daemon leaks memory with specific query +--echo # + +CREATE TABLE t1 (`voter_id` int(11) unsigned NOT NULL, + `language_id` int(11) unsigned NOT NULL DEFAULT '1' +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE t2 (`voter_id` int(10) unsigned NOT NULL DEFAULT '0', + `serialized_c` mediumblob) ENGINE=InnoDB DEFAULT CHARSET=utf8; +insert into t2 values (1,repeat("a",1000)),(2,repeat("a",1000)),(3,repeat("b",1000)),(4,repeat("c",1000)),(4,repeat("b",1000)); +SELECT GROUP_CONCAT(t1.language_id SEPARATOR ',') AS `translation_resources`, `d`.`serialized_c` FROM t2 AS `d` LEFT JOIN t1 ON `d`.`voter_id` = t1.`voter_id` GROUP BY `d`.`voter_id` ORDER BY 10-d.voter_id+RAND()*0; +drop table t1,t2; diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test index 0f6be0b0ec6..f826feff5c0 100644 --- a/mysql-test/t/having.test +++ b/mysql-test/t/having.test @@ -743,3 +743,18 @@ SELECT * FROM t1 JOIN t2 ON c1 = c2 HAVING c2 > 'a' ORDER BY c2 LIMIT 1; DROP TABLE t1,t2; --echo End of 10.0 tests + +--echo # +--echo # MDEV-10716: Assertion `real_type() != FIELD_ITEM' failed in +--echo # Item_ref::build_equal_items(THD*, COND_EQUAL*, bool, COND_EQUAL**) +--echo # +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); +SELECT i, COUNT(*) FROM t1 GROUP BY i HAVING i<>0 AND 1; +SELECT i-1 A, COUNT(*) FROM t1 GROUP BY i HAVING A AND 1; +CREATE VIEW v1 as select i, i-1 as A from t1; +SELECT A, COUNT(*) FROM v1 GROUP BY i HAVING A AND 1; +DROP VIEW v1; +DROP TABLE t1; + +--echo End of 10.1 tests diff --git a/mysql-test/t/index_merge_innodb.test b/mysql-test/t/index_merge_innodb.test index 6a1cb53dc40..3a2601342ba 100644 --- a/mysql-test/t/index_merge_innodb.test +++ b/mysql-test/t/index_merge_innodb.test @@ -12,7 +12,7 @@ # Slow test, don't run during staging part --source include/not_staging.inc ---source include/have_xtradb.inc +--source include/have_innodb.inc let $engine_type= InnoDB; # InnoDB does not support Merge tables (affects include/index_merge1.inc) diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 1443f654809..157b4c69508 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -8,8 +8,7 @@ # on the presence of the log tables (which are CSV-based). --source include/have_csv.inc -# Check that XtraDB is enabled as result depends on it --- source include/have_xtradb.inc +-- source include/have_innodb.inc # Save the initial number of concurrent sessions --source include/count_sessions.inc @@ -622,13 +621,13 @@ select * from information_schema.schema_privileges order by grantee; select * from information_schema.user_privileges order by grantee; show grants; connection con4; -select * from information_schema.column_privileges where grantee like '%user%' +select * from information_schema.column_privileges where grantee like '\'user%' order by grantee; -select * from information_schema.table_privileges where grantee like '%user%' +select * from information_schema.table_privileges where grantee like '\'user%' order by grantee; -select * from information_schema.schema_privileges where grantee like '%user%' +select * from information_schema.schema_privileges where grantee like '\'user%' order by grantee; -select * from information_schema.user_privileges where grantee like '%user%' +select * from information_schema.user_privileges where grantee like '\'user%' order by grantee; show grants; connection default; diff --git a/mysql-test/t/information_schema_all_engines.test b/mysql-test/t/information_schema_all_engines.test index 8c898909c1e..f8d685d2560 100644 --- a/mysql-test/t/information_schema_all_engines.test +++ b/mysql-test/t/information_schema_all_engines.test @@ -3,7 +3,7 @@ # available (since these engines inject tables into INFORMATION_SCHEMA). --source include/not_embedded.inc ---source include/have_xtradb.inc +--source include/have_innodb.inc --source include/have_perfschema.inc --source include/not_staging.inc diff --git a/mysql-test/t/innodb_group.test b/mysql-test/t/innodb_group.test new file mode 100644 index 00000000000..56c8d54003e --- /dev/null +++ b/mysql-test/t/innodb_group.test @@ -0,0 +1,22 @@ +# +# Tests involving GROUP BY, aggregate functions and InnoDB +# + + +--source include/have_innodb.inc + +--echo # +--echo # Start of 10.1 tests +--echo # + +--echo # +--echo # MDEV-10556 Assertion `0' failed in virtual void Item_sum_field::set_result_field(Field*) +--echo # + +CREATE TABLE t1 (i INT) ENGINE=InnoDB; +SELECT DISTINCT STDDEV(1) FROM t1 GROUP BY i ORDER BY BENCHMARK(0, BIT_XOR(i)); +DROP TABLE t1; + +--echo # +--echo # End of 10.1 tests +--echo # diff --git a/mysql-test/t/innodb_mysql_lock.test b/mysql-test/t/innodb_mysql_lock.test index cb57c092e40..39ea7e5df88 100644 --- a/mysql-test/t/innodb_mysql_lock.test +++ b/mysql-test/t/innodb_mysql_lock.test @@ -64,6 +64,7 @@ set @@autocommit=1; connection default; disconnect con1; +disconnect con2; disconnect con3; @@ -116,52 +117,6 @@ connection default; disconnect con37346; drop table t1; - ---echo # ---echo # Bug #42147 Concurrent DML and LOCK TABLE ... READ for InnoDB ---echo # table cause warnings in errlog ---echo # - ---echo # ---echo # Note that this test for now relies on a global suppression of ---echo # the warning "Found lock of type 6 that is write and read locked" ---echo # This suppression rule can be removed once Bug#42147 is properly ---echo # fixed. See bug page for more info. ---echo # - ---disable_warnings -DROP TABLE IF EXISTS t1; ---enable_warnings - -CREATE TABLE t1 (i INT) engine= innodb; - ---echo # Get user-level lock -connection con2; -SELECT get_lock('bug42147_lock', 60); - -connection default; ---send INSERT INTO t1 SELECT get_lock('bug42147_lock', 60) - -connection con2; -let $wait_condition= - SELECT COUNT(*) > 0 FROM information_schema.processlist - WHERE state = 'User lock' - AND info = 'INSERT INTO t1 SELECT get_lock(\'bug42147_lock\', 60)'; ---source include/wait_condition.inc -LOCK TABLES t1 READ; -SELECT release_lock('bug42147_lock'); - -connection default; ---reap - -connection con2; -UNLOCK TABLES; - -connection default; -disconnect con2; -DROP TABLE t1; - - --echo # --echo # Bug#53798 OPTIMIZE TABLE breaks repeatable read --echo # diff --git a/mysql-test/t/insert_notembedded.test b/mysql-test/t/insert_notembedded.test index 713eaf5db40..2769aee8d8a 100644 --- a/mysql-test/t/insert_notembedded.test +++ b/mysql-test/t/insert_notembedded.test @@ -156,41 +156,5 @@ connection default; DROP DATABASE meow; -# -# Bug#28587 SELECT is blocked by INSERT waiting on read lock, even with low_priority_updates -# ---echo connection: default -set low_priority_updates=1; ---disable_warnings -drop table if exists t1; ---enable_warnings -create table t1 (a int, b int, unique key t1$a (a)); -lock table t1 read; -connect (update,localhost,root,,); -connection update; ---echo connection: update -set low_priority_updates=1; -show variables like 'low_priority_updates'; -let $ID= `select connection_id()`; ---send insert into t1 values (1, 2) ON DUPLICATE KEY UPDATE b = 2; -connection default; -# we must wait till the insert opens and locks the table -let $wait_condition= - select count(*) = 1 from information_schema.processlist - where state = "Waiting for table level lock" and id = $ID; ---source include/wait_condition.inc -connect (select,localhost,root,,); ---echo connection: select -select * from t1; -connection default; ---echo connection: default -select * from t1; -connection default; -disconnect update; -disconnect select; -unlock tables; -drop table t1; -set low_priority_updates=default; - set local sql_mode=default; set global sql_mode=default; diff --git a/mysql-test/t/keywords.test b/mysql-test/t/keywords.test index 54052e65014..40beee9e3c1 100644 --- a/mysql-test/t/keywords.test +++ b/mysql-test/t/keywords.test @@ -173,3 +173,10 @@ drop table option; set option=1; --error 1193 set option option=1; + +--echo # +--echo # MDEV-10585 EXECUTE IMMEDIATE statement +--echo # + +CREATE TABLE immediate (immediate int); +DROP TABLE immediate; diff --git a/mysql-test/t/lock_sync.test b/mysql-test/t/lock_sync.test index c090e3a1d93..af8435f7fbb 100644 --- a/mysql-test/t/lock_sync.test +++ b/mysql-test/t/lock_sync.test @@ -406,6 +406,12 @@ let $restore_table= t2; --echo # 2.8 REPLACE with a subquery. --echo # --echo # Same is true for this statement as well. + +--echo # Suppress warnings for REPLACE ... SELECT +--disable_query_log +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +--enable_query_log + let $statement= replace into t2 select i+5 from t1; let $restore_table= t2; --source include/check_no_concurrent_insert.inc @@ -872,116 +878,6 @@ disconnect con2; set @@global.concurrent_insert= @old_concurrent_insert; ---echo # ---echo # Test for bug #45143 "All connections hang on concurrent ALTER TABLE". ---echo # ---echo # Concurrent execution of statements which required weak write lock ---echo # (TL_WRITE_ALLOW_WRITE) on several instances of the same table and ---echo # statements which tried to acquire stronger write lock (TL_WRITE, ---echo # TL_WRITE_ALLOW_READ) on this table might have led to deadlock. -# -# Suppress warnings for INSERTs that use get_lock(). -# -disable_query_log; -call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); -enable_query_log; - ---disable_warnings -drop table if exists t1; -drop view if exists v1; ---enable_warnings ---echo # Create auxiliary connections used through the test. -connect (con_bug45143_1,localhost,root,,test,,); -connect (con_bug45143_3,localhost,root,,test,,); -connect (con_bug45143_2,localhost,root,,test,,); -connection default; ---echo # Reset DEBUG_SYNC facility before using it. -set debug_sync= 'RESET'; ---echo # Turn off logging so calls to locking subsystem performed ---echo # for general_log table won't interfere with our test. -set @old_general_log = @@global.general_log; -set @@global.general_log= OFF; - -create table t1 (i int) engine=InnoDB; ---echo # We have to use view in order to make LOCK TABLES avoid ---echo # acquiring SNRW metadata lock on table. -create view v1 as select * from t1; -insert into t1 values (1); ---echo # Prepare user lock which will be used for resuming execution of ---echo # the first statement after it acquires TL_WRITE_ALLOW_WRITE lock. -select get_lock("lock_bug45143_wait", 0); - -connection con_bug45143_1; ---echo # Sending: ---send insert into t1 values (get_lock("lock_bug45143_wait", 100)); - -connection con_bug45143_2; ---echo # Wait until the above INSERT takes TL_WRITE_ALLOW_WRITE lock on 't1' ---echo # and then gets blocked on user lock 'lock_bug45143_wait'. -let $wait_condition= select count(*)= 1 from information_schema.processlist - where state= 'User lock' and - info='insert into t1 values (get_lock("lock_bug45143_wait", 100))'; ---source include/wait_condition.inc ---echo # Ensure that upcoming SELECT waits after acquiring TL_WRITE_ALLOW_WRITE ---echo # lock for the first instance of 't1'. -set debug_sync='thr_multi_lock_after_thr_lock SIGNAL parked WAIT_FOR go'; ---echo # Sending: ---send select count(*) > 0 from t1 as a, t1 as b for update; - -connection con_bug45143_3; ---echo # Wait until the above SELECT ... FOR UPDATE is blocked after ---echo # acquiring lock for the the first instance of 't1'. -set debug_sync= 'now WAIT_FOR parked'; ---echo # Send LOCK TABLE statement which will try to get TL_WRITE lock on 't1': ---send lock table v1 write; - -connection default; ---echo # Wait until this LOCK TABLES statement starts waiting for table lock. -let $wait_condition= select count(*)= 1 from information_schema.processlist - where state= 'Waiting for table level lock' and - info='lock table v1 write'; ---source include/wait_condition.inc ---echo # Allow SELECT ... FOR UPDATE to resume. ---echo # Since it already has TL_WRITE_ALLOW_WRITE lock on the first instance ---echo # of 't1' it should be able to get lock on the second instance without ---echo # waiting, even although there is another thread which has such lock ---echo # on this table and also there is a thread waiting for a TL_WRITE on it. -set debug_sync= 'now SIGNAL go'; - -connection con_bug45143_2; ---echo # Reap SELECT ... FOR UPDATE ---reap - -connection default; ---echo # Resume execution of the INSERT statement. -select release_lock("lock_bug45143_wait"); - -connection con_bug45143_1; ---echo # Reap INSERT statement. ---echo # In Statement and Mixed replication mode we get here "Unsafe ---echo # for binlog" warnings. In row mode there are no warnings. ---echo # Hide the discrepancy. ---disable_warnings ---reap ---enable_warnings - - -connection con_bug45143_3; ---echo # Reap LOCK TABLES statement. ---reap -unlock tables; - -connection default; ---echo # Do clean-up. -disconnect con_bug45143_1; -disconnect con_bug45143_2; -disconnect con_bug45143_3; -set debug_sync= 'RESET'; -set @@global.general_log= @old_general_log; -drop view v1; -drop table t1; - - --echo # --echo # Bug#50821 Deadlock between LOCK TABLES and ALTER TABLE --echo # @@ -1050,55 +946,6 @@ DROP EVENT e2; SET DEBUG_SYNC="RESET"; ---echo # ---echo # Bug#55930 Assertion `thd->transaction.stmt.is_empty() || ---echo # thd->in_sub_stmt || (thd->state.. ---echo # - ---disable_warnings -DROP TABLE IF EXISTS t1; ---enable_warnings - -CREATE TABLE t1(a INT) engine=InnoDB; -INSERT INTO t1 VALUES (1), (2); - -connect (con1, localhost, root); -connect (con2, localhost, root); - -connection con1; -SET SESSION lock_wait_timeout= 1; -SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL opti_recreate WAIT_FOR opti_analyze'; ---echo # Sending: ---send OPTIMIZE TABLE t1 - -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR opti_recreate'; -SET DEBUG_SYNC= 'after_lock_tables_takes_lock SIGNAL thrlock WAIT_FOR release_thrlock'; ---echo # Sending: ---send INSERT INTO t1 VALUES (3) - -connection default; -SET DEBUG_SYNC= 'now WAIT_FOR thrlock'; -SET DEBUG_SYNC= 'now SIGNAL opti_analyze'; - -connection con1; ---echo # Reaping: OPTIMIZE TABLE t1 ---reap -SET DEBUG_SYNC= 'now SIGNAL release_thrlock'; -disconnect con1; ---source include/wait_until_disconnected.inc - -connection con2; ---echo # Reaping: INSERT INTO t1 VALUES (3) ---reap -disconnect con2; ---source include/wait_until_disconnected.inc - -connection default; -DROP TABLE t1; -SET DEBUG_SYNC= 'RESET'; - - --echo # --echo # Bug#57130 crash in Item_field::print during SHOW CREATE TABLE or VIEW --echo # @@ -1151,6 +998,102 @@ DROP TABLE t1; disconnect con1; disconnect con2; + +--echo # +--echo # Bug#28587 SELECT is blocked by INSERT waiting on read lock, even with low_priority_updates +--echo # +set low_priority_updates=1; +--disable_warnings +drop table if exists t1; +drop table if exists t2; +--enable_warnings +set debug_sync='RESET'; +create table t1 (a int, b int, unique key t1$a (a)); +create table t2 (j int, k int); +set debug_sync='after_lock_tables_takes_lock SIGNAL parked WAIT_FOR go'; +--echo # Sending: +--send insert into t2 select * from t1; +connect (update,localhost,root,,); +connection update; +set debug_sync='now WAIT_FOR parked'; +set low_priority_updates=1; +show variables like 'low_priority_updates'; +let $ID= `select connection_id()`; +--send insert into t1 values (1, 2) ON DUPLICATE KEY UPDATE b = 2; +connect (select,localhost,root,,); +# we must wait till the insert opens and locks the table +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table level lock" and id = $ID; +--source include/wait_condition.inc +select * from t1; +set debug_sync='now SIGNAL go'; +connection default; +disconnect update; +disconnect select; +--echo # Reaping INSERT SELECT +--reap +drop tables t1, t2; +set low_priority_updates=default; +set debug_sync='RESET'; + + +--echo # +--echo # Additional test coverage for LOCK TABLES ... READ LOCAL +--echo # for InnoDB tables. +--echo # +--echo # Check that we correctly handle deadlocks which can occur +--echo # during metadata lock upgrade which happens when one tries +--echo # to use LOCK TABLES ... READ LOCAL for InnoDB tables. + +--enable_connect_log +CREATE TABLE t1 (i INT) ENGINE=InnoDB; +CREATE TABLE t2 (j INT) ENGINE=InnoDB; + +--echo # Execute LOCK TABLE READ LOCK which will pause after acquiring +--echo # SR metadata lock and before upgrading it to SRO lock. +SET DEBUG_SYNC="after_open_table_mdl_shared SIGNAL locked WAIT_FOR go"; +--echo # Sending: +--send LOCK TABLE t1 READ LOCAL + +connect (con1, localhost, root); +SET DEBUG_SYNC="now WAIT_FOR locked"; +--echo # Execute RENAME TABLE which will try to acquire X lock. +--echo # Sending: +--send RENAME TABLE t1 TO t3, t2 TO t1, t3 TO t2 + +connect (con2, localhost, root); +--echo # Wait until RENAME TABLE is blocked. +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "RENAME TABLE t1 TO t3, t2 TO t1, t3 TO t2"; +--source include/wait_condition.inc +--echo # Resume LOCK TABLE statement. It should try to +--echo # upgrade SR lock to SRO lock which will create +--echo # deadlock due to presence of pending X lock. +--echo # Deadlock should be detected and LOCK TABLES should +--echo # release its MDL and retry opening of tables. +SET DEBUG_SYNC="now SIGNAL go"; + +connection con1; +--echo # RENAME TABLE should be able to complete. Reap it. +--reap + +connection default; +--echo # Reap LOCK TABLES. +--reap +--echo # Check that we see new version of table. +SELECT * FROM t1; +UNLOCK TABLES; + +--echo # Clean-up. +SET DEBUG_SYNC="RESET"; +disconnect con1; +disconnect con2; +DROP TABLES t1, t2; +--disable_connect_log + # Check that all connections opened by test cases in this file are really # gone so execution of other tests won't be affected by their presence. --source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/mdl_sync.test b/mysql-test/t/mdl_sync.test index 0b6d6f58013..4aa191d3dfc 100644 --- a/mysql-test/t/mdl_sync.test +++ b/mysql-test/t/mdl_sync.test @@ -119,10 +119,6 @@ alter table t1 add index (not_exist); --echo # lock. --error ER_DUP_ENTRY alter table t1 add primary key (c1); ---echo # Check that SNRW lock is compatible with S lock. -lock table t1 write; -insert into t1 values (1); -unlock tables; --echo # Check that X lock is incompatible with S lock. --echo # Sending: --send rename table t1 to t2; @@ -172,35 +168,6 @@ connection mdl_con1; alter table t1 drop column c2; --echo # connection default; -handler t1 open; ---echo # -connection mdl_con1; ---echo # Check that upgrade from SNRW to X is blocked by presence of S lock. -lock table t1 write; ---echo # Sending: ---send alter table t1 add column c2 int; ---echo # -connection mdl_con2; ---echo # Check that the above upgrade of SNRW to X in ALTER TABLE is blocked ---echo # because of S lock. -let $wait_condition= - select count(*) = 1 from information_schema.processlist - where state = "Waiting for table metadata lock" and - info = "alter table t1 add column c2 int"; ---source include/wait_condition.inc ---echo # -connection default; ---echo # Unblock ALTER TABLE. -handler t1 close; ---echo # -connection mdl_con1; ---echo # Reaping ALTER TABLE. ---reap ---echo # Restore the original state of the things. -alter table t1 drop column c2; -unlock tables; ---echo # -connection default; --echo # --echo # 2) Acquire SH (shared high-priority) lock on the table. --echo # We have to involve DEBUG_SYNC facility for this as usually @@ -797,8 +764,6 @@ lock table t1 write; --echo # connection mdl_con1; --echo # Check that S and SH locks are compatible with it. -handler t1 open; -handler t1 close; select column_name from information_schema.columns where table_schema='test' and table_name='t1'; --echo # Check that SR lock is incompatible with SNRW lock. @@ -1293,8 +1258,6 @@ where state = "Waiting for table metadata lock" and info = "lock table t1 write"; --source include/wait_condition.inc --echo # Check that S and SH locks are compatible with pending SNRW -handler t1 open t; -handler t close; select column_name from information_schema.columns where table_schema='test' and table_name='t1'; --echo # Check that SR is incompatible with pending SNRW @@ -2162,190 +2125,6 @@ disconnect mdl_con3; set debug_sync= 'RESET'; drop table t1, t2; - ---echo # ---echo # Additional coverage for some scenarios in which not quite ---echo # correct use of S metadata locks by HANDLER statement might ---echo # have caused deadlocks. ---echo # ---disable_warnings -drop table if exists t1, t2; ---enable_warnings -connect(handler_con1,localhost,root,,); -connect(handler_con2,localhost,root,,); -connection default; -create table t1 (i int); -create table t2 (j int); -insert into t1 values (1); - ---echo # ---echo # First, check scenario in which we upgrade SNRW lock to X lock ---echo # on a table while having HANDLER READ trying to acquire TL_READ ---echo # on the same table. ---echo # -handler t1 open; ---echo # -connection handler_con1; -lock table t1 write; ---echo # Upgrade SNRW to X lock. ---echo # Sending: ---send alter table t1 add column j int; ---echo # -connection handler_con2; ---echo # Wait until ALTER is blocked during upgrade. -let $wait_condition= - select count(*) = 1 from information_schema.processlist - where state = "Waiting for table metadata lock" and - info = "alter table t1 add column j int"; ---source include/wait_condition.inc ---echo # -connection default; ---echo # The below statement should not cause deadlock. ---send handler t1 read first; ---echo # -connection handler_con1; ---echo # Reap ALTER TABLE. ---reap -unlock tables; ---echo # -connection default; ---echo # Reap HANDLER READ. ---reap -handler t1 close; - ---echo # ---echo # Now, check scenario in which upgrade of SNRW lock to X lock ---echo # can be blocked by HANDLER which is open in connection currently ---echo # waiting to get table-lock owned by connection doing upgrade. ---echo # -handler t1 open; ---echo # -connection handler_con1; -lock table t1 write, t2 read; ---echo # -connection default; ---echo # Execute statement which will be blocked on table-level lock ---echo # owned by connection 'handler_con1'. ---echo # Sending: ---send insert into t2 values (1); ---echo # -connection handler_con1; ---echo # Wait until INSERT is blocked on table-level lock. -let $wait_condition= - select count(*) = 1 from information_schema.processlist - where state = "Waiting for table level lock" and - info = "insert into t2 values (1)"; ---source include/wait_condition.inc ---echo # Sending 'alter table t1 drop column j'. It should not cause ---echo # deadlock. -send alter table t1 drop column j; -connection handler_con2; ---echo # Wait until ALTER is blocked during upgrade. -let $wait_condition= - select count(*) = 1 from information_schema.processlist - where state = "Waiting for table metadata lock" and - info = "alter table t1 drop column j"; ---source include/wait_condition.inc ---echo # -connection default; ---echo # Reap INSERT. ---error ER_LOCK_ABORTED ---reap -handler t1 close; ---echo # -connection handler_con1; ---echo # Reaping 'alter table t1 drop column j' ---reap -unlock tables; -connection default; - ---echo # Then, check the scenario in which upgrade of SNRW lock to X ---echo # lock is blocked by HANDLER which is open in connection currently ---echo # waiting to get SW lock on the same table. ---echo # -handler t1 open; ---echo # -connection handler_con1; -lock table t1 write; ---echo # -connection default; ---echo # The below insert should be blocked because active SNRW lock on 't1'. ---echo # Sending: ---send insert into t1 values (1); ---echo # -connection handler_con1; ---echo # Wait until INSERT is blocked because of SNRW lock. -let $wait_condition= - select count(*) = 1 from information_schema.processlist - where state = "Waiting for table metadata lock" and - info = "insert into t1 values (1)"; ---source include/wait_condition.inc ---echo # The below ALTER TABLE will be blocked because of presence of HANDLER. ---echo # Sending: ---send alter table t1 add column j int; ---echo # -connection default; ---echo # INSERT should be chosen as victim for resolving deadlock. ---echo # Reaping INSERT. ---error ER_LOCK_DEADLOCK ---reap ---echo # Close HANDLER to unblock ALTER TABLE. -handler t1 close; ---echo # -connection handler_con1; ---echo # Reaping ALTER TABLE. ---reap -unlock tables; ---echo # -connection default; - ---echo # ---echo # Finally, test in which upgrade of SNRW lock to X lock is blocked ---echo # by HANDLER which is open in connection currently waiting to get ---echo # SR lock on the table on which lock is upgraded. ---echo # -handler t1 open; ---echo # -connection handler_con1; -lock table t1 write, t2 write; ---echo # -connection default; ---echo # The below insert should be blocked because active SNRW lock on 't1'. ---echo # Sending: ---send insert into t2 values (1); ---echo # -connection handler_con1; ---echo # Wait until INSERT is blocked because of SNRW lock. -let $wait_condition= - select count(*) = 1 from information_schema.processlist - where state = "Waiting for table metadata lock" and - info = "insert into t2 values (1)"; ---source include/wait_condition.inc ---echo # The below ALTER TABLE will be blocked because of presence of HANDLER. ---echo # Sending: ---send alter table t1 drop column j; ---echo # -connection default; ---echo # INSERT should be chosen as victim for resolving deadlock. ---echo # Reaping INSERT. ---error ER_LOCK_DEADLOCK ---reap ---echo # Close HANDLER to unblock ALTER TABLE. -handler t1 close; ---echo # -connection handler_con1; ---echo # Reaping ALTER TABLE. ---reap -unlock tables; ---echo # -connection default; - ---echo # Clean-up. -disconnect handler_con1; -disconnect handler_con2; -drop tables t1, t2; - - --echo # --echo # Test coverage for basic deadlock detection in metadata --echo # locking subsystem. diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index 689c52faabc..09f313616f1 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -2878,6 +2878,19 @@ drop tables m1, t1, t4; drop view t3; +--echo # +--echo # MDEV-10424 - Assertion `ticket == __null' failed in +--echo # MDL_request::set_type +--echo # +CREATE TABLE t1 (f1 INT) ENGINE=MyISAM; +CREATE TABLE tmerge (f1 INT) ENGINE=MERGE UNION=(t1); +PREPARE stmt FROM "ANALYZE TABLE tmerge, t1"; +EXECUTE stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t1, tmerge; + + --echo End of 5.5 tests diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index 0297280340d..4e09b2370f5 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -8,17 +8,6 @@ source include/have_log_bin.inc; CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT."); ---disable_warnings -drop table if exists t1,t2,t3; -drop database if exists mysqltest; -drop view if exists v1; ---error 0,ER_NONEXISTING_GRANT,ER_NONEXISTING_TABLE_GRANT -revoke all privileges on mysqltest.t1 from mysqltest_1@localhost; ---error 0,ER_NONEXISTING_GRANT,ER_NONEXISTING_TABLE_GRANT -revoke all privileges on mysqltest.* from mysqltest_1@localhost; -delete from mysql.user where user=_binary'mysqltest_1'; ---enable_warnings - create table t1(id1 int not null auto_increment primary key, t char(12)); create table t2(id2 int not null, t char(12)); create table t3(id3 int not null, t char(12), index(id3)); @@ -372,9 +361,7 @@ drop table t1, t2; connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connection root; ---disable_warnings create database mysqltest; ---enable_warnings create table mysqltest.t1 (a int, b int, primary key (a)); create table mysqltest.t2 (a int, b int, primary key (a)); create table mysqltest.t3 (a int, b int, primary key (a)); @@ -415,22 +402,6 @@ update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1; delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1; drop table t1,t2; -# Test for Bug#5837 delete with outer join and const tables ---disable_warnings -create table t1 ( - aclid bigint not null primary key, - status tinyint(1) not null -) engine = innodb; - -create table t2 ( - refid bigint not null primary key, - aclid bigint, index idx_acl(aclid) -) engine = innodb; ---enable_warnings -insert into t2 values(1,null); -delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1'; -drop table t1, t2; - # # Bug#19225 unchecked error leads to server crash # @@ -441,47 +412,6 @@ delete from t1,t2 using t1,t2 where t1.a=(select a from t1); drop table t1, t2; # End of 4.1 tests -# -# Test for Bug#1980. -# ---disable_warnings -create table t1 ( c char(8) not null ) engine=innodb; ---enable_warnings - -insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'); -insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F'); - -alter table t1 add b char(8) not null; -alter table t1 add a char(8) not null; -alter table t1 add primary key (a,b,c); -update t1 set a=c, b=c; - -create table t2 like t1; -insert into t2 select * from t1; - -delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b; - -drop table t1,t2; - ---disable_warnings -create table t1 ( c char(8) not null ) engine=innodb; ---enable_warnings - -insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'); -insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F'); - -alter table t1 add b char(8) not null; -alter table t1 add a char(8) not null; -alter table t1 add primary key (a,b,c); -update t1 set a=c, b=c; - -create table t2 like t1; -insert into t2 select * from t1; - -delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b; - -drop table t1,t2; - # # Test alter table and a concurrent multi update # (Before we have introduced data-lock-aware metadata locks @@ -618,9 +548,6 @@ set @@session.binlog_format= @sav_binlog_format; # # prepare ---disable_warnings -drop table if exists t1, t2, t3; ---enable_warnings CREATE TABLE t1 (a int, PRIMARY KEY (a)); CREATE TABLE t2 (a int, PRIMARY KEY (a)); CREATE TABLE t3 (a int, PRIMARY KEY (a)) ENGINE=MyISAM; @@ -1057,54 +984,3 @@ deallocate prepare stmt1; drop view v3,v2,v1; drop table t1,t2,t3; --echo end of 5.5 tests - - ---source include/have_xtradb.inc - ---echo ---echo # Bug mdev-5970 ---echo # Bug#13256831 - ERROR 1032 (HY000): CAN'T FIND RECORD ---echo - -CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB; -CREATE TABLE t2 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (5, 7); -INSERT INTO t2 VALUES (6, 97); - -CREATE ALGORITHM = MERGE VIEW v1 AS -SELECT a2.f1 AS f1, a2.f2 AS f2 -FROM t1 AS a1 JOIN t2 AS a2 ON a1.f2 > a2.f1 -WITH LOCAL CHECK OPTION; - -SELECT * FROM v1; -UPDATE v1 SET f1 = 1; -SELECT * FROM v1; - -DROP TABLE t1, t2; -DROP VIEW v1; - ---echo # ---echo # MDEV-5973: MySQL Bug#11757486:49539: NON-DESCRIPTIVE ERR (ERROR 0 ---echo # FROM STORAGE ENGINE) WITH MULTI-TABLE UPDATE ---echo # - -CREATE TABLE table_11757486 (field1 tinyint) ENGINE=INNODB; -INSERT INTO table_11757486 VALUES (0),(0); -SET SESSION SQL_MODE='STRICT_ALL_TABLES'; -UPDATE IGNORE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1; -UPDATE IGNORE table_11757486 SET field1=128; - ---error ER_WARN_DATA_OUT_OF_RANGE -UPDATE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1; ---error ER_WARN_DATA_OUT_OF_RANGE -UPDATE table_11757486 SET field1=128; - -SET SESSION SQL_MODE=''; -UPDATE IGNORE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1; -UPDATE IGNORE table_11757486 SET field1=128; - -DROP TABLE table_11757486; - -SET SESSION SQL_MODE=default; - ---echo end of 10.0 tests diff --git a/mysql-test/t/multi_update_innodb.test b/mysql-test/t/multi_update_innodb.test index 51757c29553..f5f8f91edb8 100644 --- a/mysql-test/t/multi_update_innodb.test +++ b/mysql-test/t/multi_update_innodb.test @@ -75,3 +75,101 @@ UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_2=10,B.pk_2=11; SELECT * FROM t2; DROP TABLE t1,t2; + +--echo +--echo # Bug mdev-5970 +--echo # Bug#13256831 - ERROR 1032 (HY000): CAN'T FIND RECORD +--echo + +CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB; +CREATE TABLE t2 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (5, 7); +INSERT INTO t2 VALUES (6, 97); + +CREATE ALGORITHM = MERGE VIEW v1 AS +SELECT a2.f1 AS f1, a2.f2 AS f2 +FROM t1 AS a1 JOIN t2 AS a2 ON a1.f2 > a2.f1 +WITH LOCAL CHECK OPTION; + +SELECT * FROM v1; +UPDATE v1 SET f1 = 1; +SELECT * FROM v1; + +DROP TABLE t1, t2; +DROP VIEW v1; + +--echo # +--echo # MDEV-5973: MySQL Bug#11757486:49539: NON-DESCRIPTIVE ERR (ERROR 0 +--echo # FROM STORAGE ENGINE) WITH MULTI-TABLE UPDATE +--echo # + +CREATE TABLE table_11757486 (field1 tinyint) ENGINE=INNODB; +INSERT INTO table_11757486 VALUES (0),(0); +SET SESSION SQL_MODE='STRICT_ALL_TABLES'; +UPDATE IGNORE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1; +UPDATE IGNORE table_11757486 SET field1=128; + +--error ER_WARN_DATA_OUT_OF_RANGE +UPDATE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1; +--error ER_WARN_DATA_OUT_OF_RANGE +UPDATE table_11757486 SET field1=128; + +SET SESSION SQL_MODE=''; +UPDATE IGNORE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1; +UPDATE IGNORE table_11757486 SET field1=128; + +DROP TABLE table_11757486; + +SET SESSION SQL_MODE=default; + +# Test for Bug#5837 delete with outer join and const tables +create table t1 ( + aclid bigint not null primary key, + status tinyint(1) not null +) engine = innodb; + +create table t2 ( + refid bigint not null primary key, + aclid bigint, index idx_acl(aclid) +) engine = innodb; +insert into t2 values(1,null); +delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1'; +drop table t1, t2; + +# +# Test for Bug#1980. +# +create table t1 ( c char(8) not null ) engine=innodb; + +insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'); +insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F'); + +alter table t1 add b char(8) not null; +alter table t1 add a char(8) not null; +alter table t1 add primary key (a,b,c); +update t1 set a=c, b=c; + +create table t2 like t1; +insert into t2 select * from t1; + +delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b; + +drop table t1,t2; + +create table t1 ( c char(8) not null ) engine=innodb; + +insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'); +insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F'); + +alter table t1 add b char(8) not null; +alter table t1 add a char(8) not null; +alter table t1 add primary key (a,b,c); +update t1 set a=c, b=c; + +create table t2 like t1; +insert into t2 select * from t1; + +delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b; + +drop table t1,t2; + diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index f1813dd0ca4..8df9a0c82bf 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -588,8 +588,16 @@ DROP DATABASE connected_db; # USE and names with backticks # --write_file $MYSQLTEST_VARDIR/tmp/backticks.sql +\u aa`bb``cc +SELECT DATABASE(); +USE test +SELECT DATABASE(); USE aa`bb``cc SELECT DATABASE(); +USE test +SELECT DATABASE(); +USE `aa``bb````cc` +SELECT DATABASE(); EOF create database `aa``bb````cc`; --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/backticks.sql diff --git a/mysql-test/t/mysql_not_windows.test b/mysql-test/t/mysql_not_windows.test index 66853677f7b..591de74cbbf 100644 --- a/mysql-test/t/mysql_not_windows.test +++ b/mysql-test/t/mysql_not_windows.test @@ -13,3 +13,12 @@ --echo --echo End of tests + +# Multi-line exec +exec $MYSQL \ + test -e "select 1"; +exec $MYSQL test -e "select + 2"; +let $query = select 3 + as X; +exec $MYSQL test -e "$query"; diff --git a/mysql-test/t/mysqlbinlog_row_compressed.test b/mysql-test/t/mysqlbinlog_row_compressed.test new file mode 100644 index 00000000000..1a7ce093986 --- /dev/null +++ b/mysql-test/t/mysqlbinlog_row_compressed.test @@ -0,0 +1,68 @@ +# +# Test for compressed row event +# + +--source include/have_log_bin.inc +--source include/have_binlog_format_row.inc + +# +# +# mysqlbinlog: compressed row event +# +# + +SET GLOBAL log_bin_compress=on; +SET GLOBAL log_bin_compress_min_len=10; +CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1)); +CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1)); +INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, ""); +INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL); +INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A"); +INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A"); +INSERT INTO t2 SELECT * FROM t1; +UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL; +DELETE FROM t1; +DELETE FROM t2; + +--let $binlog = query_get_value(SHOW MASTER STATUS, File, 1) +--let $datadir = `SELECT @@datadir` + +FLUSH BINARY LOGS; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--replace_regex /\d{6} *\d*:\d\d:\d\d// /Start:.*at startup/Start: xxx/ /SET TIMESTAMP=\d*/SET TIMESTAMP=X/ /exec_time=\d*/exec_time=x/ /mapped to number \d*/mapped to number num/ /CRC32 0x[0-9a-f]+/CRC32 XXX/ +--exec $MYSQL_BINLOG --verbose --verbose --base64-output=DECODE-ROWS $datadir/$binlog + +--echo +--echo Test mysqlbinlog | mysql type point-in-time recovery with compressed events. +--echo + +FLUSH BINARY LOGS; +--let $binlog_file = query_get_value(SHOW MASTER STATUS, File, 1) +CREATE TABLE t3 (a INT PRIMARY KEY, b INT, c VARCHAR(100)); +INSERT INTO t3 VALUES (0, 10, "hello"); +BEGIN; +INSERT INTO t3 VALUES (1, 10, "cat"), (2, 10, "mouse"), (3, 10, "dog"); +INSERT INTO t3 VALUES (4, 10, "goodbye"); +COMMIT; +UPDATE t3 SET b=b+100 where a<>1; +DELETE FROM t3 WHERE a=2; +SET @old_image=@@binlog_row_image; +SET binlog_row_image=minimal; +INSERT INTO t3 VALUES (5, 20, "red"), (6, 30, "green"), (7, 40, "blue"); +INSERT INTO t3 VALUES (8, 20, "rigel"); +UPDATE t3 SET c = concat("colour of ", c) WHERE a > 5; +UPDATE t3 SET b=b*2 WHERE a IN (5,6,7); +DELETE FROM t3 WHERE a=6; +SET binlog_row_image=@old_image; +SELECT * FROM t3 ORDER BY a; +FLUSH LOGS; +DROP TABLE t3; + +--let $MYSQLD_DATADIR= `select @@datadir` +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/$binlog_file | $MYSQL + +SELECT * FROM t3 ORDER BY a; + +DROP TABLE t1,t2,t3; +SET GLOBAL log_bin_compress=off; +SET GLOBAL log_bin_compress_min_len=256; diff --git a/mysql-test/t/mysqlbinlog_stmt_compressed.test b/mysql-test/t/mysqlbinlog_stmt_compressed.test new file mode 100644 index 00000000000..c4331ddf229 --- /dev/null +++ b/mysql-test/t/mysqlbinlog_stmt_compressed.test @@ -0,0 +1,59 @@ +# +# Test for compressed query event +# + +--source include/have_log_bin.inc +--source include/have_binlog_format_statement.inc + +# +# +# mysqlbinlog: compressed query event +# +# + +SET GLOBAL log_bin_compress=on; +SET GLOBAL log_bin_compress_min_len=10; +CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1)); +CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1)); +INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, ""); +INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL); +INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A"); +INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A"); +INSERT INTO t2 SELECT * FROM t1; +UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL; +DELETE FROM t1; +DELETE FROM t2; + +--let $binlog = query_get_value(SHOW MASTER STATUS, File, 1) +--let $datadir = `SELECT @@datadir` + +FLUSH BINARY LOGS; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--replace_regex /\d{6} *\d*:\d\d:\d\d// /Start:.*at startup/Start: xxx/ /SET TIMESTAMP=\d*/SET TIMESTAMP=X/ /exec_time=\d*/exec_time=x/ /mapped to number \d*/mapped to number num/ /CRC32 0x[0-9a-f]+/CRC32 XXX/ +--exec $MYSQL_BINLOG --verbose --verbose --base64-output=DECODE-ROWS $datadir/$binlog + +--echo +--echo Test mysqlbinlog | mysql type point-in-time recovery with compressed events. +--echo + +FLUSH BINARY LOGS; +--let $binlog_file = query_get_value(SHOW MASTER STATUS, File, 1) +CREATE TABLE t3 (a INT PRIMARY KEY, b INT, c VARCHAR(100)); +INSERT INTO t3 VALUES (0, 10, "hello"); +BEGIN; +INSERT INTO t3 VALUES (1, 10, "cat"), (2, 10, "mouse"), (3, 10, "dog"); +INSERT INTO t3 VALUES (4, 10, "goodbye"); +COMMIT; +DELETE FROM t3 WHERE a=2; +SELECT * FROM t3 ORDER BY a; +FLUSH LOGS; +DROP TABLE t3; + +--let $MYSQLD_DATADIR= `select @@datadir` +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/$binlog_file | $MYSQL + +SELECT * FROM t3 ORDER BY a; + +DROP TABLE t1,t2,t3; +SET GLOBAL log_bin_compress=off; +SET GLOBAL log_bin_compress_min_len=256; diff --git a/mysql-test/t/mysqldump-nl.test b/mysql-test/t/mysqldump-nl.test new file mode 100644 index 00000000000..311996e77c3 --- /dev/null +++ b/mysql-test/t/mysqldump-nl.test @@ -0,0 +1,38 @@ +# +# New lines in identifiers +# + +# embedded server doesn't support external clients +--source include/not_embedded.inc +# cmd.exe doesn't like new lines on the command line +--source include/not_windows.inc + +create database `mysqltest1 +1tsetlqsym`; +use `mysqltest1 +1tsetlqsym`; + +create table `t1 +1t` (`foobar +raboof` int); +create view `v1 +1v` as select * from `t1 +1t`; + +create procedure sp() select * from `v1 +1v`; + +flush tables; +use test; + +exec $MYSQL_DUMP --compact --comment --routines --add-drop-database --databases 'mysqltest1 +1tsetlqsym'; + +exec $MYSQL_DUMP --compact --comment --routines --add-drop-database --databases 'mysqltest1 +1tsetlqsym' | $MYSQL; + +show tables from `mysqltest1 +1tsetlqsym`; + +drop database `mysqltest1 +1tsetlqsym`; diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index a797dff572e..b2706a8459f 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -740,15 +740,6 @@ echo ; --error 1 --exec echo "--exec " | $MYSQL_TEST 2>&1 -# Multi-line exec -exec $MYSQL - test -e "select 1"; -exec $MYSQL test -e "select - 2"; -let $query = select 3 - as X; -exec $MYSQL test -e "$query"; - # ---------------------------------------------------------------------------- # Test let command # ---------------------------------------------------------------------------- diff --git a/mysql-test/t/null.test b/mysql-test/t/null.test index 8f130cc9b8e..072038fae50 100644 --- a/mysql-test/t/null.test +++ b/mysql-test/t/null.test @@ -1007,6 +1007,23 @@ INSERT INTO t1 VALUES (1),(2); SELECT * FROM t1 WHERE NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(i = ROUND(0), 14), 13), 12), 11), 10), 9), 8), 7), 6), 5), 4), 3), 2), 1); DROP TABLE t1; +--echo # +--echo # MDEV-10347 mysqld got signal 11 +--echo # + +CREATE TABLE t1 (f1 VARCHAR(10), f2 VARCHAR(40)); +CREATE TABLE t2 (f3 VARCHAR(20)); +PREPARE stmt FROM " + SELECT ( + SELECT IFNULL(f3,4) FROM t2 + WHERE IFNULL(NULLIF(f1,''),1) + ) AS sq + FROM t1 + GROUP BY f2 +"; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t2,t1; --echo # --echo # MDEV-10236 Where expression with NOT function gives incorrect result diff --git a/mysql-test/t/parser.test b/mysql-test/t/parser.test index 5970b564c85..1fa7df7fc3d 100644 --- a/mysql-test/t/parser.test +++ b/mysql-test/t/parser.test @@ -771,6 +771,16 @@ select 0<=!0, 0 <= !0; select 1<2 THEN 'SELECT 1 AS c' ELSE 'SELECT 2 AS c' END; +EXECUTE IMMEDIATE TRIM('SELECT 1 AS c'); +EXECUTE IMMEDIATE SUBSTRING('SELECT 1 AS c' FROM 1); +EXECUTE IMMEDIATE COALESCE(NULL, 'SELECT 1 AS c'); + +--echo # +--echo # Testing SET STATEMENT and system variables +--echo # +CREATE TABLE t1 (a INT); +SET STATEMENT max_sort_length=1025 FOR EXECUTE IMMEDIATE CONCAT('INSERT INTO t1 VALUES (', @@max_sort_length, ')'); +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # End of MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions +--echo # + +--echo # +--echo # End of 10.2 tests +--echo # + + +--echo # +--echo # MDEV-11360 Dynamic SQL: DEFAULT as a bind parameter +--echo # + +# Correct usage +CREATE TABLE t1 (a INT DEFAULT 10, b INT DEFAULT NULL); +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?,?)' USING DEFAULT, DEFAULT; +SELECT * FROM t1; +UPDATE t1 SET a=20, b=30; +SELECT * FROM t1; +EXECUTE IMMEDIATE 'UPDATE t1 SET a=?,b=?' USING DEFAULT, DEFAULT; +SELECT * FROM t1; +DROP TABLE t1; + +# Incorrect usage in a expression in INSERT..VALUES +CREATE TABLE t1 (a INT DEFAULT 10); +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?+1)' USING DEFAULT; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (CONCAT(?,?))' USING DEFAULT, 'test'; +DROP TABLE t1; + +# Incorrect usage in UPDATE..SET +CREATE TABLE t1 (a INT DEFAULT 10); +INSERT INTO t1 VALUES (20); +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'UPDATE t1 SET a=?+1' USING DEFAULT; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'UPDATE t1 SET a=CONCAT(?,?)' USING DEFAULT, 'test'; +DROP TABLE t1; + +# Incorrect usage in not an UPDATE/INSERT query at all +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CAST(? AS SIGNED)' USING DEFAULT; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CAST(? AS DOUBLE)' USING DEFAULT; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CAST(? AS CHAR)' USING DEFAULT; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CAST(? AS DECIMAL(10,1))' USING DEFAULT; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CAST(? AS TIME)' USING DEFAULT; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CAST(? AS DATE)' USING DEFAULT; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CAST(? AS DATETIME)' USING DEFAULT; + +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT ?+1' USING DEFAULT; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CONCAT(?,?)' USING DEFAULT,'test'; + +# Incorrect usage in the LIMIT clause +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT 1 LIMIT ?' USING DEFAULT; +CREATE TABLE t1 (a INT DEFAULT 10); +INSERT INTO t1 VALUES (1),(2),(3); +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT * FROM t1 LIMIT ?' USING DEFAULT; +DROP TABLE t1; + +--echo # The output of this query in 'Note' is a syntactically incorrect query. +--echo # But as it's never logged, it's ok. It should be human readable only. +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT ?' USING DEFAULT; + +# This tests Item_param::eq() for DEFAULT as a bound value +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>?+a' USING DEFAULT,DEFAULT; +DROP TABLE t1; diff --git a/mysql-test/t/ps_ddl.test b/mysql-test/t/ps_ddl.test index 21355ca42b7..90226d379bf 100644 --- a/mysql-test/t/ps_ddl.test +++ b/mysql-test/t/ps_ddl.test @@ -2259,3 +2259,27 @@ EXECUTE stmt3; EXECUTE stmt3; DEALLOCATE PREPARE stmt3; DROP TEMPORARY TABLES tm, t1; + +--echo # +--echo # Start of 10.1 tests +--echo # + +--echo # +--echo # MDEV-10702 Crash in SET STATEMENT FOR EXECUTE +--echo # +CREATE TABLE t1 (a INT); +PREPARE stmt FROM 'INSERT INTO t1 VALUES (@@max_sort_length)'; +SET STATEMENT max_sort_length=2048 FOR EXECUTE stmt; +SELECT * FROM t1; +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=NEW.a + 1; +SET STATEMENT max_sort_length=2048 FOR EXECUTE stmt; +SELECT * FROM t1; +DROP TRIGGER tr1; +SET STATEMENT max_sort_length=2048 FOR EXECUTE stmt; +SELECT * FROM t1; +DROP TABLE t1; + + +--echo # +--echo # End of 10.1 tests +--echo # diff --git a/mysql-test/t/rowid_order_innodb.test b/mysql-test/t/rowid_order_innodb.test index 1053b8bd7c2..152eb28d388 100644 --- a/mysql-test/t/rowid_order_innodb.test +++ b/mysql-test/t/rowid_order_innodb.test @@ -8,7 +8,7 @@ # main code t/rowid_order_innodb.test -> include/rowid_order.inc # ---source include/have_xtradb.inc +--source include/have_innodb.inc let $engine_type= InnoDB; --source include/rowid_order.inc diff --git a/mysql-test/t/selectivity.test b/mysql-test/t/selectivity.test index 92e38604a30..3e60f242083 100644 --- a/mysql-test/t/selectivity.test +++ b/mysql-test/t/selectivity.test @@ -972,6 +972,79 @@ set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivit DROP TABLE t1,t2; - set use_stat_tables=@save_use_stat_tables; +--echo # +--echo # Bug mdev-11096: range condition over column without statistical data +--echo # + +set use_stat_tables='preferably'; +set optimizer_use_condition_selectivity=3; + +create table t1(col1 char(32)); +insert into t1 values ('a'),('b'),('c'),('d'), ('e'),('f'),('g'),('h'); +analyze table t1 persistent for columns () indexes (); + +explain extended +select * from t1 where col1 > 'b' and col1 < 'e'; +select * from t1 where col1 > 'b' and col1 < 'e'; + +drop table t1; + +set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +set use_stat_tables=@save_use_stat_tables; + +--echo # +--echo # Bug mdev-9628: unindexed blob column without min-max statistics +--echo # with optimizer_use_condition_selectivity=3 +--echo # + +set use_stat_tables='preferably'; +set optimizer_use_condition_selectivity=3; + +create table t1(col1 char(32)); +insert into t1 values ('a'),('b'),('c'),('d'), ('e'),('f'),('g'),('h'); +analyze table t1; + +create table t2(col1 text); +insert into t2 values ('a'),('b'),('c'),('d'), ('e'),('f'),('g'),('h'); +analyze table t2; + +select * from t1 where col1 > 'b' and col1 < 'd'; +explain extended +select * from t1 where col1 > 'b' and col1 < 'd'; + +select * from t2 where col1 > 'b' and col1 < 'd'; +explain extended +select * from t2 where col1 > 'b' and col1 < 'd'; + +select * from t2 where col1 < 'b' and col1 > 'd'; +explain extended +select * from t2 where col1 < 'b' and col1 > 'd'; + +drop table t1,t2; + +set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +set use_stat_tables=@save_use_stat_tables; + +--echo # +--echo # Bug mdev-11364: IS NULL over not nullable datetime column +--echo # in mergeable derived +--echo # + +set use_stat_tables='preferably'; +set optimizer_use_condition_selectivity=4; +set HISTOGRAM_SIZE = 255; + +CREATE TABLE t1 (t TIME, d DATE NOT NULL); +INSERT INTO t1 VALUES ('10:00:00', '0000-00-00'),('11:00:00','0000-00-00'); + +ANALYZE TABLE t1; + +SELECT * FROM (SELECT t FROM t1 WHERE d IS NULL) sq; + +DROP TABLE t1; + +set histogram_size=@save_histogram_size; +set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +set use_stat_tables=@save_use_stat_tables; diff --git a/mysql-test/t/selectivity_innodb.test b/mysql-test/t/selectivity_innodb.test index d6a77eac600..e2dba034363 100644 --- a/mysql-test/t/selectivity_innodb.test +++ b/mysql-test/t/selectivity_innodb.test @@ -109,10 +109,68 @@ where t1.child_user_id=t3.id and t1.child_group_id is null and t2.lower_group_na drop table t1,t2,t3; +--echo # +--echo # MDEV-9187: duplicate of bug mdev-9628 +--echo # + +set use_stat_tables = preferably; +set optimizer_use_condition_selectivity=3; + +CREATE TABLE t1 (f1 char(32)) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('foo'),('bar'),('qux'); +ANALYZE TABLE t1; + +SELECT * FROM t1 WHERE f1 < 'm'; +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE f1 < 'm'; + +CREATE TABLE t2 (f1 TEXT) ENGINE=InnoDB; +INSERT INTO t2 VALUES ('foo'),('bar'),('qux'); +ANALYZE TABLE t2; + +SELECT * FROM t2 WHERE f1 <> 'qux'; +EXPLAIN EXTENDED +SELECT * FROM t2 WHERE f1 <> 'qux'; + +DROP TABLE t1,t2; + --echo # --echo # End of 10.0 tests --echo # + +--echo # +--echo # Start of 10.1 tests +--echo # + +--echo # +--echo # MDEV-11060: sql/protocol.cc:532: void Protocol::end_statement(): Assertion `0' failed +--echo # + + +set optimizer_use_condition_selectivity=4; + +--disable_warnings +drop view if exists v1; +--enable_warnings + +create table t1 (a int not null, b int, c int) engine=InnoDB; +create trigger trgi before insert on t1 for each row set new.a=if(new.a is null,new.b,new.c); + +create table t2 (d int, e int) engine=InnoDB; +update t1, t2 set a=NULL, b=2, c=NULL where b=d and e=200; + +create view v1 as select * from t1, t2 where d=2; +--error ER_BAD_NULL_ERROR +insert v1 (a,c) values (NULL, 20); + +drop table t1,t2; +drop view v1; + +--echo # +--echo # End of 10.1 tests +--echo # + set use_stat_tables= @tmp_ust; set optimizer_use_condition_selectivity= @tmp_oucs; SET SESSION STORAGE_ENGINE=DEFAULT; diff --git a/mysql-test/t/show_explain_ps.test b/mysql-test/t/show_explain_ps.test index 4ad1e4304de..b43cd559e09 100644 --- a/mysql-test/t/show_explain_ps.test +++ b/mysql-test/t/show_explain_ps.test @@ -6,6 +6,11 @@ # Like all other perfschema tests, we don't work on embedded server: --source include/not_embedded.inc +# There is a query below that selects from P_S tables. +# Remove possible history that could confuse it +truncate table performance_schema.events_statements_history_long; +truncate table performance_schema.events_stages_history_long; + --disable_warnings drop table if exists t0, t1; --enable_warnings @@ -45,7 +50,11 @@ reap; set debug_dbug=''; select event_name -from performance_schema.events_waits_history_long -where event_name='wait/synch/cond/sql/show_explain'; - +from +performance_schema.events_stages_history_long +where + event_name like '%show explain' and + thread_id in(select thread_id + from performance_schema.events_statements_history_long + where EVENT_NAME='statement/sql/show_explain'); drop table t0; diff --git a/mysql-test/t/slowlog_enospace-10508.test b/mysql-test/t/slowlog_enospace-10508.test new file mode 100644 index 00000000000..b2c26a5984d --- /dev/null +++ b/mysql-test/t/slowlog_enospace-10508.test @@ -0,0 +1,24 @@ +# +# MDEV-10508 Mariadb crash on out of disk space during dump import +# +--source include/have_sequence.inc +--source include/have_debug.inc + +call mtr.add_suppression('Error writing file.*errno: 28 '); +create table t1 (a int, b int) engine=memory; +insert t1 select seq, seq+1 from seq_1_to_1000; +set global general_log=0; +set global log_queries_not_using_indexes=1; +set debug_dbug='+d,simulate_file_write_error'; +--disable_result_log +--let $run= 50 +while ($run) +{ + select * from t1 where a>10; + dec $run; +} +--enable_result_log +set debug_dbug=''; +set global general_log=1; +set global log_queries_not_using_indexes=default; +drop table t1; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index c80e1eaaa3e..08f7fa5035b 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -9291,6 +9291,57 @@ CALL p1; DROP PROCEDURE p1; DROP TABLE t1; +--echo # +--echo # MDEV-10713: signal 11 error on multi-table update - crash in +--echo # handler::increment_statistics or in make_select or assertion +--echo # failure pfs_thread == ((PFS_thread*) pthread_getspecific((THR_PFS))) +--echo # + +CREATE TABLE `t1` ( + `CLOSE_YN` varchar(10) COLLATE utf8_bin DEFAULT NULL +) DEFAULT CHARSET=utf8 COLLATE=utf8_bin ; + + +CREATE TABLE `t2` ( + `ap_close_to` varchar(8) COLLATE utf8_bin DEFAULT NULL +) DEFAULT CHARSET=utf8 COLLATE=utf8_bin ; +insert t1 values (1); + + +--delimiter $$ + +CREATE FUNCTION `f1`(`P_DC_CD` VARBINARY(50), `P_SYS_DATE` DATETIME) RETURNS datetime + DETERMINISTIC + SQL SECURITY INVOKER +BEGIN + DECLARE V_SYS_DATE DATETIME; + SELECT now() AS LOC_DATE INTO V_SYS_DATE ; + RETURN v_sys_date ; +END $$ + +--delimiter ; + +update t1 S +JOIN +( + SELECT CASE + WHEN DATE_FORMAT( f1('F01', NOW()) , '%Y%m%d') <= CLOSE_YMD + THEN '99991231' + ELSE '' END ACCOUNT_APPLY_YYYYMMDD + FROM ( + select case + when 'AP'='AP' + then ap_close_to + end AS CLOSE_YMD + from t2 + ) A +) X +SET S.CLOSE_YN = '' +where 1=1; + +drop function if exists f1; +drop table t1,t2; + --echo # End of 5.5 test --echo # @@ -9446,3 +9497,54 @@ end | --delimiter ; drop table t1,t2; + +--echo # +--echo # MDEV-11584: GRANT inside an SP does not work well on 2nd execution +--echo # + +CREATE PROCEDURE sp1() + GRANT ALL PRIVILEGES ON *.* TO 'foo'@'%' IDENTIFIED BY 'pass'; +CALL sp1(); +CALL sp1(); +drop user 'foo'@'%'; +drop procedure sp1; + + +--echo #End of 10.1 tests + +--echo # +--echo # MDEV-11081: CURSOR for query with GROUP BY +--echo # + +CREATE TABLE t1 (name VARCHAR(10), value INT); +INSERT INTO t1 VALUES ('b',1); +INSERT INTO t1 VALUES ('b',1); +INSERT INTO t1 VALUES ('c',1); +INSERT INTO t1 VALUES ('a',1); +INSERT INTO t1 VALUES ('a',1); +INSERT INTO t1 VALUES ('a',1); +DELIMITER |; +CREATE PROCEDURE p1 () +BEGIN + DECLARE done INT DEFAULT FALSE; + DECLARE v_name VARCHAR(10); + DECLARE v_total INT; + DECLARE c CURSOR FOR + SELECT name, SUM(value) AS total FROM t1 GROUP BY name; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + OPEN c; +read_loop: + LOOP + FETCH c INTO v_name, v_total; + IF done THEN + LEAVE read_loop; + END IF; + SELECT v_name, v_total; + END LOOP; + CLOSE c; +END; +| +DELIMITER ;| +CALL p1(); +DROP PROCEDURE p1; +DROP TABLE t1; diff --git a/mysql-test/t/statistics.test b/mysql-test/t/statistics.test index d8b56b9c0a3..d75a01333cb 100644 --- a/mysql-test/t/statistics.test +++ b/mysql-test/t/statistics.test @@ -740,6 +740,30 @@ show variables like 'use_stat_tables'; analyze table t1; drop table t1; +--echo # +--echo # MDEV-10435 crash with bad stat tables +--echo # + +set use_stat_tables='preferably'; +call mtr.add_suppression("Column count of mysql.table_stats is wrong. Expected 3, found 1. The table is probably corrupted"); + +rename table mysql.table_stats to test.table_stats; +flush tables; +create table t1 (a int); +--error ER_NO_SUCH_TABLE +rename table t1 to t2, t3 to t4; +drop table t1; +rename table test.table_stats to mysql.table_stats; + +rename table mysql.table_stats to test.table_stats; +create table mysql.table_stats (a int); +flush tables; +create table t1 (a int); +--error ER_NO_SUCH_TABLE +rename table t1 to t2, t3 to t4; +drop table t1, mysql.table_stats; +rename table test.table_stats to mysql.table_stats; + set use_stat_tables=@save_use_stat_tables; --echo # diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test index e0b0d9c8838..7ab32241bcb 100644 --- a/mysql-test/t/status.test +++ b/mysql-test/t/status.test @@ -23,13 +23,13 @@ SET GLOBAL LOG_OUTPUT = 'FILE'; connect (con1,localhost,root,,); connect (con2,localhost,root,,); +connection default; flush status; show status like 'Table_lock%'; select * from information_schema.session_status where variable_name like 'Table_lock%'; -connection con1; set sql_log_bin=0; set @old_general_log = @@global.general_log; set global general_log = 'OFF'; @@ -39,35 +39,46 @@ drop table if exists t1; create table t1(n int) engine=myisam; insert into t1 values(1); -# Execute dummy select in order to ensure that tables used in the -# previous statement are unlocked and closed. -select 1; +select get_lock('mysqltest_lock', 100); connection con2; -lock tables t1 read; -unlock tables; -lock tables t1 read; +--echo # Sending: +--send update t1 set n = get_lock('mysqltest_lock', 100) connection con1; +--echo # Wait for the first UPDATE to get blocked. +let $wait_condition= select count(*) from INFORMATION_SCHEMA.PROCESSLIST + where STATE = "User lock" and + INFO = "update t1 set n = get_lock('mysqltest_lock', 100)"; +--source include/wait_condition.inc + let $ID= `select connection_id()`; +--echo # Sending: --send update t1 set n = 3 -connection con2; -# wait for the other query to start executing +connection default; +--echo # wait for the second UPDATE to get blocked let $wait_condition= select 1 from INFORMATION_SCHEMA.PROCESSLIST where ID = $ID and STATE = "Waiting for table level lock"; --source include/wait_condition.inc -unlock tables; +select release_lock('mysqltest_lock'); + +connection con2; +--echo # Reaping first UPDATE +--reap +select release_lock('mysqltest_lock'); connection con1; +--echo # Reaping second UPDATE reap; show status like 'Table_locks_waited'; + +connection default; drop table t1; set global general_log = @old_general_log; disconnect con2; disconnect con1; -connection default; # End of 4.1 tests diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index aaecaf020a0..77b9c305ac8 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -5978,6 +5978,19 @@ SELECT * FROM t1 WHERE a IN(SELECT MIN(a) FROM t1); DROP TABLE t1; SET SESSION big_tables=0; +--echo # +--echo # MDEV-10776: Server crash on query +--echo # +create table t1 (field1 int); + +insert into t1 values (1); + +select round((select 1 from t1 limit 1)) +from t1 +group by round((select 1 from t1 limit 1)); + +drop table t1; + --echo # --echo # MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE || --echo # m_lock_type != 2' failed in handler::ha_index_read_map diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test index 7ba4de34ea9..fb44362b537 100644 --- a/mysql-test/t/temp_table.test +++ b/mysql-test/t/temp_table.test @@ -583,6 +583,15 @@ ALTER TABLE t2 RENAME t1, LOCK EXCLUSIVE; DROP TABLE t1; +--echo # +--echo # MDEV-10792: Assertion `thd->mdl_context.is_lock_owner +--echo # (MDL_key::TABLE, table->db, table->table_name, MDL_SHARED)' +--echo # failed in mysql_rm_table_no_locks +--echo # +CREATE TEMPORARY TABLE t1 (i INT); +--error ER_BAD_TABLE_ERROR +DROP TABLE nonexisting_table, t1; + --echo # Cleanup DROP DATABASE temp_db; diff --git a/mysql-test/t/truncate_coverage.test b/mysql-test/t/truncate_coverage.test index 0834f7a3eca..3351ce84232 100644 --- a/mysql-test/t/truncate_coverage.test +++ b/mysql-test/t/truncate_coverage.test @@ -17,86 +17,6 @@ DROP TABLE IF EXISTS t1; --echo # Bug#20667 - Truncate table fails for a write locked table --echo # ######## -# Attack wait_while_table_is_used(). Kill query while trying to -# upgrade MDL. -# -CREATE TABLE t1 (c1 INT); -INSERT INTO t1 VALUES (1); -# -# Acquire a shared metadata lock on table by opening HANDLER for it and wait. -# TRUNCATE shall block on this metadata lock. -# We can't use normal DML as such statements would also block LOCK TABLES. -# ---connect (con1, localhost, root,,) -HANDLER t1 OPEN; -# -# Get connection id of default connection. -# Lock the table and start TRUNCATE, which will block on MDL upgrade. -# ---connection default -let $ID= `SELECT @id := CONNECTION_ID()`; -LOCK TABLE t1 WRITE; -SET DEBUG_SYNC='mdl_upgrade_lock SIGNAL waiting'; -send TRUNCATE TABLE t1; -# -# Get the default connection ID into a variable in an invisible statement. -# Kill the TRUNCATE query. This shall result in an error return -# from wait_while_table_is_used(). -# ---connect (con2, localhost, root,,) -SET DEBUG_SYNC='now WAIT_FOR waiting'; -let $invisible_assignment_in_select = `SELECT @id := $ID`; -KILL QUERY @id; ---disconnect con2 ---connection default ---error ER_QUERY_INTERRUPTED -reap; -UNLOCK TABLES; ---connection con1 ---echo # Release shared metadata lock by closing HANDLER. -HANDLER t1 CLOSE; ---disconnect con1 ---connection default -DROP TABLE t1; -SET DEBUG_SYNC='RESET'; -######## -# Attack reopen_tables(). Remove form file. -# -CREATE TABLE t1 (c1 INT); -INSERT INTO t1 VALUES (1); -# -# Acquire a shared metadata lock on table by opening HANDLER for it and wait. -# TRUNCATE shall block on this metadata lock. -# We can't use normal DML as such statements would also block LOCK TABLES. -# ---connect (con1, localhost, root,,) -HANDLER t1 OPEN; -# -# Lock the table and start TRUNCATE, which will block on MDL upgrade. -# ---connection default -LOCK TABLE t1 WRITE; -SET DEBUG_SYNC='mdl_upgrade_lock SIGNAL waiting'; -send TRUNCATE TABLE t1; -# -# Remove datafile. -# Commit to let TRUNCATE continue. -# ---connect (con2, localhost, root,,) -SET DEBUG_SYNC='now WAIT_FOR waiting'; ---remove_file $MYSQLD_DATADIR/test/t1.frm ---disconnect con2 ---connection con1 -HANDLER t1 CLOSE; ---disconnect con1 ---connection default ---error ER_NO_SUCH_TABLE -reap; -UNLOCK TABLES; ---error ER_BAD_TABLE_ERROR -DROP TABLE t1; -SET DEBUG_SYNC='RESET'; -######## # Attack acquire_exclusive_locks(). Hold a global read lock. # Non-LOCK TABLE case. # diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test index 659e75270ca..834fd0c5327 100644 --- a/mysql-test/t/type_decimal.test +++ b/mysql-test/t/type_decimal.test @@ -604,6 +604,11 @@ SHOW COLUMNS FROM t1dec102; SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1dec102'; DROP TABLE t1dec102; +# +# MDEV-10552 equality operation on cast of the value "-0.0" to decimal not working +# +select cast('-0.0' as decimal(5,1)) < 0; + --echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/type_uint.test b/mysql-test/t/type_uint.test index 3a949c5c47a..84fca993d09 100644 --- a/mysql-test/t/type_uint.test +++ b/mysql-test/t/type_uint.test @@ -16,6 +16,13 @@ drop table t1; # End of 4.1 tests +create table t1 (a bigint unsigned, b mediumint unsigned); +insert t1 values (1,2),(0xffffffffffffffff,0xffffff); +select coalesce(a,b), coalesce(b,a) from t1; +create table t2 as select a from t1 union select b from t1; +show create table t2; +select * from t2; +drop table t1, t2; --echo # --echo # Start of 10.0 tests diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 4d97f380dff..ed6e92f145e 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -1532,3 +1532,11 @@ show global status like 'foobar'; select * from information_schema.session_variables where variable_name='sql_mode'; --echo End of 5.5 tests + +# +# test Item_func_get_system_var::print() +# +explain extended select @@VERsion from dual where rand() > @@verSION; +explain extended select @@SESsion.SQL_mode from dual where rand() > @@sesSION.sql_MODE; +explain extended select @@GLObal.COLLATION_connection from dual where rand() > @@gloBAL.collation_CONNECTION; +explain extended select @@FOObar.KEY_BUFfer_size from dual where rand() > @@fooBAR.key_bufFER_SIZE; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 8992f77c563..c3f462eab18 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -4636,7 +4636,6 @@ DROP TABLE t1, t2; --echo # --disable_warnings -DROP TABLE IF EXISTS t1; DROP VIEW IF EXISTS v1; DROP PROCEDURE IF EXISTS p1; --enable_warnings @@ -4647,25 +4646,27 @@ connect (con3, localhost, root); connection default; CREATE VIEW v1 AS SELECT schema_name FROM information_schema.schemata; -CREATE TABLE t1 (str VARCHAR(50)); -CREATE PROCEDURE p1() INSERT INTO t1 SELECT * FROM v1; +CREATE PROCEDURE p1() SELECT COUNT(*), GET_LOCK('blocker', 100) FROM v1; --echo # CALL p1() so the view is merged. +--disable_result_log CALL p1(); +--enable_result_log +SELECT RELEASE_LOCK('blocker'); connection con3; -LOCK TABLE t1 READ; +SELECT GET_LOCK('blocker', 100); connection default; ---echo # Try to CALL p1() again, this time it should block for t1. +--echo # Try to CALL p1() again, this time it should block on "blocker". --echo # Sending: --send CALL p1() connection con2; let $wait_condition= SELECT COUNT(*) = 1 from information_schema.processlist - WHERE state = "Waiting for table level lock" AND - info = "INSERT INTO t1 SELECT * FROM v1"; + WHERE state = "User lock" AND + info = "SELECT COUNT(*), GET_LOCK('blocker', 100) FROM v1"; --source include/wait_condition.inc --echo # ... then try to drop the view. This should block. --echo # Sending: @@ -4677,11 +4678,14 @@ let $wait_condition= WHERE state = "Waiting for table metadata lock" AND info = "DROP VIEW v1"; --source include/wait_condition.inc --echo # Now allow CALL p1() to complete -UNLOCK TABLES; +SELECT RELEASE_LOCK('blocker'); connection default; --echo # Reaping: CALL p1() +--disable_result_log --reap +--enable_result_log +SELECT RELEASE_LOCK('blocker'); connection con2; --echo # Reaping: DROP VIEW v1 @@ -4689,7 +4693,6 @@ connection con2; connection default; DROP PROCEDURE p1; -DROP TABLE t1; disconnect con2; disconnect con3; @@ -6019,6 +6022,26 @@ select * from v1; DROP VIEW v1; DROP TABLE t1; + +--echo # +--echo # MDEV-10724:Assertion `vcol_table == 0 || vcol_table == table' +--echo # failed in fill_record(THD*, TABLE*, List&, List&, +--echo # bool, bool) +--echo # + +CREATE TABLE t1 (f1 INT); +CREATE TABLE t2 (f2 INT); +CREATE TABLE t3 (f3 INT); + +CREATE ALGORITHM = MERGE VIEW v AS SELECT f1, f3 FROM t1, +( SELECT f3 FROM t2, t3 ) AS sq; + +--error ER_VIEW_MULTIUPDATE +INSERT INTO v (f1, f3) VALUES (1,1), (2,2); + +drop view v; +drop tables t1,t2,t3; + --echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/t/xtradb_mrr.test b/mysql-test/t/xtradb_mrr.test index d994c182ccc..b56cbb0459f 100644 --- a/mysql-test/t/xtradb_mrr.test +++ b/mysql-test/t/xtradb_mrr.test @@ -1,4 +1,4 @@ --- source include/have_xtradb.inc +-- source include/have_innodb.inc --disable_warnings drop table if exists t1,t2,t3,t4; diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests index daba2ea8ae8..7b5c2756f11 100644 --- a/mysql-test/unstable-tests +++ b/mysql-test/unstable-tests @@ -23,66 +23,61 @@ # ############################################################################## +main.alter_table : Modified in 10.1.19 main.analyze_stmt_slow_query_log : MDEV-7558 - wrong result -main.bootstrap : Modified on 2016-06-18 (MDEV-9969) +main.create : Modified in 10.1.20 main.create_delayed : MDEV-10605 - failed with timeout -main.create_or_replace : Modified on 2016-06-23 (MDEV-9728) -main.ctype_recoding : Modified on 2016-06-10 (MDEV-10181) -main.ctype_utf8 : Modified on 2016-06-21 (merge) -main.ctype_utf8mb4 : Modified on 2016-06-21 (merge) +main.create_drop_binlog : Uses binlog_start_pos.inc modified in 10.1.20 +main.create_or_replace : Modified in 10.1.19 main.ctype_utf16le : MDEV-10675: timeout or extra warnings -main.events_1 : Modified on 2016-06-21 (MDEV-9524) -main.func_group : Modified on 2016-08-08 (MDEV-10468) -main.func_in : Modified on 2016-06-20 (MDEV-10020) -main.func_math : Modified on 2016-08-10 (merge) -main.func_misc : Modified on 2016-08-10 (merge) -main.grant2 : Modified on 2016-07-18 (MDEV-8569) -main.help : Modified on 2016-06-21 (MDEV-9524) +main.ctype_utf8 : Modified in 10.1.20 +main.ctype_utf8mb4 : Modified in 10.1.20 +main.default : Modified in 10.1.20 +main.derived : Modified in 10.1.20 +main.derived_view : Modified in 10.1.20 +main.drop : Modified in 10.1.19 +main.events_restart : MDEV-11221: assertion failure +main.fulltext_charsets : Added in 10.1.20 +main.func_time : Modified in 10.1.20 +main.group_by : Modified in 10.1.20 +main.group_by_innodb : Modified in 10.1.20 main.host_cache_size_functionality : MDEV-10606 - sporadic failure on shutdown main.index_intersect_innodb : MDEV-10643 - failed with timeout -main.index_merge_innodb : MDEV-7142 - sporadic wrong execution plan -main.information_schema_stats : Modified on 2016-07-25 (MDEV-10428) +main.index_merge_innodb : MDEV-7142 - Wrong execution plan +main.information_schema : Modified in 10.1.19 main.innodb_mysql_lock : MDEV-7861 - sporadic lock detection failure -main.insert_innodb : Modified on 2016-06-14 (merge from upstream) -main.loaddata : Modified on 2016-08-10 (merge) -main.locale : Modified on 2016-06-21 (merge) +main.kill_processlist-6619 : MDEV-10793 - wrong result in processlist +main.loaddata : Modified in 10.1.20 +main.lowercase_fs_on : Uses search_pattern_in_file.inc modified in 10.1.20 main.mdev-504 : MDEV-10607 - sporadic "can't connect" main.mdev375 : MDEV-10607 - sporadic "can't connect" main.merge : MDEV-10607 - sporadic "can't connect" -main.multi_update : Modified on 2016-06-20 (MDEV-5973) -main.myisam_enable_keys-10506 : New test, added on 2016-08-10 (MDEV-10506) -main.mysqlcheck : Modified on 2016-08-10 (merge) -main.mysqldump : MDEV-10512 - sporadic assertion failure -main.mysqltest : MDEV-9269 - fails on Alpha -main.named_pipe : Modified on 2016-08-02 (MDEV-10383) -main.openssl_1 : Modified on 2016-07-11 (MDEV-10211) +main.mysql : Modified in 10.1.19 +main.mysql_not_windows : Modified in 10.1.19 +main.mysqlbinlog : Uses binlog_start_pos.inc modified in 10.1.20 +main.mysqldump-max : Uses binlog_start_pos.inc modified in 10.1.20 +main.mysqldump-nl : Added in 10.1.19 +main.mysqltest : MDEV-9269 - fails on Alpha; also modified in 10.1.19 +main.named_pipe : Uses search_pattern_in_file.inc modified in 10.1.20 +main.null : Modified in 10.1.19 main.order_by_optimizer_innodb : MDEV-10683 - wrong execution plan -main.parser : Modified on 2016-06-21 (merge) +main.parser : Modified in 10.1.20 main.pool_of_threads : MDEV-10100 - sporadic error on detecting max connections -main.ps_1general : Modified on 2016-07-12 (merge) -main.range : Modified on 2016-08-10 (merge) -main.range_mrr_icp : Modified on 2016-08-10 (merge) -main.query_cache : MDEV-10611 - sporadic mutex problem +main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count +main.selectivity : Modified in 10.1.20 +main.selectivity_innodb : Modified in 10.1.19 main.show_explain : MDEV-10674 - sporadic failure -main.shutdown : MDEV-10612 - sporadic crashes -main.sp-prelocking : Modified on 2016-08-10 (merge) +main.sp : Modified in 10.1.20 main.sp-security : MDEV-10607 - sporadic "can't connect" -main.ssl : MDEV-10211 - different ciphers on some platforms -main.ssl_ca : Modified on 2016-07-11 (MDEV-10211) -main.ssl_compress : Modified on 2016-07-11 (MDEV-10211) -main.ssl_timeout : Modified on 2016-07-11 (MDEV-10211) main.stat_tables_par_innodb : MDEV-10515 - sporadic wrong results +main.statistics : Modified in 10.1.20 main.status : MDEV-8510 - sporadic wrong result -main.status_user : Modified on 2016-06-20 (MDEV-8633) -main.subselect : Modified in 10.1.17 +main.subselect : Modified in 10.1.20 main.subselect_innodb : MDEV-10614 - sporadic wrong results -main.subselect_sj_mat : Modified in 10.1.17 -main.temp_table : Modified on 2016-06-18 (MDEV-8569) -main.type_date : Modified on 2016-08-10 (merge) -main.type_datetime : Modified on 2016-06-16 (MDEV-9374) main.type_datetime_hires : MDEV-10687 - timeout -main.view : Modified on 2016-08-10 (merge) -main.xtradb_mrr : Modified on 2016-08-04 (MDEV-9946) +main.type_decimal : Modified in 10.1.20 +main.view : Uses search_pattern_in_file.inc modified in 10.1.20 +main.wait_timeout_not_windows : Uses search_pattern_in_file.inc modified in 10.1.20 #---------------------------------------------------------------- @@ -92,65 +87,55 @@ archive.discover : MDEV-10510 - table is marked as crashed #---------------------------------------------------------------- binlog.binlog_commit_wait : MDEV-10150 - Error: too much time elapsed -binlog.binlog_dmls_on_tmp_tables_readonly : New test, added on 2016-05-04 (upstream) +binlog.binlog_incident : Uses binlog_start_pos.inc modified in 10.1.20 +binlog.binlog_killed : Uses binlog_start_pos.inc modified in 10.1.20 +binlog.binlog_killed_simulate : Uses binlog_start_pos.inc modified in 10.1.20 +binlog.binlog_mysqlbinlog2 : Uses binlog_start_pos.inc modified in 10.1.20 +binlog.mix_innodb_myisam_binlog : Uses binlog_start_pos.inc modified in 10.1.20 +binlog.binlog_row_annotate : Uses binlog_start_pos.inc modified in 10.1.20 binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint #---------------------------------------------------------------- -connect.tbl : MDEV-9844, MDEV-10179 - sporadic crashes, valgrind warnings, wrong results -connect.jdbc : New test, added on 2016-07-15 -connect.jdbc-new : New test, added on 2016-07-14 -connect.jdbc-oracle : New test, added on 2016-07-13 -connect.jdbc-postgresql : New test, added on 2016-07-13 +binlog_encryption.* : Added in 10.1.20 #---------------------------------------------------------------- -galera.GAL-382 : New test, added in 10.1.17 -galera.MW-252 : New test, added in 10.1.17 -galera.MW-258 : New test, added in 10.1.17 -galera.MW-259 : New test, added in 10.1.17 -galera.MW-285 : New test, added in 10.1.17 -galera.MW-286 : New test, added in 10.1.17 -galera.MW-292 : New test, added in 10.1.17 -galera.MW-44 : New test, added in 10.1.17 -galera.galera#414 : New test, added in 10.1.17 -galera.galera_as_slave_autoinc : New test, added in 10.1.17 -galera.galera_as_slave_nonprim : Modified in 10.1.17 -galera.galera_bf_abort_flush_for_export : Modified in 10.1.17 -galera.galera_gcs_fc_limit : Modified in 10.1.17 -galera.galera_ist_recv_bind : New test, added in 10.1.17 -galera.galera_ist_restart_joiner : Modified in 10.1.17 -galera.galera_kill_ddl : Modified in 10.1.17 -galera.galera_parallel_simple : Modified in 10.1.17 -galera.galera_pc_ignore_sb : Modified in 10.1.17 -galera.galera_restart_nochanges : Modified in 10.1.17 -galera.galera_roles : Modified in 10.1.17 -galera.galera_rsu_wsrep_desync : Modified in 10.1.17 -galera.galera_split_brain : Modified in 10.1.17 -galera.galera_ssl_upgrade : Modified in 10.1.17 -galera.galera_suspend_slave : Modified in 10.1.17 -galera.galera_transaction_replay : Modified in 10.1.17 -galera.galera_var_dirty_reads : Modified in 10.1.17 -galera.galera_var_max_ws_rows : New test, added in 10.1.17 -galera.galera_var_max_ws_size : Modified in 10.1.17 -galera.mdev_10518 : New test, added in 10.1.17 -galera.mysql-wsrep#31 : Modified in 10.1.17 - -galera_3nodes.galera_certification_ccc : Modified in 10.1.17 -galera_3nodes.galera_innobackupex_backup : Modified in 10.1.17 -galera_3nodes.galera_ist_gcache_rollover : Modified in 10.1.17 -galera_3nodes.galera_pc_bootstrap : Modified in 10.1.17 -galera_3nodes.galera_pc_weight : Modified in 10.1.17 +connect.tbl : MDEV-9844, MDEV-10179 - sporadic crashes, valgrind warnings, wrong results #---------------------------------------------------------------- encryption.create_or_replace : MDEV-9359 - Assertion failure -encryption.innodb-bad-key-shutdown : MDEV-9105 - valgrind warnings, assertion failures -encryption.innodb_encryption_discard_import : MDEV-9099 - warnings, errors, crash -encryption.innodb_encryption_filekeys : MDEV-9062 - timeouts +encryption.encrypt_and_grep : MDEV-11222 - InnoDB error; also uses search_pattern_in_file.inc modified in 10.1.20 +encryption.filekeys_emptyfile : Uses search_pattern_in_file.inc modified in 10.1.20 +encryption.filekeys_encfile_bad : Uses search_pattern_in_file.inc modified in 10.1.20 +encryption.filekeys_encfile_badfile : Uses search_pattern_in_file.inc modified in 10.1.20 +encryption.filekeys_encfile_no : Uses search_pattern_in_file.inc modified in 10.1.20 +encryption.filekeys_nofile : Uses search_pattern_in_file.inc modified in 10.1.20 +encryption.filekeys_syntax : Uses search_pattern_in_file.inc modified in 10.1.20 +encryption.filekeys_tooshort : Uses search_pattern_in_file.inc modified in 10.1.20 +encryption.filekeys_unencfile : Uses search_pattern_in_file.inc modified in 10.1.20 +encryption.innodb-bad-key-change : uses keys2.txt modified in 10.1.19 +encryption.innodb-bad-key-change2 : uses keys2.txt modified in 10.1.19 +encryption.innodb-bad-key-change3 : Uses search_pattern_in_file.inc modified in 10.1.20 +encryption.innodb-bad-key-change4 : uses keys2.txt modified in 10.1.19 +encryption.innodb-bad-key-change5 : uses keys2.txt modified in 10.1.19 +encryption.innodb-bad-key-shutdown : MDEV-9105 - valgrind warnings, assertion failures, and uses keys2.txt modified in 10.1.19 +encryption.innodb-discard-import : Uses search_pattern_in_file.inc modified in 10.1.20 +encryption.innodb_encryption_discard_import : MDEV-11218 - wrong result, also uses search_pattern_in_file.inc modified in 10.1.20 +encryption.innodb_encryption_filekeys : MDEV-9962 - timeouts +encryption.innodb_encryption_row_compressed : Uses search_pattern_in_file.inc modified in 10.1.20 encryption.innodb_first_page : MDEV-10689 - crashes -encryption.innodb_onlinealter_encryption : MDEV-10099 - wrong results +encryption.innodb-log-encrypt : Uses search_pattern_in_file.inc modified in 10.1.20 +encryption.innodb_lotoftables : MDEV-11531 - InnoDB error +encryption.innodb-missing-key : Added in 10.1.19 +encryption.innodb_onlinealter_encryption : MDEV-10099 - wrong results; also uses search_pattern_in_file.inc modified in 10.1.20 encryption.innodb-page_encryption : MDEV-10641 - mutex problem +encryption.innodb_page_encryption_key_change : uses keys2.txt modified in 10.1.19 + +#---------------------------------------------------------------- + +extra/binlog_tests.database : Modified in 10.1.19 (merge) #---------------------------------------------------------------- @@ -161,34 +146,53 @@ federated.federated_transactions : MDEV-10617, MDEV-10417 - Wrong checksum, time #---------------------------------------------------------------- -funcs_1.processlist_priv_no_prot : Include file modified on 2016-07-12 (merge) -funcs_1.processlist_priv_ps : Include file modified on 2016-07-12 (merge) -funcs_2.memory_charset : MDEV-10290 - timeout +funcs_1.processlist_val_no_prot : MDEV-11223 - Wrong result +funcs_2.memory_charset : MDEV-10290 - Timeout +funcs_2.myisam_charset : MDEV-11535 - Timeout #---------------------------------------------------------------- -innodb.binlog_consistent : MDEV-10618 - Server fails to start +galera.* : Added to default suites in 10.1.19 + +galera.galera_var_dirty_reads : Modified in 10.1.20 +galera.rpl_row_annotate : Uses binlog_start_pos.inc modified in 10.1.20 + +galera_3nodes.* : Added to default suites in 10.1.19, MDEV-11490 + +#---------------------------------------------------------------- + +innodb.binlog_consistent : MDEV-10618 - Server fails to start; also uses binlog_start_pos.inc modified in 10.1.20 +innodb.group_commit_binlog_pos : Uses binlog_start_pos.inc modified in 10.1.20 +innodb.group_commit_binlog_pos_no_optimize_thread : Uses binlog_start_pos.inc modified in 10.1.20 innodb.innodb-alter-table : MDEV-10619 - Testcase timeout -innodb.innodb-alter-tempfile : Modified on 2016-08-09 (MDEV-10469) -innodb.innodb_blob_truncate : MDEV-10377 - Assertion failure -innodb.innodb-bug-14068765 : MDEV-9105 - valgrind warnings, assertion failures -innodb.innodb_corrupt_bit : Modified on 2016-06-21 (merge) -innodb.innodb-bug-14084530 : MDEV-9105 - valgrind warnings, assertion failures +innodb.innodb-bug-14068765 : MDEV-9105 - valgrind warnings, assertion failures, also uses innodb-util.pl added in 10.1.19 +innodb.innodb-bug-14084530 : MDEV-9105 - valgrind warnings, assertion failures, also uses innodb-util.pl added in 10.1.19 innodb.innodb_bug30423 : MDEV-7311 - Wrong number of rows in the plan -innodb.innodb-fk-warnings : Modified on 2016-07-18 (MDEV-8569) -innodb.innodb-fkcheck : Modified on 2016-06-13 (MDEV-10083) +innodb.innodb-change-buffer-recovery : Uses search_pattern_in_file.inc modified in 10.1.20 +innodb.innodb_defragment_fill_factor : Modified in 10.1.20 +innodb.innodb-lock-schedule-algorithm : Modified in 10.1.20 innodb.innodb-page_compression_zip : MDEV-10641 - mutex problem innodb.innodb_stats : MDEV-10682 - wrong result innodb.innodb_sys_semaphore_waits : MDEV-10331 - wrong result -innodb.innodb-wl5522 : MDEV-9105 - valgrind warnings, assertion failures -innodb.innodb-wl5522-1 : MDEV-9105 - valgrind warnings, assertion failures -innodb.innodb-wl5522-debug-zip : MDEV-10427 - Warning: database page corruption -innodb.innodb-wl5522-zip : MDEV-9105 - valgrind warnings, assertion failures -innodb.xa_recovery : MDEV-10685 - warnings +innodb.innodb-wl5522 : MDEV-9105 - valgrind warnings, assertion failures, also uses innodb-util.pl added in 10.1.19 +innodb.innodb-wl5522-1 : MDEV-9105 - valgrind warnings, assertion failures, also uses innodb-util.pl added in 10.1.19 +innodb.innodb-wl5522-debug : Modified in 10.1.19 +innodb.innodb-wl5522-debug-zip : Modified in 10.1.20 +innodb.innodb-wl5522-zip : MDEV-9105 - valgrind warnings, assertion failures, also uses innodb-util.pl added in 10.1.19 +innodb.table_index_statistics : Added in 10.1.20 +innodb.trigger : Modified in 10.1.20 +innodb.xa_recovery : Modified in 10.1.19 #---------------------------------------------------------------- -innodb_zip.innodb_prefix_index_liftedlimit : MDEV-10686 - timeout +innodb_fts.create : Added in 10.1.20 +innodb_fts.innodb_fts_misc : MDEV-11233 - Crash on CREATE FULLTEXT INDEX + +#---------------------------------------------------------------- + +maria.collations : Added in 10.1.20 +maria.encrypt-wrong-key : uses keys2.txt modified in 10.1.19 +maria.maria-connect : Uses binlog_start_pos.inc modified in 10.1.20 #---------------------------------------------------------------- @@ -205,9 +209,9 @@ mroonga/storage.repair_table_no_index_file : MDEV-9364 - multi_source.gtid : MDEV-10620, MDEV-10417 - Timeout in wait condition, fails on Mips multi_source.info_logs : MDEV-10042 - wrong result -multi_source.multisource : MDEV-10417 - Fails on Mips -multi_source.reset_slave : MDEV-10690 - wrong result -multi_source.simple : MDEV-4633 - Wrong slave status output +multi_source.multisource : MDEV-10417 - Fails on Mips; also uses binlog_start_pos.inc modified in 10.1.20 +multi_source.reset_slave : MDEV-10690 - wrong result; also uses binlog_start_pos.inc modified in 10.1.20 +multi_source.simple : MDEV-4633 - Wrong slave status output; also uses binlog_start_pos.inc modified in 10.1.20 multi_source.status_vars : MDEV-4632 - failed while waiting for Slave_received_heartbeats #---------------------------------------------------------------- @@ -217,32 +221,24 @@ parts.partition_int_myisam : MDEV-10621 - Testcase timeout #---------------------------------------------------------------- -perfschema.digest_table_full : Modified on 2016-06-21 (merge) perfschema.func_file_io : MDEV-5708 - fails for s390x perfschema.func_mutex : MDEV-5708 - fails for s390x -perfschema.rpl_gtid_func : Modified on 2016-06-21 (merge) perfschema.setup_actors : MDEV-10679 - rare crash -perfschema.sizing_low : Modified on 2016-04-26 (5.6.30 merge) perfschema.socket_summary_by_event_name_func : MDEV-10622 - Socket summary tables do not match -perfschema.start_server_low_digest : Modified on 2016-06-21 (merge) -perfschema.statement_digest : Modified on 2016-06-21 (merge) -perfschema.statement_digest_consumers : Modified on 2016-06-21 (merge) -perfschema.statement_digest_long_query : Modified on 2016-06-21 (merge) -perfschema.table_name : New test, added on 2016-04-26 (5.6.30 merge) perfschema.threads_mysql : MDEV-10677 - sporadic wrong result #---------------------------------------------------------------- plugins.feedback_plugin_send : MDEV-7932 - ssl failed for url -plugins.pam : Modified on 2016-08-03 (MDEV-7329) -plugins.pam_cleartext : Modified on 2016-08-03 plugins.server_audit : MDEV-9562 - crashes on sol10-sparc plugins.thread_pool_server_audit : MDEV-9562 - crashes on sol10-sparc + #---------------------------------------------------------------- -roles.rpl_grant_revoke_current_role-8638 : New test, added on 2016-06-20 (MDEV-8638) -roles.set_role-9614 : New test, added on 2016-05-30 (MDEV-9614) +roles.role_case_sensitive-10744 : Added in 10.1.20 +roles.create_and_drop_role : Modified in 10.1.20 +roles.create_and_grant_role : MDEV-11533 - Extra grant in output #---------------------------------------------------------------- @@ -251,38 +247,48 @@ rpl.rpl_auto_increment : MDEV-10417 - Fails on Mips rpl.rpl_auto_increment_bug45679 : MDEV-10417 - Fails on Mips rpl.rpl_auto_increment_update_failure : MDEV-10625 - warnings in error log rpl.rpl_binlog_index : MDEV-9501 - Warning: failed registering on master +rpl.rpl_checksum : Uses search_pattern_in_file.inc modified in 10.1.20 rpl.rpl_checksum_cache : MDEV-10626 - Testcase timeout rpl.rpl_circular_for_4_hosts : MDEV-10627 - Testcase timeout rpl.rpl_ddl : MDEV-10417 - Fails on Mips rpl.rpl_domain_id_filter_restart : MDEV-10684 - Wrong result +rpl.rpl_drop_db : Modified in 10.1.19 rpl.rpl_gtid_basic : MDEV-10681 - server startup problem rpl.rpl_gtid_crash : MDEV-9501 - Warning: failed registering on master +rpl.rpl_gtid_errorlog : Uses search_pattern_in_file.inc modified in 10.1.20 rpl.rpl_gtid_master_promote : MDEV-10628 - Timeout in sync_with_master rpl.rpl_gtid_mdev9033 : MDEV-10680 - warnings rpl.rpl_gtid_stop_start : MDEV-10629 - Crash on shutdown rpl.rpl_gtid_until : MDEV-10625 - warnings in error log -rpl.rpl_ignore_table : Modified on 2016-06-22 rpl.rpl_innodb_bug30888 : MDEV-10417 - Fails on Mips rpl.rpl_insert : MDEV-9329 - Fails on Ubuntu/s390x rpl.rpl_insert_delayed : MDEV-9329 - Fails on Ubuntu/s390x rpl.rpl_invoked_features : MDEV-10417 - Fails on Mips +rpl.rpl_mariadb_slave_capability : MDEV-11018 - sporadic wrong events in binlog +rpl.rpl_mdev10863 : Added in 10.1.20 rpl.rpl_mdev6020 : MDEV-10630, MDEV-10417 - Timeouts, fails on Mips rpl.rpl_mdev6386 : MDEV-10631 - Wrong result on slave rpl.rpl_parallel : MDEV-10632, MDEV-10653 - Failures to sync, timeouts rpl.rpl_parallel_optimistic : MDEV-10511 - timeout +rpl.rpl_parallel_retry : MDEV-11119 - Server crash rpl.rpl_parallel_temptable : MDEV-10356 - Crash in close_thread_tables rpl.rpl_partition_innodb : MDEV-10417 - Fails on Mips +rpl.rpl_row_annotate : Uses binlog_start_pos.inc modified in 10.1.20 +rpl.rpl_password_boundaries : MDEV-11534 - Slave IO warnings rpl.rpl_row_drop_create_temp_table : MDEV-10626 - Testcase timeout +rpl.rpl_row_flsh_tbls : Uses binlog_start_pos.inc modified in 10.1.20 rpl.rpl_row_log_innodb : MDEV-10688 - Wrong result rpl.rpl_row_sp001 : MDEV-9329 - Fails on Ubuntu/s390x -rpl.rpl_show_slave_hosts : MDEV-10681 - server startup problem +rpl.rpl_semi_sync : MDEV-11220 - Wrong result rpl.rpl_semi_sync_uninstall_plugin : MDEV-7140 - Wrong plugin status +rpl.rpl_show_slave_hosts : MDEV-10681 - server startup problem +rpl.rpl_skip_replication : MDEV-9268 - Fails with timeout in sync_slave_with_master on Alpha rpl.rpl_slave_grp_exec : MDEV-10514 - Unexpected deadlock -rpl.rpl_switch_stm_row_mixed : MDEV-10611 - Wrong usage of mutex +rpl.rpl_stm_flsh_tbls : Uses binlog_start_pos.inc modified in 10.1.20 +rpl.rpl_stop_slave_error : Uses search_pattern_in_file.inc modified in 10.1.20 rpl.rpl_sync : MDEV-10633 - Database page corruption rpl.rpl_temporary_error2 : MDEV-10634 - Wrong number of retries rpl.sec_behind_master-5114 : MDEV-8518 - Wrong value of Seconds_Behind_Master -rpl.rpl_skip_replication : MDEV-9268 - Fails with timeout in sync_slave_with_master on Alpha #---------------------------------------------------------------- @@ -297,46 +303,45 @@ spider/bg.vp_fixes : MDEV-9329 - Fails on Ubuntu/s390x #---------------------------------------------------------------- +sphinx.* : MDEV-10985, MDEV-10986 - Tests have not been maintained + +#---------------------------------------------------------------- + +storage_engine* : Tests are not always timely maintained + +#---------------------------------------------------------------- + stress.ddl_innodb : MDEV-10635 - Testcase timeout #---------------------------------------------------------------- -sys_vars.autocommit_func2 : MDEV-9329 - Fails on Ubuntu/s390x -sys_vars.general_log_file_basic : Modified on 2016-08-09 (MDEV-10465) -sys_vars.keep_files_on_create_basic : MDEV-10676 - timeout -sys_vars.slow_query_log_file_basic : Modified on 2016-08-09 (MDEV-10465) -sys_vars.sysvars_innodb : MDEV-6958 - error-prone rdiffs -sys_vars.sysvars_server_embedded : MDEV-6958 - error-prone rdiffs -sys_vars.innodb_buffer_pool_dump_pct_basic : MDEV-10651 - sporadic failure on file_exists +sys_vars.autocommit_func2 : MDEV-9329 - Fails on Ubuntu/s390x +sys_vars.keep_files_on_create_basic : MDEV-10676 - timeout +sys_vars.innodb_buffer_pool_dump_pct_basic : MDEV-10651 - sporadic failure on file_exists sys_vars.innodb_fatal_semaphore_wait_threshold : MDEV-10513 - crashes -sys_vars.sysvars_wsrep : Modified in 10.1.17 -sys_vars.wsrep_max_ws_size_basic : Modified in 10.1.17 +sys_vars.replicate_do_db_basic : Modified in 10.1.20 +sys_vars.replicate_do_table_basic : Modified in 10.1.20 +sys_vars.replicate_ignore_db_basic : Modified in 10.1.20 +sys_vars.replicate_ignore_table_basic : Modified in 10.1.20 +sys_vars.replicate_wild_do_table_basic : Modified in 10.1.20 +sys_vars.replicate_wild_ignore_table_basic : Modified in 10.1.20 +sys_vars.sysvars_innodb : MDEV-6958 - error-prone rdiffs +sys_vars.sysvars_server_embedded : MDEV-6958 - error-prone rdiffs +sys_vars.table_open_cache_instances_basic : Modified in 10.1.20 #---------------------------------------------------------------- -tokudb.background_job_manager : MDEV-10327 - Assertion failure on server shutdown tokudb.cluster_filter : MDEV-10678 - Wrong execution plan tokudb.cluster_filter_hidden : MDEV-10678 - Wrong execution plan tokudb.cluster_filter_unpack_varchar : MDEV-10636 - Wrong execution plan -tokudb.i_s_tokudb_lock_waits_released : Modified in 10.1.17 -tokudb.i_s_tokudb_locks_released : Modified in 10.1.17 -tokudb.* : MDEV-9891 - massive crashes on shutdown - -tokudb_alter_table.* : MDEV-9891 - massive crashes on shutdown +tokudb.dir_per_db : MDEV-11537 - Wrong result +tokudb.table_index_statistics : Added in 10.1.20 tokudb_bugs.checkpoint_lock : MDEV-10637 - Wrong processlist output tokudb_bugs.checkpoint_lock_3 : MDEV-10637 - Wrong processlist output -tokudb_bugs.* : MDEV-9891 - massive crashes on shutdown -tokudb_parts.* : MDEV-9891 - massive crashes on shutdown - -rpl-tokudb.* : MDEV-9891 - massive crashes on shutdown, also modified on 2016-06-10 (Merge) - -tokudb_add_index.* : MDEV-9891 - massive crashes on shutdown -tokudb_backup.* : MDEV-9891 - massive crashes on shutdown -tokudb_mariadb.* : MDEV-9891 - massive crashes on shutdown -tokudb_sys_vars.* : MDEV-9891 - massive crashes on shutdown -tokudb_rpl.* : MDEV-9891 - massive crashes on shutdown +tokudb_rpl.rpl_parallel_optimistic : Added in 10.1.20 +tokudb_rpl.rpl_tokudb_rfr_partition_table : Added in 10.1.20 #---------------------------------------------------------------- @@ -344,12 +349,15 @@ unit.ma_test_loghandler : MDEV-10638 - record read not ok #---------------------------------------------------------------- -vcol.charsets : Added on 2016-06-23 vcol.not_supported : MDEV-10639 - Testcase timeout vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout #---------------------------------------------------------------- -wsrep.* : MDEV-10041 - server crashes sporadically during bootstrap +wsrep.binlog_format : MDEV-11532 - WSREP has not yet prepared node +wsrep.mdev_10186 : Modified in 10.1.19 +#---------------------------------------------------------------- +wsrep_info.* : suite.pm modified in 10.1.19 +wsrep_info.plugin : MDEV-11530 - Warnings; also modified in 10.1.20 diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index b2b264e17fa..3d852120320 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -1213,6 +1213,125 @@ fun:dlopen@@GLIBC_2.2.5 } +# +# MDEV-11061: OpenSSL 0.9.8 problems +# + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Cond + obj:*/libz.so* + ... + obj:*/libcrypto.so.0.9.8 + ... + obj:*/libssl.so.0.9.8 + ... +} + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Value8 + obj:*/libz.so* + ... + obj:*/libcrypto.so.0.9.8 + ... + obj:*/libssl.so.0.9.8 + ... +} + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Cond + obj:*/libcrypto.so.0.9.8 + ... + obj:*/libssl.so.0.9.8 + ... +} + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Value8 + obj:*/libcrypto.so.0.9.8 + ... + obj:*/libssl.so.0.9.8 + ... +} + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Cond + obj:*/libssl.so.0.9.8 + obj:*/libssl.so.0.9.8 + ... +} + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Value8 + obj:*/libssl.so.0.9.8 + obj:*/libssl.so.0.9.8 + ... +} + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Cond + fun:memcpy + obj:*/libcrypto.so.0.9.8 + obj:*/libssl.so.0.9.8 + ... +} + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Value8 + fun:memcpy + obj:*/libcrypto.so.0.9.8 + obj:*/libssl.so.0.9.8 + ... +} + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Cond + fun:is_overlap + fun:memcpy + obj:*/libcrypto.so.0.9.8 + obj:*/libssl.so.0.9.8 + ... +} + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Cond + fun:memset + obj:*/libcrypto.so.0.9.8 + ... + obj:*/libssl.so.0.9.8 + ... +} + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Value8 + fun:memset + obj:*/libcrypto.so.0.9.8 + ... + obj:*/libssl.so.0.9.8 + ... +} + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Param + write(buf) + obj:*/libpthread-2.9.so* + obj:*/libcrypto.so.0.9.8 + ... + obj:*/libssl.so.0.9.8 + ... +} + { vasprintf in OpenSuse 12.3 Memcheck:Leak @@ -1310,7 +1429,7 @@ } { -g codership/mysql-wsrep/issues#176 + codership/mysql-wsrep/issues#176 Memcheck:Leak fun:_Z16wsrep_set_paramsRN6galera10ReplicatorEPKc } @@ -1451,3 +1570,123 @@ g codership/mysql-wsrep/issues#176 fun:start_thread fun:clone } + +# +# MDEV-11061: OpenSSL 0.9.8 problems +# + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Cond + obj:*/libz.so* + ... + obj:*/libcrypto.so.0.9.8 + ... + obj:*/libssl.so.0.9.8 + ... +} + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Value8 + obj:*/libz.so* + ... + obj:*/libcrypto.so.0.9.8 + ... + obj:*/libssl.so.0.9.8 + ... +} + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Cond + obj:*/libcrypto.so.0.9.8 + ... + obj:*/libssl.so.0.9.8 + ... +} + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Value8 + obj:*/libcrypto.so.0.9.8 + ... + obj:*/libssl.so.0.9.8 + ... +} + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Cond + obj:*/libssl.so.0.9.8 + obj:*/libssl.so.0.9.8 + ... +} + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Value8 + obj:*/libssl.so.0.9.8 + obj:*/libssl.so.0.9.8 + ... +} + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Cond + fun:memcpy + obj:*/libcrypto.so.0.9.8 + obj:*/libssl.so.0.9.8 + ... +} + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Value8 + fun:memcpy + obj:*/libcrypto.so.0.9.8 + obj:*/libssl.so.0.9.8 + ... +} + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Cond + fun:is_overlap + fun:memcpy + obj:*/libcrypto.so.0.9.8 + obj:*/libssl.so.0.9.8 + ... +} + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Cond + fun:memset + obj:*/libcrypto.so.0.9.8 + ... + obj:*/libssl.so.0.9.8 + ... +} + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Value8 + fun:memset + obj:*/libcrypto.so.0.9.8 + ... + obj:*/libssl.so.0.9.8 + ... +} + +{ + MDEV-11061: OpenSSL 0.9.8 + Memcheck:Param + write(buf) + obj:*/libpthread-2.9.so* + obj:*/libcrypto.so.0.9.8 + ... + obj:*/libssl.so.0.9.8 + ... +} + diff --git a/mysys/charset.c b/mysys/charset.c index 016d0fc3012..8939b6d7a4f 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -258,12 +258,38 @@ static my_bool simple_cs_is_full(CHARSET_INFO *cs) #if defined(HAVE_UCA_COLLATIONS) && (defined(HAVE_CHARSET_ucs2) || defined(HAVE_CHARSET_utf8)) +/** + Initialize a loaded collation. + @param [OUT] to - The new charset_info_st structure to initialize. + @param [IN] from - A template collation, to fill the missing data from. + @param [IN] loaded - The collation data loaded from the LDML file. + some data may be missing in "loaded". +*/ static void -copy_uca_collation(struct charset_info_st *to, CHARSET_INFO *from) +copy_uca_collation(struct charset_info_st *to, CHARSET_INFO *from, + CHARSET_INFO *loaded) { to->cset= from->cset; to->coll= from->coll; - to->strxfrm_multiply= from->strxfrm_multiply; + /* + Single-level UCA collation have strnxfrm_multiple=8. + In case of a multi-level UCA collation we use strnxfrm_multiply=4. + That means MY_COLLATION_HANDLER::strnfrmlen() will request the caller + to allocate a buffer smaller size for each level, for performance purpose, + and to fit longer VARCHARs to @@max_sort_length. + This makes filesort produce non-precise order for some rare Unicode + characters that produce more than 4 weights (long expansions). + UCA requires 2 bytes per weight multiplied by the number of levels. + In case of a 2-level collation, each character requires 4*2=8 bytes. + Therefore, the longest VARCHAR that fits into the default @@max_sort_length + is 1024/8=VARCHAR(128). With strnxfrm_multiply==8, only VARCHAR(64) + would fit. + Note, the built-in collation utf8_thai_520_w2 also uses strnxfrm_multiply=4, + for the same purpose. + TODO: we could add a new LDML syntax to choose strxfrm_multiply value. + */ + to->strxfrm_multiply= loaded->levels_for_order > 1 ? + 4 : from->strxfrm_multiply; to->min_sort_char= from->min_sort_char; to->max_sort_char= from->max_sort_char; to->mbminlen= from->mbminlen; @@ -312,7 +338,8 @@ static int add_collation(struct charset_info_st *cs) #if defined(HAVE_CHARSET_ucs2) && defined(HAVE_UCA_COLLATIONS) copy_uca_collation(newcs, newcs->state & MY_CS_NOPAD ? &my_charset_ucs2_unicode_nopad_ci : - &my_charset_ucs2_unicode_ci); + &my_charset_ucs2_unicode_ci, + cs); newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED | MY_CS_NONASCII; #endif } @@ -321,7 +348,8 @@ static int add_collation(struct charset_info_st *cs) #if defined (HAVE_CHARSET_utf8) && defined(HAVE_UCA_COLLATIONS) copy_uca_collation(newcs, newcs->state & MY_CS_NOPAD ? &my_charset_utf8_unicode_nopad_ci : - &my_charset_utf8_unicode_ci); + &my_charset_utf8_unicode_ci, + cs); newcs->ctype= my_charset_utf8_unicode_ci.ctype; if (init_state_maps(newcs)) return MY_XML_ERROR; @@ -332,7 +360,8 @@ static int add_collation(struct charset_info_st *cs) #if defined (HAVE_CHARSET_utf8mb4) && defined(HAVE_UCA_COLLATIONS) copy_uca_collation(newcs, newcs->state & MY_CS_NOPAD ? &my_charset_utf8mb4_unicode_nopad_ci : - &my_charset_utf8mb4_unicode_ci); + &my_charset_utf8mb4_unicode_ci, + cs); newcs->ctype= my_charset_utf8mb4_unicode_ci.ctype; newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED; #endif @@ -342,7 +371,8 @@ static int add_collation(struct charset_info_st *cs) #if defined (HAVE_CHARSET_utf16) && defined(HAVE_UCA_COLLATIONS) copy_uca_collation(newcs, newcs->state & MY_CS_NOPAD ? &my_charset_utf16_unicode_nopad_ci : - &my_charset_utf16_unicode_ci); + &my_charset_utf16_unicode_ci, + cs); newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED | MY_CS_NONASCII; #endif } @@ -351,7 +381,8 @@ static int add_collation(struct charset_info_st *cs) #if defined (HAVE_CHARSET_utf32) && defined(HAVE_UCA_COLLATIONS) copy_uca_collation(newcs, newcs->state & MY_CS_NOPAD ? &my_charset_utf32_unicode_nopad_ci : - &my_charset_utf32_unicode_ci); + &my_charset_utf32_unicode_ci, + cs); newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED | MY_CS_NONASCII; #endif } diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index 77581a51d75..bfdda25cafa 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -1945,8 +1945,6 @@ int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock) if ((length=(size_t) (info->write_pos - info->write_buffer))) { - info->write_end= (info->write_buffer + info->buffer_length - - ((info->pos_in_file + length) & (IO_SIZE - 1))); if (append_cache) { @@ -1968,6 +1966,8 @@ int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock) set_if_bigger(info->end_of_file, info->pos_in_file); } + info->write_end= (info->write_buffer + info->buffer_length - + ((info->pos_in_file + length) & (IO_SIZE - 1))); info->write_pos= info->write_buffer; ++info->disk_writes; UNLOCK_APPEND_BUFFER; diff --git a/mysys/my_access.c b/mysys/my_access.c index 68cd01d33e6..91a536d214e 100644 --- a/mysys/my_access.c +++ b/mysys/my_access.c @@ -173,6 +173,11 @@ static my_bool does_drive_exists(char drive_letter) file names with a colon (:) are not allowed because such file names store data in Alternate Data Streams which can be used to hide the data. + Apart from colon, other characters that are not allowed in filenames + on Windows are greater/less sign, double quotes, forward slash, backslash, + pipe and star characters. + + See MSDN documentation on filename restrictions. @param name contains the file name with or without path @param length contains the length of file name @@ -181,6 +186,8 @@ static my_bool does_drive_exists(char drive_letter) @return TRUE if the file name is allowed, FALSE otherwise. */ +#define ILLEGAL_FILENAME_CHARS "<>:\"/\\|?*" + my_bool is_filename_allowed(const char *name __attribute__((unused)), size_t length __attribute__((unused)), my_bool allow_current_dir __attribute__((unused))) @@ -205,6 +212,8 @@ my_bool is_filename_allowed(const char *name __attribute__((unused)), return (allow_current_dir && (ch - name == 1) && does_drive_exists(*name)); } + else if (strchr(ILLEGAL_FILENAME_CHARS, *ch)) + return FALSE; } return TRUE; } /* is_filename_allowed */ diff --git a/mysys/my_addr_resolve.c b/mysys/my_addr_resolve.c index 72b04119855..83716bf11e1 100644 --- a/mysys/my_addr_resolve.c +++ b/mysys/my_addr_resolve.c @@ -34,6 +34,13 @@ static const char *strip_path(const char *s) return prev; } +#if defined(HAVE_LINK_H) && defined(HAVE_DLOPEN) +#include +static ptrdiff_t offset= 0; +#else +#define offset 0 +#endif + /* The following is very much single-threaded code and it's only supposed to be used on shutdown or for a crash report @@ -60,7 +67,7 @@ static asymbol **symtable= 0; */ int my_addr_resolve(void *ptr, my_addr_loc *loc) { - bfd_vma addr= (intptr)ptr; + bfd_vma addr= (intptr)ptr - offset; asection *sec; for (sec= bfdh->sections; sec; sec= sec->next) @@ -103,6 +110,12 @@ const char *my_addr_resolve_init() uint unused; char **matching; +#if defined(HAVE_LINK_H) && defined(HAVE_DLOPEN) + struct link_map *lm = (struct link_map*) dlopen(0, RTLD_NOW); + if (lm) + offset= lm->l_addr; +#endif + bfdh= bfd_openr(my_progname, NULL); if (!bfdh) goto err; @@ -133,13 +146,6 @@ err: #include #include -#if defined(HAVE_LINK_H) && defined(HAVE_DLOPEN) -#include -static ptrdiff_t offset= 0; -#else -#define offset 0 -#endif - static int in[2], out[2]; static int initialized= 0; static char output[1024]; @@ -174,7 +180,7 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc) extra_bytes_read= read(out[0], output + total_bytes_read, sizeof(output) - total_bytes_read); if (extra_bytes_read < 0) - return 1; + return 2; /* Timeout or max bytes read. */ if (extra_bytes_read == 0) break; @@ -184,7 +190,7 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc) /* Failed starting addr2line. */ if (total_bytes_read == 0) - return 1; + return 3; /* Go through the addr2line response and get the required data. The response is structured in 2 lines. The first line contains the function @@ -205,14 +211,14 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc) } /* Response is malformed. */ if (filename_start == -1 || line_number_start == -1) - return 1; + return 4; loc->func= output; loc->file= output + filename_start; /* Addr2line was unable to extract any meaningful information. */ if (strcmp(loc->file, "??") == 0) - return 1; + return 5; loc->file= strip_path(loc->file); diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c index 0eaf1a88aa1..a0c1a23d63c 100644 --- a/mysys/my_bitmap.c +++ b/mysys/my_bitmap.c @@ -168,7 +168,7 @@ static inline uint get_first_set(my_bitmap_map value, uint word_pos) my_bool my_bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits, - my_bool thread_safe __attribute__((unused))) + my_bool thread_safe) { DBUG_ENTER("my_bitmap_init"); if (!buf) diff --git a/mysys/my_error.c b/mysys/my_error.c index c0698b19a20..f9614e07c6a 100644 --- a/mysys/my_error.c +++ b/mysys/my_error.c @@ -131,7 +131,7 @@ void my_error(uint nr, myf MyFlags, ...) Print an error message. @note - Goes through the (sole) function registered in error_handler_hook + Just like my_error, but for cases when the error message is not ER(error) @param error error number @param format format string diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c index 1fa3f9b9b8f..2ac033c8264 100644 --- a/mysys/my_fopen.c +++ b/mysys/my_fopen.c @@ -101,6 +101,7 @@ static FILE *my_win_freopen(const char *path, const char *mode, FILE *stream) HANDLE osfh; DBUG_ASSERT(path && stream); + DBUG_ASSERT(strchr(mode, 'a')); /* We use FILE_APPEND_DATA below */ /* Services don't have stdout/stderr on Windows, so _fileno returns -1. */ if (fd < 0) @@ -111,15 +112,14 @@ static FILE *my_win_freopen(const char *path, const char *mode, FILE *stream) fd= _fileno(stream); } - if ((osfh= CreateFile(path, GENERIC_READ | GENERIC_WRITE, + if ((osfh= CreateFile(path, GENERIC_READ | FILE_APPEND_DATA, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) return NULL; - if ((handle_fd= _open_osfhandle((intptr_t)osfh, - _O_APPEND | _O_TEXT)) == -1) + if ((handle_fd= _open_osfhandle((intptr_t)osfh, _O_TEXT)) == -1) { CloseHandle(osfh); return NULL; diff --git a/mysys/my_redel.c b/mysys/my_redel.c index 61e61b40791..976fc5a18c3 100644 --- a/mysys/my_redel.c +++ b/mysys/my_redel.c @@ -1,5 +1,5 @@ -/* - Copyright (c) 2000, 2010, Oracle and/or its affiliates +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates + Copyright (c) 2009, 2016, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -49,7 +49,8 @@ int my_redel(const char *org_name, const char *tmp_name, DBUG_PRINT("my",("org_name: '%s' tmp_name: '%s' MyFlags: %lu", org_name,tmp_name,MyFlags)); - if (my_copystat(org_name,tmp_name,MyFlags) < 0) + if (!my_disable_copystat_in_redel && + my_copystat(org_name,tmp_name,MyFlags) < 0) goto end; if (MyFlags & MY_REDEL_MAKE_BACKUP) { diff --git a/mysys/my_static.c b/mysys/my_static.c index ce9e8831be6..08edf2c4200 100644 --- a/mysys/my_static.c +++ b/mysys/my_static.c @@ -98,6 +98,7 @@ my_bool my_disable_sync=0; my_bool my_disable_async_io=0; my_bool my_disable_flush_key_blocks=0; my_bool my_disable_symlinks=0; +my_bool my_disable_copystat_in_redel=0; /* Typelib by all clients */ const char *sql_protocol_names_lib[] = diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index 395659238b3..e22fb4162ec 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -38,13 +38,13 @@ static char *heap_start; -#ifdef HAVE_BSS_START +#if(defined HAVE_BSS_START) && !(defined __linux__) extern char *__bss_start; #endif void my_init_stacktrace() { -#ifdef HAVE_BSS_START +#if(defined HAVE_BSS_START) && !(defined __linux__) heap_start = (char*) &__bss_start; #endif } diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c index e8c4ed9c614..a77db04acef 100644 --- a/mysys/thr_lock.c +++ b/mysys/thr_lock.c @@ -498,18 +498,6 @@ has_old_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner) return 0; } -static inline my_bool have_specific_lock(THR_LOCK_DATA *data, - enum thr_lock_type type) -{ - for ( ; data ; data=data->next) - { - if (data->type == type) - return 1; - } - return 0; -} - - static void wake_up_waiters(THR_LOCK *lock); diff --git a/plugin/auth_pam/auth_pam.c b/plugin/auth_pam/auth_pam.c index ac1b3b2da09..8810a418cd3 100644 --- a/plugin/auth_pam/auth_pam.c +++ b/plugin/auth_pam/auth_pam.c @@ -131,7 +131,7 @@ static int pam_auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info) { pam_handle_t *pamh = NULL; int status; - const char *new_username; + const char *new_username= NULL; struct param param; /* The following is written in such a way to make also solaris happy */ struct pam_conv pam_start_arg = { &conv, (char*) ¶m }; @@ -139,7 +139,7 @@ static int pam_auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info) /* get the service name, as specified in - CREATE USER ... IDENTIFIED WITH pam_auth AS "service" + CREATE USER ... IDENTIFIED WITH pam AS "service" */ const char *service = info->auth_string && info->auth_string[0] ? info->auth_string : "mysql"; diff --git a/plugin/aws_key_management/CMakeLists.txt b/plugin/aws_key_management/CMakeLists.txt index e414b9e6ad8..b3e23f0934e 100644 --- a/plugin/aws_key_management/CMakeLists.txt +++ b/plugin/aws_key_management/CMakeLists.txt @@ -3,7 +3,7 @@ # are # - OS : Windows,Linux or OSX -# - C++11 compiler : VS2013+, gcc 4.7+, clang 3.3+ +# - C++11 compiler : VS2013+, gcc 4.8+, clang 3.3+ # - libcurl development package needs to be present on Unixes # # If we build SDK outselves, we'll need require GIT to be present on the build machine @@ -13,7 +13,10 @@ # or if plugin is explicitly requested to build. Then bail out. MACRO(SKIP_AWS_PLUGIN msg) IF(VERBOSE OR "${PLUGIN_AWS_KEY_MANAGEMENT}" MATCHES "^(STATIC|DYNAMIC)$") - MESSAGE(STATUS "Skip aws_key_management - ${msg}") + MESSAGE(STATUS "Can't build aws_key_management - ${msg}") + ENDIF() + IF(TARGET aws_key_management) + MESSAGE(FATAL_ERROR "Error configuring aws_key_management - aborting") ENDIF() RETURN() ENDMACRO() @@ -27,7 +30,7 @@ ENDIF() # This plugin needs recent C++ compilers (AWS C++ SDK header files are using C++11 features) SET(CXX11_FLAGS) -SET(OLD_COMPILER_MSG "AWS SDK requires c++11 -capable compiler (minimal supported versions are g++ 4.7, clang 3.3, VS2103)") +SET(OLD_COMPILER_MSG "AWS SDK requires c++11 -capable compiler (minimal supported versions are g++ 4.8, clang 3.3, VS2103)") IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU") EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) @@ -54,26 +57,6 @@ IF (NOT(WIN32 OR APPLE OR (CMAKE_SYSTEM_NAME MATCHES "Linux"))) ENDIF() -# Figure out where AWS installs SDK libraries -# The below is defined in AWS SDK's CMakeLists.txt -# (and their handling is weird, every OS has special install directory) -IF(WIN32) - SET(SDK_INSTALL_BINARY_PREFIX "windows") -ELSEIF(APPLE) - SET(SDK_INSTALL_BINARY_PREFIX "mac") -ELSEIF(UNIX) - SET(SDK_INSTALL_BINARY_PREFIX "linux") -ENDIF() -IF(NOT APPLE) - IF(CMAKE_SIZEOF_VOID_P EQUAL 8) - SET(SDK_INSTALL_BINARY_PREFIX "${SDK_INSTALL_BINARY_PREFIX}/intel64") - ELSE() - SET(SDK_INSTALL_BINARY_PREFIX "${SDK_INSTALL_BINARY_PREFIX}/ia32") - ENDIF() -ENDIF() -IF(CMAKE_CONFIGURATION_TYPES) - SET(SDK_INSTALL_BINARY_PREFIX "${SDK_INSTALL_BINARY_PREFIX}/${CMAKE_CFG_INTDIR}") -ENDIF() FIND_LIBRARY(AWS_CPP_SDK_CORE NAMES aws-cpp-sdk-core PATH_SUFFIXES "${SDK_INSTALL_BINARY_PREFIX}") FIND_LIBRARY(AWS_CPP_SDK_KMS NAMES aws-cpp-sdk-core PATH_SUFFIXES "${SDK_INSTALL_BINARY_PREFIX}") @@ -85,7 +68,8 @@ IF(AWS_CPP_SDK_CORE AND AWS_CPP_SDK_KMS AND HAVE_AWS_HEADERS) SET(AWS_SDK_LIBS ${AWS_CPP_SDK_CORE} ${AWS_CPP_SDK_KMS}) ELSE() # Build from source, using ExternalProject_Add - IF(CMAKE_VERSION VERSION_LESS "2.8.8") + # AWS C++ SDK requires cmake 2.8.12 + IF(CMAKE_VERSION VERSION_LESS "2.8.12") SKIP_AWS_PLUGIN("CMake is too old") ENDIF() FIND_PACKAGE(Git) @@ -99,26 +83,35 @@ ELSE() SKIP_AWS_PLUGIN("AWS C++ SDK requires libcurl development package") ENDIF() SET(PIC_FLAG -fPIC) + FIND_PATH(UUID_INCLUDE_DIR uuid/uuid.h) + IF(NOT UUID_INCLUDE_DIR) + SKIP_AWS_PLUGIN("AWS C++ SDK requires uuid development package") + ENDIF() + IF(NOT APPLE) + FIND_LIBRARY(UUID_LIBRARIES uuid) + IF(NOT UUID_LIBRARIES) + SKIP_AWS_PLUGIN("AWS C++ SDK requires uuid development package") + ENDIF() + ENDIF() ENDIF() IF(MSVC) - SET(EXTRA_SDK_CMAKE_FLAGS -DCMAKE_CXX_FLAGS_DEBUGOPT="" -DCMAKE_EXE_LINKER_FLAGS_DEBUGOPT="" -DCMAKE_CXX_FLAGS=/wd4592) + SET(EXTRA_SDK_CMAKE_FLAGS -DCMAKE_CXX_FLAGS_DEBUGOPT="" -DCMAKE_EXE_LINKER_FLAGS_DEBUGOPT="" "-DCMAKE_CXX_FLAGS=/wd4530 /WX-") ENDIF() IF(CMAKE_CXX_COMPILER) SET(EXTRA_SDK_CMAKE_FLAGS ${EXTRA_SDK_CMAKE_FLAGS} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}) ENDIF() - # Relax AWS C++ SDK unreasonably high requirements for CMake version. Use replace utility (from MariaDB build) - # to patch their CMakeLists.txt SET(AWS_SDK_PATCH_COMMAND ) ExternalProject_Add( aws_sdk_cpp GIT_REPOSITORY "https://github.com/awslabs/aws-sdk-cpp.git" - GIT_TAG "0.9.6" # single tag + GIT_TAG "1.0.8" UPDATE_COMMAND "" - PATCH_COMMAND replace 3.1.2 2.8 -- ${CMAKE_BINARY_DIR}/aws-sdk-cpp/CMakeLists.txt SOURCE_DIR "${CMAKE_BINARY_DIR}/aws-sdk-cpp" CMAKE_ARGS - -DBUILD_ONLY=aws-cpp-sdk-kms -DSTATIC_LINKING=1 + -DBUILD_ONLY=kms + -DBUILD_SHARED_LIBS=OFF + -DFORCE_SHARED_CRT=OFF "-DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG} ${PIC_FLAG}" "-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${PIC_FLAG}" "-DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} ${PIC_FLAG}" @@ -127,18 +120,18 @@ ELSE() -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/aws_sdk_cpp TEST_COMMAND "" ) - + SET_TARGET_PROPERTIES(aws_sdk_cpp PROPERTIES EXCLUDE_FROM_ALL TRUE) # We do not need to build the whole SDK , just 2 of its libs set(AWS_SDK_LIBS aws-cpp-sdk-core aws-cpp-sdk-kms) FOREACH(lib ${AWS_SDK_LIBS}) ADD_LIBRARY(${lib} STATIC IMPORTED GLOBAL) ADD_DEPENDENCIES(${lib} aws_sdk_cpp) - SET(loc "${CMAKE_BINARY_DIR}/aws_sdk_cpp/lib/${SDK_INSTALL_BINARY_PREFIX}/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}") + SET(loc "${CMAKE_BINARY_DIR}/aws_sdk_cpp/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}") SET_TARGET_PROPERTIES(${lib} PROPERTIES IMPORTED_LOCATION ${loc}) IF(WIN32) SET_TARGET_PROPERTIES(${lib} PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES "bcrypt;winhttp;wininet;userenv") ELSE() - SET_TARGET_PROPERTIES(${lib} PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES "${SSL_LIBRARIES};${CURL_LIBRARIES}") + SET_TARGET_PROPERTIES(${lib} PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES "${SSL_LIBRARIES};${CURL_LIBRARIES};${UUID_LIBRARIES}") ENDIF() ENDFOREACH() @@ -150,5 +143,6 @@ ELSE() INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/aws_sdk_cpp/include) ENDIF() +ADD_DEFINITIONS(${SSL_DEFINES}) # Need to know whether openssl should be initialized SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAGS}") TARGET_LINK_LIBRARIES(aws_key_management ${AWS_SDK_LIBS}) diff --git a/plugin/aws_key_management/aws_key_management_plugin.cc b/plugin/aws_key_management/aws_key_management_plugin.cc index f4d3c7a52bc..e94c551bebe 100644 --- a/plugin/aws_key_management/aws_key_management_plugin.cc +++ b/plugin/aws_key_management/aws_key_management_plugin.cc @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -76,9 +77,11 @@ static const char *key_spec_names[]={ "AES_128", "AES_256", 0 }; /* Plugin variables */ static char* master_key_id; +static char* region; static unsigned long key_spec; static unsigned long log_level; static int rotate_key; +static int request_timeout; /* AWS functionality*/ static int aws_decrypt_key(const char *path, KEY_INFO *info); @@ -138,6 +141,7 @@ protected: } }; +Aws::SDKOptions sdkOptions; /* Plugin initialization. @@ -148,13 +152,34 @@ protected: static int plugin_init(void *p) { DBUG_ENTER("plugin_init"); - client = new KMSClient(); + +#ifdef HAVE_YASSL + sdkOptions.cryptoOptions.initAndCleanupOpenSSL = true; +#else + /* Server initialized OpenSSL already, thus AWS must skip it */ + sdkOptions.cryptoOptions.initAndCleanupOpenSSL = false; +#endif + + Aws::InitAPI(sdkOptions); + InitializeAWSLogging(Aws::MakeShared("aws_key_management_plugin", (Aws::Utils::Logging::LogLevel) log_level)); + + Aws::Client::ClientConfiguration clientConfiguration; + if (region && region[0]) + { + clientConfiguration.region = region; + } + if (request_timeout) + { + clientConfiguration.requestTimeoutMs= request_timeout; + clientConfiguration.connectTimeoutMs= request_timeout; + } + client = new KMSClient(clientConfiguration); if (!client) { sql_print_error("Can not initialize KMS client"); DBUG_RETURN(-1); } - InitializeAWSLogging(Aws::MakeShared("aws_key_management_plugin", (Aws::Utils::Logging::LogLevel) log_level)); + #ifdef HAVE_PSI_INTERFACE mysql_mutex_register("aws_key_management", &mtx_info, 1); #endif @@ -189,6 +214,8 @@ static int plugin_deinit(void *p) mysql_mutex_destroy(&mtx); delete client; ShutdownAWSLogging(); + + Aws::ShutdownAPI(sdkOptions); DBUG_RETURN(0); } @@ -557,11 +584,24 @@ static MYSQL_SYSVAR_INT(rotate_key, rotate_key, "Set this variable to key id to perform rotation of the key. Specify -1 to rotate all keys", NULL, update_rotate, 0, -1, INT_MAX, 1); + +static MYSQL_SYSVAR_INT(request_timeout, request_timeout, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, + "Timeout in milliseconds for create HTTPS connection or execute AWS request. Specify 0 to use SDK default.", + NULL, NULL, 0, 0, INT_MAX, 1); + +static MYSQL_SYSVAR_STR(region, region, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, + "AWS region. For example us-east-1, or eu-central-1. If no value provided, SDK default is used.", + NULL, NULL, ""); + static struct st_mysql_sys_var* settings[]= { MYSQL_SYSVAR(master_key_id), MYSQL_SYSVAR(key_spec), MYSQL_SYSVAR(rotate_key), MYSQL_SYSVAR(log_level), + MYSQL_SYSVAR(request_timeout), + MYSQL_SYSVAR(region), NULL }; diff --git a/plugin/feedback/CMakeLists.txt b/plugin/feedback/CMakeLists.txt index a243ba07751..2103250e5a6 100644 --- a/plugin/feedback/CMakeLists.txt +++ b/plugin/feedback/CMakeLists.txt @@ -19,5 +19,5 @@ ENDIF(WIN32) MYSQL_ADD_PLUGIN(FEEDBACK ${FEEDBACK_SOURCES} LINK_LIBRARIES ${SSL_LIBRARIES} - ${MAYBE_STATIC_ONLY} DEFAULT) + ${MAYBE_STATIC_ONLY} RECOMPILE_FOR_EMBEDDED DEFAULT) diff --git a/plugin/feedback/utils.cc b/plugin/feedback/utils.cc index 327db69feda..7530003182f 100644 --- a/plugin/feedback/utils.cc +++ b/plugin/feedback/utils.cc @@ -43,7 +43,11 @@ static const char *get_os_version_name(OSVERSIONINFOEX *ver) { DWORD major = ver->dwMajorVersion; DWORD minor = ver->dwMinorVersion; - + if (major == 10 && minor == 0) + { + return (ver->wProductType == VER_NT_WORKSTATION) ? + "Windows 10" : "Windows Server 2016"; + } if (major == 6 && minor == 3) { return (ver->wProductType == VER_NT_WORKSTATION)? @@ -102,7 +106,12 @@ static int uname(struct utsname *buf) if(version_str && version_str[0]) sprintf(buf->version, "%s %s",version_str, ver.szCSDVersion); else - sprintf(buf->version, "%s", ver.szCSDVersion); + { + /* Fallback for unknown versions, e.g "Windows ." */ + sprintf(buf->version, "Windows %d.%d%s", + ver.dwMajorVersion, ver.dwMinorVersion, + (ver.wProductType == VER_NT_WORKSTATION ? "" : " Server")); + } #ifdef _WIN64 strcpy(buf->machine, "x64"); diff --git a/plugin/file_key_management/parser.cc b/plugin/file_key_management/parser.cc index b224391264c..047e9153ec2 100644 --- a/plugin/file_key_management/parser.cc +++ b/plugin/file_key_management/parser.cc @@ -333,8 +333,7 @@ char* Parser::read_and_decrypt_file(const char *secret) // Check for file encryption uchar *decrypted; - if (file_size > OpenSSL_prefix_len && - is_prefix((char*)buffer, OpenSSL_prefix)) + if (file_size > OpenSSL_prefix_len && is_prefix((char*)buffer, OpenSSL_prefix)) { uchar key[OpenSSL_key_len]; uchar iv[OpenSSL_iv_len]; @@ -379,4 +378,3 @@ err1: err0: return NULL; } - diff --git a/plugin/handler_socket/libhsclient/allocator.hpp b/plugin/handler_socket/libhsclient/allocator.hpp index 82ff51f00e7..dd3a28ba7bd 100644 --- a/plugin/handler_socket/libhsclient/allocator.hpp +++ b/plugin/handler_socket/libhsclient/allocator.hpp @@ -35,7 +35,7 @@ typedef std::allocator allocator_type; #if 1 #define DENA_ALLOCA_ALLOCATE(typ, len) \ - static_cast(alloca((len) * sizeof(typ))) + (typ *) alloca((len) * sizeof(typ)) #define DENA_ALLOCA_FREE(x) #else #define DENA_ALLOCA_ALLOCATE(typ, len) \ diff --git a/plugin/metadata_lock_info/metadata_lock_info.cc b/plugin/metadata_lock_info/metadata_lock_info.cc index 6a9f6ef3f6c..d5308acb013 100644 --- a/plugin/metadata_lock_info/metadata_lock_info.cc +++ b/plugin/metadata_lock_info/metadata_lock_info.cc @@ -39,6 +39,7 @@ static const LEX_STRING metadata_lock_info_lock_mode[] = { { C_STRING_WITH_LEN("MDL_SHARED_READ") }, { C_STRING_WITH_LEN("MDL_SHARED_WRITE") }, { C_STRING_WITH_LEN("MDL_SHARED_UPGRADABLE") }, + { C_STRING_WITH_LEN("MDL_SHARED_READ_ONLY") }, { C_STRING_WITH_LEN("MDL_SHARED_NO_WRITE") }, { C_STRING_WITH_LEN("MDL_SHARED_NO_READ_WRITE") }, { C_STRING_WITH_LEN("MDL_EXCLUSIVE") }, diff --git a/plugin/qc_info/qc_info.cc b/plugin/qc_info/qc_info.cc index aec542b6935..e36e490dec3 100644 --- a/plugin/qc_info/qc_info.cc +++ b/plugin/qc_info/qc_info.cc @@ -107,6 +107,9 @@ static ST_FIELD_INFO qc_info_fields[]= {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0} }; + +static const char unknown[]= "#UNKNOWN#"; + static int qc_info_fill_table(THD *thd, TABLE_LIST *tables, COND *cond) { @@ -147,7 +150,8 @@ static int qc_info_fill_table(THD *thd, TABLE_LIST *tables, query_cache_block_raw = my_hash_element(queries, i); query_cache_block = (Query_cache_block*)query_cache_block_raw; - if (query_cache_block->type != Query_cache_block::QUERY) + if (unlikely(!query_cache_block || + query_cache_block->type != Query_cache_block::QUERY)) continue; query_cache_query = query_cache_block->query(); @@ -170,14 +174,33 @@ static int qc_info_fill_table(THD *thd, TABLE_LIST *tables, table->field[COLUMN_GROUP_CONCAT_MAX_LENGTH]->store(flags.group_concat_max_len, 0); cs_client= get_charset(flags.character_set_client_num, MYF(MY_WME)); - table->field[COLUMN_CHARACTER_SET_CLIENT]->store(cs_client->csname, strlen(cs_client->csname), scs); + if (likely(cs_client)) + table->field[COLUMN_CHARACTER_SET_CLIENT]-> + store(cs_client->csname, strlen(cs_client->csname), scs); + else + table->field[COLUMN_CHARACTER_SET_CLIENT]-> + store(STRING_WITH_LEN(unknown), scs); + cs_result= get_charset(flags.character_set_results_num, MYF(MY_WME)); - table->field[COLUMN_CHARACTER_SET_RESULT]->store(cs_result->csname, strlen(cs_result->csname), scs); + if (likely(cs_result)) + table->field[COLUMN_CHARACTER_SET_RESULT]-> + store(cs_result->csname, strlen(cs_result->csname), scs); + else + table->field[COLUMN_CHARACTER_SET_RESULT]-> + store(STRING_WITH_LEN(unknown), scs); + collation= get_charset(flags.collation_connection_num, MYF(MY_WME)); - table->field[COLUMN_COLLATION]->store(collation->name, strlen(collation->name), scs); + if (likely(collation)) + table->field[COLUMN_COLLATION]-> + store(collation->name, strlen(collation->name), scs); + else + table->field[COLUMN_COLLATION]-> store(STRING_WITH_LEN(unknown), scs); tz= flags.time_zone->get_name(); - table->field[COLUMN_TIMEZONE]->store(tz->ptr(), tz->length(), scs); + if (likely(tz)) + table->field[COLUMN_TIMEZONE]->store(tz->ptr(), tz->length(), scs); + else + table->field[COLUMN_TIMEZONE]-> store(STRING_WITH_LEN(unknown), scs); table->field[COLUMN_DEFAULT_WEEK_FORMAT]->store(flags.default_week_format, 0); table->field[COLUMN_DIV_PRECISION_INCREMENT]->store(flags.div_precision_increment, 0); @@ -205,7 +228,8 @@ static int qc_info_fill_table(THD *thd, TABLE_LIST *tables, /* If we have result blocks, process them */ first_result_block= query_cache_query->result(); - if(first_result_block) + if(query_cache_query->is_results_ready() && + first_result_block) { /* initialize so we can loop over the result blocks*/ result_block= first_result_block; @@ -232,7 +256,8 @@ static int qc_info_fill_table(THD *thd, TABLE_LIST *tables, } table->field[COLUMN_RESULT_BLOCKS_COUNT]->store(result_blocks_count, 0); table->field[COLUMN_RESULT_BLOCKS_SIZE]->store(result_blocks_size, 0); - table->field[COLUMN_RESULT_BLOCKS_SIZE_USED]->store(result_blocks_size_used, 0); + table->field[COLUMN_RESULT_BLOCKS_SIZE_USED]-> + store(result_blocks_size_used, 0); if (schema_table_store_record(thd, table)) goto cleanup; diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c index 9df0d75e3c6..a06c0409cd6 100644 --- a/plugin/server_audit/server_audit.c +++ b/plugin/server_audit/server_audit.c @@ -427,9 +427,8 @@ static MYSQL_SYSVAR_UINT(query_log_limit, query_log_limit, char locinfo_ini_value[sizeof(struct connection_info)+4]; static MYSQL_THDVAR_STR(loc_info, - PLUGIN_VAR_READONLY | PLUGIN_VAR_MEMALLOC, - "Auxiliary info.", NULL, NULL, - locinfo_ini_value); + PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_MEMALLOC, + "Internal info", NULL, NULL, locinfo_ini_value); static const char *syslog_facility_names[]= { diff --git a/plugin/wsrep_info/mysql-test/wsrep_info/r/plugin.result b/plugin/wsrep_info/mysql-test/wsrep_info/r/plugin.result index 1aef7c30fc7..f33a628d428 100644 --- a/plugin/wsrep_info/mysql-test/wsrep_info/r/plugin.result +++ b/plugin/wsrep_info/mysql-test/wsrep_info/r/plugin.result @@ -1,17 +1,21 @@ # On node 1 +connection node_1; SELECT * FROM INFORMATION_SCHEMA.WSREP_STATUS; NODE_INDEX NODE_STATUS CLUSTER_STATUS CLUSTER_SIZE CLUSTER_STATE_UUID CLUSTER_STATE_SEQNO CLUSTER_CONF_ID GAP PROTOCOL_VERSION - Synced Primary 2 0 2 NO 3 + Synced Primary 2 0 NO 3 SELECT * FROM INFORMATION_SCHEMA.WSREP_MEMBERSHIP ORDER BY NAME; INDEX UUID NAME ADDRESS test-node-1
test-node-2
# On node 2 +connection node_2; SELECT * FROM INFORMATION_SCHEMA.WSREP_STATUS; NODE_INDEX NODE_STATUS CLUSTER_STATUS CLUSTER_SIZE CLUSTER_STATE_UUID CLUSTER_STATE_SEQNO CLUSTER_CONF_ID GAP PROTOCOL_VERSION - Synced Primary 2 0 2 YES 3 + Synced Primary 2 0 YES 3 SELECT * FROM INFORMATION_SCHEMA.WSREP_MEMBERSHIP ORDER BY NAME; INDEX UUID NAME ADDRESS test-node-1
test-node-2
+disconnect node_2; +disconnect node_1; # End of test diff --git a/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm b/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm index 5fd761896a1..7148a9cf057 100644 --- a/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm +++ b/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm @@ -39,5 +39,7 @@ push @::global_suppressions, $ENV{PATH}="$epath:$ENV{PATH}"; $ENV{PATH}="$spath:$ENV{PATH}" unless $epath eq $spath; +sub is_default { 1 } + bless { }; diff --git a/plugin/wsrep_info/mysql-test/wsrep_info/t/plugin.test b/plugin/wsrep_info/mysql-test/wsrep_info/t/plugin.test index 9b06f15b125..9ae783a957e 100644 --- a/plugin/wsrep_info/mysql-test/wsrep_info/t/plugin.test +++ b/plugin/wsrep_info/mysql-test/wsrep_info/t/plugin.test @@ -4,7 +4,7 @@ --echo # On node 1 --connection node_1 ---replace_column 1 5 +--replace_column 1 5 7 SELECT * FROM INFORMATION_SCHEMA.WSREP_STATUS; --replace_column 1 2 4
@@ -13,7 +13,7 @@ SELECT * FROM INFORMATION_SCHEMA.WSREP_MEMBERSHIP ORDER BY NAME; --echo # On node 2 --connection node_2 ---replace_column 1 5 +--replace_column 1 5 7 SELECT * FROM INFORMATION_SCHEMA.WSREP_STATUS; --replace_column 1 2 4
diff --git a/scripts/mysql_install_db.pl.in b/scripts/mysql_install_db.pl.in index d1b299d9ef5..3ad733884fb 100644 --- a/scripts/mysql_install_db.pl.in +++ b/scripts/mysql_install_db.pl.in @@ -297,17 +297,19 @@ parse_arguments($opt, 'PICK-ARGS-FROM-ARGV', @ARGV); # ---------------------------------------------------------------------- # FIXME $extra_bindir is not used -my ($bindir,$extra_bindir,$mysqld,$pkgdatadir,$mysqld_opt,$scriptdir); +my ($bindir,$extra_bindir,$mysqld,$srcpkgdatadir,$buildpkgdatadir,$mysqld_opt, + $scriptdir); if ( $opt->{srcdir} ) { - $opt->{basedir} = $opt->{builddir}; - $bindir = "$opt->{basedir}/client"; - $extra_bindir = "$opt->{basedir}/extra"; - $mysqld = "$opt->{basedir}/sql/mysqld"; - $mysqld_opt = "--language=$opt->{srcdir}/sql/share/english"; - $pkgdatadir = "$opt->{srcdir}/scripts"; - $scriptdir = "$opt->{srcdir}/scripts"; + $opt->{basedir} = $opt->{builddir}; + $bindir = "$opt->{basedir}/client"; + $extra_bindir = "$opt->{basedir}/extra"; + $mysqld = "$opt->{basedir}/sql/mysqld"; + $mysqld_opt = "--language=$opt->{srcdir}/sql/share/english"; + $srcpkgdatadir = "$opt->{srcdir}/scripts"; + $buildpkgdatadir = "$opt->{builddir}/scripts"; + $scriptdir = "$opt->{srcdir}/scripts"; } elsif ( $opt->{basedir} ) { @@ -317,18 +319,20 @@ elsif ( $opt->{basedir} ) "libexec","sbin","bin") || # ,"sql" find_in_basedir($opt,"file","mysqld-nt", "bin"); # ,"sql" - $pkgdatadir = find_in_basedir($opt,"dir","fill_help_tables.sql", + $srcpkgdatadir = find_in_basedir($opt,"dir","fill_help_tables.sql", "share","share/mysql"); # ,"scripts" + $buildpkgdir = $srcpkgdatadir; $scriptdir = "$opt->{basedir}/scripts"; } else { - $opt->{basedir} = '@prefix@'; - $bindir = '@bindir@'; - $extra_bindir = $bindir; - $mysqld = '@libexecdir@/mysqld'; - $pkgdatadir = '@pkgdatadir@'; - $scriptdir = '@scriptdir@'; + $opt->{basedir} = '@prefix@'; + $bindir = '@bindir@'; + $extra_bindir = $bindir; + $mysqld = '@libexecdir@/mysqld'; + $srcpkgdatadir = '@pkgdatadir@'; + $buildpkgdatadir = '@pkgdatadir@'; + $scriptdir = '@scriptdir@'; } unless ( $opt->{ldata} ) @@ -336,19 +340,15 @@ unless ( $opt->{ldata} ) $opt->{ldata} = '@localstatedir@'; } -if ( $opt->{srcdir} ) -{ - $pkgdatadir = "$opt->{srcdir}/scripts"; -} # ---------------------------------------------------------------------- # Set up paths to SQL scripts required for bootstrap # ---------------------------------------------------------------------- -my $fill_help_tables = "$pkgdatadir/fill_help_tables.sql"; -my $create_system_tables = "$pkgdatadir/mysql_system_tables.sql"; -my $fill_system_tables = "$pkgdatadir/mysql_system_tables_data.sql"; -my $maria_add_gis_sp = "$pkgdatadir/maria_add_gis_sp_bootstrap.sql"; +my $fill_help_tables = "$srcpkgdatadir/fill_help_tables.sql"; +my $create_system_tables = "$srcpkgdatadir/mysql_system_tables.sql"; +my $fill_system_tables = "$srcpkgdatadir/mysql_system_tables_data.sql"; +my $maria_add_gis_sp = "$buildpkgdatadir/maria_add_gis_sp_bootstrap.sql"; foreach my $f ( $fill_help_tables,$create_system_tables,$fill_system_tables,$maria_add_gis_sp ) { @@ -508,7 +508,7 @@ if ( open(PIPE, "| $mysqld_install_cmd_line") ) # FIXME > /dev/null ? if ( open(PIPE, "| $mysqld_install_cmd_line") ) { - print PIPE "use test;\n"; + print PIPE "use mysql;\n"; while ( ) { print PIPE $_; diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index e5502301d9c..3b48dad649c 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -271,7 +271,8 @@ then extra_bindir="$basedir/extra" mysqld="$basedir/sql/mysqld" langdir="$basedir/sql/share/english" - pkgdatadir="$srcdir/scripts" + srcpkgdatadir="$srcdir/scripts" + buildpkgdatadir="$builddir/scripts" scriptdir="$srcdir/scripts" elif test -n "$basedir" then @@ -289,8 +290,9 @@ then cannot_find_file errmsg.sys $basedir/share/english $basedir/share/mysql/english exit 1 fi - pkgdatadir=`find_in_basedir --dir fill_help_tables.sql share share/mysql` - if test -z "$pkgdatadir" + srcpkgdatadir=`find_in_basedir --dir fill_help_tables.sql share share/mysql` + buildpkgdatadir=$srcpkgdatadir + if test -z "$srcpkgdatadir" then cannot_find_file fill_help_tables.sql $basedir/share $basedir/share/mysql exit 1 @@ -301,16 +303,17 @@ else bindir="@bindir@" extra_bindir="$bindir" mysqld="@libexecdir@/mysqld" - pkgdatadir="@pkgdatadir@" + srcpkgdatadir="@pkgdatadir@" + buildpkgdatadir="@pkgdatadir@" scriptdir="@scriptdir@" fi # Set up paths to SQL scripts required for bootstrap -fill_help_tables="$pkgdatadir/fill_help_tables.sql" -create_system_tables="$pkgdatadir/mysql_system_tables.sql" -create_system_tables2="$pkgdatadir/mysql_performance_tables.sql" -fill_system_tables="$pkgdatadir/mysql_system_tables_data.sql" -maria_add_gis_sp="$pkgdatadir/maria_add_gis_sp_bootstrap.sql" +fill_help_tables="$srcpkgdatadir/fill_help_tables.sql" +create_system_tables="$srcpkgdatadir/mysql_system_tables.sql" +create_system_tables2="$srcpkgdatadir/mysql_performance_tables.sql" +fill_system_tables="$srcpkgdatadir/mysql_system_tables_data.sql" +maria_add_gis_sp="$buildpkgdatadir/maria_add_gis_sp_bootstrap.sql" for f in "$fill_help_tables" "$create_system_tables" "$create_system_tables2" "$fill_system_tables" "$maria_add_gis_sp" do @@ -463,7 +466,6 @@ else exit 1 fi - # Don't output verbose information if running inside bootstrap or using # --srcdir for testing. In such cases, there's no end user looking at # the screen. @@ -506,10 +508,8 @@ then echo "The latest information about MariaDB is available at http://mariadb.org/." echo "You can find additional information about the MySQL part at:" echo "http://dev.mysql.com" - echo "Support MariaDB development by buying support/new features from MariaDB" - echo "Corporation Ab. You can contact us about this at sales@mariadb.com." - echo "Alternatively consider joining our community based development effort:" - echo "http://mariadb.com/kb/en/contributing-to-the-mariadb-project/" + echo "Consider joining MariaDB's strong and vibrant community:" + echo "https://mariadb.org/get-involved/" echo fi diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index e37f512b0f3..000271f7808 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -754,7 +754,7 @@ if [ ! -d $mysql_unix_port_dir ] then if ! `mkdir -p $mysql_unix_port_dir` then - echo "Fatal error Can't create database directory '$mysql_unix_port'" + log_error "Fatal error Can't create database directory '$mysql_unix_port'" exit 1 fi chown $user $mysql_unix_port_dir @@ -969,9 +969,14 @@ do done cmd="$cmd $args" [ $dry_run -eq 1 ] && return + # Avoid 'nohup: ignoring input' warning test -n "$NOHUP_NICENESS" && cmd="$cmd < /dev/null" +# close stdout and stderr, everything goes to $logging now +exec 1>&- +exec 2>&- + log_notice "Starting $MYSQLD daemon with databases from $DATADIR" # variable to track the current number of "fast" (a.k.a. subsecond) restarts diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index f173a861e85..466bb46b382 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -154,9 +154,8 @@ readonly WSREP_SST_OPT_AUTH # Splitting AUTH into potential user:password pair if ! wsrep_auth_not_set then - readonly AUTH_VEC=(${WSREP_SST_OPT_AUTH//:/ }) - WSREP_SST_OPT_USER="${AUTH_VEC[0]:-}" - WSREP_SST_OPT_PSWD="${AUTH_VEC[1]:-}" + WSREP_SST_OPT_USER="${WSREP_SST_OPT_AUTH%%:*}" + WSREP_SST_OPT_PSWD="${WSREP_SST_OPT_AUTH##*:}" fi readonly WSREP_SST_OPT_USER readonly WSREP_SST_OPT_PSWD diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 10d6896accd..9e3d9560807 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -1,4 +1,4 @@ -#!/bin/bash -ue +#!/bin/sh -ue # Copyright (C) 2010-2014 Codership Oy # @@ -23,7 +23,7 @@ RSYNC_CONF= # rsync configuration file RSYNC_REAL_PID= # rsync process id OS=$(uname) -[ "$OS" == "Darwin" ] && export -n LD_LIBRARY_PATH +[ "$OS" = "Darwin" ] && export -n LD_LIBRARY_PATH # Setting the path for lsof on CentOS export PATH="/usr/sbin:/sbin:$PATH" @@ -60,27 +60,65 @@ check_pid_and_port() { local pid_file=$1 local rsync_pid=$2 - local rsync_port=$3 + local rsync_addr=$3 + local rsync_port=$4 - if ! which lsof > /dev/null; then - wsrep_log_error "lsof tool not found in PATH! Make sure you have it installed." - exit 2 # ENOENT - fi + case $OS in + FreeBSD) + local port_info="$(sockstat -46lp ${rsync_port} 2>/dev/null | \ + grep ":${rsync_port}")" + local is_rsync="$(echo $port_info | \ + grep -w '[[:space:]]\+rsync[[:space:]]\+'"$rsync_pid" 2>/dev/null)" + ;; + *) + if ! which lsof > /dev/null; then + wsrep_log_error "lsof tool not found in PATH! Make sure you have it installed." + exit 2 # ENOENT + fi - local port_info=$(lsof -i :$rsync_port -Pn 2>/dev/null | \ - grep "(LISTEN)") - local is_rsync=$(echo $port_info | \ - grep -w '^rsync[[:space:]]\+'"$rsync_pid" 2>/dev/null) + local port_info="$(lsof -i :$rsync_port -Pn 2>/dev/null | \ + grep "(LISTEN)")" + local is_rsync="$(echo $port_info | \ + grep -w '^rsync[[:space:]]\+'"$rsync_pid" 2>/dev/null)" + ;; + esac - if [ -n "$port_info" -a -z "$is_rsync" ]; then - wsrep_log_error "rsync daemon port '$rsync_port' has been taken" - exit 16 # EBUSY + local is_listening_all="$(echo $port_info | \ + grep "*:$rsync_port" 2>/dev/null)" + local is_listening_addr="$(echo $port_info | \ + grep "$rsync_addr:$rsync_port" 2>/dev/null)" + + if [ ! -z "$is_listening_all" -o ! -z "$is_listening_addr" ]; then + if [ -z "$is_rsync" ]; then + wsrep_log_error "rsync daemon port '$rsync_port' has been taken" + exit 16 # EBUSY + fi fi check_pid $pid_file && \ [ -n "$port_info" ] && [ -n "$is_rsync" ] && \ [ $(cat $pid_file) -eq $rsync_pid ] } +is_local_ip() +{ + local address="$1" + local get_addr_bin=`which ifconfig` + if [ -z "$get_addr_bin" ] + then + get_addr_bin=`which ip` + get_addr_bin="$get_addr_bin address show" + # Add an slash at the end, so we don't get false positive : 172.18.0.4 matches 172.18.0.41 + # ip output format is "X.X.X.X/mask" + address="${address}/" + else + # Add an space at the end, so we don't get false positive : 172.18.0.4 matches 172.18.0.41 + # ifconfig output format is "X.X.X.X " + address="$address " + fi + + $get_addr_bin | grep "$address" > /dev/null +} + MAGIC_FILE="$WSREP_SST_OPT_DATA/rsync_sst_complete" rm -rf "$MAGIC_FILE" @@ -117,8 +155,8 @@ fi # --exclude '*.[0-9][0-9][0-9][0-9][0-9][0-9]' --exclude '*.index') # New filter - exclude everything except dirs (schemas) and innodb files -FILTER=(-f '- /lost+found' -f '- /.fseventsd' -f '- /.Trashes' - -f '+ /wsrep_sst_binlog.tar' -f '+ /ib_lru_dump' -f '+ /ibdata*' -f '+ /*/' -f '- /*') +FILTER="-f '- /lost+found' -f '- /.fseventsd' -f '- /.Trashes' + -f '+ /wsrep_sst_binlog.tar' -f '+ /ib_lru_dump' -f '+ /ibdata*' -f '+ /*/' -f '- /*'" if [ "$WSREP_SST_OPT_ROLE" = "donor" ] then @@ -165,7 +203,9 @@ then if ! [ -z $WSREP_SST_OPT_BINLOG ] then # Prepare binlog files - pushd $BINLOG_DIRNAME &> /dev/null + OLD_PWD="$(pwd)" + cd $BINLOG_DIRNAME + binlog_files_full=$(tail -n $BINLOG_N_FILES ${BINLOG_FILENAME}.index) binlog_files="" for ii in $binlog_files_full @@ -177,14 +217,14 @@ then wsrep_log_info "Preparing binlog files for transfer:" tar -cvf $BINLOG_TAR_FILE $binlog_files >&2 fi - popd &> /dev/null + cd "$OLD_PWD" fi # first, the normal directories, so that we can detect incompatible protocol RC=0 - rsync --owner --group --perms --links --specials \ + eval rsync --owner --group --perms --links --specials \ --ignore-times --inplace --dirs --delete --quiet \ - $WHOLE_FILE_OPT "${FILTER[@]}" "$WSREP_SST_OPT_DATA/" \ + $WHOLE_FILE_OPT ${FILTER} "$WSREP_SST_OPT_DATA/" \ rsync://$WSREP_SST_OPT_ADDR >&2 || RC=$? if [ "$RC" -ne 0 ]; then @@ -216,11 +256,12 @@ then fi # then, we parallelize the transfer of database directories, use . so that pathconcatenation works - pushd "$WSREP_SST_OPT_DATA" >/dev/null + OLD_PWD="$(pwd)" + cd $WSREP_SST_OPT_DATA count=1 - [ "$OS" == "Linux" ] && count=$(grep -c processor /proc/cpuinfo) - [ "$OS" == "Darwin" -o "$OS" == "FreeBSD" ] && count=$(sysctl -n hw.ncpu) + [ "$OS" = "Linux" ] && count=$(grep -c processor /proc/cpuinfo) + [ "$OS" = "Darwin" -o "$OS" = "FreeBSD" ] && count=$(sysctl -n hw.ncpu) find . -maxdepth 1 -mindepth 1 -type d -not -name "lost+found" -print0 | \ xargs -I{} -0 -P $count \ @@ -229,7 +270,7 @@ then $WHOLE_FILE_OPT --exclude '*/ib_logfile*' "$WSREP_SST_OPT_DATA"/{}/ \ rsync://$WSREP_SST_OPT_ADDR/{} >&2 || RC=$? - popd >/dev/null + cd "$OLD_PWD" if [ $RC -ne 0 ]; then wsrep_log_error "find/rsync returned code $RC:" @@ -271,6 +312,7 @@ then ADDR=$WSREP_SST_OPT_ADDR RSYNC_PORT=$(echo $ADDR | awk -F ':' '{ print $2 }') + RSYNC_ADDR=$(echo $ADDR | awk -F ':' '{ print $1 }') if [ -z "$RSYNC_PORT" ] then RSYNC_PORT=4444 @@ -303,11 +345,19 @@ EOF # rm -rf "$DATA"/ib_logfile* # we don't want old logs around - # listen at all interfaces (for firewalled setups) - rsync --daemon --no-detach --port $RSYNC_PORT --config "$RSYNC_CONF" & + # If the IP is local listen only in it + if is_local_ip $RSYNC_ADDR + then + rsync --daemon --no-detach --address $RSYNC_ADDR --port $RSYNC_PORT --config "$RSYNC_CONF" & + else + # Not local, possibly a NAT, listen in all interface + rsync --daemon --no-detach --port $RSYNC_PORT --config "$RSYNC_CONF" & + # Overwrite address with all + RSYNC_ADDR="*" + fi RSYNC_REAL_PID=$! - until check_pid_and_port $RSYNC_PID $RSYNC_REAL_PID $RSYNC_PORT + until check_pid_and_port $RSYNC_PID $RSYNC_REAL_PID $RSYNC_ADDR $RSYNC_PORT do sleep 0.2 done @@ -331,7 +381,9 @@ EOF if ! [ -z $WSREP_SST_OPT_BINLOG ] then - pushd $BINLOG_DIRNAME &> /dev/null + OLD_PWD="$(pwd)" + cd $BINLOG_DIRNAME + if [ -f $BINLOG_TAR_FILE ] then # Clean up old binlog files first @@ -343,7 +395,8 @@ EOF echo ${BINLOG_DIRNAME}/${ii} >> ${BINLOG_FILENAME}.index done fi - popd &> /dev/null + cd "$OLD_PWD" + fi if [ -r "$MAGIC_FILE" ] then diff --git a/scripts/wsrep_sst_xtrabackup-v2.sh b/scripts/wsrep_sst_xtrabackup-v2.sh index 63febe556da..565e62e4dbe 100644 --- a/scripts/wsrep_sst_xtrabackup-v2.sh +++ b/scripts/wsrep_sst_xtrabackup-v2.sh @@ -176,7 +176,7 @@ get_transfer() fi wsrep_log_info "Using netcat as streamer" if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then - if nc -h | grep -q ncat;then + if nc -h 2>&1 | grep -q ncat;then tcmd="nc -l ${TSST_PORT}" else tcmd="nc -dl ${TSST_PORT}" diff --git a/scripts/wsrep_sst_xtrabackup.sh b/scripts/wsrep_sst_xtrabackup.sh index 22923ab3e88..ca3c0129837 100644 --- a/scripts/wsrep_sst_xtrabackup.sh +++ b/scripts/wsrep_sst_xtrabackup.sh @@ -149,7 +149,7 @@ get_transfer() fi wsrep_log_info "Using netcat as streamer" if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then - if nc -h | grep -q ncat;then + if nc -h 2>&1 | grep -q ncat;then tcmd="nc -l ${TSST_PORT}" else tcmd="nc -dl ${TSST_PORT}" diff --git a/sql-common/client.c b/sql-common/client.c index 858e9ec4b5b..fc76fa976e0 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -569,16 +569,22 @@ err: Error message is set. @retval */ - ulong cli_safe_read(MYSQL *mysql) +{ + ulong reallen = 0; + return cli_safe_read_reallen(mysql, &reallen); +} + +ulong +cli_safe_read_reallen(MYSQL *mysql, ulong* reallen) { NET *net= &mysql->net; ulong len=0; restart: if (net->vio != 0) - len= my_net_read_packet(net, 0); + len= my_net_read_packet_reallen(net, 0, reallen); if (len == packet_error || len == 0) { diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 28072375bbc..d011b1a07d2 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -136,7 +136,7 @@ SET (SQL_SOURCE opt_table_elimination.cc sql_expression_cache.cc gcalc_slicescan.cc gcalc_tools.cc threadpool_common.cc ../sql-common/mysql_async.c - my_apc.cc my_apc.h mf_iocache_encr.cc + my_apc.cc my_apc.h mf_iocache_encr.cc item_jsonfunc.cc my_json_writer.cc my_json_writer.h rpl_gtid.cc rpl_parallel.cc sql_type.cc sql_type.h diff --git a/sql/contributors.h b/sql/contributors.h index f52d3243453..0359ec54022 100644 --- a/sql/contributors.h +++ b/sql/contributors.h @@ -46,6 +46,7 @@ struct show_table_contributors_st show_table_contributors[]= { {"Auttomattic", "https://automattic.com", "Bronze Sponsor of the MariaDB Foundation"}, {"Verkkokauppa.com", "https://virtuozzo.com", "Bronze Sponsor of the MariaDB Foundation"}, {"Virtuozzo", "https://virtuozzo.com/", "Bronze Sponsor of the MariaDB Foundation"}, + {"Tencent Game DBA", "http://tencentdba.com/about/", "Bronze Sponsor of the MariaDB Foundation"}, /* Sponsors of important features */ {"Google", "USA", "Sponsoring encryption, parallel replication and GTID"}, diff --git a/sql/encryption.cc b/sql/encryption.cc index 52aaef896dd..a92296e8b66 100644 --- a/sql/encryption.cc +++ b/sql/encryption.cc @@ -29,6 +29,10 @@ uint no_key(uint) { return ENCRYPTION_KEY_VERSION_INVALID; } +uint zero_size(uint,uint) +{ + return 0; +} static int ctx_init(void *ctx, const unsigned char* key, unsigned int klen, const unsigned char* iv, unsigned int ivlen, int flags, @@ -97,6 +101,7 @@ int finalize_encryption_plugin(st_plugin_int *plugin) encryption_handler.encryption_key_get_func= (uint (*)(uint, uint, uchar*, uint*))no_key; encryption_handler.encryption_key_get_latest_version_func= no_key; + encryption_handler.encryption_ctx_size_func= zero_size; if (plugin && plugin->plugin->deinit && plugin->plugin->deinit(NULL)) { diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc index 9de55c44dd0..c96060cd5df 100644 --- a/sql/event_db_repository.cc +++ b/sql/event_db_repository.cc @@ -166,20 +166,8 @@ const TABLE_FIELD_TYPE event_table_fields[ET_FIELD_COUNT] = static const TABLE_FIELD_DEF event_table_def= {ET_FIELD_COUNT, event_table_fields, 0, (uint*) 0}; -class Event_db_intact : public Table_check_intact -{ -protected: - void report_error(uint, const char *fmt, ...) - { - va_list args; - va_start(args, fmt); - error_log_print(ERROR_LEVEL, fmt, args); - va_end(args); - } -}; - /** In case of an error, a message is printed to the error log. */ -static Event_db_intact table_intact; +static Table_check_intact_log_error table_intact; /** diff --git a/sql/field.cc b/sql/field.cc index ef97ab857af..2629bdf0e25 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -80,7 +80,7 @@ const char field_separator=','; NOTE: to avoid 256*256 table, gap in table types numeration is skiped following #defines describe that gap and how to canculate number of fields - and index of field in thia array. + and index of field in this array. */ #define FIELDTYPE_TEAR_FROM (MYSQL_TYPE_BIT + 1) #define FIELDTYPE_TEAR_TO (MYSQL_TYPE_NEWDECIMAL - 1) @@ -355,7 +355,7 @@ static enum_field_types field_types_merge_rules [FIELDTYPE_NUM][FIELDTYPE_NUM]= //MYSQL_TYPE_NULL MYSQL_TYPE_TIMESTAMP MYSQL_TYPE_LONGLONG, MYSQL_TYPE_VARCHAR, //MYSQL_TYPE_LONGLONG MYSQL_TYPE_INT24 - MYSQL_TYPE_LONGLONG, MYSQL_TYPE_LONG, + MYSQL_TYPE_LONGLONG, MYSQL_TYPE_LONGLONG, //MYSQL_TYPE_DATE MYSQL_TYPE_TIME MYSQL_TYPE_VARCHAR, MYSQL_TYPE_VARCHAR, //MYSQL_TYPE_DATETIME MYSQL_TYPE_YEAR @@ -2310,7 +2310,7 @@ void Field::set_default() if (default_value) { table->in_use->reset_arena_for_cached_items(table->expr_arena); - (void) default_value->expr_item->save_in_field(this, 0); + (void) default_value->expr->save_in_field(this, 0); table->in_use->reset_arena_for_cached_items(0); return; } @@ -4956,8 +4956,8 @@ Field_timestamp::Field_timestamp(uchar *ptr_arg, uint32 len_arg, this field will be automaticly updated on insert. */ flags|= TIMESTAMP_FLAG; - flags|= ON_UPDATE_NOW_FLAG; - DBUG_ASSERT(unireg_check == TIMESTAMP_UN_FIELD); + if (unireg_check != TIMESTAMP_DN_FIELD) + flags|= ON_UPDATE_NOW_FLAG; } } @@ -7883,7 +7883,7 @@ void Field_blob::store_length(uchar *i_ptr, uint i_packlength, uint32 i_number) } -uint32 Field_blob::get_length(const uchar *pos, uint packlength_arg) +uint32 Field_blob::get_length(const uchar *pos, uint packlength_arg) const { return (uint32)read_lowendian(pos, packlength_arg); } @@ -7898,16 +7898,12 @@ int Field_blob::copy_value(Field_blob *from) DBUG_ASSERT(field_charset == from->charset()); int rc= 0; uint32 length= from->get_length(); - uchar *data; - from->get_ptr(&data); + uchar *data= from->get_ptr(); if (packlength < from->packlength) { - int well_formed_errors; set_if_smaller(length, Field_blob::max_data_length()); - length= field_charset->cset->well_formed_len(field_charset, - (const char *) data, - (const char *) data + length, - length, &well_formed_errors); + length= (uint32) Well_formed_prefix(field_charset, + (const char *) data, length).length(); rc= report_if_important_data((const char *) data + length, (const char *) data + from->get_length(), true); @@ -7943,9 +7939,8 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs) copy_length= table->in_use->variables.group_concat_max_len; if (new_length > copy_length) { - int well_formed_error; - new_length= cs->cset->well_formed_len(cs, from, from + copy_length, - new_length, &well_formed_error); + new_length= Well_formed_prefix(cs, + from, copy_length, new_length).length(); table->blob_storage->set_truncated_value(true); } if (!(tmp= table->blob_storage->store(from, new_length))) @@ -8150,7 +8145,7 @@ uint Field_blob::get_key_image(uchar *buff,uint length, imagetype type_arg) bzero(buff, image_length); return image_length; } - get_ptr(&blob); + blob= get_ptr(); gobj= Geometry::construct(&buffer, (char*) blob, blob_length); if (!gobj || gobj->get_mbr(&mbr, &dummy)) bzero(buff, image_length); @@ -8165,7 +8160,7 @@ uint Field_blob::get_key_image(uchar *buff,uint length, imagetype type_arg) } #endif /*HAVE_SPATIAL*/ - get_ptr(&blob); + blob= get_ptr(); uint local_char_length= length / field_charset->mbmaxlen; local_char_length= my_charpos(field_charset, blob, blob + blob_length, local_char_length); @@ -8324,7 +8319,7 @@ uchar *Field_blob::pack(uchar *to, const uchar *from, uint max_length) */ if (length > 0) { - get_ptr((uchar**) &from); + from= get_ptr(); memcpy(to+packlength, from,length); } ptr=save; // Restore org row pointer @@ -8570,14 +8565,12 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs) geom_type != Field::GEOM_GEOMETRYCOLLECTION && (uint32) geom_type != wkb_type) { - my_printf_error(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, - ER_THD(get_thd(), ER_TRUNCATED_WRONG_VALUE_FOR_FIELD), - MYF(0), - Geometry::ci_collection[geom_type]->m_name.str, - Geometry::ci_collection[wkb_type]->m_name.str, - field_name, - (ulong) table->in_use->get_stmt_da()-> - current_row_for_warning()); + my_error(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, MYF(0), + Geometry::ci_collection[geom_type]->m_name.str, + Geometry::ci_collection[wkb_type]->m_name.str, + field_name, + (ulong) table->in_use->get_stmt_da()-> + current_row_for_warning()); goto err_exit; } @@ -9779,42 +9772,39 @@ void Column_definition::create_length_to_internal_length(void) } -bool check_expression(Virtual_column_info *vcol, const char *type, - const char *name, bool must_be_determinstic) +bool check_expression(Virtual_column_info *vcol, const char *name, + enum_vcol_info_type type) + { bool ret; Item::vcol_func_processor_result res; - /* We use 2 bytes to store the expression length */ - if (vcol->expr_str.length > UINT_MAX32) - { - my_error(ER_EXPRESSION_IS_TOO_BIG, MYF(0), type, name); - return TRUE; - } + + if (!vcol->name.length) + vcol->name.str= const_cast(name); /* Walk through the Item tree checking if all items are valid to be part of the virtual column */ - res.errors= 0; - ret= vcol->expr_item->walk(&Item::check_vcol_func_processor, 0, &res); + ret= vcol->expr->walk(&Item::check_vcol_func_processor, 0, &res); vcol->flags= res.errors; uint filter= VCOL_IMPOSSIBLE; - if (must_be_determinstic) + if (type != VCOL_GENERATED_VIRTUAL && type != VCOL_DEFAULT) filter|= VCOL_NOT_STRICTLY_DETERMINISTIC; if (ret || (res.errors & filter)) { - my_error(ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED, MYF(0), res.name, - type, name); + my_error(ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED, MYF(0), res.name, + vcol_type_name(type), name); return TRUE; } /* Safe to call before fix_fields as long as vcol's don't include sub queries (which is now checked in check_vcol_func_processor) */ - if (vcol->expr_item->check_cols(1)) + if (vcol->expr->check_cols(1)) return TRUE; return FALSE; } @@ -9830,22 +9820,21 @@ bool Column_definition::check(THD *thd) /* Initialize data for a computed field */ if (vcol_info) { - DBUG_ASSERT(vcol_info->expr_item); + DBUG_ASSERT(vcol_info->expr); vcol_info->set_field_type(sql_type); - if (check_expression(vcol_info, "GENERATED ALWAYS AS", field_name, - vcol_info->stored_in_db)) + if (check_expression(vcol_info, field_name, vcol_info->stored_in_db + ? VCOL_GENERATED_STORED : VCOL_GENERATED_VIRTUAL)) DBUG_RETURN(TRUE); } if (check_constraint && - check_expression(check_constraint, "CHECK", field_name, 0)) - DBUG_RETURN(1); + check_expression(check_constraint, field_name, VCOL_CHECK_FIELD)) + DBUG_RETURN(1); if (default_value) { - Item *def_expr= default_value->expr_item; - - if (check_expression(default_value, "DEFAULT", field_name, 0)) + Item *def_expr= default_value->expr; + if (check_expression(default_value, field_name, VCOL_DEFAULT)) DBUG_RETURN(TRUE); /* Constant's are stored in the 'empty_record', except for blobs */ @@ -9869,15 +9858,15 @@ bool Column_definition::check(THD *thd) DBUG_RETURN(1); } - if (default_value && !default_value->expr_item->basic_const_item() && + if (default_value && !default_value->expr->basic_const_item() && mysql_type_to_time_type(sql_type) == MYSQL_TIMESTAMP_DATETIME && - default_value->expr_item->type() == Item::FUNC_ITEM) + default_value->expr->type() == Item::FUNC_ITEM) { /* Special case: NOW() for TIMESTAMP and DATETIME fields are handled as in MariaDB 10.1 by marking them in unireg_check. */ - Item_func *fn= static_cast(default_value->expr_item); + Item_func *fn= static_cast(default_value->expr); if (fn->functype() == Item_func::NOW_FUNC && (fn->decimals == 0 || fn->decimals >= length)) { @@ -10562,8 +10551,8 @@ Column_definition::Column_definition(THD *thd, Field *old_field, if (!(flags & (NO_DEFAULT_VALUE_FLAG | BLOB_FLAG)) && old_field->ptr != NULL && orig_field != NULL) { - if (orig_field->has_update_default_function()) - unireg_check= Field::TIMESTAMP_UN_FIELD; + if (orig_field->unireg_check != Field::NEXT_NUMBER) + unireg_check= orig_field->unireg_check; /* Get the value from default_values */ const uchar *dv= orig_field->table->s->default_values; @@ -10573,9 +10562,7 @@ Column_definition::Column_definition(THD *thd, Field *old_field, String *res= orig_field->val_str(&tmp, orig_field->ptr_in_record(dv)); char *pos= (char*) thd->strmake(res->ptr(), res->length()); default_value= new (thd->mem_root) Virtual_column_info(); - default_value->expr_str.str= pos; - default_value->expr_str.length= res->length(); - default_value->expr_item= + default_value->expr= new (thd->mem_root) Item_string(thd, pos, res->length(), charset); default_value->utf8= 0; } @@ -10639,7 +10626,7 @@ Create_field *Create_field::clone(MEM_ROOT *mem_root) const bool Column_definition::has_default_expression() { return (default_value && - (!default_value->expr_item->basic_const_item() || + (!default_value->expr->basic_const_item() || (flags & BLOB_FLAG))); } @@ -10824,3 +10811,55 @@ bool Field::validate_value_in_record_with_warn(THD *thd, const uchar *record) dbug_tmp_restore_column_map(table->read_set, old_map); return rc; } + + +bool Field::save_in_field_default_value(bool view_error_processing) +{ + THD *thd= table->in_use; + + if (flags & NO_DEFAULT_VALUE_FLAG && + real_type() != MYSQL_TYPE_ENUM) + { + if (reset()) + { + my_message(ER_CANT_CREATE_GEOMETRY_OBJECT, + ER_THD(thd, ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0)); + return -1; + } + + if (view_error_processing) + { + TABLE_LIST *view= table->pos_in_table_list->top_table(); + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_NO_DEFAULT_FOR_VIEW_FIELD, + ER_THD(thd, ER_NO_DEFAULT_FOR_VIEW_FIELD), + view->view_db.str, + view->view_name.str); + } + else + { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_NO_DEFAULT_FOR_FIELD, + ER_THD(thd, ER_NO_DEFAULT_FOR_FIELD), + field_name); + } + return 1; + } + set_default(); + return + !is_null() && + validate_value_in_record_with_warn(thd, table->record[0]) && + thd->is_error() ? -1 : 0; +} + + +bool Field::save_in_field_ignore_value(bool view_error_processing) +{ + enum_sql_command com= table->in_use->lex->sql_command; + // All insert-like commands + if (com == SQLCOM_INSERT || com == SQLCOM_REPLACE || + com == SQLCOM_INSERT_SELECT || com == SQLCOM_REPLACE_SELECT || + com == SQLCOM_LOAD) + return save_in_field_default_value(view_error_processing); + return 0; // ignore +} diff --git a/sql/field.h b/sql/field.h index f349f357244..eb7af2e015b 100644 --- a/sql/field.h +++ b/sql/field.h @@ -560,6 +560,28 @@ inline bool is_temporal_type_with_time(enum_field_types type) } } +enum enum_vcol_info_type +{ + VCOL_GENERATED_VIRTUAL, VCOL_GENERATED_STORED, + VCOL_DEFAULT, VCOL_CHECK_FIELD, VCOL_CHECK_TABLE +}; + +static inline const char *vcol_type_name(enum_vcol_info_type type) +{ + switch (type) + { + case VCOL_GENERATED_VIRTUAL: + case VCOL_GENERATED_STORED: + return "GENERATED ALWAYS AS"; + case VCOL_DEFAULT: + return "DEFAULT"; + case VCOL_CHECK_FIELD: + case VCOL_CHECK_TABLE: + return "CHECK"; + } + return 0; +} + /* Flags for Virtual_column_info. If none is set, the expression must be a constant with no side-effects, so it's calculated at CREATE TABLE time, @@ -599,23 +621,20 @@ public: /* Flag indicating that the field is physically stored in the database */ bool stored_in_db; bool utf8; /* Already in utf8 */ - /* The expression to compute the value of the virtual column */ - Item *expr_item; - /* Text representation of the defining expression */ - LEX_STRING expr_str; + Item *expr; LEX_STRING name; /* Name of constraint */ uint flags; Virtual_column_info() : field_type((enum enum_field_types)MYSQL_TYPE_VIRTUAL), in_partitioning_expr(FALSE), stored_in_db(FALSE), - utf8(TRUE), expr_item(NULL), flags(0) + utf8(TRUE), expr(NULL), flags(0) { - expr_str.str= name.str= NULL; + name.str= NULL; name.length= 0; }; ~Virtual_column_info() {} - enum_field_types get_real_type() + enum_field_types get_real_type() const { return field_type; } @@ -624,7 +643,7 @@ public: /* Calling this function can only be done once. */ field_type= fld_type; } - bool is_stored() + bool is_stored() const { return stored_in_db; } @@ -632,7 +651,7 @@ public: { stored_in_db= stored; } - bool is_in_partitioning_expr() + bool is_in_partitioning_expr() const { return in_partitioning_expr; } @@ -640,13 +659,8 @@ public: { in_partitioning_expr= TRUE; } - bool is_equal(Virtual_column_info* vcol) - { - return field_type == vcol->get_real_type() - && stored_in_db == vcol->is_stored() - && expr_str.length == vcol->expr_str.length - && memcmp(expr_str.str, vcol->expr_str.str, expr_str.length) == 0; - } + inline bool is_equal(const Virtual_column_info* vcol) const; + void print(String*); }; class Field: public Value_source @@ -709,10 +723,14 @@ public: in more clean way with transition to new text based .frm format. See also comment for Field_timestamp::Field_timestamp(). */ - enum utype { NONE,DATE,SHIELD,NOEMPTY,CASEUP,PNR,BGNR,PGNR,YES,NO,REL, - CHECK,EMPTY,UNKNOWN_FIELD,CASEDN,NEXT_NUMBER,INTERVAL_FIELD, - BIT_FIELD, TIMESTAMP_OLD_FIELD, CAPITALIZE, BLOB_FIELD, - TIMESTAMP_DN_FIELD, TIMESTAMP_UN_FIELD, TIMESTAMP_DNUN_FIELD}; + enum utype { + NONE=0, + NEXT_NUMBER=15, // AUTO_INCREMENT + TIMESTAMP_OLD_FIELD=18, // TIMESTAMP created before 4.1.3 + TIMESTAMP_DN_FIELD=21, // TIMESTAMP DEFAULT NOW() + TIMESTAMP_UN_FIELD=22, // TIMESTAMP ON UPDATE NOW() + TIMESTAMP_DNUN_FIELD=23 // TIMESTAMP DEFAULT NOW() ON UPDATE NOW() + }; enum geometry_type { GEOM_GEOMETRY = 0, GEOM_POINT = 1, GEOM_LINESTRING = 2, GEOM_POLYGON = 3, @@ -916,7 +934,12 @@ public: bool has_update_default_function() const { - return unireg_check == TIMESTAMP_UN_FIELD; + return flags & ON_UPDATE_NOW_FLAG; + } + bool has_default_now_unireg_check() const + { + return unireg_check == TIMESTAMP_DN_FIELD + || unireg_check == TIMESTAMP_DNUN_FIELD; } /* @@ -936,14 +959,6 @@ public: } virtual void set_explicit_default(Item *value); - /** - Evaluates the @c INSERT default function and stores the result in the - field. If no such function exists for the column, or the function is not - valid for the column's data type, invoking this function has no effect. - */ - virtual int evaluate_insert_default_function() { return 0; } - - /** Evaluates the @c UPDATE default function, if one exists, and stores the result in the record buffer. If no such function exists for the column, @@ -1171,6 +1186,11 @@ public: ptr=ptr_arg; null_ptr=null_ptr_arg; null_bit=null_bit_arg; } inline void move_field(uchar *ptr_arg) { ptr=ptr_arg; } + inline uchar *record_ptr() // record[0] or wherever the field was moved to + { + my_ptrdiff_t offset= table->s->field[field_index]->ptr - table->s->default_values; + return ptr - offset; + } virtual void move_field_offset(my_ptrdiff_t ptr_diff) { ptr=ADD_TO_PTR(ptr,ptr_diff, uchar*); @@ -1261,7 +1281,7 @@ public: virtual uint max_packed_col_length(uint max_length) { return max_length;} - uint offset(uchar *record) + uint offset(uchar *record) const { return (uint) (ptr - record); } @@ -1393,7 +1413,7 @@ public: - If field is char/varchar/.. and is not part of write set. TRUE - If field is char/varchar/.. and is part of write set. */ - virtual bool is_updatable() const { return FALSE; } + virtual bool is_varchar_and_in_write_set() const { return FALSE; } /* Check whether the field can be used as a join attribute in hash join */ virtual bool hash_join_is_possible() { return TRUE; } @@ -1451,6 +1471,10 @@ public: // Exactly the same rules with REF access return can_optimize_keypart_ref(cond, item); } + + bool save_in_field_default_value(bool view_eror_processing); + bool save_in_field_ignore_value(bool view_error_processing); + friend int cre_myisam(char * name, register TABLE *form, uint options, ulonglong auto_increment_value); friend class Copy_field; @@ -1698,7 +1722,7 @@ public: int store_decimal(const my_decimal *d); uint32 max_data_length() const; - bool is_updatable() const + bool is_varchar_and_in_write_set() const { DBUG_ASSERT(table && table->write_set); return bitmap_is_set(table->write_set, field_index); @@ -2772,7 +2796,11 @@ public: const char *field_name_arg) :Field_temporal_with_date(ptr_arg, length_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg) - {} + { + if (unireg_check == TIMESTAMP_UN_FIELD || + unireg_check == TIMESTAMP_DNUN_FIELD) + flags|= ON_UPDATE_NOW_FLAG; + } enum_field_types type() const { return MYSQL_TYPE_DATETIME;} enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONGLONG; } double val_real(void); @@ -3200,7 +3228,8 @@ public: int store_field(Field *from) { // Be sure the value is stored from->val_str(&value); - if (table->copy_blobs || (!value.is_alloced() && from->is_updatable())) + if (table->copy_blobs || + (!value.is_alloced() && from->is_varchar_and_in_write_set())) value.copy(); return store(value.ptr(), value.length(), from->charset()); } @@ -3257,30 +3286,29 @@ public: { store_length(ptr, packlength, number); } - inline uint32 get_length(uint row_offset= 0) + inline uint32 get_length(uint row_offset= 0) const { return get_length(ptr+row_offset, this->packlength); } - uint32 get_length(const uchar *ptr, uint packlength); - uint32 get_length(const uchar *ptr_arg) + uint32 get_length(const uchar *ptr, uint packlength) const; + uint32 get_length(const uchar *ptr_arg) const { return get_length(ptr_arg, this->packlength); } - inline void get_ptr(uchar **str) - { - memcpy(str, ptr+packlength, sizeof(uchar*)); - } - inline void get_ptr(uchar **str, uint row_offset) - { - memcpy(str, ptr+packlength+row_offset, sizeof(char*)); - } + inline uchar *get_ptr() const { return get_ptr(0); } + inline uchar *get_ptr(my_ptrdiff_t row_offset) const + { + uchar *s; + memcpy(&s, ptr + packlength + row_offset, sizeof(uchar*)); + return s; + } inline void set_ptr(uchar *length, uchar *data) - { - memcpy(ptr,length,packlength); - memcpy(ptr+packlength, &data,sizeof(char*)); - } + { + memcpy(ptr,length,packlength); + memcpy(ptr+packlength, &data,sizeof(char*)); + } void set_ptr_offset(my_ptrdiff_t ptr_diff, uint32 length, const uchar *data) - { - uchar *ptr_ofs= ADD_TO_PTR(ptr,ptr_diff,uchar*); - store_length(ptr_ofs, packlength, length); - memcpy(ptr_ofs+packlength, &data, sizeof(char*)); - } + { + uchar *ptr_ofs= ADD_TO_PTR(ptr,ptr_diff,uchar*); + store_length(ptr_ofs, packlength, length); + memcpy(ptr_ofs+packlength, &data, sizeof(char*)); + } inline void set_ptr(uint32 length, uchar *data) { set_ptr_offset(0, length, data); @@ -3294,8 +3322,7 @@ public: void sql_type(String &str) const; inline bool copy() { - uchar *tmp; - get_ptr(&tmp); + uchar *tmp= get_ptr(); if (value.copy((char*) tmp, get_length(), charset())) { Field_blob::reset(); @@ -3311,7 +3338,10 @@ public: uint packed_col_length(const uchar *col_ptr, uint length); uint max_packed_col_length(uint max_length); void free() { value.free(); } - inline void clear_temporary() { bzero((uchar*) &value,sizeof(value)); } + inline void clear_temporary() { bzero((uchar*) &value, sizeof(value)); } + inline bool owns_ptr(uchar* p) const { return p == (uchar*)value.ptr(); } + inline void own_value_ptr() + { value.reset((char*)get_ptr(), get_length(), get_length(), value.charset()); } uint size_of() const { return sizeof(*this); } bool has_charset(void) const { return charset() == &my_charset_bin ? FALSE : TRUE; } @@ -3764,8 +3794,7 @@ public: bool has_default_function() const { - return (unireg_check == Field::TIMESTAMP_UN_FIELD || - unireg_check == Field::NEXT_NUMBER); + return unireg_check != Field::NONE; } Field *make_field(TABLE_SHARE *share, MEM_ROOT *mem_root, @@ -3786,6 +3815,12 @@ public: } /* Return true if default is an expression that must be saved explicitely */ bool has_default_expression(); + + bool has_default_now_unireg_check() const + { + return unireg_check == Field::TIMESTAMP_DN_FIELD + || unireg_check == Field::TIMESTAMP_DNUN_FIELD; + } }; @@ -3882,8 +3917,8 @@ uint32 calc_pack_length(enum_field_types type,uint32 length); int set_field_to_null(Field *field); int set_field_to_null_with_conversions(Field *field, bool no_conversions); int convert_null_to_field_value_or_error(Field *field); -bool check_expression(Virtual_column_info *vcol, const char *type, - const char *name, bool must_be_deterministic); +bool check_expression(Virtual_column_info *vcol, const char *name, + enum_vcol_info_type type); /* The following are for the interface with the .frm file @@ -3900,19 +3935,13 @@ bool check_expression(Virtual_column_info *vcol, const char *type, #define FIELDFLAG_GEOM 2048 // mangled with decimals! #define FIELDFLAG_TREAT_BIT_AS_CHAR 4096 /* use Field_bit_as_char */ - -#define FIELDFLAG_LEFT_FULLSCREEN 8192 -#define FIELDFLAG_RIGHT_FULLSCREEN 16384 -#define FIELDFLAG_FORMAT_NUMBER 16384 // predit: ###,,## in output +#define FIELDFLAG_LONG_DECIMAL 8192 #define FIELDFLAG_NO_DEFAULT 16384 /* sql */ -#define FIELDFLAG_SUM ((uint) 32768)// predit: +#fieldflag #define FIELDFLAG_MAYBE_NULL ((uint) 32768)// sql #define FIELDFLAG_HEX_ESCAPE ((uint) 0x10000) #define FIELDFLAG_PACK_SHIFT 3 #define FIELDFLAG_DEC_SHIFT 8 -#define FIELDFLAG_MAX_DEC 63 -#define FIELDFLAG_NUM_SCREEN_TYPE 0x7F01 -#define FIELDFLAG_ALFA_SCREEN_TYPE 0x7800 +#define FIELDFLAG_MAX_DEC 63 #define MTYP_TYPENR(type) (type & 127) /* Remove bits from type */ @@ -3928,10 +3957,9 @@ bool check_expression(Virtual_column_info *vcol, const char *type, #define f_is_bitfield(x) (((x) & (FIELDFLAG_BITFIELD | FIELDFLAG_NUMBER)) == FIELDFLAG_BITFIELD) #define f_is_blob(x) (((x) & (FIELDFLAG_BLOB | FIELDFLAG_NUMBER)) == FIELDFLAG_BLOB) #define f_is_geom(x) (((x) & (FIELDFLAG_GEOM | FIELDFLAG_NUMBER)) == FIELDFLAG_GEOM) -#define f_is_equ(x) ((x) & (1+2+FIELDFLAG_PACK+31*256)) -#define f_settype(x) (((int) x) << FIELDFLAG_PACK_SHIFT) -#define f_maybe_null(x) (x & FIELDFLAG_MAYBE_NULL) -#define f_no_default(x) (x & FIELDFLAG_NO_DEFAULT) +#define f_settype(x) (((int) (x)) << FIELDFLAG_PACK_SHIFT) +#define f_maybe_null(x) ((x) & FIELDFLAG_MAYBE_NULL) +#define f_no_default(x) ((x) & FIELDFLAG_NO_DEFAULT) #define f_bit_as_char(x) ((x) & FIELDFLAG_TREAT_BIT_AS_CHAR) #define f_is_hex_escape(x) ((x) & FIELDFLAG_HEX_ESCAPE) diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 263c5bb5017..85101fd5f0a 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -467,20 +467,19 @@ static void do_cut_string(Copy_field *copy) static void do_cut_string_complex(Copy_field *copy) { // Shorter string field - int well_formed_error; CHARSET_INFO *cs= copy->from_field->charset(); const uchar *from_end= copy->from_ptr + copy->from_length; - uint copy_length= cs->cset->well_formed_len(cs, - (char*) copy->from_ptr, - (char*) from_end, - copy->to_length / cs->mbmaxlen, - &well_formed_error); + Well_formed_prefix prefix(cs, + (char*) copy->from_ptr, + (char*) from_end, + copy->to_length / cs->mbmaxlen); + uint copy_length= prefix.length(); if (copy->to_length < copy_length) copy_length= copy->to_length; memcpy(copy->to_ptr, copy->from_ptr, copy_length); /* Check if we lost any important characters */ - if (well_formed_error || + if (prefix.well_formed_error_pos() || cs->cset->scan(cs, (char*) copy->from_ptr + copy_length, (char*) from_end, MY_SEQ_SPACES) < (copy->from_length - copy_length)) @@ -534,22 +533,19 @@ static void do_varstring1(Copy_field *copy) static void do_varstring1_mb(Copy_field *copy) { - int well_formed_error; CHARSET_INFO *cs= copy->from_field->charset(); uint from_length= (uint) *(uchar*) copy->from_ptr; const uchar *from_ptr= copy->from_ptr + 1; uint to_char_length= (copy->to_length - 1) / cs->mbmaxlen; - uint length= cs->cset->well_formed_len(cs, (char*) from_ptr, - (char*) from_ptr + from_length, - to_char_length, &well_formed_error); - if (length < from_length) + Well_formed_prefix prefix(cs, (char*) from_ptr, from_length, to_char_length); + if (prefix.length() < from_length) { if (current_thd->count_cuted_fields) copy->to_field->set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1); } - *copy->to_ptr= (uchar) length; - memcpy(copy->to_ptr + 1, from_ptr, length); + *copy->to_ptr= (uchar) prefix.length(); + memcpy(copy->to_ptr + 1, from_ptr, prefix.length()); } @@ -572,22 +568,19 @@ static void do_varstring2(Copy_field *copy) static void do_varstring2_mb(Copy_field *copy) { - int well_formed_error; CHARSET_INFO *cs= copy->from_field->charset(); uint char_length= (copy->to_length - HA_KEY_BLOB_LENGTH) / cs->mbmaxlen; uint from_length= uint2korr(copy->from_ptr); const uchar *from_beg= copy->from_ptr + HA_KEY_BLOB_LENGTH; - uint length= cs->cset->well_formed_len(cs, (char*) from_beg, - (char*) from_beg + from_length, - char_length, &well_formed_error); - if (length < from_length) + Well_formed_prefix prefix(cs, (char*) from_beg, from_length, char_length); + if (prefix.length() < from_length) { if (current_thd->count_cuted_fields) copy->to_field->set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1); } - int2store(copy->to_ptr, length); - memcpy(copy->to_ptr+HA_KEY_BLOB_LENGTH, from_beg, length); + int2store(copy->to_ptr, prefix.length()); + memcpy(copy->to_ptr+HA_KEY_BLOB_LENGTH, from_beg, prefix.length()); } diff --git a/sql/filesort.cc b/sql/filesort.cc index ae51fb94e64..2210dc569df 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -31,7 +31,7 @@ #include #include "sql_sort.h" #include "probes_mysql.h" -#include "sql_base.h" // update_virtual_fields +#include "sql_base.h" #include "sql_test.h" // TEST_filesort #include "opt_range.h" // SQL_SELECT #include "bounded_queue.h" @@ -784,8 +784,6 @@ static ha_rows find_all_keys(THD *thd, Sort_param *param, SQL_SELECT *select, { if ((error= select->quick->get_next())) break; - if (!error && sort_form->vfield) - update_virtual_fields(thd, sort_form); file->position(sort_form->record[0]); DBUG_EXECUTE_IF("debug_filesort", dbug_print_record(sort_form, TRUE);); } @@ -793,8 +791,6 @@ static ha_rows find_all_keys(THD *thd, Sort_param *param, SQL_SELECT *select, { { error= file->ha_rnd_next(sort_form->record[0]); - if (!error && sort_form->vfield) - update_virtual_fields(thd, sort_form); if (!flag) { my_store_ptr(ref_pos,ref_length,record); // Position to row @@ -1276,7 +1272,7 @@ static void register_used_fields(Sort_param *param) { if (field->vcol_info) { - Item *vcol_item= field->vcol_info->expr_item; + Item *vcol_item= field->vcol_info->expr; vcol_item->walk(&Item::register_field_in_read_map, 1, 0); } bitmap_set_bit(bitmap, field->field_index); diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 92ac18d8f13..aa15e8bb538 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -3450,7 +3450,7 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked) } m_start_key.length= 0; m_rec0= table->record[0]; - m_rec_length= table_share->stored_rec_length; + m_rec_length= table_share->reclength; if (!m_part_ids_sorted_by_num_of_records) { if (!(m_part_ids_sorted_by_num_of_records= @@ -7975,7 +7975,7 @@ void ha_partition::append_row_to_str(String &str) { Field **field_ptr; if (!is_rec0) - set_field_ptr(m_part_info->full_part_field_array, rec, + table->move_fields(m_part_info->full_part_field_array, rec, table->record[0]); /* No primary key, use full partition field array. */ for (field_ptr= m_part_info->full_part_field_array; @@ -7989,7 +7989,7 @@ void ha_partition::append_row_to_str(String &str) field_unpack(&str, field, rec, 0, false); } if (!is_rec0) - set_field_ptr(m_part_info->full_part_field_array, table->record[0], + table->move_fields(m_part_info->full_part_field_array, table->record[0], rec); } } @@ -8456,18 +8456,6 @@ uint ha_partition::max_supported_keys() const } -uint ha_partition::extra_rec_buf_length() const -{ - handler **file; - uint max= (*m_file)->extra_rec_buf_length(); - - for (file= m_file, file++; *file; file++) - if (max < (*file)->extra_rec_buf_length()) - max= (*file)->extra_rec_buf_length(); - return max; -} - - uint ha_partition::min_record_length(uint options) const { handler **file; diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 74f5a06e4bc..7324efcb6c9 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -1011,12 +1011,6 @@ public: virtual uint max_supported_key_parts() const; virtual uint max_supported_key_length() const; virtual uint max_supported_key_part_length() const; - - /* - The extra record buffer length is the maximum needed by all handlers. - The minimum record length is the maximum of all involved handlers. - */ - virtual uint extra_rec_buf_length() const; virtual uint min_record_length(uint options) const; /* diff --git a/sql/handler.cc b/sql/handler.cc index b3041fc3d47..d20da5c0129 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2579,6 +2579,8 @@ int handler::ha_rnd_next(uchar *buf) if (!result) { update_rows_read(); + if (table->vfield && buf == table->record[0]) + table->update_virtual_fields(VCOL_UPDATE_FOR_READ); increment_statistics(&SSV::ha_read_rnd_next_count); } else if (result == HA_ERR_RECORD_DELETED) @@ -2603,7 +2605,11 @@ int handler::ha_rnd_pos(uchar *buf, uchar *pos) { result= rnd_pos(buf, pos); }) increment_statistics(&SSV::ha_read_rnd_count); if (!result) + { update_rows_read(); + if (table->vfield && buf == table->record[0]) + table->update_virtual_fields(VCOL_UPDATE_FOR_READ); + } table->status=result ? STATUS_NOT_FOUND: 0; DBUG_RETURN(result); } @@ -2622,7 +2628,11 @@ int handler::ha_index_read_map(uchar *buf, const uchar *key, { result= index_read_map(buf, key, keypart_map, find_flag); }) increment_statistics(&SSV::ha_read_key_count); if (!result) + { update_index_statistics(); + if (table->vfield && buf == table->record[0]) + table->update_virtual_fields(VCOL_UPDATE_FOR_READ); + } table->status=result ? STATUS_NOT_FOUND: 0; DBUG_RETURN(result); } @@ -2649,6 +2659,8 @@ int handler::ha_index_read_idx_map(uchar *buf, uint index, const uchar *key, { update_rows_read(); index_rows_read[index]++; + if (table->vfield && buf == table->record[0]) + table->update_virtual_fields(VCOL_UPDATE_FOR_READ); } table->status=result ? STATUS_NOT_FOUND: 0; return result; @@ -2666,7 +2678,11 @@ int handler::ha_index_next(uchar * buf) { result= index_next(buf); }) increment_statistics(&SSV::ha_read_next_count); if (!result) + { update_index_statistics(); + if (table->vfield && buf == table->record[0]) + table->update_virtual_fields(VCOL_UPDATE_FOR_READ); + } table->status=result ? STATUS_NOT_FOUND: 0; DBUG_RETURN(result); } @@ -2683,7 +2699,11 @@ int handler::ha_index_prev(uchar * buf) { result= index_prev(buf); }) increment_statistics(&SSV::ha_read_prev_count); if (!result) + { update_index_statistics(); + if (table->vfield && buf == table->record[0]) + table->update_virtual_fields(VCOL_UPDATE_FOR_READ); + } table->status=result ? STATUS_NOT_FOUND: 0; DBUG_RETURN(result); } @@ -2699,7 +2719,11 @@ int handler::ha_index_first(uchar * buf) { result= index_first(buf); }) increment_statistics(&SSV::ha_read_first_count); if (!result) + { update_index_statistics(); + if (table->vfield && buf == table->record[0]) + table->update_virtual_fields(VCOL_UPDATE_FOR_READ); + } table->status=result ? STATUS_NOT_FOUND: 0; return result; } @@ -2723,7 +2747,11 @@ int handler::ha_index_last(uchar * buf) { result= index_last(buf); }) increment_statistics(&SSV::ha_read_last_count); if (!result) + { update_index_statistics(); + if (table->vfield && buf == table->record[0]) + table->update_virtual_fields(VCOL_UPDATE_FOR_READ); + } table->status=result ? STATUS_NOT_FOUND: 0; return result; } @@ -2739,7 +2767,11 @@ int handler::ha_index_next_same(uchar *buf, const uchar *key, uint keylen) { result= index_next_same(buf, key, keylen); }) increment_statistics(&SSV::ha_read_next_count); if (!result) + { update_index_statistics(); + if (table->vfield && buf == table->record[0]) + table->update_virtual_fields(VCOL_UPDATE_FOR_READ); + } table->status=result ? STATUS_NOT_FOUND: 0; return result; } @@ -4218,6 +4250,7 @@ handler::check_if_supported_inplace_alter(TABLE *altered_table, Alter_inplace_info::ALTER_COLUMN_OPTION | Alter_inplace_info::CHANGE_CREATE_OPTION | Alter_inplace_info::ALTER_PARTITIONED | + Alter_inplace_info::ALTER_VIRTUAL_GCOL_EXPR | Alter_inplace_info::ALTER_RENAME; /* Is there at least one operation that requires copy algorithm? */ @@ -5901,6 +5934,10 @@ static int check_wsrep_max_ws_rows() if (wsrep_max_ws_rows) { THD *thd= current_thd; + + if (!WSREP(thd)) + return 0; + thd->wsrep_affected_rows++; if (thd->wsrep_exec_mode != REPL_RECV && thd->wsrep_affected_rows > wsrep_max_ws_rows) @@ -6111,6 +6148,13 @@ void handler::set_lock_type(enum thr_lock_type lock) @note Aborting the transaction does NOT end it, it still has to be rolled back with hton->rollback(). + @note It is safe to abort from one thread (bf_thd) the transaction, + running in another thread (victim_thd), because InnoDB's lock_sys and + trx_mutex guarantee the necessary protection. However, its not safe + to access victim_thd->transaction, because it's not protected from + concurrent accesses. And it's an overkill to take LOCK_plugin and + iterate the whole installed_htons[] array every time. + @param bf_thd brute force THD asking for the abort @param victim_thd victim THD to be aborted @@ -6127,29 +6171,16 @@ int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal) DBUG_RETURN(0); } - /* Try statement transaction if standard one is not set. */ - THD_TRANS *trans= (victim_thd->transaction.all.ha_list) ? - &victim_thd->transaction.all : &victim_thd->transaction.stmt; - - Ha_trx_info *ha_info= trans->ha_list, *ha_info_next; - - for (; ha_info; ha_info= ha_info_next) + handlerton *hton= installed_htons[DB_TYPE_INNODB]; + if (hton && hton->abort_transaction) { - handlerton *hton= ha_info->ht(); - if (!hton->abort_transaction) - { - /* Skip warning for binlog & wsrep. */ - if (hton->db_type != DB_TYPE_BINLOG && hton != wsrep_hton) - { - WSREP_WARN("Cannot abort transaction."); - } - } - else - { - hton->abort_transaction(hton, bf_thd, victim_thd, signal); - } - ha_info_next= ha_info->next(); + hton->abort_transaction(hton, bf_thd, victim_thd, signal); } + else + { + WSREP_WARN("Cannot abort InnoDB transaction"); + } + DBUG_RETURN(0); } diff --git a/sql/handler.h b/sql/handler.h index 569b53bc6cd..98adbf51d9a 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -195,7 +195,7 @@ enum enum_alter_inplace_result { #define HA_HAS_NEW_CHECKSUM (1ULL << 38) #define HA_CAN_VIRTUAL_COLUMNS (1ULL << 39) #define HA_MRR_CANT_SORT (1ULL << 40) -#define HA_RECORD_MUST_BE_CLEAN_ON_WRITE (1ULL << 41) +#define HA_RECORD_MUST_BE_CLEAN_ON_WRITE (1ULL << 41) /* unused */ /* This storage engine supports condition pushdown @@ -370,16 +370,9 @@ enum enum_alter_inplace_result { */ #define HA_OPEN_KEYFILE 1 -#define HA_OPEN_RNDFILE 2 -#define HA_GET_INDEX 4 -#define HA_GET_INFO 8 /* do a ha_info() after open */ #define HA_READ_ONLY 16 /* File opened as readonly */ /* Try readonly if can't open with read and write */ #define HA_TRY_READ_ONLY 32 -#define HA_WAIT_IF_LOCKED 64 /* Wait if locked on open */ -#define HA_ABORT_IF_LOCKED 128 /* skip if locked on open.*/ -#define HA_BLOCK_LOCK 256 /* unlock when reading some records */ -#define HA_OPEN_TEMPORARY 512 /* Some key definitions */ #define HA_KEY_NULL_LENGTH 1 @@ -1846,34 +1839,50 @@ public: typedef ulonglong HA_ALTER_FLAGS; // Add non-unique, non-primary index - static const HA_ALTER_FLAGS ADD_INDEX = 1L << 0; + static const HA_ALTER_FLAGS ADD_INDEX = 1ULL << 0; + // + // Adds a spatial index. At the moment all engines treat it + // identically to the ADD_INDEX, so it gets the same code + static const HA_ALTER_FLAGS ADD_SPATIAL_INDEX = ADD_INDEX; // Drop non-unique, non-primary index - static const HA_ALTER_FLAGS DROP_INDEX = 1L << 1; + static const HA_ALTER_FLAGS DROP_INDEX = 1ULL << 1; // Add unique, non-primary index - static const HA_ALTER_FLAGS ADD_UNIQUE_INDEX = 1L << 2; + static const HA_ALTER_FLAGS ADD_UNIQUE_INDEX = 1ULL << 2; // Drop unique, non-primary index - static const HA_ALTER_FLAGS DROP_UNIQUE_INDEX = 1L << 3; + static const HA_ALTER_FLAGS DROP_UNIQUE_INDEX = 1ULL << 3; // Add primary index - static const HA_ALTER_FLAGS ADD_PK_INDEX = 1L << 4; + static const HA_ALTER_FLAGS ADD_PK_INDEX = 1ULL << 4; // Drop primary index - static const HA_ALTER_FLAGS DROP_PK_INDEX = 1L << 5; + static const HA_ALTER_FLAGS DROP_PK_INDEX = 1ULL << 5; - // Add column - static const HA_ALTER_FLAGS ADD_COLUMN = 1L << 6; + // Virtual generated column + static const HA_ALTER_FLAGS ADD_VIRTUAL_COLUMN = 1ULL << 6; + // Stored base (non-generated) column + static const HA_ALTER_FLAGS ADD_STORED_BASE_COLUMN = 1ULL << 7; + // Stored generated column + static const HA_ALTER_FLAGS ADD_STORED_GENERATED_COLUMN= 1ULL << 8; + // Add generic column (convience constant). + static const HA_ALTER_FLAGS ADD_COLUMN= ADD_VIRTUAL_COLUMN | + ADD_STORED_BASE_COLUMN | + ADD_STORED_GENERATED_COLUMN; // Drop column - static const HA_ALTER_FLAGS DROP_COLUMN = 1L << 7; + static const HA_ALTER_FLAGS DROP_VIRTUAL_COLUMN = 1ULL << 9; + static const HA_ALTER_FLAGS DROP_STORED_COLUMN = 1ULL << 10; + static const HA_ALTER_FLAGS DROP_COLUMN= DROP_VIRTUAL_COLUMN | + DROP_STORED_COLUMN; // Rename column - static const HA_ALTER_FLAGS ALTER_COLUMN_NAME = 1L << 8; + static const HA_ALTER_FLAGS ALTER_COLUMN_NAME = 1ULL << 11; // Change column datatype - static const HA_ALTER_FLAGS ALTER_COLUMN_TYPE = 1L << 9; + static const HA_ALTER_FLAGS ALTER_VIRTUAL_COLUMN_TYPE = 1ULL << 12; + static const HA_ALTER_FLAGS ALTER_STORED_COLUMN_TYPE = 1ULL << 13; /** Change column datatype in such way that new type has compatible @@ -1881,83 +1890,94 @@ public: possible to perform change by only updating data dictionary without changing table rows. */ - static const HA_ALTER_FLAGS ALTER_COLUMN_EQUAL_PACK_LENGTH = 1L << 10; + static const HA_ALTER_FLAGS ALTER_COLUMN_EQUAL_PACK_LENGTH = 1ULL << 14; // Reorder column - static const HA_ALTER_FLAGS ALTER_COLUMN_ORDER = 1L << 11; + static const HA_ALTER_FLAGS ALTER_STORED_COLUMN_ORDER = 1ULL << 15; + + // Reorder column + static const HA_ALTER_FLAGS ALTER_VIRTUAL_COLUMN_ORDER = 1ULL << 16; // Change column from NOT NULL to NULL - static const HA_ALTER_FLAGS ALTER_COLUMN_NULLABLE = 1L << 12; + static const HA_ALTER_FLAGS ALTER_COLUMN_NULLABLE = 1ULL << 17; // Change column from NULL to NOT NULL - static const HA_ALTER_FLAGS ALTER_COLUMN_NOT_NULLABLE = 1L << 13; + static const HA_ALTER_FLAGS ALTER_COLUMN_NOT_NULLABLE = 1ULL << 18; // Set or remove default column value - static const HA_ALTER_FLAGS ALTER_COLUMN_DEFAULT = 1L << 14; + static const HA_ALTER_FLAGS ALTER_COLUMN_DEFAULT = 1ULL << 19; + // Change column generation expression + static const HA_ALTER_FLAGS ALTER_VIRTUAL_GCOL_EXPR = 1ULL << 20; + static const HA_ALTER_FLAGS ALTER_STORED_GCOL_EXPR = 1ULL << 21; + // // Add foreign key - static const HA_ALTER_FLAGS ADD_FOREIGN_KEY = 1L << 15; + static const HA_ALTER_FLAGS ADD_FOREIGN_KEY = 1ULL << 22; // Drop foreign key - static const HA_ALTER_FLAGS DROP_FOREIGN_KEY = 1L << 16; + static const HA_ALTER_FLAGS DROP_FOREIGN_KEY = 1ULL << 23; // table_options changed, see HA_CREATE_INFO::used_fields for details. - static const HA_ALTER_FLAGS CHANGE_CREATE_OPTION = 1L << 17; + static const HA_ALTER_FLAGS CHANGE_CREATE_OPTION = 1ULL << 24; // Table is renamed - static const HA_ALTER_FLAGS ALTER_RENAME = 1L << 18; + static const HA_ALTER_FLAGS ALTER_RENAME = 1ULL << 25; // column's engine options changed, something in field->option_struct - static const HA_ALTER_FLAGS ALTER_COLUMN_OPTION = 1L << 19; + static const HA_ALTER_FLAGS ALTER_COLUMN_OPTION = 1ULL << 26; // MySQL alias for the same thing: - static const HA_ALTER_FLAGS ALTER_COLUMN_STORAGE_TYPE = 1L << 19; + static const HA_ALTER_FLAGS ALTER_COLUMN_STORAGE_TYPE = 1ULL << 26; // Change the column format of column - static const HA_ALTER_FLAGS ALTER_COLUMN_COLUMN_FORMAT = 1L << 20; + static const HA_ALTER_FLAGS ALTER_COLUMN_COLUMN_FORMAT = 1ULL << 27; // Add partition - static const HA_ALTER_FLAGS ADD_PARTITION = 1L << 21; + static const HA_ALTER_FLAGS ADD_PARTITION = 1ULL << 28; // Drop partition - static const HA_ALTER_FLAGS DROP_PARTITION = 1L << 22; + static const HA_ALTER_FLAGS DROP_PARTITION = 1ULL << 29; // Changing partition options - static const HA_ALTER_FLAGS ALTER_PARTITION = 1L << 23; + static const HA_ALTER_FLAGS ALTER_PARTITION = 1ULL << 30; // Coalesce partition - static const HA_ALTER_FLAGS COALESCE_PARTITION = 1L << 24; + static const HA_ALTER_FLAGS COALESCE_PARTITION = 1ULL << 31; // Reorganize partition ... into - static const HA_ALTER_FLAGS REORGANIZE_PARTITION = 1L << 25; + static const HA_ALTER_FLAGS REORGANIZE_PARTITION = 1ULL << 32; // Reorganize partition - static const HA_ALTER_FLAGS ALTER_TABLE_REORG = 1L << 26; + static const HA_ALTER_FLAGS ALTER_TABLE_REORG = 1ULL << 33; // Remove partitioning - static const HA_ALTER_FLAGS ALTER_REMOVE_PARTITIONING = 1L << 27; + static const HA_ALTER_FLAGS ALTER_REMOVE_PARTITIONING = 1ULL << 34; // Partition operation with ALL keyword - static const HA_ALTER_FLAGS ALTER_ALL_PARTITION = 1L << 28; + static const HA_ALTER_FLAGS ALTER_ALL_PARTITION = 1ULL << 35; /** Recreate the table for ALTER TABLE FORCE, ALTER TABLE ENGINE and OPTIMIZE TABLE operations. */ - static const HA_ALTER_FLAGS RECREATE_TABLE = 1L << 29; + static const HA_ALTER_FLAGS RECREATE_TABLE = 1ULL << 36; - // Virtual columns changed - static const HA_ALTER_FLAGS ALTER_COLUMN_VCOL = 1L << 30; + /** + Changes in generated columns that affect storage, + for example, when a vcol type or expression changes + and this vcol is indexed or used in a partitioning expression + */ + static const HA_ALTER_FLAGS ALTER_COLUMN_VCOL = 1ULL << 37; /** ALTER TABLE for a partitioned table. The engine needs to commit online alter of all partitions atomically (using group_commit_ctx) */ - static const HA_ALTER_FLAGS ALTER_PARTITIONED = 1L << 31; + static const HA_ALTER_FLAGS ALTER_PARTITIONED = 1ULL << 38; - static const HA_ALTER_FLAGS ALTER_ADD_CHECK_CONSTRAINT = 1LL << 32; + static const HA_ALTER_FLAGS ALTER_ADD_CHECK_CONSTRAINT = 1ULL << 39; - static const HA_ALTER_FLAGS ALTER_DROP_CHECK_CONSTRAINT= 1LL << 33; + static const HA_ALTER_FLAGS ALTER_DROP_CHECK_CONSTRAINT= 1ULL << 40; /** Create options (like MAX_ROWS) for the new version of table. @@ -2954,7 +2974,6 @@ public: virtual const key_map *keys_to_use_for_scanning() { return &key_map_empty; } bool has_transactions() { return (ha_table_flags() & HA_NO_TRANSACTIONS) == 0; } - virtual uint extra_rec_buf_length() const { return 0; } /** This method is used to analyse the error to see whether the error @@ -3875,18 +3894,6 @@ public: } LEX_STRING *engine_name() { return hton_name(ht); } - - /* - @brief - Check whether the engine supports virtual columns - - @retval - FALSE if the engine does not support virtual columns - @retval - TRUE if the engine supports virtual columns - */ - - virtual bool check_if_supported_virtual_columns(void) { return FALSE;} TABLE* get_table() { return table; } TABLE_SHARE* get_table_share() { return table_share; } diff --git a/sql/hostname.cc b/sql/hostname.cc index a84aebdf3c8..e8d6780d095 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -28,7 +28,6 @@ #include "sql_priv.h" #include "unireg.h" // SPECIAL_NO_HOST_CACHE #include "hostname.h" -#include "unireg.h" #ifndef __WIN__ #include // getservbyname, servent #endif diff --git a/sql/item.cc b/sql/item.cc index 8087aad2e7f..682f88317f1 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -43,6 +43,7 @@ #include "sql_expression_cache.h" const String my_null_string("NULL", 4, default_charset_info); +const String my_default_string("DEFAULT", 7, default_charset_info); static int save_field_in_field(Field *, bool *, Field *, bool); @@ -568,6 +569,24 @@ uint Item::temporal_precision(enum_field_types type_arg) } +void Item::print_parenthesised(String *str, enum_query_type query_type, + enum precedence parent_prec) +{ + bool need_parens= precedence() < parent_prec; + if (need_parens) + str->append('('); + print(str, query_type); + if (need_parens) + str->append(')'); +} + + +void Item::print(String *str, enum_query_type query_type) +{ + str->append(full_name()); +} + + void Item::print_item_w_name(String *str, enum_query_type query_type) { print(str, query_type); @@ -900,17 +919,15 @@ bool Item_field::find_item_in_field_list_processor(void *arg) bool Item_field::register_field_in_read_map(void *arg) { TABLE *table= (TABLE *) arg; + int res= 0; + if (field->vcol_info && + !bitmap_fast_test_and_set(field->table->vcol_set, field->field_index)) + { + res= field->vcol_info->expr->walk(&Item::register_field_in_read_map,1,arg); + } if (field->table == table || !table) bitmap_set_bit(field->table->read_set, field->field_index); - if (field->vcol_info && - !bitmap_is_set(field->table->vcol_set, field->field_index)) - { - /* Ensure that the virtual fields is updated on read or write */ - bitmap_set_bit(field->table->vcol_set, field->field_index); - return field->vcol_info->expr_item->walk(&Item::register_field_in_read_map, - 1, arg); - } - return 0; + return res; } /* @@ -949,7 +966,8 @@ bool Item_field::register_field_in_write_map(void *arg) - All fields that have default value as a constant are initialized first. - Then user-specified values from the INSERT list - Then all fields that has a default expression, in field_index order. - - Last all virtual fields, in field_index order. + - Then all virtual fields, in field_index order. + - Then auto-increment values This means: - For default fields we can't access the same field or a field after @@ -957,6 +975,7 @@ bool Item_field::register_field_in_write_map(void *arg) - A virtual fields can't access itself or a virtual field after itself. - user-specified values will not see virtual fields or default expressions, as in INSERT t1 (a) VALUES (b); + - no virtual fields can access auto-increment values This is used by fix_vcol_expr() when a table is opened @@ -966,11 +985,18 @@ bool Item_field::register_field_in_write_map(void *arg) bool Item_field::check_field_expression_processor(void *arg) { + Field *org_field= (Field*) arg; if (field->flags & NO_DEFAULT_VALUE_FLAG) return 0; + if (field->flags & AUTO_INCREMENT_FLAG) + { + my_error(ER_EXPRESSION_REFERS_TO_UNINIT_FIELD, + MYF(0), + org_field->field_name, field->field_name); + return 1; + } if ((field->default_value && field->default_value->flags) || field->vcol_info) { - Field *org_field= (Field*) arg; if (field == org_field || (!org_field->vcol_info && field->vcol_info) || (((field->vcol_info && org_field->vcol_info) || @@ -986,6 +1012,18 @@ bool Item_field::check_field_expression_processor(void *arg) return 0; } +bool Item_field::update_vcol_processor(void *arg) +{ + MY_BITMAP *map= (MY_BITMAP *) arg; + if (field->vcol_info && + !bitmap_fast_test_and_set(map, field->field_index)) + { + field->vcol_info->expr->walk(&Item::update_vcol_processor, 0, arg); + field->vcol_info->expr->save_in_field(field, 0); + } + return 0; +} + bool Item::check_cols(uint c) { @@ -2618,16 +2656,50 @@ void Item_ident::print(String *str, enum_query_type query_type) THD *thd= current_thd; char d_name_buff[MAX_ALIAS_NAME], t_name_buff[MAX_ALIAS_NAME]; const char *d_name= db_name, *t_name= table_name; + bool use_table_name= table_name && table_name[0]; + bool use_db_name= use_table_name && db_name && db_name[0] && !alias_name_used; + + if (use_db_name && (query_type & QT_ITEM_IDENT_SKIP_DB_NAMES)) + use_db_name= !thd->db || strcmp(thd->db, db_name); + + if (use_db_name) + use_db_name= !(cached_table && cached_table->belong_to_view && + cached_table->belong_to_view->compact_view_format); + + if (!use_db_name && use_table_name && + (query_type & QT_ITEM_IDENT_SKIP_TABLE_NAMES)) + { + /* + Don't print the table name if it's the only table in the context + XXX technically, that's a sufficient, but too strong condition + */ + if (!context) + use_table_name= false; + else if (context->outer_context) + use_table_name= true; + else if (context->last_name_resolution_table == context->first_name_resolution_table) + use_table_name= false; + else if (!context->last_name_resolution_table && + !context->first_name_resolution_table->next_name_resolution_table) + use_table_name= false; + } + + if (!field_name || !field_name[0]) + { + append_identifier(thd, str, STRING_WITH_LEN("tmp_field")); + return; + } + if (lower_case_table_names== 1 || (lower_case_table_names == 2 && !alias_name_used)) { - if (table_name && table_name[0]) + if (use_table_name) { strmov(t_name_buff, table_name); my_casedn_str(files_charset_info, t_name_buff); t_name= t_name_buff; } - if (db_name && db_name[0]) + if (use_db_name) { strmov(d_name_buff, db_name); my_casedn_str(files_charset_info, d_name_buff); @@ -2635,43 +2707,18 @@ void Item_ident::print(String *str, enum_query_type query_type) } } - if (!table_name || !field_name || !field_name[0]) + if (use_db_name) { - const char *nm= (field_name && field_name[0]) ? - field_name : name ? name : "tmp_field"; - append_identifier(thd, str, nm, (uint) strlen(nm)); - return; - } - if (db_name && db_name[0] && !alias_name_used) - { - /* - When printing EXPLAIN, don't print database name when it's the same as - current database. - */ - bool skip_db= (query_type & QT_ITEM_IDENT_SKIP_CURRENT_DATABASE) && - thd->db && !strcmp(thd->db, db_name); - if (!skip_db && - !(cached_table && cached_table->belong_to_view && - cached_table->belong_to_view->compact_view_format)) - { - append_identifier(thd, str, d_name, (uint)strlen(d_name)); - str->append('.'); - } - append_identifier(thd, str, t_name, (uint)strlen(t_name)); + append_identifier(thd, str, d_name, (uint)strlen(d_name)); str->append('.'); - append_identifier(thd, str, field_name, (uint)strlen(field_name)); + DBUG_ASSERT(use_table_name); } - else + if (use_table_name) { - if (table_name[0]) - { - append_identifier(thd, str, t_name, (uint) strlen(t_name)); - str->append('.'); - append_identifier(thd, str, field_name, (uint) strlen(field_name)); - } - else - append_identifier(thd, str, field_name, (uint) strlen(field_name)); + append_identifier(thd, str, t_name, (uint) strlen(t_name)); + str->append('.'); } + append_identifier(thd, str, field_name, (uint) strlen(field_name)); } /* ARGSUSED */ @@ -2832,9 +2879,28 @@ void Item_field::fix_after_pullout(st_select_lex *new_parent, Item **ref) if (context) { Name_resolution_context *ctx= new Name_resolution_context(); - ctx->outer_context= NULL; // We don't build a complete name resolver - ctx->table_list= NULL; // We rely on first_name_resolution_table instead + if (context->select_lex == new_parent) + { + /* + This field was pushed in then pulled out + (for example left part of IN) + */ + ctx->outer_context= context->outer_context; + } + else if (context->outer_context) + { + /* just pull to the upper context */ + ctx->outer_context= context->outer_context->outer_context; + } + else + { + /* No upper context (merging Derived/VIEW where context chain ends) */ + ctx->outer_context= NULL; + } + ctx->table_list= context->first_name_resolution_table; ctx->select_lex= new_parent; + if (context->select_lex == NULL) + ctx->select_lex= NULL; ctx->first_name_resolution_table= context->first_name_resolution_table; ctx->last_name_resolution_table= context->last_name_resolution_table; ctx->error_processor= context->error_processor; @@ -2900,6 +2966,14 @@ void Item_int::print(String *str, enum_query_type query_type) } +Item *Item_bool::neg_transformer(THD *thd) +{ + value= !value; + name= 0; + return this; +} + + Item_uint::Item_uint(THD *thd, const char *str_arg, uint length): Item_int(thd, str_arg, length) { @@ -3228,6 +3302,7 @@ Item_param::Item_param(THD *thd, uint pos_in_query_arg): Rewritable_query_parameter(pos_in_query_arg, 1), Type_handler_hybrid_field_type(MYSQL_TYPE_VARCHAR), state(NO_VALUE), + indicators(0), indicator(STMT_INDICATOR_NONE), /* Don't pretend to be a literal unless value for this item is set. */ item_type(PARAM_ITEM), set_param_func(default_set_param_func), @@ -3412,11 +3487,37 @@ bool Item_param::set_longdata(const char *str, ulong length) } +void Item_param::CONVERSION_INFO::set(THD *thd, CHARSET_INFO *fromcs) +{ + CHARSET_INFO *tocs= thd->variables.collation_connection; + + character_set_of_placeholder= fromcs; + character_set_client= thd->variables.character_set_client; + /* + Setup source and destination character sets so that they + are different only if conversion is necessary: this will + make later checks easier. + */ + uint32 dummy_offset; + final_character_set_of_str_value= + String::needs_conversion(0, fromcs, tocs, &dummy_offset) ? + tocs : fromcs; +} + + +bool Item_param::CONVERSION_INFO::convert(THD *thd, String *str) +{ + return thd->convert_string(str, + character_set_of_placeholder, + final_character_set_of_str_value); +} + + /** - Set parameter value from user variable value. + Set parameter value from Item. @param thd Current thread - @param entry User variable structure (NULL means use NULL value) + @param item Item @retval 0 OK @@ -3424,47 +3525,44 @@ bool Item_param::set_longdata(const char *str, ulong length) 1 Out of memory */ -bool Item_param::set_from_user_var(THD *thd, const user_var_entry *entry) +bool Item_param::set_from_item(THD *thd, Item *item) { - DBUG_ENTER("Item_param::set_from_user_var"); - if (entry && entry->value) + DBUG_ENTER("Item_param::set_from_item"); + if (limit_clause_param) { - unsigned_flag= entry->unsigned_flag; - if (limit_clause_param) + longlong val= item->val_int(); + if (item->null_value) { - bool unused; - set_int(entry->val_int(&unused), MY_INT64_NUM_DECIMAL_DIGITS); + set_null(); + DBUG_RETURN(false); + } + else + { + unsigned_flag= item->unsigned_flag; + set_int(val, MY_INT64_NUM_DECIMAL_DIGITS); item_type= Item::INT_ITEM; - set_handler_by_result_type(entry->type); + set_handler_by_result_type(item->result_type()); DBUG_RETURN(!unsigned_flag && value.integer < 0 ? 1 : 0); } - switch (entry->type) { + } + struct st_value tmp; + if (!item->store(&tmp, 0)) + { + unsigned_flag= item->unsigned_flag; + switch (item->cmp_type()) { case REAL_RESULT: - set_double(*(double*)entry->value); + set_double(tmp.value.m_double); item_type= Item::REAL_ITEM; set_handler_by_field_type(MYSQL_TYPE_DOUBLE); break; case INT_RESULT: - set_int(*(longlong*)entry->value, MY_INT64_NUM_DECIMAL_DIGITS); + set_int(tmp.value.m_longlong, MY_INT64_NUM_DECIMAL_DIGITS); item_type= Item::INT_ITEM; set_handler_by_field_type(MYSQL_TYPE_LONGLONG); break; case STRING_RESULT: { - CHARSET_INFO *fromcs= entry->charset(); - CHARSET_INFO *tocs= thd->variables.collation_connection; - uint32 dummy_offset; - - value.cs_info.character_set_of_placeholder= fromcs; - value.cs_info.character_set_client= thd->variables.character_set_client; - /* - Setup source and destination character sets so that they - are different only if conversion is necessary: this will - make later checks easier. - */ - value.cs_info.final_character_set_of_str_value= - String::needs_conversion(0, fromcs, tocs, &dummy_offset) ? - tocs : fromcs; + value.cs_info.set(thd, item->collation.collation); /* Exact value of max_length is not known unless data is converted to charset of connection, so we have to set it later. @@ -3472,13 +3570,13 @@ bool Item_param::set_from_user_var(THD *thd, const user_var_entry *entry) item_type= Item::STRING_ITEM; set_handler_by_field_type(MYSQL_TYPE_VARCHAR); - if (set_str((const char *)entry->value, entry->length)) + if (set_str(tmp.m_string.ptr(), tmp.m_string.length())) DBUG_RETURN(1); break; } case DECIMAL_RESULT: { - const my_decimal *ent_value= (const my_decimal *)entry->value; + const my_decimal *ent_value= &tmp.m_decimal; my_decimal2decimal(ent_value, &decimal_value); state= DECIMAL_VALUE; decimals= ent_value->frac; @@ -3489,8 +3587,17 @@ bool Item_param::set_from_user_var(THD *thd, const user_var_entry *entry) set_handler_by_field_type(MYSQL_TYPE_NEWDECIMAL); break; } - case ROW_RESULT: case TIME_RESULT: + { + value.time= tmp.value.m_time; + state= TIME_VALUE; + max_length= item->max_length; + decimals= item->decimals; + item_type= Item::DATE_ITEM; + set_handler(item->type_handler()); + break; + } + case ROW_RESULT: DBUG_ASSERT(0); set_null(); } @@ -3544,6 +3651,11 @@ int Item_param::save_in_field(Field *field, bool no_conversions) { field->set_notnull(); + /* + There's no "default" intentionally, to make compiler complain + when adding a new XXX_VALUE value. + Garbage (e.g. in case of a memory overrun) is handled after the switch. + */ switch (state) { case INT_VALUE: return field->store(value.integer, unsigned_flag); @@ -3560,14 +3672,30 @@ int Item_param::save_in_field(Field *field, bool no_conversions) str_value.charset()); case NULL_VALUE: return set_field_to_null_with_conversions(field, no_conversions); + case DEFAULT_VALUE: + return field->save_in_field_default_value(field->table->pos_in_table_list-> + top_table() != + field->table->pos_in_table_list); + case IGNORE_VALUE: + return field->save_in_field_ignore_value(field->table->pos_in_table_list-> + top_table() != + field->table->pos_in_table_list); case NO_VALUE: - default: - DBUG_ASSERT(0); + DBUG_ASSERT(0); // Should not be possible + return true; } + DBUG_ASSERT(0); // Garbage return 1; } +void Item_param::invalid_default_param() const +{ + my_message(ER_INVALID_DEFAULT_PARAM, + ER_THD(current_thd, ER_INVALID_DEFAULT_PARAM), MYF(0)); +} + + bool Item_param::get_date(MYSQL_TIME *res, ulonglong fuzzydate) { if (state == TIME_VALUE) @@ -3581,6 +3709,7 @@ bool Item_param::get_date(MYSQL_TIME *res, ulonglong fuzzydate) double Item_param::val_real() { + // There's no "default". See comments in Item_param::save_in_field(). switch (state) { case REAL_VALUE: return value.real; @@ -3603,17 +3732,24 @@ double Item_param::val_real() time value for the placeholder. */ return TIME_to_double(&value.time); + case IGNORE_VALUE: + case DEFAULT_VALUE: + invalid_default_param(); + // fall through case NULL_VALUE: return 0.0; - default: - DBUG_ASSERT(0); + case NO_VALUE: + DBUG_ASSERT(0); // Should not be possible + return 0.0; } + DBUG_ASSERT(0); // Garbage return 0.0; } longlong Item_param::val_int() { + // There's no "default". See comments in Item_param::save_in_field(). switch (state) { case REAL_VALUE: return (longlong) rint(value.real); @@ -3632,17 +3768,24 @@ longlong Item_param::val_int() } case TIME_VALUE: return (longlong) TIME_to_ulonglong(&value.time); + case IGNORE_VALUE: + case DEFAULT_VALUE: + invalid_default_param(); + // fall through case NULL_VALUE: return 0; - default: - DBUG_ASSERT(0); + case NO_VALUE: + DBUG_ASSERT(0); // Should not be possible + return 0; } + DBUG_ASSERT(0); // Garbage return 0; } my_decimal *Item_param::val_decimal(my_decimal *dec) { + // There's no "default". See comments in Item_param::save_in_field(). switch (state) { case DECIMAL_VALUE: return &decimal_value; @@ -3659,17 +3802,24 @@ my_decimal *Item_param::val_decimal(my_decimal *dec) { return TIME_to_my_decimal(&value.time, dec); } + case IGNORE_VALUE: + case DEFAULT_VALUE: + invalid_default_param(); + // fall through case NULL_VALUE: - return 0; - default: - DBUG_ASSERT(0); + return 0; + case NO_VALUE: + DBUG_ASSERT(0); // Should not be possible + return 0; } + DBUG_ASSERT(0); // Gabrage return 0; } String *Item_param::val_str(String* str) { + // There's no "default". See comments in Item_param::save_in_field(). switch (state) { case STRING_VALUE: case LONG_DATA_VALUE: @@ -3694,12 +3844,18 @@ String *Item_param::val_str(String* str) str->set_charset(&my_charset_bin); return str; } + case IGNORE_VALUE: + case DEFAULT_VALUE: + invalid_default_param(); + // fall through case NULL_VALUE: return NULL; - default: - DBUG_ASSERT(0); + case NO_VALUE: + DBUG_ASSERT(0); // Should not be possible + return NULL; } - return str; + DBUG_ASSERT(0); // Garbage + return NULL; } /** @@ -3715,37 +3871,54 @@ String *Item_param::val_str(String* str) const String *Item_param::query_val_str(THD *thd, String* str) const { + // There's no "default". See comments in Item_param::save_in_field(). switch (state) { case INT_VALUE: str->set_int(value.integer, unsigned_flag, &my_charset_bin); - break; + return str; case REAL_VALUE: str->set_real(value.real, NOT_FIXED_DEC, &my_charset_bin); - break; + return str; case DECIMAL_VALUE: if (my_decimal2string(E_DEC_FATAL_ERROR, &decimal_value, 0, 0, 0, str) > 1) return &my_null_string; - break; + return str; case TIME_VALUE: { + static const uint32 typelen= 9; // "TIMESTAMP" is the longest type name char *buf, *ptr; str->length(0); /* TODO: in case of error we need to notify replication that binary log contains wrong statement */ - if (str->reserve(MAX_DATE_STRING_REP_LENGTH+3)) + if (str->reserve(MAX_DATE_STRING_REP_LENGTH + 3 + typelen)) break; /* Create date string inplace */ + switch (value.time.time_type) { + case MYSQL_TIMESTAMP_DATE: + str->append(C_STRING_WITH_LEN("DATE")); + break; + case MYSQL_TIMESTAMP_TIME: + str->append(C_STRING_WITH_LEN("TIME")); + break; + case MYSQL_TIMESTAMP_DATETIME: + str->append(C_STRING_WITH_LEN("TIMESTAMP")); + break; + case MYSQL_TIMESTAMP_ERROR: + case MYSQL_TIMESTAMP_NONE: + break; + } + DBUG_ASSERT(str->length() <= typelen); buf= str->c_ptr_quick(); - ptr= buf; + ptr= buf + str->length(); *ptr++= '\''; ptr+= (uint) my_TIME_to_str(&value.time, ptr, decimals); *ptr++= '\''; str->length((uint32) (ptr - buf)); - break; + return str; } case STRING_VALUE: case LONG_DATA_VALUE: @@ -3754,14 +3927,19 @@ const String *Item_param::query_val_str(THD *thd, String* str) const append_query_string(value.cs_info.character_set_client, str, str_value.ptr(), str_value.length(), thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES); - break; + return str; } + case IGNORE_VALUE: + case DEFAULT_VALUE: + return &my_default_string; case NULL_VALUE: return &my_null_string; - default: - DBUG_ASSERT(0); + case NO_VALUE: + DBUG_ASSERT(0); // Should not be possible + return NULL; } - return str; + DBUG_ASSERT(0); // Garbage + return NULL; } @@ -3775,21 +3953,7 @@ bool Item_param::convert_str_value(THD *thd) bool rc= FALSE; if (state == STRING_VALUE || state == LONG_DATA_VALUE) { - /* - Check is so simple because all charsets were set up properly - in setup_one_conversion_function, where typecode of - placeholder was also taken into account: the variables are different - here only if conversion is really necessary. - */ - if (value.cs_info.final_character_set_of_str_value != - value.cs_info.character_set_of_placeholder) - { - rc= thd->convert_string(&str_value, - value.cs_info.character_set_of_placeholder, - value.cs_info.final_character_set_of_str_value); - } - else - str_value.set_charset(value.cs_info.final_character_set_of_str_value); + rc= value.cs_info.convert_if_needed(thd, &str_value); /* Here str_value is guaranteed to be in final_character_set_of_str_value */ /* @@ -3819,7 +3983,12 @@ Item * Item_param::clone_item(THD *thd) { MEM_ROOT *mem_root= thd->mem_root; + // There's no "default". See comments in Item_param::save_in_field(). switch (state) { + case IGNORE_VALUE: + case DEFAULT_VALUE: + invalid_default_param(); + // fall through case NULL_VALUE: return new (mem_root) Item_null(thd, name); case INT_VALUE: @@ -3829,6 +3998,8 @@ Item_param::clone_item(THD *thd) case REAL_VALUE: return new (mem_root) Item_float(thd, name, value.real, decimals, max_length); + case DECIMAL_VALUE: + return 0; // Should create Item_decimal. See MDEV-11361. case STRING_VALUE: case LONG_DATA_VALUE: return new (mem_root) Item_string(thd, name, str_value.c_ptr_quick(), @@ -3836,11 +4007,11 @@ Item_param::clone_item(THD *thd) collation.derivation, collation.repertoire); case TIME_VALUE: - break; + return 0; case NO_VALUE: - default: - DBUG_ASSERT(0); - }; + return 0; + } + DBUG_ASSERT(0); // Garbage return 0; } @@ -3851,7 +4022,12 @@ Item_param::eq(const Item *item, bool binary_cmp) const if (!basic_const_item()) return FALSE; + // There's no "default". See comments in Item_param::save_in_field(). switch (state) { + case IGNORE_VALUE: + case DEFAULT_VALUE: + invalid_default_param(); + return false; case NULL_VALUE: return null_eq(item); case INT_VALUE: @@ -3861,9 +4037,12 @@ Item_param::eq(const Item *item, bool binary_cmp) const case STRING_VALUE: case LONG_DATA_VALUE: return str_eq(&str_value, item, binary_cmp); - default: - break; + case DECIMAL_VALUE: + case TIME_VALUE: + case NO_VALUE: + return false; } + DBUG_ASSERT(0); // Garbage return FALSE; } @@ -3875,6 +4054,14 @@ void Item_param::print(String *str, enum_query_type query_type) { str->append('?'); } + else if (state == DEFAULT_VALUE) + { + str->append("default"); + } + else if (state == IGNORE_VALUE) + { + str->append("ignore"); + } else { char buffer[STRING_BUFFER_USUAL_SIZE]; @@ -3926,6 +4113,26 @@ Item_param::set_param_type_and_swap_value(Item_param *src) } +void Item_param::set_default() +{ + state= DEFAULT_VALUE; + /* + When Item_param is set to DEFAULT_VALUE: + - its val_str() and val_decimal() return NULL + - get_date() returns true + It's important also to have null_value==true for DEFAULT_VALUE. + Otherwise the callers of val_xxx() and get_date(), e.g. Item::send(), + can misbehave (e.g. crash on asserts). + */ + null_value= true; +} + +void Item_param::set_ignore() +{ + state= IGNORE_VALUE; + null_value= true; +} + /** This operation is intended to store some item value in Item_param to be used later. @@ -4522,8 +4729,6 @@ static Item** find_field_in_group_list(Item *find_item, ORDER *group_list) const char *field_name; ORDER *found_group= NULL; int found_match_degree= 0; - Item_ident *cur_field; - int cur_match_degree= 0; char name_buff[SAFE_NAME_LEN+1]; if (find_item->type() == Item::FIELD_ITEM || @@ -4548,54 +4753,70 @@ static Item** find_field_in_group_list(Item *find_item, ORDER *group_list) for (ORDER *cur_group= group_list ; cur_group ; cur_group= cur_group->next) { - if ((*(cur_group->item))->real_item()->type() == Item::FIELD_ITEM) + int cur_match_degree= 0; + + /* SELECT list element with explicit alias */ + if ((*(cur_group->item))->name && + !(*(cur_group->item))->is_autogenerated_name && + !my_strcasecmp(system_charset_info, + (*(cur_group->item))->name, field_name)) { - cur_field= (Item_ident*) *cur_group->item; - cur_match_degree= 0; - - DBUG_ASSERT(cur_field->field_name != 0); + ++cur_match_degree; + } + /* Reference on the field or view/derived field. */ + else if ((*(cur_group->item))->type() == Item::FIELD_ITEM || + (*(cur_group->item))->type() == Item::REF_ITEM ) + { + Item_ident *cur_field= (Item_ident*) *cur_group->item; + const char *l_db_name= cur_field->db_name; + const char *l_table_name= cur_field->table_name; + const char *l_field_name= cur_field->field_name; + + DBUG_ASSERT(l_field_name != 0); if (!my_strcasecmp(system_charset_info, - cur_field->field_name, field_name)) + l_field_name, field_name)) ++cur_match_degree; else continue; - if (cur_field->table_name && table_name) + if (l_table_name && table_name) { /* If field_name is qualified by a table name. */ - if (my_strcasecmp(table_alias_charset, cur_field->table_name, table_name)) + if (my_strcasecmp(table_alias_charset, l_table_name, table_name)) /* Same field names, different tables. */ return NULL; ++cur_match_degree; - if (cur_field->db_name && db_name) + if (l_db_name && db_name) { /* If field_name is also qualified by a database name. */ - if (strcmp(cur_field->db_name, db_name)) + if (strcmp(l_db_name, db_name)) /* Same field names, different databases. */ return NULL; ++cur_match_degree; } } + } + else + continue; - if (cur_match_degree > found_match_degree) - { - found_match_degree= cur_match_degree; - found_group= cur_group; - } - else if (found_group && (cur_match_degree == found_match_degree) && - ! (*(found_group->item))->eq(cur_field, 0)) - { - /* - If the current resolve candidate matches equally well as the current - best match, they must reference the same column, otherwise the field - is ambiguous. - */ - my_error(ER_NON_UNIQ_ERROR, MYF(0), - find_item->full_name(), current_thd->where); - return NULL; - } + if (cur_match_degree > found_match_degree) + { + found_match_degree= cur_match_degree; + found_group= cur_group; + } + else if (found_group && (cur_match_degree == found_match_degree) && + !(*(found_group->item))->eq((*(cur_group->item)), 0)) + { + /* + If the current resolve candidate matches equally well as the current + best match, they must reference the same column, otherwise the field + is ambiguous. + */ + my_error(ER_NON_UNIQ_ERROR, MYF(0), + find_item->full_name(), current_thd->where); + return NULL; } } @@ -5406,6 +5627,14 @@ bool Item_field::vcol_in_partition_func_processor(void *int_arg) return FALSE; } +bool Item_field::check_valid_arguments_processor(void *bool_arg) +{ + Virtual_column_info *vcol= field->vcol_info; + if (!vcol) + return FALSE; + return vcol->expr->walk(&Item::check_partition_func_processor, 0, NULL) + || vcol->expr->walk(&Item::check_valid_arguments_processor, 0, NULL); +} void Item_field::cleanup() { @@ -5636,6 +5865,7 @@ String *Item::check_well_formed_result(String *str, bool send_error) /* Check whether we got a well-formed string */ CHARSET_INFO *cs= str->charset(); uint wlen= str->well_formed_length(); + null_value= false; if (wlen < str->length()) { THD *thd= current_thd; @@ -6121,6 +6351,12 @@ int Item::save_in_field(Field *field, bool no_conversions) } +bool Item::save_in_param(THD *thd, Item_param *param) +{ + return param->set_from_item(thd, this); +} + + int Item_string::save_in_field(Field *field, bool no_conversions) { String *result; @@ -8466,7 +8702,7 @@ bool Item_default_value::fix_fields(THD *thd, Item **items) { fix_session_vcol_expr_for_read(thd, field, field->default_value); if (thd->mark_used_columns != MARK_COLUMNS_NONE) - field->default_value->expr_item->walk(&Item::register_field_in_read_map, 1, 0); + field->default_value->expr->walk(&Item::register_field_in_read_map, 1, 0); IF_DBUG(def_field->is_stat_field=1,); // a hack to fool ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED } return FALSE; @@ -8537,42 +8773,8 @@ int Item_default_value::save_in_field(Field *field_arg, bool no_conversions) calculate(); else { - TABLE *table= field_arg->table; - THD *thd= table->in_use; - - if (field_arg->flags & NO_DEFAULT_VALUE_FLAG && - field_arg->real_type() != MYSQL_TYPE_ENUM) - { - if (field_arg->reset()) - { - my_message(ER_CANT_CREATE_GEOMETRY_OBJECT, - ER_THD(thd, ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0)); - return -1; - } - - if (context->error_processor == &view_error_processor) - { - TABLE_LIST *view= table->pos_in_table_list->top_table(); - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - ER_NO_DEFAULT_FOR_VIEW_FIELD, - ER_THD(thd, ER_NO_DEFAULT_FOR_VIEW_FIELD), - view->view_db.str, - view->view_name.str); - } - else - { - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - ER_NO_DEFAULT_FOR_FIELD, - ER_THD(thd, ER_NO_DEFAULT_FOR_FIELD), - field_arg->field_name); - } - return 1; - } - field_arg->set_default(); - return - !field_arg->is_null() && - field_arg->validate_value_in_record_with_warn(thd, table->record[0]) && - thd->is_error() ? -1 : 0; + return field_arg->save_in_field_default_value(context->error_processor == + &view_error_processor); } return Item_field::save_in_field(field_arg, no_conversions); } @@ -8610,6 +8812,57 @@ Item *Item_default_value::transform(THD *thd, Item_transformer transformer, return (this->*transformer)(thd, args); } +void Item_ignore_value::print(String *str, enum_query_type query_type) +{ + str->append(STRING_WITH_LEN("ignore")); +} + +int Item_ignore_value::save_in_field(Field *field_arg, bool no_conversions) +{ + return field_arg->save_in_field_ignore_value(context->error_processor == + &view_error_processor); +} + +String *Item_ignore_value::val_str(String *str) +{ + DBUG_ASSERT(0); // never should be called + null_value= 1; + return 0; +} + +double Item_ignore_value::val_real() +{ + DBUG_ASSERT(0); // never should be called + null_value= 1; + return 0.0; +} + +longlong Item_ignore_value::val_int() +{ + DBUG_ASSERT(0); // never should be called + null_value= 1; + return 0; +} + +my_decimal *Item_ignore_value::val_decimal(my_decimal *decimal_value) +{ + DBUG_ASSERT(0); // never should be called + null_value= 1; + return 0; +} + +bool Item_ignore_value::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) +{ + DBUG_ASSERT(0); // never should be called + null_value= 1; + return TRUE; +} + +bool Item_ignore_value::send(Protocol *protocol, String *buffer) +{ + DBUG_ASSERT(0); // never should be called + return TRUE; +} bool Item_insert_value::eq(const Item *item, bool binary_cmp) const { @@ -9187,6 +9440,17 @@ int Item_cache_int::save_in_field(Field *field, bool no_conversions) } +Item *Item_cache_int::convert_to_basic_const_item(THD *thd) +{ + Item *new_item; + DBUG_ASSERT(value_cached || example != 0); + new_item= null_value ? + (Item*) new (thd->mem_root) Item_null(thd) : + (Item*) new (thd->mem_root) Item_int(thd, val_int(), max_length); + return new_item; +} + + Item_cache_temporal::Item_cache_temporal(THD *thd, enum_field_types field_type_arg): Item_cache_int(thd, field_type_arg) @@ -9342,6 +9606,23 @@ Item *Item_cache_temporal::clone_item(THD *thd) } +Item *Item_cache_temporal::convert_to_basic_const_item(THD *thd) +{ + Item *new_item; + DBUG_ASSERT(value_cached || example != 0); + if (null_value) + new_item= (Item*) new (thd->mem_root) Item_null(thd); + else + { + MYSQL_TIME ltime; + unpack_time(val_datetime_packed(), <ime); + new_item= (Item*) new (thd->mem_root) Item_datetime_literal(thd, <ime, + decimals); + } + return new_item; +} + + bool Item_cache_real::cache_value() { if (!example) @@ -9390,6 +9671,18 @@ my_decimal *Item_cache_real::val_decimal(my_decimal *decimal_val) } +Item *Item_cache_real::convert_to_basic_const_item(THD *thd) +{ + Item *new_item; + DBUG_ASSERT(value_cached || example != 0); + new_item= null_value ? + (Item*) new (thd->mem_root) Item_null(thd) : + (Item*) new (thd->mem_root) Item_float(thd, val_real(), + decimals); + return new_item; +} + + bool Item_cache_decimal::cache_value() { if (!example) @@ -9441,6 +9734,22 @@ my_decimal *Item_cache_decimal::val_decimal(my_decimal *val) } +Item *Item_cache_decimal::convert_to_basic_const_item(THD *thd) +{ + Item *new_item; + DBUG_ASSERT(value_cached || example != 0); + if (null_value) + new_item= (Item*) new (thd->mem_root) Item_null(thd); + else + { + my_decimal decimal_value; + my_decimal *result= val_decimal(&decimal_value); + new_item= (Item*) new (thd->mem_root) Item_decimal(thd, result); + } + return new_item; +} + + bool Item_cache_str::cache_value() { if (!example) @@ -9520,6 +9829,26 @@ bool Item_cache_row::allocate(THD *thd, uint num) } +Item *Item_cache_str::convert_to_basic_const_item(THD *thd) +{ + Item *new_item; + DBUG_ASSERT(value_cached || example != 0); + if (null_value) + new_item= (Item*) new (thd->mem_root) Item_null(thd); + else + { + char buff[MAX_FIELD_WIDTH]; + String tmp(buff, sizeof(buff), value->charset()); + String *result= val_str(&tmp); + uint length= result->length(); + char *tmp_str= thd->strmake(result->ptr(), length); + new_item= new (thd->mem_root) Item_string(thd, tmp_str, length, + result->charset()); + } + return new_item; +} + + bool Item_cache_row::setup(THD *thd, Item *item) { example= item; @@ -10258,3 +10587,14 @@ void Item::register_in(THD *thd) next= thd->free_list; thd->free_list= this; } + +void Virtual_column_info::print(String *str) +{ + expr->print_parenthesised(str, + (enum_query_type)(QT_ITEM_ORIGINAL_FUNC_NULLIF | + QT_ITEM_IDENT_SKIP_DB_NAMES | + QT_ITEM_IDENT_SKIP_TABLE_NAMES | + QT_ITEM_CACHE_WRAPPER_SKIP_DETAILS | + QT_TO_SYSTEM_CHARSET), + LOWEST_PRECEDENCE); +} diff --git a/sql/item.h b/sql/item.h index 5b8254837e8..1f3e0f02971 100644 --- a/sql/item.h +++ b/sql/item.h @@ -30,6 +30,29 @@ C_MODE_START #include + +/* + A prototype for a C-compatible structure to store a value of any data type. + Currently it has to stay in /sql, as it depends on String and my_decimal. + We'll do the following changes: + 1. add pure C "struct st_string" and "struct st_my_decimal" + 2. change type of m_string to struct st_string and move inside the union + 3. change type of m_decmal to struct st_my_decimal and move inside the union + 4. move the definition to some file in /include +*/ +struct st_value +{ + enum enum_dynamic_column_type m_type; + union + { + longlong m_longlong; + double m_double; + MYSQL_TIME m_time; + } value; + String m_string; + my_decimal m_decimal; +}; + C_MODE_END const char *dbug_print_item(Item *item); @@ -38,6 +61,7 @@ class Protocol; struct TABLE_LIST; void item_init(void); /* Init item functions */ class Item_field; +class Item_param; class user_var_entry; class JOIN; struct KEY_FIELD; @@ -45,6 +69,30 @@ struct SARGABLE_PARAM; class RANGE_OPT_PARAM; class SEL_TREE; +enum precedence { + LOWEST_PRECEDENCE, + ASSIGN_PRECEDENCE, // := + OR_PRECEDENCE, // OR, || (unless PIPES_AS_CONCAT) + XOR_PRECEDENCE, // XOR + AND_PRECEDENCE, // AND, && + NOT_PRECEDENCE, // NOT (unless HIGH_NOT_PRECEDENCE) + BETWEEN_PRECEDENCE, // BETWEEN, CASE, WHEN, THEN, ELSE + CMP_PRECEDENCE, // =, <=>, >=, >, <=, <, <>, !=, IS, LIKE, REGEXP, IN + BITOR_PRECEDENCE, // | + BITAND_PRECEDENCE, // & + SHIFT_PRECEDENCE, // <<, >> + ADDINTERVAL_PRECEDENCE, // first argument in +INTERVAL + ADD_PRECEDENCE, // +, - + MUL_PRECEDENCE, // *, /, DIV, %, MOD + BITXOR_PRECEDENCE, // ^ + PIPES_PRECEDENCE, // || (if PIPES_AS_CONCAT) + NEG_PRECEDENCE, // unary -, ~ + BANG_PRECEDENCE, // !, NOT (if HIGH_NOT_PRECEDENCE) + COLLATE_PRECEDENCE, // BINARY, COLLATE + INTERVAL_PRECEDENCE, // INTERVAL + DEFAULT_PRECEDENCE, + HIGHEST_PRECEDENCE +}; typedef Bounds_checked_array Ref_ptr_array; @@ -742,9 +790,61 @@ public: supposed to be applied recursively. */ virtual inline void quick_fix_field() { fixed= 1; } + + bool store(struct st_value *value, ulonglong fuzzydate) + { + switch (cmp_type()) { + case INT_RESULT: + { + value->m_type= unsigned_flag ? DYN_COL_UINT : DYN_COL_INT; + value->value.m_longlong= val_int(); + break; + } + case REAL_RESULT: + { + value->m_type= DYN_COL_DOUBLE; + value->value.m_double= val_real(); + break; + } + case DECIMAL_RESULT: + { + value->m_type= DYN_COL_DECIMAL; + my_decimal *dec= val_decimal(&value->m_decimal); + if (dec != &value->m_decimal && !null_value) + my_decimal2decimal(dec, &value->m_decimal); + break; + } + case STRING_RESULT: + { + value->m_type= DYN_COL_STRING; + String *str= val_str(&value->m_string); + if (str != &value->m_string && !null_value) + value->m_string.set(str->ptr(), str->length(), str->charset()); + break; + } + case TIME_RESULT: + { + value->m_type= DYN_COL_DATETIME; + get_date(&value->value.m_time, fuzzydate); + break; + } + case ROW_RESULT: + DBUG_ASSERT(false); + null_value= true; + break; + } + if (null_value) + { + value->m_type= DYN_COL_NULL; + return true; + } + return false; + } + /* Function returns 1 on overflow and -1 on fatal errors */ int save_in_field_no_warnings(Field *field, bool no_conversions); virtual int save_in_field(Field *field, bool no_conversions); + virtual bool save_in_param(THD *thd, Item_param *param); virtual void save_org_in_field(Field *field, fast_field_copier data __attribute__ ((__unused__))) @@ -1187,13 +1287,13 @@ public: query and why they should be generated from the Item-tree, @see mysql_register_view(). */ - virtual inline void print(String *str, enum_query_type query_type) - { - str->append(full_name()); - } + virtual enum precedence precedence() const { return DEFAULT_PRECEDENCE; } + void print_parenthesised(String *str, enum_query_type query_type, + enum precedence parent_prec); + virtual void print(String *str, enum_query_type query_type); + void print_item_w_name(String *str, enum_query_type query_type); + void print_value(String *str); - void print_item_w_name(String *, enum_query_type query_type); - void print_value(String *); virtual void update_used_tables() {} virtual COND *build_equal_items(THD *thd, COND_EQUAL *inheited, bool link_item_fields, @@ -1383,6 +1483,7 @@ public: virtual void set_result_field(Field *field) {} virtual bool is_result_field() { return 0; } virtual bool is_bool_type() { return false; } + virtual bool is_json_type() { return false; } /* This is to handle printing of default values */ virtual bool need_parentheses_in_default() { return false; } virtual void save_in_result_field(bool no_conversions) {} @@ -1445,65 +1546,41 @@ public: (*traverser)(this, arg); } - /* - This is used to get the most recent version of any function in - an item tree. The version is the version where a MySQL function - was introduced in. So any function which is added should use - this function and set the int_arg to maximum of the input data - and their own version info. - */ - virtual bool intro_version(void *int_arg) { return 0; } - - virtual bool remove_dependence_processor(void * arg) { return 0; } + /*========= Item processors, to be used with Item::walk() ========*/ + virtual bool remove_dependence_processor(void *arg) { return 0; } virtual bool cleanup_processor(void *arg); - virtual bool collect_item_field_processor(void * arg) { return 0; } - virtual bool add_field_to_set_processor(void * arg) { return 0; } + virtual bool cleanup_excluding_const_fields_processor(void *arg) { return cleanup_processor(arg); } + virtual bool collect_item_field_processor(void *arg) { return 0; } + virtual bool collect_outer_ref_processor(void *arg) {return 0; } + virtual bool check_inner_refs_processor(void *arg) { return 0; } virtual bool find_item_in_field_list_processor(void *arg) { return 0; } virtual bool find_item_processor(void *arg); - virtual bool change_context_processor(void *context) { return 0; } - virtual bool reset_query_id_processor(void *query_id_arg) { return 0; } + virtual bool change_context_processor(void *arg) { return 0; } + virtual bool reset_query_id_processor(void *arg) { return 0; } virtual bool is_expensive_processor(void *arg) { return 0; } + + // FIXME reduce the number of "add field to bitmap" processors + virtual bool add_field_to_set_processor(void *arg) { return 0; } virtual bool register_field_in_read_map(void *arg) { return 0; } virtual bool register_field_in_write_map(void *arg) { return 0; } + virtual bool register_field_in_bitmap(void *arg) { return 0; } + virtual bool update_table_bitmaps_processor(void *arg) { return 0; } + virtual bool enumerate_field_refs_processor(void *arg) { return 0; } virtual bool mark_as_eliminated_processor(void *arg) { return 0; } virtual bool eliminate_subselect_processor(void *arg) { return 0; } virtual bool set_fake_select_as_master_processor(void *arg) { return 0; } - virtual bool update_table_bitmaps_processor(void *arg) { return 0; } virtual bool view_used_tables_processor(void *arg) { return 0; } - virtual bool eval_not_null_tables(void *opt_arg) { return 0; } - virtual bool is_subquery_processor (void *opt_arg) { return 0; } + virtual bool eval_not_null_tables(void *arg) { return 0; } + virtual bool is_subquery_processor(void *arg) { return 0; } virtual bool count_sargable_conds(void *arg) { return 0; } - virtual bool limit_index_condition_pushdown_processor(void *opt_arg) - { - return FALSE; - } - virtual bool exists2in_processor(void *opt_arg) { return 0; } - virtual bool find_selective_predicates_list_processor(void *opt_arg) - { return 0; } - virtual bool exclusive_dependence_on_table_processor(void *map) - { return 0; } - virtual bool exclusive_dependence_on_grouping_fields_processor(void *arg) - { return 0; } - - virtual Item *get_copy(THD *thd, MEM_ROOT *mem_root)=0; - - /* To call bool function for all arguments */ - struct bool_func_call_args - { - Item *original_func_item; - void (Item::*bool_function)(); - }; - - /* - The next function differs from the previous one that a bitmap to be updated - is passed as uchar *arg. - */ - virtual bool register_field_in_bitmap(void *arg) { return 0; } - - bool cache_const_expr_analyzer(uchar **arg); - Item* cache_const_expr_transformer(THD *thd, uchar *arg); - + virtual bool limit_index_condition_pushdown_processor(void *arg) { return 0; } + virtual bool exists2in_processor(void *arg) { return 0; } + virtual bool find_selective_predicates_list_processor(void *arg) { return 0; } + virtual bool exclusive_dependence_on_table_processor(void *arg) { return 0; } + virtual bool exclusive_dependence_on_grouping_fields_processor(void *arg) { return 0; } + virtual bool switch_to_nullable_fields_processor(void *arg) { return 0; } + virtual bool find_function_processor (void *arg) { return 0; } /* Check if a partition function is allowed SYNOPSIS @@ -1555,21 +1632,40 @@ public: assumes that there are no multi-byte collations amongst the partition fields. */ - virtual bool check_partition_func_processor(void *bool_arg) { return TRUE;} - /* - @brief - Processor used to mark virtual columns used in partitioning expression + virtual bool check_partition_func_processor(void *arg) { return 1;} + virtual bool vcol_in_partition_func_processor(void *arg) { return 0; } + /** Processor used to check acceptability of an item in the defining + expression for a virtual column - @param - arg always ignored + @param arg always ignored - @retval - FALSE always + @retval 0 the item is accepted in the definition of a virtual column + @retval 1 otherwise */ - virtual bool vcol_in_partition_func_processor(void *arg) + struct vcol_func_processor_result { - return FALSE; + uint errors; /* Bits of possible errors */ + const char *name; /* Not supported function */ + }; + virtual bool check_vcol_func_processor(void *arg) + { + return mark_unsupported_function(full_name(), arg, VCOL_IMPOSSIBLE); } + virtual bool check_field_expression_processor(void *arg) { return 0; } + virtual bool check_func_default_processor(void *arg) { return 0; } + /* + Check if an expression value has allowed arguments, like DATE/DATETIME + for date functions. Also used by partitioning code to reject + timezone-dependent expressions in a (sub)partitioning function. + */ + virtual bool check_valid_arguments_processor(void *arg) { return 0; } + virtual bool update_vcol_processor(void *arg) { return 0; } + /*============== End of Item processor list ======================*/ + + virtual Item *get_copy(THD *thd, MEM_ROOT *mem_root)=0; + + bool cache_const_expr_analyzer(uchar **arg); + Item* cache_const_expr_transformer(THD *thd, uchar *arg); virtual Item* propagate_equal_fields(THD*, const Context &, COND_EQUAL *) { @@ -1581,42 +1677,9 @@ public: COND_EQUAL *cond, Item **place); - /* - @brief - Processor used to check acceptability of an item in the defining - expression for a virtual column - - @param - arg always ignored - - @retval - FALSE the item is accepted in the definition of a virtual column - @retval - TRUE otherwise - */ - struct vcol_func_processor_result - { - uint errors; /* Bits of possible errors */ - const char *name; /* Not supported function */ - }; - virtual bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(full_name(), arg, VCOL_IMPOSSIBLE); - } - - virtual bool check_field_expression_processor(void *arg) { return FALSE; } - /* arg points to REPLACE_EQUAL_FIELD_ARG object */ virtual Item *replace_equal_field(THD *thd, uchar *arg) { return this; } - /* - Check if an expression value has allowed arguments, like DATE/DATETIME - for date functions. Also used by partitioning code to reject - timezone-dependent expressions in a (sub)partitioning function. - */ - virtual bool check_valid_arguments_processor(void *bool_arg) - { - return FALSE; - } + struct Collect_deps_prm { List *parameters; @@ -1626,31 +1689,6 @@ public: int nest_level; bool collect; }; - /** - Collect outer references - */ - virtual bool collect_outer_ref_processor(void *arg) {return FALSE; } - - /** - Find a function of a given type - - @param arg the function type to search (enum Item_func::Functype) - @return - @retval TRUE the function type we're searching for is found - @retval FALSE the function type wasn't found - - @description - This function can be used (together with Item::walk()) to find functions - in an item tree fragment. - */ - virtual bool find_function_processor (void *arg) - { - return FALSE; - } - - virtual bool check_inner_refs_processor(void *arg) { return FALSE; } - - virtual bool switch_to_nullable_fields_processor(void *arg) { return FALSE; } /* For SP local variable returns pointer to Item representing its @@ -2515,7 +2553,6 @@ public: { TABLE *tab= field->table; tab->covering_keys.intersect(field->part_of_key); - tab->merge_keys.merge(field->part_of_key); if (tab->read_set) bitmap_fast_test_and_set(tab->read_set, field->field_index); /* @@ -2563,12 +2600,15 @@ public: bool register_field_in_bitmap(void *arg); bool check_partition_func_processor(void *int_arg) {return FALSE;} bool vcol_in_partition_func_processor(void *bool_arg); + bool check_valid_arguments_processor(void *bool_arg); bool check_field_expression_processor(void *arg); bool enumerate_field_refs_processor(void *arg); bool update_table_bitmaps_processor(void *arg); bool switch_to_nullable_fields_processor(void *arg); + bool update_vcol_processor(void *arg); bool check_vcol_func_processor(void *arg) { + context= 0; return mark_unsupported_function(field_name, arg, VCOL_FIELD_REF); } void cleanup(); @@ -2587,6 +2627,9 @@ public: virtual void print(String *str, enum_query_type query_type); bool exclusive_dependence_on_table_processor(void *map); bool exclusive_dependence_on_grouping_fields_processor(void *arg); + bool cleanup_excluding_const_fields_processor(void *arg) + { return field && const_item() ? 0 : cleanup_processor(arg); } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } bool is_outer_field() const @@ -2724,9 +2767,57 @@ public: { NO_VALUE, NULL_VALUE, INT_VALUE, REAL_VALUE, STRING_VALUE, TIME_VALUE, LONG_DATA_VALUE, - DECIMAL_VALUE + DECIMAL_VALUE, DEFAULT_VALUE, IGNORE_VALUE } state; + struct CONVERSION_INFO + { + /* + Character sets conversion info for string values. + Character sets of client and connection defined at bind time are used + for all conversions, even if one of them is later changed (i.e. + between subsequent calls to mysql_stmt_execute). + */ + CHARSET_INFO *character_set_client; + CHARSET_INFO *character_set_of_placeholder; + /* + This points at character set of connection if conversion + to it is required (i. e. if placeholder typecode is not BLOB). + Otherwise it's equal to character_set_client (to simplify + check in convert_str_value()). + */ + CHARSET_INFO *final_character_set_of_str_value; + private: + bool needs_conversion() const + { + return final_character_set_of_str_value != + character_set_of_placeholder; + } + bool convert(THD *thd, String *str); + public: + void set(THD *thd, CHARSET_INFO *cs); + bool convert_if_needed(THD *thd, String *str) + { + /* + Check is so simple because all charsets were set up properly + in setup_one_conversion_function, where typecode of + placeholder was also taken into account: the variables are different + here only if conversion is really necessary. + */ + if (needs_conversion()) + return convert(thd, str); + str->set_charset(final_character_set_of_str_value); + return false; + } + }; + + /* + Used for bulk protocol. Indicates if we should expect + indicators byte before value of the parameter + */ + my_bool indicators; + enum enum_indicator_type indicator; + /* A buffer for string and long data values. Historically all allocated values returned from val_str() were treated as eligible to @@ -2743,24 +2834,7 @@ public: { longlong integer; double real; - /* - Character sets conversion info for string values. - Character sets of client and connection defined at bind time are used - for all conversions, even if one of them is later changed (i.e. - between subsequent calls to mysql_stmt_execute). - */ - struct CONVERSION_INFO - { - CHARSET_INFO *character_set_client; - CHARSET_INFO *character_set_of_placeholder; - /* - This points at character set of connection if conversion - to it is required (i. e. if placeholder typecode is not BLOB). - Otherwise it's equal to character_set_client (to simplify - check in convert_str_value()). - */ - CHARSET_INFO *final_character_set_of_str_value; - } cs_info; + CONVERSION_INFO cs_info; MYSQL_TIME time; } value; @@ -2784,6 +2858,8 @@ public: bool get_date(MYSQL_TIME *tm, ulonglong fuzzydate); int save_in_field(Field *field, bool no_conversions); + void set_default(); + void set_ignore(); void set_null(); void set_int(longlong i, uint32 max_length_arg); void set_double(double i); @@ -2792,7 +2868,7 @@ public: bool set_str(const char *str, ulong length); bool set_longdata(const char *str, ulong length); void set_time(MYSQL_TIME *tm, timestamp_type type, uint32 max_length_arg); - bool set_from_user_var(THD *thd, const user_var_entry *entry); + bool set_from_item(THD *thd, Item *item); void reset(); /* Assign placeholder value from bind data. @@ -2847,6 +2923,8 @@ public: Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return 0; } private: + void invalid_default_param() const; + virtual bool set_value(THD *thd, sp_rcontext *ctx, Item **it); virtual void set_out_param_info(Send_field *info); @@ -2899,6 +2977,21 @@ public: }; +/* + We sometimes need to distinguish a number from a boolean: + a[1] and a[true] are different things in XPath. + Also in JSON boolean values should be treated differently. +*/ +class Item_bool :public Item_int +{ +public: + Item_bool(THD *thd, const char *str_arg, longlong i): + Item_int(thd, str_arg, i, 1) {} + bool is_bool_type() { return true; } + Item *neg_transformer(THD *thd); +}; + + class Item_uint :public Item_int { public: @@ -3279,9 +3372,11 @@ public: } bool check_partition_func_processor(void *int_arg) {return TRUE;} - bool check_vcol_func_processor(void *arg) - { - return mark_unsupported_function(func_name, arg, VCOL_IMPOSSIBLE); + + bool check_vcol_func_processor(void *arg) + { // VCOL_TIME_FUNC because the value is not constant, but does not + // require fix_fields() to be re-run for every statement. + return mark_unsupported_function(func_name, arg, VCOL_TIME_FUNC); } }; @@ -4151,6 +4246,18 @@ public: } Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } + bool exclusive_dependence_on_table_processor(void *map) + { return depended_from != NULL; } + bool exclusive_dependence_on_grouping_fields_processor(void *arg) + { return depended_from != NULL; } + bool cleanup_excluding_const_fields_processor(void *arg) + { + Item *item= real_item(); + if (item && item->type() == FIELD_ITEM && + ((Item_field *) item)->field && item->const_item()) + return 0; + return cleanup_processor(arg); + } }; @@ -4349,7 +4456,7 @@ public: if (result_type() == ROW_RESULT) orig_item->bring_value(); } - virtual bool is_expensive() { return orig_item->is_expensive(); } + bool is_expensive() { return orig_item->is_expensive(); } bool is_expensive_processor(void *arg) { return orig_item->is_expensive_processor(arg); } bool check_vcol_func_processor(void *arg) @@ -4652,6 +4759,7 @@ public: #include "item_timefunc.h" #include "item_subselect.h" #include "item_xmlfunc.h" +#include "item_jsonfunc.h" #include "item_create.h" #endif @@ -4988,6 +5096,10 @@ public: :Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL, (const char *)NULL), arg(a) {} + Item_default_value(THD *thd, Name_resolution_context *context_arg, Field *a) + :Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL, + (const char *)NULL), + arg(NULL) {} enum Type type() const { return DEFAULT_VALUE_ITEM; } bool eq(const Item *item, bool binary_cmp) const; bool fix_fields(THD *, Item **); @@ -4999,8 +5111,19 @@ public: bool get_date(MYSQL_TIME *ltime,ulonglong fuzzydate); bool send(Protocol *protocol, String *buffer); int save_in_field(Field *field_arg, bool no_conversions); + bool save_in_param(THD *thd, Item_param *param) + { + // It should not be possible to have "EXECUTE .. USING DEFAULT(a)" + DBUG_ASSERT(arg == NULL); + param->set_default(); + return false; + } table_map used_tables() const { return (table_map)0L; } + Field *get_tmp_table_field() { return 0; } + Item *get_tmp_table_item(THD *thd) { return this; } Item_field *field_for_view_update() { return 0; } + bool update_vcol_processor(void *arg) { return 0; } + bool check_func_default_processor(void *arg) { return true; } bool walk(Item_processor processor, bool walk_subquery, void *args) { @@ -5011,6 +5134,37 @@ public: Item *transform(THD *thd, Item_transformer transformer, uchar *args); }; +/** + This class is used as bulk parameter INGNORE representation. + + It just do nothing when assigned to a field + +*/ + +class Item_ignore_value : public Item_default_value +{ +public: + Item_ignore_value(THD *thd, Name_resolution_context *context_arg) + :Item_default_value(thd, context_arg) + {}; + + void print(String *str, enum_query_type query_type); + int save_in_field(Field *field_arg, bool no_conversions); + bool save_in_param(THD *thd, Item_param *param) + { + param->set_ignore(); + return false; + } + + String *val_str(String *str); + double val_real(); + longlong val_int(); + my_decimal *val_decimal(my_decimal *decimal_value); + bool get_date(MYSQL_TIME *ltime,ulonglong fuzzydate); + bool send(Protocol *protocol, String *buffer); +}; + + /* Item_insert_value -- an implementation of VALUES() function. You can use the VALUES(col_name) function in the UPDATE clause @@ -5043,12 +5197,15 @@ public: */ table_map used_tables() const { return RAND_TABLE_BIT; } + Item_field *field_for_view_update() { return 0; } + bool walk(Item_processor processor, bool walk_subquery, void *args) { return arg->walk(processor, walk_subquery, args) || (this->*processor)(args); } bool check_partition_func_processor(void *int_arg) {return TRUE;} + bool update_vcol_processor(void *arg) { return 0; } bool check_vcol_func_processor(void *arg) { return mark_unsupported_function("values()", arg, VCOL_IMPOSSIBLE); @@ -5269,6 +5426,14 @@ public: example->split_sum_func2(thd, ref_pointer_array, fields, &example, flags); } Item *get_example() const { return example; } + + virtual Item *convert_to_basic_const_item(THD *thd) { return 0; }; + Item *derived_field_transformer_for_having(THD *thd, uchar *arg) + { return convert_to_basic_const_item(thd); } + Item *derived_field_transformer_for_where(THD *thd, uchar *arg) + { return convert_to_basic_const_item(thd); } + Item *derived_grouping_field_transformer_for_where(THD *thd, uchar *arg) + { return convert_to_basic_const_item(thd); } }; @@ -5289,6 +5454,7 @@ public: enum Item_result result_type() const { return INT_RESULT; } bool cache_value(); int save_in_field(Field *field, bool no_conversions); + Item *convert_to_basic_const_item(THD *thd); Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } }; @@ -5315,6 +5481,7 @@ public: Important when storing packed datetime values. */ Item *clone_item(THD *thd); + Item *convert_to_basic_const_item(THD *thd); Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } }; @@ -5333,6 +5500,7 @@ public: my_decimal *val_decimal(my_decimal *); enum Item_result result_type() const { return REAL_RESULT; } bool cache_value(); + Item *convert_to_basic_const_item(THD *thd); Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } }; @@ -5351,6 +5519,7 @@ public: my_decimal *val_decimal(my_decimal *); enum Item_result result_type() const { return DECIMAL_RESULT; } bool cache_value(); + Item *convert_to_basic_const_item(THD *thd); Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } }; @@ -5379,6 +5548,7 @@ public: CHARSET_INFO *charset() const { return value->charset(); }; int save_in_field(Field *field, bool no_conversions); bool cache_value(); + Item *convert_to_basic_const_item(THD *thd); Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } }; @@ -5637,4 +5807,21 @@ public: void close() {} }; + +/* + It's used in ::fix_fields() methods of LIKE and JSON_SEARCH + functions to handle the ESCAPE parameter. + This parameter is quite non-standard so the specific function. +*/ +bool fix_escape_item(THD *thd, Item *escape_item, String *tmp_str, + bool escape_used_in_parsing, CHARSET_INFO *cmp_cs, + int *escape); + +inline bool Virtual_column_info::is_equal(const Virtual_column_info* vcol) const +{ + return field_type == vcol->get_real_type() + && stored_in_db == vcol->is_stored() + && expr->eq(vcol->expr, true); +} + #endif /* SQL_ITEM_INCLUDED */ diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 193af8631ba..2856cea0697 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -286,20 +286,10 @@ longlong Item_func_not::val_int() return ((!null_value && value == 0) ? 1 : 0); } -/* - We put any NOT expression into parenthesis to avoid - possible problems with internal view representations where - any '!' is converted to NOT. It may cause a problem if - '!' is used in an expression together with other operators - whose precedence is lower than the precedence of '!' yet - higher than the precedence of NOT. -*/ - void Item_func_not::print(String *str, enum_query_type query_type) { - str->append('('); - Item_func::print(str, query_type); - str->append(')'); + str->append('!'); + args[0]->print_parenthesised(str, query_type, precedence()); } /** @@ -1167,8 +1157,7 @@ void Item_func_truth::fix_length_and_dec() void Item_func_truth::print(String *str, enum_query_type query_type) { - str->append('('); - args[0]->print(str, query_type); + args[0]->print_parenthesised(str, query_type, precedence()); str->append(STRING_WITH_LEN(" is ")); if (! affirmative) str->append(STRING_WITH_LEN("not ")); @@ -1176,7 +1165,6 @@ void Item_func_truth::print(String *str, enum_query_type query_type) str->append(STRING_WITH_LEN("true")); else str->append(STRING_WITH_LEN("false")); - str->append(')'); } @@ -2240,15 +2228,13 @@ longlong Item_func_between::val_int() void Item_func_between::print(String *str, enum_query_type query_type) { - str->append('('); - args[0]->print(str, query_type); + args[0]->print_parenthesised(str, query_type, precedence()); if (negated) str->append(STRING_WITH_LEN(" not")); str->append(STRING_WITH_LEN(" between ")); - args[1]->print(str, query_type); + args[1]->print_parenthesised(str, query_type, precedence()); str->append(STRING_WITH_LEN(" and ")); - args[2]->print(str, query_type); - str->append(')'); + args[2]->print_parenthesised(str, query_type, precedence()); } @@ -2552,7 +2538,7 @@ Item_func_nullif::fix_length_and_dec() See also class Item_func_nullif declaration. */ if (arg_count == 2) - args[arg_count++]= args[0]; + args[arg_count++]= m_arg0 ? m_arg0 : args[0]; THD *thd= current_thd; /* @@ -2703,7 +2689,47 @@ Item_func_nullif::fix_length_and_dec() unsigned_flag= args[2]->unsigned_flag; fix_char_length(args[2]->max_char_length()); maybe_null=1; + m_arg0= args[0]; setup_args_and_comparator(thd, &cmp); + /* + A special code for EXECUTE..PREPARE. + + If args[0] did not change, then we don't remember it, as it can point + to a temporary Item object which will be destroyed between PREPARE + and EXECUTE. EXECUTE time fix_length_and_dec() will correctly set args[2] + from args[0] again. + + If args[0] changed, then it can be Item_func_conv_charset() for the + original args[0], which was permanently installed during PREPARE time + into the item tree as a wrapper for args[0], using change_item_tree(), i.e. + + NULLIF(latin1_field, 'a' COLLATE utf8_bin) + + was "rewritten" to: + + CASE WHEN CONVERT(latin1_field USING utf8) = 'a' COLLATE utf8_bin + THEN NULL + ELSE latin1_field + + - m_args0 points to Item_field corresponding to latin1_field + - args[0] points to Item_func_conv_charset + - args[0]->args[0] is equal to m_args0 + - args[1] points to Item_func_set_collation + - args[2] points is eqial to m_args0 + + In this case we remember and reuse m_arg0 during EXECUTE time as args[2]. + + QQ: How to make sure that m_args0 does not point + to something temporary which will be destoyed between PREPARE and EXECUTE. + The condition below should probably be more strict and somehow check that: + - change_item_tree() was called for the new args[0] + - m_args0 is referenced from inside args[0], e.g. as a function argument, + and therefore it is also something that won't be destroyed between + PREPARE and EXECUTE. + Any ideas? + */ + if (args[0] == m_arg0) + m_arg0= NULL; } @@ -3301,27 +3327,27 @@ uint Item_func_case::decimal_precision() const void Item_func_case::print(String *str, enum_query_type query_type) { - str->append(STRING_WITH_LEN("(case ")); + str->append(STRING_WITH_LEN("case ")); if (first_expr_num != -1) { - args[first_expr_num]->print(str, query_type); + args[first_expr_num]->print_parenthesised(str, query_type, precedence()); str->append(' '); } for (uint i=0 ; i < ncases ; i+=2) { str->append(STRING_WITH_LEN("when ")); - args[i]->print(str, query_type); + args[i]->print_parenthesised(str, query_type, precedence()); str->append(STRING_WITH_LEN(" then ")); - args[i+1]->print(str, query_type); + args[i+1]->print_parenthesised(str, query_type, precedence()); str->append(' '); } if (else_expr_num != -1) { str->append(STRING_WITH_LEN("else ")); - args[else_expr_num]->print(str, query_type); + args[else_expr_num]->print_parenthesised(str, query_type, precedence()); str->append(' '); } - str->append(STRING_WITH_LEN("end)")); + str->append(STRING_WITH_LEN("end")); } @@ -4299,13 +4325,12 @@ void Item_func_in::fix_length_and_dec() void Item_func_in::print(String *str, enum_query_type query_type) { - str->append('('); - args[0]->print(str, query_type); + args[0]->print_parenthesised(str, query_type, precedence()); if (negated) str->append(STRING_WITH_LEN(" not")); str->append(STRING_WITH_LEN(" in (")); print_args(str, 1, query_type); - str->append(STRING_WITH_LEN("))")); + str->append(STRING_WITH_LEN(")")); } @@ -4509,7 +4534,8 @@ Item_cond::fix_fields(THD *thd, Item **ref) was: become: = 1 */ - if (item->type() == FIELD_ITEM) + Item::Type type= item->type(); + if (type == Item::FIELD_ITEM || type == Item::REF_ITEM) { Query_arena backup, *arena; Item *new_item; @@ -4823,19 +4849,17 @@ Item_cond::used_tables() const void Item_cond::print(String *str, enum_query_type query_type) { - str->append('('); List_iterator_fast li(list); Item *item; if ((item=li++)) - item->print(str, query_type); + item->print_parenthesised(str, query_type, precedence()); while ((item=li++)) { str->append(' '); str->append(func_name()); str->append(' '); - item->print(str, query_type); + item->print_parenthesised(str, query_type, precedence()); } - str->append(')'); } @@ -5027,6 +5051,13 @@ longlong Item_func_isnull::val_int() } +void Item_func_isnull::print(String *str, enum_query_type query_type) +{ + args[0]->print_parenthesised(str, query_type, precedence()); + str->append(STRING_WITH_LEN(" is null")); +} + + longlong Item_is_not_null_test::val_int() { DBUG_ASSERT(fixed == 1); @@ -5064,9 +5095,8 @@ longlong Item_func_isnotnull::val_int() void Item_func_isnotnull::print(String *str, enum_query_type query_type) { - str->append('('); - args[0]->print(str, query_type); - str->append(STRING_WITH_LEN(" is not null)")); + args[0]->print_parenthesised(str, query_type, precedence()); + str->append(STRING_WITH_LEN(" is not null")); } @@ -5076,6 +5106,22 @@ bool Item_bool_func2::count_sargable_conds(void *arg) return 0; } +void Item_func_like::print(String *str, enum_query_type query_type) +{ + args[0]->print_parenthesised(str, query_type, precedence()); + str->append(' '); + if (negated) + str->append(STRING_WITH_LEN(" not ")); + str->append(func_name()); + str->append(' '); + args[1]->print_parenthesised(str, query_type, precedence()); + if (escape_used_in_parsing) + { + str->append(STRING_WITH_LEN(" escape ")); + escape_item->print(str, query_type); + } +} + longlong Item_func_like::val_int() { @@ -5094,11 +5140,11 @@ longlong Item_func_like::val_int() } null_value=0; if (canDoTurboBM) - return turboBM_matches(res->ptr(), res->length()) ? 1 : 0; + return turboBM_matches(res->ptr(), res->length()) ? !negated : negated; return my_wildcmp(cmp_collation.collation, res->ptr(),res->ptr()+res->length(), res2->ptr(),res2->ptr()+res2->length(), - escape,wild_one,wild_many) ? 0 : 1; + escape,wild_one,wild_many) ? negated : !negated; } @@ -5108,6 +5154,9 @@ longlong Item_func_like::val_int() bool Item_func_like::with_sargable_pattern() const { + if (negated) + return false; + if (!args[1]->const_item() || args[1]->is_expensive()) return false; @@ -5124,13 +5173,10 @@ bool Item_func_like::with_sargable_pattern() const } -bool Item_func_like::fix_fields(THD *thd, Item **ref) +bool fix_escape_item(THD *thd, Item *escape_item, String *tmp_str, + bool escape_used_in_parsing, CHARSET_INFO *cmp_cs, + int *escape) { - DBUG_ASSERT(fixed == 0); - if (Item_bool_func2::fix_fields(thd, ref) || - escape_item->fix_fields(thd, &escape_item)) - return TRUE; - if (!escape_item->const_during_execution()) { my_error(ER_WRONG_ARGUMENTS,MYF(0),"ESCAPE"); @@ -5140,7 +5186,7 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref) if (escape_item->const_item()) { /* If we are on execution stage */ - String *escape_str= escape_item->val_str(&cmp_value1); + String *escape_str= escape_item->val_str(tmp_str); if (escape_str) { const char *escape_str_ptr= escape_str->ptr(); @@ -5153,7 +5199,7 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref) return TRUE; } - if (use_mb(cmp_collation.collation)) + if (use_mb(cmp_cs)) { CHARSET_INFO *cs= escape_str->charset(); my_wc_t wc; @@ -5161,7 +5207,7 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref) (const uchar*) escape_str_ptr, (const uchar*) escape_str_ptr + escape_str->length()); - escape= (int) (rc > 0 ? wc : '\\'); + *escape= (int) (rc > 0 ? wc : '\\'); } else { @@ -5170,25 +5216,40 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref) code instead of Unicode code as "escape" argument. Convert to "cs" if charset of escape differs. */ - CHARSET_INFO *cs= cmp_collation.collation; uint32 unused; if (escape_str->needs_conversion(escape_str->length(), - escape_str->charset(), cs, &unused)) + escape_str->charset(),cmp_cs,&unused)) { char ch; uint errors; - uint32 cnvlen= copy_and_convert(&ch, 1, cs, escape_str_ptr, + uint32 cnvlen= copy_and_convert(&ch, 1, cmp_cs, escape_str_ptr, escape_str->length(), escape_str->charset(), &errors); - escape= cnvlen ? ch : '\\'; + *escape= cnvlen ? ch : '\\'; } else - escape= escape_str_ptr ? *escape_str_ptr : '\\'; + *escape= escape_str_ptr ? *escape_str_ptr : '\\'; } } else - escape= '\\'; + *escape= '\\'; + } + return FALSE; +} + + +bool Item_func_like::fix_fields(THD *thd, Item **ref) +{ + DBUG_ASSERT(fixed == 0); + if (Item_bool_func2::fix_fields(thd, ref) || + escape_item->fix_fields(thd, &escape_item) || + fix_escape_item(thd, escape_item, &cmp_value1, escape_used_in_parsing, + cmp_collation.collation, &escape)) + return TRUE; + + if (escape_item->const_item()) + { /* We could also do boyer-more for non-const items, but as we would have to recompute the tables for each row it's not worth it. diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 6d432bd97f3..7774663bd57 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -215,6 +215,7 @@ public: virtual longlong val_int(); virtual void fix_length_and_dec(); virtual void print(String *str, enum_query_type query_type); + enum precedence precedence() const { return CMP_PRECEDENCE; } protected: Item_func_truth(THD *thd, Item *a, bool a_value, bool a_affirmative): @@ -480,6 +481,7 @@ public: { Item_func::print_op(str, query_type); } + enum precedence precedence() const { return CMP_PRECEDENCE; } Item *neg_transformer(THD *thd); virtual Item *negated_item(THD *thd); Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) @@ -535,6 +537,7 @@ public: Item_func_xor(THD *thd, Item *i1, Item *i2): Item_bool_func(thd, i1, i2) {} enum Functype functype() const { return XOR_FUNC; } const char *func_name() const { return "xor"; } + enum precedence precedence() const { return XOR_PRECEDENCE; } void print(String *str, enum_query_type query_type) { Item_func::print_op(str, query_type); } longlong val_int(); @@ -559,6 +562,7 @@ public: longlong val_int(); enum Functype functype() const { return NOT_FUNC; } const char *func_name() const { return "not"; } + enum precedence precedence() const { return BANG_PRECEDENCE; } Item *neg_transformer(THD *thd); bool fix_fields(THD *, Item **); virtual void print(String *str, enum_query_type query_type); @@ -649,6 +653,8 @@ public: longlong val_int(); const char *func_name() const { return ""; } Item *neg_transformer(THD *thd); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy(thd, mem_root, this); } }; @@ -837,7 +843,6 @@ public: Item_func_opt_neg(THD *thd, List &list): Item_bool_func(thd, list), negated(0), pred_level(0) {} public: - inline void negate() { negated= !negated; } inline void top_level_item() { pred_level= 1; } bool is_top_level_item() const { return pred_level; } Item *neg_transformer(THD *thd) @@ -865,6 +870,7 @@ public: longlong val_int(); enum Functype functype() const { return BETWEEN; } const char *func_name() const { return "between"; } + enum precedence precedence() const { return BETWEEN_PRECEDENCE; } void fix_length_and_dec(); virtual void print(String *str, enum_query_type query_type); bool eval_not_null_tables(void *opt_arg); @@ -1064,6 +1070,12 @@ class Item_func_nullif :public Item_func_hybrid_field_type */ Item_cache *m_cache; int compare(); + void reset_first_arg_if_needed() + { + if (arg_count == 3 && args[0] != args[2]) + args[0]= args[2]; + } + Item *m_arg0; public: /* Here we pass three arguments to the parent constructor, as NULLIF @@ -1075,8 +1087,14 @@ public: */ Item_func_nullif(THD *thd, Item *a, Item *b): Item_func_hybrid_field_type(thd, a, b, a), - m_cache(NULL) + m_cache(NULL), + m_arg0(NULL) { arg_count--; } + void cleanup() + { + Item_func_hybrid_field_type::cleanup(); + arg_count= 2; // See the comment to the constructor + } bool date_op(MYSQL_TIME *ltime, uint fuzzydate); double real_op(); longlong int_op(); @@ -1114,6 +1132,12 @@ public: } Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } + Item *derived_field_transformer_for_having(THD *thd, uchar *arg) + { reset_first_arg_if_needed(); return this; } + Item *derived_field_transformer_for_where(THD *thd, uchar *arg) + { reset_first_arg_if_needed(); return this; } + Item *derived_grouping_field_transformer_for_where(THD *thd, uchar *arg) + { reset_first_arg_if_needed(); return this; } }; @@ -1549,6 +1573,7 @@ public: uint decimal_precision() const; table_map not_null_tables() const { return 0; } const char *func_name() const { return "case"; } + enum precedence precedence() const { return BETWEEN_PRECEDENCE; } virtual void print(String *str, enum_query_type query_type); Item *find_item(String *str); CHARSET_INFO *compare_collation() const { return cmp_collation.collation; } @@ -1660,7 +1685,8 @@ public: } virtual void print(String *str, enum_query_type query_type); enum Functype functype() const { return IN_FUNC; } - const char *func_name() const { return " IN "; } + const char *func_name() const { return "in"; } + enum precedence precedence() const { return CMP_PRECEDENCE; } bool eval_not_null_tables(void *opt_arg); void fix_after_pullout(st_select_lex *new_parent, Item **ref); bool count_sargable_conds(void *arg); @@ -1751,10 +1777,28 @@ public: update_used_tables(); } const char *func_name() const { return "isnull"; } + void print(String *str, enum_query_type query_type); + enum precedence precedence() const { return CMP_PRECEDENCE; } + + bool arg_is_datetime_notnull_field() + { + Item **args= arguments(); + if (args[0]->type() == Item::FIELD_ITEM) + { + Field *field=((Item_field*) args[0])->field; + + if (((field->type() == MYSQL_TYPE_DATE) || + (field->type() == MYSQL_TYPE_DATETIME)) && + (field->flags & NOT_NULL_FLAG)) + return true; + } + return false; + } + /* Optimize case of not_null_column IS NULL */ virtual void update_used_tables() { - if (!args[0]->maybe_null) + if (!args[0]->maybe_null && !arg_is_datetime_notnull_field()) { used_tables_cache= 0; /* is always false */ const_item_cache= 1; @@ -1812,10 +1856,11 @@ public: longlong val_int(); enum Functype functype() const { return ISNOTNULL_FUNC; } const char *func_name() const { return "isnotnull"; } + enum precedence precedence() const { return CMP_PRECEDENCE; } table_map not_null_tables() const { return abort_on_null ? not_null_tables_cache : 0; } Item *neg_transformer(THD *thd); - virtual void print(String *str, enum_query_type query_type); + void print(String *str, enum_query_type query_type); void top_level_item() { abort_on_null=1; } Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } @@ -1843,6 +1888,7 @@ class Item_func_like :public Item_bool_func2 bool escape_used_in_parsing; bool use_sampling; + bool negated; DTCollation cmp_collation; String cmp_value1, cmp_value2; @@ -1863,13 +1909,10 @@ public: Item_func_like(THD *thd, Item *a, Item *b, Item *escape_arg, bool escape_used): Item_bool_func2(thd, a, b), canDoTurboBM(FALSE), pattern(0), pattern_len(0), bmGs(0), bmBc(0), escape_item(escape_arg), - escape_used_in_parsing(escape_used), use_sampling(0) {} + escape_used_in_parsing(escape_used), use_sampling(0), negated(0) {} longlong val_int(); enum Functype functype() const { return LIKE_FUNC; } - void print(String *str, enum_query_type query_type) - { - Item_func::print_op(str, query_type); - } + void print(String *str, enum_query_type query_type); CHARSET_INFO *compare_collation() const { return cmp_collation.collation; } cond_result eq_cmp_result() const @@ -1949,6 +1992,7 @@ public: return this; } const char *func_name() const { return "like"; } + enum precedence precedence() const { return CMP_PRECEDENCE; } bool fix_fields(THD *thd, Item **ref); void fix_length_and_dec() { @@ -1957,6 +2001,12 @@ public: } void cleanup(); + Item *neg_transformer(THD *thd) + { + negated= !negated; + return this; + } + bool find_selective_predicates_list_processor(void *arg); Item *get_copy(THD *thd, MEM_ROOT *mem_root) @@ -2066,10 +2116,11 @@ public: longlong val_int(); void fix_length_and_dec(); const char *func_name() const { return "regexp"; } + enum precedence precedence() const { return CMP_PRECEDENCE; } Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } - virtual inline void print(String *str, enum_query_type query_type) + void print(String *str, enum_query_type query_type) { print_op(str, query_type); } @@ -2480,6 +2531,7 @@ public: enum Functype functype() const { return COND_AND_FUNC; } longlong val_int(); const char *func_name() const { return "and"; } + enum precedence precedence() const { return AND_PRECEDENCE; } table_map not_null_tables() const { return abort_on_null ? not_null_tables_cache: and_tables_cache; } Item *copy_andor_structure(THD *thd); @@ -2515,6 +2567,7 @@ public: enum Functype functype() const { return COND_OR_FUNC; } longlong val_int(); const char *func_name() const { return "or"; } + enum precedence precedence() const { return OR_PRECEDENCE; } table_map not_null_tables() const { return and_tables_cache; } Item *copy_andor_structure(THD *thd); Item *neg_transformer(THD *thd); @@ -2665,4 +2718,3 @@ extern Ge_creator ge_creator; extern Le_creator le_creator; #endif /* ITEM_CMPFUNC_INCLUDED */ - diff --git a/sql/item_create.cc b/sql/item_create.cc index 7f0d4144177..a506ab948d1 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -1708,6 +1708,305 @@ protected: #endif +class Create_func_json_exists : public Create_func_arg2 +{ +public: + virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + + static Create_func_json_exists s_singleton; + +protected: + Create_func_json_exists() {} + virtual ~Create_func_json_exists() {} +}; + + +class Create_func_json_valid : public Create_func_arg1 +{ +public: + virtual Item *create_1_arg(THD *thd, Item *arg1); + + static Create_func_json_valid s_singleton; + +protected: + Create_func_json_valid() {} + virtual ~Create_func_json_valid() {} +}; + + +class Create_func_json_type : public Create_func_arg1 +{ +public: + virtual Item *create_1_arg(THD *thd, Item *arg1); + + static Create_func_json_type s_singleton; + +protected: + Create_func_json_type() {} + virtual ~Create_func_json_type() {} +}; + + +class Create_func_json_depth : public Create_func_arg1 +{ +public: + virtual Item *create_1_arg(THD *thd, Item *arg1); + + static Create_func_json_depth s_singleton; + +protected: + Create_func_json_depth() {} + virtual ~Create_func_json_depth() {} +}; + + +class Create_func_json_value : public Create_func_arg2 +{ +public: + virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + + static Create_func_json_value s_singleton; + +protected: + Create_func_json_value() {} + virtual ~Create_func_json_value() {} +}; + + +class Create_func_json_query : public Create_func_arg2 +{ +public: + virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + + static Create_func_json_query s_singleton; + +protected: + Create_func_json_query() {} + virtual ~Create_func_json_query() {} +}; + + +class Create_func_json_keys: public Create_native_func +{ +public: + virtual Item *create_native(THD *thd, LEX_STRING name, List *item_list); + + static Create_func_json_keys s_singleton; + +protected: + Create_func_json_keys() {} + virtual ~Create_func_json_keys() {} +}; + + +class Create_func_json_contains: public Create_native_func +{ +public: + virtual Item *create_native(THD *thd, LEX_STRING name, List *item_list); + + static Create_func_json_contains s_singleton; + +protected: + Create_func_json_contains() {} + virtual ~Create_func_json_contains() {} +}; + + +class Create_func_json_contains_path : public Create_native_func +{ +public: + virtual Item *create_native(THD *thd, LEX_STRING name, List *item_list); + + static Create_func_json_contains_path s_singleton; + +protected: + Create_func_json_contains_path() {} + virtual ~Create_func_json_contains_path() {} +}; + + +class Create_func_json_extract : public Create_native_func +{ +public: + virtual Item *create_native(THD *thd, LEX_STRING name, List *item_list); + + static Create_func_json_extract s_singleton; + +protected: + Create_func_json_extract() {} + virtual ~Create_func_json_extract() {} +}; + + +class Create_func_json_search : public Create_native_func +{ +public: + virtual Item *create_native(THD *thd, LEX_STRING name, List *item_list); + + static Create_func_json_search s_singleton; + +protected: + Create_func_json_search() {} + virtual ~Create_func_json_search() {} +}; + + +class Create_func_json_array : public Create_native_func +{ +public: + virtual Item *create_native(THD *thd, LEX_STRING name, List *item_list); + + static Create_func_json_array s_singleton; + +protected: + Create_func_json_array() {} + virtual ~Create_func_json_array() {} +}; + + +class Create_func_json_array_append : public Create_native_func +{ +public: + virtual Item *create_native(THD *thd, LEX_STRING name, List *item_list); + + static Create_func_json_array_append s_singleton; + +protected: + Create_func_json_array_append() {} + virtual ~Create_func_json_array_append() {} +}; + + +class Create_func_json_array_insert : public Create_native_func +{ +public: + virtual Item *create_native(THD *thd, LEX_STRING name, List *item_list); + + static Create_func_json_array_insert s_singleton; + +protected: + Create_func_json_array_insert() {} + virtual ~Create_func_json_array_insert() {} +}; + + +class Create_func_json_insert : public Create_native_func +{ +public: + virtual Item *create_native(THD *thd, LEX_STRING name, List *item_list); + + static Create_func_json_insert s_singleton; + +protected: + Create_func_json_insert() {} + virtual ~Create_func_json_insert() {} +}; + + +class Create_func_json_set : public Create_native_func +{ +public: + virtual Item *create_native(THD *thd, LEX_STRING name, List *item_list); + + static Create_func_json_set s_singleton; + +protected: + Create_func_json_set() {} + virtual ~Create_func_json_set() {} +}; + + +class Create_func_json_replace : public Create_native_func +{ +public: + virtual Item *create_native(THD *thd, LEX_STRING name, List *item_list); + + static Create_func_json_replace s_singleton; + +protected: + Create_func_json_replace() {} + virtual ~Create_func_json_replace() {} +}; + + +class Create_func_json_remove : public Create_native_func +{ +public: + virtual Item *create_native(THD *thd, LEX_STRING name, List *item_list); + + static Create_func_json_remove s_singleton; + +protected: + Create_func_json_remove() {} + virtual ~Create_func_json_remove() {} +}; + + +class Create_func_json_object : public Create_native_func +{ +public: + virtual Item *create_native(THD *thd, LEX_STRING name, List *item_list); + + static Create_func_json_object s_singleton; + +protected: + Create_func_json_object() {} + virtual ~Create_func_json_object() {} +}; + + +class Create_func_json_length : public Create_native_func +{ +public: + virtual Item *create_native(THD *thd, LEX_STRING name, List *item_list); + + static Create_func_json_length s_singleton; + +protected: + Create_func_json_length() {} + virtual ~Create_func_json_length() {} +}; + + +class Create_func_json_merge : public Create_native_func +{ +public: + virtual Item *create_native(THD *thd, LEX_STRING name, List *item_list); + + static Create_func_json_merge s_singleton; + +protected: + Create_func_json_merge() {} + virtual ~Create_func_json_merge() {} +}; + + +class Create_func_json_quote : public Create_func_arg1 +{ +public: + virtual Item *create_1_arg(THD *thd, Item *arg1); + + static Create_func_json_quote s_singleton; + +protected: + Create_func_json_quote() {} + virtual ~Create_func_json_quote() {} +}; + + +class Create_func_json_unquote : public Create_func_arg1 +{ +public: + virtual Item *create_1_arg(THD *thd, Item *arg1); + + static Create_func_json_unquote s_singleton; + +protected: + Create_func_json_unquote() {} + virtual ~Create_func_json_unquote() {} +}; + + class Create_func_last_day : public Create_func_arg1 { public: @@ -4572,6 +4871,78 @@ Create_func_issimple::create_1_arg(THD *thd, Item *arg1) #endif +Create_func_json_exists Create_func_json_exists::s_singleton; + +Item* +Create_func_json_exists::create_2_arg(THD *thd, Item *arg1, Item *arg2) +{ + return new (thd->mem_root) Item_func_json_exists(thd, arg1, arg2); +} + + +Create_func_json_valid Create_func_json_valid::s_singleton; + +Item* +Create_func_json_valid::create_1_arg(THD *thd, Item *arg1) +{ + return new (thd->mem_root) Item_func_json_valid(thd, arg1); +} + + +Create_func_json_type Create_func_json_type::s_singleton; + +Item* +Create_func_json_type::create_1_arg(THD *thd, Item *arg1) +{ + return new (thd->mem_root) Item_func_json_type(thd, arg1); +} + + +Create_func_json_depth Create_func_json_depth::s_singleton; + +Item* +Create_func_json_depth::create_1_arg(THD *thd, Item *arg1) +{ + return new (thd->mem_root) Item_func_json_depth(thd, arg1); +} + + +Create_func_json_value Create_func_json_value::s_singleton; + +Item* +Create_func_json_value::create_2_arg(THD *thd, Item *arg1, Item *arg2) +{ + return new (thd->mem_root) Item_func_json_value(thd, arg1, arg2); +} + + +Create_func_json_query Create_func_json_query::s_singleton; + +Item* +Create_func_json_query::create_2_arg(THD *thd, Item *arg1, Item *arg2) +{ + return new (thd->mem_root) Item_func_json_query(thd, arg1, arg2); +} + + +Create_func_json_quote Create_func_json_quote::s_singleton; + +Item* +Create_func_json_quote::create_1_arg(THD *thd, Item *arg1) +{ + return new (thd->mem_root) Item_func_json_quote(thd, arg1); +} + + +Create_func_json_unquote Create_func_json_unquote::s_singleton; + +Item* +Create_func_json_unquote::create_1_arg(THD *thd, Item *arg1) +{ + return new (thd->mem_root) Item_func_json_unquote(thd, arg1); +} + + Create_func_last_day Create_func_last_day::s_singleton; Item* @@ -4581,6 +4952,385 @@ Create_func_last_day::create_1_arg(THD *thd, Item *arg1) } +Create_func_json_array Create_func_json_array::s_singleton; + +Item* +Create_func_json_array::create_native(THD *thd, LEX_STRING name, + List *item_list) +{ + Item *func; + + if (item_list != NULL) + { + func= new (thd->mem_root) Item_func_json_array(thd, *item_list); + } + else + { + func= new (thd->mem_root) Item_func_json_array(thd); + } + + return func; +} + + +Create_func_json_array_append Create_func_json_array_append::s_singleton; + +Item* +Create_func_json_array_append::create_native(THD *thd, LEX_STRING name, + List *item_list) +{ + Item *func= NULL; + int arg_count= 0; + + if (item_list != NULL) + arg_count= item_list->elements; + + if (arg_count < 3 || (arg_count & 1) == 0 /*is even*/) + { + my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str); + } + else + { + func= new (thd->mem_root) Item_func_json_array_append(thd, *item_list); + } + + return func; +} + + +Create_func_json_array_insert Create_func_json_array_insert::s_singleton; + +Item* +Create_func_json_array_insert::create_native(THD *thd, LEX_STRING name, + List *item_list) +{ + Item *func= NULL; + int arg_count= 0; + + if (item_list != NULL) + arg_count= item_list->elements; + + if (arg_count < 3 || (arg_count & 1) == 0 /*is even*/) + { + my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str); + } + else + { + func= new (thd->mem_root) Item_func_json_array_insert(thd, *item_list); + } + + return func; +} + + +Create_func_json_insert Create_func_json_insert::s_singleton; + +Item* +Create_func_json_insert::create_native(THD *thd, LEX_STRING name, + List *item_list) +{ + Item *func= NULL; + int arg_count= 0; + + if (item_list != NULL) + arg_count= item_list->elements; + + if (arg_count < 3 || (arg_count & 1) == 0 /*is even*/) + { + my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str); + } + else + { + func= new (thd->mem_root) Item_func_json_insert(true, false, + thd, *item_list); + } + + return func; +} + + +Create_func_json_set Create_func_json_set::s_singleton; + +Item* +Create_func_json_set::create_native(THD *thd, LEX_STRING name, + List *item_list) +{ + Item *func= NULL; + int arg_count= 0; + + if (item_list != NULL) + arg_count= item_list->elements; + + if (arg_count < 3 || (arg_count & 1) == 0 /*is even*/) + { + my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str); + } + else + { + func= new (thd->mem_root) Item_func_json_insert(true, true, + thd, *item_list); + } + + return func; +} + + +Create_func_json_replace Create_func_json_replace::s_singleton; + +Item* +Create_func_json_replace::create_native(THD *thd, LEX_STRING name, + List *item_list) +{ + Item *func= NULL; + int arg_count= 0; + + if (item_list != NULL) + arg_count= item_list->elements; + + if (arg_count < 3 || (arg_count & 1) == 0 /*is even*/) + { + my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str); + } + else + { + func= new (thd->mem_root) Item_func_json_insert(false, true, + thd, *item_list); + } + + return func; +} + + +Create_func_json_remove Create_func_json_remove::s_singleton; + +Item* +Create_func_json_remove::create_native(THD *thd, LEX_STRING name, + List *item_list) +{ + Item *func= NULL; + int arg_count= 0; + + if (item_list != NULL) + arg_count= item_list->elements; + + if (arg_count < 2 /*json_doc, path [,path]*/) + { + my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str); + } + else + { + func= new (thd->mem_root) Item_func_json_remove(thd, *item_list); + } + + return func; +} + + +Create_func_json_object Create_func_json_object::s_singleton; + +Item* +Create_func_json_object::create_native(THD *thd, LEX_STRING name, + List *item_list) +{ + Item *func; + int arg_count; + + if (item_list != NULL) + { + arg_count= item_list->elements; + if ((arg_count & 1) != 0 /*is odd*/) + { + my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str); + func= NULL; + } + else + { + func= new (thd->mem_root) Item_func_json_object(thd, *item_list); + } + } + else + { + arg_count= 0; + func= new (thd->mem_root) Item_func_json_object(thd); + } + + return func; +} + + +Create_func_json_length Create_func_json_length::s_singleton; + +Item* +Create_func_json_length::create_native(THD *thd, LEX_STRING name, + List *item_list) +{ + Item *func; + int arg_count; + + if (item_list == NULL || + (arg_count= item_list->elements) == 0) + { + my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str); + func= NULL; + } + else + { + func= new (thd->mem_root) Item_func_json_length(thd, *item_list); + } + + return func; +} + + +Create_func_json_merge Create_func_json_merge::s_singleton; + +Item* +Create_func_json_merge::create_native(THD *thd, LEX_STRING name, + List *item_list) +{ + Item *func; + int arg_count; + + if (item_list == NULL || + (arg_count= item_list->elements) < 2) // json, json + { + my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str); + func= NULL; + } + else + { + func= new (thd->mem_root) Item_func_json_merge(thd, *item_list); + } + + return func; +} + + +Create_func_json_contains Create_func_json_contains::s_singleton; + +Item* +Create_func_json_contains::create_native(THD *thd, LEX_STRING name, + List *item_list) +{ + Item *func= NULL; + int arg_count= 0; + + if (item_list != NULL) + arg_count= item_list->elements; + + if (arg_count == 2 || arg_count == 3/* json_doc, val, [path] */) + { + func= new (thd->mem_root) Item_func_json_contains(thd, *item_list); + } + else + { + my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str); + } + + return func; +} + + +Create_func_json_keys Create_func_json_keys::s_singleton; + +Item* +Create_func_json_keys::create_native(THD *thd, LEX_STRING name, + List *item_list) +{ + Item *func= NULL; + int arg_count= 0; + + if (item_list != NULL) + arg_count= item_list->elements; + + if (arg_count < 1 || arg_count > 2 /* json_doc, [path]...*/) + { + my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str); + } + else + { + func= new (thd->mem_root) Item_func_json_keys(thd, *item_list); + } + + return func; +} + + +Create_func_json_contains_path Create_func_json_contains_path::s_singleton; + +Item* +Create_func_json_contains_path::create_native(THD *thd, LEX_STRING name, + List *item_list) +{ + Item *func= NULL; + int arg_count= 0; + + if (item_list != NULL) + arg_count= item_list->elements; + + if (arg_count < 3 /* json_doc, one_or_all, path, [path]...*/) + { + my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str); + } + else + { + func= new (thd->mem_root) Item_func_json_contains_path(thd, *item_list); + } + + return func; +} + + +Create_func_json_extract Create_func_json_extract::s_singleton; + +Item* +Create_func_json_extract::create_native(THD *thd, LEX_STRING name, + List *item_list) +{ + Item *func= NULL; + int arg_count= 0; + + if (item_list != NULL) + arg_count= item_list->elements; + + if (arg_count < 2 /* json_doc, path, [path]...*/) + { + my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str); + } + else + { + func= new (thd->mem_root) Item_func_json_extract(thd, *item_list); + } + + return func; +} + + +Create_func_json_search Create_func_json_search::s_singleton; + +Item* +Create_func_json_search::create_native(THD *thd, LEX_STRING name, + List *item_list) +{ + Item *func= NULL; + int arg_count= 0; + + if (item_list != NULL) + arg_count= item_list->elements; + + if (arg_count < 3 /* json_doc, one_or_all, search_str, [escape_char[, path]...*/) + { + my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str); + } + else + { + func= new (thd->mem_root) Item_func_json_search(thd, *item_list); + } + + return func; +} + + Create_func_last_insert_id Create_func_last_insert_id::s_singleton; Item* @@ -5615,7 +6365,7 @@ Create_func_weekofyear Create_func_weekofyear::s_singleton; Item* Create_func_weekofyear::create_1_arg(THD *thd, Item *arg1) { - Item *i1= new (thd->mem_root) Item_int(thd, (char*) "0", 3, 1); + Item *i1= new (thd->mem_root) Item_int(thd, (char*) "3", 3, 1); return new (thd->mem_root) Item_func_week(thd, arg1, i1); } @@ -5852,6 +6602,29 @@ static Native_func_registry func_array[] = { { C_STRING_WITH_LEN("ISSIMPLE") }, GEOM_BUILDER(Create_func_issimple)}, { { C_STRING_WITH_LEN("IS_FREE_LOCK") }, BUILDER(Create_func_is_free_lock)}, { { C_STRING_WITH_LEN("IS_USED_LOCK") }, BUILDER(Create_func_is_used_lock)}, + { { C_STRING_WITH_LEN("JSON_ARRAY") }, BUILDER(Create_func_json_array)}, + { { C_STRING_WITH_LEN("JSON_ARRAY_APPEND") }, BUILDER(Create_func_json_array_append)}, + { { C_STRING_WITH_LEN("JSON_ARRAY_INSERT") }, BUILDER(Create_func_json_array_insert)}, + { { C_STRING_WITH_LEN("JSON_CONTAINS") }, BUILDER(Create_func_json_contains)}, + { { C_STRING_WITH_LEN("JSON_CONTAINS_PATH") }, BUILDER(Create_func_json_contains_path)}, + { { C_STRING_WITH_LEN("JSON_DEPTH") }, BUILDER(Create_func_json_depth)}, + { { C_STRING_WITH_LEN("JSON_EXISTS") }, BUILDER(Create_func_json_exists)}, + { { C_STRING_WITH_LEN("JSON_EXTRACT") }, BUILDER(Create_func_json_extract)}, + { { C_STRING_WITH_LEN("JSON_INSERT") }, BUILDER(Create_func_json_insert)}, + { { C_STRING_WITH_LEN("JSON_KEYS") }, BUILDER(Create_func_json_keys)}, + { { C_STRING_WITH_LEN("JSON_LENGTH") }, BUILDER(Create_func_json_length)}, + { { C_STRING_WITH_LEN("JSON_MERGE") }, BUILDER(Create_func_json_merge)}, + { { C_STRING_WITH_LEN("JSON_QUERY") }, BUILDER(Create_func_json_query)}, + { { C_STRING_WITH_LEN("JSON_QUOTE") }, BUILDER(Create_func_json_quote)}, + { { C_STRING_WITH_LEN("JSON_OBJECT") }, BUILDER(Create_func_json_object)}, + { { C_STRING_WITH_LEN("JSON_REMOVE") }, BUILDER(Create_func_json_remove)}, + { { C_STRING_WITH_LEN("JSON_REPLACE") }, BUILDER(Create_func_json_replace)}, + { { C_STRING_WITH_LEN("JSON_SET") }, BUILDER(Create_func_json_set)}, + { { C_STRING_WITH_LEN("JSON_SEARCH") }, BUILDER(Create_func_json_search)}, + { { C_STRING_WITH_LEN("JSON_TYPE") }, BUILDER(Create_func_json_type)}, + { { C_STRING_WITH_LEN("JSON_UNQUOTE") }, BUILDER(Create_func_json_unquote)}, + { { C_STRING_WITH_LEN("JSON_VALID") }, BUILDER(Create_func_json_valid)}, + { { C_STRING_WITH_LEN("JSON_VALUE") }, BUILDER(Create_func_json_value)}, { { C_STRING_WITH_LEN("LAST_DAY") }, BUILDER(Create_func_last_day)}, { { C_STRING_WITH_LEN("LAST_INSERT_ID") }, BUILDER(Create_func_last_insert_id)}, { { C_STRING_WITH_LEN("LCASE") }, BUILDER(Create_func_lcase)}, @@ -5882,6 +6655,7 @@ static Native_func_registry func_array[] = { { C_STRING_WITH_LEN("MBRCONTAINS") }, GEOM_BUILDER(Create_func_mbr_contains)}, { { C_STRING_WITH_LEN("MBRDISJOINT") }, GEOM_BUILDER(Create_func_mbr_disjoint)}, { { C_STRING_WITH_LEN("MBREQUAL") }, GEOM_BUILDER(Create_func_mbr_equals)}, + { { C_STRING_WITH_LEN("MBREQUALS") }, GEOM_BUILDER(Create_func_mbr_equals)}, { { C_STRING_WITH_LEN("MBRINTERSECTS") }, GEOM_BUILDER(Create_func_mbr_intersects)}, { { C_STRING_WITH_LEN("MBROVERLAPS") }, GEOM_BUILDER(Create_func_mbr_overlaps)}, { { C_STRING_WITH_LEN("MBRTOUCHES") }, GEOM_BUILDER(Create_func_touches)}, @@ -6242,6 +7016,9 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type, res= new (thd->mem_root) Item_char_typecast(thd, a, len, real_cs); break; } + case ITEM_CAST_JSON: + res= new (thd->mem_root) Item_json_typecast(thd, a); + break; default: { DBUG_ASSERT(0); diff --git a/sql/item_func.cc b/sql/item_func.cc index 3b98dd0d345..c38bdba05c2 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -471,16 +471,14 @@ void Item_func::print_args(String *str, uint from, enum_query_type query_type) void Item_func::print_op(String *str, enum_query_type query_type) { - str->append('('); for (uint i=0 ; i < arg_count-1 ; i++) { - args[i]->print(str, query_type); + args[i]->print_parenthesised(str, query_type, precedence()); str->append(' '); str->append(func_name()); str->append(' '); } - args[arg_count-1]->print(str, query_type); - str->append(')'); + args[arg_count-1]->print_parenthesised(str, query_type, precedence()); } @@ -4747,7 +4745,7 @@ bool Item_func_set_user_var::register_field_in_read_map(void *arg) bitmap_set_bit(result_field->table->read_set, result_field->field_index); if (result_field->vcol_info) return result_field->vcol_info-> - expr_item->walk(&Item::register_field_in_read_map, 1, arg); + expr->walk(&Item::register_field_in_read_map, 1, arg); } return 0; } @@ -5245,11 +5243,10 @@ bool Item_func_set_user_var::is_null_result() void Item_func_set_user_var::print(String *str, enum_query_type query_type) { - str->append(STRING_WITH_LEN("(@")); + str->append(STRING_WITH_LEN("@")); str->append(name.str, name.length); str->append(STRING_WITH_LEN(":=")); - args[0]->print(str, query_type); - str->append(')'); + args[0]->print_parenthesised(str, query_type, precedence()); } @@ -5259,8 +5256,7 @@ void Item_func_set_user_var::print_as_stmt(String *str, str->append(STRING_WITH_LEN("set @")); str->append(name.str, name.length); str->append(STRING_WITH_LEN(":=")); - args[0]->print(str, query_type); - str->append(')'); + args[0]->print_parenthesised(str, query_type, precedence()); } bool Item_func_set_user_var::send(Protocol *protocol, String *str_arg) @@ -5629,9 +5625,8 @@ bool Item_func_get_user_var::const_item() const void Item_func_get_user_var::print(String *str, enum_query_type query_type) { - str->append(STRING_WITH_LEN("(@")); + str->append(STRING_WITH_LEN("@")); append_identifier(current_thd, str, name.str, name.length); - str->append(')'); } @@ -5841,7 +5836,22 @@ void Item_func_get_system_var::fix_length_and_dec() void Item_func_get_system_var::print(String *str, enum_query_type query_type) { - str->append(name, name_length); + if (name_length) + str->append(name, name_length); + else + { + str->append(STRING_WITH_LEN("@@")); + if (component.length) + { + str->append(&component); + str->append('.'); + } + else if (var_type == SHOW_OPT_GLOBAL && var->scope() != sys_var::GLOBAL) + { + str->append(STRING_WITH_LEN("global.")); + } + str->append(&var->name); + } } bool Item_func_get_system_var::check_vcol_func_processor(void *arg) @@ -6586,7 +6596,8 @@ Item_func_sp::init_result_field(THD *thd) bool Item_func_sp::is_expensive() { - return !(m_sp->m_chistics->detistic); + return !m_sp->m_chistics->detistic || + current_thd->locked_tables_mode < LTM_LOCK_TABLES; } diff --git a/sql/item_func.h b/sql/item_func.h index ca7c4819012..d4314f7bd6a 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -730,6 +730,7 @@ public: Item_func_plus(THD *thd, Item *a, Item *b): Item_func_additive_op(thd, a, b) {} const char *func_name() const { return "+"; } + enum precedence precedence() const { return ADD_PRECEDENCE; } longlong int_op(); double real_op(); my_decimal *decimal_op(my_decimal *); @@ -743,6 +744,7 @@ public: Item_func_minus(THD *thd, Item *a, Item *b): Item_func_additive_op(thd, a, b) {} const char *func_name() const { return "-"; } + enum precedence precedence() const { return ADD_PRECEDENCE; } longlong int_op(); double real_op(); my_decimal *decimal_op(my_decimal *); @@ -758,6 +760,7 @@ public: Item_func_mul(THD *thd, Item *a, Item *b): Item_num_op(thd, a, b) {} const char *func_name() const { return "*"; } + enum precedence precedence() const { return MUL_PRECEDENCE; } longlong int_op(); double real_op(); my_decimal *decimal_op(my_decimal *); @@ -778,6 +781,7 @@ public: double real_op(); my_decimal *decimal_op(my_decimal *); const char *func_name() const { return "/"; } + enum precedence precedence() const { return MUL_PRECEDENCE; } void fix_length_and_dec(); void result_precision(); Item *get_copy(THD *thd, MEM_ROOT *mem_root) @@ -792,9 +796,9 @@ public: {} longlong val_int(); const char *func_name() const { return "DIV"; } + enum precedence precedence() const { return MUL_PRECEDENCE; } void fix_length_and_dec(); - - virtual inline void print(String *str, enum_query_type query_type) + void print(String *str, enum_query_type query_type) { print_op(str, query_type); } @@ -815,6 +819,7 @@ public: double real_op(); my_decimal *decimal_op(my_decimal *); const char *func_name() const { return "%"; } + enum precedence precedence() const { return MUL_PRECEDENCE; } void result_precision(); void fix_length_and_dec(); bool check_partition_func_processor(void *int_arg) {return FALSE;} @@ -833,6 +838,12 @@ public: my_decimal *decimal_op(my_decimal *); const char *func_name() const { return "-"; } enum Functype functype() const { return NEG_FUNC; } + enum precedence precedence() const { return NEG_PRECEDENCE; } + void print(String *str, enum_query_type query_type) + { + str->append(func_name()); + args[0]->print_parenthesised(str, query_type, precedence()); + } void fix_length_and_dec(); uint decimal_precision() const { return args[0]->decimal_precision(); } bool check_partition_func_processor(void *int_arg) {return FALSE;} @@ -1353,6 +1364,7 @@ public: Item_func_bit_or(THD *thd, Item *a, Item *b): Item_func_bit(thd, a, b) {} longlong val_int(); const char *func_name() const { return "|"; } + enum precedence precedence() const { return BITOR_PRECEDENCE; } Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } }; @@ -1363,6 +1375,7 @@ public: Item_func_bit_and(THD *thd, Item *a, Item *b): Item_func_bit(thd, a, b) {} longlong val_int(); const char *func_name() const { return "&"; } + enum precedence precedence() const { return BITAND_PRECEDENCE; } Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } }; @@ -1384,6 +1397,7 @@ public: Item_func_shift_left(THD *thd, Item *a, Item *b): Item_func_bit(thd, a, b) {} longlong val_int(); const char *func_name() const { return "<<"; } + enum precedence precedence() const { return SHIFT_PRECEDENCE; } Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } }; @@ -1394,6 +1408,7 @@ public: Item_func_shift_right(THD *thd, Item *a, Item *b): Item_func_bit(thd, a, b) {} longlong val_int(); const char *func_name() const { return ">>"; } + enum precedence precedence() const { return SHIFT_PRECEDENCE; } Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } }; @@ -1404,10 +1419,11 @@ public: Item_func_bit_neg(THD *thd, Item *a): Item_func_bit(thd, a) {} longlong val_int(); const char *func_name() const { return "~"; } - - virtual inline void print(String *str, enum_query_type query_type) + enum precedence precedence() const { return NEG_PRECEDENCE; } + void print(String *str, enum_query_type query_type) { - Item_func::print(str, query_type); + str->append(func_name()); + args[0]->print_parenthesised(str, query_type, precedence()); } Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } @@ -1917,7 +1933,8 @@ public: } bool const_item() const { return 0; } bool is_expensive() { return 1; } - virtual void print(String *str, enum_query_type query_type); + void print(String *str, enum_query_type query_type); + enum precedence precedence() const { return ASSIGN_PRECEDENCE; } void print_as_stmt(String *str, enum_query_type query_type); const char *func_name() const { return "set_user_var"; } int save_in_field(Field *field, bool no_conversions, @@ -2155,6 +2172,7 @@ public: Item_func_bit_xor(THD *thd, Item *a, Item *b): Item_func_bit(thd, a, b) {} longlong val_int(); const char *func_name() const { return "^"; } + enum precedence precedence() const { return BITXOR_PRECEDENCE; } Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } }; @@ -2197,7 +2215,7 @@ enum Cast_target { ITEM_CAST_BINARY, ITEM_CAST_SIGNED_INT, ITEM_CAST_UNSIGNED_INT, ITEM_CAST_DATE, ITEM_CAST_TIME, ITEM_CAST_DATETIME, ITEM_CAST_CHAR, - ITEM_CAST_DECIMAL, ITEM_CAST_DOUBLE + ITEM_CAST_DECIMAL, ITEM_CAST_DOUBLE, ITEM_CAST_JSON }; diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index f96e570915e..1584090c29e 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -291,7 +291,7 @@ public: } } - const char *func_name() const { return "st_multipoint"; } + const char *func_name() const { return "geometrycollection"; } Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } }; diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc new file mode 100644 index 00000000000..9b9490a0cbc --- /dev/null +++ b/sql/item_jsonfunc.cc @@ -0,0 +1,2578 @@ +/* Copyright (c) 2016, 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 + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + + +#include +#include "sql_priv.h" +#include "sql_class.h" +#include "item.h" + + +/* + Compare ASCII string against the string with the specified + character set. + Only compares the equality, case insencitive. +*/ +static bool eq_ascii_string(const CHARSET_INFO *cs, + const char *ascii, + const char *s, uint32 s_len) +{ + const char *s_end= s + s_len; + + while (*ascii && s < s_end) + { + my_wc_t wc; + int wc_len; + + wc_len= cs->cset->mb_wc(cs, &wc, (uchar *) s, (uchar *) s_end); + if (wc_len <= 0 || (wc | 0x20) != (my_wc_t) *ascii) + return 0; + + ascii++; + s+= wc_len; + } + + return *ascii == 0 && s >= s_end; +} + + +static bool append_simple(String *s, const char *a, uint a_len) +{ + if (!s->realloc_with_extra_if_needed(s->length() + a_len)) + { + s->q_append(a, a_len); + return FALSE; + } + + return TRUE; +} + + +static inline bool append_simple(String *s, const uchar *a, uint a_len) +{ + return append_simple(s, (const char *) a, a_len); +} + + +/* + Appends JSON string to the String object taking charsets in + consideration. +static int st_append_json(String *s, + CHARSET_INFO *json_cs, const uchar *js, uint js_len) +{ + int str_len= js_len * s->charset()->mbmaxlen; + + if (!s->reserve(str_len, 1024) && + (str_len= json_unescape(json_cs, js, js + js_len, + s->charset(), (uchar *) s->end(), (uchar *) s->end() + str_len)) > 0) + { + s->length(s->length() + str_len); + return 0; + } + + return js_len; +} +*/ + + +/* + Appends arbitrary String to the JSON string taking charsets in + consideration. +*/ +static int st_append_escaped(String *s, const String *a) +{ + /* + In the worst case one character from the 'a' string + turns into '\uXXXX\uXXXX' which is 12. + */ + int str_len= a->length() * 12 * s->charset()->mbmaxlen / + a->charset()->mbminlen; + if (!s->reserve(str_len, 1024) && + (str_len= + json_escape(a->charset(), (uchar *) a->ptr(), (uchar *)a->end(), + s->charset(), + (uchar *) s->end(), (uchar *)s->end() + str_len)) > 0) + { + s->length(s->length() + str_len); + return 0; + } + + return a->length(); +} + + +#define report_json_error(js, je, n_param) \ + report_json_error_ex(js, je, func_name(), n_param, \ + Sql_condition::WARN_LEVEL_WARN) + +static void report_json_error_ex(String *js, json_engine_t *je, + const char *fname, int n_param, + Sql_condition::enum_warning_level lv) +{ + THD *thd= current_thd; + int position= (const char *) je->s.c_str - js->ptr(); + uint code; + + n_param++; + + switch (je->s.error) + { + case JE_BAD_CHR: + code= ER_JSON_BAD_CHR; + break; + + case JE_NOT_JSON_CHR: + code= ER_JSON_NOT_JSON_CHR; + break; + + case JE_EOS: + code= ER_JSON_EOS; + break; + + case JE_SYN: + case JE_STRING_CONST: + code= ER_JSON_SYNTAX; + break; + + case JE_ESCAPING: + code= ER_JSON_ESCAPING; + break; + + case JE_DEPTH: + code= ER_JSON_DEPTH; + push_warning_printf(thd, lv, code, ER_THD(thd, code), JSON_DEPTH_LIMIT, + n_param, fname, position); + return; + + default: + return; + } + + push_warning_printf(thd, lv, code, ER_THD(thd, code), + n_param, fname, position); +} + + + +#define NO_WILDCARD_ALLOWED 1 +#define SHOULD_END_WITH_ARRAY 2 + +#define report_path_error(js, je, n_param) \ + report_path_error_ex(js, je, func_name(), n_param,\ + Sql_condition::WARN_LEVEL_WARN) + +static void report_path_error_ex(String *ps, json_path_t *p, + const char *fname, int n_param, + Sql_condition::enum_warning_level lv) +{ + THD *thd= current_thd; + int position= (const char *) p->s.c_str - ps->ptr() + 1; + uint code; + + n_param++; + + switch (p->s.error) + { + case JE_BAD_CHR: + case JE_NOT_JSON_CHR: + case JE_SYN: + code= ER_JSON_PATH_SYNTAX; + break; + + case JE_EOS: + code= ER_JSON_PATH_EOS; + break; + + case JE_DEPTH: + code= ER_JSON_PATH_DEPTH; + push_warning_printf(thd, lv, code, ER_THD(thd, code), + JSON_DEPTH_LIMIT, n_param, fname, position); + return; + + case NO_WILDCARD_ALLOWED: + code= ER_JSON_PATH_NO_WILDCARD; + break; + + default: + return; + } + push_warning_printf(thd, lv, code, ER_THD(thd, code), + n_param, fname, position); +} + + + +/* + Checks if the path has '.*' '[*]' or '**' constructions + and sets the NO_WILDCARD_ALLOWED error if the case. +*/ +static int path_setup_nwc(json_path_t *p, CHARSET_INFO *i_cs, + const uchar *str, const uchar *end) +{ + if (!json_path_setup(p, i_cs, str, end)) + { + if ((p->types_used & (JSON_PATH_WILD | JSON_PATH_DOUBLE_WILD)) == 0) + return 0; + p->s.error= NO_WILDCARD_ALLOWED; + } + + return 1; +} + + +longlong Item_func_json_valid::val_int() +{ + String *js= args[0]->val_str(&tmp_value); + json_engine_t je; + + if ((null_value= args[0]->null_value)) + return 0; + + json_scan_start(&je, js->charset(), (const uchar *) js->ptr(), + (const uchar *) js->ptr()+js->length()); + + while (json_scan_next(&je) == 0) {} + + return je.s.error == 0; +} + + +void Item_func_json_exists::fix_length_and_dec() +{ + Item_int_func::fix_length_and_dec(); + maybe_null= 1; + path.set_constant_flag(args[1]->const_item()); +} + + +longlong Item_func_json_exists::val_int() +{ + json_engine_t je; + uint array_counters[JSON_DEPTH_LIMIT]; + + String *js= args[0]->val_str(&tmp_js); + + if (!path.parsed) + { + String *s_p= args[1]->val_str(&tmp_path); + if (s_p && + json_path_setup(&path.p, s_p->charset(), (const uchar *) s_p->ptr(), + (const uchar *) s_p->ptr() + s_p->length())) + goto err_return; + path.parsed= path.constant; + } + + if ((null_value= args[0]->null_value || args[1]->null_value)) + { + null_value= 1; + return 0; + } + + null_value= 0; + json_scan_start(&je, js->charset(),(const uchar *) js->ptr(), + (const uchar *) js->ptr() + js->length()); + + path.cur_step= path.p.steps; + if (json_find_path(&je, &path.p, &path.cur_step, array_counters)) + { + if (je.s.error) + goto err_return; + return 0; + } + + return 1; + +err_return: + null_value= 1; + return 0; +} + + +void Item_func_json_value::fix_length_and_dec() +{ + collation.set(args[0]->collation); + max_length= args[0]->max_length; + path.set_constant_flag(args[1]->const_item()); +} + + +/* + Returns NULL, not an error if the found value + is not a scalar. +*/ +String *Item_func_json_value::val_str(String *str) +{ + json_engine_t je; + String *js= args[0]->val_str(&tmp_js); + int error= 0; + uint array_counters[JSON_DEPTH_LIMIT]; + + if (!path.parsed) + { + String *s_p= args[1]->val_str(&tmp_path); + if (s_p && + json_path_setup(&path.p, s_p->charset(), (const uchar *) s_p->ptr(), + (const uchar *) s_p->ptr() + s_p->length())) + goto err_return; + path.parsed= path.constant; + } + + if ((null_value= args[0]->null_value || args[1]->null_value)) + return NULL; + + json_scan_start(&je, js->charset(),(const uchar *) js->ptr(), + (const uchar *) js->ptr() + js->length()); + + path.cur_step= path.p.steps; +continue_search: + if (json_find_path(&je, &path.p, &path.cur_step, array_counters)) + { + if (je.s.error) + goto err_return; + + null_value= 1; + return 0; + } + + if (json_read_value(&je)) + goto err_return; + + if (check_and_get_value(&je, str, &error)) + { + if (error) + goto err_return; + goto continue_search; + } + + return str; + +err_return: + null_value= 1; + return 0; +} + + +bool Item_func_json_value::check_and_get_value(json_engine_t *je, String *res, + int *error) +{ + if (!json_value_scalar(je)) + { + /* We only look for scalar values! */ + if (json_skip_level(je) || json_scan_next(je)) + *error= 1; + return true; + } + + res->set((const char *) je->value, je->value_len, je->s.cs); + return false; +} + + +bool Item_func_json_query::check_and_get_value(json_engine_t *je, String *res, + int *error) +{ + const uchar *value; + if (json_value_scalar(je)) + { + /* We skip scalar values. */ + if (json_scan_next(je)) + *error= 1; + return true; + } + + value= je->value; + if (json_skip_level(je)) + { + *error= 1; + return true; + } + + res->set((const char *) je->value, je->s.c_str - value, je->s.cs); + return false; +} + + +void Item_func_json_quote::fix_length_and_dec() +{ + collation.set(&my_charset_utf8mb4_bin); + /* + Odd but realistic worst case is when all characters + of the argument turn into '\uXXXX\uXXXX', which is 12. + */ + max_length= args[0]->max_length * 12 + 2; +} + + +String *Item_func_json_quote::val_str(String *str) +{ + String *s= args[0]->val_str(&tmp_s); + + if ((null_value= (args[0]->null_value || + args[0]->result_type() != STRING_RESULT))) + return NULL; + + str->length(0); + str->set_charset(&my_charset_utf8mb4_bin); + + if (str->append("\"", 1) || + st_append_escaped(str, s) || + str->append("\"", 1)) + { + /* Report an error. */ + null_value= 1; + return 0; + } + + return str; +} + + +void Item_func_json_unquote::fix_length_and_dec() +{ + collation.set(&my_charset_utf8_general_ci); + max_length= args[0]->max_length; +} + + +String *Item_func_json_unquote::val_str(String *str) +{ + String *js= args[0]->val_str(&tmp_s); + json_engine_t je; + int c_len; + + if ((null_value= args[0]->null_value)) + return NULL; + + json_scan_start(&je, js->charset(),(const uchar *) js->ptr(), + (const uchar *) js->ptr() + js->length()); + + je.value_type= (enum json_value_types) -1; /* To report errors right. */ + + if (json_read_value(&je)) + goto error; + + if (je.value_type != JSON_VALUE_STRING) + return js; + + str->length(0); + str->set_charset(&my_charset_utf8_general_ci); + + if (str->realloc_with_extra_if_needed(je.value_len) || + (c_len= json_unescape(js->charset(), + je.value, je.value + je.value_len, + &my_charset_utf8_general_ci, + (uchar *) str->ptr(), (uchar *) (str->ptr() + je.value_len))) < 0) + goto error; + + str->length(c_len); + return str; + +error: + if (je.value_type == JSON_VALUE_STRING) + report_json_error(js, &je, 0); + /* We just return the argument's value in the case of error. */ + return js; +} + + +static int alloc_tmp_paths(THD *thd, uint n_paths, + json_path_with_flags **paths,String **tmp_paths) +{ + if (n_paths > 0) + { + *paths= (json_path_with_flags *) alloc_root(thd->mem_root, + sizeof(json_path_with_flags) * n_paths); + *tmp_paths= (String *) alloc_root(thd->mem_root, sizeof(String) * n_paths); + if (*paths == 0 || *tmp_paths == 0) + return 1; + + bzero(*tmp_paths, sizeof(String) * n_paths); + + return 0; + } + + /* n_paths == 0 */ + *paths= 0; + *tmp_paths= 0; + return 0; +} + + +static void mark_constant_paths(json_path_with_flags *p, + Item** args, uint n_args) +{ + uint n; + for (n= 0; n < n_args; n++) + p[n].set_constant_flag(args[n]->const_item()); +} + + +bool Item_json_str_multipath::fix_fields(THD *thd, Item **ref) +{ + return alloc_tmp_paths(thd, get_n_paths(), &paths, &tmp_paths) || + Item_str_func::fix_fields(thd, ref); +} + + +void Item_json_str_multipath::cleanup() +{ + if (tmp_paths) + { + for (uint i= get_n_paths(); i>0; i--) + tmp_paths[i-1].free(); + tmp_paths= 0; + } + Item_str_func::cleanup(); +} + + +void Item_func_json_extract::fix_length_and_dec() +{ + collation.set(args[0]->collation); + max_length= args[0]->max_length * (arg_count - 1); + + mark_constant_paths(paths, args+1, arg_count-1); +} + + +String *Item_func_json_extract::val_str(String *str) +{ + String *js= args[0]->val_str(&tmp_js); + json_engine_t je; + bool multiple_values_found= FALSE; + const uchar *value; + const char *first_value= NULL; + uint n_arg, v_len, first_len; + uint array_counters[JSON_DEPTH_LIMIT]; + + if ((null_value= args[0]->null_value)) + return 0; + + str->set_charset(js->charset()); + str->length(0); + + for (n_arg=1; n_arg < arg_count; n_arg++) + { + json_path_with_flags *c_path= paths + n_arg - 1; + if (!c_path->parsed) + { + String *s_p= args[n_arg]->val_str(tmp_paths + (n_arg-1)); + if (s_p && + json_path_setup(&c_path->p,s_p->charset(),(const uchar *) s_p->ptr(), + (const uchar *) s_p->ptr() + s_p->length())) + goto return_null; + c_path->parsed= c_path->constant; + } + + if (args[n_arg]->null_value) + goto return_null; + + json_scan_start(&je, js->charset(),(const uchar *) js->ptr(), + (const uchar *) js->ptr() + js->length()); + + c_path->cur_step= c_path->p.steps; + + while (!json_find_path(&je, &c_path->p, &c_path->cur_step, array_counters)) + { + if (json_read_value(&je)) + goto error; + + value= je.value_begin; + if (json_value_scalar(&je)) + v_len= je.value_end - value; + else + { + if (json_skip_level(&je)) + goto error; + v_len= je.s.c_str - value; + } + + if (!multiple_values_found) + { + if (first_value == NULL) + { + /* + Just remember the first value as we don't know yet + if we need to create an array out of it or not. + */ + first_value= (const char *) value; + first_len= v_len; + } + else + { + multiple_values_found= TRUE; /* We have to make an JSON array. */ + if (str->append("[", 1) || + str->append(first_value, first_len)) + goto error; /* Out of memory. */ + } + + } + if (multiple_values_found && + (str->append(", ", 2) || + str->append((const char *) value, v_len))) + goto error; /* Out of memory. */ + + if (json_scan_next(&je)) + break; + + } + } + + if (je.s.error) + goto error; + + if (first_value == NULL) + { + /* Nothing was found. */ + goto return_null; + } + + if (multiple_values_found ? + str->append("]") : + str->append(first_value, first_len)) + goto error; /* Out of memory. */ + + return str; + +error: + report_json_error(js, &je, 0); +return_null: + /* TODO: launch error messages. */ + null_value= 1; + return 0; +} + + +longlong Item_func_json_extract::val_int() +{ + String *js= args[0]->val_str(&tmp_js); + json_engine_t je; + uint n_arg; + uint array_counters[JSON_DEPTH_LIMIT]; + + if ((null_value= args[0]->null_value)) + return 0; + + for (n_arg=1; n_arg < arg_count; n_arg++) + { + json_path_with_flags *c_path= paths + n_arg - 1; + if (!c_path->parsed) + { + String *s_p= args[n_arg]->val_str(tmp_paths+(n_arg-1)); + if (s_p && + json_path_setup(&c_path->p,s_p->charset(),(const uchar *) s_p->ptr(), + (const uchar *) s_p->ptr() + s_p->length())) + goto error; + c_path->parsed= c_path->constant; + } + + if (args[n_arg]->null_value) + goto error; + + json_scan_start(&je, js->charset(),(const uchar *) js->ptr(), + (const uchar *) js->ptr() + js->length()); + + c_path->cur_step= c_path->p.steps; + + if (json_find_path(&je, &c_path->p, &c_path->cur_step, array_counters)) + { + /* Path wasn't found. */ + if (je.s.error) + goto error; + + continue; + } + + if (json_read_value(&je)) + goto error; + + if (json_value_scalar(&je)) + { + int err; + char *v_end= (char *) je.value_end; + return (je.s.cs->cset->strtoll10)(je.s.cs, (const char *) je.value_begin, + &v_end, &err); + } + else + break; + } + + /* Nothing was found. */ + null_value= 1; + return 0; + +error: + /* TODO: launch error messages. */ + null_value= 1; + return 0; +} + + +void Item_func_json_contains::fix_length_and_dec() +{ + a2_constant= args[1]->const_item(); + a2_parsed= FALSE; + if (arg_count > 2) + path.set_constant_flag(args[2]->const_item()); + Item_int_func::fix_length_and_dec(); +} + + +static int find_key_in_object(json_engine_t *j, json_string_t *key) +{ + const uchar *c_str= key->c_str; + + while (json_scan_next(j) == 0 && j->state != JST_OBJ_END) + { + DBUG_ASSERT(j->state == JST_KEY); + if (json_key_matches(j, key)) + return TRUE; + if (json_skip_key(j)) + return FALSE; + key->c_str= c_str; + } + + return FALSE; +} + + +static int check_contains(json_engine_t *js, json_engine_t *value) +{ + json_engine_t loc_js; + bool set_js; + + switch (js->value_type) + { + case JSON_VALUE_OBJECT: + { + json_string_t key_name; + + if (value->value_type != JSON_VALUE_OBJECT) + return FALSE; + + loc_js= *js; + set_js= FALSE; + json_string_set_cs(&key_name, value->s.cs); + while (json_scan_next(value) == 0 && value->state != JST_OBJ_END) + { + const uchar *k_start, *k_end; + + DBUG_ASSERT(value->state == JST_KEY); + k_start= value->s.c_str; + while (json_read_keyname_chr(value) == 0) + k_end= value->s.c_str; + + if (value->s.error || json_read_value(value)) + return FALSE; + + if (set_js) + *js= loc_js; + else + set_js= TRUE; + + json_string_set_str(&key_name, k_start, k_end); + if (!find_key_in_object(js, &key_name) || + json_read_value(js) || + !check_contains(js, value)) + return FALSE; + } + + return value->state == JST_OBJ_END && !json_skip_level(js); + } + case JSON_VALUE_ARRAY: + if (value->value_type != JSON_VALUE_ARRAY) + { + while (json_scan_next(js) == 0 && js->state != JST_ARRAY_END) + { + json_level_t c_level; + DBUG_ASSERT(js->state == JST_VALUE); + if (json_read_value(js)) + return FALSE; + + c_level= json_value_scalar(js) ? NULL : json_get_level(js); + if (check_contains(js, value)) + { + if (json_skip_level(js)) + return FALSE; + return TRUE; + } + if (value->s.error || js->s.error || + (c_level && json_skip_to_level(js, c_level))) + return FALSE; + } + return FALSE; + } + /* else */ + loc_js= *js; + set_js= FALSE; + while (json_scan_next(value) == 0 && value->state != JST_ARRAY_END) + { + DBUG_ASSERT(value->state == JST_VALUE); + if (json_read_value(value)) + return FALSE; + + if (set_js) + *js= loc_js; + else + set_js= TRUE; + if (!check_contains(js, value)) + return FALSE; + } + + return value->state == JST_ARRAY_END; + + case JSON_VALUE_STRING: + if (value->value_type != JSON_VALUE_STRING) + return FALSE; + /* + TODO: make proper json-json comparison here that takes excapint + into account. + */ + return value->value_len == js->value_len && + memcmp(value->value, js->value, value->value_len) == 0; + case JSON_VALUE_NUMBER: + if (value->value_type == JSON_VALUE_NUMBER) + { + double d_j, d_v; + char *end; + int err; + + d_j= my_strntod(js->s.cs, (char *) js->value, js->value_len, + &end, &err);; + d_v= my_strntod(value->s.cs, (char *) value->value, value->value_len, + &end, &err);; + + return (fabs(d_j - d_v) < 1e-12); + } + else + return FALSE; + + default: + break; + } + + /* + We have these not mentioned in the 'switch' above: + + case JSON_VALUE_TRUE: + case JSON_VALUE_FALSE: + case JSON_VALUE_NULL: + */ + return value->value_type == js->value_type; +} + + +longlong Item_func_json_contains::val_int() +{ + String *js= args[0]->val_str(&tmp_js); + json_engine_t je, ve; + int result; + + if ((null_value= args[0]->null_value)) + return 0; + + if (!a2_parsed) + { + val= args[1]->val_str(&tmp_val); + a2_parsed= a2_constant; + } + + if (val == 0) + { + null_value= 1; + return 0; + } + + json_scan_start(&je, js->charset(),(const uchar *) js->ptr(), + (const uchar *) js->ptr() + js->length()); + + if (arg_count>2) /* Path specified. */ + { + uint array_counters[JSON_DEPTH_LIMIT]; + if (!path.parsed) + { + String *s_p= args[2]->val_str(&tmp_path); + if (s_p && + path_setup_nwc(&path.p,s_p->charset(),(const uchar *) s_p->ptr(), + (const uchar *) s_p->end())) + { + report_path_error(s_p, &path.p, 2); + goto return_null; + } + path.parsed= path.constant; + } + if (args[2]->null_value) + goto return_null; + + path.cur_step= path.p.steps; + if (json_find_path(&je, &path.p, &path.cur_step, array_counters)) + { + if (je.s.error) + { + ve.s.error= 0; + goto error; + } + + return FALSE; + } + } + + json_scan_start(&ve, val->charset(),(const uchar *) val->ptr(), + (const uchar *) val->end()); + + if (json_read_value(&je) || json_read_value(&ve)) + goto error; + + result= check_contains(&je, &ve); + if (je.s.error || ve.s.error) + goto error; + + return result; + +error: + if (je.s.error) + report_json_error(js, &je, 0); + if (ve.s.error) + report_json_error(val, &ve, 1); +return_null: + null_value= 1; + return 0; +} + + +bool Item_func_json_contains_path::fix_fields(THD *thd, Item **ref) +{ + return alloc_tmp_paths(thd, arg_count-2, &paths, &tmp_paths) || + Item_int_func::fix_fields(thd, ref); +} + + +void Item_func_json_contains_path::fix_length_and_dec() +{ + ooa_constant= args[1]->const_item(); + ooa_parsed= FALSE; + mark_constant_paths(paths, args+2, arg_count-2); + Item_int_func::fix_length_and_dec(); +} + + +void Item_func_json_contains_path::cleanup() +{ + if (tmp_paths) + { + for (uint i= arg_count-2; i>0; i--) + tmp_paths[i-1].free(); + tmp_paths= 0; + } + Item_int_func::cleanup(); +} + + +static int parse_one_or_all(const Item_func *f, Item *ooa_arg, + bool *ooa_parsed, bool ooa_constant, bool *mode_one) +{ + if (!*ooa_parsed) + { + char buff[20]; + String *res, tmp(buff, sizeof(buff), &my_charset_bin); + if ((res= ooa_arg->val_str(&tmp)) == NULL) + return TRUE; + + *mode_one=eq_ascii_string(res->charset(), "one", + res->ptr(), res->length()); + if (!*mode_one) + { + if (!eq_ascii_string(res->charset(), "all", res->ptr(), res->length())) + { + THD *thd= current_thd; + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_JSON_ONE_OR_ALL, ER_THD(thd, ER_JSON_ONE_OR_ALL), + f->func_name()); + *mode_one= TRUE; + return TRUE; + } + } + *ooa_parsed= ooa_constant; + } + return FALSE; +} + + +longlong Item_func_json_contains_path::val_int() +{ + String *js= args[0]->val_str(&tmp_js); + json_engine_t je; + uint n_arg; + longlong result; + + if ((null_value= args[0]->null_value)) + return 0; + + if (parse_one_or_all(this, args[1], &ooa_parsed, ooa_constant, &mode_one)) + goto return_null; + + result= !mode_one; + for (n_arg=2; n_arg < arg_count; n_arg++) + { + uint array_counters[JSON_DEPTH_LIMIT]; + json_path_with_flags *c_path= paths + n_arg - 2; + if (!c_path->parsed) + { + String *s_p= args[n_arg]->val_str(tmp_paths+(n_arg-2)); + if (s_p && + json_path_setup(&c_path->p,s_p->charset(),(const uchar *) s_p->ptr(), + (const uchar *) s_p->ptr() + s_p->length())) + { + report_path_error(s_p, &c_path->p, n_arg-2); + goto return_null; + } + c_path->parsed= c_path->constant; + } + + if (args[n_arg]->null_value) + goto return_null; + + json_scan_start(&je, js->charset(),(const uchar *) js->ptr(), + (const uchar *) js->ptr() + js->length()); + + c_path->cur_step= c_path->p.steps; + if (json_find_path(&je, &c_path->p, &c_path->cur_step, array_counters)) + { + /* Path wasn't found. */ + if (je.s.error) + goto js_error; + + if (!mode_one) + { + result= 0; + break; + } + } + else if (mode_one) + { + result= 1; + break; + } + } + + + return result; + +js_error: + report_json_error(js, &je, 0); +return_null: + null_value= 1; + return 0; +} + + +static int append_json_value(String *str, Item *item, String *tmp_val) +{ + if (item->is_bool_type()) + { + longlong v_int= item->val_int(); + const char *t_f; + int t_f_len; + + if (item->null_value) + goto append_null; + + if (v_int) + { + t_f= "true"; + t_f_len= 4; + } + else + { + t_f= "false"; + t_f_len= 5; + } + + return str->append(t_f, t_f_len); + } + { + String *sv= item->val_str(tmp_val); + if (item->null_value) + goto append_null; + if (item->is_json_type()) + return str->append(sv->ptr(), sv->length()); + + if (item->result_type() == STRING_RESULT) + { + return str->append("\"", 1) || + st_append_escaped(str, sv) || + str->append("\"", 1); + } + return st_append_escaped(str, sv); + } + +append_null: + return str->append("null", 4); +} + + +static int append_json_keyname(String *str, Item *item, String *tmp_val) +{ + String *sv= item->val_str(tmp_val); + if (item->null_value) + goto append_null; + + return str->append("\"", 1) || + st_append_escaped(str, sv) || + str->append("\": ", 3); + +append_null: + return str->append("\"\": ", 4); +} + + +void Item_func_json_array::fix_length_and_dec() +{ + ulonglong char_length= 2; + uint n_arg; + + if (arg_count == 0) + { + collation.set(&my_charset_utf8_general_ci); + tmp_val.set_charset(&my_charset_utf8_general_ci); + max_length= 2; + return; + } + + if (agg_arg_charsets_for_string_result(collation, args, arg_count)) + return; + + for (n_arg=0 ; n_arg < arg_count ; n_arg++) + char_length+= args[n_arg]->max_char_length() + 4; + + fix_char_length_ulonglong(char_length); + tmp_val.set_charset(collation.collation); +} + + +String *Item_func_json_array::val_str(String *str) +{ + DBUG_ASSERT(fixed == 1); + uint n_arg; + + str->length(0); + + if (str->append("[", 1) || + ((arg_count > 0) && append_json_value(str, args[0], &tmp_val))) + goto err_return; + + for (n_arg=1; n_arg < arg_count; n_arg++) + { + if (str->append(", ", 2) || + append_json_value(str, args[n_arg], &tmp_val)) + goto err_return; + } + + if (str->append("]", 1)) + goto err_return; + + return str; + +err_return: + /*TODO: Launch out of memory error. */ + null_value= 1; + return NULL; +} + + +void Item_func_json_array_append::fix_length_and_dec() +{ + uint n_arg; + ulonglong char_length; + + collation.set(args[0]->collation); + char_length= args[0]->max_char_length(); + + for (n_arg= 1; n_arg < arg_count; n_arg+= 2) + { + paths[n_arg/2].set_constant_flag(args[n_arg]->const_item()); + char_length+= args[n_arg/2+1]->max_char_length() + 4; + } + + fix_char_length_ulonglong(char_length); +} + + +String *Item_func_json_array_append::val_str(String *str) +{ + json_engine_t je; + String *js= args[0]->val_str(&tmp_js); + uint n_arg, n_path, str_rest_len; + const uchar *ar_end; + + DBUG_ASSERT(fixed == 1); + + if ((null_value= args[0]->null_value)) + return 0; + + for (n_arg=1, n_path=0; n_arg < arg_count; n_arg+=2, n_path++) + { + uint array_counters[JSON_DEPTH_LIMIT]; + json_path_with_flags *c_path= paths + n_path; + if (!c_path->parsed) + { + String *s_p= args[n_arg]->val_str(tmp_paths+n_path); + if (s_p && + path_setup_nwc(&c_path->p,s_p->charset(),(const uchar *) s_p->ptr(), + (const uchar *) s_p->ptr() + s_p->length())) + { + report_path_error(s_p, &c_path->p, n_arg); + goto return_null; + } + c_path->parsed= c_path->constant; + } + if (args[n_arg]->null_value) + goto return_null; + + json_scan_start(&je, js->charset(),(const uchar *) js->ptr(), + (const uchar *) js->ptr() + js->length()); + + c_path->cur_step= c_path->p.steps; + + if (json_find_path(&je, &c_path->p, &c_path->cur_step, array_counters)) + { + if (je.s.error) + goto js_error; + + goto return_null; + } + + if (json_read_value(&je)) + goto js_error; + + str->length(0); + str->set_charset(js->charset()); + if (str->reserve(js->length() + 8, 1024)) + goto return_null; /* Out of memory. */ + + if (je.value_type == JSON_VALUE_ARRAY) + { + if (json_skip_level(&je)) + goto js_error; + + ar_end= je.s.c_str - je.sav_c_len; + str_rest_len= js->length() - (ar_end - (const uchar *) js->ptr()); + str->q_append(js->ptr(), ar_end-(const uchar *) js->ptr()); + str->append(", ", 2); + if (append_json_value(str, args[n_arg+1], &tmp_val)) + goto return_null; /* Out of memory. */ + + if (str->reserve(str_rest_len, 1024)) + goto return_null; /* Out of memory. */ + str->q_append((const char *) ar_end, str_rest_len); + } + else + { + const uchar *c_from, *c_to; + + /* Wrap as an array. */ + str->q_append(js->ptr(), (const char *) je.value_begin - js->ptr()); + c_from= je.value_begin; + + if (je.value_type == JSON_VALUE_OBJECT) + { + if (json_skip_level(&je)) + goto js_error; + c_to= je.s.c_str; + } + else + c_to= je.value_end; + + if (str->append("[", 1) || + str->append((const char *) c_from, c_to - c_from) || + str->append(", ", 2) || + append_json_value(str, args[n_arg+1], &tmp_val) || + str->append("]", 1) || + str->append((const char *) je.s.c_str, + js->end() - (const char *) je.s.c_str)) + goto return_null; /* Out of memory. */ + } + { + /* Swap str and js. */ + if (str == &tmp_js) + { + str= js; + js= &tmp_js; + } + else + { + js= str; + str= &tmp_js; + } + } + } + + return js; + +js_error: + report_json_error(js, &je, 0); + +return_null: + null_value= 1; + return 0; +} + + +String *Item_func_json_array_insert::val_str(String *str) +{ + json_engine_t je; + String *js= args[0]->val_str(&tmp_js); + uint n_arg, n_path; + + DBUG_ASSERT(fixed == 1); + + if ((null_value= args[0]->null_value)) + return 0; + + for (n_arg=1, n_path=0; n_arg < arg_count; n_arg+=2, n_path++) + { + uint array_counters[JSON_DEPTH_LIMIT]; + json_path_with_flags *c_path= paths + n_path; + const char *item_pos; + uint n_item; + + if (!c_path->parsed) + { + String *s_p= args[n_arg]->val_str(tmp_paths+n_path); + if (s_p && + (path_setup_nwc(&c_path->p,s_p->charset(),(const uchar *) s_p->ptr(), + (const uchar *) s_p->ptr() + s_p->length()) || + c_path->p.last_step - 1 < c_path->p.steps || + c_path->p.last_step->type != JSON_PATH_ARRAY)) + { + if (c_path->p.s.error == 0) + c_path->p.s.error= SHOULD_END_WITH_ARRAY; + + report_path_error(s_p, &c_path->p, n_arg); + + goto return_null; + } + c_path->parsed= c_path->constant; + c_path->p.last_step--; + } + if (args[n_arg]->null_value) + goto return_null; + + json_scan_start(&je, js->charset(),(const uchar *) js->ptr(), + (const uchar *) js->ptr() + js->length()); + + c_path->cur_step= c_path->p.steps; + + if (json_find_path(&je, &c_path->p, &c_path->cur_step, array_counters)) + { + if (je.s.error) + goto js_error; + + /* Can't find the array to insert. */ + continue; + } + + if (json_read_value(&je)) + goto js_error; + + if (je.value_type != JSON_VALUE_ARRAY) + { + /* Must be an array. */ + continue; + } + + item_pos= 0; + n_item= 0; + + while (json_scan_next(&je) == 0 && je.state != JST_ARRAY_END) + { + DBUG_ASSERT(je.state == JST_VALUE); + if (n_item == c_path->p.last_step[1].n_item) + { + item_pos= (const char *) je.s.c_str; + break; + } + n_item++; + + if (json_read_value(&je) || + (!json_value_scalar(&je) && json_skip_level(&je))) + goto js_error; + } + + if (je.s.error) + goto js_error; + + str->length(0); + str->set_charset(js->charset()); + if (item_pos) + { + if (append_simple(str, js->ptr(), item_pos - js->ptr()) || + (n_item > 0 && str->append(" ", 1)) || + append_json_value(str, args[n_arg+1], &tmp_val) || + str->append(",", 1) || + (n_item == 0 && str->append(" ", 1)) || + append_simple(str, item_pos, js->end() - item_pos)) + goto return_null; /* Out of memory. */ + } + else + { + /* Insert position wasn't found - append to the array. */ + DBUG_ASSERT(je.state == JST_ARRAY_END); + item_pos= (const char *) (je.s.c_str - je.sav_c_len); + if (append_simple(str, js->ptr(), item_pos - js->ptr()) || + (n_item > 0 && str->append(", ", 2)) || + append_json_value(str, args[n_arg+1], &tmp_val) || + append_simple(str, item_pos, js->end() - item_pos)) + goto return_null; /* Out of memory. */ + } + + { + /* Swap str and js. */ + if (str == &tmp_js) + { + str= js; + js= &tmp_js; + } + else + { + js= str; + str= &tmp_js; + } + } + } + + return js; + +js_error: + report_json_error(js, &je, 0); +return_null: + null_value= 1; + return 0; +} + + +String *Item_func_json_object::val_str(String *str) +{ + DBUG_ASSERT(fixed == 1); + uint n_arg; + + str->length(0); + + if (str->append("{", 1) || + (arg_count > 0 && + (append_json_keyname(str, args[0], &tmp_val) || + append_json_value(str, args[1], &tmp_val)))) + goto err_return; + + for (n_arg=2; n_arg < arg_count; n_arg+=2) + { + if (str->append(", ", 2) || + append_json_keyname(str, args[n_arg], &tmp_val) || + append_json_value(str, args[n_arg+1], &tmp_val)) + goto err_return; + } + + if (str->append("}", 1)) + goto err_return; + + return str; + +err_return: + /*TODO: Launch out of memory error. */ + null_value= 1; + return NULL; +} + + +String *Item_func_json_merge::val_str(String *str) +{ + DBUG_ASSERT(fixed == 1); + json_engine_t je1, je2; + String *js1= args[0]->val_str(&tmp_js1), *js2; + uint n_arg; + + if (args[0]->null_value) + goto null_return; + + for (n_arg=1; n_arg < arg_count; n_arg++) + { + js2= args[n_arg]->val_str(&tmp_js2); + if (args[n_arg]->null_value) + goto null_return; + + json_scan_start(&je1, js1->charset(),(const uchar *) js1->ptr(), + (const uchar *) js1->ptr() + js1->length()); + + json_scan_start(&je2, js2->charset(),(const uchar *) js2->ptr(), + (const uchar *) js2->ptr() + js2->length()); + + if (json_read_value(&je1) || json_read_value(&je2)) + goto error_return; + + str->length(0); + if (je1.value_type == JSON_VALUE_OBJECT && + je2.value_type == JSON_VALUE_OBJECT) + { + /* Wrap as a single objects. */ + if (json_skip_level(&je1)) + goto error_return; + if (str->append(js1->ptr(), + ((const char *)je1.s.c_str - js1->ptr()) - je1.sav_c_len) || + str->append(", ", 2) || + str->append((const char *)je2.s.c_str, + js2->length() - ((const char *)je2.s.c_str - js2->ptr()))) + goto error_return; + } + else + { + const char *end1, *beg2; + + /* Merge as a single array. */ + if (je1.value_type == JSON_VALUE_ARRAY) + { + if (json_skip_level(&je1)) + goto error_return; + end1= (const char *) (je1.s.c_str - je1.sav_c_len); + } + else + { + if (str->append("[", 1)) + goto error_return; + end1= js1->end(); + } + + if (str->append(js1->ptr(), end1 - js1->ptr()), + str->append(", ", 2)) + goto error_return; + + if (je2.value_type == JSON_VALUE_ARRAY) + beg2= (const char *) je2.s.c_str; + else + beg2= js2->ptr(); + + if (str->append(beg2, js2->end() - beg2)) + goto error_return; + + if (je2.value_type != JSON_VALUE_ARRAY && + str->append("]", 1)) + goto error_return; + } + + { + /* Swap str and js1. */ + if (str == &tmp_js1) + { + str= js1; + js1= &tmp_js1; + } + else + { + js1= str; + str= &tmp_js1; + } + } + } + + null_value= 0; + return js1; + +error_return: + if (je1.s.error) + report_json_error(js1, &je1, 0); + if (je2.s.error) + report_json_error(js2, &je2, n_arg); +null_return: + null_value= 1; + return NULL; +} + + +void Item_func_json_length::fix_length_and_dec() +{ + if (arg_count > 1) + path.set_constant_flag(args[1]->const_item()); +} + + +longlong Item_func_json_length::val_int() +{ + String *js= args[0]->val_str(&tmp_js); + json_engine_t je; + uint length= 0; + uint array_counters[JSON_DEPTH_LIMIT]; + + if ((null_value= args[0]->null_value)) + return 0; + + json_scan_start(&je, js->charset(),(const uchar *) js->ptr(), + (const uchar *) js->ptr() + js->length()); + + if (arg_count > 1) + { + /* Path specified - let's apply it. */ + if (!path.parsed) + { + String *s_p= args[1]->val_str(&tmp_path); + if (s_p && + json_path_setup(&path.p, s_p->charset(), (const uchar *) s_p->ptr(), + (const uchar *) s_p->ptr() + s_p->length())) + { + report_path_error(s_p, &path.p, 2); + goto null_return; + } + path.parsed= path.constant; + } + if (args[1]->null_value) + goto null_return; + + path.cur_step= path.p.steps; + if (json_find_path(&je, &path.p, &path.cur_step, array_counters)) + { + if (je.s.error) + goto err_return; + goto null_return; + } + } + + + if (json_read_value(&je)) + goto err_return; + + if (json_value_scalar(&je)) + return 1; + + while (json_scan_next(&je) == 0 && + je.state != JST_OBJ_END && je.state != JST_ARRAY_END) + { + switch (je.state) + { + case JST_VALUE: + case JST_KEY: + length++; + break; + case JST_OBJ_START: + case JST_ARRAY_START: + if (json_skip_level(&je)) + goto err_return; + break; + default: + break; + }; + } + + if (!je.s.error) + return length; + +err_return: + report_json_error(js, &je, 0); +null_return: + null_value= 1; + return 0; +} + + +longlong Item_func_json_depth::val_int() +{ + String *js= args[0]->val_str(&tmp_js); + json_engine_t je; + uint depth= 0, c_depth= 0; + bool inc_depth= TRUE; + + if ((null_value= args[0]->null_value)) + return 0; + + + json_scan_start(&je, js->charset(),(const uchar *) js->ptr(), + (const uchar *) js->ptr() + js->length()); + + do + { + switch (je.state) + { + case JST_VALUE: + case JST_KEY: + if (inc_depth) + { + c_depth++; + inc_depth= FALSE; + if (c_depth > depth) + depth= c_depth; + } + break; + case JST_OBJ_START: + case JST_ARRAY_START: + inc_depth= TRUE; + break; + case JST_OBJ_END: + case JST_ARRAY_END: + if (!inc_depth) + c_depth--; + inc_depth= FALSE; + break; + default: + break; + } + } while (json_scan_next(&je) == 0); + + if (!je.s.error) + return depth; + + report_json_error(js, &je, 0); + null_value= 1; + return 0; +} + + +void Item_func_json_type::fix_length_and_dec() +{ + collation.set(&my_charset_utf8_general_ci); + max_length= 12; +} + + +String *Item_func_json_type::val_str(String *str) +{ + String *js= args[0]->val_str(&tmp_js); + json_engine_t je; + const char *type; + + if ((null_value= args[0]->null_value)) + return 0; + + + json_scan_start(&je, js->charset(),(const uchar *) js->ptr(), + (const uchar *) js->ptr() + js->length()); + + if (json_read_value(&je)) + goto error; + + switch (je.value_type) + { + case JSON_VALUE_OBJECT: + type= "OBJECT"; + break; + case JSON_VALUE_ARRAY: + type= "ARRAY"; + break; + case JSON_VALUE_STRING: + type= "STRING"; + break; + case JSON_VALUE_NUMBER: + type= (je.num_flags & JSON_NUM_FRAC_PART) ? "DOUBLE" : "INTEGER"; + break; + case JSON_VALUE_TRUE: + case JSON_VALUE_FALSE: + type= "BOOLEAN"; + break; + default: + type= "NULL"; + break; + } + + str->set(type, strlen(type), &my_charset_utf8_general_ci); + return str; + +error: + report_json_error(js, &je, 0); + null_value= 1; + return 0; +} + + +void Item_func_json_insert::fix_length_and_dec() +{ + uint n_arg; + ulonglong char_length; + + collation.set(args[0]->collation); + char_length= args[0]->max_char_length(); + + for (n_arg= 1; n_arg < arg_count; n_arg+= 2) + { + paths[n_arg/2].set_constant_flag(args[n_arg]->const_item()); + char_length+= args[n_arg/2+1]->max_char_length() + 4; + } + + fix_char_length_ulonglong(char_length); +} + + +String *Item_func_json_insert::val_str(String *str) +{ + json_engine_t je; + String *js= args[0]->val_str(&tmp_js); + uint n_arg, n_path; + json_string_t key_name; + + DBUG_ASSERT(fixed == 1); + + if ((null_value= args[0]->null_value)) + return 0; + + str->set_charset(js->charset()); + json_string_set_cs(&key_name, js->charset()); + + for (n_arg=1, n_path=0; n_arg < arg_count; n_arg+=2, n_path++) + { + uint array_counters[JSON_DEPTH_LIMIT]; + json_path_with_flags *c_path= paths + n_path; + const char *v_to; + const json_path_step_t *lp; + + if (!c_path->parsed) + { + String *s_p= args[n_arg]->val_str(tmp_paths+n_path); + if (s_p) + { + if (path_setup_nwc(&c_path->p,s_p->charset(), + (const uchar *) s_p->ptr(), + (const uchar *) s_p->ptr() + s_p->length())) + { + report_path_error(s_p, &c_path->p, n_arg); + goto return_null; + } + + /* We search to the last step. */ + c_path->p.last_step--; + } + c_path->parsed= c_path->constant; + } + if (args[n_arg]->null_value) + goto return_null; + + json_scan_start(&je, js->charset(),(const uchar *) js->ptr(), + (const uchar *) js->ptr() + js->length()); + + c_path->cur_step= c_path->p.steps; + + if (c_path->p.last_step >= c_path->p.steps && + json_find_path(&je, &c_path->p, &c_path->cur_step, array_counters)) + { + if (je.s.error) + goto js_error; + } + + if (json_read_value(&je)) + goto js_error; + + lp= c_path->p.last_step+1; + if (lp->type & JSON_PATH_ARRAY) + { + uint n_item= 0; + + if (je.value_type != JSON_VALUE_ARRAY) + { + const uchar *v_from= je.value_begin; + if (!mode_insert) + continue; + + str->length(0); + /* Wrap the value as an array. */ + if (append_simple(str, js->ptr(), (const char *) v_from - js->ptr()) || + str->append("[", 1)) + goto js_error; /* Out of memory. */ + + if (je.value_type == JSON_VALUE_OBJECT) + { + if (json_skip_level(&je)) + goto js_error; + } + + if (append_simple(str, v_from, je.s.c_str - v_from) || + str->append(", ", 2) || + append_json_value(str, args[n_arg+1], &tmp_val) || + str->append("]", 1) || + append_simple(str, je.s.c_str, js->end()-(const char *) je.s.c_str)) + goto js_error; /* Out of memory. */ + + goto continue_point; + } + + while (json_scan_next(&je) == 0 && je.state != JST_ARRAY_END) + { + switch (je.state) + { + case JST_VALUE: + if (n_item == lp->n_item) + goto v_found; + n_item++; + if (json_skip_array_item(&je)) + goto js_error; + break; + default: + break; + } + } + + if (je.s.error) + goto js_error; + + if (!mode_insert) + continue; + + v_to= (const char *) (je.s.c_str - je.sav_c_len); + str->length(0); + if (append_simple(str, js->ptr(), v_to - js->ptr()) || + str->append(", ", 2) || + append_json_value(str, args[n_arg+1], &tmp_val) || + append_simple(str, v_to, js->end() - v_to)) + goto js_error; /* Out of memory. */ + } + else /*JSON_PATH_KEY*/ + { + if (je.value_type != JSON_VALUE_OBJECT) + continue; + + while (json_scan_next(&je) == 0 && je.state != JST_OBJ_END) + { + switch (je.state) + { + case JST_KEY: + json_string_set_str(&key_name, lp->key, lp->key_end); + if (json_key_matches(&je, &key_name)) + goto v_found; + if (json_skip_key(&je)) + goto js_error; + break; + default: + break; + } + } + + if (je.s.error) + goto js_error; + + if (!mode_insert) + continue; + + v_to= (const char *) (je.s.c_str - je.sav_c_len); + str->length(0); + if (append_simple(str, js->ptr(), v_to - js->ptr()) || + str->append(", \"", 3) || + append_simple(str, lp->key, lp->key_end - lp->key) || + str->append("\":", 2) || + append_json_value(str, args[n_arg+1], &tmp_val) || + append_simple(str, v_to, js->end() - v_to)) + goto js_error; /* Out of memory. */ + } + + goto continue_point; + +v_found: + + if (!mode_replace) + continue; + + if (json_read_value(&je)) + goto js_error; + + v_to= (const char *) je.value_begin; + str->length(0); + if (!json_value_scalar(&je)) + { + if (json_skip_level(&je)) + goto js_error; + } + + if (append_simple(str, js->ptr(), v_to - js->ptr()) || + append_json_value(str, args[n_arg+1], &tmp_val) || + append_simple(str, je.s.c_str, js->end()-(const char *) je.s.c_str)) + goto js_error; /* Out of memory. */ +continue_point: + { + /* Swap str and js. */ + if (str == &tmp_js) + { + str= js; + js= &tmp_js; + } + else + { + js= str; + str= &tmp_js; + } + } + } + + return js; + +js_error: + report_json_error(js, &je, 0); +return_null: + null_value= 1; + return 0; +} + + +void Item_func_json_remove::fix_length_and_dec() +{ + collation.set(args[0]->collation); + max_length= args[0]->max_length; + + mark_constant_paths(paths, args+1, arg_count-1); +} + + +String *Item_func_json_remove::val_str(String *str) +{ + json_engine_t je; + String *js= args[0]->val_str(&tmp_js); + uint n_arg, n_path; + json_string_t key_name; + + DBUG_ASSERT(fixed == 1); + + if (args[0]->null_value) + goto null_return; + + str->set_charset(js->charset()); + json_string_set_cs(&key_name, js->charset()); + + for (n_arg=1, n_path=0; n_arg < arg_count; n_arg+=2, n_path++) + { + uint array_counters[JSON_DEPTH_LIMIT]; + json_path_with_flags *c_path= paths + n_path; + const char *rem_start, *rem_end; + const json_path_step_t *lp; + uint n_item= 0; + + if (!c_path->parsed) + { + String *s_p= args[n_arg]->val_str(tmp_paths+n_path); + if (s_p) + { + if (path_setup_nwc(&c_path->p,s_p->charset(), + (const uchar *) s_p->ptr(), + (const uchar *) s_p->ptr() + s_p->length())) + { + report_path_error(s_p, &c_path->p, n_arg); + goto null_return; + } + + /* We search to the last step. */ + c_path->p.last_step--; + if (c_path->p.last_step < c_path->p.steps) + goto null_return; + } + c_path->parsed= c_path->constant; + } + if (args[n_arg]->null_value) + goto null_return; + + json_scan_start(&je, js->charset(),(const uchar *) js->ptr(), + (const uchar *) js->ptr() + js->length()); + + c_path->cur_step= c_path->p.steps; + + if (json_find_path(&je, &c_path->p, &c_path->cur_step, array_counters)) + { + if (je.s.error) + goto js_error; + } + + if (json_read_value(&je)) + goto js_error; + + lp= c_path->p.last_step+1; + if (lp->type & JSON_PATH_ARRAY) + { + if (je.value_type != JSON_VALUE_ARRAY) + continue; + + while (json_scan_next(&je) == 0 && je.state != JST_ARRAY_END) + { + switch (je.state) + { + case JST_VALUE: + if (n_item == lp->n_item) + { + rem_start= (const char *) (je.s.c_str - + (n_item ? je.sav_c_len : 0)); + goto v_found; + } + n_item++; + if (json_skip_array_item(&je)) + goto js_error; + break; + default: + break; + } + } + + if (je.s.error) + goto js_error; + + continue; + } + else /*JSON_PATH_KEY*/ + { + if (je.value_type != JSON_VALUE_OBJECT) + continue; + + while (json_scan_next(&je) == 0 && je.state != JST_OBJ_END) + { + switch (je.state) + { + case JST_KEY: + if (n_item == 0) + rem_start= (const char *) (je.s.c_str - je.sav_c_len); + json_string_set_str(&key_name, lp->key, lp->key_end); + if (json_key_matches(&je, &key_name)) + goto v_found; + + if (json_skip_key(&je)) + goto js_error; + + rem_start= (const char *) je.s.c_str; + n_item++; + break; + default: + break; + } + } + + if (je.s.error) + goto js_error; + + continue; + } + +v_found: + + if (json_skip_key(&je) || json_scan_next(&je)) + goto js_error; + + rem_end= (je.state == JST_VALUE && n_item == 0) ? + (const char *) je.s.c_str : (const char *) (je.s.c_str - je.sav_c_len); + + str->length(0); + + if (append_simple(str, js->ptr(), rem_start - js->ptr()) || + append_simple(str, rem_end, js->end() - rem_end)) + goto js_error; /* Out of memory. */ + + { + /* Swap str and js. */ + if (str == &tmp_js) + { + str= js; + js= &tmp_js; + } + else + { + js= str; + str= &tmp_js; + } + } + } + + return js; + +js_error: + report_json_error(js, &je, 0); +null_return: + null_value= 1; + return 0; +} + + +void Item_func_json_keys::fix_length_and_dec() +{ + collation.set(args[0]->collation); + max_length= args[0]->max_length; + if (arg_count > 1) + path.set_constant_flag(args[1]->const_item()); +} + + +String *Item_func_json_keys::val_str(String *str) +{ + json_engine_t je; + String *js= args[0]->val_str(&tmp_js); + uint n_keys= 0; + uint array_counters[JSON_DEPTH_LIMIT]; + + if ((args[0]->null_value)) + goto null_return; + + json_scan_start(&je, js->charset(),(const uchar *) js->ptr(), + (const uchar *) js->ptr() + js->length()); + + if (arg_count < 2) + goto skip_search; + + if (!path.parsed) + { + String *s_p= args[1]->val_str(&tmp_path); + if (s_p && + path_setup_nwc(&path.p, s_p->charset(), (const uchar *) s_p->ptr(), + (const uchar *) s_p->ptr() + s_p->length())) + { + report_path_error(s_p, &path.p, 1); + goto null_return; + } + path.parsed= path.constant; + } + + if (args[1]->null_value) + goto null_return; + + path.cur_step= path.p.steps; + + if (json_find_path(&je, &path.p, &path.cur_step, array_counters)) + { + if (je.s.error) + goto err_return; + + goto null_return; + } + +skip_search: + if (json_read_value(&je)) + goto err_return; + + if (je.value_type != JSON_VALUE_OBJECT) + goto null_return; + + str->length(0); + if (str->append("[", 1)) + goto err_return; /* Out of memory. */ + /* Parse the OBJECT collecting the keys. */ + while (json_scan_next(&je) == 0 && je.state != JST_OBJ_END) + { + const uchar *key_start, *key_end; + + switch (je.state) + { + case JST_KEY: + key_start= je.s.c_str; + while (json_read_keyname_chr(&je) == 0) + { + key_end= je.s.c_str; + } + if (je.s.error || + (n_keys > 0 && str->append(", ", 2)) || + str->append("\"", 1) || + append_simple(str, key_start, key_end - key_start) || + str->append("\"", 1)) + goto err_return; + n_keys++; + break; + case JST_OBJ_START: + case JST_ARRAY_START: + if (json_skip_level(&je)) + break; + break; + default: + break; + } + } + + if (je.s.error || str->append("]", 1)) + goto err_return; + + null_value= 0; + return str; + +err_return: + report_json_error(js, &je, 0); +null_return: + null_value= 1; + return 0; +} + + +bool Item_func_json_search::fix_fields(THD *thd, Item **ref) +{ + if (Item_json_str_multipath::fix_fields(thd, ref)) + return TRUE; + + if (arg_count < 4) + return FALSE; + + return fix_escape_item(thd, args[3], &tmp_js, true, + args[0]->collation.collation, &escape); +} + + +static const uint SQR_MAX_BLOB_WIDTH= sqrt(MAX_BLOB_WIDTH); + +void Item_func_json_search::fix_length_and_dec() +{ + collation.set(args[0]->collation); + + /* + It's rather difficult to estimate the length of the result. + I belive arglen^2 is the reasonable upper limit. + */ + if (args[0]->max_length > SQR_MAX_BLOB_WIDTH) + max_length= MAX_BLOB_WIDTH; + else + { + max_length= args[0]->max_length; + max_length*= max_length; + } + + ooa_constant= args[1]->const_item(); + ooa_parsed= FALSE; + + if (arg_count > 4) + mark_constant_paths(paths, args+4, arg_count-4); +} + + +int Item_func_json_search::compare_json_value_wild(json_engine_t *je, + const String *cmp_str) +{ + return my_wildcmp(collation.collation, + (const char *) je->value, (const char *) (je->value + je->value_len), + cmp_str->ptr(), cmp_str->end(), escape, wild_one, wild_many) ? 0 : 1; +} + + +static int append_json_path(String *str, const json_path_t *p) +{ + const json_path_step_t *c; + + if (str->append("\"$", 2)) + return TRUE; + + for (c= p->steps+1; c <= p->last_step; c++) + { + if (c->type & JSON_PATH_KEY) + { + if (str->append(".", 1) || + append_simple(str, c->key, c->key_end-c->key)) + return TRUE; + } + else /*JSON_PATH_ARRAY*/ + { + + if (str->append("[", 1) || + str->append_ulonglong(c->n_item) || + str->append("]", 1)) + return TRUE; + } + } + + return str->append("\"", 1); +} + + +static int json_path_compare(const json_path_t *a, const json_path_t *b) +{ + const json_path_step_t *sa= a->steps + 1; + const json_path_step_t *sb= b->steps + 1; + + if (a->last_step - sa > b->last_step - sb) + return -2; + + while (sa <= a->last_step) + { + if (sb > b->last_step) + return -2; + + if (!((sa->type & sb->type) & JSON_PATH_KEY_OR_ARRAY)) + goto step_failed; + + if (sa->type & JSON_PATH_ARRAY) + { + if (!(sa->type & JSON_PATH_WILD) && sa->n_item != sb->n_item) + goto step_failed; + } + else /* JSON_PATH_KEY */ + { + if (!(sa->type & JSON_PATH_WILD) && + (sa->key_end - sa->key != sb->key_end - sb->key || + memcmp(sa->key, sb->key, sa->key_end - sa->key) != 0)) + goto step_failed; + } + sb++; + sa++; + continue; + +step_failed: + if (!(sa->type & JSON_PATH_DOUBLE_WILD)) + return -1; + sb++; + } + + return sb <= b->last_step; +} + + +static bool path_ok(const json_path_with_flags *paths_list, int n_paths, + const json_path_t *p) +{ + for (; n_paths > 0; n_paths--, paths_list++) + { + if (json_path_compare(&paths_list->p, p) >= 0) + return TRUE; + } + return FALSE; +} + + +String *Item_func_json_search::val_str(String *str) +{ + String *js= args[0]->val_str(&tmp_js); + String *s_str= args[2]->val_str(&tmp_js); + json_engine_t je; + json_path_t p, sav_path; + uint n_arg; + + if (args[0]->null_value || args[2]->null_value) + goto null_return; + + if (parse_one_or_all(this, args[1], &ooa_parsed, ooa_constant, &mode_one)) + goto null_return; + + n_path_found= 0; + str->set_charset(js->charset()); + str->length(0); + + for (n_arg=4; n_arg < arg_count; n_arg++) + { + json_path_with_flags *c_path= paths + n_arg - 4; + if (!c_path->parsed) + { + String *s_p= args[n_arg]->val_str(tmp_paths + (n_arg-1)); + if (s_p && + json_path_setup(&c_path->p,s_p->charset(),(const uchar *) s_p->ptr(), + (const uchar *) s_p->ptr() + s_p->length())) + { + report_path_error(s_p, &c_path->p, n_arg); + goto null_return; + } + c_path->parsed= c_path->constant; + } + if (args[n_arg]->null_value) + goto null_return; + } + + json_scan_start(&je, js->charset(),(const uchar *) js->ptr(), + (const uchar *) js->ptr() + js->length()); + + p.last_step= p.steps; + p.steps[0].type= JSON_PATH_ARRAY_WILD; + p.steps[0].n_item= 0; + + do + { + switch (je.state) + { + case JST_KEY: + p.last_step->key= je.s.c_str; + while (json_read_keyname_chr(&je) == 0) + p.last_step->key_end= je.s.c_str; + if (je.s.error) + goto js_error; + /* Now we have je.state == JST_VALUE, so let's handle it. */ + + case JST_VALUE: + if (json_read_value(&je)) + goto js_error; + if (json_value_scalar(&je)) + { + if ((arg_count < 5 || path_ok(paths, n_arg - 4, &p)) && + compare_json_value_wild(&je, s_str) != 0) + { + ++n_path_found; + if (n_path_found == 1) + { + sav_path= p; + sav_path.last_step= sav_path.steps + (p.last_step - p.steps); + } + else + { + if (n_path_found == 2) + { + if (str->append("[", 1) || + append_json_path(str, &sav_path)) + goto js_error; + } + if (str->append(", ", 2) || append_json_path(str, &p)) + goto js_error; + } + + if (mode_one) + goto end; + } + if (p.last_step->type & JSON_PATH_ARRAY) + p.last_step->n_item++; + + } + else + { + p.last_step++; + p.last_step->type= (enum json_path_step_types) je.value_type; + p.last_step->n_item= 0; + } + break; + case JST_OBJ_END: + case JST_ARRAY_END: + p.last_step--; + if (p.last_step->type & JSON_PATH_ARRAY) + p.last_step->n_item++; + break; + default: + break; + } + } while (json_scan_next(&je) == 0); + + if (je.s.error) + goto js_error; + +end: + if (n_path_found == 0) + goto null_return; + if (n_path_found == 1) + { + if (append_json_path(str, &sav_path)) + goto js_error; + } + else + { + if (str->append("]", 1)) + goto js_error; + } + + null_value= 0; + return str; + + +js_error: + report_json_error(js, &je, 0); +null_return: + /* TODO: launch error messages. */ + null_value= 1; + return 0; +} + + +void Item_json_typecast::fix_length_and_dec() +{ + maybe_null= args[0]->maybe_null; + max_length= args[0]->max_length; +} + + +String *Item_json_typecast::val_str(String *str) +{ + String *vs= args[0]->val_str(str); + null_value= args[0]->null_value; + return vs; +} + diff --git a/sql/item_jsonfunc.h b/sql/item_jsonfunc.h new file mode 100644 index 00000000000..07741536f55 --- /dev/null +++ b/sql/item_jsonfunc.h @@ -0,0 +1,429 @@ +#ifndef ITEM_JSONFUNC_INCLUDED +#define ITEM_JSONFUNC_INCLUDED + +/* Copyright (c) 2016, MariaDB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + + +/* This file defines all JSON functions */ + + +#include +#include "item_cmpfunc.h" // Item_bool_func +#include "item_strfunc.h" // Item_str_func + + +class json_path_with_flags +{ +public: + json_path_t p; + bool constant; + bool parsed; + json_path_step_t *cur_step; + void set_constant_flag(bool s_constant) + { + constant= s_constant; + parsed= FALSE; + } +}; + + +class Item_func_json_valid: public Item_int_func +{ +protected: + String tmp_value; + +public: + Item_func_json_valid(THD *thd, Item *json) : Item_int_func(thd, json) {} + longlong val_int(); + const char *func_name() const { return "json_valid"; } + void fix_length_and_dec() + { + Item_int_func::fix_length_and_dec(); + maybe_null= 1; + } + bool is_bool_type() { return true; } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy(thd, mem_root, this); } +}; + + +class Item_func_json_exists: public Item_int_func +{ +protected: + json_path_with_flags path; + String tmp_js, tmp_path; + +public: + Item_func_json_exists(THD *thd, Item *js, Item *i_path): + Item_int_func(thd, js, i_path) {} + const char *func_name() const { return "json_exists"; } + bool is_bool_type() { return true; } + void fix_length_and_dec(); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy(thd, mem_root, this); } + longlong val_int(); +}; + + +class Item_func_json_value: public Item_str_func +{ +protected: + json_path_with_flags path; + String tmp_js, tmp_path; + +public: + Item_func_json_value(THD *thd, Item *js, Item *i_path): + Item_str_func(thd, js, i_path) {} + const char *func_name() const { return "json_value"; } + void fix_length_and_dec(); + String *val_str(String *); + virtual bool check_and_get_value(json_engine_t *je, String *res, int *error); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy(thd, mem_root, this); } +}; + + +class Item_func_json_query: public Item_func_json_value +{ +public: + Item_func_json_query(THD *thd, Item *js, Item *i_path): + Item_func_json_value(thd, js, i_path) {} + const char *func_name() const { return "json_query"; } + bool check_and_get_value(json_engine_t *je, String *res, int *error); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy(thd, mem_root, this); } +}; + + +class Item_func_json_quote: public Item_str_func +{ +protected: + String tmp_s; + +public: + Item_func_json_quote(THD *thd, Item *s): Item_str_func(thd, s) {} + const char *func_name() const { return "json_quote"; } + void fix_length_and_dec(); + String *val_str(String *); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy(thd, mem_root, this); } +}; + + +class Item_func_json_unquote: public Item_str_func +{ +protected: + String tmp_s; + +public: + Item_func_json_unquote(THD *thd, Item *s): Item_str_func(thd, s) {} + const char *func_name() const { return "json_unquote"; } + void fix_length_and_dec(); + String *val_str(String *); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy(thd, mem_root, this); } +}; + + +class Item_json_str_multipath: public Item_str_func +{ +protected: + json_path_with_flags *paths; + String *tmp_paths; +public: + Item_json_str_multipath(THD *thd, List &list): + Item_str_func(thd, list), tmp_paths(0) {} + bool fix_fields(THD *thd, Item **ref); + void cleanup(); + virtual uint get_n_paths() const = 0; + bool is_json_type() { return true; } +}; + + +class Item_func_json_extract: public Item_json_str_multipath +{ +protected: + String tmp_js; +public: + Item_func_json_extract(THD *thd, List &list): + Item_json_str_multipath(thd, list) {} + const char *func_name() const { return "json_extract"; } + void fix_length_and_dec(); + String *val_str(String *); + longlong val_int(); + uint get_n_paths() const { return arg_count - 1; } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy(thd, mem_root, this); } +}; + + +class Item_func_json_contains: public Item_int_func +{ +protected: + String tmp_js; + json_path_with_flags path; + String tmp_path; + bool a2_constant, a2_parsed; + String tmp_val, *val; +public: + Item_func_json_contains(THD *thd, List &list): + Item_int_func(thd, list) {} + const char *func_name() const { return "json_contains"; } + void fix_length_and_dec(); + longlong val_int(); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy(thd, mem_root, this); } +}; + + +class Item_func_json_contains_path: public Item_int_func +{ +protected: + String tmp_js; + json_path_with_flags *paths; + String *tmp_paths; + bool mode_one; + bool ooa_constant, ooa_parsed; + +public: + Item_func_json_contains_path(THD *thd, List &list): + Item_int_func(thd, list), tmp_paths(0) {} + const char *func_name() const { return "json_contains_path"; } + bool fix_fields(THD *thd, Item **ref); + void fix_length_and_dec(); + void cleanup(); + longlong val_int(); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy(thd, mem_root, this); } +}; + + +class Item_func_json_array: public Item_str_func +{ +protected: + String tmp_val; +public: + Item_func_json_array(THD *thd): + Item_str_func(thd) {} + Item_func_json_array(THD *thd, List &list): + Item_str_func(thd, list) {} + String *val_str(String *); + bool is_json_type() { return true; } + void fix_length_and_dec(); + const char *func_name() const { return "json_array"; } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy(thd, mem_root, this); } +}; + + +class Item_func_json_array_append: public Item_json_str_multipath +{ +protected: + String tmp_js; + String tmp_val; +public: + Item_func_json_array_append(THD *thd, List &list): + Item_json_str_multipath(thd, list) {} + void fix_length_and_dec(); + String *val_str(String *); + uint get_n_paths() const { return arg_count/2; } + const char *func_name() const { return "json_array_append"; } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy(thd, mem_root, this); } +}; + + +class Item_func_json_array_insert: public Item_func_json_array_append +{ +public: + Item_func_json_array_insert(THD *thd, List &list): + Item_func_json_array_append(thd, list) {} + String *val_str(String *); + const char *func_name() const { return "json_array_insert"; } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy(thd, mem_root, this); } +}; + + +class Item_func_json_object: public Item_func_json_array +{ +public: + Item_func_json_object(THD *thd): + Item_func_json_array(thd) {} + Item_func_json_object(THD *thd, List &list): + Item_func_json_array(thd, list) {} + String *val_str(String *); + bool is_json_type() { return true; } + const char *func_name() const { return "json_object"; } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy(thd, mem_root, this); } +}; + + +class Item_func_json_merge: public Item_func_json_array +{ +protected: + String tmp_js1, tmp_js2; +public: + Item_func_json_merge(THD *thd, List &list): + Item_func_json_array(thd, list) {} + String *val_str(String *); + bool is_json_type() { return true; } + const char *func_name() const { return "json_merge"; } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy(thd, mem_root, this); } +}; + + +class Item_func_json_length: public Item_int_func +{ +protected: + json_path_with_flags path; + String tmp_js; + String tmp_path; +public: + Item_func_json_length(THD *thd, List &list): + Item_int_func(thd, list) {} + const char *func_name() const { return "json_length"; } + void fix_length_and_dec(); + longlong val_int(); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy(thd, mem_root, this); } +}; + + +class Item_func_json_depth: public Item_int_func +{ +protected: + String tmp_js; +public: + Item_func_json_depth(THD *thd, Item *js): Item_int_func(thd, js) {} + const char *func_name() const { return "json_depth"; } + longlong val_int(); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy(thd, mem_root, this); } +}; + + +class Item_func_json_type: public Item_str_func +{ +protected: + String tmp_js; +public: + Item_func_json_type(THD *thd, Item *js): Item_str_func(thd, js) {} + const char *func_name() const { return "json_type"; } + void fix_length_and_dec(); + String *val_str(String *); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy(thd, mem_root, this); } +}; + + +class Item_func_json_insert: public Item_json_str_multipath +{ +protected: + String tmp_js; + String tmp_val; + bool mode_insert, mode_replace; +public: + Item_func_json_insert(bool i_mode, bool r_mode, THD *thd, List &list): + Item_json_str_multipath(thd, list), + mode_insert(i_mode), mode_replace(r_mode) {} + void fix_length_and_dec(); + String *val_str(String *); + uint get_n_paths() const { return arg_count/2; } + const char *func_name() const + { + return mode_insert ? + (mode_replace ? "json_set" : "json_insert") : "json_update"; + } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy(thd, mem_root, this); } +}; + + +class Item_func_json_remove: public Item_json_str_multipath +{ +protected: + String tmp_js; +public: + Item_func_json_remove(THD *thd, List &list): + Item_json_str_multipath(thd, list) {} + void fix_length_and_dec(); + String *val_str(String *); + uint get_n_paths() const { return arg_count - 1; } + const char *func_name() const { return "json_remove"; } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy(thd, mem_root, this); } +}; + + +class Item_func_json_keys: public Item_str_func +{ +protected: + json_path_with_flags path; + String tmp_js, tmp_path; + +public: + Item_func_json_keys(THD *thd, List &list): + Item_str_func(thd, list) {} + const char *func_name() const { return "json_keys"; } + void fix_length_and_dec(); + String *val_str(String *); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy(thd, mem_root, this); } +}; + + +class Item_func_json_search: public Item_json_str_multipath +{ +protected: + String tmp_js; + bool mode_one; + bool ooa_constant, ooa_parsed; + int escape; + int n_path_found; + json_path_t sav_path; + + int compare_json_value_wild(json_engine_t *je, const String *cmp_str); + +public: + Item_func_json_search(THD *thd, List &list): + Item_json_str_multipath(thd, list) {} + const char *func_name() const { return "json_search"; } + bool fix_fields(THD *thd, Item **ref); + void fix_length_and_dec(); + String *val_str(String *); + uint get_n_paths() const { return arg_count > 4 ? arg_count - 4 : 0; } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy(thd, mem_root, this); } +}; + + +class Item_json_typecast: public Item_str_func +{ +public: + Item_json_typecast(THD *thd, Item *a): Item_str_func(thd, a) {} + const char *func_name() const { return "cast_as_json"; } + bool is_json_type() { return true; } + void fix_length_and_dec(); + String *val_str(String *str); + Item *get_copy(THD *thd, MEM_ROOT *mem_root) + { return get_item_copy(thd, mem_root, this); } +}; + + +#endif /* ITEM_JSONFUNC_INCLUDED */ diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index acd3d74c12b..9740dc9dae1 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -164,31 +164,6 @@ String *Item_func_md5::val_str_ascii(String *str) } -/* - The MD5()/SHA() functions treat their parameter as being a case sensitive. - Thus we set binary collation on it so different instances of MD5() will be - compared properly. -*/ -static CHARSET_INFO *get_checksum_charset(const char *csname) -{ - CHARSET_INFO *cs= get_charset_by_csname(csname, MY_CS_BINSORT, MYF(0)); - if (!cs) - { - // Charset has no binary collation: use my_charset_bin. - cs= &my_charset_bin; - } - return cs; -} - - -void Item_func_md5::fix_length_and_dec() -{ - CHARSET_INFO *cs= get_checksum_charset(args[0]->collation.collation->csname); - args[0]->collation.set(cs, DERIVATION_COERCIBLE); - fix_length_and_charset(32, default_charset()); -} - - String *Item_func_sha::val_str_ascii(String *str) { DBUG_ASSERT(fixed == 1); @@ -214,8 +189,6 @@ String *Item_func_sha::val_str_ascii(String *str) void Item_func_sha::fix_length_and_dec() { - CHARSET_INFO *cs= get_checksum_charset(args[0]->collation.collation->csname); - args[0]->collation.set(cs, DERIVATION_COERCIBLE); // size of hex representation of hash fix_length_and_charset(SHA1_HASH_SIZE * 2, default_charset()); } @@ -345,9 +318,6 @@ void Item_func_sha2::fix_length_and_dec() "sha2"); } - CHARSET_INFO *cs= get_checksum_charset(args[0]->collation.collation->csname); - args[0]->collation.set(cs, DERIVATION_COERCIBLE); - #else THD *thd= current_thd; push_warning_printf(thd, @@ -2671,7 +2641,7 @@ String *Item_func_format::val_str_ascii(String *str) return 0; /* purecov: inspected */ nr= my_double_round(nr, (longlong) dec, FALSE, FALSE); str->set_real(nr, dec, &my_charset_numeric); - if (isnan(nr) || my_isinf(nr)) + if (!isfinite(nr)) return str; str_length=str->length(); } @@ -3487,13 +3457,11 @@ bool Item_func_set_collation::eq(const Item *item, bool binary_cmp) const void Item_func_set_collation::print(String *str, enum_query_type query_type) { - str->append('('); - args[0]->print(str, query_type); + args[0]->print_parenthesised(str, query_type, precedence()); str->append(STRING_WITH_LEN(" collate ")); DBUG_ASSERT(args[1]->basic_const_item() && args[1]->type() == Item::STRING_ITEM); ((Item_string *)args[1])->print_value(str); - str->append(')'); } String *Item_func_charset::val_str(String *str) @@ -3621,6 +3589,21 @@ nl: } +void Item_func_weight_string::print(String *str, enum_query_type query_type) +{ + str->append(func_name()); + str->append('('); + args[0]->print(str, query_type); + str->append(','); + str->append_ulonglong(result_length); + str->append(','); + str->append_ulonglong(nweights); + str->append(','); + str->append_ulonglong(flags); + str->append(')'); +} + + String *Item_func_hex::val_str_ascii(String *str) { String *res; @@ -4728,7 +4711,7 @@ void Item_func_dyncol_add::print(String *str, enum_query_type query_type) { DBUG_ASSERT((arg_count & 0x1) == 1); // odd number of arguments - str->append(STRING_WITH_LEN("column_create(")); + str->append(STRING_WITH_LEN("column_add(")); args[arg_count - 1]->print(str, query_type); str->append(','); print_arguments(str, query_type); diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 25b63ebe73d..65c6dacbc73 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -97,23 +97,69 @@ public: }; -class Item_func_md5 :public Item_str_ascii_func +/** + Functions that return a checksum or a hash of the argument, + or somehow else encode or decode the argument, + returning an ASCII-repertoire string. +*/ +class Item_str_ascii_checksum_func: public Item_str_ascii_func +{ +public: + Item_str_ascii_checksum_func(THD *thd, Item *a) + :Item_str_ascii_func(thd, a) { } + Item_str_ascii_checksum_func(THD *thd, Item *a, Item *b) + :Item_str_ascii_func(thd, a, b) { } + bool eq(const Item *item, bool binary_cmp) const + { + // Always use binary argument comparison: MD5('x') != MD5('X') + return Item_func::eq(item, true); + } +}; + + +/** + Functions that return a checksum or a hash of the argument, + or somehow else encode or decode the argument, + returning a binary string. +*/ +class Item_str_binary_checksum_func: public Item_str_func +{ +public: + Item_str_binary_checksum_func(THD *thd, Item *a) + :Item_str_func(thd, a) { } + Item_str_binary_checksum_func(THD *thd, Item *a, Item *b) + :Item_str_func(thd, a, b) { } + bool eq(const Item *item, bool binary_cmp) const + { + /* + Always use binary argument comparison: + FROM_BASE64('test') != FROM_BASE64('TEST') + */ + return Item_func::eq(item, true); + } +}; + + +class Item_func_md5 :public Item_str_ascii_checksum_func { String tmp_value; public: - Item_func_md5(THD *thd, Item *a): Item_str_ascii_func(thd, a) {} + Item_func_md5(THD *thd, Item *a): Item_str_ascii_checksum_func(thd, a) {} String *val_str_ascii(String *); - void fix_length_and_dec(); + void fix_length_and_dec() + { + fix_length_and_charset(32, default_charset()); + } const char *func_name() const { return "md5"; } Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } }; -class Item_func_sha :public Item_str_ascii_func +class Item_func_sha :public Item_str_ascii_checksum_func { public: - Item_func_sha(THD *thd, Item *a): Item_str_ascii_func(thd, a) {} + Item_func_sha(THD *thd, Item *a): Item_str_ascii_checksum_func(thd, a) {} String *val_str_ascii(String *); void fix_length_and_dec(); const char *func_name() const { return "sha"; } @@ -121,10 +167,11 @@ public: { return get_item_copy(thd, mem_root, this); } }; -class Item_func_sha2 :public Item_str_ascii_func +class Item_func_sha2 :public Item_str_ascii_checksum_func { public: - Item_func_sha2(THD *thd, Item *a, Item *b): Item_str_ascii_func(thd, a, b) {} + Item_func_sha2(THD *thd, Item *a, Item *b) + :Item_str_ascii_checksum_func(thd, a, b) {} String *val_str_ascii(String *); void fix_length_and_dec(); const char *func_name() const { return "sha2"; } @@ -132,11 +179,12 @@ public: { return get_item_copy(thd, mem_root, this); } }; -class Item_func_to_base64 :public Item_str_ascii_func +class Item_func_to_base64 :public Item_str_ascii_checksum_func { String tmp_value; public: - Item_func_to_base64(THD *thd, Item *a): Item_str_ascii_func(thd, a) {} + Item_func_to_base64(THD *thd, Item *a) + :Item_str_ascii_checksum_func(thd, a) {} String *val_str_ascii(String *); void fix_length_and_dec(); const char *func_name() const { return "to_base64"; } @@ -144,11 +192,12 @@ public: { return get_item_copy(thd, mem_root, this); } }; -class Item_func_from_base64 :public Item_str_func +class Item_func_from_base64 :public Item_str_binary_checksum_func { String tmp_value; public: - Item_func_from_base64(THD *thd, Item *a): Item_str_func(thd, a) {} + Item_func_from_base64(THD *thd, Item *a) + :Item_str_binary_checksum_func(thd, a) { } String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "from_base64"; } @@ -158,7 +207,7 @@ public: #include -class Item_aes_crypt :public Item_str_func +class Item_aes_crypt :public Item_str_binary_checksum_func { enum { AES_KEY_LENGTH = 128 }; void create_key(String *user_key, uchar* key); @@ -166,7 +215,8 @@ class Item_aes_crypt :public Item_str_func protected: int what; public: - Item_aes_crypt(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} + Item_aes_crypt(THD *thd, Item *a, Item *b) + :Item_str_binary_checksum_func(thd, a, b) {} String *val_str(String *); }; @@ -481,7 +531,7 @@ public: authentication procedure works, see comments in password.c. */ -class Item_func_password :public Item_str_ascii_func +class Item_func_password :public Item_str_ascii_checksum_func { public: enum PW_Alg {OLD, NEW}; @@ -491,9 +541,9 @@ private: bool deflt; public: Item_func_password(THD *thd, Item *a): - Item_str_ascii_func(thd, a), alg(NEW), deflt(1) {} + Item_str_ascii_checksum_func(thd, a), alg(NEW), deflt(1) {} Item_func_password(THD *thd, Item *a, PW_Alg al): - Item_str_ascii_func(thd, a), alg(al), deflt(0) {} + Item_str_ascii_checksum_func(thd, a), alg(al), deflt(0) {} String *val_str_ascii(String *str); bool fix_fields(THD *thd, Item **ref); void fix_length_and_dec() @@ -513,12 +563,14 @@ public: -class Item_func_des_encrypt :public Item_str_func +class Item_func_des_encrypt :public Item_str_binary_checksum_func { String tmp_value,tmp_arg; public: - Item_func_des_encrypt(THD *thd, Item *a): Item_str_func(thd, a) {} - Item_func_des_encrypt(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} + Item_func_des_encrypt(THD *thd, Item *a) + :Item_str_binary_checksum_func(thd, a) {} + Item_func_des_encrypt(THD *thd, Item *a, Item *b) + :Item_str_binary_checksum_func(thd, a, b) {} String *val_str(String *); void fix_length_and_dec() { @@ -531,12 +583,14 @@ public: { return get_item_copy(thd, mem_root, this); } }; -class Item_func_des_decrypt :public Item_str_func +class Item_func_des_decrypt :public Item_str_binary_checksum_func { String tmp_value; public: - Item_func_des_decrypt(THD *thd, Item *a): Item_str_func(thd, a) {} - Item_func_des_decrypt(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} + Item_func_des_decrypt(THD *thd, Item *a) + :Item_str_binary_checksum_func(thd, a) {} + Item_func_des_decrypt(THD *thd, Item *a, Item *b) + :Item_str_binary_checksum_func(thd, a, b) {} String *val_str(String *); void fix_length_and_dec() { @@ -551,7 +605,13 @@ public: { return get_item_copy(thd, mem_root, this); } }; -class Item_func_encrypt :public Item_str_func + +/** + QQ: Item_func_encrypt should derive from Item_str_ascii_checksum_func. + However, it should be fixed to handle UCS2, UTF16, UTF32 properly first, + as the underlying crypt() call expects a null-terminated input string. +*/ +class Item_func_encrypt :public Item_str_binary_checksum_func { String tmp_value; @@ -561,11 +621,12 @@ class Item_func_encrypt :public Item_str_func collation.set(&my_charset_bin); } public: - Item_func_encrypt(THD *thd, Item *a): Item_str_func(thd, a) + Item_func_encrypt(THD *thd, Item *a): Item_str_binary_checksum_func(thd, a) { constructor_helper(); } - Item_func_encrypt(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) + Item_func_encrypt(THD *thd, Item *a, Item *b) + :Item_str_binary_checksum_func(thd, a, b) { constructor_helper(); } @@ -583,7 +644,7 @@ public: #include "sql_crypt.h" -class Item_func_encode :public Item_str_func +class Item_func_encode :public Item_str_binary_checksum_func { private: /** Whether the PRNG has already been seeded. */ @@ -592,7 +653,7 @@ protected: SQL_CRYPT sql_crypt; public: Item_func_encode(THD *thd, Item *a, Item *seed_arg): - Item_str_func(thd, a, seed_arg) {} + Item_str_binary_checksum_func(thd, a, seed_arg) {} String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "encode"; } @@ -911,12 +972,12 @@ public: }; -class Item_func_hex :public Item_str_ascii_func +class Item_func_hex :public Item_str_ascii_checksum_func { String tmp_value; public: Item_func_hex(THD *thd, Item *a): - Item_str_ascii_func(thd, a) {} + Item_str_ascii_checksum_func(thd, a) {} const char *func_name() const { return "hex"; } String *val_str_ascii(String *); void fix_length_and_dec() @@ -1171,6 +1232,7 @@ public: void fix_length_and_dec(); bool eq(const Item *item, bool binary_cmp) const; const char *func_name() const { return "collate"; } + enum precedence precedence() const { return COLLATE_PRECEDENCE; } enum Functype functype() const { return COLLATE_FUNC; } virtual void print(String *str, enum_query_type query_type); Item_field *field_for_view_update() @@ -1254,6 +1316,7 @@ public: } Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) { return this; } + void print(String *str, enum_query_type query_type); Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } }; @@ -1289,11 +1352,12 @@ public: #define ZLIB_DEPENDED_FUNCTION { null_value=1; return 0; } #endif -class Item_func_compress: public Item_str_func +class Item_func_compress: public Item_str_binary_checksum_func { String buffer; public: - Item_func_compress(THD *thd, Item *a): Item_str_func(thd, a) {} + Item_func_compress(THD *thd, Item *a) + :Item_str_binary_checksum_func(thd, a) {} void fix_length_and_dec(){max_length= (args[0]->max_length*120)/100+12;} const char *func_name() const{return "compress";} String *val_str(String *) ZLIB_DEPENDED_FUNCTION @@ -1301,11 +1365,12 @@ public: { return get_item_copy(thd, mem_root, this); } }; -class Item_func_uncompress: public Item_str_func +class Item_func_uncompress: public Item_str_binary_checksum_func { String buffer; public: - Item_func_uncompress(THD *thd, Item *a): Item_str_func(thd, a) {} + Item_func_uncompress(THD *thd, Item *a) + :Item_str_binary_checksum_func(thd, a) {} void fix_length_and_dec(){ maybe_null= 1; max_length= MAX_BLOB_WIDTH; } const char *func_name() const{return "uncompress";} String *val_str(String *) ZLIB_DEPENDED_FUNCTION diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 21c633333f1..89c663b5f16 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -228,6 +228,7 @@ bool Item_subselect::select_transformer(JOIN *join) { DBUG_ENTER("Item_subselect::select_transformer"); + DBUG_ASSERT(thd == join->thd); DBUG_RETURN(false); } @@ -629,6 +630,7 @@ bool Item_subselect::is_expensive() examined_rows+= cur_join->get_examined_rows(); } + // here we are sure that subquery is optimized so thd is set return !all_are_simple && (examined_rows > thd->variables.expensive_subquery_limit); } @@ -693,6 +695,7 @@ bool Item_subselect::exec() subselect_engine *org_engine= engine; DBUG_ENTER("Item_subselect::exec"); + DBUG_ASSERT(fixed); /* Do not execute subselect in case of a fatal error @@ -741,6 +744,7 @@ int Item_in_subselect::optimize(double *out_rows, double *cost) { int res; DBUG_ENTER("Item_in_subselect::optimize"); + DBUG_ASSERT(fixed); SELECT_LEX *save_select= thd->lex->current_select; JOIN *join= unit->first_select()->join; @@ -857,6 +861,7 @@ bool Item_in_subselect::expr_cache_is_needed(THD *thd) bool Item_in_subselect::exec() { DBUG_ENTER("Item_in_subselect::exec"); + DBUG_ASSERT(fixed); /* Initialize the cache of the left predicate operand. This has to be done as late as now, because Cached_item directly contains a resolved field (not @@ -911,6 +916,7 @@ table_map Item_subselect::used_tables() const bool Item_subselect::const_item() const { + DBUG_ASSERT(thd); return (thd->lex->context_analysis_only ? FALSE : forced_const || const_item_cache); @@ -1112,10 +1118,11 @@ Item_singlerow_subselect::select_transformer(JOIN *join) DBUG_ENTER("Item_singlerow_subselect::select_transformer"); if (changed) DBUG_RETURN(false); + DBUG_ASSERT(join->thd == thd); SELECT_LEX *select_lex= join->select_lex; Query_arena *arena= thd->stmt_arena; - + if (!select_lex->master_unit()->is_union() && !select_lex->table_list.elements && select_lex->item_list.elements == 1 && @@ -1790,6 +1797,7 @@ Item_in_subselect::single_value_transformer(JOIN *join) { SELECT_LEX *select_lex= join->select_lex; DBUG_ENTER("Item_in_subselect::single_value_transformer"); + DBUG_ASSERT(thd == join->thd); /* Check that the right part of the subselect contains no more than one @@ -1904,6 +1912,7 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join) Item **place= optimizer->arguments() + 1; SELECT_LEX *select_lex= join->select_lex; Item *subs; + DBUG_ASSERT(thd == join->thd); /* */ @@ -2012,6 +2021,7 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join) bool Item_in_subselect::fix_having(Item *having, SELECT_LEX *select_lex) { bool fix_res= 0; + DBUG_ASSERT(thd); if (!having->fixed) { select_lex->having_fix_field= 1; @@ -2074,6 +2084,7 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN *join, Item **having_item) { SELECT_LEX *select_lex= join->select_lex; + DBUG_ASSERT(thd == join->thd); /* The non-transformed HAVING clause of 'join' may be stored in two ways during JOIN::optimize: this->tmp_having= this->having; this->having= 0; @@ -2215,6 +2226,7 @@ Item_in_subselect::row_value_transformer(JOIN *join) uint cols_num= left_expr->cols(); DBUG_ENTER("Item_in_subselect::row_value_transformer"); + DBUG_ASSERT(thd == join->thd); // psergey: duplicated_subselect_card_check if (select_lex->item_list.elements != cols_num) @@ -2326,6 +2338,7 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join, !select_lex->table_list.elements); DBUG_ENTER("Item_in_subselect::create_row_in_to_exists_cond"); + DBUG_ASSERT(thd == join->thd); *where_item= NULL; *having_item= NULL; @@ -2571,6 +2584,7 @@ bool Item_in_subselect::inject_in_to_exists_cond(JOIN *join_arg) Item *having_item= join_arg->in_to_exists_having; DBUG_ENTER("Item_in_subselect::inject_in_to_exists_cond"); + DBUG_ASSERT(thd == join_arg->thd); if (where_item) { @@ -2700,8 +2714,8 @@ static bool check_equality_for_exist2in(Item_func *func, args[0]->all_used_tables() == OUTER_REF_TABLE_BIT) { /* It is Item_field or Item_direct_view_ref) */ - DBUG_ASSERT(args[0]->type() == Item::FIELD_ITEM || - args[0]->type() == Item::REF_ITEM); + DBUG_ASSERT(args[1]->type() == Item::FIELD_ITEM || + args[1]->type() == Item::REF_ITEM); *local_field= (Item_ident *)args[1]; *outer_exp= args[0]; return TRUE; @@ -3099,6 +3113,7 @@ Item_in_subselect::select_in_like_transformer(JOIN *join) bool result; DBUG_ENTER("Item_in_subselect::select_in_like_transformer"); + DBUG_ASSERT(thd == join->thd); /* IN/SOME/ALL/ANY subqueries aren't support LIMIT clause. Without it @@ -3309,6 +3324,7 @@ bool Item_in_subselect::setup_mat_engine() subselect_single_select_engine *select_engine; DBUG_ENTER("Item_in_subselect::setup_mat_engine"); + DBUG_ASSERT(thd); /* The select_engine (that executes transformed IN=>EXISTS subselects) is @@ -3347,6 +3363,7 @@ bool Item_in_subselect::setup_mat_engine() bool Item_in_subselect::init_left_expr_cache() { JOIN *outer_join; + DBUG_ASSERT(thd); outer_join= unit->outer_select()->join; /* @@ -3374,6 +3391,7 @@ bool Item_in_subselect::init_left_expr_cache() bool Item_in_subselect::init_cond_guards() { + DBUG_ASSERT(thd); uint cols_num= left_expr->cols(); if (!abort_on_null && left_expr->maybe_null && !pushed_cond_guards) { @@ -4572,7 +4590,7 @@ subselect_hash_sj_engine::get_strategy_using_schema() return COMPLETE_MATCH; else { - List_iterator inner_col_it(*item_in->unit->get_unit_column_types()); + List_iterator inner_col_it(*item_in->unit->get_column_types(false)); Item *outer_col, *inner_col; for (uint i= 0; i < item_in->left_expr->cols(); i++) @@ -6186,7 +6204,7 @@ subselect_rowid_merge_engine::init(MY_BITMAP *non_null_key_parts, Check if the first and only indexed column contains NULL in the curent row, and add the row number to the corresponding key. */ - if (tmp_table->field[merge_keys[i]->get_field_idx(0)]->is_null()) + if (merge_keys[i]->get_field(0)->is_null()) merge_keys[i]->set_null(cur_rownum); else merge_keys[i]->add_key(cur_rownum); @@ -6662,4 +6680,3 @@ void Item_subselect::init_expr_cache_tracker(THD *thd) DBUG_ASSERT(expr_cache->type() == Item::EXPR_CACHE_ITEM); node->cache_tracker= ((Item_cache_wrapper *)expr_cache)->init_tracker(qw->mem_root); } - diff --git a/sql/item_subselect.h b/sql/item_subselect.h index 83340573e8a..823dbc6c281 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -1236,10 +1236,10 @@ public: uint get_column_count() { return key_column_count; } uint get_keyid() { return keyid; } - uint get_field_idx(uint i) + Field *get_field(uint i) { DBUG_ASSERT(i < key_column_count); - return key_columns[i]->field->field_index; + return key_columns[i]->field; } rownum_t get_min_null_row() { return min_null_row; } rownum_t get_max_null_row() { return max_null_row; } diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 83378c2e994..51a6c2bd3eb 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -3156,21 +3156,18 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)), /* stop if length of result more than max_length */ if (result->length() > max_length) { - int well_formed_error; CHARSET_INFO *cs= item->collation.collation; const char *ptr= result->ptr(); - uint add_length; THD *thd= current_thd; /* It's ok to use item->result.length() as the fourth argument as this is never used to limit the length of the data. Cut is done with the third argument. */ - add_length= cs->cset->well_formed_len(cs, - ptr + old_length, - ptr + max_length, - result->length(), - &well_formed_error); + uint add_length= Well_formed_prefix(cs, + ptr + old_length, + ptr + max_length, + result->length()).length(); result->length(old_length + add_length); item->warning_for_row= TRUE; push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, diff --git a/sql/item_sum.h b/sql/item_sum.h index b9075db0196..84049814ef9 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -1195,7 +1195,6 @@ public: fixed= true; } table_map used_tables() const { return (table_map) 1L; } - void set_result_field(Field *) { DBUG_ASSERT(0); } void save_in_result_field(bool no_conversions) { DBUG_ASSERT(0); } bool check_vcol_func_processor(void *arg) { diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 41dc96717fe..27ce83f3f2b 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1044,13 +1044,15 @@ uint week_mode(uint mode) longlong Item_func_week::val_int() { DBUG_ASSERT(fixed == 1); - uint year; + uint year, week_format; MYSQL_TIME ltime; if (get_arg0_date(<ime, TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE)) return 0; - return (longlong) calc_week(<ime, - week_mode((uint) args[1]->val_int()), - &year); + if (arg_count > 1) + week_format= args[1]->val_int(); + else + week_format= current_thd->variables.default_week_format; + return (longlong) calc_week(<ime, week_mode(week_format), &year); } @@ -1649,6 +1651,15 @@ bool Item_func_curtime::get_date(MYSQL_TIME *res, return 0; } +void Item_func_curtime::print(String *str, enum_query_type query_type) +{ + str->append(func_name()); + str->append('('); + if (decimals) + str->append_ulonglong(decimals); + str->append(')'); +} + static void set_sec_part(ulong sec_part, MYSQL_TIME *ltime, Item *item) { DBUG_ASSERT(item->decimals == AUTO_SEC_PART_DIGITS || @@ -1702,6 +1713,15 @@ bool Item_func_now::fix_fields(THD *thd, Item **items) return Item_temporal_func::fix_fields(thd, items); } +void Item_func_now::print(String *str, enum_query_type query_type) +{ + str->append(func_name()); + str->append('('); + if (decimals) + str->append_ulonglong(decimals); + str->append(')'); +} + /** Converts current time in my_time_t to MYSQL_TIME represenatation for local time zone. Defines time zone (local) used for whole NOW function. @@ -2179,13 +2199,11 @@ static const char *interval_names[]= void Item_date_add_interval::print(String *str, enum_query_type query_type) { - str->append('('); - args[0]->print(str, query_type); + args[0]->print_parenthesised(str, query_type, ADDINTERVAL_PRECEDENCE); str->append(date_sub_interval?" - interval ":" + interval "); - args[1]->print(str, query_type); + args[1]->print_parenthesised(str, query_type, INTERVAL_PRECEDENCE); str->append(' '); str->append(interval_names[int_type]); - str->append(')'); } void Item_extract::print(String *str, enum_query_type query_type) @@ -2334,7 +2352,7 @@ void Item_temporal_typecast::print(String *str, enum_query_type query_type) args[0]->print(str, query_type); str->append(STRING_WITH_LEN(" as ")); str->append(cast_type()); - if (decimals) + if (decimals && decimals != NOT_FIXED_DEC) { str->append('('); str->append(llstr(decimals, buf)); @@ -2468,13 +2486,9 @@ String *Item_char_typecast::val_str(String *str) if (!charset_conversion) { // Try to reuse the original string (if well formed). - MY_STRCOPY_STATUS status; - cs->cset->well_formed_char_length(cs, res->ptr(), res->end(), - cast_length, &status); - if (!status.m_well_formed_error_pos) - { - res= reuse(res, status.m_source_end_pos - res->ptr()); - } + Well_formed_prefix prefix(cs, res->ptr(), res->end(), cast_length); + if (!prefix.well_formed_error_pos()) + res= reuse(res, prefix.length()); goto end; } // Character set conversion, or bad bytes were found. diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 3d2b5c8c9e9..d8f69e2098d 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -115,15 +115,6 @@ public: longlong val_int_endpoint(bool left_endp, bool *incl_endp); bool check_partition_func_processor(void *bool_arg) { return FALSE;} - bool intro_version(void *int_arg) - { - int *input_version= (int*)int_arg; - /* This function was introduced in 5.5 */ - int output_version= MY_MAX(*input_version, 50500); - *input_version= output_version; - return 0; - } - /* Only meaningful with date part and optional time part */ bool check_valid_arguments_processor(void *int_arg) { @@ -334,6 +325,7 @@ public: class Item_func_week :public Item_int_func { public: + Item_func_week(THD *thd, Item *a): Item_int_func(thd, a) {} Item_func_week(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {} longlong val_int(); const char *func_name() const { return "week"; } @@ -343,6 +335,16 @@ public: max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } + bool check_vcol_func_processor(void *arg) + { + if (arg_count == 2) + return FALSE; + return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); + } + bool check_valid_arguments_processor(void *int_arg) + { + return arg_count == 2; + } Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } }; @@ -653,6 +655,7 @@ public: { return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC); } + void print(String *str, enum_query_type query_type); }; @@ -738,6 +741,7 @@ public: */ return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC); } + void print(String *str, enum_query_type query_type); }; @@ -745,7 +749,7 @@ class Item_func_now_local :public Item_func_now { public: Item_func_now_local(THD *thd, uint dec): Item_func_now(thd, dec) {} - const char *func_name() const { return "now"; } + const char *func_name() const { return "current_timestamp"; } virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time); virtual enum Functype functype() const { return NOW_FUNC; } Item *get_copy(THD *thd, MEM_ROOT *mem_root) @@ -914,6 +918,7 @@ public: bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date); bool eq(const Item *item, bool binary_cmp) const; void print(String *str, enum_query_type query_type); + enum precedence precedence() const { return ADDINTERVAL_PRECEDENCE; } bool need_parentheses_in_default() { return true; } Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } @@ -981,7 +986,12 @@ class Item_extract :public Item_int_func bool eq(const Item *item, bool binary_cmp) const; void print(String *str, enum_query_type query_type); bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} + bool check_vcol_func_processor(void *arg) + { + if (int_type != INTERVAL_WEEK) + return FALSE; + return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); + } bool check_valid_arguments_processor(void *int_arg) { switch (int_type) { diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc index cbbdeea0205..4d848a0f737 100644 --- a/sql/item_xmlfunc.cc +++ b/sql/item_xmlfunc.cc @@ -13,10 +13,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifdef __GNUC__ -#pragma implementation -#endif - #include #include "sql_priv.h" /* @@ -406,19 +402,6 @@ public: }; -/* - We need to distinguish a number from a boolean: - a[1] and a[true] are different things in XPath. -*/ -class Item_bool :public Item_int -{ -public: - Item_bool(THD *thd, int32 i): Item_int(thd, i) {} - const char *func_name() const { return "xpath_bool"; } - bool is_bool_type() { return true; } -}; - - /* Converts its argument into a boolean value. * a number is true if it is non-zero @@ -1214,13 +1197,13 @@ my_xpath_keyword(MY_XPATH *x, static Item *create_func_true(MY_XPATH *xpath, Item **args, uint nargs) { - return new (xpath->thd->mem_root) Item_bool(xpath->thd, 1); + return new (xpath->thd->mem_root) Item_bool(xpath->thd, "xpath_bool", 1); } static Item *create_func_false(MY_XPATH *xpath, Item **args, uint nargs) { - return new (xpath->thd->mem_root) Item_bool(xpath->thd, 0); + return new (xpath->thd->mem_root) Item_bool(xpath->thd, "xpath_bool", 0); } diff --git a/sql/item_xmlfunc.h b/sql/item_xmlfunc.h index 3c58955c96a..3c071b897e2 100644 --- a/sql/item_xmlfunc.h +++ b/sql/item_xmlfunc.h @@ -21,11 +21,6 @@ /* This file defines all XML functions */ -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - - typedef struct my_xml_node_st MY_XML_NODE; diff --git a/sql/lex.h b/sql/lex.h index d82dcf4e94a..c40aa8f546d 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -278,6 +278,7 @@ static SYMBOL symbols[] = { { "IGNORE", SYM(IGNORE_SYM)}, { "IGNORE_DOMAIN_IDS", SYM(IGNORE_DOMAIN_IDS_SYM)}, { "IGNORE_SERVER_IDS", SYM(IGNORE_SERVER_IDS_SYM)}, + { "IMMEDIATE", SYM(IMMEDIATE_SYM)}, { "IMPORT", SYM(IMPORT)}, { "IN", SYM(IN_SYM)}, { "INDEX", SYM(INDEX_SYM)}, @@ -308,6 +309,7 @@ static SYMBOL symbols[] = { { "ITERATE", SYM(ITERATE_SYM)}, { "INVOKER", SYM(INVOKER_SYM)}, { "JOIN", SYM(JOIN_SYM)}, + { "JSON", SYM(JSON_SYM)}, { "KEY", SYM(KEY_SYM)}, { "KEYS", SYM(KEYS)}, { "KEY_BLOCK_SIZE", SYM(KEY_BLOCK_SIZE)}, @@ -342,6 +344,7 @@ static SYMBOL symbols[] = { { "LOW_PRIORITY", SYM(LOW_PRIORITY)}, { "MASTER", SYM(MASTER_SYM)}, { "MASTER_CONNECT_RETRY", SYM(MASTER_CONNECT_RETRY_SYM)}, + { "MASTER_DELAY", SYM(MASTER_DELAY_SYM)}, { "MASTER_GTID_POS", SYM(MASTER_GTID_POS_SYM)}, { "MASTER_HOST", SYM(MASTER_HOST_SYM)}, { "MASTER_LOG_FILE", SYM(MASTER_LOG_FILE_SYM)}, @@ -643,7 +646,7 @@ static SYMBOL symbols[] = { { "UPGRADE", SYM(UPGRADE_SYM)}, { "USAGE", SYM(USAGE)}, { "USE", SYM(USE_SYM)}, - { "USER", SYM(USER)}, + { "USER", SYM(USER_SYM)}, { "USER_RESOURCES", SYM(RESOURCES)}, { "USE_FRM", SYM(USE_FRM)}, { "USING", SYM(USING)}, @@ -711,7 +714,7 @@ static SYMBOL sql_functions[] = { { "PERCENT_RANK", SYM(PERCENT_RANK_SYM)}, { "RANK", SYM(RANK_SYM)}, { "ROW_NUMBER", SYM(ROW_NUMBER_SYM)}, - { "SESSION_USER", SYM(USER)}, + { "SESSION_USER", SYM(USER_SYM)}, { "STD", SYM(STD_SYM)}, { "STDDEV", SYM(STD_SYM)}, { "STDDEV_POP", SYM(STD_SYM)}, @@ -721,7 +724,7 @@ static SYMBOL sql_functions[] = { { "SUBSTRING", SYM(SUBSTRING)}, { "SUM", SYM(SUM_SYM)}, { "SYSDATE", SYM(SYSDATE)}, - { "SYSTEM_USER", SYM(USER)}, + { "SYSTEM_USER", SYM(USER_SYM)}, { "TRIM", SYM(TRIM)}, { "VARIANCE", SYM(VARIANCE_SYM)}, { "VAR_POP", SYM(VARIANCE_SYM)}, diff --git a/sql/lock.cc b/sql/lock.cc index 8aebc1f30d9..a51c34365fa 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -164,18 +164,12 @@ lock_tables_check(THD *thd, TABLE **tables, uint count, uint flags) write we must own metadata lock of MDL_SHARED_WRITE or stronger type. For table to be locked for read we must own metadata lock of MDL_SHARED_READ or stronger type). - The only exception are HANDLER statements which are allowed to - lock table for read while having only MDL_SHARED lock on it. */ DBUG_ASSERT(t->s->tmp_table || thd->mdl_context.is_lock_owner(MDL_key::TABLE, t->s->db.str, t->s->table_name.str, t->reginfo.lock_type >= TL_WRITE_ALLOW_WRITE ? - MDL_SHARED_WRITE : MDL_SHARED_READ) || - (t->open_by_handler && - thd->mdl_context.is_lock_owner(MDL_key::TABLE, - t->s->db.str, t->s->table_name.str, - MDL_SHARED))); + MDL_SHARED_WRITE : MDL_SHARED_READ)); /* Prevent modifications to base tables if READ_ONLY is activated. @@ -411,7 +405,6 @@ static int lock_external(THD *thd, TABLE **tables, uint count) } else { - (*tables)->db_stat &= ~ HA_BLOCK_LOCK; (*tables)->current_lock= lock_type; } } diff --git a/sql/log.cc b/sql/log.cc index 569942ac485..57984bd03f4 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -301,6 +301,9 @@ public: { compute_statistics(); truncate(0); + if(cache_log.file != -1) + my_chsize(cache_log.file, 0, 0, MYF(MY_WME)); + changes_to_non_trans_temp_table_flag= FALSE; incident= FALSE; before_stmt_pos= MY_OFF_T_UNDEF; @@ -1307,7 +1310,7 @@ bool LOGGER::slow_log_print(THD *thd, const char *query, uint query_length, /* fill in user_host value: the format is "%s[%s] @ %s [%s]" */ user_host_len= (strxnmov(user_host_buff, MAX_USER_HOST_SIZE, - sctx->priv_user ? sctx->priv_user : "", "[", + sctx->priv_user, "[", sctx->user ? sctx->user : (thd->slave_thread ? "SQL_SLAVE" : ""), "] @ ", sctx->host ? sctx->host : "", " [", sctx->ip ? sctx->ip : "", "]", NullS) - @@ -2765,9 +2768,7 @@ int MYSQL_LOG::generate_new_name(char *new_name, const char *log_name, { THD *thd= current_thd; if (thd) - my_printf_error(ER_NO_UNIQUE_LOGFILE, - ER_THD(thd, ER_NO_UNIQUE_LOGFILE), - MYF(ME_FATALERROR), log_name); + my_error(ER_NO_UNIQUE_LOGFILE, MYF(ME_FATALERROR), log_name); sql_print_error(ER_DEFAULT(ER_NO_UNIQUE_LOGFILE), log_name); return 1; } @@ -3108,7 +3109,7 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time, if (! write_error) { write_error= 1; - sql_print_error(ER_THD(thd, ER_ERROR_ON_WRITE), name, error); + sql_print_error(ER_THD(thd, ER_ERROR_ON_WRITE), name, tmp_errno); } } } @@ -3401,7 +3402,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name, if (init_and_set_log_file_name(log_name, new_name, next_log_number, log_type_arg, io_cache_type_arg)) { - sql_print_error("MSYQL_BIN_LOG::open failed to generate new file name."); + sql_print_error("MYSQL_BIN_LOG::open failed to generate new file name."); DBUG_RETURN(1); } @@ -3430,7 +3431,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name, } }); - sql_print_error("MSYQL_BIN_LOG::open failed to sync the index file."); + sql_print_error("MYSQL_BIN_LOG::open failed to sync the index file."); DBUG_RETURN(1); } DBUG_EXECUTE_IF("crash_create_non_critical_before_update_index", DBUG_SUICIDE();); @@ -4304,6 +4305,10 @@ void MYSQL_BIN_LOG::wait_for_last_checkpoint_event() relay log. IMPLEMENTATION + + - You must hold rli->data_lock before calling this function, since + it writes group_relay_log_pos and similar fields of + Relay_log_info. - Protects index file with LOCK_index - Delete relevant relay log files - Copy all file names after these ones to the front of the index file @@ -4317,7 +4322,7 @@ void MYSQL_BIN_LOG::wait_for_last_checkpoint_event() read by the SQL slave thread are deleted). @note - - This is only called from the slave-execute thread when it has read + - This is only called from the slave SQL thread when it has read all commands from a relay log and want to switch to a new relay log. - When this happens, we can be in an active transaction as a transaction can span over two relay logs @@ -4348,6 +4353,8 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included) DBUG_ASSERT(rli->slave_running == MYSQL_SLAVE_RUN_NOT_CONNECT); DBUG_ASSERT(!strcmp(rli->linfo.log_file_name,rli->event_relay_log_name)); + mysql_mutex_assert_owner(&rli->data_lock); + mysql_mutex_lock(&LOCK_index); ir= rli->inuse_relaylog_list; @@ -4406,7 +4413,7 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included) } /* Store where we are in the new file for the execution thread */ - flush_relay_log_info(rli); + rli->flush(); DBUG_EXECUTE_IF("crash_before_purge_logs", DBUG_SUICIDE();); @@ -4530,14 +4537,14 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log, if ((error= sync_purge_index_file())) { - sql_print_error("MSYQL_BIN_LOG::purge_logs failed to flush register file."); + sql_print_error("MYSQL_BIN_LOG::purge_logs failed to flush register file."); goto err; } /* We know how many files to delete. Update index file. */ if ((error=update_log_index(&log_info, need_update_threads))) { - sql_print_error("MSYQL_BIN_LOG::purge_logs failed to update the index file"); + sql_print_error("MYSQL_BIN_LOG::purge_logs failed to update the index file"); goto err; } @@ -4547,7 +4554,7 @@ err: /* Read each entry from purge_index_file and delete the file. */ if (is_inited_purge_index_file() && (error= purge_index_entry(thd, reclaimed_space, FALSE))) - sql_print_error("MSYQL_BIN_LOG::purge_logs failed to process registered files" + sql_print_error("MYSQL_BIN_LOG::purge_logs failed to process registered files" " that would be purged."); close_purge_index_file(); @@ -4664,7 +4671,7 @@ int MYSQL_BIN_LOG::purge_index_entry(THD *thd, ulonglong *reclaimed_space, if ((error=reinit_io_cache(&purge_index_file, READ_CACHE, 0, 0, 0))) { - sql_print_error("MSYQL_BIN_LOG::purge_index_entry failed to reinit register file " + sql_print_error("MYSQL_BIN_LOG::purge_index_entry failed to reinit register file " "for read"); goto err; } @@ -4679,7 +4686,7 @@ int MYSQL_BIN_LOG::purge_index_entry(THD *thd, ulonglong *reclaimed_space, if (purge_index_file.error) { error= purge_index_file.error; - sql_print_error("MSYQL_BIN_LOG::purge_index_entry error %d reading from " + sql_print_error("MYSQL_BIN_LOG::purge_index_entry error %d reading from " "register file.", error); goto err; } @@ -5159,9 +5166,7 @@ int MYSQL_BIN_LOG::new_file_impl(bool need_lock) /* handle reopening errors */ if (error) { - my_printf_error(ER_CANT_OPEN_FILE, - ER_THD_OR_DEFAULT(current_thd, ER_CANT_OPEN_FILE), - MYF(ME_FATALERROR), file_to_open, error); + my_error(ER_CANT_OPEN_FILE, MYF(ME_FATALERROR), file_to_open, error); close_on_error= TRUE; } @@ -9832,7 +9837,7 @@ int TC_LOG_BINLOG::recover(LOG_INFO *linfo, const char *last_log_name, ((last_gtid_standalone && !ev->is_part_of_group(typ)) || (!last_gtid_standalone && (typ == XID_EVENT || - (typ == QUERY_EVENT && + (LOG_EVENT_IS_QUERY(typ) && (((Query_log_event *)ev)->is_commit() || ((Query_log_event *)ev)->is_rollback())))))) { diff --git a/sql/log_event.cc b/sql/log_event.cc index 60d63a416e3..85dce217743 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -51,6 +51,7 @@ #include "rpl_utility.h" #include "rpl_constants.h" #include "sql_digest.h" +#include "zlib.h" #define my_b_write_string(A, B) my_b_write((A), (uchar*)(B), (uint) (sizeof(B) - 1)) @@ -702,6 +703,380 @@ char *str_to_hex(char *to, const char *from, uint len) return to; // pointer to end 0 of 'to' } +#define BINLOG_COMPRESSED_HEADER_LEN 1 +#define BINLOG_COMPRESSED_ORIGINAL_LENGTH_MAX_BYTES 4 +/** + Compressed Record + Record Header: 1 Byte + 7 Bit: Always 1, mean compressed; + 4-6 Bit: Compressed algorithm - Always 0, means zlib + It maybe support other compression algorithm in the future. + 0-3 Bit: Bytes of "Record Original Length" + Record Original Length: 1-4 Bytes + Compressed Buf: +*/ + +/** + Get the length of compress content. +*/ + +uint32 binlog_get_compress_len(uint32 len) +{ + /* 5 for the begin content, 1 reserved for a '\0'*/ + return ALIGN_SIZE((BINLOG_COMPRESSED_HEADER_LEN + BINLOG_COMPRESSED_ORIGINAL_LENGTH_MAX_BYTES) + + compressBound(len) + 1); +} + +/** + Compress buf from 'src' to 'dst'. + + Note: 1) Then the caller should guarantee the length of 'dst', which + can be got by binlog_get_uncompress_len, is enough to hold + the content uncompressed. + 2) The 'comlen' should stored the length of 'dst', and it will + be set as the size of compressed content after return. + + return zero if successful, others otherwise. +*/ +int binlog_buf_compress(const char *src, char *dst, uint32 len, uint32 *comlen) +{ + uchar lenlen; + if (len & 0xFF000000) + { + dst[1] = uchar(len >> 24); + dst[2] = uchar(len >> 16); + dst[3] = uchar(len >> 8); + dst[4] = uchar(len); + lenlen = 4; + } + else if (len & 0x00FF0000) + { + dst[1] = uchar(len >> 16); + dst[2] = uchar(len >> 8); + dst[3] = uchar(len); + lenlen = 3; + } + else if (len & 0x0000FF00) + { + dst[1] = uchar(len >> 8); + dst[2] = uchar(len); + lenlen = 2; + } + else + { + dst[1] = uchar(len); + lenlen = 1; + } + dst[0] = 0x80 | (lenlen & 0x07); + + uLongf tmplen = (uLongf)*comlen - BINLOG_COMPRESSED_HEADER_LEN - lenlen - 1; + if (compress((Bytef *)dst + BINLOG_COMPRESSED_HEADER_LEN + lenlen, &tmplen, + (const Bytef *)src, (uLongf)len) != Z_OK) + { + return 1; + } + *comlen = (uint32)tmplen + BINLOG_COMPRESSED_HEADER_LEN + lenlen; + return 0; +} + +/** + Convert a query_compressed_log_event to query_log_event + from 'src' to 'dst', the size after compression stored in 'newlen'. + + @Note: + 1) The caller should call my_free to release 'dst' if *is_malloc is + returned as true. + 2) If *is_malloc is retuened as false, then 'dst' reuses the passed-in + 'buf'. + + return zero if successful, non-zero otherwise. +*/ + +int +query_event_uncompress(const Format_description_log_event *description_event, + bool contain_checksum, const char *src, ulong src_len, + char* buf, ulong buf_size, bool* is_malloc, char **dst, + ulong *newlen) +{ + ulong len = uint4korr(src + EVENT_LEN_OFFSET); + const char *tmp = src; + const char *end = src + len; + + // bad event + if (src_len < len ) + return 1; + + DBUG_ASSERT((uchar)src[EVENT_TYPE_OFFSET] == QUERY_COMPRESSED_EVENT); + + uint8 common_header_len= description_event->common_header_len; + uint8 post_header_len= + description_event->post_header_len[QUERY_COMPRESSED_EVENT-1]; + + *is_malloc = false; + + tmp += common_header_len; + // bad event + if (end <= tmp) + return 1; + + uint db_len = (uint)tmp[Q_DB_LEN_OFFSET]; + uint16 status_vars_len= uint2korr(tmp + Q_STATUS_VARS_LEN_OFFSET); + + tmp += post_header_len + status_vars_len + db_len + 1; + // bad event + if (end <= tmp) + return 1; + + int32 comp_len = len - (tmp - src) - + (contain_checksum ? BINLOG_CHECKSUM_LEN : 0); + uint32 un_len = binlog_get_uncompress_len(tmp); + + // bad event + if (comp_len < 0 || un_len == 0) + return 1; + + *newlen = (tmp - src) + un_len; + if(contain_checksum) + *newlen += BINLOG_CHECKSUM_LEN; + + uint32 alloc_size = ALIGN_SIZE(*newlen); + char *new_dst = NULL; + + + if (alloc_size <= buf_size) + { + new_dst = buf; + } + else + { + new_dst = (char *)my_malloc(alloc_size, MYF(MY_WME)); + if (!new_dst) + return 1; + + *is_malloc = true; + } + + /* copy the head*/ + memcpy(new_dst, src , tmp - src); + if (binlog_buf_uncompress(tmp, new_dst + (tmp - src), + comp_len, &un_len)) + { + if (*is_malloc) + my_free(new_dst); + + *is_malloc = false; + + return 1; + } + + new_dst[EVENT_TYPE_OFFSET] = QUERY_EVENT; + int4store(new_dst + EVENT_LEN_OFFSET, *newlen); + if(contain_checksum) + { + ulong clear_len = *newlen - BINLOG_CHECKSUM_LEN; + int4store(new_dst + clear_len, + my_checksum(0L, (uchar *)new_dst, clear_len)); + } + *dst = new_dst; + return 0; +} + +int +row_log_event_uncompress(const Format_description_log_event *description_event, + bool contain_checksum, const char *src, ulong src_len, + char* buf, ulong buf_size, bool* is_malloc, char **dst, + ulong *newlen) +{ + Log_event_type type = (Log_event_type)(uchar)src[EVENT_TYPE_OFFSET]; + ulong len = uint4korr(src + EVENT_LEN_OFFSET); + const char *tmp = src; + char *new_dst = NULL; + const char *end = tmp + len; + + // bad event + if (src_len < len) + return 1; + + DBUG_ASSERT(LOG_EVENT_IS_ROW_COMPRESSED(type)); + + uint8 common_header_len= description_event->common_header_len; + uint8 post_header_len= description_event->post_header_len[type-1]; + + tmp += common_header_len + ROWS_HEADER_LEN_V1; + if (post_header_len == ROWS_HEADER_LEN_V2) + { + /* + Have variable length header, check length, + which includes length bytes + */ + + // bad event + if (end - tmp <= 2) + return 1; + + uint16 var_header_len= uint2korr(tmp); + DBUG_ASSERT(var_header_len >= 2); + + /* skip over var-len header, extracting 'chunks' */ + tmp += var_header_len; + + /* get the uncompressed event type */ + type= + (Log_event_type)(type - WRITE_ROWS_COMPRESSED_EVENT + WRITE_ROWS_EVENT); + } + else + { + /* get the uncompressed event type */ + type= (Log_event_type) + (type - WRITE_ROWS_COMPRESSED_EVENT_V1 + WRITE_ROWS_EVENT_V1); + } + + //bad event + if (end <= tmp) + return 1; + + ulong m_width = net_field_length((uchar **)&tmp); + tmp += (m_width + 7) / 8; + + if (type == UPDATE_ROWS_EVENT_V1 || type == UPDATE_ROWS_EVENT) + { + tmp += (m_width + 7) / 8; + } + + //bad event + if (end <= tmp) + return 1; + + uint32 un_len = binlog_get_uncompress_len(tmp); + //bad event + if (un_len == 0) + return 1; + + long comp_len = len - (tmp - src) - + (contain_checksum ? BINLOG_CHECKSUM_LEN : 0); + //bad event + if (comp_len <=0) + return 1; + + *newlen = (tmp - src) + un_len; + if(contain_checksum) + *newlen += BINLOG_CHECKSUM_LEN; + + uint32 alloc_size = ALIGN_SIZE(*newlen); + + *is_malloc = false; + if (alloc_size <= buf_size) + { + new_dst = buf; + } + else + { + new_dst = (char *)my_malloc(alloc_size, MYF(MY_WME)); + if (!new_dst) + return 1; + + *is_malloc = true; + } + + /* Copy the head. */ + memcpy(new_dst, src , tmp - src); + /* Uncompress the body. */ + if (binlog_buf_uncompress(tmp, new_dst + (tmp - src), + comp_len, &un_len)) + { + if (*is_malloc) + my_free(new_dst); + + return 1; + } + + new_dst[EVENT_TYPE_OFFSET] = type; + int4store(new_dst + EVENT_LEN_OFFSET, *newlen); + if(contain_checksum){ + ulong clear_len = *newlen - BINLOG_CHECKSUM_LEN; + int4store(new_dst + clear_len, + my_checksum(0L, (uchar *)new_dst, clear_len)); + } + *dst = new_dst; + return 0; +} + +/** + Get the length of uncompress content. + return 0 means error. +*/ + +uint32 binlog_get_uncompress_len(const char *buf) +{ + DBUG_ASSERT((buf[0] & 0xe0) == 0x80); + uint32 lenlen = buf[0] & 0x07; + uint32 len = 0; + switch(lenlen) + { + case 1: + len = uchar(buf[1]); + break; + case 2: + len = uchar(buf[1]) << 8 | uchar(buf[2]); + break; + case 3: + len = uchar(buf[1]) << 16 | uchar(buf[2]) << 8 | uchar(buf[3]); + break; + case 4: + len = uchar(buf[1]) << 24 | uchar(buf[2]) << 16 | + uchar(buf[3]) << 8 | uchar(buf[4]); + break; + default: + DBUG_ASSERT(lenlen >= 1 && lenlen <= 4); + break; + } + return len; +} + +/** + Uncompress the content in 'src' with length of 'len' to 'dst'. + + Note: 1) Then the caller should guarantee the length of 'dst' (which + can be got by statement_get_uncompress_len) is enough to hold + the content uncompressed. + 2) The 'newlen' should stored the length of 'dst', and it will + be set as the size of uncompressed content after return. + + return zero if successful, others otherwise. +*/ +int binlog_buf_uncompress(const char *src, char *dst, uint32 len, + uint32 *newlen) +{ + if((src[0] & 0x80) == 0) + { + return 1; + } + + uint32 lenlen= src[0] & 0x07; + uLongf buflen= *newlen; + + uint32 alg = (src[0] & 0x70) >> 4; + switch(alg) + { + case 0: + // zlib + if(uncompress((Bytef *)dst, &buflen, + (const Bytef*)src + 1 + lenlen, len - 1 - lenlen) != Z_OK) + { + return 1; + } + break; + default: + //TODO + //bad algorithm + return 1; + } + + DBUG_ASSERT(*newlen == (uint32)buflen); + *newlen = (uint32)buflen; + return 0; +} + #ifndef MYSQL_CLIENT /** @@ -828,6 +1203,13 @@ const char* Log_event::get_type_str(Log_event_type type) case TRANSACTION_CONTEXT_EVENT: return "Transaction_context"; case VIEW_CHANGE_EVENT: return "View_change"; case XA_PREPARE_LOG_EVENT: return "XA_prepare"; + case QUERY_COMPRESSED_EVENT: return "Query_compressed"; + case WRITE_ROWS_COMPRESSED_EVENT: return "Write_rows_compressed"; + case UPDATE_ROWS_COMPRESSED_EVENT: return "Update_rows_compressed"; + case DELETE_ROWS_COMPRESSED_EVENT: return "Delete_rows_compressed"; + case WRITE_ROWS_COMPRESSED_EVENT_V1: return "Write_rows_compressed_v1"; + case UPDATE_ROWS_COMPRESSED_EVENT_V1: return "Update_rows_compressed_v1"; + case DELETE_ROWS_COMPRESSED_EVENT_V1: return "Delete_rows_compressed_v1"; default: return "Unknown"; /* impossible */ } @@ -966,6 +1348,7 @@ int Log_event::do_update_pos(rpl_group_info *rgi) Relay_log_info *rli= rgi->rli; DBUG_ENTER("Log_event::do_update_pos"); + DBUG_ASSERT(!rli->belongs_to_client()); /* rli is null when (as far as I (Guilhem) know) the caller is Load_log_event::do_apply_event *and* that one is called from @@ -1514,6 +1897,10 @@ err: if (error) { DBUG_ASSERT(!res); +#ifdef MYSQL_CLIENT + if (force_opt) + DBUG_RETURN(new Unknown_log_event()); +#endif if (event.length() >= OLD_HEADER_LEN) sql_print_error("Error in Log_event::read_log_event(): '%s'," " data_len: %lu, event_type: %d", error, @@ -1660,6 +2047,10 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len, case QUERY_EVENT: ev = new Query_log_event(buf, event_len, fdle, QUERY_EVENT); break; + case QUERY_COMPRESSED_EVENT: + ev = new Query_compressed_log_event(buf, event_len, fdle, + QUERY_COMPRESSED_EVENT); + break; case LOAD_EVENT: ev = new Load_log_event(buf, event_len, fdle); break; @@ -1734,6 +2125,19 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len, ev = new Delete_rows_log_event(buf, event_len, fdle); break; + case WRITE_ROWS_COMPRESSED_EVENT: + case WRITE_ROWS_COMPRESSED_EVENT_V1: + ev = new Write_rows_compressed_log_event(buf, event_len, fdle); + break; + case UPDATE_ROWS_COMPRESSED_EVENT: + case UPDATE_ROWS_COMPRESSED_EVENT_V1: + ev = new Update_rows_compressed_log_event(buf, event_len, fdle); + break; + case DELETE_ROWS_COMPRESSED_EVENT: + case DELETE_ROWS_COMPRESSED_EVENT_V1: + ev = new Delete_rows_compressed_log_event(buf, event_len, fdle); + break; + /* MySQL GTID events are ignored */ case GTID_LOG_EVENT: case ANONYMOUS_GTID_LOG_EVENT: @@ -1777,7 +2181,7 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len, else { DBUG_PRINT("error",("Unknown event code: %d", - (int) buf[EVENT_TYPE_OFFSET])); + (uchar) buf[EVENT_TYPE_OFFSET])); ev= NULL; break; } @@ -2835,6 +3239,27 @@ void Log_event::print_base64(IO_CACHE* file, glob_description_event); break; } + case WRITE_ROWS_COMPRESSED_EVENT: + case WRITE_ROWS_COMPRESSED_EVENT_V1: + { + ev= new Write_rows_compressed_log_event((const char*) ptr, size, + glob_description_event); + break; + } + case UPDATE_ROWS_COMPRESSED_EVENT: + case UPDATE_ROWS_COMPRESSED_EVENT_V1: + { + ev= new Update_rows_compressed_log_event((const char*) ptr, size, + glob_description_event); + break; + } + case DELETE_ROWS_COMPRESSED_EVENT: + case DELETE_ROWS_COMPRESSED_EVENT_V1: + { + ev= new Delete_rows_compressed_log_event((const char*) ptr, size, + glob_description_event); + break; + } default: break; } @@ -3189,6 +3614,24 @@ bool Query_log_event::write() write_footer(); } +bool Query_compressed_log_event::write() +{ + const char *query_tmp = query; + uint32 q_len_tmp = q_len; + uint32 alloc_size; + bool ret = true; + q_len = alloc_size = binlog_get_compress_len(q_len); + query = (char *)my_safe_alloca(alloc_size); + if(query && !binlog_buf_compress(query_tmp, (char *)query, q_len_tmp, &q_len)) + { + ret = Query_log_event::write(); + } + my_safe_afree((void *)query, alloc_size); + query = query_tmp; + q_len = q_len_tmp; + return ret; +} + /** The simplest constructor that could possibly work. This is used for creating static objects that have a special meaning and are invisible @@ -3381,6 +3824,16 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, DBUG_PRINT("info",("Query_log_event has flags2: %lu sql_mode: %llu cache_tye: %d", (ulong) flags2, sql_mode, cache_type)); } + +Query_compressed_log_event::Query_compressed_log_event(THD* thd_arg, const char* query_arg, + ulong query_length, bool using_trans, + bool direct, bool suppress_use, int errcode) + :Query_log_event(thd_arg, query_arg, query_length, using_trans, direct, + suppress_use, errcode), + query_buf(0) +{ + +} #endif /* MYSQL_CLIENT */ @@ -3787,6 +4240,39 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, DBUG_VOID_RETURN; } +Query_compressed_log_event::Query_compressed_log_event(const char *buf, + uint event_len, + const Format_description_log_event + *description_event, + Log_event_type event_type) + :Query_log_event(buf, event_len, description_event, event_type), + query_buf(NULL) +{ + if(query) + { + uint32 un_len=binlog_get_uncompress_len(query); + if (!un_len) + { + query = 0; + return; + } + + /* Reserve one byte for '\0' */ + query_buf = (Log_event::Byte*)my_malloc(ALIGN_SIZE(un_len + 1), + MYF(MY_WME)); + if(query_buf && + !binlog_buf_uncompress(query, (char *)query_buf, q_len, &un_len)) + { + query_buf[un_len] = 0; + query = (const char *)query_buf; + q_len = un_len; + } + else + { + query= 0; + } + } +} /* Replace a binlog event read into a packet with a dummy event. Either a @@ -5055,6 +5541,15 @@ Format_description_log_event(uint8 binlog_ver, const char* server_ver) post_header_len[GTID_LIST_EVENT-1]= GTID_LIST_HEADER_LEN; post_header_len[START_ENCRYPTION_EVENT-1]= START_ENCRYPTION_HEADER_LEN; + //compressed event + post_header_len[QUERY_COMPRESSED_EVENT-1]= QUERY_HEADER_LEN; + post_header_len[WRITE_ROWS_COMPRESSED_EVENT-1]= ROWS_HEADER_LEN_V2; + post_header_len[UPDATE_ROWS_COMPRESSED_EVENT-1]= ROWS_HEADER_LEN_V2; + post_header_len[DELETE_ROWS_COMPRESSED_EVENT-1]= ROWS_HEADER_LEN_V2; + post_header_len[WRITE_ROWS_COMPRESSED_EVENT_V1-1]= ROWS_HEADER_LEN_V1; + post_header_len[UPDATE_ROWS_COMPRESSED_EVENT_V1-1]= ROWS_HEADER_LEN_V1; + post_header_len[DELETE_ROWS_COMPRESSED_EVENT_V1-1]= ROWS_HEADER_LEN_V1; + // Sanity-check that all post header lengths are initialized. int i; for (i=0; i B -> A setup. The NOTES below is a wrong comment which will disappear when 4.1 is merged. + This must only be called from the Slave SQL thread, since it calls + Relay_log_info::flush(). + @retval 0 ok */ @@ -6456,7 +6954,7 @@ int Rotate_log_event::do_update_pos(rpl_group_info *rgi) (ulong) rli->group_master_log_pos)); mysql_mutex_unlock(&rli->data_lock); rpl_global_gtid_slave_state->record_and_update_gtid(thd, rgi); - flush_relay_log_info(rli); + rli->flush(); /* Reset thd->variables.option_bits and sql_mode etc, because this could @@ -8186,8 +8684,13 @@ void Unknown_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info if (print_event_info->short_form) return; - print_header(&cache, print_event_info, FALSE); - my_b_printf(&cache, "\n# %s", "Unknown event\n"); + if (what != ENCRYPTED) + { + print_header(&cache, print_event_info, FALSE); + my_b_printf(&cache, "\n# Unknown event\n"); + } + else + my_b_printf(&cache, "# Encrypted event\n"); } #endif @@ -8225,6 +8728,9 @@ void Stop_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) were we must do this cleaning is in Start_log_event_v3::do_apply_event(), not here. Because if we come here, the master was sane. + + This must only be called from the Slave SQL thread, since it calls + Relay_log_info::flush(). */ int Stop_log_event::do_update_pos(rpl_group_info *rgi) @@ -8244,7 +8750,7 @@ int Stop_log_event::do_update_pos(rpl_group_info *rgi) { rpl_global_gtid_slave_state->record_and_update_gtid(thd, rgi); rli->inc_group_relay_log_pos(0, rgi); - flush_relay_log_info(rli); + rli->flush(); } DBUG_RETURN(0); } @@ -9397,7 +9903,7 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len, { DBUG_ENTER("Rows_log_event::Rows_log_event(const char*,...)"); uint8 const common_header_len= description_event->common_header_len; - Log_event_type event_type= (Log_event_type) buf[EVENT_TYPE_OFFSET]; + Log_event_type event_type= (Log_event_type)(uchar)buf[EVENT_TYPE_OFFSET]; m_type= event_type; uint8 const post_header_len= description_event->post_header_len[event_type-1]; @@ -9496,8 +10002,7 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len, m_cols_ai.bitmap= m_cols.bitmap; /* See explanation in is_valid() */ - if ((event_type == UPDATE_ROWS_EVENT) || - (event_type == UPDATE_ROWS_EVENT_V1)) + if (LOG_EVENT_IS_UPDATE_ROW(event_type)) { DBUG_PRINT("debug", ("Reading from %p", ptr_after_width)); @@ -9544,6 +10049,35 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len, DBUG_VOID_RETURN; } +void Rows_log_event::uncompress_buf() +{ + uint32 un_len = binlog_get_uncompress_len((char *)m_rows_buf); + if (!un_len) + return; + + uchar *new_buf= (uchar*) my_malloc(ALIGN_SIZE(un_len), MYF(MY_WME)); + if (new_buf) + { + if(!binlog_buf_uncompress((char *)m_rows_buf, (char *)new_buf, + m_rows_cur - m_rows_buf, &un_len)) + { + my_free(m_rows_buf); + m_rows_buf = new_buf; +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + m_curr_row= m_rows_buf; +#endif + m_rows_end= m_rows_buf + un_len; + m_rows_cur= m_rows_end; + return; + } + else + { + my_free(new_buf); + } + } + m_cols.bitmap= 0; // catch it in is_valid +} + Rows_log_event::~Rows_log_event() { if (m_cols.bitmap == m_bitbuf) // no my_malloc happened @@ -9566,7 +10100,8 @@ int Rows_log_event::get_data_size() (m_rows_cur - m_rows_buf);); int data_size= 0; - bool is_v2_event= get_type_code() > DELETE_ROWS_EVENT_V1; + Log_event_type type = get_type_code(); + bool is_v2_event= LOG_EVENT_IS_ROW_V2(type); if (is_v2_event) { data_size= ROWS_HEADER_LEN_V2 + @@ -10381,6 +10916,27 @@ bool Rows_log_event::write_data_body() return res; } + +bool Rows_log_event::write_compressed() +{ + uchar *m_rows_buf_tmp = m_rows_buf; + uchar *m_rows_cur_tmp = m_rows_cur; + bool ret = true; + uint32 comlen, alloc_size; + comlen= alloc_size= binlog_get_compress_len(m_rows_cur_tmp - m_rows_buf_tmp); + m_rows_buf = (uchar *)my_safe_alloca(alloc_size); + if(m_rows_buf && + !binlog_buf_compress((const char *)m_rows_buf_tmp, (char *)m_rows_buf, + m_rows_cur_tmp - m_rows_buf_tmp, &comlen)) + { + m_rows_cur= comlen + m_rows_buf; + ret= Log_event::write(); + } + my_safe_afree(m_rows_buf, alloc_size); + m_rows_buf= m_rows_buf_tmp; + m_rows_cur= m_rows_cur_tmp; + return ret; +} #endif #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) @@ -11163,9 +11719,7 @@ int Table_map_log_event::do_apply_event(rpl_group_info *rgi) For the cases in which a 'BINLOG' statement is set to execute in a user session */ - my_printf_error(ER_SLAVE_FATAL_ERROR, - ER_THD(thd, ER_SLAVE_FATAL_ERROR), - MYF(0), buf); + my_error(ER_SLAVE_FATAL_ERROR, MYF(0), buf); } my_free(memory); @@ -11295,6 +11849,21 @@ Write_rows_log_event::Write_rows_log_event(THD *thd_arg, TABLE *tbl_arg, is_transactional, WRITE_ROWS_EVENT_V1) { } + +Write_rows_compressed_log_event::Write_rows_compressed_log_event( + THD *thd_arg, + TABLE *tbl_arg, + ulong tid_arg, + bool is_transactional) + : Write_rows_log_event(thd_arg, tbl_arg, tid_arg, is_transactional) +{ + m_type = WRITE_ROWS_COMPRESSED_EVENT_V1; +} + +bool Write_rows_compressed_log_event::write() +{ + return Rows_log_event::write_compressed(); +} #endif /* @@ -11307,6 +11876,15 @@ Write_rows_log_event::Write_rows_log_event(const char *buf, uint event_len, : Rows_log_event(buf, event_len, description_event) { } + +Write_rows_compressed_log_event::Write_rows_compressed_log_event( + const char *buf, uint event_len, + const Format_description_log_event + *description_event) +: Write_rows_log_event(buf, event_len, description_event) +{ + uncompress_buf(); +} #endif #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) @@ -11798,6 +12376,28 @@ void Write_rows_log_event::print(FILE *file, PRINT_EVENT_INFO* print_event_info) {DBUG_SET("+d,simulate_my_b_fill_error");}); Rows_log_event::print_helper(file, print_event_info, "Write_rows"); } + +void Write_rows_compressed_log_event::print(FILE *file, + PRINT_EVENT_INFO* print_event_info) +{ + char *new_buf; + ulong len; + bool is_malloc = false; + if(!row_log_event_uncompress(glob_description_event, + checksum_alg == BINLOG_CHECKSUM_ALG_CRC32, + temp_buf, UINT_MAX32, NULL, 0, &is_malloc, &new_buf, &len)) + { + free_temp_buf(); + register_temp_buf(new_buf, true); + Rows_log_event::print_helper(file, print_event_info, + "Write_compressed_rows"); + } + else + { + my_b_printf(&print_event_info->head_cache, + "ERROR: uncompress write_compressed_rows failed\n"); + } +} #endif @@ -11983,7 +12583,7 @@ void issue_long_find_row_warning(Log_event_type type, if (delta > LONG_FIND_ROW_THRESHOLD) { rgi->set_long_find_row_note_printed(); - const char* evt_type= type == DELETE_ROWS_EVENT ? " DELETE" : "n UPDATE"; + const char* evt_type= LOG_EVENT_IS_DELETE_ROW(type) ? " DELETE" : "n UPDATE"; const char* scan_type= is_index_scan ? "scanning an index" : "scanning the table"; sql_print_information("The slave is applying a ROW event on behalf of a%s statement " @@ -12318,6 +12918,20 @@ Delete_rows_log_event::Delete_rows_log_event(THD *thd_arg, TABLE *tbl_arg, DELETE_ROWS_EVENT_V1) { } + +Delete_rows_compressed_log_event::Delete_rows_compressed_log_event( + THD *thd_arg, TABLE *tbl_arg, + ulong tid_arg, + bool is_transactional) + : Delete_rows_log_event(thd_arg, tbl_arg, tid_arg, is_transactional) +{ + m_type= DELETE_ROWS_COMPRESSED_EVENT_V1; +} + +bool Delete_rows_compressed_log_event::write() +{ + return Rows_log_event::write_compressed(); +} #endif /* #if !defined(MYSQL_CLIENT) */ /* @@ -12330,6 +12944,15 @@ Delete_rows_log_event::Delete_rows_log_event(const char *buf, uint event_len, : Rows_log_event(buf, event_len, description_event) { } + +Delete_rows_compressed_log_event::Delete_rows_compressed_log_event( + const char *buf, uint event_len, + const Format_description_log_event + *description_event) + : Delete_rows_log_event(buf, event_len, description_event) +{ + uncompress_buf(); +} #endif #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) @@ -12427,6 +13050,28 @@ void Delete_rows_log_event::print(FILE *file, { Rows_log_event::print_helper(file, print_event_info, "Delete_rows"); } + +void Delete_rows_compressed_log_event::print(FILE *file, + PRINT_EVENT_INFO* print_event_info) +{ + char *new_buf; + ulong len; + bool is_malloc = false; + if(!row_log_event_uncompress(glob_description_event, + checksum_alg == BINLOG_CHECKSUM_ALG_CRC32, + temp_buf, UINT_MAX32, NULL, 0, &is_malloc, &new_buf, &len)) + { + free_temp_buf(); + register_temp_buf(new_buf, true); + Rows_log_event::print_helper(file, print_event_info, + "Delete_compressed_rows"); + } + else + { + my_b_printf(&print_event_info->head_cache, + "ERROR: uncompress delete_compressed_rows failed\n"); + } +} #endif @@ -12454,6 +13099,19 @@ Update_rows_log_event::Update_rows_log_event(THD *thd_arg, TABLE *tbl_arg, init(tbl_arg->rpl_write_set); } +Update_rows_compressed_log_event::Update_rows_compressed_log_event(THD *thd_arg, TABLE *tbl_arg, + ulong tid, + bool is_transactional) +: Update_rows_log_event(thd_arg, tbl_arg, tid, is_transactional) +{ + m_type = UPDATE_ROWS_COMPRESSED_EVENT_V1; +} + +bool Update_rows_compressed_log_event::write() +{ + return Rows_log_event::write_compressed(); +} + void Update_rows_log_event::init(MY_BITMAP const *cols) { /* if my_bitmap_init fails, caught in is_valid() */ @@ -12492,6 +13150,15 @@ Update_rows_log_event::Update_rows_log_event(const char *buf, uint event_len, : Rows_log_event(buf, event_len, description_event) { } + +Update_rows_compressed_log_event::Update_rows_compressed_log_event( + const char *buf, uint event_len, + const Format_description_log_event + *description_event) + : Update_rows_log_event(buf, event_len, description_event) +{ + uncompress_buf(); +} #endif #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) @@ -12644,6 +13311,27 @@ void Update_rows_log_event::print(FILE *file, { Rows_log_event::print_helper(file, print_event_info, "Update_rows"); } + +void Update_rows_compressed_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info) +{ + char *new_buf; + ulong len; + bool is_malloc= false; + if(!row_log_event_uncompress(glob_description_event, + checksum_alg == BINLOG_CHECKSUM_ALG_CRC32, + temp_buf, UINT_MAX32, NULL, 0, &is_malloc, &new_buf, &len)) + { + free_temp_buf(); + register_temp_buf(new_buf, true); + Rows_log_event::print_helper(file, print_event_info, + "Update_compressed_rows"); + } + else + { + my_b_printf(&print_event_info->head_cache, + "ERROR: uncompress update_compressed_rows failed\n"); + } +} #endif #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) @@ -12771,7 +13459,7 @@ err: DBUG_ASSERT(error != 0); sql_print_error("Error in Log_event::read_log_event(): " "'%s', data_len: %d, event_type: %d", - error,data_len,head[EVENT_TYPE_OFFSET]); + error,data_len,(uchar)head[EVENT_TYPE_OFFSET]); } (*arg_buf)+= data_len; (*arg_buf_len)-= data_len; diff --git a/sql/log_event.h b/sql/log_event.h index 306f78ca4c9..7b8704636af 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -692,11 +692,75 @@ enum Log_event_type START_ENCRYPTION_EVENT= 164, + /* + Compressed binlog event. + + Note that the order between WRITE/UPDATE/DELETE events is significant; + this is so that we can convert from the compressed to the uncompressed + event type with (type-WRITE_ROWS_COMPRESSED_EVENT + WRITE_ROWS_EVENT) + and similar for _V1. + */ + QUERY_COMPRESSED_EVENT = 165, + WRITE_ROWS_COMPRESSED_EVENT_V1 = 166, + UPDATE_ROWS_COMPRESSED_EVENT_V1 = 167, + DELETE_ROWS_COMPRESSED_EVENT_V1 = 168, + WRITE_ROWS_COMPRESSED_EVENT = 169, + UPDATE_ROWS_COMPRESSED_EVENT = 170, + DELETE_ROWS_COMPRESSED_EVENT = 171, + /* Add new MariaDB events here - right above this comment! */ ENUM_END_EVENT /* end marker */ }; +static inline bool LOG_EVENT_IS_QUERY(enum Log_event_type type) +{ + return type == QUERY_EVENT || type == QUERY_COMPRESSED_EVENT; +} + + +static inline bool LOG_EVENT_IS_WRITE_ROW(enum Log_event_type type) +{ + return type == WRITE_ROWS_EVENT || type == WRITE_ROWS_EVENT_V1 || + type == WRITE_ROWS_COMPRESSED_EVENT || + type == WRITE_ROWS_COMPRESSED_EVENT_V1; +} + + +static inline bool LOG_EVENT_IS_UPDATE_ROW(enum Log_event_type type) +{ + return type == UPDATE_ROWS_EVENT || type == UPDATE_ROWS_EVENT_V1 || + type == UPDATE_ROWS_COMPRESSED_EVENT || + type == UPDATE_ROWS_COMPRESSED_EVENT_V1; +} + + +static inline bool LOG_EVENT_IS_DELETE_ROW(enum Log_event_type type) +{ + return type == DELETE_ROWS_EVENT || type == DELETE_ROWS_EVENT_V1 || + type == DELETE_ROWS_COMPRESSED_EVENT || + type == DELETE_ROWS_COMPRESSED_EVENT_V1; +} + + +static inline bool LOG_EVENT_IS_ROW_COMPRESSED(enum Log_event_type type) +{ + return type == WRITE_ROWS_COMPRESSED_EVENT || + type == WRITE_ROWS_COMPRESSED_EVENT_V1 || + type == UPDATE_ROWS_COMPRESSED_EVENT || + type == UPDATE_ROWS_COMPRESSED_EVENT_V1 || + type == DELETE_ROWS_COMPRESSED_EVENT || + type == DELETE_ROWS_COMPRESSED_EVENT_V1; +} + + +static inline bool LOG_EVENT_IS_ROW_V2(enum Log_event_type type) +{ + return (type >= WRITE_ROWS_EVENT && type <= DELETE_ROWS_EVENT) || + (type >= WRITE_ROWS_COMPRESSED_EVENT && type <= DELETE_ROWS_COMPRESSED_EVENT); +} + + /* The number of types we handle in Format_description_log_event (UNKNOWN_EVENT is not to be handled, it does not exist in binlogs, it does not have a @@ -1149,7 +1213,7 @@ public: return thd ? thd->db : 0; } #else - Log_event() : temp_buf(0), flags(0) {} + Log_event() : temp_buf(0), when(0), flags(0) {} ha_checksum crc; /* print*() functions are used by mysqlbinlog */ virtual void print(FILE* file, PRINT_EVENT_INFO* print_event_info) = 0; @@ -2045,9 +2109,37 @@ public: /* !!! Public in this patch to allow old usage */ !strncasecmp(query, "SAVEPOINT", 9) || !strncasecmp(query, "ROLLBACK", 8); } - bool is_begin() { return !strcmp(query, "BEGIN"); } - bool is_commit() { return !strcmp(query, "COMMIT"); } - bool is_rollback() { return !strcmp(query, "ROLLBACK"); } + virtual bool is_begin() { return !strcmp(query, "BEGIN"); } + virtual bool is_commit() { return !strcmp(query, "COMMIT"); } + virtual bool is_rollback() { return !strcmp(query, "ROLLBACK"); } +}; + +class Query_compressed_log_event:public Query_log_event{ +protected: + Log_event::Byte* query_buf; // point to the uncompressed query +public: + Query_compressed_log_event(const char* buf, uint event_len, + const Format_description_log_event *description_event, + Log_event_type event_type); + ~Query_compressed_log_event() + { + if (query_buf) + my_free(query_buf); + } + Log_event_type get_type_code() { return QUERY_COMPRESSED_EVENT; } + + /* + the min length of log_bin_compress_min_len is 10, + means that Begin/Commit/Rollback would never be compressed! + */ + virtual bool is_begin() { return false; } + virtual bool is_commit() { return false; } + virtual bool is_rollback() { return false; } +#ifdef MYSQL_SERVER + Query_compressed_log_event(THD* thd_arg, const char* query_arg, ulong query_length, + bool using_trans, bool direct, bool suppress_use, int error); + virtual bool write(); +#endif }; @@ -3676,6 +3768,7 @@ private: class Unknown_log_event: public Log_event { public: + enum { UNKNOWN, ENCRYPTED } what; /* Even if this is an unknown event, we still pass description_event to Log_event's ctor, this way we can extract maximum information from the @@ -3683,8 +3776,10 @@ public: */ Unknown_log_event(const char* buf, const Format_description_log_event *description_event): - Log_event(buf, description_event) + Log_event(buf, description_event), what(UNKNOWN) {} + /* constructor for hopelessly corrupted events */ + Unknown_log_event(): Log_event(), what(ENCRYPTED) {} ~Unknown_log_event() {} void print(FILE* file, PRINT_EVENT_INFO* print_event_info); Log_event_type get_type_code() { return UNKNOWN_EVENT;} @@ -4341,6 +4436,7 @@ public: #ifdef MYSQL_SERVER virtual bool write_data_header(); virtual bool write_data_body(); + virtual bool write_compressed(); virtual const char *get_db() { return m_table->s->db.str; } #endif /* @@ -4375,6 +4471,7 @@ protected: #endif Rows_log_event(const char *row_data, uint event_len, const Format_description_log_event *description_event); + void uncompress_buf(); #ifdef MYSQL_CLIENT void print_helper(FILE *, PRINT_EVENT_INFO *, char const *const name); @@ -4587,6 +4684,23 @@ private: #endif }; +class Write_rows_compressed_log_event : public Write_rows_log_event +{ +public: +#if defined(MYSQL_SERVER) + Write_rows_compressed_log_event(THD*, TABLE*, ulong table_id, + bool is_transactional); + virtual bool write(); +#endif +#ifdef HAVE_REPLICATION + Write_rows_compressed_log_event(const char *buf, uint event_len, + const Format_description_log_event *description_event); +#endif +private: +#if defined(MYSQL_CLIENT) + void print(FILE *file, PRINT_EVENT_INFO *print_event_info); +#endif +}; /** @class Update_rows_log_event @@ -4657,6 +4771,24 @@ protected: #endif /* defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) */ }; +class Update_rows_compressed_log_event : public Update_rows_log_event +{ +public: +#if defined(MYSQL_SERVER) + Update_rows_compressed_log_event(THD*, TABLE*, ulong table_id, + bool is_transactional); + virtual bool write(); +#endif +#ifdef HAVE_REPLICATION + Update_rows_compressed_log_event(const char *buf, uint event_len, + const Format_description_log_event *description_event); +#endif +private: +#if defined(MYSQL_CLIENT) + void print(FILE *file, PRINT_EVENT_INFO *print_event_info); +#endif +}; + /** @class Delete_rows_log_event @@ -4723,6 +4855,23 @@ protected: #endif }; +class Delete_rows_compressed_log_event : public Delete_rows_log_event +{ +public: +#if defined(MYSQL_SERVER) + Delete_rows_compressed_log_event(THD*, TABLE*, ulong, bool is_transactional); + virtual bool write(); +#endif +#ifdef HAVE_REPLICATION + Delete_rows_compressed_log_event(const char *buf, uint event_len, + const Format_description_log_event *description_event); +#endif +private: +#if defined(MYSQL_CLIENT) + void print(FILE *file, PRINT_EVENT_INFO *print_event_info); +#endif +}; + #include "log_event_old.h" @@ -4964,4 +5113,19 @@ extern TYPELIB binlog_checksum_typelib; @} (end of group Replication) */ + +int binlog_buf_compress(const char *src, char *dst, uint32 len, uint32 *comlen); +int binlog_buf_uncompress(const char *src, char *dst, uint32 len, uint32 *newlen); +uint32 binlog_get_compress_len(uint32 len); +uint32 binlog_get_uncompress_len(const char *buf); + +int query_event_uncompress(const Format_description_log_event *description_event, bool contain_checksum, + const char *src, ulong src_len, char* buf, ulong buf_size, bool* is_malloc, + char **dst, ulong *newlen); + +int row_log_event_uncompress(const Format_description_log_event *description_event, bool contain_checksum, + const char *src, ulong src_len, char* buf, ulong buf_size, bool* is_malloc, + char **dst, ulong *newlen); + + #endif /* _log_event_h */ diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index 0502f20d2b1..552221ee68a 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -1582,11 +1582,10 @@ int Old_rows_log_event::do_apply_event(rpl_group_info *rgi) break; default: - rli->report(ERROR_LEVEL, thd->net.last_errno, NULL, + rli->report(ERROR_LEVEL, thd->net.last_errno, NULL, "Error in %s event: row application failed. %s", - get_type_str(), - thd->net.last_error ? thd->net.last_error : ""); - thd->is_slave_error= 1; + get_type_str(), thd->net.last_error); + thd->is_slave_error = 1; break; } @@ -1625,7 +1624,7 @@ int Old_rows_log_event::do_apply_event(rpl_group_info *rgi) "on table %s.%s. %s", get_type_str(), table->s->db.str, table->s->table_name.str, - thd->net.last_error ? thd->net.last_error : ""); + thd->net.last_error); /* If one day we honour --skip-slave-errors in row-based replication, and diff --git a/sql/mdl.cc b/sql/mdl.cc index 1d6b4f6ffc3..c05fdc0157b 100644 --- a/sql/mdl.cc +++ b/sql/mdl.cc @@ -391,7 +391,11 @@ public: virtual const bitmap_t *incompatible_waiting_types_bitmap() const { return m_waiting_incompatible; } virtual bool needs_notification(const MDL_ticket *ticket) const - { return (ticket->get_type() >= MDL_SHARED_NO_WRITE); } + { + return ticket->get_type() == MDL_SHARED_NO_WRITE || + ticket->get_type() == MDL_SHARED_NO_READ_WRITE || + ticket->get_type() == MDL_EXCLUSIVE; + } /** Notify threads holding a shared metadata locks on object which @@ -1413,7 +1417,8 @@ const MDL_lock::bitmap_t MDL_lock::MDL_scoped_lock::m_granted_incompatible[MDL_TYPE_END]= { MDL_BIT(MDL_EXCLUSIVE) | MDL_BIT(MDL_SHARED), - MDL_BIT(MDL_EXCLUSIVE) | MDL_BIT(MDL_INTENTION_EXCLUSIVE), 0, 0, 0, 0, 0, 0, + MDL_BIT(MDL_EXCLUSIVE) | MDL_BIT(MDL_INTENTION_EXCLUSIVE), + 0, 0, 0, 0, 0, 0, 0, MDL_BIT(MDL_EXCLUSIVE) | MDL_BIT(MDL_SHARED) | MDL_BIT(MDL_INTENTION_EXCLUSIVE) }; @@ -1421,7 +1426,7 @@ const MDL_lock::bitmap_t MDL_lock::MDL_scoped_lock::m_waiting_incompatible[MDL_TYPE_END]= { MDL_BIT(MDL_EXCLUSIVE) | MDL_BIT(MDL_SHARED), - MDL_BIT(MDL_EXCLUSIVE), 0, 0, 0, 0, 0, 0, 0 + MDL_BIT(MDL_EXCLUSIVE), 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -1433,39 +1438,41 @@ MDL_lock::MDL_scoped_lock::m_waiting_incompatible[MDL_TYPE_END]= The first array specifies if particular type of request can be satisfied if there is granted lock of certain type. - Request | Granted requests for lock | - type | S SH SR SW SU SNW SNRW X | - ----------+----------------------------------+ - S | + + + + + + + - | - SH | + + + + + + + - | - SR | + + + + + + - - | - SW | + + + + + - - - | - SU | + + + + - - - - | - SNW | + + + - - - - - | - SNRW | + + - - - - - - | - X | - - - - - - - - | - SU -> X | - - - - 0 0 0 0 | - SNW -> X | - - - 0 0 0 0 0 | - SNRW -> X | - - 0 0 0 0 0 0 | + Request | Granted requests for lock | + type | S SH SR SW SU SRO SNW SNRW X | + ----------+---------------------------------------+ + S | + + + + + + + + - | + SH | + + + + + + + + - | + SR | + + + + + + + - - | + SW | + + + + + - - - - | + SU | + + + + - + - - - | + SRO | + + + - + + + - - | + SNW | + + + - - + - - - | + SNRW | + + - - - - - - - | + X | - - - - - - - - - | + SU -> X | - - - - 0 - 0 0 0 | + SNW -> X | - - - 0 0 - 0 0 0 | + SNRW -> X | - - 0 0 0 0 0 0 0 | The second array specifies if particular type of request can be satisfied if there is waiting request for the same lock of certain type. In other words it specifies what is the priority of different lock types. - Request | Pending requests for lock | - type | S SH SR SW SU SNW SNRW X | - ----------+---------------------------------+ - S | + + + + + + + - | - SH | + + + + + + + + | - SR | + + + + + + - - | - SW | + + + + + - - - | - SU | + + + + + + + - | - SNW | + + + + + + + - | - SNRW | + + + + + + + - | - X | + + + + + + + + | - SU -> X | + + + + + + + + | - SNW -> X | + + + + + + + + | - SNRW -> X | + + + + + + + + | + Request | Pending requests for lock | + type | S SH SR SW SU SRO SNW SNRW X | + ----------+--------------------------------------+ + S | + + + + + + + + - | + SH | + + + + + + + + + | + SR | + + + + + + + - - | + SW | + + + + + + - - - | + SU | + + + + + + + + - | + SRO | + + + - + + + - - | + SNW | + + + + + + + + - | + SNRW | + + + + + + + + - | + X | + + + + + + + + + | + SU -> X | + + + + + + + + + | + SNW -> X | + + + + + + + + + | + SNRW -> X | + + + + + + + + + | Here: "+" -- means that request can be satisfied "-" -- means that request can't be satisfied and should wait @@ -1487,19 +1494,23 @@ MDL_lock::MDL_object_lock::m_granted_incompatible[MDL_TYPE_END]= MDL_BIT(MDL_EXCLUSIVE), MDL_BIT(MDL_EXCLUSIVE) | MDL_BIT(MDL_SHARED_NO_READ_WRITE), MDL_BIT(MDL_EXCLUSIVE) | MDL_BIT(MDL_SHARED_NO_READ_WRITE) | - MDL_BIT(MDL_SHARED_NO_WRITE), + MDL_BIT(MDL_SHARED_NO_WRITE) | MDL_BIT(MDL_SHARED_READ_ONLY), MDL_BIT(MDL_EXCLUSIVE) | MDL_BIT(MDL_SHARED_NO_READ_WRITE) | MDL_BIT(MDL_SHARED_NO_WRITE) | MDL_BIT(MDL_SHARED_UPGRADABLE), + MDL_BIT(MDL_EXCLUSIVE) | MDL_BIT(MDL_SHARED_NO_READ_WRITE) | + MDL_BIT(MDL_SHARED_WRITE), MDL_BIT(MDL_EXCLUSIVE) | MDL_BIT(MDL_SHARED_NO_READ_WRITE) | MDL_BIT(MDL_SHARED_NO_WRITE) | MDL_BIT(MDL_SHARED_UPGRADABLE) | MDL_BIT(MDL_SHARED_WRITE), MDL_BIT(MDL_EXCLUSIVE) | MDL_BIT(MDL_SHARED_NO_READ_WRITE) | - MDL_BIT(MDL_SHARED_NO_WRITE) | MDL_BIT(MDL_SHARED_UPGRADABLE) | - MDL_BIT(MDL_SHARED_WRITE) | MDL_BIT(MDL_SHARED_READ), + MDL_BIT(MDL_SHARED_NO_WRITE) | MDL_BIT(MDL_SHARED_READ_ONLY) | + MDL_BIT(MDL_SHARED_UPGRADABLE) | MDL_BIT(MDL_SHARED_WRITE) | + MDL_BIT(MDL_SHARED_READ), MDL_BIT(MDL_EXCLUSIVE) | MDL_BIT(MDL_SHARED_NO_READ_WRITE) | - MDL_BIT(MDL_SHARED_NO_WRITE) | MDL_BIT(MDL_SHARED_UPGRADABLE) | - MDL_BIT(MDL_SHARED_WRITE) | MDL_BIT(MDL_SHARED_READ) | - MDL_BIT(MDL_SHARED_HIGH_PRIO) | MDL_BIT(MDL_SHARED) + MDL_BIT(MDL_SHARED_NO_WRITE) | MDL_BIT(MDL_SHARED_READ_ONLY) | + MDL_BIT(MDL_SHARED_UPGRADABLE) | MDL_BIT(MDL_SHARED_WRITE) | + MDL_BIT(MDL_SHARED_READ) | MDL_BIT(MDL_SHARED_HIGH_PRIO) | + MDL_BIT(MDL_SHARED) }; @@ -1513,6 +1524,8 @@ MDL_lock::MDL_object_lock::m_waiting_incompatible[MDL_TYPE_END]= MDL_BIT(MDL_EXCLUSIVE) | MDL_BIT(MDL_SHARED_NO_READ_WRITE) | MDL_BIT(MDL_SHARED_NO_WRITE), MDL_BIT(MDL_EXCLUSIVE), + MDL_BIT(MDL_EXCLUSIVE) | MDL_BIT(MDL_SHARED_NO_READ_WRITE) | + MDL_BIT(MDL_SHARED_WRITE), MDL_BIT(MDL_EXCLUSIVE), MDL_BIT(MDL_EXCLUSIVE), 0 @@ -2306,10 +2319,11 @@ MDL_context::upgrade_shared_lock(MDL_ticket *mdl_ticket, if (mdl_ticket->has_stronger_or_equal_type(new_type)) DBUG_RETURN(FALSE); - /* Only allow upgrades from SHARED_UPGRADABLE/NO_WRITE/NO_READ_WRITE */ + /* Only allow upgrades from SHARED_UPGRADABLE/NO_WRITE/NO_READ_WRITE/READ */ DBUG_ASSERT(mdl_ticket->m_type == MDL_SHARED_UPGRADABLE || mdl_ticket->m_type == MDL_SHARED_NO_WRITE || - mdl_ticket->m_type == MDL_SHARED_NO_READ_WRITE); + mdl_ticket->m_type == MDL_SHARED_NO_READ_WRITE || + mdl_ticket->m_type == MDL_SHARED_READ); mdl_xlock_request.init(&mdl_ticket->m_lock->key, new_type, MDL_TRANSACTION); diff --git a/sql/mdl.h b/sql/mdl.h index 7961f1f24b2..97216b8e7b1 100644 --- a/sql/mdl.h +++ b/sql/mdl.h @@ -15,15 +15,6 @@ along with this program; if not, write to the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#if defined(__IBMC__) || defined(__IBMCPP__) -/* Further down, "next_in_lock" and "next_in_context" have the same type, - and in "sql_plist.h" this leads to an identical signature, which causes - problems in function overloading. -*/ -#pragma namemangling(v5) -#endif - - #include "sql_plist.h" #include #include @@ -204,6 +195,12 @@ enum enum_mdl_type { To be used for the first phase of ALTER TABLE. */ MDL_SHARED_UPGRADABLE, + /* + A shared metadata lock for cases when we need to read data from table + and block all concurrent modifications to it (for both data and metadata). + Used by LOCK TABLES READ statement. + */ + MDL_SHARED_READ_ONLY, /* An upgradable shared metadata lock which blocks all attempts to update table data, allowing reads. @@ -476,6 +473,19 @@ public: type= type_arg; } + /** + Is this a request for a lock which allow data to be updated? + + @note This method returns true for MDL_SHARED_UPGRADABLE type of + lock. Even though this type of lock doesn't allow updates + it will always be upgraded to one that does. + */ + bool is_write_lock_request() const + { + return (type >= MDL_SHARED_WRITE && + type != MDL_SHARED_READ_ONLY); + } + /* This is to work around the ugliness of TABLE_LIST compiler-generated assignment operator. It is currently used diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 0c742a5c484..84d6e3b582f 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -389,6 +389,8 @@ static DYNAMIC_ARRAY all_options; /* Global variables */ bool opt_bin_log, opt_bin_log_used=0, opt_ignore_builtin_innodb= 0; +bool opt_bin_log_compress; +uint opt_bin_log_compress_min_len; my_bool opt_log, debug_assert_if_crashed_table= 0, opt_help= 0; my_bool debug_assert_on_not_freed_memory= 0; my_bool disable_log_notes; @@ -3886,6 +3888,7 @@ SHOW_VAR com_status_vars[]= { {"drop_user", STMT_STATUS(SQLCOM_DROP_USER)}, {"drop_view", STMT_STATUS(SQLCOM_DROP_VIEW)}, {"empty_query", STMT_STATUS(SQLCOM_EMPTY_QUERY)}, + {"execute_immediate", STMT_STATUS(SQLCOM_EXECUTE_IMMEDIATE)}, {"execute_sql", STMT_STATUS(SQLCOM_EXECUTE)}, {"flush", STMT_STATUS(SQLCOM_FLUSH)}, {"get_diagnostics", STMT_STATUS(SQLCOM_GET_DIAGNOSTICS)}, @@ -4186,6 +4189,7 @@ static int init_common_variables() max_system_variables.pseudo_thread_id= ~(my_thread_id) 0; server_start_time= flush_status_time= my_time(0); + my_disable_copystat_in_redel= 1; global_rpl_filter= new Rpl_filter; binlog_filter= new Rpl_filter; @@ -4257,6 +4261,8 @@ static int init_common_variables() return 1; } + opt_log_basename= const_cast("mysql"); + if (gethostname(glob_hostname,sizeof(glob_hostname)) < 0) { /* @@ -4266,9 +4272,8 @@ static int init_common_variables() strmake(glob_hostname, STRING_WITH_LEN("localhost")); sql_print_warning("gethostname failed, using '%s' as hostname", glob_hostname); - opt_log_basename= const_cast("mysql"); } - else + else if (is_filename_allowed(glob_hostname, strlen(glob_hostname), FALSE)) opt_log_basename= glob_hostname; strmake(pidfile_name, opt_log_basename, sizeof(pidfile_name)-5); @@ -5168,6 +5173,12 @@ static int init_server_components() opt_bin_logname= my_once_strdup(buf, MYF(MY_WME)); } + /* + Since some wsrep threads (THDs) are create before plugins are + initialized, LOCK_plugin mutex needs to be initialized here. + */ + plugin_mutex_init(); + /* Wsrep initialization must happen at this point, because: - opt_bin_logname must be known when starting replication @@ -5409,6 +5420,17 @@ static int init_server_components() #endif #ifdef WITH_WSREP + /* + Now is the right time to initialize members of wsrep startup threads + that rely on plugins and other related global system variables to be + initialized. This initialization was not possible before, as plugins + (and thus some global system variables) are initialized after wsrep + startup threads are created. + Note: This only needs to be done for rsync, xtrabackup based SST methods. + */ + if (wsrep_before_SE()) + wsrep_plugins_post_init(); + if (WSREP_ON && !opt_bin_log) { wsrep_emulate_bin_log= 1; @@ -5875,6 +5897,12 @@ int mysqld_main(int argc, char **argv) setbuf(stderr, NULL); FreeConsole(); // Remove window } + + if (fileno(stdin) >= 0) + { + /* Disable CRLF translation (MDEV-9409). */ + _setmode(fileno(stdin), O_BINARY); + } #endif #ifdef WITH_WSREP @@ -6007,11 +6035,26 @@ int mysqld_main(int argc, char **argv) } disable_log_notes= 0; /* Startup done, now we can give notes again */ - sql_print_information(ER_DEFAULT(ER_STARTUP),my_progname,server_version, - ((mysql_socket_getfd(unix_sock) == INVALID_SOCKET) ? - (char*) "" : mysqld_unix_port), - mysqld_port, - MYSQL_COMPILATION_COMMENT); + + if (IS_SYSVAR_AUTOSIZE(&server_version_ptr)) + sql_print_information(ER_DEFAULT(ER_STARTUP), my_progname, server_version, + ((mysql_socket_getfd(unix_sock) == INVALID_SOCKET) ? + (char*) "" : mysqld_unix_port), + mysqld_port, MYSQL_COMPILATION_COMMENT); + else + { + char real_server_version[2 * SERVER_VERSION_LENGTH + 10]; + + set_server_version(real_server_version, sizeof(real_server_version)); + strcat(real_server_version, "' as '"); + strcat(real_server_version, server_version); + + sql_print_information(ER_DEFAULT(ER_STARTUP), my_progname, + real_server_version, + ((mysql_socket_getfd(unix_sock) == INVALID_SOCKET) ? + (char*) "" : mysqld_unix_port), + mysqld_port, MYSQL_COMPILATION_COMMENT); + } // try to keep fd=0 busy if (!freopen(IF_WIN("NUL","/dev/null"), "r", stdin)) @@ -9026,9 +9069,10 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument) case (int) OPT_LOG_BASENAME: { if (opt_log_basename[0] == 0 || strchr(opt_log_basename, FN_EXTCHAR) || - strchr(opt_log_basename,FN_LIBCHAR)) + strchr(opt_log_basename,FN_LIBCHAR) || + !is_filename_allowed(opt_log_basename, strlen(opt_log_basename), FALSE)) { - sql_print_error("Wrong argument for --log-basename. It can't be empty or contain '.' or '" FN_DIRSEP "'"); + sql_print_error("Wrong argument for --log-basename. It can't be empty or contain '.' or '" FN_DIRSEP "'. It must be valid filename."); return 1; } if (log_error_file_ptr != disabled_my_option) @@ -9911,9 +9955,9 @@ static int test_if_case_insensitive(const char *dir_name) MY_STAT stat_info; DBUG_ENTER("test_if_case_insensitive"); - fn_format(buff, glob_hostname, dir_name, ".lower-test", + fn_format(buff, opt_log_basename, dir_name, ".lower-test", MY_UNPACK_FILENAME | MY_REPLACE_EXT | MY_REPLACE_DIR); - fn_format(buff2, glob_hostname, dir_name, ".LOWER-TEST", + fn_format(buff2, opt_log_basename, dir_name, ".LOWER-TEST", MY_UNPACK_FILENAME | MY_REPLACE_EXT | MY_REPLACE_DIR); mysql_file_delete(key_file_casetest, buff2, MYF(0)); if ((file= mysql_file_create(key_file_casetest, diff --git a/sql/mysqld.h b/sql/mysqld.h index 294b463161b..96944c012ce 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -109,7 +109,8 @@ extern CHARSET_INFO *character_set_filesystem; extern MY_BITMAP temp_pool; extern bool opt_large_files; -extern bool opt_update_log, opt_bin_log, opt_error_log; +extern bool opt_update_log, opt_bin_log, opt_error_log, opt_bin_log_compress; +extern uint opt_bin_log_compress_min_len; extern my_bool opt_log, opt_bootstrap; extern my_bool opt_backup_history_log; extern my_bool opt_backup_progress_log; @@ -661,13 +662,15 @@ enum enum_query_type QT_WITHOUT_INTRODUCERS= (1 << 1), /// view internal representation (like QT_ORDINARY except ORDER BY clause) QT_VIEW_INTERNAL= (1 << 2), - /// If identifiers should not include database names for the current database - QT_ITEM_IDENT_SKIP_CURRENT_DATABASE= (1 << 3), + /// If identifiers should not include database names, where unambiguous + QT_ITEM_IDENT_SKIP_DB_NAMES= (1 << 3), + /// If identifiers should not include table names, where unambiguous + QT_ITEM_IDENT_SKIP_TABLE_NAMES= (1 << 4), /// If Item_cache_wrapper should not print - QT_ITEM_CACHE_WRAPPER_SKIP_DETAILS= (1 << 4), + QT_ITEM_CACHE_WRAPPER_SKIP_DETAILS= (1 << 5), /// If Item_subselect should print as just "(subquery#1)" /// rather than display the subquery body - QT_ITEM_SUBSELECT_ID_ONLY= (1 << 5), + QT_ITEM_SUBSELECT_ID_ONLY= (1 << 6), /// If NULLIF(a,b) should print itself as /// CASE WHEN a_for_comparison=b THEN NULL ELSE a_for_return_value END /// when "a" was replaced to two different items @@ -677,11 +680,11 @@ enum enum_query_type /// a_for_return_value is not the same as a_for_comparison. /// SHOW CREATE {VIEW|PROCEDURE|FUNCTION} and other cases where the /// original representation is required, should set this flag. - QT_ITEM_ORIGINAL_FUNC_NULLIF= (1 <<6), + QT_ITEM_ORIGINAL_FUNC_NULLIF= (1 << 7), /// This value means focus on readability, not on ability to parse back, etc. QT_EXPLAIN= QT_TO_SYSTEM_CHARSET | - QT_ITEM_IDENT_SKIP_CURRENT_DATABASE | + QT_ITEM_IDENT_SKIP_DB_NAMES | QT_ITEM_CACHE_WRAPPER_SKIP_DETAILS | QT_ITEM_SUBSELECT_ID_ONLY, diff --git a/sql/net_serv.cc b/sql/net_serv.cc index fccc947f3f1..f9635689e63 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -1,5 +1,5 @@ -/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2010, 2014, SkySQL Ab. +/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. + Copyright (c) 2012, 2016, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -60,8 +60,10 @@ #define EXTRA_DEBUG_fflush fflush #else static void inline EXTRA_DEBUG_fprintf(...) {} +#ifndef MYSQL_SERVER static int inline EXTRA_DEBUG_fflush(...) { return 0; } #endif +#endif #ifdef MYSQL_SERVER #define MYSQL_SERVER_my_error my_error #else @@ -1133,15 +1135,22 @@ ulong my_net_read(NET *net) The function returns the length of the found packet or packet_error. net->read_pos points to the read data. */ +ulong +my_net_read_packet(NET *net, my_bool read_from_server) +{ + ulong reallen = 0; + return my_net_read_packet_reallen(net, read_from_server, &reallen); +} ulong -my_net_read_packet(NET *net, my_bool read_from_server) +my_net_read_packet_reallen(NET *net, my_bool read_from_server, ulong* reallen) { size_t len, complen; MYSQL_NET_READ_START(); + *reallen = 0; #ifdef HAVE_COMPRESS if (!net->compress) { @@ -1164,7 +1173,10 @@ my_net_read_packet(NET *net, my_bool read_from_server) } net->read_pos = net->buff + net->where_b; if (len != packet_error) + { net->read_pos[len]=0; /* Safeguard for mysql_use_result */ + *reallen = len; + } MYSQL_NET_READ_DONE(0, len); return len; #ifdef HAVE_COMPRESS @@ -1265,6 +1277,7 @@ my_net_read_packet(NET *net, my_bool read_from_server) return packet_error; } buf_length+= complen; + *reallen += packet_len; } net->read_pos= net->buff+ first_packet_offset + NET_HEADER_SIZE; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 3ea9f4e5db9..01b836fddf7 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1477,6 +1477,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler, handler *save_file= file, *org_file; my_bool org_key_read; THD *thd= head->in_use; + MY_BITMAP * const save_vcol_set= head->vcol_set; MY_BITMAP * const save_read_set= head->read_set; MY_BITMAP * const save_write_set= head->write_set; DBUG_ENTER("QUICK_RANGE_SELECT::init_ror_merged_scan"); @@ -1489,7 +1490,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler, { DBUG_RETURN(1); } - head->column_bitmaps_set(&column_bitmap, &column_bitmap); + head->column_bitmaps_set(&column_bitmap, &column_bitmap, &column_bitmap); goto end; } @@ -1514,7 +1515,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler, goto failure; /* purecov: inspected */ } - head->column_bitmaps_set(&column_bitmap, &column_bitmap); + head->column_bitmaps_set(&column_bitmap, &column_bitmap, &column_bitmap); if (file->ha_external_lock(thd, F_RDLCK)) goto failure; @@ -1568,7 +1569,7 @@ end: DBUG_RETURN(0); failure: - head->column_bitmaps_set(save_read_set, save_write_set); + head->column_bitmaps_set(save_read_set, save_write_set, save_vcol_set); delete file; file= save_file; DBUG_RETURN(1); @@ -2759,9 +2760,16 @@ bool create_key_parts_for_pseudo_indexes(RANGE_OPT_PARAM *param, { Field *field= *field_ptr; uint16 store_length; + uint16 max_key_part_length= (uint16) table->file->max_key_part_length(); key_part->key= keys; key_part->part= 0; - key_part->length= (uint16) field->key_length(); + if (field->flags & BLOB_FLAG) + key_part->length= max_key_part_length; + else + { + key_part->length= (uint16) field->key_length(); + set_if_smaller(key_part->length, max_key_part_length); + } store_length= key_part->length; if (field->real_maybe_null()) store_length+= HA_KEY_NULL_LENGTH; @@ -3107,6 +3115,7 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond) } free_alloc: + thd->no_errors= 0; thd->mem_root= param.old_root; free_root(&alloc, MYF(0)); diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index a09826ac2f0..a9222cbca42 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -4000,7 +4000,7 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd) table->alias.set("weedout-tmp", sizeof("weedout-tmp")-1, table_alias_charset); table->reginfo.lock_type=TL_WRITE; /* Will be updated */ - table->db_stat=HA_OPEN_KEYFILE+HA_OPEN_RNDFILE; + table->db_stat=HA_OPEN_KEYFILE; table->map=1; table->temp_pool_slot = temp_pool_slot; table->copy_blobs= 1; diff --git a/sql/parse_file.h b/sql/parse_file.h index e4756e6c8af..87917dbd71b 100644 --- a/sql/parse_file.h +++ b/sql/parse_file.h @@ -42,9 +42,9 @@ enum file_opt_type { struct File_option { - LEX_STRING name; /**< Name of the option */ - int offset; /**< offset to base address of value */ - file_opt_type type; /**< Option type */ + LEX_STRING name; /**< Name of the option */ + my_ptrdiff_t offset; /**< offset to base address of value */ + file_opt_type type; /**< Option type */ }; diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 273c0afb9ac..74c09b8a3c6 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -40,8 +40,6 @@ partition_info *partition_info::get_clone(THD *thd) MEM_ROOT *mem_root= thd->mem_root; DBUG_ENTER("partition_info::get_clone"); - if (!this) - DBUG_RETURN(NULL); List_iterator part_it(partitions); partition_element *part; partition_info *clone= new (mem_root) partition_info(); @@ -255,7 +253,6 @@ bool partition_info::set_partition_bitmaps(TABLE_LIST *table_list) DBUG_ASSERT(bitmaps_are_initialized); DBUG_ASSERT(table); - is_pruning_completed= false; if (!bitmaps_are_initialized) DBUG_RETURN(TRUE); @@ -282,239 +279,6 @@ bool partition_info::set_partition_bitmaps(TABLE_LIST *table_list) } -/** - Checks if possible to do prune partitions on insert. - - @param thd Thread context - @param duplic How to handle duplicates - @param update In case of ON DUPLICATE UPDATE, default function fields - @param update_fields In case of ON DUPLICATE UPDATE, which fields to update - @param fields Listed fields - @param empty_values True if values is empty (only defaults) - @param[out] prune_needs_default_values Set on return if copying of default - values is needed - @param[out] can_prune_partitions Enum showing if possible to prune - @param[inout] used_partitions If possible to prune the bitmap - is initialized and cleared - - @return Operation status - @retval false Success - @retval true Failure -*/ - -bool partition_info::can_prune_insert(THD* thd, - enum_duplicates duplic, - COPY_INFO &update, - List &update_fields, - List &fields, - bool empty_values, - enum_can_prune *can_prune_partitions, - bool *prune_needs_default_values, - MY_BITMAP *used_partitions) -{ - uint32 *bitmap_buf; - uint bitmap_bytes; - uint num_partitions= 0; - *can_prune_partitions= PRUNE_NO; - DBUG_ASSERT(bitmaps_are_initialized); - DBUG_ENTER("partition_info::can_prune_insert"); - - if (table->s->db_type()->partition_flags() & HA_USE_AUTO_PARTITION) - DBUG_RETURN(false); - - /* - If under LOCK TABLES pruning will skip start_stmt instead of external_lock - for unused partitions. - - Cannot prune if there are BEFORE INSERT triggers that changes any - partitioning column, since they may change the row to be in another - partition. - */ - if (is_fields_updated_in_triggers(TRG_EVENT_INSERT, TRG_ACTION_BEFORE)) - DBUG_RETURN(false); - - if (table->found_next_number_field) - { - /* - If the field is used in the partitioning expression, we cannot prune. - TODO: If all rows have not null values and - is not 0 (with NO_AUTO_VALUE_ON_ZERO sql_mode), then pruning is possible! - */ - if (bitmap_is_set(&full_part_field_set, - table->found_next_number_field->field_index)) - DBUG_RETURN(false); - } - - /* - If updating a field in the partitioning expression, we cannot prune. - - Note: TIMESTAMP_AUTO_SET_ON_INSERT is handled by converting Item_null - to the start time of the statement. Which will be the same as in - write_row(). So pruning of TIMESTAMP DEFAULT CURRENT_TIME will work. - But TIMESTAMP_AUTO_SET_ON_UPDATE cannot be pruned if the timestamp - column is a part of any part/subpart expression. - */ - if (duplic == DUP_UPDATE) - { - /* - TODO: add check for static update values, which can be pruned. - */ - if (is_field_in_part_expr(update_fields)) - DBUG_RETURN(false); - - /* - Cannot prune if there are BEFORE UPDATE triggers that changes any - partitioning column, since they may change the row to be in another - partition. - */ - if (is_fields_updated_in_triggers(TRG_EVENT_UPDATE, TRG_ACTION_BEFORE)) - DBUG_RETURN(false); - } - - /* - If not all partitioning fields are given, - we also must set all non given partitioning fields - to get correct defaults. - TODO: If any gain, we could enhance this by only copy the needed default - fields by - 1) check which fields needs to be set. - 2) only copy those fields from the default record. - */ - *prune_needs_default_values= false; - if (fields.elements) - { - if (!is_full_part_expr_in_fields(fields)) - *prune_needs_default_values= true; - } - else if (empty_values) - { - *prune_needs_default_values= true; // like 'INSERT INTO t () VALUES ()' - } - else - { - /* - In case of INSERT INTO t VALUES (...) we must get values for - all fields in table from VALUES (...) part, so no defaults - are needed. - */ - } - - /* Pruning possible, have to initialize the used_partitions bitmap. */ - num_partitions= lock_partitions.n_bits; - bitmap_bytes= bitmap_buffer_size(num_partitions); - if (!(bitmap_buf= (uint32*) thd->alloc(bitmap_bytes))) - { - mem_alloc_error(bitmap_bytes); - DBUG_RETURN(true); - } - /* Also clears all bits. */ - if (my_bitmap_init(used_partitions, bitmap_buf, num_partitions, false)) - { - /* purecov: begin deadcode */ - /* Cannot happen, due to pre-alloc. */ - mem_alloc_error(bitmap_bytes); - DBUG_RETURN(true); - /* purecov: end */ - } - /* - If no partitioning field in set (e.g. defaults) check pruning only once. - */ - if (fields.elements && - !is_field_in_part_expr(fields)) - *can_prune_partitions= PRUNE_DEFAULTS; - else - *can_prune_partitions= PRUNE_YES; - - DBUG_RETURN(false); -} - - -/** - Mark the partition, the record belongs to, as used. - - @param fields Fields to set - @param values Values to use - @param info COPY_INFO used for default values handling - @param copy_default_values True if we should copy default values - @param used_partitions Bitmap to set - - @returns Operational status - @retval false Success - @retval true Failure -*/ - -bool partition_info::set_used_partition(List &fields, - List &values, - COPY_INFO &info, - bool copy_default_values, - MY_BITMAP *used_partitions) -{ - THD *thd= table->in_use; - uint32 part_id; - longlong func_value; - Dummy_error_handler error_handler; - bool ret= true; - DBUG_ENTER("set_partition"); - DBUG_ASSERT(thd); - - /* Only allow checking of constant values */ - List_iterator_fast v(values); - Item *item; - thd->push_internal_handler(&error_handler); - while ((item= v++)) - { - if (!item->const_item()) - goto err; - } - - if (copy_default_values) - restore_record(table,s->default_values); - - if (fields.elements || !values.elements) - { - if (fill_record(thd, table, fields, values, false, !copy_default_values)) - goto err; - } - else - { - /* All fields has a value */ - if (fill_record(thd, table, table->field, values, false, false)) - goto err; - } - DBUG_ASSERT(!table->auto_increment_field_not_null); - - /* - Evaluate DEFAULT functions like CURRENT_TIMESTAMP. - TODO: avoid setting non partitioning fields default value, to avoid - overhead. Not yet done, since mostly only one DEFAULT function per - table, or at least very few such columns. - */ -// if (info.function_defaults_apply_on_columns(&full_part_field_set)) -// info.set_function_defaults(table); - - { - /* - This function is used in INSERT; 'values' are supplied by user, - or are default values, not values read from a table, so read_set is - irrelevant. - */ - my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set); - const int rc= get_partition_id(this, &part_id, &func_value); - dbug_tmp_restore_column_map(table->read_set, old_map); - if (rc) - goto err; - } - - DBUG_PRINT("info", ("Insert into partition %u", part_id)); - bitmap_set_bit(used_partitions, part_id); - ret= false; - -err: - thd->pop_internal_handler(); - DBUG_RETURN(ret); -} - - /* Create a memory area where default partition names are stored and fill it up with the names. @@ -562,42 +326,6 @@ char *partition_info::create_default_partition_names(THD *thd, uint part_no, } -/* - Generate a version string for partition expression - This function must be updated every time there is a possibility for - a new function of a higher version number than 5.5.0. - - SYNOPSIS - set_show_version_string() - RETURN VALUES - None -*/ -void partition_info::set_show_version_string(String *packet) -{ - int version= 0; - if (column_list) - packet->append(STRING_WITH_LEN("\n/*!50500")); - else - { - if (part_expr) - part_expr->walk(&Item::intro_version, 0, &version); - if (subpart_expr) - subpart_expr->walk(&Item::intro_version, 0, &version); - if (version == 0) - { - /* No new functions in partition function */ - packet->append(STRING_WITH_LEN("\n/*!50100")); - } - else - { - char buf[65]; - char *buf_ptr= longlong10_to_str((longlong)version, buf, 10); - packet->append(STRING_WITH_LEN("\n/*!")); - packet->append(buf, (size_t)(buf_ptr - buf)); - } - } -} - /* Create a unique name for the subpartition as part_name'sp''subpart_no' @@ -2205,71 +1933,6 @@ void partition_info::report_part_expr_error(bool use_subpart_expr) } -/** - Check if fields are in the partitioning expression. - - @param fields List of Items (fields) - - @return True if any field in the fields list is used by a partitioning expr. - @retval true At least one field in the field list is found. - @retval false No field is within any partitioning expression. -*/ - -bool partition_info::is_field_in_part_expr(List &fields) -{ - List_iterator it(fields); - Item *item; - Item_field *field; - DBUG_ENTER("is_fields_in_part_expr"); - while ((item= it++)) - { - field= item->field_for_view_update(); - DBUG_ASSERT(field->field->table == table); - if (bitmap_is_set(&full_part_field_set, field->field->field_index)) - DBUG_RETURN(true); - } - DBUG_RETURN(false); -} - - -/** - Check if all partitioning fields are included. -*/ - -bool partition_info::is_full_part_expr_in_fields(List &fields) -{ - Field **part_field= full_part_field_array; - DBUG_ASSERT(*part_field); - DBUG_ENTER("is_full_part_expr_in_fields"); - /* - It is very seldom many fields in full_part_field_array, so it is OK - to loop over all of them instead of creating a bitmap fields argument - to compare with. - */ - do - { - List_iterator it(fields); - Item *item; - Item_field *field; - bool found= false; - - while ((item= it++)) - { - field= item->field_for_view_update(); - DBUG_ASSERT(field->field->table == table); - if (*part_field == field->field) - { - found= true; - break; - } - } - if (!found) - DBUG_RETURN(false); - } while (*(++part_field)); - DBUG_RETURN(true); -} - - /* Create a new column value in current list with maxvalue Called from parser diff --git a/sql/partition_info.h b/sql/partition_info.h index 99a71fea798..d4c180ddcdd 100644 --- a/sql/partition_info.h +++ b/sql/partition_info.h @@ -242,15 +242,6 @@ public: bool is_auto_partitioned; bool has_null_value; bool column_list; // COLUMNS PARTITIONING, 5.5+ - /** - True if pruning has been completed and can not be pruned any further, - even if there are subqueries or stored programs in the condition. - - Some times it is needed to run prune_partitions() a second time to prune - read partitions after tables are locked, when subquery and - stored functions might have been evaluated. - */ - bool is_pruning_completed; partition_info() : get_partition_id(NULL), get_part_partition_id(NULL), @@ -284,7 +275,7 @@ public: list_of_part_fields(FALSE), list_of_subpart_fields(FALSE), linear_hash_ind(FALSE), fixed(FALSE), is_auto_partitioned(FALSE), - has_null_value(FALSE), column_list(FALSE), is_pruning_completed(false) + has_null_value(FALSE), column_list(FALSE) { all_fields_in_PF.clear_all(); all_fields_in_PPF.clear_all(); @@ -344,51 +335,12 @@ public: bool check_partition_field_length(); bool init_column_part(THD *thd); bool add_column_list_value(THD *thd, Item *item); - void set_show_version_string(String *packet); partition_element *get_part_elem(const char *partition_name, char *file_name, uint32 *part_id); void report_part_expr_error(bool use_subpart_expr); - bool set_used_partition(List &fields, - List &values, - COPY_INFO &info, - bool copy_default_values, - MY_BITMAP *used_partitions); - /** - PRUNE_NO - Unable to prune. - PRUNE_DEFAULTS - Partitioning field is only set to - DEFAULT values, only need to check - pruning for one row where the DEFAULTS - values are set. - PRUNE_YES - Pruning is possible, calculate the used partition set - by evaluate the partition_id on row by row basis. - */ - enum enum_can_prune {PRUNE_NO=0, PRUNE_DEFAULTS, PRUNE_YES}; - bool can_prune_insert(THD *thd, - enum_duplicates duplic, - COPY_INFO &update, - List &update_fields, - List &fields, - bool empty_values, - enum_can_prune *can_prune_partitions, - bool *prune_needs_default_values, - MY_BITMAP *used_partitions); bool has_same_partitioning(partition_info *new_part_info); private: - bool is_fields_updated_in_triggers(trg_event_type event_type, - trg_action_time_type action_time_type) - { - if (table->triggers) - { - Trigger *t; - for (t= table->triggers->get_trigger(event_type, action_time_type); - t; - t= t->next) - if (t->is_fields_updated_in_trigger(&full_part_field_set)) - return true; - } - return false; - } static int list_part_cmp(const void* a, const void* b); bool set_up_default_partitions(THD *thd, handler *file, HA_CREATE_INFO *info, uint start_no); @@ -400,8 +352,6 @@ private: const char *part_name); bool prune_partition_bitmaps(TABLE_LIST *table_list); bool add_named_partition(const char *part_name, uint length); - bool is_field_in_part_expr(List &fields); - bool is_full_part_expr_in_fields(List &fields); public: bool has_unique_name(partition_element *element); }; diff --git a/sql/protocol.cc b/sql/protocol.cc index be73c94c9b2..f8b68c02fff 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -572,6 +572,7 @@ void Protocol::end_statement() thd->get_stmt_da()->statement_warn_count()); break; case Diagnostics_area::DA_OK: + case Diagnostics_area::DA_OK_BULK: error= send_ok(thd->server_status, thd->get_stmt_da()->statement_warn_count(), thd->get_stmt_da()->affected_rows(), @@ -1306,33 +1307,27 @@ bool Protocol_text::send_out_parameters(List *sp_params) thd->lex->prepared_stmt_params.elements); List_iterator_fast item_param_it(*sp_params); - List_iterator_fast user_var_name_it(thd->lex->prepared_stmt_params); + List_iterator_fast param_it(thd->lex->prepared_stmt_params); while (true) { Item_param *item_param= item_param_it++; - LEX_STRING *user_var_name= user_var_name_it++; + Item *param= param_it++; + Settable_routine_parameter *sparam; - if (!item_param || !user_var_name) + if (!item_param || !param) break; if (!item_param->get_out_param_info()) continue; // It's an IN-parameter. - Item_func_set_user_var *suv= - new (thd->mem_root) Item_func_set_user_var(thd, *user_var_name, item_param); - /* - Item_func_set_user_var is not fixed after construction, call - fix_fields(). - */ - if (suv->fix_fields(thd, NULL)) - return TRUE; + if (!(sparam= param->get_settable_routine_parameter())) + { + DBUG_ASSERT(0); + continue; + } - if (suv->check(FALSE)) - return TRUE; - - if (suv->update()) - return TRUE; + sparam->set_value(thd, thd->spcont, reinterpret_cast(&item_param)); } return FALSE; diff --git a/sql/records.cc b/sql/records.cc index e7a4ab836c0..fccfa751c7e 100644 --- a/sql/records.cc +++ b/sql/records.cc @@ -358,8 +358,6 @@ static int rr_quick(READ_RECORD *info) break; } } - if (info->table->vfield) - update_virtual_fields(info->thd, info->table); return tmp; } @@ -483,8 +481,6 @@ int rr_sequential(READ_RECORD *info) break; } } - if (!tmp && info->table->vfield) - update_virtual_fields(info->thd, info->table); return tmp; } diff --git a/sql/rpl_filter.cc b/sql/rpl_filter.cc index f1c6d76f7ff..b82e7bada45 100644 --- a/sql/rpl_filter.cc +++ b/sql/rpl_filter.cc @@ -282,6 +282,9 @@ Rpl_filter::parse_filter_rule(const char* spec, Add_filter add) int status= 0; char *arg, *ptr, *pstr; + if (!spec) + return false; + if (! (ptr= my_strdup(spec, MYF(MY_WME)))) return true; diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc index 4adea76b3cb..1d9cb39075b 100644 --- a/sql/rpl_gtid.cc +++ b/sql/rpl_gtid.cc @@ -448,19 +448,7 @@ static const TABLE_FIELD_DEF mysql_gtid_slave_pos_tabledef= { mysql_rpl_slave_state_pk_parts }; -class Gtid_db_intact : public Table_check_intact -{ -protected: - void report_error(uint, const char *fmt, ...) - { - va_list args; - va_start(args, fmt); - error_log_print(ERROR_LEVEL, fmt, args); - va_end(args); - } -}; - -static Gtid_db_intact gtid_table_intact; +static Table_check_intact_log_error gtid_table_intact; /* Check that the mysql.gtid_slave_pos table has the correct definition. diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index 6048d26998b..fd04e233d35 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -18,7 +18,7 @@ #include "sql_priv.h" #include #include "rpl_mi.h" -#include "slave.h" // SLAVE_MAX_HEARTBEAT_PERIOD +#include "slave.h" #include "strfunc.h" #include "sql_repl.h" @@ -647,7 +647,7 @@ file '%s')", fname); (ulong) mi->master_log_pos)); mi->rli.mi= mi; - if (init_relay_log_info(&mi->rli, slave_info_fname)) + if (mi->rli.init(slave_info_fname)) goto err; mi->inited = 1; diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc index 8cd7474cb73..f7aab704c43 100644 --- a/sql/rpl_parallel.cc +++ b/sql/rpl_parallel.cc @@ -47,9 +47,7 @@ rpt_handle_event(rpl_parallel_thread::queued_event *qev, if (!(ev->is_artificial_event() || ev->is_relay_log_event() || (ev->when == 0))) rgi->last_master_timestamp= ev->when + (time_t)ev->exec_time; - mysql_mutex_lock(&rli->data_lock); - /* Mutex will be released in apply_event_and_update_pos(). */ - err= apply_event_and_update_pos(ev, thd, rgi, rpt); + err= apply_event_and_update_pos_for_parallel(ev, thd, rgi); thread_safe_increment64(&rli->executed_entries); /* ToDo: error handling. */ @@ -647,7 +645,7 @@ is_group_ending(Log_event *ev, Log_event_type event_type) { if (event_type == XID_EVENT) return 1; - if (event_type == QUERY_EVENT) + if (event_type == QUERY_EVENT) // COMMIT/ROLLBACK are never compressed { Query_log_event *qev = (Query_log_event *)ev; if (qev->is_commit()) @@ -2426,8 +2424,17 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev, !(unlikely(rli->gtid_skip_flag != GTID_SKIP_NOT) && is_group_event)) return -1; - /* ToDo: what to do with this lock?!? */ - mysql_mutex_unlock(&rli->data_lock); + /* Note: rli->data_lock is released by sql_delay_event(). */ + if (sql_delay_event(ev, rli->sql_driver_thd, serial_rgi)) + { + /* + If sql_delay_event() returns non-zero, it means that the wait timed out + due to slave stop. We should not queue the event in this case, it must + not be applied yet. + */ + delete ev; + return 1; + } if (unlikely(typ == FORMAT_DESCRIPTION_EVENT)) { @@ -2504,7 +2511,7 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev, { DBUG_ASSERT(rli->gtid_skip_flag == GTID_SKIP_TRANSACTION); if (typ == XID_EVENT || - (typ == QUERY_EVENT && + (typ == QUERY_EVENT && // COMMIT/ROLLBACK are never compressed (((Query_log_event *)ev)->is_commit() || ((Query_log_event *)ev)->is_rollback()))) rli->gtid_skip_flag= GTID_SKIP_NOT; @@ -2766,7 +2773,6 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev, /* Queue the event for processing. */ - rli->event_relay_log_pos= rli->future_event_relay_log_pos; qev->ir= rli->last_inuse_relaylog; ++qev->ir->queued_count; cur_thread->enqueue(qev); diff --git a/sql/rpl_record.cc b/sql/rpl_record.cc index f82c5a3982a..c753f76c930 100644 --- a/sql/rpl_record.cc +++ b/sql/rpl_record.cc @@ -416,6 +416,13 @@ unpack_row(rpl_group_info *rgi, } } + /* + Add Extra slave persistent columns + */ + int error= 0; + if ((error= fill_extra_persistent_columns(table, cols->n_bits))) + DBUG_RETURN(error); + /* We should now have read all the null bytes, otherwise something is really wrong. @@ -489,5 +496,30 @@ int prepare_record(TABLE *const table, const uint skip, const bool check) DBUG_RETURN(0); } +/** + Fills @c table->record[0] with computed values of extra persistent column which are present on slave but not on master. + @param table Table whose record[0] buffer is prepared. + @param master_cols No of columns on master + @returns 0 on success + */ +int fill_extra_persistent_columns(TABLE *table, int master_cols) +{ + int error= 0; + Field **vfield_ptr, *vfield; + if (!table->vfield) + return 0; + for (vfield_ptr= table->vfield; *vfield_ptr; ++vfield_ptr) + { + vfield= *vfield_ptr; + if (vfield->field_index >= master_cols && vfield->stored_in_db()) + { + /*Set bitmap for writing*/ + bitmap_set_bit(table->vcol_set, vfield->field_index); + error= vfield->vcol_info->expr->save_in_field(vfield,0); + bitmap_clear_bit(table->vcol_set, vfield->field_index); + } + } + return error; +} #endif // HAVE_REPLICATION diff --git a/sql/rpl_record.h b/sql/rpl_record.h index c10eb8225b0..be69716d9d5 100644 --- a/sql/rpl_record.h +++ b/sql/rpl_record.h @@ -38,6 +38,7 @@ int unpack_row(rpl_group_info *rgi, // Fill table's record[0] with default values. int prepare_record(TABLE *const table, const uint skip, const bool check); +int fill_extra_persistent_columns(TABLE *table, int master_cols); #endif #endif diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index de6e37aecaf..cd189b4ab2d 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -29,6 +29,7 @@ #include "rpl_utility.h" #include "transaction.h" #include "sql_parse.h" // end_trans, ROLLBACK +#include "slave.h" #include #include @@ -42,30 +43,24 @@ rpl_slave_state *rpl_global_gtid_slave_state; /* Object used for MASTER_GTID_WAIT(). */ gtid_waiting rpl_global_gtid_waiting; - -// Defined in slave.cc -int init_intvar_from_file(int* var, IO_CACHE* f, int default_val); -int init_strvar_from_file(char *var, int max_size, IO_CACHE *f, - const char *default_val); +const char *const Relay_log_info::state_delaying_string = "Waiting until MASTER_DELAY seconds after master executed event"; Relay_log_info::Relay_log_info(bool is_slave_recovery) :Slave_reporting_capability("SQL"), - no_storage(FALSE), replicate_same_server_id(::replicate_same_server_id), + replicate_same_server_id(::replicate_same_server_id), info_fd(-1), cur_log_fd(-1), relay_log(&sync_relaylog_period), sync_counter(0), is_relay_log_recovery(is_slave_recovery), save_temporary_tables(0), mi(0), inuse_relaylog_list(0), last_inuse_relaylog(0), cur_log_old_open_count(0), group_relay_log_pos(0), event_relay_log_pos(0), -#if HAVE_valgrind - is_fake(FALSE), -#endif group_master_log_pos(0), log_space_total(0), ignore_log_space_limit(0), last_master_timestamp(0), sql_thread_caught_up(true), slave_skip_counter(0), abort_pos_wait(0), slave_run_id(0), sql_driver_thd(), gtid_skip_flag(GTID_SKIP_NOT), inited(0), abort_slave(0), stop_for_until(0), slave_running(MYSQL_SLAVE_NOT_RUN), until_condition(UNTIL_NONE), until_log_pos(0), retried_trans(0), executed_entries(0), + sql_delay(0), sql_delay_end(0), m_flags(0) { DBUG_ENTER("Relay_log_info::Relay_log_info"); @@ -117,39 +112,42 @@ Relay_log_info::~Relay_log_info() } -int init_relay_log_info(Relay_log_info* rli, - const char* info_fname) +/** + Read the relay_log.info file. + + @param info_fname The name of the file to read from. + @retval 0 success + @retval 1 failure +*/ +int Relay_log_info::init(const char* info_fname) { char fname[FN_REFLEN+128]; - int info_fd; const char* msg = 0; int error = 0; - DBUG_ENTER("init_relay_log_info"); - DBUG_ASSERT(!rli->no_storage); // Don't init if there is no storage + DBUG_ENTER("Relay_log_info::init"); - if (rli->inited) // Set if this function called + if (inited) // Set if this function called DBUG_RETURN(0); fn_format(fname, info_fname, mysql_data_home, "", 4+32); - mysql_mutex_lock(&rli->data_lock); - info_fd = rli->info_fd; - rli->cur_log_fd = -1; - rli->slave_skip_counter=0; - rli->abort_pos_wait=0; - rli->log_space_limit= relay_log_space_limit; - rli->log_space_total= 0; + mysql_mutex_lock(&data_lock); + cur_log_fd = -1; + slave_skip_counter=0; + abort_pos_wait=0; + log_space_limit= relay_log_space_limit; + log_space_total= 0; char pattern[FN_REFLEN]; (void) my_realpath(pattern, slave_load_tmpdir, 0); if (fn_format(pattern, PREFIX_SQL_LOAD, pattern, "", MY_SAFE_PATH | MY_RETURN_REAL_PATH) == NullS) { - mysql_mutex_unlock(&rli->data_lock); + mysql_mutex_unlock(&data_lock); sql_print_error("Unable to use slave's temporary directory %s", slave_load_tmpdir); DBUG_RETURN(1); } - unpack_filename(rli->slave_patternload_file, pattern); - rli->slave_patternload_file_size= strlen(rli->slave_patternload_file); + unpack_filename(slave_patternload_file, pattern); + slave_patternload_file_size= strlen(slave_patternload_file); /* The relay log will now be opened, as a SEQ_READ_APPEND IO_CACHE. @@ -163,7 +161,7 @@ int init_relay_log_info(Relay_log_info* rli, if (opt_relay_logname && opt_relay_logname[strlen(opt_relay_logname) - 1] == FN_LIBCHAR) { - mysql_mutex_unlock(&rli->data_lock); + mysql_mutex_unlock(&data_lock); sql_print_error("Path '%s' is a directory name, please specify \ a file name for --relay-log option", opt_relay_logname); DBUG_RETURN(1); @@ -175,7 +173,7 @@ a file name for --relay-log option", opt_relay_logname); opt_relaylog_index_name[strlen(opt_relaylog_index_name) - 1] == FN_LIBCHAR) { - mysql_mutex_unlock(&rli->data_lock); + mysql_mutex_unlock(&data_lock); sql_print_error("Path '%s' is a directory name, please specify \ a file name for --relay-log-index option", opt_relaylog_index_name); DBUG_RETURN(1); @@ -184,7 +182,7 @@ a file name for --relay-log-index option", opt_relaylog_index_name); char buf[FN_REFLEN]; const char *ln; static bool name_warning_sent= 0; - ln= rli->relay_log.generate_name(opt_relay_logname, "-relay-bin", + ln= relay_log.generate_name(opt_relay_logname, "-relay-bin", 1, buf); /* We send the warning only at startup, not after every RESET SLAVE */ if (!opt_relay_logname && !opt_relaylog_index_name && !name_warning_sent && @@ -207,7 +205,6 @@ a file name for --relay-log-index option", opt_relaylog_index_name); } /* For multimaster, add connection name to relay log filenames */ - Master_info* mi= rli->mi; char buf_relay_logname[FN_REFLEN], buf_relaylog_index_name_buff[FN_REFLEN]; char *buf_relaylog_index_name= opt_relaylog_index_name; @@ -229,12 +226,12 @@ a file name for --relay-log-index option", opt_relaylog_index_name); note, that if open() fails, we'll still have index file open but a destructor will take care of that */ - if (rli->relay_log.open_index_file(buf_relaylog_index_name, ln, TRUE) || - rli->relay_log.open(ln, LOG_BIN, 0, 0, SEQ_READ_APPEND, - mi->rli.max_relay_log_size, 1, TRUE)) + if (relay_log.open_index_file(buf_relaylog_index_name, ln, TRUE) || + relay_log.open(ln, LOG_BIN, 0, 0, SEQ_READ_APPEND, + max_relay_log_size, 1, TRUE)) { - mysql_mutex_unlock(&rli->data_lock); - sql_print_error("Failed when trying to open logs for '%s' in init_relay_log_info(). Error: %M", ln, my_errno); + mysql_mutex_unlock(&data_lock); + sql_print_error("Failed when trying to open logs for '%s' in Relay_log_info::init(). Error: %M", ln, my_errno); DBUG_RETURN(1); } } @@ -256,7 +253,7 @@ file '%s', errno %d)", fname, my_errno); msg= current_thd->get_stmt_da()->message(); goto err; } - if (init_io_cache(&rli->info_file, info_fd, IO_SIZE*2, READ_CACHE, 0L,0, + if (init_io_cache(&info_file, info_fd, IO_SIZE*2, READ_CACHE, 0L,0, MYF(MY_WME))) { sql_print_error("Failed to create a cache on relay log info file '%s'", @@ -266,20 +263,19 @@ file '%s', errno %d)", fname, my_errno); } /* Init relay log with first entry in the relay index file */ - if (init_relay_log_pos(rli,NullS,BIN_LOG_HEADER_SIZE,0 /* no data lock */, + if (init_relay_log_pos(this,NullS,BIN_LOG_HEADER_SIZE,0 /* no data lock */, &msg, 0)) { sql_print_error("Failed to open the relay log 'FIRST' (relay_log_pos 4)"); goto err; } - rli->group_master_log_name[0]= 0; - rli->group_master_log_pos= 0; - rli->info_fd= info_fd; + group_master_log_name[0]= 0; + group_master_log_pos= 0; } else // file exists { if (info_fd >= 0) - reinit_io_cache(&rli->info_file, READ_CACHE, 0L,0,0); + reinit_io_cache(&info_file, READ_CACHE, 0L,0,0); else { int error=0; @@ -291,7 +287,7 @@ Failed to open the existing relay log info file '%s' (errno %d)", fname, my_errno); error= 1; } - else if (init_io_cache(&rli->info_file, info_fd, + else if (init_io_cache(&info_file, info_fd, IO_SIZE*2, READ_CACHE, 0L, 0, MYF(MY_WME))) { sql_print_error("Failed to create a cache on relay log info file '%s'", @@ -302,24 +298,15 @@ Failed to open the existing relay log info file '%s' (errno %d)", { if (info_fd >= 0) mysql_file_close(info_fd, MYF(0)); - rli->info_fd= -1; - rli->relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT); - mysql_mutex_unlock(&rli->data_lock); + info_fd= -1; + relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT); + mysql_mutex_unlock(&data_lock); DBUG_RETURN(1); } } - rli->info_fd = info_fd; int relay_log_pos, master_log_pos, lines; char *first_non_digit; - /* - In MySQL 5.6, there is a MASTER_DELAY option to CHANGE MASTER. This is - not yet merged into MariaDB (as of 10.0.13). However, we detect the - presense of the new option in relay-log.info, as a placeholder for - possible later merge of the feature, and to maintain file format - compatibility with MySQL 5.6+. - */ - int dummy_sql_delay; /* Starting from MySQL 5.6.x, relay-log.info has a new format. @@ -344,25 +331,25 @@ Failed to open the existing relay log info file '%s' (errno %d)", it is line count and not binlog name (new format) it will be overwritten by the second row later. */ - if (init_strvar_from_file(rli->group_relay_log_name, - sizeof(rli->group_relay_log_name), - &rli->info_file, "")) + if (init_strvar_from_file(group_relay_log_name, + sizeof(group_relay_log_name), + &info_file, "")) { msg="Error reading slave log configuration"; goto err; } - lines= strtoul(rli->group_relay_log_name, &first_non_digit, 10); + lines= strtoul(group_relay_log_name, &first_non_digit, 10); - if (rli->group_relay_log_name[0] != '\0' && + if (group_relay_log_name[0] != '\0' && *first_non_digit == '\0' && lines >= LINES_IN_RELAY_LOG_INFO_WITH_DELAY) { DBUG_PRINT("info", ("relay_log_info file is in new format.")); /* Seems to be new format => read relay log name from next line */ - if (init_strvar_from_file(rli->group_relay_log_name, - sizeof(rli->group_relay_log_name), - &rli->info_file, "")) + if (init_strvar_from_file(group_relay_log_name, + sizeof(group_relay_log_name), + &info_file, "")) { msg="Error reading slave log configuration"; goto err; @@ -372,70 +359,70 @@ Failed to open the existing relay log info file '%s' (errno %d)", DBUG_PRINT("info", ("relay_log_info file is in old format.")); if (init_intvar_from_file(&relay_log_pos, - &rli->info_file, BIN_LOG_HEADER_SIZE) || - init_strvar_from_file(rli->group_master_log_name, - sizeof(rli->group_master_log_name), - &rli->info_file, "") || - init_intvar_from_file(&master_log_pos, &rli->info_file, 0) || + &info_file, BIN_LOG_HEADER_SIZE) || + init_strvar_from_file(group_master_log_name, + sizeof(group_master_log_name), + &info_file, "") || + init_intvar_from_file(&master_log_pos, &info_file, 0) || (lines >= LINES_IN_RELAY_LOG_INFO_WITH_DELAY && - init_intvar_from_file(&dummy_sql_delay, &rli->info_file, 0))) + init_intvar_from_file(&sql_delay, &info_file, 0))) { msg="Error reading slave log configuration"; goto err; } - strmake_buf(rli->event_relay_log_name,rli->group_relay_log_name); - rli->group_relay_log_pos= rli->event_relay_log_pos= relay_log_pos; - rli->group_master_log_pos= master_log_pos; + strmake_buf(event_relay_log_name,group_relay_log_name); + group_relay_log_pos= event_relay_log_pos= relay_log_pos; + group_master_log_pos= master_log_pos; - if (rli->is_relay_log_recovery && init_recovery(rli->mi, &msg)) + if (is_relay_log_recovery && init_recovery(mi, &msg)) goto err; - rli->relay_log_state.load(rpl_global_gtid_slave_state); - if (init_relay_log_pos(rli, - rli->group_relay_log_name, - rli->group_relay_log_pos, + relay_log_state.load(rpl_global_gtid_slave_state); + if (init_relay_log_pos(this, + group_relay_log_name, + group_relay_log_pos, 0 /* no data lock*/, &msg, 0)) { sql_print_error("Failed to open the relay log '%s' (relay_log_pos %llu)", - rli->group_relay_log_name, rli->group_relay_log_pos); + group_relay_log_name, group_relay_log_pos); goto err; } } - DBUG_PRINT("info", ("my_b_tell(rli->cur_log)=%llu rli->event_relay_log_pos=%llu", - my_b_tell(rli->cur_log), rli->event_relay_log_pos)); - DBUG_ASSERT(rli->event_relay_log_pos >= BIN_LOG_HEADER_SIZE); - DBUG_ASSERT(my_b_tell(rli->cur_log) == rli->event_relay_log_pos); + DBUG_PRINT("info", ("my_b_tell(cur_log)=%llu event_relay_log_pos=%llu", + my_b_tell(cur_log), event_relay_log_pos)); + DBUG_ASSERT(event_relay_log_pos >= BIN_LOG_HEADER_SIZE); + DBUG_ASSERT(my_b_tell(cur_log) == event_relay_log_pos); /* Now change the cache from READ to WRITE - must do this - before flush_relay_log_info + before Relay_log_info::flush() */ - reinit_io_cache(&rli->info_file, WRITE_CACHE,0L,0,1); - if ((error= flush_relay_log_info(rli))) + reinit_io_cache(&info_file, WRITE_CACHE,0L,0,1); + if ((error= flush())) { msg= "Failed to flush relay log info file"; goto err; } - if (count_relay_log_space(rli)) + if (count_relay_log_space(this)) { msg="Error counting relay log space"; goto err; } - rli->inited= 1; - mysql_mutex_unlock(&rli->data_lock); + inited= 1; + mysql_mutex_unlock(&data_lock); DBUG_RETURN(error); err: sql_print_error("%s", msg); - end_io_cache(&rli->info_file); + end_io_cache(&info_file); if (info_fd >= 0) mysql_file_close(info_fd, MYF(0)); - rli->info_fd= -1; - rli->relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT); - mysql_mutex_unlock(&rli->data_lock); + info_fd= -1; + relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT); + mysql_mutex_unlock(&data_lock); DBUG_RETURN(1); } @@ -752,6 +739,8 @@ err: if (!rli->relay_log.description_event_for_exec->is_valid() && !*errmsg) *errmsg= "Invalid Format_description log event; could be out of memory"; + DBUG_PRINT("info", ("Returning %d from init_relay_log_pos", (*errmsg)?1:0)); + DBUG_RETURN ((*errmsg) ? 1 : 0); } @@ -969,8 +958,11 @@ void Relay_log_info::inc_group_relay_log_pos(ulonglong log_pos, { DBUG_ENTER("Relay_log_info::inc_group_relay_log_pos"); - if (!skip_lock) + if (skip_lock) + mysql_mutex_assert_owner(&data_lock); + else mysql_mutex_lock(&data_lock); + rgi->inc_event_relay_log_pos(); DBUG_PRINT("info", ("log_pos: %lu group_master_log_pos: %lu", (long) log_pos, (long) group_master_log_pos)); @@ -1134,10 +1126,10 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset, Indeed, rli->inited==0 does not imply that they already are empty. It could be that slave's info initialization partly succeeded : for example if relay-log.info existed but *relay-bin*.* - have been manually removed, init_relay_log_info reads the old - relay-log.info and fills rli->master_log_*, then init_relay_log_info + have been manually removed, Relay_log_info::init() reads the old + relay-log.info and fills rli->master_log_*, then Relay_log_info::init() checks for the existence of the relay log, this fails and - init_relay_log_info leaves rli->inited to 0. + Relay_log_info::init() leaves rli->inited to 0. In that pathological case, rli->master_log_pos* will be properly reinited at the next START SLAVE (as RESET SLAVE or CHANGE MASTER, the callers of purge_relay_logs, will delete bogus *.info files @@ -1253,8 +1245,8 @@ bool Relay_log_info::is_until_satisfied(my_off_t master_beg_pos) if (until_condition == UNTIL_MASTER_POS) { - log_name= (mi->using_parallel() ? - future_event_master_log_name : group_master_log_name); + log_name= (mi->using_parallel() ? future_event_master_log_name + : group_master_log_name); log_pos= master_beg_pos; } else @@ -1325,6 +1317,7 @@ void Relay_log_info::stmt_done(my_off_t event_master_log_pos, THD *thd, { DBUG_ENTER("Relay_log_info::stmt_done"); + DBUG_ASSERT(!belongs_to_client()); DBUG_ASSERT(rgi->rli == this); /* If in a transaction, and if the slave supports transactions, just @@ -1374,7 +1367,7 @@ void Relay_log_info::stmt_done(my_off_t event_master_log_pos, THD *thd, } DBUG_EXECUTE_IF("inject_crash_before_flush_rli", DBUG_SUICIDE();); if (mi->using_gtid == Master_info::USE_GTID_NO) - flush_relay_log_info(this); + flush(); DBUG_EXECUTE_IF("inject_crash_after_flush_rli", DBUG_SUICIDE();); } DBUG_VOID_RETURN; @@ -1739,6 +1732,12 @@ delete_or_keep_event_post_apply(rpl_group_info *rgi, case DELETE_ROWS_EVENT: case UPDATE_ROWS_EVENT: case WRITE_ROWS_EVENT: + case WRITE_ROWS_COMPRESSED_EVENT: + case DELETE_ROWS_COMPRESSED_EVENT: + case UPDATE_ROWS_COMPRESSED_EVENT: + case WRITE_ROWS_COMPRESSED_EVENT_V1: + case UPDATE_ROWS_COMPRESSED_EVENT_V1: + case DELETE_ROWS_COMPRESSED_EVENT_V1: /* After the last Rows event has been applied, the saved Annotate_rows event (if any) is not needed anymore and can be deleted. @@ -2037,4 +2036,79 @@ bool rpl_sql_thread_info::cached_charset_compare(char *charset) const DBUG_RETURN(0); } + +/** + Store the file and position where the slave's SQL thread are in the + relay log. + + Notes: + + - This function should be called either from the slave SQL thread, + or when the slave thread is not running. (It reads the + group_{relay|master}_log_{pos|name} and delay fields in the rli + object. These may only be modified by the slave SQL thread or by + a client thread when the slave SQL thread is not running.) + + - If there is an active transaction, then we do not update the + position in the relay log. This is to ensure that we re-execute + statements if we die in the middle of an transaction that was + rolled back. + + - As a transaction never spans binary logs, we don't have to handle + the case where we do a relay-log-rotation in the middle of the + transaction. If transactions could span several binlogs, we would + have to ensure that we do not delete the relay log file where the + transaction started before switching to a new relay log file. + + - Error can happen if writing to file fails or if flushing the file + fails. + + @param rli The object representing the Relay_log_info. + + @todo Change the log file information to a binary format to avoid + calling longlong2str. + + @return 0 on success, 1 on error. +*/ +bool Relay_log_info::flush() +{ + bool error=0; + + DBUG_ENTER("Relay_log_info::flush()"); + + IO_CACHE *file = &info_file; + // 2*file name, 2*long long, 2*unsigned long, 6*'\n' + char buff[FN_REFLEN * 2 + 22 * 2 + 10 * 2 + 6], *pos; + my_b_seek(file, 0L); + pos= longlong10_to_str(LINES_IN_RELAY_LOG_INFO_WITH_DELAY, buff, 10); + *pos++='\n'; + pos=strmov(pos, group_relay_log_name); + *pos++='\n'; + pos=longlong10_to_str(group_relay_log_pos, pos, 10); + *pos++='\n'; + pos=strmov(pos, group_master_log_name); + *pos++='\n'; + pos=longlong10_to_str(group_master_log_pos, pos, 10); + *pos++='\n'; + pos= longlong10_to_str(sql_delay, pos, 10); + *pos++= '\n'; + if (my_b_write(file, (uchar*) buff, (size_t) (pos-buff))) + error=1; + if (flush_io_cache(file)) + error=1; + if (sync_relayloginfo_period && + !error && + ++sync_counter >= sync_relayloginfo_period) + { + if (my_sync(info_fd, MYF(MY_WME))) + error=1; + sync_counter= 0; + } + /* + Flushing the relay log is done by the slave I/O thread + or by the user on STOP SLAVE. + */ + DBUG_RETURN(error); +} + #endif diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h index c8673db7f73..5c637702d04 100644 --- a/sql/rpl_rli.h +++ b/sql/rpl_rli.h @@ -29,11 +29,6 @@ class Master_info; class Rpl_filter; -enum { - LINES_IN_RELAY_LOG_INFO_WITH_DELAY= 5 -}; - - /**************************************************************************** Replication SQL Thread @@ -47,7 +42,7 @@ enum { Relay_log_info is initialized from the slave.info file if such exists. Otherwise, data members are intialized with defaults. The - initialization is done with init_relay_log_info() call. + initialization is done with Relay_log_info::init() call. The format of slave.info file: @@ -78,11 +73,17 @@ public: }; /* - If flag set, then rli does not store its state in any info file. - This is the case only when we execute BINLOG SQL commands inside - a client, non-replication thread. + The SQL thread owns one Relay_log_info, and each client that has + executed a BINLOG statement owns one Relay_log_info. This function + returns zero for the Relay_log_info object that belongs to the SQL + thread and nonzero for Relay_log_info objects that belong to + clients. */ - bool no_storage; + inline bool belongs_to_client() + { + DBUG_ASSERT(sql_driver_thd); + return !sql_driver_thd->slave_thread; + } /* If true, events with the same server id should be replicated. This @@ -194,6 +195,11 @@ public: relay log and finishing (commiting) on another relay log. Case which can happen when, for example, the relay log gets rotated because of max_binlog_size. + + Note: group_relay_log_name, group_relay_log_pos must only be + written from the thread owning the Relay_log_info (SQL thread if + !belongs_to_client(); client thread executing BINLOG statement if + belongs_to_client()). */ char group_relay_log_name[FN_REFLEN]; ulonglong group_relay_log_pos; @@ -205,16 +211,17 @@ public: */ char future_event_master_log_name[FN_REFLEN]; -#ifdef HAVE_valgrind - bool is_fake; /* Mark that this is a fake relay log info structure */ -#endif - /* Original log name and position of the group we're currently executing (whose coordinates are group_relay_log_name/pos in the relay log) in the master's binlog. These concern the *group*, because in the master's binlog the log_pos that comes with each event is the position of the beginning of the group. + + Note: group_master_log_name, group_master_log_pos must only be + written from the thread owning the Relay_log_info (SQL thread if + !belongs_to_client(); client thread executing BINLOG statement if + belongs_to_client()). */ char group_master_log_name[FN_REFLEN]; volatile my_off_t group_master_log_pos; @@ -244,6 +251,15 @@ public: bool sql_thread_caught_up; void clear_until_condition(); + /** + Reset the delay. + This is used by RESET SLAVE to clear the delay. + */ + void clear_sql_delay() + { + sql_delay= 0; + } + /* Needed for problems when slave stops and we want to restart it @@ -475,8 +491,72 @@ public: m_flags&= ~flag; } + /** + Text used in THD::proc_info when the slave SQL thread is delaying. + */ + static const char *const state_delaying_string; + + bool flush(); + + /** + Reads the relay_log.info file. + */ + int init(const char* info_filename); + + /** + Indicate that a delay starts. + + This does not actually sleep; it only sets the state of this + Relay_log_info object to delaying so that the correct state can be + reported by SHOW SLAVE STATUS and SHOW PROCESSLIST. + + Requires rli->data_lock. + + @param delay_end The time when the delay shall end. + */ + void start_sql_delay(time_t delay_end) + { + mysql_mutex_assert_owner(&data_lock); + sql_delay_end= delay_end; + thd_proc_info(sql_driver_thd, state_delaying_string); + } + + int32 get_sql_delay() { return sql_delay; } + void set_sql_delay(time_t _sql_delay) { sql_delay= _sql_delay; } + time_t get_sql_delay_end() { return sql_delay_end; } + private: + + /** + Delay slave SQL thread by this amount, compared to master (in + seconds). This is set with CHANGE MASTER TO MASTER_DELAY=X. + + Guarded by data_lock. Initialized by the client thread executing + START SLAVE. Written by client threads executing CHANGE MASTER TO + MASTER_DELAY=X. Read by SQL thread and by client threads + executing SHOW SLAVE STATUS. Note: must not be written while the + slave SQL thread is running, since the SQL thread reads it without + a lock when executing Relay_log_info::flush(). + */ + int sql_delay; + + /** + During a delay, specifies the point in time when the delay ends. + + This is used for the SQL_Remaining_Delay column in SHOW SLAVE STATUS. + + Guarded by data_lock. Written by the sql thread. Read by client + threads executing SHOW SLAVE STATUS. + */ + time_t sql_delay_end; + + /* + Before the MASTER_DELAY parameter was added (WL#344), + relay_log.info had 4 lines. Now it has 5 lines. + */ + static const int LINES_IN_RELAY_LOG_INFO_WITH_DELAY= 5; + /* Holds the state of the data in the relay log. We need this to ensure that we are not in the middle of a @@ -875,10 +955,6 @@ public: }; -// Defined in rpl_rli.cc -int init_relay_log_info(Relay_log_info* rli, const char* info_fname); - - extern struct rpl_slave_state *rpl_global_gtid_slave_state; extern gtid_waiting rpl_global_gtid_waiting; diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index d42611bfebe..03fba3fde49 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -6781,7 +6781,7 @@ ER_FK_COLUMN_NOT_NULL ger "Spalte '%-.192s' kann nicht NOT NULL sein: wird für eine Fremdschlüsselbeschränkung '%-.192s' SET NULL benötigt" ER_DUP_INDEX - eng "Duplicate index '%-.64s' defined on the table '%-.64s.%-.64s'. This is deprecated and will be disallowed in a future release" + eng "Duplicate index %`s. This is deprecated and will be disallowed in a future release" ER_FK_COLUMN_CANNOT_CHANGE eng "Cannot change column '%-.192s': used in a foreign key constraint '%-.192s'" @@ -6965,28 +6965,28 @@ ER_LAST_MYSQL_ERROR_MESSAGE # MariaDB error numbers starts from 1900 start-error-number 1900 -ER_VCOL_BASED_ON_VCOL - eng "A computed column cannot be based on a computed column" -ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +ER_UNUSED_18 + eng "" +ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED eng "Function or expression '%s' cannot be used in the %s clause of %`s" -ER_DATA_CONVERSION_ERROR_FOR_VIRTUAL_COLUMN - eng "Generated value for computed column '%s' cannot be converted to type '%s'" -ER_PRIMARY_KEY_BASED_ON_VIRTUAL_COLUMN - eng "Primary key cannot be defined upon a computed column" +ER_UNUSED_19 + eng "" +ER_PRIMARY_KEY_BASED_ON_GENERATED_COLUMN + eng "Primary key cannot be defined upon a generated column" ER_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN - eng "Key/Index cannot be defined on a non-stored computed column" -ER_WRONG_FK_OPTION_FOR_VIRTUAL_COLUMN - eng "Cannot define foreign key with %s clause on a computed column" -ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN - eng "The value specified for computed column '%s' in table '%s' ignored" -ER_UNSUPPORTED_ACTION_ON_VIRTUAL_COLUMN - eng "This is not yet supported for computed columns" -ER_CONST_EXPR_IN_VCOL - eng "Constant expression in computed column function is not allowed" -ER_ROW_EXPR_FOR_VCOL - eng "Expression for computed column cannot return a row" -ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS - eng "%s storage engine does not support computed columns" + eng "Key/Index cannot be defined on a virtual generated column" +ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN + eng "Cannot define foreign key with %s clause on a generated column" +ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN + eng "The value specified for generated column '%s' in table '%s' ignored" +ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN + eng "This is not yet supported for generated columns" +ER_UNUSED_20 + eng "" +ER_UNUSED_21 + eng "" +ER_UNSUPPORTED_ENGINE_FOR_GENERATED_COLUMNS + eng "%s storage engine does not support generated columns" ER_UNKNOWN_OPTION eng "Unknown option '%-.64s'" ER_BAD_OPTION_VALUE @@ -7151,12 +7151,187 @@ skip-to-error-number 2000 # MySQL 5.7 error numbers starts here skip-to-error-number 3000 -ER_MYSQL_57_TEST - eng "5.7 test" -ER_WRONG_TABLESPACE_NAME 42000 - eng "Incorrect tablespace name %`-.192s" +ER_ERROR_ON_MASTER + eng "Query partially completed on the master (error on master: %d) and was aborted. There is a chance that your master is inconsistent at this point. If you are sure that your master is ok, run this query manually on the slave and then restart the slave with SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE;. Query:'%s'" + +ER_INCONSISTENT_ERROR + eng "Query caused different errors on master and slave. Error on master: message (format)='%s' error code=%d; Error on slave:actual message='%s', error code=%d. Default database:'%s'. Query:'%s'" + +ER_STORAGE_ENGINE_NOT_LOADED + eng "Storage engine for table '%s'.'%s' is not loaded." + +ER_GET_STACKED_DA_WITHOUT_ACTIVE_HANDLER 0Z002 + eng "GET STACKED DIAGNOSTICS when handler not active" + +ER_WARN_LEGACY_SYNTAX_CONVERTED + eng "%s is no longer supported. The statement was converted to %s." + +ER_BINLOG_UNSAFE_FULLTEXT_PLUGIN + eng "Statement is unsafe because it uses a fulltext parser plugin which may not return the same value on the slave." + ER_CANNOT_DISCARD_TEMPORARY_TABLE - eng "Cannot DISCARD/IMPORT tablespace associated with temporary table" + eng "Cannot DISCARD/IMPORT tablespace associated with temporary table" + +ER_FK_DEPTH_EXCEEDED + eng "Foreign key cascade delete/update exceeds max depth of %d." + +ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE_V2 + eng "Column count of %s.%s is wrong. Expected %d, found %d. Created with MySQL %d, now running %d. Please use mysql_upgrade to fix this error." + ger "Spaltenanzahl von %s.%s falsch. %d erwartet, aber %d erhalten. Erzeugt mit MySQL %d, jetzt unter %d. Bitte benutzen Sie mysql_upgrade, um den Fehler zu beheben" + +ER_WARN_TRIGGER_DOESNT_HAVE_CREATED + eng "Trigger %s.%s.%s does not have CREATED attribute." + +ER_REFERENCED_TRG_DOES_NOT_EXIST_MYSQL + eng "Referenced trigger '%s' for the given action time and event type does not exist." + +ER_EXPLAIN_NOT_SUPPORTED + eng "EXPLAIN FOR CONNECTION command is supported only for SELECT/UPDATE/INSERT/DELETE/REPLACE" +ER_INVALID_FIELD_SIZE + eng "Invalid size for column '%-.192s'." + +ER_MISSING_HA_CREATE_OPTION + eng "Table storage engine '%-.64s' found required create option missing" + +ER_ENGINE_OUT_OF_MEMORY + eng "Out of memory in storage engine '%-.64s'." + +ER_PASSWORD_EXPIRE_ANONYMOUS_USER + eng "The password for anonymous user cannot be expired." + +ER_SLAVE_SQL_THREAD_MUST_STOP + eng "This operation cannot be performed with a running slave sql thread; run STOP SLAVE SQL_THREAD first" + +ER_NO_FT_MATERIALIZED_SUBQUERY + eng "Cannot create FULLTEXT index on materialized subquery" + +ER_INNODB_UNDO_LOG_FULL + eng "Undo Log error: %s" + +ER_INVALID_ARGUMENT_FOR_LOGARITHM 2201E + eng "Invalid argument for logarithm" + +ER_SLAVE_CHANNEL_IO_THREAD_MUST_STOP + eng "This operation cannot be performed with a running slave io thread; run STOP SLAVE IO_THREAD FOR CHANNEL '%s' first." + +ER_WARN_OPEN_TEMP_TABLES_MUST_BE_ZERO + eng "This operation may not be safe when the slave has temporary tables. The tables will be kept open until the server restarts or until the tables are deleted by any replicated DROP statement. Suggest to wait until slave_open_temp_tables = 0." + +ER_WARN_ONLY_MASTER_LOG_FILE_NO_POS + eng "CHANGE MASTER TO with a MASTER_LOG_FILE clause but no MASTER_LOG_POS clause may not be safe. The old position value may not be valid for the new binary log file." + +ER_QUERY_TIMEOUT + eng "Query execution was interrupted, maximum statement execution time exceeded" + +ER_NON_RO_SELECT_DISABLE_TIMER + eng "Select is not a read only statement, disabling timer" + +ER_DUP_LIST_ENTRY + eng "Duplicate entry '%-.192s'." + +ER_SQL_MODE_NO_EFFECT + eng "'%s' mode no longer has any effect. Use STRICT_ALL_TABLES or STRICT_TRANS_TABLES instead." + +ER_AGGREGATE_ORDER_FOR_UNION + eng "Expression #%u of ORDER BY contains aggregate function and applies to a UNION" + +ER_AGGREGATE_ORDER_NON_AGG_QUERY + eng "Expression #%u of ORDER BY contains aggregate function and applies to the result of a non-aggregated query" + +ER_SLAVE_WORKER_STOPPED_PREVIOUS_THD_ERROR + eng "Slave worker has stopped after at least one previous worker encountered an error when slave-preserve-commit-order was enabled. To preserve commit order, the last transaction executed by this thread has not been committed. When restarting the slave after fixing any failed threads, you should fix this worker as well." + +ER_DONT_SUPPORT_SLAVE_PRESERVE_COMMIT_ORDER + eng "slave_preserve_commit_order is not supported %s." + +ER_SERVER_OFFLINE_MODE + eng "The server is currently in offline mode" + +ER_GIS_DIFFERENT_SRIDS + eng "Binary geometry function %s given two geometries of different srids: %u and %u, which should have been identical." + +ER_GIS_UNSUPPORTED_ARGUMENT + eng "Calling geometry function %s with unsupported types of arguments." + +ER_GIS_UNKNOWN_ERROR + eng "Unknown GIS error occured in function %s." + +ER_GIS_UNKNOWN_EXCEPTION + eng "Unknown exception caught in GIS function %s." + +ER_GIS_INVALID_DATA 22023 + eng "Invalid GIS data provided to function %s." + +ER_BOOST_GEOMETRY_EMPTY_INPUT_EXCEPTION + eng "The geometry has no data in function %s." + +ER_BOOST_GEOMETRY_CENTROID_EXCEPTION + eng "Unable to calculate centroid because geometry is empty in function %s." + +ER_BOOST_GEOMETRY_OVERLAY_INVALID_INPUT_EXCEPTION + eng "Geometry overlay calculation error: geometry data is invalid in function %s." + +ER_BOOST_GEOMETRY_TURN_INFO_EXCEPTION + eng "Geometry turn info calculation error: geometry data is invalid in function %s." + +ER_BOOST_GEOMETRY_SELF_INTERSECTION_POINT_EXCEPTION + eng "Analysis procedures of intersection points interrupted unexpectedly in function %s." + +ER_BOOST_GEOMETRY_UNKNOWN_EXCEPTION + eng "Unknown exception thrown in function %s." + +ER_STD_BAD_ALLOC_ERROR + eng "Memory allocation error: %-.256s in function %s." + +ER_STD_DOMAIN_ERROR + eng "Domain error: %-.256s in function %s." + +ER_STD_LENGTH_ERROR + eng "Length error: %-.256s in function %s." + +ER_STD_INVALID_ARGUMENT + eng "Invalid argument error: %-.256s in function %s." + +ER_STD_OUT_OF_RANGE_ERROR + eng "Out of range error: %-.256s in function %s." + +ER_STD_OVERFLOW_ERROR + eng "Overflow error error: %-.256s in function %s." + +ER_STD_RANGE_ERROR + eng "Range error: %-.256s in function %s." + +ER_STD_UNDERFLOW_ERROR + eng "Underflow error: %-.256s in function %s." + +ER_STD_LOGIC_ERROR + eng "Logic error: %-.256s in function %s." + +ER_STD_RUNTIME_ERROR + eng "Runtime error: %-.256s in function %s." + +ER_STD_UNKNOWN_EXCEPTION + eng "Unknown exception: %-.384s in function %s." + +ER_GIS_DATA_WRONG_ENDIANESS + eng "Geometry byte string must be little endian." + +ER_CHANGE_MASTER_PASSWORD_LENGTH + eng "The password provided for the replication user exceeds the maximum length of 32 characters" + +ER_USER_LOCK_WRONG_NAME 42000 + eng "Incorrect user-level lock name '%-.192s'." + +# Should be different from ER_LOCK_DEADLOCK since it doesn't cause implicit +# rollback. Should not be mapped to SQLSTATE 40001 for the same reason. +ER_USER_LOCK_DEADLOCK + eng "Deadlock found when trying to get user-level lock; try rolling back transaction/releasing locks and restarting lock acquisition." + +ER_REPLACE_INACCESSIBLE_ROWS + eng "REPLACE cannot be executed as it requires deleting rows that are not in the view" + +ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS + eng "Do not support online operation on table with GIS index" # MariaDB extra error numbers starts from 4000 skip-to-error-number 4000 @@ -7220,9 +7395,9 @@ ER_CONSTRAINT_FAILED 23000 rus "проверка CONSTRAINT %`s Ð´Ð»Ñ %`-.192s.%`-.192s провалилаÑÑŒ" ukr "Перевірка CONSTRAINT %`s Ð´Ð»Ñ %`-.192s.%`-.192s не пройшла" ER_EXPRESSION_IS_TOO_BIG - eng "%s expression in the %s clause is too big" + eng "Expression in the %s clause is too big" ER_ERROR_EVALUATING_EXPRESSION - eng "Got an error evaluating stored expression %`s" + eng "Got an error evaluating stored expression %s" ER_CALCULATING_DEFAULT_VALUE eng "Got an error when calculating default value for %`s" ER_EXPRESSION_REFERS_TO_UNINIT_FIELD 01000 @@ -7232,3 +7407,34 @@ ER_PARTITION_DEFAULT_ERROR ukr "ПрипуÑтимо мати тільки один DEFAULT розділ" ER_REFERENCED_TRG_DOES_NOT_EXIST eng "Referenced trigger '%s' for the given action time and event type does not exist" +ER_INVALID_DEFAULT_PARAM + eng "Default/ignore value is not supported for such parameter usage" + ukr "Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð·Ð° замовчуваннÑм або ігнороване Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð½Ðµ підтримано Ð´Ð»Ñ Ñ†ÑŒÐ¾Ð³Ð¾ випадку викориÑÑ‚Ð°Ð½Ð½Ñ Ð¿Ð°Ñ€Ð°ÑŒÐµÑ‚Ñ€Ð°" +ER_BINLOG_NON_SUPPORTED_BULK + eng "Only row based replication supported for bulk operations" +ER_BINLOG_UNCOMPRESS_ERROR + eng "Uncompress the compressed binlog failed" +ER_JSON_BAD_CHR + eng "Broken JSON string in argument %d to function '%s' at position %d" +ER_JSON_NOT_JSON_CHR + eng "Character disallowd in JSON in argument %d to function '%s' at position %d" +ER_JSON_EOS + eng "Unexpected end of JSON text in argument %d to function '%s'" +ER_JSON_SYNTAX + eng "Syntax error in JSON text in argument %d to function '%s' at position %d" +ER_JSON_ESCAPING + eng "Incorrect escaping in JSON text in argument %d to function '%s' at position %d" +ER_JSON_DEPTH + eng "Limit of %d on JSON nested strucures depth is reached in argument %d to function '%s' at position %d" +ER_JSON_PATH_EOS + eng "Unexpected end of JSON path in argument %d to function '%s'" +ER_JSON_PATH_SYNTAX + eng "Syntax error in JSON path in argument %d to function '%s' at position %d" +ER_JSON_PATH_DEPTH + eng "Limit of %d on JSON path depth is reached in argument %d to function '%s' at position %d" +ER_JSON_PATH_NO_WILDCARD + eng "Wildcards in JSON path not allowed in argument %d to function '%s'" +ER_JSON_PATH_ARRAY + eng "JSON path should end with an array identifier in argument %d to function '%s'" +ER_JSON_ONE_OR_ALL + eng "Argument 2 to function '%s' must be "one" or "all"." diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index f9478134ab4..ad7fb873c68 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -64,18 +64,18 @@ extern "C" sig_handler handle_fatal_signal(int sig) struct tm tm; #ifdef HAVE_STACKTRACE THD *thd; -#endif /* This flag remembers if the query pointer was found invalid. We will try and print the query at the end of the signal handler, in case we're wrong. */ bool print_invalid_query_pointer= false; +#endif if (segfaulted) { my_safe_printf_stderr("Fatal " SIGNAL_FMT " while backtracing\n", sig); - _exit(1); /* Quit without running destructors */ + goto end; } segfaulted = 1; @@ -276,6 +276,7 @@ extern "C" sig_handler handle_fatal_signal(int sig) "\"mlockall\" bugs.\n"); } +#ifdef HAVE_STACKTRACE if (print_invalid_query_pointer) { my_safe_printf_stderr( @@ -285,6 +286,7 @@ extern "C" sig_handler handle_fatal_signal(int sig) my_write_stderr(thd->query(), MY_MIN(65536U, thd->query_length())); my_safe_printf_stderr("\n\n"); } +#endif #ifdef HAVE_WRITE_CORE if (test_flags & TEST_CORE_ON_SIGNAL) @@ -299,9 +301,11 @@ end: #ifndef __WIN__ /* Quit, without running destructors (etc.) + Use a signal, because the parent (systemd) can check that with WIFSIGNALED On Windows, do not terminate, but pass control to exception filter. */ - _exit(1); // Using _exit(), since exit() is not async signal safe + signal(sig, SIG_DFL); + kill(getpid(), sig); #else return; #endif diff --git a/sql/slave.cc b/sql/slave.cc index 08cbf9acb6a..05e967c4edb 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -77,6 +77,7 @@ Master_info *active_mi= 0; Master_info_index *master_info_index; my_bool replicate_same_server_id; ulonglong relay_log_space_limit = 0; +ulonglong opt_read_binlog_speed_limit = 0; const char *relay_log_index= 0; const char *relay_log_basename= 0; @@ -735,7 +736,7 @@ int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock) DBUG_PRINT("info",("Flushing relay-log info file.")); if (current_thd) THD_STAGE_INFO(current_thd, stage_flushing_relay_log_info_file); - if (flush_relay_log_info(&mi->rli)) + if (mi->rli.flush()) DBUG_RETURN(ER_ERROR_DURING_FLUSH_LOGS); if (my_sync(mi->rli.info_fd, MYF(MY_WME))) @@ -1631,8 +1632,10 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi) (master_res= mysql_store_result(mysql)) && (master_row= mysql_fetch_row(master_res))) { + mysql_mutex_lock(&mi->data_lock); mi->clock_diff_with_master= (long) (time((time_t*) 0) - strtoul(master_row[0], 0, 10)); + mysql_mutex_unlock(&mi->data_lock); } else if (check_io_slave_killed(mi, NULL)) goto slave_killed_err; @@ -1644,7 +1647,9 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi) } else { + mysql_mutex_lock(&mi->data_lock); mi->clock_diff_with_master= 0; /* The "most sensible" value */ + mysql_mutex_unlock(&mi->data_lock); sql_print_warning("\"SELECT UNIX_TIMESTAMP()\" failed on master, " "do not trust column Seconds_Behind_Master of SHOW " "SLAVE STATUS. Error: %s (%d)", @@ -2794,6 +2799,15 @@ void show_master_info_get_fields(THD *thd, List *field_list, Item_empty_string(thd, "Parallel_Mode", sizeof("conservative")-1), mem_root); + field_list->push_back(new (mem_root) + Item_return_int(thd, "SQL_Delay", 10, + MYSQL_TYPE_LONG)); + field_list->push_back(new (mem_root) + Item_return_int(thd, "SQL_Remaining_Delay", 8, + MYSQL_TYPE_LONG)); + field_list->push_back(new (mem_root) + Item_empty_string(thd, "Slave_SQL_Running_State", + 20)); if (full) { field_list->push_back(new (mem_root) @@ -2983,6 +2997,7 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full, prot_store_ids(thd, &mi->ignore_server_ids); // Master_Server_id protocol->store((uint32) mi->master_id); + // SQL_Delay // Master_Ssl_Crl protocol->store(mi->ssl_ca, &my_charset_bin); // Master_Ssl_Crlpath @@ -3005,6 +3020,22 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full, protocol->store(mode_name, strlen(mode_name), &my_charset_bin); } + protocol->store((uint32) mi->rli.get_sql_delay()); + // SQL_Remaining_Delay + // THD::proc_info is not protected by any lock, so we read it once + // to ensure that we use the same value throughout this function. + const char *slave_sql_running_state= + mi->rli.sql_driver_thd ? mi->rli.sql_driver_thd->proc_info : ""; + if (slave_sql_running_state == Relay_log_info::state_delaying_string) + { + time_t t= my_time(0), sql_delay_end= mi->rli.get_sql_delay_end(); + protocol->store((uint32)(t < sql_delay_end ? sql_delay_end - t : 0)); + } + else + protocol->store_null(); + // Slave_SQL_Running_State + protocol->store(slave_sql_running_state, &my_charset_bin); + if (full) { protocol->store((uint32) mi->rli.retried_trans); @@ -3277,13 +3308,15 @@ static int request_dump(THD *thd, MYSQL* mysql, Master_info* mi, try a reconnect. We do not want to print anything to the error log in this case because this a anormal event in an idle server. + network_read_len get the real network read length in VIO, especially using compressed protocol RETURN VALUES 'packet_error' Error number Length of packet */ -static ulong read_event(MYSQL* mysql, Master_info *mi, bool* suppress_warnings) +static ulong read_event(MYSQL* mysql, Master_info *mi, bool* suppress_warnings, + ulong* network_read_len) { ulong len; DBUG_ENTER("read_event"); @@ -3298,7 +3331,7 @@ static ulong read_event(MYSQL* mysql, Master_info *mi, bool* suppress_warnings) DBUG_RETURN(packet_error); #endif - len = cli_safe_read(mysql); + len = cli_safe_read_reallen(mysql, network_read_len); if (len == packet_error || (long) len < 1) { if (mysql_errno(mysql) == ER_NET_READ_INTERRUPTED) @@ -3311,8 +3344,13 @@ static ulong read_event(MYSQL* mysql, Master_info *mi, bool* suppress_warnings) *suppress_warnings= TRUE; } else - sql_print_error("Error reading packet from server: %s ( server_errno=%d)", - mysql_error(mysql), mysql_errno(mysql)); + { + if (!mi->rli.abort_slave) + { + sql_print_error("Error reading packet from server: %s (server_errno=%d)", + mysql_error(mysql), mysql_errno(mysql)); + } + } DBUG_RETURN(packet_error); } @@ -3369,38 +3407,83 @@ has_temporary_error(THD *thd) /** - Applies the given event and advances the relay log position. + If this is a lagging slave (specified with CHANGE MASTER TO MASTER_DELAY = X), delays accordingly. Also unlocks rli->data_lock. - In essence, this function does: + Design note: this is the place to unlock rli->data_lock. The lock + must be held when reading delay info from rli, but it should not be + held while sleeping. - @code - ev->apply_event(rli); - ev->update_pos(rli); - @endcode + @param ev Event that is about to be executed. - But it also does some maintainance, such as skipping events if - needed and reporting errors. + @param thd The sql thread's THD object. - If the @c skip flag is set, then it is tested whether the event - should be skipped, by looking at the slave_skip_counter and the - server id. The skip flag should be set when calling this from a - replication thread but not set when executing an explicit BINLOG - statement. + @param rli The sql thread's Relay_log_info structure. - @retval 0 OK. + @retval 0 If the delay timed out and the event shall be executed. - @retval 1 Error calling ev->apply_event(). - - @retval 2 No error calling ev->apply_event(), but error calling - ev->update_pos(). + @retval nonzero If the delay was interrupted and the event shall be skipped. */ -int apply_event_and_update_pos(Log_event* ev, THD* thd, - rpl_group_info *rgi, - rpl_parallel_thread *rpt) +int +sql_delay_event(Log_event *ev, THD *thd, rpl_group_info *rgi) { - int exec_res= 0; Relay_log_info* rli= rgi->rli; - DBUG_ENTER("apply_event_and_update_pos"); + long sql_delay= rli->get_sql_delay(); + + DBUG_ENTER("sql_delay_event"); + mysql_mutex_assert_owner(&rli->data_lock); + DBUG_ASSERT(!rli->belongs_to_client()); + + int type= ev->get_type_code(); + if (sql_delay && type != ROTATE_EVENT && + type != FORMAT_DESCRIPTION_EVENT && type != START_EVENT_V3) + { + // The time when we should execute the event. + time_t sql_delay_end= + ev->when + rli->mi->clock_diff_with_master + sql_delay; + // The current time. + time_t now= my_time(0); + // The time we will have to sleep before executing the event. + unsigned long nap_time= 0; + if (sql_delay_end > now) + nap_time= sql_delay_end - now; + + DBUG_PRINT("info", ("sql_delay= %lu " + "ev->when= %lu " + "rli->mi->clock_diff_with_master= %lu " + "now= %ld " + "sql_delay_end= %lu " + "nap_time= %ld", + sql_delay, (long)ev->when, + rli->mi->clock_diff_with_master, + (long)now, sql_delay_end, (long)nap_time)); + + if (sql_delay_end > now) + { + DBUG_PRINT("info", ("delaying replication event %lu secs", + nap_time)); + rli->start_sql_delay(sql_delay_end); + mysql_mutex_unlock(&rli->data_lock); + DBUG_RETURN(slave_sleep(thd, nap_time, sql_slave_killed, rgi)); + } + } + + mysql_mutex_unlock(&rli->data_lock); + + DBUG_RETURN(0); +} + + +/* + First half of apply_event_and_update_pos(), see below. + Setup some THD variables for applying the event. + + Split out so that it can run with rli->data_lock held in non-parallel + replication, but without the mutex held in the parallel case. +*/ +static int +apply_event_and_update_pos_setup(Log_event* ev, THD* thd, rpl_group_info *rgi) +{ + DBUG_ENTER("apply_event_and_update_pos_setup"); DBUG_PRINT("exec_event",("%s(type_code: %d; server_id: %d)", ev->get_type_str(), ev->get_type_code(), @@ -3450,13 +3533,23 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd, (ev->flags & LOG_EVENT_SKIP_REPLICATION_F ? OPTION_SKIP_REPLICATION : 0); ev->thd = thd; // because up to this point, ev->thd == 0 - int reason= ev->shall_skip(rgi); - if (reason == Log_event::EVENT_SKIP_COUNT) - { - DBUG_ASSERT(rli->slave_skip_counter > 0); - rli->slave_skip_counter--; - } - mysql_mutex_unlock(&rli->data_lock); + DBUG_RETURN(ev->shall_skip(rgi)); +} + + +/* + Second half of apply_event_and_update_pos(), see below. + + Do the actual event apply (or skip), and position update. + */ +static int +apply_event_and_update_pos_apply(Log_event* ev, THD* thd, rpl_group_info *rgi, + int reason) +{ + int exec_res= 0; + Relay_log_info* rli= rgi->rli; + + DBUG_ENTER("apply_event_and_update_pos_apply"); DBUG_EXECUTE_IF("inject_slave_sql_before_apply_event", { DBUG_ASSERT(!debug_sync_set_action @@ -3503,16 +3596,16 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd, if (exec_res == 0) { int error= ev->update_pos(rgi); -#ifdef HAVE_valgrind - if (!rli->is_fake) -#endif + #ifndef DBUG_OFF + DBUG_PRINT("info", ("update_pos error = %d", error)); + if (!rli->belongs_to_client()) { - DBUG_PRINT("info", ("update_pos error = %d", error)); DBUG_PRINT("info", ("group %llu %s", rli->group_relay_log_pos, rli->group_relay_log_name)); DBUG_PRINT("info", ("event %llu %s", rli->event_relay_log_pos, rli->event_relay_log_name)); } +#endif /* The update should not fail, so print an error message and return an error code. @@ -3544,6 +3637,103 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd, } +/** + Applies the given event and advances the relay log position. + + This is needed by the sql thread to execute events from the binlog, + and by clients executing BINLOG statements. Conceptually, this + function does: + + @code + ev->apply_event(rli); + ev->update_pos(rli); + @endcode + + It also does the following maintainance: + + - Initializes the thread's server_id and time; and the event's + thread. + + - If !rli->belongs_to_client() (i.e., if it belongs to the slave + sql thread instead of being used for executing BINLOG + statements), it does the following things: (1) skips events if it + is needed according to the server id or slave_skip_counter; (2) + unlocks rli->data_lock; (3) sleeps if required by 'CHANGE MASTER + TO MASTER_DELAY=X'; (4) maintains the running state of the sql + thread (rli->thread_state). + + - Reports errors as needed. + + @param ev The event to apply. + + @param thd The client thread that executes the event (i.e., the + slave sql thread if called from a replication slave, or the client + thread if called to execute a BINLOG statement). + + @param rli The relay log info (i.e., the slave's rli if called from + a replication slave, or the client's thd->rli_fake if called to + execute a BINLOG statement). + + @retval 0 OK. + + @retval 1 Error calling ev->apply_event(). + + @retval 2 No error calling ev->apply_event(), but error calling + ev->update_pos(). + + This function is only used in non-parallel replication, where it is called + with rli->data_lock held; this lock is released during this function. +*/ +int +apply_event_and_update_pos(Log_event* ev, THD* thd, rpl_group_info *rgi) +{ + Relay_log_info* rli= rgi->rli; + mysql_mutex_assert_owner(&rli->data_lock); + int reason= apply_event_and_update_pos_setup(ev, thd, rgi); + if (reason == Log_event::EVENT_SKIP_COUNT) + { + DBUG_ASSERT(rli->slave_skip_counter > 0); + rli->slave_skip_counter--; + } + + if (reason == Log_event::EVENT_SKIP_NOT) + { + // Sleeps if needed, and unlocks rli->data_lock. + if (sql_delay_event(ev, thd, rgi)) + return 0; + } + else + mysql_mutex_unlock(&rli->data_lock); + + return apply_event_and_update_pos_apply(ev, thd, rgi, reason); +} + + +/* + The version of above apply_event_and_update_pos() used in parallel + replication. Unlike the non-parallel case, this function is called without + rli->data_lock held. +*/ +int +apply_event_and_update_pos_for_parallel(Log_event* ev, THD* thd, + rpl_group_info *rgi) +{ + Relay_log_info* rli= rgi->rli; + mysql_mutex_assert_not_owner(&rli->data_lock); + int reason= apply_event_and_update_pos_setup(ev, thd, rgi); + /* + In parallel replication, sql_slave_skip_counter is handled in the SQL + driver thread, so 23 should never see EVENT_SKIP_COUNT here. + */ + DBUG_ASSERT(reason != Log_event::EVENT_SKIP_COUNT); + /* + Calling sql_delay_event() was handled in the SQL driver thread when + doing parallel replication. + */ + return apply_event_and_update_pos_apply(ev, thd, rgi, reason); +} + + /** Keep the relay log transaction state up to date. @@ -3587,7 +3777,7 @@ inline void update_state_of_relay_log(Relay_log_info *rli, Log_event *ev) } /* Check for an event that starts or stops a transaction */ - if (typ == QUERY_EVENT) + if (LOG_EVENT_IS_QUERY(typ)) { Query_log_event *qev= (Query_log_event*) ev; /* @@ -3619,7 +3809,8 @@ inline void update_state_of_relay_log(Relay_log_info *rli, Log_event *ev) /** - Top-level function for executing the next event from the relay log. + Top-level function for executing the next event in the relay log. + This is called from the SQL thread. This function reads the event from the relay log, executes it, and advances the relay log position. It also handles errors, etc. @@ -3726,7 +3917,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli, */ DBUG_EXECUTE_IF("incomplete_group_in_relay_log", if ((typ == XID_EVENT) || - ((typ == QUERY_EVENT) && + (LOG_EVENT_IS_QUERY(typ) && strcmp("COMMIT", ((Query_log_event *) ev)->query) == 0)) { DBUG_ASSERT(thd->transaction.all.modified_non_trans_table); @@ -3743,6 +3934,13 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli, if (rli->mi->using_parallel()) { int res= rli->parallel.do_event(serial_rgi, ev, event_size); + /* + In parallel replication, we need to update the relay log position + immediately so that it will be the correct position from which to + read the next event. + */ + if (res == 0) + rli->event_relay_log_pos= rli->future_event_relay_log_pos; if (res >= 0) DBUG_RETURN(res); /* @@ -3794,7 +3992,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli, serial_rgi->future_event_relay_log_pos= rli->future_event_relay_log_pos; serial_rgi->event_relay_log_name= rli->event_relay_log_name; serial_rgi->event_relay_log_pos= rli->event_relay_log_pos; - exec_res= apply_event_and_update_pos(ev, thd, serial_rgi, NULL); + exec_res= apply_event_and_update_pos(ev, thd, serial_rgi); #ifdef WITH_WSREP WSREP_DEBUG("apply_event_and_update_pos() result: %d", exec_res); @@ -4164,8 +4362,10 @@ connected: };); #endif - // TODO: the assignment below should be under mutex (5.0) + mysql_mutex_lock(&mi->run_lock); mi->slave_running= MYSQL_SLAVE_RUN_CONNECT; + mysql_mutex_unlock(&mi->run_lock); + thd->slave_net = &mysql->net; THD_STAGE_INFO(thd, stage_checking_master_version); ret= get_master_version_and_clock(mysql, mi); @@ -4230,9 +4430,11 @@ connected: mi->slave_running= MYSQL_SLAVE_RUN_READING; DBUG_ASSERT(mi->last_error().number == 0); + ulonglong lastchecktime = my_hrtime().val; + ulonglong tokenamount = opt_read_binlog_speed_limit*1024; while (!io_slave_killed(mi)) { - ulong event_len; + ulong event_len, network_read_len = 0; /* We say "waiting" because read_event() will wait if there's nothing to read. But if there's something to read, it will not wait. The @@ -4240,7 +4442,7 @@ connected: we're in fact receiving nothing. */ THD_STAGE_INFO(thd, stage_waiting_for_master_to_send_event); - event_len= read_event(mysql, mi, &suppress_warnings); + event_len= read_event(mysql, mi, &suppress_warnings, &network_read_len); if (check_io_slave_killed(mi, NullS)) goto err; @@ -4288,6 +4490,47 @@ Stopping slave I/O thread due to out-of-memory error from master"); goto err; } + /* Control the binlog read speed of master + when read_binlog_speed_limit is non-zero + */ + ulonglong speed_limit_in_bytes = opt_read_binlog_speed_limit * 1024; + if (speed_limit_in_bytes) + { + /* Prevent the tokenamount become a large value, + for example, the IO thread doesn't work for a long time + */ + if (tokenamount > speed_limit_in_bytes * 2) + { + lastchecktime = my_hrtime().val; + tokenamount = speed_limit_in_bytes * 2; + } + + do + { + ulonglong currenttime = my_hrtime().val; + tokenamount += (currenttime - lastchecktime) * speed_limit_in_bytes / (1000*1000); + lastchecktime = currenttime; + if(tokenamount < network_read_len) + { + ulonglong micro_time = 1000*1000 * (network_read_len - tokenamount) / speed_limit_in_bytes ; + ulonglong second_time = micro_time / (1000 * 1000); + micro_time = micro_time % (1000 * 1000); + + // at least sleep 1000 micro second + my_sleep(micro_time > 1000 ? micro_time : 1000); + + /* + If it sleep more than one second, + it should use slave_sleep() to avoid the STOP SLAVE hang. + */ + if (second_time) + slave_sleep(thd, second_time, io_slave_killed, mi); + + } + }while(tokenamount < network_read_len); + tokenamount -= network_read_len; + } + /* XXX: 'synced' should be updated by queue_event to indicate whether event has been synced to disk */ bool synced= 0; @@ -4697,7 +4940,21 @@ pthread_handler_t handle_slave_sql(void *arg) serial_rgi->gtid_sub_id= 0; serial_rgi->gtid_pending= false; - rli->gtid_skip_flag = GTID_SKIP_NOT; + if (mi->using_gtid != Master_info::USE_GTID_NO && mi->using_parallel() && + rli->restart_gtid_pos.count() > 0) + { + /* + With parallel replication in GTID mode, if we have a multi-domain GTID + position, we need to start some way back in the relay log and skip any + GTID that was already applied before. Since event groups can be split + across multiple relay logs, this earlier starting point may be in the + middle of an already applied event group, so we also need to skip any + remaining part of such group. + */ + rli->gtid_skip_flag = GTID_SKIP_TRANSACTION; + } + else + rli->gtid_skip_flag = GTID_SKIP_NOT; if (init_relay_log_pos(rli, rli->group_relay_log_name, rli->group_relay_log_pos, @@ -4928,7 +5185,7 @@ pthread_handler_t handle_slave_sql(void *arg) { ulong domain_count; - flush_relay_log_info(rli); + rli->flush(); if (mi->using_parallel()) { /* @@ -5479,6 +5736,10 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) bool gtid_skip_enqueue= false; bool got_gtid_event= false; rpl_gtid event_gtid; + bool is_compress_event = false; + char* new_buf = NULL; + char new_buf_arr[4096]; + bool is_malloc = false; /* FD_q must have been prepared for the first R_a event @@ -5525,7 +5786,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) // Emulate the network corruption DBUG_EXECUTE_IF("corrupt_queue_event", - if (buf[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT) + if ((uchar)buf[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT) { char *debug_event_buf_c = (char*) buf; int debug_cor_pos = rand() % (event_len - BINLOG_CHECKSUM_LEN); @@ -5808,10 +6069,8 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) TODO: handling `when' for SHOW SLAVE STATUS' snds behind */ - if ((memcmp(mi->master_log_name, hb.get_log_ident(), hb.get_ident_len()) - && mi->master_log_name != NULL) - || mi->master_log_pos > hb.log_pos) - { + if (memcmp(mi->master_log_name, hb.get_log_ident(), hb.get_ident_len()) || + mi->master_log_pos > hb.log_pos) { /* missed events of heartbeat from the past */ error= ER_SLAVE_HEARTBEAT_FAILURE; error_msg.append(STRING_WITH_LEN("heartbeat is not compatible with local info;")); @@ -5959,6 +6218,51 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) inc_pos= event_len; } break; + /* + Binlog compressed event should uncompress in IO thread + */ + case QUERY_COMPRESSED_EVENT: + inc_pos= event_len; + if (query_event_uncompress(rli->relay_log.description_event_for_queue, + checksum_alg == BINLOG_CHECKSUM_ALG_CRC32, + buf, event_len, new_buf_arr, sizeof(new_buf_arr), + &is_malloc, (char **)&new_buf, &event_len)) + { + char llbuf[22]; + error = ER_BINLOG_UNCOMPRESS_ERROR; + error_msg.append(STRING_WITH_LEN("binlog uncompress error, master log_pos: ")); + llstr(mi->master_log_pos, llbuf); + error_msg.append(llbuf, strlen(llbuf)); + goto err; + } + buf = new_buf; + is_compress_event = true; + goto default_action; + + case WRITE_ROWS_COMPRESSED_EVENT: + case UPDATE_ROWS_COMPRESSED_EVENT: + case DELETE_ROWS_COMPRESSED_EVENT: + case WRITE_ROWS_COMPRESSED_EVENT_V1: + case UPDATE_ROWS_COMPRESSED_EVENT_V1: + case DELETE_ROWS_COMPRESSED_EVENT_V1: + inc_pos = event_len; + { + if (row_log_event_uncompress(rli->relay_log.description_event_for_queue, + checksum_alg == BINLOG_CHECKSUM_ALG_CRC32, + buf, event_len, new_buf_arr, sizeof(new_buf_arr), + &is_malloc, (char **)&new_buf, &event_len)) + { + char llbuf[22]; + error = ER_BINLOG_UNCOMPRESS_ERROR; + error_msg.append(STRING_WITH_LEN("binlog uncompress error, master log_pos: ")); + llstr(mi->master_log_pos, llbuf); + error_msg.append(llbuf, strlen(llbuf)); + goto err; + } + } + buf = new_buf; + is_compress_event = true; + goto default_action; #ifndef DBUG_OFF case XID_EVENT: @@ -5977,7 +6281,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) DBUG_EXECUTE_IF("kill_slave_io_after_2_events", { if (mi->dbug_do_disconnect && - (((uchar)buf[EVENT_TYPE_OFFSET] == QUERY_EVENT) || + (LOG_EVENT_IS_QUERY((Log_event_type)(uchar)buf[EVENT_TYPE_OFFSET]) || ((uchar)buf[EVENT_TYPE_OFFSET] == TABLE_MAP_EVENT)) && (--mi->dbug_event_counter == 0)) { @@ -5990,7 +6294,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) DBUG_EXECUTE_IF("kill_slave_io_before_commit", { if ((uchar)buf[EVENT_TYPE_OFFSET] == XID_EVENT || - ((uchar)buf[EVENT_TYPE_OFFSET] == QUERY_EVENT && + ((uchar)buf[EVENT_TYPE_OFFSET] == QUERY_EVENT && /* QUERY_COMPRESSED_EVENT would never be commmit or rollback */ Query_log_event::peek_is_commit_rollback(buf, event_len, checksum_alg))) { @@ -6010,7 +6314,9 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) ++mi->events_queued_since_last_gtid; } - inc_pos= event_len; + if (!is_compress_event) + inc_pos= event_len; + break; } @@ -6101,8 +6407,8 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) /* everything is filtered out from non-master */ (s_id != mi->master_id || /* for the master meta information is necessary */ - (buf[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT && - buf[EVENT_TYPE_OFFSET] != ROTATE_EVENT))) || + ((uchar)buf[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT && + (uchar)buf[EVENT_TYPE_OFFSET] != ROTATE_EVENT))) || /* Check whether it needs to be filtered based on domain_id @@ -6131,9 +6437,9 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) */ if (!(s_id == global_system_variables.server_id && !mi->rli.replicate_same_server_id) || - (buf[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT && - buf[EVENT_TYPE_OFFSET] != ROTATE_EVENT && - buf[EVENT_TYPE_OFFSET] != STOP_EVENT)) + ((uchar)buf[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT && + (uchar)buf[EVENT_TYPE_OFFSET] != ROTATE_EVENT && + (uchar)buf[EVENT_TYPE_OFFSET] != STOP_EVENT)) { mi->master_log_pos+= inc_pos; memcpy(rli->ign_master_log_name_end, mi->master_log_name, FN_REFLEN); @@ -6174,7 +6480,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) buf[EVENT_TYPE_OFFSET])) || (!mi->last_queued_gtid_standalone && ((uchar)buf[EVENT_TYPE_OFFSET] == XID_EVENT || - ((uchar)buf[EVENT_TYPE_OFFSET] == QUERY_EVENT && + ((uchar)buf[EVENT_TYPE_OFFSET] == QUERY_EVENT && /* QUERY_COMPRESSED_EVENT would never be commmit or rollback */ Query_log_event::peek_is_commit_rollback(buf, event_len, checksum_alg)))))) { @@ -6204,6 +6510,9 @@ err: mi->report(ERROR_LEVEL, error, NULL, ER_DEFAULT(error), error_msg.ptr()); + if(is_malloc) + my_free((void *)new_buf); + DBUG_RETURN(error); } @@ -6358,7 +6667,7 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi, mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir_ptr); /* we disallow empty users */ - if (mi->user == NULL || mi->user[0] == 0) + if (mi->user[0] == 0) { mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, NULL, ER_THD(thd, ER_SLAVE_FATAL_ERROR), @@ -6516,75 +6825,6 @@ MYSQL *rpl_connect_master(MYSQL *mysql) } #endif -/* - Store the file and position where the execute-slave thread are in the - relay log. - - SYNOPSIS - flush_relay_log_info() - rli Relay log information - - NOTES - - As this is only called by the slave thread or on STOP SLAVE, with the - log_lock grabbed and the slave thread stopped, we don't need to have - a lock here. - - If there is an active transaction, then we don't update the position - in the relay log. This is to ensure that we re-execute statements - if we die in the middle of an transaction that was rolled back. - - As a transaction never spans binary logs, we don't have to handle the - case where we do a relay-log-rotation in the middle of the transaction. - If this would not be the case, we would have to ensure that we - don't delete the relay log file where the transaction started when - we switch to a new relay log file. - - TODO - - Change the log file information to a binary format to avoid calling - longlong2str. - - RETURN VALUES - 0 ok - 1 write error -*/ - -bool flush_relay_log_info(Relay_log_info* rli) -{ - bool error=0; - DBUG_ENTER("flush_relay_log_info"); - - if (unlikely(rli->no_storage)) - DBUG_RETURN(0); - - IO_CACHE *file = &rli->info_file; - char buff[FN_REFLEN*2+22*2+4], *pos; - - my_b_seek(file, 0L); - pos=strmov(buff, rli->group_relay_log_name); - *pos++='\n'; - pos= longlong10_to_str(rli->group_relay_log_pos, pos, 10); - *pos++='\n'; - pos=strmov(pos, rli->group_master_log_name); - *pos++='\n'; - pos=longlong10_to_str(rli->group_master_log_pos, pos, 10); - *pos='\n'; - if (my_b_write(file, (uchar*) buff, (size_t) (pos-buff)+1)) - error=1; - if (flush_io_cache(file)) - error=1; - if (sync_relayloginfo_period && - !error && - ++(rli->sync_counter) >= sync_relayloginfo_period) - { - if (my_sync(rli->info_fd, MYF(MY_WME))) - error=1; - rli->sync_counter= 0; - } - /* - Flushing the relay log is done by the slave I/O thread - or by the user on STOP SLAVE. - */ - DBUG_RETURN(error); -} - /* Called when we notice that the current "hot" log got rotated under our feet. @@ -6941,7 +7181,7 @@ static Log_event* next_event(rpl_group_info *rgi, ulonglong *event_size) } rli->event_relay_log_pos = BIN_LOG_HEADER_SIZE; strmake_buf(rli->event_relay_log_name,rli->linfo.log_file_name); - flush_relay_log_info(rli); + rli->flush(); } /* diff --git a/sql/slave.h b/sql/slave.h index e8a925ce560..b2a1e308aba 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -17,6 +17,14 @@ #ifndef SLAVE_H #define SLAVE_H +/** + MASTER_DELAY can be at most (1 << 31) - 1. +*/ +#define MASTER_DELAY_MAX (0x7FFFFFFF) +#if INT_MAX < 0x7FFFFFFF +#error "don't support platforms where INT_MAX < 0x7FFFFFFF" +#endif + /** @defgroup Replication Replication @{ @@ -102,12 +110,14 @@ int init_dynarray_intvar_from_file(DYNAMIC_ARRAY* arr, IO_CACHE* f); In Master_info: run_lock, data_lock run_lock protects all information about the run state: slave_running, thd - and the existence of the I/O thread to stop/start it, you need this mutex). + and the existence of the I/O thread (to stop/start it, you need this mutex). data_lock protects some moving members of the struct: counters (log name, position) and relay log (MYSQL_BIN_LOG object). In Relay_log_info: run_lock, data_lock see Master_info + However, note that run_lock does not protect + Relay_log_info.run_state; that is protected by data_lock. Order of acquisition: if you want to have LOCK_active_mi and a run_lock, you must acquire LOCK_active_mi first. @@ -130,6 +140,7 @@ extern my_bool opt_log_slave_updates; extern char *opt_slave_skip_errors; extern my_bool opt_replicate_annotate_row_events; extern ulonglong relay_log_space_limit; +extern ulonglong opt_read_binlog_speed_limit; extern ulonglong slave_skipped_errors; extern const char *relay_log_index; extern const char *relay_log_basename; @@ -173,7 +184,6 @@ extern const char *relay_log_basename; int init_slave(); int init_recovery(Master_info* mi, const char** errmsg); void init_slave_skip_errors(const char* arg); -bool flush_relay_log_info(Relay_log_info* rli); int register_slave_on_master(MYSQL* mysql); int terminate_slave_threads(Master_info* mi, int thread_mask, bool skip_lock = 0); @@ -242,9 +252,17 @@ void set_slave_thread_options(THD* thd); void set_slave_thread_default_charset(THD *thd, rpl_group_info *rgi); int rotate_relay_log(Master_info* mi); int has_temporary_error(THD *thd); +int sql_delay_event(Log_event *ev, THD *thd, rpl_group_info *rgi); int apply_event_and_update_pos(Log_event* ev, THD* thd, - struct rpl_group_info *rgi, - rpl_parallel_thread *rpt); + struct rpl_group_info *rgi); +int apply_event_and_update_pos_for_parallel(Log_event* ev, THD* thd, + struct rpl_group_info *rgi); + +int init_intvar_from_file(int* var, IO_CACHE* f, int default_val); +int init_floatvar_from_file(float* var, IO_CACHE* f, float default_val); +int init_strvar_from_file(char *var, int max_size, IO_CACHE *f, + const char *default_val); +int init_dynarray_intvar_from_file(DYNAMIC_ARRAY* arr, IO_CACHE* f); pthread_handler_t handle_slave_io(void *arg); void slave_output_error_info(rpl_group_info *rgi, THD *thd); diff --git a/sql/sp_head.cc b/sql/sp_head.cc index e2610fd950c..0b9b503aef3 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -253,6 +253,7 @@ sp_get_flags_for_command(LEX *lex) statement within an IF condition. */ case SQLCOM_EXECUTE: + case SQLCOM_EXECUTE_IMMEDIATE: flags= sp_head::MULTI_RESULTS | sp_head::CONTAINS_DYNAMIC_SQL; break; case SQLCOM_PREPARE: @@ -4255,7 +4256,7 @@ sp_head::add_used_tables_to_table_list(THD *thd, if (stab->temp) continue; - if (!(tab_buff= (char *)thd->calloc(ALIGN_SIZE(sizeof(TABLE_LIST)) * + if (!(tab_buff= (char *)thd->alloc(ALIGN_SIZE(sizeof(TABLE_LIST)) * stab->lock_count)) || !(key_buff= (char*)thd->memdup(stab->qname.str, stab->qname.length))) @@ -4264,32 +4265,11 @@ sp_head::add_used_tables_to_table_list(THD *thd, for (uint j= 0; j < stab->lock_count; j++) { table= (TABLE_LIST *)tab_buff; - - table->db= key_buff; - table->db_length= stab->db_length; - table->table_name= table->db + table->db_length + 1; - table->table_name_length= stab->table_name_length; - table->alias= table->table_name + table->table_name_length + 1; - table->lock_type= stab->lock_type; - table->cacheable_table= 1; - table->prelocking_placeholder= 1; - table->belong_to_view= belong_to_view; - table->trg_event_map= stab->trg_event_map; - /* - Since we don't allow DDL on base tables in prelocked mode it - is safe to infer the type of metadata lock from the type of - table lock. - */ - table->mdl_request.init(MDL_key::TABLE, table->db, table->table_name, - table->lock_type >= TL_WRITE_ALLOW_WRITE ? - MDL_SHARED_WRITE : MDL_SHARED_READ, - MDL_TRANSACTION); - - /* Everyting else should be zeroed */ - - **query_tables_last_ptr= table; - table->prev_global= *query_tables_last_ptr; - *query_tables_last_ptr= &table->next_global; + table->init_one_table_for_prelocking(key_buff, stab->db_length, + key_buff + stab->db_length + 1, stab->table_name_length, + key_buff + stab->db_length + stab->table_name_length + 2, + stab->lock_type, true, belong_to_view, stab->trg_event_map, + query_tables_last_ptr); tab_buff+= ALIGN_SIZE(sizeof(TABLE_LIST)); result= TRUE; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index ab6a8032348..ce7de2ed72b 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1064,7 +1064,12 @@ static bool fix_lex_user(THD *thd, LEX_USER *user) make_scramble= my_make_scrambled_password; } + Query_arena *arena, backup; + arena= thd->activate_stmt_arena_if_needed(&backup); char *buff= (char *) thd->alloc(scramble_length + 1); + if (arena) + thd->restore_active_arena(arena, &backup); + if (buff == NULL) return true; make_scramble(buff, user->pwtext.str, user->pwtext.length); @@ -1750,7 +1755,7 @@ bool acl_reload(THD *thd) my_hash_init2(&acl_roles,50, &my_charset_utf8_bin, 0, 0, 0, (my_hash_get_key) acl_role_get_key, 0, (void (*)(void *))free_acl_role, 0); - my_hash_init2(&acl_roles_mappings, 50, system_charset_info, 0, 0, 0, + my_hash_init2(&acl_roles_mappings, 50, &my_charset_utf8_bin, 0, 0, 0, (my_hash_get_key) acl_role_map_get_key, 0, 0, 0); old_mem= acl_memroot; delete_dynamic(&acl_wild_hosts); @@ -12030,14 +12035,9 @@ static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio, mostly for backward compatibility (to truncate long usernames, as old 5.1 did) */ - { - CHARSET_INFO *cs= system_charset_info; - int err; - - user_len= (uint) cs->cset->well_formed_len(cs, user, user + user_len, - username_char_length, &err); - user[user_len]= '\0'; - } + user_len= Well_formed_prefix(system_charset_info, user, user_len, + username_char_length).length(); + user[user_len]= '\0'; Security_context *sctx= thd->security_ctx; diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index ed23d9cccd6..bc5b9bde8e8 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -380,7 +380,19 @@ static bool open_only_one_table(THD* thd, TABLE_LIST* table, } thd->prepare_derived_at_open= FALSE; - table->next_global= save_next_global; + /* + MERGE engine may adjust table->next_global chain, thus we have to + append save_next_global after merge children. + */ + if (save_next_global) + { + TABLE_LIST *table_list_iterator= table; + while (table_list_iterator->next_global) + table_list_iterator= table_list_iterator->next_global; + table_list_iterator->next_global= save_next_global; + save_next_global->prev_global= &table_list_iterator->next_global; + } + table->next_local= save_next_local; return open_error; diff --git a/sql/sql_audit.cc b/sql/sql_audit.cc index 118b843e1a4..8a523ebbf4b 100644 --- a/sql/sql_audit.cc +++ b/sql/sql_audit.cc @@ -250,10 +250,8 @@ void mysql_audit_finalize() int initialize_audit_plugin(st_plugin_int *plugin) { st_mysql_audit *data= (st_mysql_audit*) plugin->plugin->info; - - if (!data->class_mask || !data->event_notify || - !data->class_mask[0]) - { + + if (!data->event_notify || !data->class_mask[0]) { sql_print_error("Plugin '%s' has invalid data.", plugin->name.str); return 1; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index d3832a7068e..b6cfd2f2cc1 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1495,7 +1495,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx) Note that we allow write locks on log tables as otherwise logging to general/slow log would be disabled in read only transactions. */ - if (table_list->mdl_request.type >= MDL_SHARED_WRITE && + if (table_list->mdl_request.is_write_lock_request() && thd->tx_read_only && !(flags & (MYSQL_LOCK_LOG_TABLE | MYSQL_OPEN_HAS_MDL_LOCK))) { @@ -1654,7 +1654,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx) pre-acquiring metadata locks at the beggining of open_tables() call. */ - if (table_list->mdl_request.type >= MDL_SHARED_WRITE && + if (table_list->mdl_request.is_write_lock_request() && ! (flags & (MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK | MYSQL_OPEN_FORCE_SHARED_MDL | MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL | @@ -1855,12 +1855,8 @@ retry_share: goto err_lock; error= open_table_from_share(thd, share, alias, - (uint) (HA_OPEN_KEYFILE | - HA_OPEN_RNDFILE | - HA_GET_INDEX | - HA_TRY_READ_ONLY), - (READ_KEYINFO | COMPUTE_TYPES | - EXTRA_RECORD), + HA_OPEN_KEYFILE | HA_TRY_READ_ONLY, + EXTRA_RECORD, thd->open_options, table, FALSE); if (error) @@ -2689,10 +2685,8 @@ static bool auto_repair_table(THD *thd, TABLE_LIST *table_list) DBUG_ASSERT(! share->is_view); if (open_table_from_share(thd, share, table_list->alias, - (uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE | - HA_GET_INDEX | - HA_TRY_READ_ONLY), - READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD, + HA_OPEN_KEYFILE | HA_TRY_READ_ONLY, + EXTRA_RECORD, ha_open_options | HA_OPEN_FOR_REPAIR, entry, FALSE) || ! entry->file || (entry->file->is_crashed() && entry->file->ha_check_and_repair(thd))) @@ -3606,6 +3600,7 @@ lock_table_names(THD *thd, const DDL_options_st &options, table= table->next_global) { if (table->mdl_request.type < MDL_SHARED_UPGRADABLE || + table->mdl_request.type == MDL_SHARED_READ_ONLY || table->open_type == OT_TEMPORARY_ONLY || (table->open_type == OT_TEMPORARY_OR_BASE && is_temporary_table(table))) { @@ -3729,6 +3724,11 @@ open_tables_check_upgradable_mdl(THD *thd, TABLE_LIST *tables_start, for (table= tables_start; table && table != tables_end; table= table->next_global) { + /* + Check below needs to be updated if this function starts + called for SRO locks. + */ + DBUG_ASSERT(table->mdl_request.type != MDL_SHARED_READ_ONLY); if (table->mdl_request.type < MDL_SHARED_UPGRADABLE || table->open_type == OT_TEMPORARY_ONLY || (table->open_type == OT_TEMPORARY_OR_BASE && is_temporary_table(table))) @@ -4064,13 +4064,22 @@ restart: } } - if (WSREP_ON && - wsrep_replicate_myisam && - (*start) && - (*start)->table && - (*start)->table->file->ht == myisam_hton && - sqlcom_can_generate_row_events(thd) && - thd->get_command() != COM_STMT_PREPARE) + if (WSREP_ON && + wsrep_replicate_myisam && + (*start) && + (*start)->table && + (*start)->table->file->ht == myisam_hton && + wsrep_thd_exec_mode(thd) == LOCAL_STATE && + !is_stat_table((*start)->db, (*start)->alias) && + thd->get_command() != COM_STMT_PREPARE && + ((thd->lex->sql_command == SQLCOM_INSERT || + thd->lex->sql_command == SQLCOM_INSERT_SELECT || + thd->lex->sql_command == SQLCOM_REPLACE || + thd->lex->sql_command == SQLCOM_REPLACE_SELECT || + thd->lex->sql_command == SQLCOM_UPDATE || + thd->lex->sql_command == SQLCOM_UPDATE_MULTI || + thd->lex->sql_command == SQLCOM_LOAD || + thd->lex->sql_command == SQLCOM_DELETE))) { WSREP_TO_ISOLATION_BEGIN(NULL, NULL, (*start)); } @@ -4138,6 +4147,25 @@ handle_routine(THD *thd, Query_tables_list *prelocking_ctx, } +/* + @note this can be changed to use a hash, instead of scanning the linked + list, if the performance of this function will ever become an issue +*/ +static bool table_already_fk_prelocked(TABLE_LIST *tl, LEX_STRING *db, + LEX_STRING *table, thr_lock_type lock_type) +{ + for (; tl; tl= tl->next_global ) + { + if (tl->lock_type >= lock_type && + tl->prelocking_placeholder == TABLE_LIST::FK && + strcmp(tl->db, db->str) == 0 && + strcmp(tl->table_name, table->str) == 0) + return true; + } + return false; +} + + /** Defines how prelocking algorithm for DML statements should handle table list elements: @@ -4177,6 +4205,52 @@ handle_table(THD *thd, Query_tables_list *prelocking_ctx, add_tables_and_routines_for_triggers(thd, prelocking_ctx, table_list)) return TRUE; } + + if (table_list->table->file->referenced_by_foreign_key()) + { + List fk_list; + List_iterator fk_list_it(fk_list); + FOREIGN_KEY_INFO *fk; + Query_arena *arena, backup; + + arena= thd->activate_stmt_arena_if_needed(&backup); + + table_list->table->file->get_parent_foreign_key_list(thd, &fk_list); + if (thd->is_error()) + { + if (arena) + thd->restore_active_arena(arena, &backup); + return TRUE; + } + + *need_prelocking= TRUE; + + while ((fk= fk_list_it++)) + { + // FK_OPTION_RESTRICT and FK_OPTION_NO_ACTION only need read access + static bool can_write[]= { true, false, true, true, false, true }; + uint8 op= table_list->trg_event_map; + thr_lock_type lock_type; + + if ((op & (1 << TRG_EVENT_DELETE) && can_write[fk->delete_method]) + || (op & (1 << TRG_EVENT_UPDATE) && can_write[fk->update_method])) + lock_type= TL_WRITE_ALLOW_WRITE; + else + lock_type= TL_READ; + + if (table_already_fk_prelocked(table_list, fk->foreign_db, + fk->foreign_table, lock_type)) + continue; + + TABLE_LIST *tl= (TABLE_LIST *) thd->alloc(sizeof(TABLE_LIST)); + tl->init_one_table_for_prelocking(fk->foreign_db->str, fk->foreign_db->length, + fk->foreign_table->str, fk->foreign_table->length, + NULL, lock_type, false, table_list->belong_to_view, + op, &prelocking_ctx->query_tables_last); + } + if (arena) + thd->restore_active_arena(arena, &backup); + } } return FALSE; @@ -5028,7 +5102,6 @@ static void update_field_dependencies(THD *thd, Field *field, TABLE *table) */ table->covering_keys.intersect(field->part_of_key); - table->merge_keys.merge(field->part_of_key); if (field->vcol_info) table->mark_virtual_col(field); @@ -6377,7 +6450,6 @@ mark_common_columns(THD *thd, TABLE_LIST *table_ref_1, TABLE_LIST *table_ref_2, /* Mark field_1 used for table cache. */ bitmap_set_bit(table_1->read_set, field_1->field_index); table_1->covering_keys.intersect(field_1->part_of_key); - table_1->merge_keys.merge(field_1->part_of_key); } if (field_2) { @@ -6385,7 +6457,6 @@ mark_common_columns(THD *thd, TABLE_LIST *table_ref_1, TABLE_LIST *table_ref_2, /* Mark field_2 used for table cache. */ bitmap_set_bit(table_2->read_set, field_2->field_index); table_2->covering_keys.intersect(field_2->part_of_key); - table_2->merge_keys.merge(field_2->part_of_key); } if (using_fields != NULL) @@ -7480,7 +7551,6 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name, if (table) { table->covering_keys.intersect(field->part_of_key); - table->merge_keys.merge(field->part_of_key); } if (tables->is_natural_join) { @@ -7500,7 +7570,6 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name, thd->lex->current_select->select_list_tables|= field_table->map; field_table->covering_keys.intersect(field->part_of_key); - field_table->merge_keys.merge(field->part_of_key); field_table->used_fields++; } } @@ -7768,7 +7837,6 @@ fill_record(THD *thd, TABLE *table_arg, List &fields, List &values, List_iterator_fast f(fields),v(values); Item *value, *fld; Item_field *field; - TABLE *vcol_table= 0; bool save_abort_on_warning= thd->abort_on_warning; bool save_no_errors= thd->no_errors; DBUG_ENTER("fill_record"); @@ -7794,8 +7862,6 @@ fill_record(THD *thd, TABLE *table_arg, List &fields, List &values, table_arg->auto_increment_field_not_null= FALSE; f.rewind(); } - else - vcol_table= thd->lex->unit.insert_table_with_stored_vcol; while ((fld= f++)) { @@ -7810,9 +7876,10 @@ fill_record(THD *thd, TABLE *table_arg, List &fields, List &values, if (table->next_number_field && rfield->field_index == table->next_number_field->field_index) table->auto_increment_field_not_null= TRUE; - if (rfield->vcol_info && - value->type() != Item::DEFAULT_VALUE_ITEM && - value->type() != Item::NULL_ITEM && + Item::Type type= value->type(); + if (rfield->vcol_info && + type != Item::DEFAULT_VALUE_ITEM && + type != Item::NULL_ITEM && table->s->table_category != TABLE_CATEGORY_TEMPORARY) { push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, @@ -7827,8 +7894,6 @@ fill_record(THD *thd, TABLE *table_arg, List &fields, List &values, goto err; } rfield->set_explicit_default(value); - DBUG_ASSERT(vcol_table == 0 || vcol_table == table); - vcol_table= table; } if (!update && table_arg->default_field && @@ -7836,10 +7901,8 @@ fill_record(THD *thd, TABLE *table_arg, List &fields, List &values, goto err; /* Update virtual fields */ thd->abort_on_warning= FALSE; - if (vcol_table && vcol_table->vfield && - update_virtual_fields(thd, vcol_table, - vcol_table->triggers ? VCOL_UPDATE_ALL : - VCOL_UPDATE_FOR_WRITE)) + if (table_arg->vfield && + table_arg->update_virtual_fields(VCOL_UPDATE_FOR_WRITE)) goto err; thd->abort_on_warning= save_abort_on_warning; thd->no_errors= save_no_errors; @@ -7897,7 +7960,7 @@ void switch_defaults_to_nullable_trigger_fields(TABLE *table) for (Field **field_ptr= table->default_field; *field_ptr ; field_ptr++) { Field *field= (*field_ptr); - field->default_value->expr_item->walk(&Item::switch_to_nullable_fields_processor, 1, trigger_field); + field->default_value->expr->walk(&Item::switch_to_nullable_fields_processor, 1, trigger_field); *field_ptr= (trigger_field[field->field_index]); } } @@ -7990,9 +8053,7 @@ fill_record_n_invoke_before_triggers(THD *thd, TABLE *table, if (item_field && table->vfield) { DBUG_ASSERT(table == item_field->field->table); - result= update_virtual_fields(thd, table, - table->triggers ? VCOL_UPDATE_ALL : - VCOL_UPDATE_FOR_WRITE); + result= table->update_virtual_fields(VCOL_UPDATE_FOR_WRITE); } } } @@ -8060,15 +8121,18 @@ fill_record(THD *thd, TABLE *table, Field **ptr, List &values, value=v++; if (field->field_index == autoinc_index) table->auto_increment_field_not_null= TRUE; - if (field->vcol_info && - value->type() != Item::DEFAULT_VALUE_ITEM && - value->type() != Item::NULL_ITEM && - table->s->table_category != TABLE_CATEGORY_TEMPORARY) + if (field->vcol_info) { - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN, - ER_THD(thd, ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN), - field->field_name, table->s->table_name.str); + Item::Type type= value->type(); + if (type != Item::DEFAULT_VALUE_ITEM && + type != Item::NULL_ITEM && + table->s->table_category != TABLE_CATEGORY_TEMPORARY) + { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN, + ER_THD(thd, ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN), + field->field_name, table->s->table_name.str); + } } if (use_value) @@ -8082,9 +8146,7 @@ fill_record(THD *thd, TABLE *table, Field **ptr, List &values, /* Update virtual fields */ thd->abort_on_warning= FALSE; if (table->vfield && - update_virtual_fields(thd, table, - table->triggers ? VCOL_UPDATE_ALL : - VCOL_UPDATE_FOR_WRITE)) + table->update_virtual_fields(VCOL_UPDATE_FOR_WRITE)) goto err; thd->abort_on_warning= abort_on_warning_saved; DBUG_RETURN(thd->is_error()); @@ -8138,10 +8200,7 @@ fill_record_n_invoke_before_triggers(THD *thd, TABLE *table, Field **ptr, { DBUG_ASSERT(table == (*ptr)->table); if (table->vfield) - result= update_virtual_fields(thd, table, - table->triggers ? - VCOL_UPDATE_ALL : - VCOL_UPDATE_FOR_WRITE); + result= table->update_virtual_fields(VCOL_UPDATE_FOR_WRITE); } return result; @@ -8387,6 +8446,7 @@ open_system_tables_for_read(THD *thd, TABLE_LIST *table_list, */ lex->reset_n_backup_query_tables_list(&query_tables_list_backup); thd->reset_n_backup_open_tables_state(backup); + thd->lex->sql_command= SQLCOM_SELECT; if (open_and_lock_tables(thd, table_list, FALSE, MYSQL_OPEN_IGNORE_FLUSH | diff --git a/sql/sql_base.h b/sql/sql_base.h index bdfbe400e54..8f363a73863 100644 --- a/sql/sql_base.h +++ b/sql/sql_base.h @@ -288,8 +288,6 @@ TABLE *find_table_for_mdl_upgrade(THD *thd, const char *db, const char *table_name, bool no_error); -int update_virtual_fields(THD *thd, TABLE *table, - enum enum_vcol_update_mode vcol_update_mode= VCOL_UPDATE_FOR_READ); int dynamic_column_error_message(enum_dyncol_func_result rc); /* open_and_lock_tables with optional derived handling */ @@ -331,14 +329,12 @@ inline void setup_table_map(TABLE *table, TABLE_LIST *table_list, uint tablenr) table->force_index= table_list->force_index; table->force_index_order= table->force_index_group= 0; table->covering_keys= table->s->keys_for_keyread; - table->merge_keys.clear_all(); TABLE_LIST *orig= table_list->select_lex ? table_list->select_lex->master_unit()->derived : 0; if (!orig || !orig->is_merged_derived()) { /* Tables merged from derived were set up already.*/ table->covering_keys= table->s->keys_for_keyread; - table->merge_keys.clear_all(); } } diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc index 1967b74e737..d92ac15822f 100644 --- a/sql/sql_binlog.cc +++ b/sql/sql_binlog.cc @@ -17,18 +17,99 @@ #include #include "sql_priv.h" #include "sql_binlog.h" -#include "sql_parse.h" // check_global_access -#include "sql_acl.h" // *_ACL +#include "sql_parse.h" +#include "sql_acl.h" #include "rpl_rli.h" #include "base64.h" -#include "slave.h" // apply_event_and_update_pos -#include "log_event.h" // Format_description_log_event, - // EVENT_LEN_OFFSET, - // EVENT_TYPE_OFFSET, - // FORMAT_DESCRIPTION_LOG_EVENT, - // START_EVENT_V3, - // Log_event_type, - // Log_event +#include "slave.h" +#include "log_event.h" + + +/** + Check if the event type is allowed in a BINLOG statement. + + @retval 0 if the event type is ok. + @retval 1 if the event type is not ok. +*/ +static int check_event_type(int type, Relay_log_info *rli) +{ + Format_description_log_event *fd_event= + rli->relay_log.description_event_for_exec; + + /* + Convert event type id of certain old versions (see comment in + Format_description_log_event::Format_description_log_event(char*,...)). + */ + if (fd_event && fd_event->event_type_permutation) + { + IF_DBUG({ + int new_type= fd_event->event_type_permutation[type]; + DBUG_PRINT("info", + ("converting event type %d to %d (%s)", + type, new_type, + Log_event::get_type_str((Log_event_type)new_type))); + }, + (void)0); + type= fd_event->event_type_permutation[type]; + } + + switch (type) + { + case START_EVENT_V3: + case FORMAT_DESCRIPTION_EVENT: + /* + We need a preliminary FD event in order to parse the FD event, + if we don't already have one. + */ + if (!fd_event) + if (!(rli->relay_log.description_event_for_exec= + new Format_description_log_event(4))) + { + my_error(ER_OUTOFMEMORY, MYF(0), 1); + return 1; + } + + /* It is always allowed to execute FD events. */ + return 0; + + case TABLE_MAP_EVENT: + case WRITE_ROWS_EVENT_V1: + case UPDATE_ROWS_EVENT_V1: + case DELETE_ROWS_EVENT_V1: + case WRITE_ROWS_EVENT: + case UPDATE_ROWS_EVENT: + case DELETE_ROWS_EVENT: + case PRE_GA_WRITE_ROWS_EVENT: + case PRE_GA_UPDATE_ROWS_EVENT: + case PRE_GA_DELETE_ROWS_EVENT: + /* + Row events are only allowed if a Format_description_event has + already been seen. + */ + if (fd_event) + return 0; + else + { + my_error(ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT, + MYF(0), Log_event::get_type_str((Log_event_type)type)); + return 1; + } + break; + + default: + /* + It is not meaningful to execute other events than row-events and + FD events. It would even be dangerous to execute Stop_log_event + and Rotate_log_event since they call Relay_log_info::flush(), which + is not allowed to call by other threads than the slave SQL + thread when the slave SQL thread is running. + */ + my_error(ER_ONLY_FD_AND_RBR_EVENTS_ALLOWED_IN_BINLOG_STATEMENT, + MYF(0), Log_event::get_type_str((Log_event_type)type)); + return 1; + } +} + /** Execute a BINLOG statement. @@ -73,31 +154,13 @@ void mysql_client_binlog_statement(THD* thd) Allocation */ - /* - If we do not have a Format_description_event, we create a dummy - one here. In this case, the first event we read must be a - Format_description_event. - */ - my_bool have_fd_event= TRUE; int err; Relay_log_info *rli; rpl_group_info *rgi; rli= thd->rli_fake; - if (!rli) - { - rli= thd->rli_fake= new Relay_log_info(FALSE); -#ifdef HAVE_valgrind - rli->is_fake= TRUE; -#endif - have_fd_event= FALSE; - } - if (rli && !rli->relay_log.description_event_for_exec) - { - rli->relay_log.description_event_for_exec= - new Format_description_log_event(4); - have_fd_event= FALSE; - } + if (!rli && (rli= thd->rli_fake= new Relay_log_info(FALSE))) + rli->sql_driver_thd= thd; if (!(rgi= thd->rgi_fake)) rgi= thd->rgi_fake= new rpl_group_info(rli); rgi->thd= thd; @@ -109,16 +172,13 @@ void mysql_client_binlog_statement(THD* thd) /* Out of memory check */ - if (!(rli && - rli->relay_log.description_event_for_exec && - buf)) + if (!(rli && buf)) { my_error(ER_OUTOFMEMORY, MYF(ME_FATALERROR), 1); /* needed 1 bytes */ goto end; } - rli->sql_driver_thd= thd; - rli->no_storage= TRUE; + DBUG_ASSERT(rli->belongs_to_client()); for (char const *strptr= thd->lex->comment.str ; strptr < thd->lex->comment.str + thd->lex->comment.length ; ) @@ -185,23 +245,8 @@ void mysql_client_binlog_statement(THD* thd) DBUG_PRINT("info", ("event_len=%lu, bytes_decoded=%d", event_len, bytes_decoded)); - /* - If we have not seen any Format_description_event, then we must - see one; it is the only statement that can be read in base64 - without a prior Format_description_event. - */ - if (!have_fd_event) - { - int type = (uchar)bufptr[EVENT_TYPE_OFFSET]; - if (type == FORMAT_DESCRIPTION_EVENT || type == START_EVENT_V3) - have_fd_event= TRUE; - else - { - my_error(ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT, - MYF(0), Log_event::get_type_str((Log_event_type)type)); - goto end; - } - } + if (check_event_type(bufptr[EVENT_TYPE_OFFSET], rli)) + goto end; ev= Log_event::read_log_event(bufptr, event_len, &error, rli->relay_log.description_event_for_exec, @@ -212,7 +257,7 @@ void mysql_client_binlog_statement(THD* thd) { /* This could actually be an out-of-memory, but it is more likely - causes by a bad statement + caused by a bad statement */ my_error(ER_SYNTAX_ERROR, MYF(0)); goto end; diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 2f4856fc4e2..6b13dba876e 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -962,7 +962,7 @@ inline void Query_cache_query::unlock_reading() void Query_cache_query::init_n_lock() { DBUG_ENTER("Query_cache_query::init_n_lock"); - res=0; wri = 0; len = 0; + res=0; wri = 0; len = 0; ready= 0; mysql_rwlock_init(key_rwlock_query_cache_query_lock, &lock); lock_writing(); DBUG_PRINT("qcache", ("inited & locked query for block 0x%lx", @@ -1227,6 +1227,7 @@ void Query_cache::end_of_result(THD *thd) query_cache.split_block(last_result_block,len); header->found_rows(limit_found_rows); + header->set_results_ready(); // signal for plugin header->result()->type= Query_cache_block::RESULT; /* Drop the writer. */ diff --git a/sql/sql_cache.h b/sql/sql_cache.h index 6984c2115f2..945de307ffb 100644 --- a/sql/sql_cache.h +++ b/sql/sql_cache.h @@ -156,8 +156,9 @@ struct Query_cache_query Query_cache_block *res; Query_cache_tls *wri; ulong len; - uint8 tbls_type; unsigned int last_pkt_nr; + uint8 tbls_type; + uint8 ready; Query_cache_query() {} /* Remove gcc warning */ inline void init_n_lock(); @@ -177,6 +178,12 @@ struct Query_cache_query { return (((uchar*)this) + ALIGN_SIZE(sizeof(Query_cache_query))); } + /** + following used to check if result ready in plugin without + locking rw_lock of the query. + */ + inline void set_results_ready() { ready= 1; } + inline bool is_results_ready() { return ready; } void lock_writing(); void lock_reading(); bool try_lock_writing(); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 6433786a079..1837f2878c7 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -267,185 +267,6 @@ bool Foreign_key::validate(List &table_fields) /**************************************************************************** ** Thread specific functions ****************************************************************************/ -#ifdef ONLY_FOR_MYSQL_CLOSED_SOURCE_SCHEDULED -/** - Get reference to scheduler data object - - @param thd THD object - - @retval Scheduler data object on THD -*/ -void *thd_get_scheduler_data(THD *thd) -{ - return thd->scheduler.data; -} - -/** - Set reference to Scheduler data object for THD object - - @param thd THD object - @param psi Scheduler data object to set on THD -*/ -void thd_set_scheduler_data(THD *thd, void *data) -{ - thd->scheduler.data= data; -} - -/** - Get reference to Performance Schema object for THD object - - @param thd THD object - - @retval Performance schema object for thread on THD -*/ -PSI_thread *thd_get_psi(THD *thd) -{ - return thd->scheduler.m_psi; -} - -/** - Get net_wait_timeout for THD object - - @param thd THD object - - @retval net_wait_timeout value for thread on THD -*/ -ulong thd_get_net_wait_timeout(THD* thd) -{ - return thd->variables.net_wait_timeout; -} - -/** - Set reference to Performance Schema object for THD object - - @param thd THD object - @param psi Performance schema object for thread -*/ -void thd_set_psi(THD *thd, PSI_thread *psi) -{ - thd->scheduler.m_psi= psi; -} - -/** - Set the state on connection to killed - - @param thd THD object -*/ -void thd_set_killed(THD *thd) -{ - thd->killed= KILL_CONNECTION; -} - -/** - Set thread stack in THD object - - @param thd Thread object - @param stack_start Start of stack to set in THD object -*/ -void thd_set_thread_stack(THD *thd, char *stack_start) -{ - thd->thread_stack= stack_start; -} - -/** - Close the socket used by this connection - - @param thd THD object -*/ -void thd_close_connection(THD *thd) -{ - if (thd->net.vio) - vio_close(thd->net.vio); -} - -/** - Lock data that needs protection in THD object - - @param thd THD object -*/ -void thd_lock_data(THD *thd) -{ - mysql_mutex_lock(&thd->LOCK_thd_data); -} - -/** - Unlock data that needs protection in THD object - - @param thd THD object -*/ -void thd_unlock_data(THD *thd) -{ - mysql_mutex_unlock(&thd->LOCK_thd_data); -} - -/** - Support method to check if connection has already started transcaction - - @param client_cntx Low level client context - - @retval TRUE if connection already started transaction -*/ -bool thd_is_transaction_active(THD *thd) -{ - return thd->transaction.is_active(); -} - -/** - Check if there is buffered data on the socket representing the connection - - @param thd THD object -*/ -int thd_connection_has_data(THD *thd) -{ - Vio *vio= thd->net.vio; - return vio->has_data(vio); -} - -/** - Set reading/writing on socket, used by SHOW PROCESSLIST - - @param thd THD object - @param val Value to set it to (0 or 1) -*/ -void thd_set_net_read_write(THD *thd, uint val) -{ - thd->net.reading_or_writing= val; -} - -/** - Get reading/writing on socket from THD object - @param thd THD object - - @retval net.reading_or_writing value for thread on THD. -*/ -uint thd_get_net_read_write(THD *thd) -{ - return thd->net.reading_or_writing; -} - -/** - Set reference to mysys variable in THD object - - @param thd THD object - @param mysys_var Reference to set -*/ -void thd_set_mysys_var(THD *thd, st_my_thread_var *mysys_var) -{ - thd->set_mysys_var(mysys_var); -} - -/** - Get socket file descriptor for this connection - - @param thd THD object - - @retval Socket of the connection -*/ -my_socket thd_get_fd(THD *thd) -{ - return mysql_socket_getfd(thd->net.vio->mysql_socket); -} -#endif /* ONLY_FOR_MYSQL_CLOSED_SOURCE_SCHEDULED */ /** Get current THD object from thread local data @@ -540,13 +361,13 @@ const char *set_thd_proc_info(THD *thd_arg, const char *info, PSI_stage_info old_stage; PSI_stage_info new_stage; - old_stage.m_key= 0; - old_stage.m_name= info; + new_stage.m_key= 0; + new_stage.m_name= info; - set_thd_stage_info(thd_arg, & old_stage, & new_stage, + set_thd_stage_info(thd_arg, & new_stage, & old_stage, calling_function, calling_file, calling_line); - return new_stage.m_name; + return old_stage.m_name; } extern "C" @@ -829,6 +650,28 @@ bool Drop_table_error_handler::handle_condition(THD *thd, } +/** + Handle an error from MDL_context::upgrade_lock() and mysql_lock_tables(). + Ignore ER_LOCK_ABORTED and ER_LOCK_DEADLOCK errors. +*/ + +bool +MDL_deadlock_and_lock_abort_error_handler:: +handle_condition(THD *thd, + uint sql_errno, + const char *sqlstate, + Sql_condition::enum_warning_level level, + const char* msg, + Sql_condition **cond_hdl) +{ + *cond_hdl= NULL; + if (sql_errno == ER_LOCK_ABORTED || sql_errno == ER_LOCK_DEADLOCK) + m_need_reopen= true; + + return m_need_reopen; +} + + /** Send timeout to thread. @@ -854,6 +697,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier) in_sub_stmt(0), log_all_errors(0), binlog_unsafe_warning_flags(0), binlog_table_maps(0), + bulk_param(0), table_map_for_update(0), m_examined_row_count(0), accessed_rows_and_keys(0), @@ -974,6 +818,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier) mysql_audit_init_thd(this); net.vio=0; net.buff= 0; + net.reading_or_writing= 0; client_capabilities= 0; // minimalistic client system_thread= NON_SYSTEM_THREAD; cleanup_done= free_connection_done= abort_on_warning= 0; @@ -4561,6 +4406,94 @@ extern "C" int thd_is_connected(MYSQL_THD thd) #ifdef INNODB_COMPATIBILITY_HOOKS + +/** open a table and add it to thd->open_tables + + @note At the moment this is used in innodb background purge threads + *only*.There should be no table locks, because the background purge does not + change the table as far as LOCK TABLES is concerned. MDL locks are + still needed, though. + + To make sure no table stays open for long, this helper allows the thread to + have only one table open at any given time. +*/ +TABLE *open_purge_table(THD *thd, const char *db, size_t dblen, + const char *tb, size_t tblen) +{ + DBUG_ENTER("open_purge_table"); + DBUG_ASSERT(thd->open_tables == NULL); + DBUG_ASSERT(thd->locked_tables_mode < LTM_PRELOCKED); + + Open_table_context ot_ctx(thd, 0); + TABLE_LIST *tl= (TABLE_LIST*)thd->alloc(sizeof(TABLE_LIST)); + + tl->init_one_table(db, dblen, tb, tblen, tb, TL_READ); + tl->i_s_requested_object= OPEN_TABLE_ONLY; + + bool error= open_table(thd, tl, &ot_ctx); + + /* we don't recover here */ + DBUG_ASSERT(!error || !ot_ctx.can_recover_from_failed_open()); + + if (error) + close_thread_tables(thd); + + DBUG_RETURN(error ? NULL : tl->table); +} + +/** Find an open table in the list of prelocked tabled + + Used for foreign key actions, for example, in UPDATE t1 SET a=1; + where a child table t2 has a KB on t1.a. + + But only when virtual columns are involved, otherwise InnoDB + does not need an open TABLE. +*/ +TABLE *find_fk_open_table(THD *thd, const char *db, size_t db_len, + const char *table, size_t table_len) +{ + for (TABLE *t= thd->open_tables; t; t= t->next) + { + if (t->s->db.length == db_len && t->s->table_name.length == table_len && + !strcmp(t->s->db.str, db) && !strcmp(t->s->table_name.str, table) && + t->pos_in_table_list->prelocking_placeholder == TABLE_LIST::FK) + return t; + } + return NULL; +} + +/* the following three functions are used in background purge threads */ + +MYSQL_THD create_thd() +{ + THD *thd= new THD(next_thread_id()); + thd->thread_stack= (char*) &thd; + thd->store_globals(); + thd->set_command(COM_DAEMON); + thd->system_thread= SYSTEM_THREAD_GENERIC; + thd->security_ctx->host_or_ip=""; + add_to_active_threads(thd); + return thd; +} + +void destroy_thd(MYSQL_THD thd) +{ + delete_running_thd(thd); +} + +void reset_thd(MYSQL_THD thd) +{ + close_thread_tables(thd); + thd->mdl_context.release_transactional_locks(); + thd->free_items(); + free_root(thd->mem_root, MYF(MY_KEEP_PREALLOC)); +} + +unsigned long long thd_get_query_id(const MYSQL_THD thd) +{ + return((unsigned long long)thd->query_id); +} + extern "C" const struct charset_info_st *thd_charset(MYSQL_THD thd) { return(thd->charset()); @@ -4598,19 +4531,20 @@ extern "C" int thd_rpl_is_parallel(const MYSQL_THD thd) } /* - This function can optionally be called to check if thd_report_wait_for() + This function can optionally be called to check if thd_rpl_deadlock_check() needs to be called for waits done by a given transaction. - If this function returns false for a given thd, there is no need to do any - calls to thd_report_wait_for() on that thd. + If this function returns false for a given thd, there is no need to do + any calls to thd_rpl_deadlock_check() on that thd. - This call is optional; it is safe to call thd_report_wait_for() in any case. - This call can be used to save some redundant calls to thd_report_wait_for() - if desired. (This is unlikely to matter much unless there are _lots_ of - waits to report, as the overhead of thd_report_wait_for() is small). + This call is optional; it is safe to call thd_rpl_deadlock_check() in + any case. This call can be used to save some redundant calls to + thd_rpl_deadlock_check() if desired. (This is unlikely to matter much + unless there are _lots_ of waits to report, as the overhead of + thd_rpl_deadlock_check() is small). */ extern "C" int -thd_need_wait_for(const MYSQL_THD thd) +thd_need_wait_reports(const MYSQL_THD thd) { rpl_group_info *rgi; @@ -4625,75 +4559,9 @@ thd_need_wait_for(const MYSQL_THD thd) } /* - Used by InnoDB/XtraDB to report that one transaction THD is about to go to - wait for a transactional lock held by another transactions OTHER_THD. - - This is used for parallel replication, where transactions are required to - commit in the same order on the slave as they did on the master. If the - transactions on the slave encounters lock conflicts on the slave that did - not exist on the master, this can cause deadlocks. - - Normally, such conflicts will not occur, because the same conflict would - have prevented the two transactions from committing in parallel on the - master, thus preventing them from running in parallel on the slave in the - first place. However, it is possible in case when the optimizer chooses a - different plan on the slave than on the master (eg. table scan instead of - index scan). - - InnoDB/XtraDB reports lock waits using this call. If a lock wait causes a - deadlock with the pre-determined commit order, we kill the later transaction, - and later re-try it, to resolve the deadlock. - - This call need only receive reports about waits for locks that will remain - until the holding transaction commits. InnoDB/XtraDB auto-increment locks - are released earlier, and so need not be reported. (Such false positives are - not harmful, but could lead to unnecessary kill and retry, so best avoided). -*/ -extern "C" void -thd_report_wait_for(MYSQL_THD thd, MYSQL_THD other_thd) -{ - rpl_group_info *rgi; - rpl_group_info *other_rgi; - - if (!thd) - return; - DEBUG_SYNC(thd, "thd_report_wait_for"); - thd->transaction.stmt.mark_trans_did_wait(); - if (!other_thd) - return; - binlog_report_wait_for(thd, other_thd); - rgi= thd->rgi_slave; - other_rgi= other_thd->rgi_slave; - if (!rgi || !other_rgi) - return; - if (!rgi->is_parallel_exec) - return; - if (rgi->rli != other_rgi->rli) - return; - if (!rgi->gtid_sub_id || !other_rgi->gtid_sub_id) - return; - if (rgi->current_gtid.domain_id != other_rgi->current_gtid.domain_id) - return; - if (rgi->gtid_sub_id > other_rgi->gtid_sub_id) - return; - /* - This transaction is about to wait for another transaction that is required - by replication binlog order to commit after. This would cause a deadlock. - - So send a kill to the other transaction, with a temporary error; this will - cause replication to rollback (and later re-try) the other transaction, - releasing the lock for this transaction so replication can proceed. - */ - other_rgi->killed_for_retry= rpl_group_info::RETRY_KILL_KILLED; - mysql_mutex_lock(&other_thd->LOCK_thd_data); - other_thd->awake(KILL_CONNECTION); - mysql_mutex_unlock(&other_thd->LOCK_thd_data); -} - -/* - Used by storage engines (currently TokuDB) to report that one transaction - THD is about to go to wait for a transactional lock held by another - transactions OTHER_THD. + Used by storage engines (currently TokuDB and InnoDB/XtraDB) to report that + one transaction THD is about to go to wait for a transactional lock held by + another transactions OTHER_THD. This is used for parallel replication, where transactions are required to commit in the same order on the slave as they did on the master. If the @@ -4708,9 +4576,9 @@ thd_report_wait_for(MYSQL_THD thd, MYSQL_THD other_thd) chooses a different plan on the slave than on the master (eg. table scan instead of index scan). - InnoDB/XtraDB reports lock waits using this call. If a lock wait causes a - deadlock with the pre-determined commit order, we kill the later transaction, - and later re-try it, to resolve the deadlock. + Storage engines report lock waits using this call. If a lock wait causes a + deadlock with the pre-determined commit order, we kill the later + transaction, and later re-try it, to resolve the deadlock. This call need only receive reports about waits for locks that will remain until the holding transaction commits. InnoDB/XtraDB auto-increment locks, @@ -4801,8 +4669,8 @@ thd_rpl_deadlock_check(MYSQL_THD thd, MYSQL_THD other_thd) Calling this function is just an optimisation to avoid unnecessary deadlocks. If it was not used, a gap lock would be set that could eventually - cause a deadlock; the deadlock would be caught by thd_report_wait_for() and - the transaction T2 killed and rolled back (and later re-tried). + cause a deadlock; the deadlock would be caught by thd_rpl_deadlock_check() + and the transaction T2 killed and rolled back (and later re-tried). */ extern "C" int thd_need_ordering_with(const MYSQL_THD thd, const MYSQL_THD other_thd) @@ -5766,6 +5634,17 @@ int THD::decide_logging_format(TABLE_LIST *tables) !(wsrep_binlog_format() == BINLOG_FORMAT_STMT && !binlog_filter->db_ok(db))) { + + if (is_bulk_op()) + { + if (wsrep_binlog_format() == BINLOG_FORMAT_STMT) + { + my_error(ER_BINLOG_NON_SUPPORTED_BULK, MYF(0)); + DBUG_PRINT("info", + ("decision: no logging since an error was generated")); + DBUG_RETURN(-1); + } + } /* Compute one bit field with the union of all the engine capabilities, and one with the intersection of all the engine @@ -5834,9 +5713,11 @@ int THD::decide_logging_format(TABLE_LIST *tables) { static const char *prelocked_mode_name[] = { "NON_PRELOCKED", + "LOCK_TABLES", "PRELOCKED", "PRELOCKED_UNDER_LOCK_TABLES", }; + compile_time_assert(array_elements(prelocked_mode_name) == LTM_always_last); DBUG_PRINT("debug", ("prelocked_mode: %s", prelocked_mode_name[locked_tables_mode])); } @@ -5885,7 +5766,8 @@ int THD::decide_logging_format(TABLE_LIST *tables) replicated_tables_count++; - if (table->lock_type <= TL_READ_NO_INSERT) + if (table->lock_type <= TL_READ_NO_INSERT && + table->prelocking_placeholder != TABLE_LIST::FK) has_read_tables= true; else if (table->table->found_next_number_field && (table->lock_type >= TL_WRITE_ALLOW_WRITE)) @@ -6024,7 +5906,7 @@ int THD::decide_logging_format(TABLE_LIST *tables) */ my_error((error= ER_BINLOG_ROW_INJECTION_AND_STMT_ENGINE), MYF(0)); } - else if (wsrep_binlog_format() == BINLOG_FORMAT_ROW && + else if ((wsrep_binlog_format() == BINLOG_FORMAT_ROW || is_bulk_op()) && sqlcom_can_generate_row_events(this)) { /* @@ -6097,7 +5979,8 @@ int THD::decide_logging_format(TABLE_LIST *tables) else { if (lex->is_stmt_unsafe() || lex->is_stmt_row_injection() - || (flags_write_all_set & HA_BINLOG_STMT_CAPABLE) == 0) + || (flags_write_all_set & HA_BINLOG_STMT_CAPABLE) == 0 || + is_bulk_op()) { /* log in row format! */ set_current_stmt_binlog_format_row_if_mixed(); @@ -6438,7 +6321,14 @@ int THD::binlog_write_row(TABLE* table, bool is_trans, if (variables.option_bits & OPTION_GTID_BEGIN) is_trans= 1; - Rows_log_event* const ev= + Rows_log_event* ev; + if (binlog_should_compress(len)) + ev = + binlog_prepare_pending_rows_event(table, variables.server_id, + len, is_trans, + static_cast(0)); + else + ev = binlog_prepare_pending_rows_event(table, variables.server_id, len, is_trans, static_cast(0)); @@ -6486,8 +6376,15 @@ int THD::binlog_update_row(TABLE* table, bool is_trans, DBUG_DUMP("after_row", after_row, after_size); #endif - Rows_log_event* const ev= - binlog_prepare_pending_rows_event(table, variables.server_id, + Rows_log_event* ev; + if(binlog_should_compress(before_size + after_size)) + ev = + binlog_prepare_pending_rows_event(table, variables.server_id, + before_size + after_size, is_trans, + static_cast(0)); + else + ev = + binlog_prepare_pending_rows_event(table, variables.server_id, before_size + after_size, is_trans, static_cast(0)); @@ -6539,8 +6436,15 @@ int THD::binlog_delete_row(TABLE* table, bool is_trans, if (variables.option_bits & OPTION_GTID_BEGIN) is_trans= 1; - Rows_log_event* const ev= - binlog_prepare_pending_rows_event(table, variables.server_id, + Rows_log_event* ev; + if(binlog_should_compress(len)) + ev = + binlog_prepare_pending_rows_event(table, variables.server_id, + len, is_trans, + static_cast(0)); + else + ev = + binlog_prepare_pending_rows_event(table, variables.server_id, len, is_trans, static_cast(0)); @@ -7005,15 +6909,27 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg, flush the pending rows event if necessary. */ { - Query_log_event qinfo(this, query_arg, query_len, is_trans, direct, - suppress_use, errcode); + int error = 0; + /* Binlog table maps will be irrelevant after a Query_log_event (they are just removed on the slave side) so after the query log event is written to the binary log, we pretend that no table maps were written. - */ - int error= mysql_bin_log.write(&qinfo); + */ + if(binlog_should_compress(query_len)) + { + Query_compressed_log_event qinfo(this, query_arg, query_len, is_trans, direct, + suppress_use, errcode); + error= mysql_bin_log.write(&qinfo); + } + else + { + Query_log_event qinfo(this, query_arg, query_len, is_trans, direct, + suppress_use, errcode); + error= mysql_bin_log.write(&qinfo); + } + binlog_table_maps= 0; DBUG_RETURN(error); } diff --git a/sql/sql_class.h b/sql/sql_class.h index 994a161a646..ef10d7e4053 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -201,6 +201,99 @@ typedef struct st_user_var_events bool unsigned_flag; } BINLOG_USER_VAR_EVENT; + +/* + When updating a table with virtual BLOB columns, the following might happen: + - an old record is read from the table, it has no vcol blob. + - update_virtual_fields() is run, vcol blob gets its value into the + record. But only a pointer to the value is in the table->record[0], + the value is in Field_blob::value String (or, it can be elsewhere!) + - store_record(table,record[1]), old record now is in record[1] + - fill_record() prepares new values in record[0], vcol blob is updated, + new value replaces the old one in the Field_blob::value + - now both record[1] and record[0] have a pointer that points to the + *new* vcol blob value. Or record[1] has a pointer to nowhere if + Field_blob::value had to realloc. + + To resolve this we unlink vcol blobs from the pointer to the + data (in the record[1]). The orphan memory must be freed manually + (but, again, only if it was owned by Field_blob::value String). + + With REPLACE and INSERT ... ON DUP KEY UPATE it's even more complex. + There is no store_record(table,record[1]), instead the row is read + directly into record[1]. +*/ +struct BLOB_VALUE_ORPHANAGE { + MY_BITMAP map; + TABLE *table; + BLOB_VALUE_ORPHANAGE() { map.bitmap= NULL; } + ~BLOB_VALUE_ORPHANAGE() { free(); } + bool init(TABLE *table_arg) + { + table= table_arg; + if (table->s->virtual_fields && table->s->blob_fields) + return bitmap_init(&map, NULL, table->s->virtual_fields, FALSE); + map.bitmap= NULL; + return 0; + } + void free() { bitmap_free(&map); } + + /** Remove blob's ownership from blob value memory + + @note the memory becomes orphaned, it needs to be freed using + free_orphans() or re-attached back to blobs using adopt_orphans() + */ + void make_orphans() + { + DBUG_ASSERT(!table || !table->s->virtual_fields || !table->s->blob_fields || map.bitmap); + if (!map.bitmap) + return; + for (Field **ptr=table->vfield; *ptr; ptr++) + { + Field_blob *vb= (Field_blob*)(*ptr); + if (!(vb->flags & BLOB_FLAG) || !vb->owns_ptr(vb->get_ptr())) + continue; + bitmap_set_bit(&map, ptr - table->vfield); + vb->clear_temporary(); + } + } + + /** Frees orphaned blob values + + @note It is assumed that value pointers are in table->record[1], while + Field_blob::ptr's point to table->record[0] as usual + */ + void free_orphans() + { + DBUG_ASSERT(!table || !table->s->virtual_fields || !table->s->blob_fields || map.bitmap); + if (!map.bitmap) + return; + for (Field **ptr=table->vfield; *ptr; ptr++) + { + Field_blob *vb= (Field_blob*)(*ptr); + if (vb->flags & BLOB_FLAG && bitmap_fast_test_and_clear(&map, ptr - table->vfield)) + my_free(vb->get_ptr(table->s->rec_buff_length)); + } + DBUG_ASSERT(bitmap_is_clear_all(&map)); + } + + /** Restores blob's ownership over previously orphaned values */ + void adopt_orphans() + { + DBUG_ASSERT(!table || !table->s->virtual_fields || !table->s->blob_fields || map.bitmap); + if (!map.bitmap) + return; + for (Field **ptr=table->vfield; *ptr; ptr++) + { + Field_blob *vb= (Field_blob*)(*ptr); + if (vb->flags & BLOB_FLAG && bitmap_fast_test_and_clear(&map, ptr - table->vfield)) + vb->own_value_ptr(); + } + DBUG_ASSERT(bitmap_is_clear_all(&map)); + } +}; + + /* The COPY_INFO structure is used by INSERT/REPLACE code. The schema of the row counting by the INSERT/INSERT ... ON DUPLICATE KEY @@ -213,7 +306,7 @@ typedef struct st_user_var_events of the INSERT ... ON DUPLICATE KEY UPDATE no matter whether the row was actually changed or not. */ -typedef struct st_copy_info { +struct COPY_INFO { ha_rows records; /**< Number of processed records */ ha_rows deleted; /**< Number of deleted records */ ha_rows updated; /**< Number of updated records */ @@ -229,7 +322,8 @@ typedef struct st_copy_info { /* for VIEW ... WITH CHECK OPTION */ TABLE_LIST *view; TABLE_LIST *table_list; /* Normal table */ -} COPY_INFO; + BLOB_VALUE_ORPHANAGE vblobs0, vblobs1; // vcol blobs of record[0] and record[1] +}; class Key_part_spec :public Sql_alloc { @@ -352,8 +446,6 @@ class Foreign_key: public Key { public: enum fk_match_opt { FK_MATCH_UNDEF, FK_MATCH_FULL, FK_MATCH_PARTIAL, FK_MATCH_SIMPLE}; - enum fk_option { FK_OPTION_UNDEF, FK_OPTION_RESTRICT, FK_OPTION_CASCADE, - FK_OPTION_SET_NULL, FK_OPTION_NO_ACTION, FK_OPTION_DEFAULT}; LEX_STRING ref_db; LEX_STRING ref_table; @@ -1280,7 +1372,8 @@ enum enum_locked_tables_mode LTM_NONE= 0, LTM_LOCK_TABLES, LTM_PRELOCKED, - LTM_PRELOCKED_UNDER_LOCK_TABLES + LTM_PRELOCKED_UNDER_LOCK_TABLES, + LTM_always_last }; /** @@ -1530,7 +1623,8 @@ enum enum_thread_type SYSTEM_THREAD_EVENT_SCHEDULER= 8, SYSTEM_THREAD_EVENT_WORKER= 16, SYSTEM_THREAD_BINLOG_BACKGROUND= 32, - SYSTEM_THREAD_SLAVE_BACKGROUND= 64 + SYSTEM_THREAD_SLAVE_BACKGROUND= 64, + SYSTEM_THREAD_GENERIC= 128 }; inline char const * @@ -1651,6 +1745,30 @@ private: }; +/** + Internal error handler to process an error from MDL_context::upgrade_lock() + and mysql_lock_tables(). Used by implementations of HANDLER READ and + LOCK TABLES LOCAL. +*/ + +class MDL_deadlock_and_lock_abort_error_handler: public Internal_error_handler +{ +public: + virtual + bool handle_condition(THD *thd, + uint sql_errno, + const char *sqlstate, + Sql_condition::enum_warning_level level, + const char* msg, + Sql_condition **cond_hdl); + + bool need_reopen() const { return m_need_reopen; }; + void init() { m_need_reopen= FALSE; }; +private: + bool m_need_reopen; +}; + + /** Tables that were locked with LOCK TABLES statement. @@ -1991,14 +2109,14 @@ private: void dec_thread_count(void) { DBUG_ASSERT(thread_count > 0); - thread_safe_decrement32(const_cast(&thread_count)); + thread_safe_decrement32(&thread_count); signal_thd_deleted(); } void inc_thread_count(void) { - thread_safe_increment32(const_cast(&thread_count)); + thread_safe_increment32(&thread_count); } public: @@ -2463,6 +2581,8 @@ public: */ Query_arena *stmt_arena; + void *bulk_param; + /* map for tables that will be updated for a multi-table update query statement, for other query statements, this will be zero. @@ -3438,6 +3558,12 @@ public: To raise this flag, use my_error(). */ inline bool is_error() const { return m_stmt_da->is_error(); } + void set_bulk_execution(void *bulk) + { + bulk_param= bulk; + m_stmt_da->set_bulk_execution(MY_TEST(bulk)); + } + bool is_bulk_op() const { return MY_TEST(bulk_param); } /// Returns Diagnostics-area for the current statement. Diagnostics_area *get_stmt_da() @@ -4384,7 +4510,7 @@ protected: /* All descendant classes have their send_data() skip the first unit->offset_limit_cnt rows sent. Select_materialize - also uses unit->get_unit_column_types(). + also uses unit->get_column_types(). */ SELECT_LEX_UNIT *unit; /* Something used only by the parser: */ @@ -4447,6 +4573,9 @@ public: #endif virtual void update_used_tables() {} + /* this method is called just before the first row of the table can be read */ + virtual void prepare_to_read_rows() {} + void reset_offset_limit() { unit->offset_limit_cnt= 0; @@ -5293,11 +5422,9 @@ public: int do_deletes(); int do_table_deletes(TABLE *table, SORT_INFO *sort_info, bool ignore); bool send_eof(); - inline ha_rows num_deleted() - { - return deleted; - } + inline ha_rows num_deleted() const { return deleted; } virtual void abort_result_set(); + void prepare_to_read_rows(); }; @@ -5308,6 +5435,7 @@ class multi_update :public select_result_interceptor TABLE_LIST *update_tables, *table_being_updated; TABLE **tmp_tables, *main_table, *table_to_update; TMP_TABLE_PARAM *tmp_table_param; + BLOB_VALUE_ORPHANAGE *vblobs; ha_rows updated, found; List *fields, *values; List **fields_for_table, **values_for_table; @@ -5341,16 +5469,11 @@ public: bool initialize_tables (JOIN *join); int do_updates(); bool send_eof(); - inline ha_rows num_found() - { - return found; - } - inline ha_rows num_updated() - { - return updated; - } + inline ha_rows num_found() const { return found; } + inline ha_rows num_updated() const { return updated; } virtual void abort_result_set(); void update_used_tables(); + void prepare_to_read_rows(); }; class my_var : public Sql_alloc { @@ -5510,6 +5633,15 @@ public: */ #define CF_UPDATES_DATA (1U << 18) +/** + SP Bulk execution safe +*/ +#define CF_SP_BULK_SAFE (1U << 19) +/** + SP Bulk execution optimized +*/ +#define CF_SP_BULK_OPTIMIZED (1U << 20) + /* Bits in server_command_flags */ /** @@ -5681,6 +5813,12 @@ void thd_exit_cond(MYSQL_THD thd, const PSI_stage_info *stage, #define THD_EXIT_COND(P1, P2) \ thd_exit_cond(P1, P2, __func__, __FILE__, __LINE__) +inline bool binlog_should_compress(ulong len) +{ + return opt_bin_log_compress && + len >= opt_bin_log_compress_min_len; +} + #endif /* MYSQL_SERVER */ #endif /* SQL_CLASS_INCLUDED */ diff --git a/sql/sql_cmd.h b/sql/sql_cmd.h index 92b74bb88ab..e33f8e443dc 100644 --- a/sql/sql_cmd.h +++ b/sql/sql_cmd.h @@ -95,6 +95,7 @@ enum enum_sql_command { SQLCOM_SHOW_GENERIC, SQLCOM_ALTER_USER, SQLCOM_SHOW_CREATE_USER, + SQLCOM_EXECUTE_IMMEDIATE, /* When a command is added here, be sure it's also added in mysqld.cc diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc index 7e98a9bd1ff..a4ceae52e5e 100644 --- a/sql/sql_cte.cc +++ b/sql/sql_cte.cc @@ -1121,17 +1121,6 @@ bool With_element::check_unrestricted_recursive(st_select_lex *sel, { if(!tbl->is_with_table()) { - if (tbl->is_materialized_derived()) - { - table_map dep_map; - check_dependencies_in_unit(unit, NULL, false, &dep_map); - if (dep_map & get_elem_map()) - { - my_error(ER_REF_TO_RECURSIVE_WITH_TABLE_IN_DERIVED, - MYF(0), query_name->str); - return true; - } - } if (check_unrestricted_recursive(unit->first_select(), unrestricted, encountered)) diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc index 7ecce8a8da3..118c6f23cb0 100644 --- a/sql/sql_cursor.cc +++ b/sql/sql_cursor.cc @@ -433,7 +433,7 @@ void Materialized_cursor::on_table_fill_finished() bool Select_materialize::send_result_set_metadata(List &list, uint flags) { DBUG_ASSERT(table == 0); - if (create_result_table(unit->thd, unit->get_unit_column_types(), + if (create_result_table(unit->thd, unit->get_column_types(true), FALSE, thd->variables.option_bits | TMP_TABLE_ALL_COLUMNS, "", FALSE, TRUE, TRUE)) diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 20538fe1fb4..8b7d4ee5ed2 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -815,7 +815,7 @@ static bool mysql_rm_db_internal(THD *thd,char *db, bool if_exists, bool silent) { ulong deleted_tables= 0; - bool error= true; + bool error= true, rm_mysql_schema; char path[FN_REFLEN + 16]; MY_DIR *dirp; uint length; @@ -840,6 +840,18 @@ mysql_rm_db_internal(THD *thd,char *db, bool if_exists, bool silent) length= build_table_filename(path, sizeof(path) - 1, db, "", "", 0); strmov(path+length, MY_DB_OPT_FILE); // Append db option file name del_dbopt(path); // Remove dboption hash entry + /* + Now remove the db.opt file. + The 'find_db_tables_and_rm_known_files' doesn't remove this file + if there exists a table with the name 'db', so let's just do it + separately. We know this file exists and needs to be deleted anyway. + */ + if (my_delete_with_symlink(path, MYF(0)) && my_errno != ENOENT) + { + my_error(EE_DELETE, MYF(0), path, my_errno); + DBUG_RETURN(true); + } + path[length]= '\0'; // Remove file name /* See if the directory exists */ @@ -867,7 +879,8 @@ mysql_rm_db_internal(THD *thd,char *db, bool if_exists, bool silent) Disable drop of enabled log tables, must be done before name locking. This check is only needed if we are dropping the "mysql" database. */ - if ((my_strcasecmp(system_charset_info, MYSQL_SCHEMA_NAME.str, db) == 0)) + if ((rm_mysql_schema= + (my_strcasecmp(system_charset_info, MYSQL_SCHEMA_NAME.str, db) == 0))) { for (table= tables; table; table= table->next_local) if (check_if_log_table(table, TRUE, "DROP")) @@ -880,7 +893,7 @@ mysql_rm_db_internal(THD *thd,char *db, bool if_exists, bool silent) lock_db_routines(thd, dbnorm)) goto exit; - if (!in_bootstrap) + if (!in_bootstrap && !rm_mysql_schema) { for (table= tables; table; table= table->next_local) { @@ -921,10 +934,13 @@ mysql_rm_db_internal(THD *thd,char *db, bool if_exists, bool silent) ha_drop_database(path); tmp_disable_binlog(thd); query_cache_invalidate1(thd, dbnorm); - (void) sp_drop_db_routines(thd, dbnorm); /* @todo Do not ignore errors */ + if (!rm_mysql_schema) + { + (void) sp_drop_db_routines(thd, dbnorm); /* @todo Do not ignore errors */ #ifdef HAVE_EVENT_SCHEDULER - Events::drop_schema_events(thd, dbnorm); + Events::drop_schema_events(thd, dbnorm); #endif + } reenable_binlog(thd); /* diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 4f9afca2f6d..e9a3be30060 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -561,9 +561,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, { explain->tracker.on_record_read(); if (table->vfield) - update_virtual_fields(thd, table, - table->triggers ? VCOL_UPDATE_ALL : - VCOL_UPDATE_FOR_READ); + table->update_virtual_fields(VCOL_UPDATE_FOR_WRITE); thd->inc_examined_row_count(1); // thd->is_error() is tested to disallow delete row on error if (!select || select->skip_record(thd) > 0) @@ -926,6 +924,15 @@ multi_delete::prepare(List &values, SELECT_LEX_UNIT *u) DBUG_RETURN(0); } +void multi_delete::prepare_to_read_rows() +{ + /* see multi_update::prepare_to_read_rows() */ + for (TABLE_LIST *walk= delete_tables; walk; walk= walk->next_local) + { + TABLE_LIST *tbl= walk->correspondent_table->find_table_for_update(); + tbl->table->mark_columns_needed_for_delete(); + } +} bool multi_delete::initialize_tables(JOIN *join) @@ -955,7 +962,6 @@ multi_delete::initialize_tables(JOIN *join) } } - walk= delete_tables; for (JOIN_TAB *tab= first_linear_tab(join, WITHOUT_BUSH_ROOTS, @@ -979,7 +985,6 @@ multi_delete::initialize_tables(JOIN *join) normal_tables= 1; tbl->prepare_triggers_for_delete_stmt_or_event(); tbl->prepare_for_position(); - tbl->mark_columns_needed_for_delete(); } else if ((tab->type != JT_SYSTEM && tab->type != JT_CONST) && walk == delete_tables) diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 0b67b952056..daac90d56f6 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -713,6 +713,7 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived) } unit->derived= derived; + derived->fill_me= FALSE; if (!(derived->derived_result= new (thd->mem_root) select_union(thd))) DBUG_RETURN(TRUE); // out of memory @@ -1195,8 +1196,9 @@ bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived) (uchar*) sl); if (extracted_cond_copy) { - extracted_cond_copy->walk(&Item::cleanup_processor, 0, 0); - sl->cond_pushed_into_where= extracted_cond_copy; + extracted_cond_copy->walk( + &Item::cleanup_excluding_const_fields_processor, 0, 0); + sl->cond_pushed_into_where= extracted_cond_copy; } continue; @@ -1229,8 +1231,9 @@ bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived) has been pushed into the where clause of sl */ extracted_cond_copy= remove_pushed_top_conjuncts(thd, extracted_cond_copy); - - cond_over_grouping_fields->walk(&Item::cleanup_processor, 0, 0); + + cond_over_grouping_fields->walk( + &Item::cleanup_excluding_const_fields_processor, 0, 0); sl->cond_pushed_into_where= cond_over_grouping_fields; if (!extracted_cond_copy) diff --git a/sql/sql_error.cc b/sql/sql_error.cc index 1d234c578e3..d14c7b83b77 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -320,7 +320,7 @@ Sql_condition::set_sqlstate(const char* sqlstate) } Diagnostics_area::Diagnostics_area(bool initialize) - : m_main_wi(0, false, initialize) + : is_bulk_execution(0), m_main_wi(0, false, initialize) { push_warning_info(&m_main_wi); @@ -330,7 +330,8 @@ Diagnostics_area::Diagnostics_area(bool initialize) Diagnostics_area::Diagnostics_area(ulonglong warning_info_id, bool allow_unlimited_warnings, bool initialize) - : m_main_wi(warning_info_id, allow_unlimited_warnings, initialize) + : is_bulk_execution(0), + m_main_wi(warning_info_id, allow_unlimited_warnings, initialize) { push_warning_info(&m_main_wi); @@ -376,22 +377,33 @@ Diagnostics_area::set_ok_status(ulonglong affected_rows, const char *message) { DBUG_ENTER("set_ok_status"); - DBUG_ASSERT(! is_set()); + DBUG_ASSERT(!is_set() || (m_status == DA_OK_BULK && is_bulk_op())); /* In production, refuse to overwrite an error or a custom response with an OK packet. */ if (is_error() || is_disabled()) return; - - m_statement_warn_count= current_statement_warn_count(); - m_affected_rows= affected_rows; + /* + When running a bulk operation, m_status will be DA_OK for the first + operation and set to DA_OK_BULK for all following operations. + */ + if (m_status == DA_OK_BULK) + { + m_statement_warn_count+= current_statement_warn_count(); + m_affected_rows+= affected_rows; + } + else + { + m_statement_warn_count= current_statement_warn_count(); + m_affected_rows= affected_rows; + m_status= (is_bulk_op() ? DA_OK_BULK : DA_OK); + } m_last_insert_id= last_insert_id; if (message) strmake_buf(m_message, message); else m_message[0]= '\0'; - m_status= DA_OK; DBUG_VOID_RETURN; } diff --git a/sql/sql_error.h b/sql/sql_error.h index 8fb1abacf2b..aa8e6c6b0f3 100644 --- a/sql/sql_error.h +++ b/sql/sql_error.h @@ -658,6 +658,8 @@ public: DA_OK, /** Set whenever one calls my_eof(). */ DA_EOF, + /** Set whenever one calls my_ok() in PS bulk mode. */ + DA_OK_BULK, /** Set whenever one calls my_error() or my_message(). */ DA_ERROR, /** Set in case of a custom response, such as one from COM_STMT_PREPARE. */ @@ -699,13 +701,21 @@ public: bool is_disabled() const { return m_status == DA_DISABLED; } + void set_bulk_execution(bool bulk) { is_bulk_execution= bulk; } + + bool is_bulk_op() const { return is_bulk_execution; } + enum_diagnostics_status status() const { return m_status; } const char *message() const - { DBUG_ASSERT(m_status == DA_ERROR || m_status == DA_OK); return m_message; } + { DBUG_ASSERT(m_status == DA_ERROR || m_status == DA_OK || + m_status == DA_OK_BULK); return m_message; } bool skip_flush() const - { DBUG_ASSERT(m_status == DA_OK); return m_skip_flush; } + { + DBUG_ASSERT(m_status == DA_OK || m_status == DA_OK_BULK); + return m_skip_flush; + } void set_skip_flush() { m_skip_flush= TRUE; } @@ -717,14 +727,21 @@ public: { DBUG_ASSERT(m_status == DA_ERROR); return m_sqlstate; } ulonglong affected_rows() const - { DBUG_ASSERT(m_status == DA_OK); return m_affected_rows; } + { + DBUG_ASSERT(m_status == DA_OK || m_status == DA_OK_BULK); + return m_affected_rows; + } ulonglong last_insert_id() const - { DBUG_ASSERT(m_status == DA_OK); return m_last_insert_id; } + { + DBUG_ASSERT(m_status == DA_OK || m_status == DA_OK_BULK); + return m_last_insert_id; + } uint statement_warn_count() const { - DBUG_ASSERT(m_status == DA_OK || m_status == DA_EOF); + DBUG_ASSERT(m_status == DA_OK || m_status == DA_OK_BULK || + m_status == DA_EOF); return m_statement_warn_count; } @@ -907,6 +924,8 @@ private: enum_diagnostics_status m_status; + my_bool is_bulk_execution; + Warning_info m_main_wi; Warning_info_list m_wi_stack; diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 95417c73c74..58db104ec96 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -282,7 +282,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, SQL_HANDLER *reopen) back-off for such locks. */ tables->mdl_request.init(MDL_key::TABLE, tables->db, tables->table_name, - MDL_SHARED, MDL_TRANSACTION); + MDL_SHARED_READ, MDL_TRANSACTION); mdl_savepoint= thd->mdl_context.mdl_savepoint(); /* for now HANDLER can be used only for real TABLES */ @@ -485,56 +485,6 @@ bool mysql_ha_close(THD *thd, TABLE_LIST *tables) } -/** - A helper class to process an error from mysql_lock_tables(). - HANDLER READ statement's attempt to lock the subject table - may get aborted if there is a pending DDL. In that case - we close the table, reopen it, and try to read again. - This is implicit and obscure, since HANDLER position - is lost in the process, but it's the legacy server - behaviour we should preserve. -*/ - -class Sql_handler_lock_error_handler: public Internal_error_handler -{ -public: - virtual - bool handle_condition(THD *thd, - uint sql_errno, - const char *sqlstate, - Sql_condition::enum_warning_level level, - const char* msg, - Sql_condition **cond_hdl); - - bool need_reopen() const { return m_need_reopen; }; - void init() { m_need_reopen= FALSE; }; -private: - bool m_need_reopen; -}; - - -/** - Handle an error from mysql_lock_tables(). - Ignore ER_LOCK_ABORTED errors. -*/ - -bool -Sql_handler_lock_error_handler:: -handle_condition(THD *thd, - uint sql_errno, - const char *sqlstate, - Sql_condition::enum_warning_level level, - const char* msg, - Sql_condition **cond_hdl) -{ - *cond_hdl= NULL; - if (sql_errno == ER_LOCK_ABORTED) - m_need_reopen= TRUE; - - return m_need_reopen; -} - - /** Finds an open HANDLER table. @@ -731,7 +681,7 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables, int error, keyno; uint num_rows; uchar *UNINIT_VAR(key); - Sql_handler_lock_error_handler sql_handler_lock_error; + MDL_deadlock_and_lock_abort_error_handler sql_handler_lock_error; DBUG_ENTER("mysql_ha_read"); DBUG_PRINT("enter",("'%s'.'%s' as '%s'", tables->db, tables->table_name, tables->alias)); @@ -750,11 +700,12 @@ retry: tables->table= table; // This is used by fix_fields table->pos_in_table_list= tables; - if (handler->lock->lock_count > 0) + if (handler->lock->table_count > 0) { int lock_error; - handler->lock->locks[0]->type= handler->lock->locks[0]->org_type; + if (handler->lock->lock_count > 0) + handler->lock->locks[0]->type= handler->lock->locks[0]->org_type; /* save open_tables state */ TABLE* backup_open_tables= thd->open_tables; @@ -928,9 +879,6 @@ retry: } goto ok; } - /* Generate values for virtual fields */ - if (table->vfield) - update_virtual_fields(thd, table); if (cond && !cond->val_int()) { if (thd->is_error()) diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 1abfd5925b8..9c21cb74802 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -77,6 +77,8 @@ #include "transaction.h" #include "sql_audit.h" #include "sql_derived.h" // mysql_handle_derived +#include "sql_prepare.h" +#include #include "debug_sync.h" @@ -126,6 +128,14 @@ static bool check_view_single_update(List &fields, List *values, while ((item= it++)) tables|= item->used_tables(); + /* + Check that table is only one + (we can not rely on check_single_table because it skips some + types of tables) + */ + if (my_count_bits(tables) > 1) + goto error; + if (values) { it.init(*values); @@ -661,7 +671,9 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, bool using_bulk_insert= 0; uint value_count; ulong counter = 1; + ulong iteration= 0; ulonglong id; + ulong bulk_iterations= bulk_parameters_iterations(thd); COPY_INFO info; TABLE *table= 0; List_iterator_fast its(values_list); @@ -725,8 +737,11 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, THD_STAGE_INFO(thd, stage_init); thd->lex->used_tables=0; values= its++; + if (bulk_parameters_set(thd)) + DBUG_RETURN(TRUE); value_count= values->elements; + DBUG_ASSERT(bulk_iterations > 0); if (mysql_prepare_insert(thd, table_list, table, fields, values, update_fields, update_values, duplic, &unused_conds, FALSE, @@ -797,6 +812,11 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, info.update_values= &update_values; info.view= (table_list->view ? table_list : 0); info.table_list= table_list; + if (duplic != DUP_ERROR) + { + info.vblobs0.init(table); + info.vblobs1.init(table); + } /* Count warnings for all inserts. @@ -885,106 +905,109 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, goto values_loop_end; } } - - while ((values= its++)) + do { - if (fields.elements || !value_count) - { - /* - There are possibly some default values: - INSERT INTO t1 (fields) VALUES ... - INSERT INTO t1 VALUES () - */ - restore_record(table,s->default_values); // Get empty record - table->reset_default_fields(); - if (fill_record_n_invoke_before_triggers(thd, table, fields, *values, 0, - TRG_EVENT_INSERT)) - { - if (values_list.elements != 1 && ! thd->is_error()) - { - info.records++; - continue; - } - /* - TODO: set thd->abort_on_warning if values_list.elements == 1 - and check that all items return warning in case of problem with - storing field. - */ - error=1; - break; - } - } - else - { - /* - No field list, all fields are set explicitly: - INSERT INTO t1 VALUES (values) - */ - if (thd->lex->used_tables) // Column used in values() - restore_record(table,s->default_values); // Get empty record - else - { - TABLE_SHARE *share= table->s; + if (iteration && bulk_parameters_set(thd)) + goto abort; + while ((values= its++)) + { + if (fields.elements || !value_count) + { /* - Fix delete marker. No need to restore rest of record since it will - be overwritten by fill_record() anyway (and fill_record() does not - use default values in this case). + There are possibly some default values: + INSERT INTO t1 (fields) VALUES ... + INSERT INTO t1 VALUES () */ -#ifdef HAVE_valgrind - if (table->file->ha_table_flags() && HA_RECORD_MUST_BE_CLEAN_ON_WRITE) - restore_record(table,s->default_values); // Get empty record - else -#endif - table->record[0][0]= share->default_values[0]; - - /* Fix undefined null_bits. */ - if (share->null_bytes > 1 && share->last_null_bit_pos) + restore_record(table,s->default_values); // Get empty record + table->reset_default_fields(); + if (fill_record_n_invoke_before_triggers(thd, table, fields, *values, 0, + TRG_EVENT_INSERT)) { - table->record[0][share->null_bytes - 1]= - share->default_values[share->null_bytes - 1]; + if (values_list.elements != 1 && ! thd->is_error()) + { + info.records++; + continue; + } + /* + TODO: set thd->abort_on_warning if values_list.elements == 1 + and check that all items return warning in case of problem with + storing field. + */ + error=1; + break; } } - if (fill_record_n_invoke_before_triggers(thd, table, table->field_to_fill(), - *values, 0, TRG_EVENT_INSERT)) + else { - if (values_list.elements != 1 && ! thd->is_error()) - { - info.records++; - continue; - } - error=1; - break; - } - } + /* + No field list, all fields are set explicitly: + INSERT INTO t1 VALUES (values) + */ + if (thd->lex->used_tables) // Column used in values() + restore_record(table,s->default_values); // Get empty record + else + { + TABLE_SHARE *share= table->s; - if ((res= table_list->view_check_option(thd, - (values_list.elements == 1 ? - 0 : - ignore))) == - VIEW_CHECK_SKIP) - continue; - else if (res == VIEW_CHECK_ERROR) - { - error= 1; - break; - } + /* + Fix delete marker. No need to restore rest of record since it will + be overwritten by fill_record() anyway (and fill_record() does not + use default values in this case). + */ + table->record[0][0]= share->default_values[0]; + + /* Fix undefined null_bits. */ + if (share->null_bytes > 1 && share->last_null_bit_pos) + { + table->record[0][share->null_bytes - 1]= + share->default_values[share->null_bytes - 1]; + } + } + if (fill_record_n_invoke_before_triggers(thd, table, + table->field_to_fill(), + *values, 0, TRG_EVENT_INSERT)) + { + if (values_list.elements != 1 && ! thd->is_error()) + { + info.records++; + continue; + } + error=1; + break; + } + } + + if ((res= table_list->view_check_option(thd, + (values_list.elements == 1 ? + 0 : + ignore))) == + VIEW_CHECK_SKIP) + continue; + else if (res == VIEW_CHECK_ERROR) + { + error= 1; + break; + } #ifndef EMBEDDED_LIBRARY - if (lock_type == TL_WRITE_DELAYED) - { - LEX_STRING const st_query = { query, thd->query_length() }; - DEBUG_SYNC(thd, "before_write_delayed"); - error=write_delayed(thd, table, duplic, st_query, ignore, log_on); - DEBUG_SYNC(thd, "after_write_delayed"); - query=0; - } - else + if (lock_type == TL_WRITE_DELAYED) + { + LEX_STRING const st_query = { query, thd->query_length() }; + DEBUG_SYNC(thd, "before_write_delayed"); + error=write_delayed(thd, table, duplic, st_query, ignore, log_on); + DEBUG_SYNC(thd, "after_write_delayed"); + query=0; + } + else #endif - error=write_record(thd, table ,&info); - if (error) - break; - thd->get_stmt_da()->inc_current_row_for_warning(); - } + error=write_record(thd, table ,&info); + if (error) + break; + thd->get_stmt_da()->inc_current_row_for_warning(); + } + its.rewind(); + iteration++; + } while (iteration < bulk_iterations); values_loop_end: free_underlaid_joins(thd, &thd->lex->select_lex); @@ -1131,7 +1154,7 @@ values_loop_end: retval= thd->lex->explain->send_explain(thd); goto abort; } - if (values_list.elements == 1 && (!(thd->variables.option_bits & OPTION_WARNINGS) || + if ((bulk_iterations * values_list.elements) == 1 && (!(thd->variables.option_bits & OPTION_WARNINGS) || !thd->cuted_fields)) { my_ok(thd, info.copied + info.deleted + @@ -1161,7 +1184,6 @@ values_loop_end: thd->lex->current_select->save_leaf_tables(thd); thd->lex->current_select->first_cond_optimization= 0; } - DBUG_RETURN(FALSE); abort: @@ -1495,8 +1517,6 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, if (!table) table= table_list->table; - if (table->s->virtual_stored_fields) - thd->lex->unit.insert_table_with_stored_vcol= table; if (!select_insert) { @@ -1673,6 +1693,15 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) HA_READ_KEY_EXACT)))) goto err; } + if (table->vfield) + { + info->vblobs0.make_orphans(); + table->move_fields(table->field, table->record[1], table->record[0]); + table->update_virtual_fields(VCOL_UPDATE_INDEXED); + info->vblobs1.make_orphans(); + table->move_fields(table->field, table->record[0], table->record[1]); + info->vblobs0.adopt_orphans(); + } if (info->handle_duplicates == DUP_UPDATE) { int res= 0; @@ -1832,6 +1861,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) trg_error= 1; goto ok_or_after_trg_err; } + info->vblobs1.free_orphans(); /* Let us attempt do write_row() once more */ } } @@ -1882,6 +1912,7 @@ ok_or_after_trg_err: my_safe_afree(key,table->s->max_unique_length); if (!table->file->has_transactions()) thd->transaction.stmt.modified_non_trans_table= TRUE; + info->vblobs1.free_orphans(); DBUG_RETURN(trg_error); err: @@ -1893,6 +1924,7 @@ before_trg_err: if (key) my_safe_afree(key, table->s->max_unique_length); table->column_bitmaps_set(save_read_set, save_write_set); + info->vblobs1.free_orphans(); DBUG_RETURN(1); } @@ -2316,6 +2348,12 @@ end_create: DBUG_RETURN(thd->is_error()); } +#define memdup_vcol(thd, vcol) \ + if (vcol) \ + { \ + (vcol)= (Virtual_column_info*)(thd)->memdup((vcol), sizeof(*(vcol))); \ + (vcol)->expr= NULL; \ + } /** As we can't let many client threads modify the same TABLE @@ -2337,7 +2375,6 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) { my_ptrdiff_t adjust_ptrs; Field **field,**org_field, *found_next_number_field; - Field **vfield= 0, **dfield_ptr= 0; TABLE *copy; TABLE_SHARE *share; uchar *bitmap; @@ -2400,14 +2437,6 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) if (!copy_tmp) goto error; - if (share->virtual_fields) - { - vfield= (Field **) client_thd->alloc((share->virtual_fields+1)* - sizeof(Field*)); - if (!vfield) - goto error; - } - /* Copy the TABLE object. */ copy= new (copy_tmp) TABLE; *copy= *table; @@ -2426,9 +2455,17 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) sizeof(Field*)); if (!copy->default_field) goto error; - dfield_ptr= copy->default_field; } + if (share->virtual_fields) + { + copy->vfield= (Field **) client_thd->alloc((share->virtual_fields+1)* + sizeof(Field*)); + if (!copy->vfield) + goto error; + } + copy->expr_arena= NULL; + /* Ensure we don't use the table list of the original table */ copy->pos_in_table_list= 0; @@ -2443,12 +2480,14 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) found_next_number_field= table->found_next_number_field; for (org_field= table->field; *org_field; org_field++, field++) { - if (!(*field= (*org_field)->make_new_field(client_thd->mem_root, copy, - 1))) + if (!(*field= (*org_field)->make_new_field(client_thd->mem_root, copy, 1))) goto error; (*field)->unireg_check= (*org_field)->unireg_check; (*field)->orig_table= copy; // Remove connection (*field)->move_field_offset(adjust_ptrs); // Point at copy->record[0] + memdup_vcol(client_thd, (*field)->vcol_info); + memdup_vcol(client_thd, (*field)->default_value); + memdup_vcol(client_thd, (*field)->check_constraint); if (*org_field == found_next_number_field) (*field)->table->found_next_number_field= *field; } @@ -2461,42 +2500,9 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) if (!(copy->def_vcol_set= (MY_BITMAP*) alloc_root(client_thd->mem_root, sizeof(MY_BITMAP)))) goto error; - copy->vfield= vfield; - for (field= copy->field; *field; field++) - { - Virtual_column_info *vcol; - if ((*field)->vcol_info) - { - if (!(vcol= unpack_vcol_info_from_frm(client_thd, - client_thd->mem_root, - copy, - 0, - (*field)->vcol_info, - &error_reported))) - goto error; - (*field)->vcol_info= vcol; - *vfield++= *field; - } - if ((*field)->default_value) - { - if (!(vcol= unpack_vcol_info_from_frm(client_thd, - client_thd->mem_root, - copy, - 0, - (*field)->default_value, - &error_reported))) - goto error; - (*field)->default_value= vcol; - *dfield_ptr++= *field; - } - else - if ((*field)->has_update_default_function()) - *dfield_ptr++= *field; - } - if (vfield) - *vfield= 0; - if (dfield_ptr) - *dfield_ptr= 0; + + if (parse_vcol_defs(client_thd, client_thd->mem_root, copy, &error_reported)) + goto error; } switch_defaults_to_nullable_trigger_fields(copy); @@ -3100,12 +3106,14 @@ static void free_delayed_insert_blobs(register TABLE *table) { for (Field **ptr=table->field ; *ptr ; ptr++) { - if ((*ptr)->flags & BLOB_FLAG) + Field_blob *f= (Field_blob*)(*ptr); + if (f->flags & BLOB_FLAG) { - uchar *str; - ((Field_blob *) (*ptr))->get_ptr(&str); - my_free(str); - ((Field_blob *) (*ptr))->reset(); + if (f->vcol_info) + f->free(); + else + my_free(f->get_ptr()); + f->reset(); } } } @@ -3127,6 +3135,9 @@ bool Delayed_insert::handle_inserts(void) table->next_number_field=table->found_next_number_field; table->use_all_columns(); + info.vblobs0.init(table); + info.vblobs1.init(table); + THD_STAGE_INFO(&thd, stage_upgrading_lock); if (thr_upgrade_write_delay_lock(*thd.lock->locks, delayed_lock, thd.variables.lock_wait_timeout)) @@ -3233,6 +3244,8 @@ bool Delayed_insert::handle_inserts(void) if (info.handle_duplicates == DUP_UPDATE) table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE); thd.clear_error(); // reset error for binlog + if (table->vfield) + table->update_virtual_fields(VCOL_UPDATE_FOR_WRITE); if (write_record(&thd, table, &info)) { info.error_count++; // Ignore errors @@ -3339,6 +3352,8 @@ bool Delayed_insert::handle_inserts(void) DBUG_PRINT("error", ("HA_EXTRA_NO_CACHE failed after loop")); goto err; } + info.vblobs0.free(); + info.vblobs1.free(); query_cache_invalidate3(&thd, table, 1); mysql_mutex_lock(&mutex); DBUG_RETURN(0); @@ -3347,6 +3362,8 @@ bool Delayed_insert::handle_inserts(void) #ifndef DBUG_OFF max_rows= 0; // For DBUG output #endif + info.vblobs0.free(); + info.vblobs1.free(); /* Remove all not used rows */ mysql_mutex_lock(&mutex); while ((row=rows.get())) @@ -3594,6 +3611,11 @@ select_insert::prepare(List &values, SELECT_LEX_UNIT *u) restore_record(table,s->default_values); // Get empty record table->reset_default_fields(); table->next_number_field=table->found_next_number_field; + if (info.handle_duplicates != DUP_ERROR) + { + info.vblobs0.init(table); + info.vblobs1.init(table); + } #ifdef HAVE_REPLICATION if (thd->rgi_slave && @@ -3998,7 +4020,6 @@ static TABLE *create_table_from_items(THD *thd, Item *item; DBUG_ENTER("create_table_from_items"); - tmp_table.alias= 0; tmp_table.s= &share; init_tmp_table_share(thd, &share, "", 0, "", ""); diff --git a/sql/sql_insert.h b/sql/sql_insert.h index cbfc1ea9dcd..5ec1846425d 100644 --- a/sql/sql_insert.h +++ b/sql/sql_insert.h @@ -21,7 +21,6 @@ /* Instead of including sql_lex.h we add this typedef here */ typedef List List_item; -typedef struct st_copy_info COPY_INFO; bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table, List &fields, List_item *values, diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc index d5883b1304e..b9d7f660a5a 100644 --- a/sql/sql_join_cache.cc +++ b/sql/sql_join_cache.cc @@ -1304,7 +1304,7 @@ uint JOIN_CACHE::write_record_data(uchar * link, bool *is_full) uint blob_len= blob_field->get_length(); (*copy_ptr)->blob_length= blob_len; len+= blob_len; - blob_field->get_ptr(&(*copy_ptr)->str); + (*copy_ptr)->str= blob_field->get_ptr(); } } } @@ -3371,7 +3371,6 @@ int JOIN_TAB_SCAN::next() int skip_rc; READ_RECORD *info= &join_tab->read_record; SQL_SELECT *select= join_tab->cache_select; - TABLE *table= join_tab->table; THD *thd= join->thd; if (is_first_record) @@ -3382,8 +3381,6 @@ int JOIN_TAB_SCAN::next() if (!err) { join_tab->tracker->r_rows++; - if (table->vfield) - update_virtual_fields(thd, table); } while (!err && select && (skip_rc= select->skip_record(thd)) <= 0) @@ -3398,8 +3395,6 @@ int JOIN_TAB_SCAN::next() if (!err) { join_tab->tracker->r_rows++; - if (table->vfield) - update_virtual_fields(thd, table); } } @@ -3923,8 +3918,6 @@ int JOIN_TAB_SCAN_MRR::next() DBUG_ASSERT(cache->buff <= (uchar *) (*ptr) && (uchar *) (*ptr) <= cache->end_pos); */ - if (join_tab->table->vfield) - update_virtual_fields(join->thd, join_tab->table); } return rc; } diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index c53daf7d92d..b2dd04d8fd5 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -196,7 +196,6 @@ init_lex_with_single_table(THD *thd, TABLE *table, LEX *lex) lex->context_analysis_only|= CONTEXT_ANALYSIS_ONLY_VCOL_EXPR; select_lex->cur_pos_in_select_list= UNDEF_POS; table->map= 1; //To ensure correct calculation of const item - table->get_fields_in_item_tree= TRUE; table_list->table= table; table_list->cacheable_table= false; return FALSE; @@ -1320,7 +1319,7 @@ static int lex_one_token(YYSTYPE *yylval, THD *thd) state= (enum my_lex_states) state_map[c]; break; case MY_LEX_ESCAPE: - if (lip->yyGet() == 'N') + if (!lip->eof() && lip->yyGet() == 'N') { // Allow \N as shortcut for NULL yylval->lex_str.str=(char*) "\\N"; yylval->lex_str.length=2; @@ -2075,7 +2074,6 @@ void st_select_lex_unit::init_query() item_list.empty(); describe= 0; found_rows_for_union= 0; - insert_table_with_stored_vcol= 0; derived= 0; is_view= false; with_clause= 0; @@ -2151,7 +2149,6 @@ void st_select_lex::init_select() in_sum_expr= with_wild= 0; options= 0; sql_cache= SQL_CACHE_UNSPECIFIED; - interval_list.empty(); ftfunc_list_alloc.empty(); inner_sum_func_list= 0; ftfunc_list= &ftfunc_list_alloc; @@ -3743,12 +3740,28 @@ bool st_select_lex::add_index_hint (THD *thd, char *str, uint length) bool st_select_lex::optimize_unflattened_subqueries(bool const_only) { - for (SELECT_LEX_UNIT *un= first_inner_unit(); un; un= un->next_unit()) + SELECT_LEX_UNIT *next_unit= NULL; + for (SELECT_LEX_UNIT *un= first_inner_unit(); + un; + un= next_unit ? next_unit : un->next_unit()) { Item_subselect *subquery_predicate= un->item; - + next_unit= NULL; + if (subquery_predicate) { + if (!subquery_predicate->fixed) + { + /* + This subquery was excluded as part of some expression so it is + invisible from all prepared expression. + */ + next_unit= un->next_unit(); + un->exclude_level(); + if (next_unit) + continue; + break; + } if (subquery_predicate->substype() == Item_subselect::IN_SUBS) { Item_in_subselect *in_subs= (Item_in_subselect*) subquery_predicate; @@ -4123,7 +4136,15 @@ void SELECT_LEX::update_used_tables() TABLE *tab= tl->table; tab->covering_keys= tab->s->keys_for_keyread; tab->covering_keys.intersect(tab->keys_in_use_for_query); - tab->merge_keys.clear_all(); + /* + View/derived was merged. Need to recalculate read_set/vcol_set + bitmaps here. For example: + CREATE VIEW v1 AS SELECT f1,f2,f3 FROM t1; + SELECT f1 FROM v1; + Initially, the view definition will put all f1,f2,f3 in the + read_set for t1. But after the view is merged, only f1 should + be in the read_set. + */ bitmap_clear_all(tab->read_set); if (tab->vcol_set) bitmap_clear_all(tab->vcol_set); diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 5310e2a018f..8f5deb8e7bd 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -246,11 +246,12 @@ struct LEX_MASTER_INFO ulong server_id; uint port, connect_retry; float heartbeat_period; + int sql_delay; /* Enum is used for making it possible to detect if the user changed variable or if it should be left at old value */ - enum {LEX_MI_UNCHANGED, LEX_MI_DISABLE, LEX_MI_ENABLE} + enum {LEX_MI_UNCHANGED= 0, LEX_MI_DISABLE, LEX_MI_ENABLE} ssl, ssl_verify_server_cert, heartbeat_opt, repl_ignore_server_ids_opt, repl_do_domain_ids_opt, repl_ignore_domain_ids_opt; enum { @@ -266,6 +267,7 @@ struct LEX_MASTER_INFO sizeof(ulong), 0, 16, MYF(0)); my_init_dynamic_array(&repl_ignore_domain_ids, sizeof(ulong), 0, 16, MYF(0)); + sql_delay= -1; } void reset(bool is_change_master) { @@ -286,6 +288,7 @@ struct LEX_MASTER_INFO repl_ignore_domain_ids_opt= LEX_MI_UNCHANGED; gtid_pos_str= null_lex_str; use_gtid_opt= LEX_GTID_UNCHANGED; + sql_delay= -1; } }; @@ -679,13 +682,6 @@ public: bool describe; /* union exec() called for EXPLAIN */ Procedure *last_procedure; /* Pointer to procedure, if such exists */ - /* - Insert table with stored virtual columns. - This is used only in those rare cases - when the list of inserted values is empty. - */ - TABLE *insert_table_with_stored_vcol; - bool columns_are_renamed; void init_query(); @@ -729,7 +725,7 @@ public: friend void lex_start(THD *thd); friend int subselect_union_engine::exec(); - List *get_unit_column_types(); + List *get_column_types(bool for_cursor); select_union *get_union_result() { return union_result; } int save_union_explain(Explain_query *output); @@ -785,7 +781,6 @@ public: Group_list_ptrs *group_list_ptrs; List item_list; /* list of fields & expressions */ - List interval_list; bool is_item_list_lookup; /* Usualy it is pointer to ftfunc_list_alloc, but in union used to create fake @@ -2680,8 +2675,8 @@ public: uint profile_options; uint grant, grant_tot_col, which_columns; enum Foreign_key::fk_match_opt fk_match_option; - enum Foreign_key::fk_option fk_update_opt; - enum Foreign_key::fk_option fk_delete_opt; + enum_fk_option fk_update_opt; + enum_fk_option fk_delete_opt; uint slave_thd_opt, start_transaction_opt; int nest_level; /* @@ -2720,15 +2715,10 @@ public: TABLE_LIST *create_last_non_select_table; /* Prepared statements SQL syntax:*/ LEX_STRING prepared_stmt_name; /* Statement name (in all queries) */ - /* - Prepared statement query text or name of variable that holds the - prepared statement (in PREPARE ... queries) - */ - LEX_STRING prepared_stmt_code; - /* If true, prepared_stmt_code is a name of variable that holds the query */ - bool prepared_stmt_code_is_varref; + /* PREPARE or EXECUTE IMMEDIATE source expression */ + Item *prepared_stmt_code; /* Names of user variables holding parameters (in EXECUTE) */ - List prepared_stmt_params; + List prepared_stmt_params; sp_head *sphead; sp_name *spname; bool sp_lex_in_use; /* Keep track on lex usage in SPs for error handling */ @@ -3006,6 +2996,20 @@ public: void init_last_field(Column_definition *field, const char *name, CHARSET_INFO *cs); void set_last_field_type(const Lex_field_type_st &type); bool set_bincmp(CHARSET_INFO *cs, bool bin); + + bool get_dynamic_sql_string(LEX_CSTRING *dst, String *buffer); + bool prepared_stmt_params_fix_fields(THD *thd) + { + // Fix Items in the EXECUTE..USING list + List_iterator_fast param_it(prepared_stmt_params); + while (Item *param= param_it++) + { + if (param->fix_fields(thd, 0) || param->check_cols(1)) + return true; + } + return false; + } + // Check if "KEY IF NOT EXISTS name" used outside of ALTER context bool check_add_key(DDL_options_st ddl) { diff --git a/sql/sql_load.cc b/sql/sql_load.cc index b1167534491..c25e73e7346 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -410,8 +410,6 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, table->prepare_triggers_for_insert_stmt_or_event(); table->mark_columns_needed_for_insert(); - if (table->s->virtual_stored_fields) - thd->lex->unit.insert_table_with_stored_vcol= table; uint tot_length=0; bool use_blobs= 0, use_vars= 0; @@ -539,6 +537,12 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, !(thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES))) ? (*escaped)[0] : INT_MAX; + if (handle_duplicates != DUP_ERROR) + { + info.vblobs0.init(table); + info.vblobs1.init(table); + } + READ_INFO read_info(thd, file, tot_length, ex->cs ? ex->cs : thd->variables.collation_database, *field_term,*ex->line_start, *ex->line_term, *enclosed, @@ -612,7 +616,8 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, *enclosed, skip_lines, ignore); thd_proc_info(thd, "End bulk insert"); - thd_progress_next_stage(thd); + if (!error) + thd_progress_next_stage(thd); if (thd->locked_tables_mode <= LTM_LOCK_TABLES && table->file->ha_end_bulk_insert() && !error) { @@ -881,7 +886,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, while ((sql_field= (Item_field*) it++)) { - if (table->field[sql_field->field->field_index] == table->next_number_field) + if (sql_field->field == table->next_number_field) auto_increment_field_not_null= true; } @@ -1521,6 +1526,54 @@ inline bool READ_INFO::terminator(const uchar *ptr, uint length) } +/** + Read a field. + + The data in the loaded file was presumably escaped using + - either select_export::send_data() OUTFILE + - or mysql_real_escape_string() + using the same character set with the one specified in the current + "LOAD DATA INFILE ... CHARACTER SET ..." (or the default LOAD character set). + + Note, non-escaped multi-byte characters are scanned as a single entity. + This is needed to correctly distinguish between: + - 0x5C as an escape character versus + - 0x5C as the second byte in a multi-byte sequence (big5, cp932, gbk, sjis) + + Parts of escaped multi-byte characters are scanned on different loop + iterations. See the comment about 0x5C handling in select_export::send_data() + in sql_class.cc. + + READ_INFO::read_field() does not check wellformedness. + Raising wellformedness errors or warnings in READ_INFO::read_field() + would be wrong, as the data after unescaping can go into a BLOB field, + or into a TEXT/VARCHAR field of a different character set. + The loop below only makes sure to revert escaping made by + select_export::send_data() or mysql_real_escape_string(). + Wellformedness is checked later, during Field::store(str,length,cs) time. + + Note, in some cases users can supply data which did not go through + escaping properly. For example, utf8 "\" + (backslash followed by LATIN SMALL LETTER A WITH DIAERESIS) + is improperly escaped data that could not be generated by + select_export::send_data() / mysql_real_escape_string(): + - either there should be two backslashes: "\\" + - or there should be no backslashes at all: "" + "\" and " are scanned on two different loop iterations and + store "" into the field. + + Note, adding useless escapes before multi-byte characters like in the + example above is safe in case of utf8, but is not safe in case of + character sets that have escape_with_backslash_is_dangerous==TRUE, + such as big5, cp932, gbk, sjis. This can lead to mis-interpretation of the + data. Suppose we have a big5 character "<5C>" followed by <30> (digit 0). + If we add an extra escape before this sequence, then we'll get + <5C><5C><30>. The first loop iteration will turn <5C> into . + The second loop iteration will turn <5C><30> into <30>. + So the program that generates a dump file for further use with LOAD DATA + must make sure to use escapes properly. +*/ + int READ_INFO::read_field() { int chr,found_enclosed_char; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index e415b275fff..6ddb5bc7995 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -570,17 +570,19 @@ void init_update_queries(void) CF_CAN_GENERATE_ROW_EVENTS | CF_OPTIMIZER_TRACE | CF_CAN_BE_EXPLAINED | - CF_UPDATES_DATA; + CF_UPDATES_DATA | CF_SP_BULK_SAFE; sql_command_flags[SQLCOM_UPDATE_MULTI]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE | CF_CAN_GENERATE_ROW_EVENTS | CF_OPTIMIZER_TRACE | CF_CAN_BE_EXPLAINED | - CF_UPDATES_DATA; + CF_UPDATES_DATA | CF_SP_BULK_SAFE; sql_command_flags[SQLCOM_INSERT]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE | CF_CAN_GENERATE_ROW_EVENTS | CF_OPTIMIZER_TRACE | CF_CAN_BE_EXPLAINED | - CF_INSERTS_DATA; + CF_INSERTS_DATA | + CF_SP_BULK_SAFE | + CF_SP_BULK_OPTIMIZED; sql_command_flags[SQLCOM_INSERT_SELECT]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE | CF_CAN_GENERATE_ROW_EVENTS | CF_OPTIMIZER_TRACE | @@ -598,7 +600,7 @@ void init_update_queries(void) CF_CAN_GENERATE_ROW_EVENTS | CF_OPTIMIZER_TRACE | CF_CAN_BE_EXPLAINED | - CF_INSERTS_DATA;; + CF_INSERTS_DATA | CF_SP_BULK_SAFE; sql_command_flags[SQLCOM_REPLACE_SELECT]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE | CF_CAN_GENERATE_ROW_EVENTS | CF_OPTIMIZER_TRACE | @@ -704,6 +706,7 @@ void init_update_queries(void) CF_CAN_GENERATE_ROW_EVENTS | CF_OPTIMIZER_TRACE; // (1) sql_command_flags[SQLCOM_EXECUTE]= CF_CAN_GENERATE_ROW_EVENTS; + sql_command_flags[SQLCOM_EXECUTE_IMMEDIATE]= CF_CAN_GENERATE_ROW_EVENTS; sql_command_flags[SQLCOM_COMPOUND]= CF_CAN_GENERATE_ROW_EVENTS; /* @@ -1082,20 +1085,11 @@ void do_handle_bootstrap(THD *thd) end: in_bootstrap= FALSE; delete thd; - if (!opt_bootstrap) - { - /* - We need to wake up main thread in case of read_init_file(). - This is not done by THD::~THD() when there are other threads running - (binlog background thread, for example). So do it here again. - */ - mysql_mutex_lock(&LOCK_thread_count); - mysql_cond_broadcast(&COND_thread_count); - mysql_mutex_unlock(&LOCK_thread_count); - } + mysql_mutex_lock(&LOCK_thread_count); + mysql_cond_broadcast(&COND_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); #ifndef EMBEDDED_LIBRARY - DBUG_ASSERT(!opt_bootstrap || thread_count == 0); my_thread_end(); pthread_exit(0); #endif @@ -2734,27 +2728,76 @@ bool sp_process_definer(THD *thd) static bool lock_tables_open_and_lock_tables(THD *thd, TABLE_LIST *tables) { Lock_tables_prelocking_strategy lock_tables_prelocking_strategy; + MDL_deadlock_and_lock_abort_error_handler deadlock_handler; + MDL_savepoint mdl_savepoint= thd->mdl_context.mdl_savepoint(); uint counter; TABLE_LIST *table; thd->in_lock_tables= 1; +retry: + if (open_tables(thd, &tables, &counter, 0, &lock_tables_prelocking_strategy)) goto err; - /* - We allow to change temporary tables even if they were locked for read - by LOCK TABLES. To avoid a discrepancy between lock acquired at LOCK - TABLES time and by the statement which is later executed under LOCK TABLES - we ensure that for temporary tables we always request a write lock (such - discrepancy can cause problems for the storage engine). - We don't set TABLE_LIST::lock_type in this case as this might result in - extra warnings from THD::decide_logging_format() even though binary logging - is totally irrelevant for LOCK TABLES. - */ for (table= tables; table; table= table->next_global) - if (!table->placeholder() && table->table->s->tmp_table) - table->table->reginfo.lock_type= TL_WRITE; + { + if (!table->placeholder()) + { + if (table->table->s->tmp_table) + { + /* + We allow to change temporary tables even if they were locked for read + by LOCK TABLES. To avoid a discrepancy between lock acquired at LOCK + TABLES time and by the statement which is later executed under LOCK + TABLES we ensure that for temporary tables we always request a write + lock (such discrepancy can cause problems for the storage engine). + We don't set TABLE_LIST::lock_type in this case as this might result + in extra warnings from THD::decide_logging_format() even though + binary logging is totally irrelevant for LOCK TABLES. + */ + table->table->reginfo.lock_type= TL_WRITE; + } + else if (table->mdl_request.type == MDL_SHARED_READ && + ! table->prelocking_placeholder && + table->table->file->lock_count() == 0) + { + /* + In case when LOCK TABLE ... READ LOCAL was issued for table with + storage engine which doesn't support READ LOCAL option and doesn't + use THR_LOCK locks we need to upgrade weak SR metadata lock acquired + in open_tables() to stronger SRO metadata lock. + This is not needed for tables used through stored routines or + triggers as we always acquire SRO (or even stronger SNRW) metadata + lock for them. + */ + deadlock_handler.init(); + thd->push_internal_handler(&deadlock_handler); + + bool result= thd->mdl_context.upgrade_shared_lock( + table->table->mdl_ticket, + MDL_SHARED_READ_ONLY, + thd->variables.lock_wait_timeout); + + thd->pop_internal_handler(); + + if (deadlock_handler.need_reopen()) + { + /* + Deadlock occurred during upgrade of metadata lock. + Let us restart acquring and opening tables for LOCK TABLES. + */ + close_tables_for_reopen(thd, &tables, mdl_savepoint); + if (thd->open_temporary_tables(tables)) + goto err; + goto retry; + } + + if (result) + goto err; + } + } + } if (lock_tables(thd, tables, counter, 0) || thd->locked_tables_list.init_locked_tables(thd)) @@ -3063,13 +3106,16 @@ mysql_execute_command(THD *thd) } /* - Bail out if DB snapshot has not been installed. We however, allow SET, - SHOW and SELECT queries (only if wsrep_dirty_reads is set). + Bail out if DB snapshot has not been installed. SET and SHOW commands, + however, are always allowed. + + We additionally allow all other commands that do not change data in + case wsrep_dirty_reads is enabled. */ if (lex->sql_command != SQLCOM_SET_OPTION && !wsrep_is_show_query(lex->sql_command) && !(thd->variables.wsrep_dirty_reads && - lex->sql_command == SQLCOM_SELECT) && + !is_update_query(lex->sql_command)) && !wsrep_node_is_ready(thd)) goto error; } @@ -3356,6 +3402,10 @@ mysql_execute_command(THD *thd) case SQLCOM_SHOW_STORAGE_ENGINES: case SQLCOM_SHOW_PROFILE: { +#ifdef WITH_WSREP + DBUG_ASSERT(thd->wsrep_exec_mode != REPL_RECV); +#endif /* WITH_WSREP */ + thd->status_var.last_query_cost= 0.0; /* @@ -3377,6 +3427,11 @@ mysql_execute_command(THD *thd) break; } + case SQLCOM_EXECUTE_IMMEDIATE: + { + mysql_sql_stmt_execute_immediate(thd); + break; + } case SQLCOM_PREPARE: { mysql_sql_stmt_prepare(thd); @@ -3677,12 +3732,6 @@ mysql_execute_command(THD *thd) create_info.table_charset= 0; } - /* - For CREATE TABLE we should not open the table even if it exists. - If the table exists, we should either not create it or replace it - */ - lex->query_tables->open_strategy= TABLE_LIST::OPEN_STUB; - /* If we are a slave, we should add OR REPLACE if we don't have IF EXISTS. This will help a slave to recover from @@ -4159,7 +4208,7 @@ end_with_restore_list: DBUG_ASSERT(select_lex->offset_limit == 0); unit->set_limit(select_lex); MYSQL_UPDATE_START(thd->query()); - res= (up_result= mysql_update(thd, all_tables, + res= up_result= mysql_update(thd, all_tables, select_lex->item_list, lex->value_list, select_lex->where, @@ -4167,7 +4216,7 @@ end_with_restore_list: select_lex->order_list.first, unit->select_limit_cnt, lex->duplicates, lex->ignore, - &found, &updated)); + &found, &updated); MYSQL_UPDATE_DONE(res, found, updated); /* mysql_update return 2 if we need to switch to multi-update */ if (up_result != 2) @@ -9395,12 +9444,6 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables, if (check_fk_parent_table_access(thd, &lex->create_info, &lex->alter_info, create_table->db)) goto err; - /* - For CREATE TABLE we should not open the table even if it exists. - If the table exists, we should either not create it or replace it - */ - lex->query_tables->open_strategy= TABLE_LIST::OPEN_STUB; - error= FALSE; err: @@ -9610,11 +9653,8 @@ bool check_string_char_length(LEX_STRING *str, uint err_msg, uint max_char_length, CHARSET_INFO *cs, bool no_error) { - int well_formed_error; - uint res= cs->cset->well_formed_len(cs, str->str, str->str + str->length, - max_char_length, &well_formed_error); - - if (!well_formed_error && str->length == res) + Well_formed_prefix prefix(cs, str->str, str->length, max_char_length); + if (!prefix.well_formed_error_pos() && str->length == prefix.length()) return FALSE; if (!no_error) diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 324eef09854..972ab3aa1f1 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -293,10 +293,10 @@ int get_parts_for_update(const uchar *old_data, uchar *new_data, DBUG_ENTER("get_parts_for_update"); DBUG_ASSERT(new_data == rec0); // table->record[0] - set_field_ptr(part_field_array, old_data, rec0); + part_info->table->move_fields(part_field_array, old_data, rec0); error= part_info->get_partition_id(part_info, old_part_id, &old_func_value); - set_field_ptr(part_field_array, rec0, old_data); + part_info->table->move_fields(part_field_array, rec0, old_data); if (unlikely(error)) // Should never happen { DBUG_ASSERT(0); @@ -321,10 +321,10 @@ int get_parts_for_update(const uchar *old_data, uchar *new_data, future use. It will be tested by ensuring that the above condition is false in one test situation before pushing the code. */ - set_field_ptr(part_field_array, new_data, rec0); + part_info->table->move_fields(part_field_array, new_data, rec0); error= part_info->get_partition_id(part_info, new_part_id, new_func_value); - set_field_ptr(part_field_array, rec0, new_data); + part_info->table->move_fields(part_field_array, rec0, new_data); if (unlikely(error)) { DBUG_RETURN(error); @@ -375,9 +375,9 @@ int get_part_for_delete(const uchar *buf, const uchar *rec0, else { Field **part_field_array= part_info->full_part_field_array; - set_field_ptr(part_field_array, buf, rec0); + part_info->table->move_fields(part_field_array, buf, rec0); error= part_info->get_partition_id(part_info, part_id, &func_value); - set_field_ptr(part_field_array, rec0, buf); + part_info->table->move_fields(part_field_array, rec0, buf); if (unlikely(error)) { DBUG_RETURN(error); @@ -936,6 +936,7 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table, if (init_lex_with_single_table(thd, table, &lex)) goto end; + table->get_fields_in_item_tree= true; func_expr->walk(&Item::change_context_processor, 0, &lex.select_lex.context); thd->where= "partition function"; @@ -3787,9 +3788,9 @@ static int get_sub_part_id_from_key(const TABLE *table,uchar *buf, else { Field **part_field_array= part_info->subpart_field_array; - set_field_ptr(part_field_array, buf, rec0); + part_info->table->move_fields(part_field_array, buf, rec0); res= part_info->get_subpartition_id(part_info, part_id); - set_field_ptr(part_field_array, rec0, buf); + part_info->table->move_fields(part_field_array, rec0, buf); } DBUG_RETURN(res); } @@ -3833,10 +3834,10 @@ bool get_part_id_from_key(const TABLE *table, uchar *buf, KEY *key_info, else { Field **part_field_array= part_info->part_field_array; - set_field_ptr(part_field_array, buf, rec0); + part_info->table->move_fields(part_field_array, buf, rec0); result= part_info->get_part_partition_id(part_info, part_id, &func_value); - set_field_ptr(part_field_array, rec0, buf); + part_info->table->move_fields(part_field_array, rec0, buf); } DBUG_RETURN(result); } @@ -3882,10 +3883,10 @@ void get_full_part_id_from_key(const TABLE *table, uchar *buf, else { Field **part_field_array= part_info->full_part_field_array; - set_field_ptr(part_field_array, buf, rec0); + part_info->table->move_fields(part_field_array, buf, rec0); result= part_info->get_partition_id(part_info, &part_spec->start_part, &func_value); - set_field_ptr(part_field_array, rec0, buf); + part_info->table->move_fields(part_field_array, rec0, buf); } part_spec->end_part= part_spec->start_part; if (unlikely(result)) @@ -3935,7 +3936,7 @@ bool verify_data_with_partition(TABLE *table, TABLE *part_table, bitmap_union(table->read_set, &part_info->full_part_field_set); old_rec= part_table->record[0]; part_table->record[0]= table->record[0]; - set_field_ptr(part_info->full_part_field_array, table->record[0], old_rec); + part_info->table->move_fields(part_info->full_part_field_array, table->record[0], old_rec); if ((error= file->ha_rnd_init(TRUE))) { file->print_error(error, MYF(0)); @@ -3970,7 +3971,7 @@ bool verify_data_with_partition(TABLE *table, TABLE *part_table, } while (TRUE); (void) file->ha_rnd_end(); err: - set_field_ptr(part_info->full_part_field_array, old_rec, + part_info->table->move_fields(part_info->full_part_field_array, old_rec, table->record[0]); part_table->record[0]= old_rec; if (error) @@ -6649,7 +6650,8 @@ void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt, } } /* Ensure the share is destroyed and reopened. */ - part_info= lpt->part_info->get_clone(thd); + if (part_info) + part_info= part_info->get_clone(thd); close_all_tables_for_name(thd, table->s, HA_EXTRA_NOT_USED, NULL); } else @@ -6667,7 +6669,8 @@ err_exclusive_lock: the table cache. */ mysql_lock_remove(thd, thd->lock, table); - part_info= lpt->part_info->get_clone(thd); + if (part_info) + part_info= part_info->get_clone(thd); close_thread_table(thd, &thd->open_tables); lpt->table_list->table= NULL; } @@ -7209,39 +7212,6 @@ err: } #endif - -/* - Prepare for calling val_int on partition function by setting fields to - point to the record where the values of the PF-fields are stored. - - SYNOPSIS - set_field_ptr() - ptr Array of fields to change ptr - new_buf New record pointer - old_buf Old record pointer - - DESCRIPTION - Set ptr in field objects of field array to refer to new_buf record - instead of previously old_buf. Used before calling val_int and after - it is used to restore pointers to table->record[0]. - This routine is placed outside of partition code since it can be useful - also for other programs. -*/ - -void set_field_ptr(Field **ptr, const uchar *new_buf, - const uchar *old_buf) -{ - my_ptrdiff_t diff= (new_buf - old_buf); - DBUG_ENTER("set_field_ptr"); - - do - { - (*ptr)->move_field_offset(diff); - } while (*(++ptr)); - DBUG_VOID_RETURN; -} - - /* Prepare for calling val_int on partition function by setting fields to point to the record where the values of the PF-fields are stored. diff --git a/sql/sql_partition.h b/sql/sql_partition.h index b225c14fc53..c2665a8366b 100644 --- a/sql/sql_partition.h +++ b/sql/sql_partition.h @@ -288,7 +288,6 @@ void create_subpartition_name(char *out, const char *in1, const char *in2, const char *in3, uint name_variant); -void set_field_ptr(Field **ptr, const uchar *new_buf, const uchar *old_buf); void set_key_field_ptr(KEY *key_info, const uchar *new_buf, const uchar *old_buf); diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index ce46a76d103..aea83f41527 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1543,10 +1543,6 @@ int plugin_init(int *argc, char **argv, int flags) dlopen_count =0; -#ifdef HAVE_PSI_INTERFACE - init_plugin_psi_keys(); -#endif - init_alloc_root(&plugin_mem_root, 4096, 4096, MYF(0)); init_alloc_root(&plugin_vars_mem_root, 4096, 4096, MYF(0)); init_alloc_root(&tmp_root, 4096, 4096, MYF(0)); @@ -1555,9 +1551,6 @@ int plugin_init(int *argc, char **argv, int flags) get_bookmark_hash_key, NULL, HASH_UNIQUE)) goto err; - - mysql_mutex_init(key_LOCK_plugin, &LOCK_plugin, MY_MUTEX_INIT_FAST); - /* The 80 is from 2016-04-27 when we had 71 default plugins Big enough to avoid many mallocs even in future @@ -2871,6 +2864,22 @@ static st_bookmark *find_bookmark(const char *plugin, const char *name, } +static size_t var_storage_size(int flags) +{ + switch (flags & PLUGIN_VAR_TYPEMASK) { + case PLUGIN_VAR_BOOL: return sizeof(my_bool); + case PLUGIN_VAR_INT: return sizeof(int); + case PLUGIN_VAR_LONG: return sizeof(long); + case PLUGIN_VAR_ENUM: return sizeof(long); + case PLUGIN_VAR_LONGLONG: return sizeof(ulonglong); + case PLUGIN_VAR_SET: return sizeof(ulonglong); + case PLUGIN_VAR_STR: return sizeof(char*); + case PLUGIN_VAR_DOUBLE: return sizeof(double); + default: DBUG_ASSERT(0); return 0; + } +} + + /* returns a bookmark for thd-local variables, creating if neccessary. returns null for non thd-local variables. @@ -2879,39 +2888,13 @@ static st_bookmark *find_bookmark(const char *plugin, const char *name, static st_bookmark *register_var(const char *plugin, const char *name, int flags) { - uint length= strlen(plugin) + strlen(name) + 3, size= 0, offset, new_size; + uint length= strlen(plugin) + strlen(name) + 3, size, offset, new_size; st_bookmark *result; char *varname, *p; - if (!(flags & PLUGIN_VAR_THDLOCAL)) - return NULL; - - switch (flags & PLUGIN_VAR_TYPEMASK) { - case PLUGIN_VAR_BOOL: - size= sizeof(my_bool); - break; - case PLUGIN_VAR_INT: - size= sizeof(int); - break; - case PLUGIN_VAR_LONG: - case PLUGIN_VAR_ENUM: - size= sizeof(long); - break; - case PLUGIN_VAR_LONGLONG: - case PLUGIN_VAR_SET: - size= sizeof(ulonglong); - break; - case PLUGIN_VAR_STR: - size= sizeof(char*); - break; - case PLUGIN_VAR_DOUBLE: - size= sizeof(double); - break; - default: - DBUG_ASSERT(0); - return NULL; - }; + DBUG_ASSERT(flags & PLUGIN_VAR_THDLOCAL); + size= var_storage_size(flags); varname= ((char*) my_alloca(length)); strxmov(varname + 1, plugin, "_", name, NullS); for (p= varname + 1; *p; p++) @@ -3005,25 +2988,17 @@ void sync_dynamic_session_variables(THD* thd, bool global_lock) */ for (idx= 0; idx < bookmark_hash.records; idx++) { - sys_var_pluginvar *pi; - sys_var *var; st_bookmark *v= (st_bookmark*) my_hash_element(&bookmark_hash,idx); if (v->version <= thd->variables.dynamic_variables_version) continue; /* already in thd->variables */ - if (!(var= intern_find_sys_var(v->key + 1, v->name_len)) || - !(pi= var->cast_pluginvar()) || - v->key[0] != plugin_var_bookmark_key(pi->plugin_var->flags)) - continue; - /* Here we do anything special that may be required of the data types */ - if ((pi->plugin_var->flags & PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_STR && - pi->plugin_var->flags & PLUGIN_VAR_MEMALLOC) + if ((v->key[0] & PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_STR && + v->key[0] & BOOKMARK_MEMALLOC) { - int offset= ((thdvar_str_t *)(pi->plugin_var))->offset; - char **pp= (char**) (thd->variables.dynamic_variables_ptr + offset); + char **pp= (char**) (thd->variables.dynamic_variables_ptr + v->offset); if (*pp) *pp= my_strdup(*pp, MYF(MY_WME|MY_FAE)); } @@ -3138,28 +3113,19 @@ void plugin_thdvar_init(THD *thd) thd->variables.dynamic_variables_size= 0; thd->variables.dynamic_variables_ptr= 0; - if (IF_WSREP((!WSREP(thd) || !thd->wsrep_applier),1)) - { - mysql_mutex_lock(&LOCK_plugin); - thd->variables.table_plugin= - intern_plugin_lock(NULL, global_system_variables.table_plugin); - if (global_system_variables.tmp_table_plugin) - thd->variables.tmp_table_plugin= - intern_plugin_lock(NULL, global_system_variables.tmp_table_plugin); - if (global_system_variables.enforced_table_plugin) - thd->variables.enforced_table_plugin= - intern_plugin_lock(NULL, global_system_variables.enforced_table_plugin); - intern_plugin_unlock(NULL, old_table_plugin); - intern_plugin_unlock(NULL, old_tmp_table_plugin); - intern_plugin_unlock(NULL, old_enforced_table_plugin); - mysql_mutex_unlock(&LOCK_plugin); - } - else - { - thd->variables.table_plugin= NULL; - thd->variables.tmp_table_plugin= NULL; - thd->variables.enforced_table_plugin= NULL; - } + mysql_mutex_lock(&LOCK_plugin); + thd->variables.table_plugin= + intern_plugin_lock(NULL, global_system_variables.table_plugin); + if (global_system_variables.tmp_table_plugin) + thd->variables.tmp_table_plugin= + intern_plugin_lock(NULL, global_system_variables.tmp_table_plugin); + if (global_system_variables.enforced_table_plugin) + thd->variables.enforced_table_plugin= + intern_plugin_lock(NULL, global_system_variables.enforced_table_plugin); + intern_plugin_unlock(NULL, old_table_plugin); + intern_plugin_unlock(NULL, old_tmp_table_plugin); + intern_plugin_unlock(NULL, old_enforced_table_plugin); + mysql_mutex_unlock(&LOCK_plugin); DBUG_VOID_RETURN; } @@ -3470,6 +3436,48 @@ bool sys_var_pluginvar::session_update(THD *thd, set_var *var) return false; } +static const void *var_def_ptr(st_mysql_sys_var *pv) +{ + switch (pv->flags & (PLUGIN_VAR_TYPEMASK | PLUGIN_VAR_THDLOCAL)) { + case PLUGIN_VAR_INT: + return &((sysvar_uint_t*) pv)->def_val; + case PLUGIN_VAR_LONG: + return &((sysvar_ulong_t*) pv)->def_val; + case PLUGIN_VAR_LONGLONG: + return &((sysvar_ulonglong_t*) pv)->def_val; + case PLUGIN_VAR_ENUM: + return &((sysvar_enum_t*) pv)->def_val; + case PLUGIN_VAR_SET: + return &((sysvar_set_t*) pv)->def_val; + case PLUGIN_VAR_BOOL: + return &((sysvar_bool_t*) pv)->def_val; + case PLUGIN_VAR_STR: + return &((sysvar_str_t*) pv)->def_val; + case PLUGIN_VAR_DOUBLE: + return &((sysvar_double_t*) pv)->def_val; + case PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL: + return &((thdvar_uint_t*) pv)->def_val; + case PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL: + return &((thdvar_ulong_t*) pv)->def_val; + case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL: + return &((thdvar_ulonglong_t*) pv)->def_val; + case PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL: + return &((thdvar_enum_t*) pv)->def_val; + case PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL: + return &((thdvar_set_t*) pv)->def_val; + case PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL: + return &((thdvar_bool_t*) pv)->def_val; + case PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL: + return &((thdvar_str_t*) pv)->def_val; + case PLUGIN_VAR_DOUBLE | PLUGIN_VAR_THDLOCAL: + return &((thdvar_double_t*) pv)->def_val; + default: + DBUG_ASSERT(0); + return NULL; + } +} + + bool sys_var_pluginvar::global_update(THD *thd, set_var *var) { DBUG_ASSERT(!is_readonly()); @@ -3479,60 +3487,7 @@ bool sys_var_pluginvar::global_update(THD *thd, set_var *var) const void *src= &var->save_result; if (!var->value) - { - switch (plugin_var->flags & (PLUGIN_VAR_TYPEMASK | PLUGIN_VAR_THDLOCAL)) { - case PLUGIN_VAR_INT: - src= &((sysvar_uint_t*) plugin_var)->def_val; - break; - case PLUGIN_VAR_LONG: - src= &((sysvar_ulong_t*) plugin_var)->def_val; - break; - case PLUGIN_VAR_LONGLONG: - src= &((sysvar_ulonglong_t*) plugin_var)->def_val; - break; - case PLUGIN_VAR_ENUM: - src= &((sysvar_enum_t*) plugin_var)->def_val; - break; - case PLUGIN_VAR_SET: - src= &((sysvar_set_t*) plugin_var)->def_val; - break; - case PLUGIN_VAR_BOOL: - src= &((sysvar_bool_t*) plugin_var)->def_val; - break; - case PLUGIN_VAR_STR: - src= &((sysvar_str_t*) plugin_var)->def_val; - break; - case PLUGIN_VAR_DOUBLE: - src= &((sysvar_double_t*) plugin_var)->def_val; - break; - case PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL: - src= &((thdvar_uint_t*) plugin_var)->def_val; - break; - case PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL: - src= &((thdvar_ulong_t*) plugin_var)->def_val; - break; - case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL: - src= &((thdvar_ulonglong_t*) plugin_var)->def_val; - break; - case PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL: - src= &((thdvar_enum_t*) plugin_var)->def_val; - break; - case PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL: - src= &((thdvar_set_t*) plugin_var)->def_val; - break; - case PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL: - src= &((thdvar_bool_t*) plugin_var)->def_val; - break; - case PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL: - src= &((thdvar_str_t*) plugin_var)->def_val; - break; - case PLUGIN_VAR_DOUBLE | PLUGIN_VAR_THDLOCAL: - src= &((thdvar_double_t*) plugin_var)->def_val; - break; - default: - DBUG_ASSERT(0); - } - } + src= var_def_ptr(plugin_var); plugin_var->update(thd, plugin_var, tgt, src); return false; @@ -3885,7 +3840,18 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp, *(int*)(opt + 1)= offset= v->offset; if (opt->flags & PLUGIN_VAR_NOCMDOPT) + { + char *val= global_system_variables.dynamic_variables_ptr + offset; + if (((opt->flags & PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_STR) && + (opt->flags & PLUGIN_VAR_MEMALLOC)) + { + char *def_val= *(char**)var_def_ptr(opt); + *(char**)val= def_val ? my_strdup(def_val, MYF(0)) : NULL; + } + else + memcpy(val, var_def_ptr(opt), var_storage_size(opt->flags)); continue; + } optname= (char*) memdup_root(mem_root, v->key + 1, (optnamelen= v->name_len) + 1); @@ -4298,3 +4264,60 @@ int thd_setspecific(MYSQL_THD thd, MYSQL_THD_KEY_T key, void *value) return 0; } +void plugin_mutex_init() +{ +#ifdef HAVE_PSI_INTERFACE + init_plugin_psi_keys(); +#endif + mysql_mutex_init(key_LOCK_plugin, &LOCK_plugin, MY_MUTEX_INIT_FAST); +} + +#ifdef WITH_WSREP + +/* + Placeholder for global_system_variables.table_plugin required during + initialization of startup wsrep threads. +*/ +static st_plugin_int wsrep_dummy_plugin; +static st_plugin_int *wsrep_dummy_plugin_ptr; + +/* + Initialize wsrep_dummy_plugin and assign it to + global_system_variables.table_plugin. +*/ +void wsrep_plugins_pre_init() +{ + wsrep_dummy_plugin_ptr= &wsrep_dummy_plugin; + wsrep_dummy_plugin.state= PLUGIN_IS_DISABLED; + global_system_variables.table_plugin= + plugin_int_to_ref(wsrep_dummy_plugin_ptr); +} + +/* + This function is intended to be called after the plugins and related + global system variables are initialized. It re-initializes some data + members of wsrep startup threads with correct values, as these value + were not available at the time these threads were created. +*/ +void wsrep_plugins_post_init() +{ + THD *thd; + I_List_iterator it(threads); + + while ((thd= it++)) + { + if (IF_WSREP(thd->wsrep_applier,1)) + { + // Save options_bits as it will get overwritten in plugin_thdvar_init() + ulonglong option_bits_saved= thd->variables.option_bits; + + plugin_thdvar_init(thd); + + // Restore option_bits + thd->variables.option_bits= option_bits_saved; + } + } + + return; +} +#endif /* WITH_WSREP */ diff --git a/sql/sql_plugin.h b/sql/sql_plugin.h index 317ccf482b6..9a0acea1d18 100644 --- a/sql/sql_plugin.h +++ b/sql/sql_plugin.h @@ -182,6 +182,7 @@ sys_var *find_plugin_sysvar(st_plugin_int *plugin, st_mysql_sys_var *var); void plugin_opt_set_limits(struct my_option *, const struct st_mysql_sys_var *); extern SHOW_COMP_OPTION plugin_status(const char *name, size_t len, int type); extern bool check_valid_path(const char *path, size_t length); +extern void plugin_mutex_init(); typedef my_bool (plugin_foreach_func)(THD *thd, plugin_ref plugin, @@ -199,3 +200,9 @@ sys_var *find_sys_var_ex(THD *thd, const char *str, size_t length, extern void sync_dynamic_session_variables(THD* thd, bool global_lock); #endif + +#ifdef WITH_WSREP +extern void wsrep_plugins_pre_init(); +extern void wsrep_plugins_post_init(); +#endif /* WITH_WSREP */ + diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index df15a629802..d7a23a41002 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -162,6 +162,9 @@ public: Select_fetch_protocol_binary result; Item_param **param_array; Server_side_cursor *cursor; + uchar *packet; + uchar *packet_end; + ulong iterations; uint param_count; uint last_errno; uint flags; @@ -180,15 +183,19 @@ public: */ uint select_number_after_prepare; char last_error[MYSQL_ERRMSG_SIZE]; + my_bool start_param; #ifndef EMBEDDED_LIBRARY bool (*set_params)(Prepared_statement *st, uchar *data, uchar *data_end, uchar *read_pos, String *expanded_query); + bool (*set_bulk_params)(Prepared_statement *st, + uchar **read_pos, uchar *data_end, bool reset); #else bool (*set_params_data)(Prepared_statement *st, String *expanded_query); + /*TODO: add bulk support for builtin server */ #endif - bool (*set_params_from_vars)(Prepared_statement *stmt, - List& varnames, - String *expanded_query); + bool (*set_params_from_actual_params)(Prepared_statement *stmt, + List &list, + String *expanded_query); public: Prepared_statement(THD *thd_arg); virtual ~Prepared_statement(); @@ -204,9 +211,16 @@ public: bool execute_loop(String *expanded_query, bool open_cursor, uchar *packet_arg, uchar *packet_end_arg); + bool execute_bulk_loop(String *expanded_query, + bool open_cursor, + uchar *packet_arg, uchar *packet_end_arg, + ulong iterations); bool execute_server_runnable(Server_runnable *server_runnable); + my_bool set_bulk_parameters(bool reset); + ulong bulk_iterations(); /* Destroy this statement */ void deallocate(); + bool execute_immediate(const char *query, uint query_length); private: /** The memory root to allocate parsed tree elements (instances of Item, @@ -218,6 +232,7 @@ private: bool set_parameters(String *expanded_query, uchar *packet, uchar *packet_end); bool execute(String *expanded_query, bool open_cursor); + void deallocate_immediate(); bool reprepare(); bool validate_metadata(Prepared_statement *copy); void swap_prepared_statement(Prepared_statement *copy); @@ -960,11 +975,62 @@ static bool insert_params(Prepared_statement *stmt, uchar *null_array, } +static bool insert_bulk_params(Prepared_statement *stmt, + uchar **read_pos, uchar *data_end, + bool reset) +{ + Item_param **begin= stmt->param_array; + Item_param **end= begin + stmt->param_count; + + DBUG_ENTER("insert_params"); + + for (Item_param **it= begin; it < end; ++it) + { + Item_param *param= *it; + if (reset) + param->reset(); + if (param->state != Item_param::LONG_DATA_VALUE) + { + if (param->indicators) + param->indicator= (enum_indicator_type) *((*read_pos)++); + else + param->indicator= STMT_INDICATOR_NONE; + if ((*read_pos) > data_end) + DBUG_RETURN(1); + switch (param->indicator) + { + case STMT_INDICATOR_NONE: + if ((*read_pos) >= data_end) + DBUG_RETURN(1); + param->set_param_func(param, read_pos, (uint) (data_end - (*read_pos))); + if (param->state == Item_param::NO_VALUE) + DBUG_RETURN(1); + break; + case STMT_INDICATOR_NULL: + param->set_null(); + break; + case STMT_INDICATOR_DEFAULT: + param->set_default(); + break; + case STMT_INDICATOR_IGNORE: + param->set_ignore(); + break; + } + } + else + DBUG_RETURN(1); // long is not supported here + } + DBUG_RETURN(0); +} + static bool setup_conversion_functions(Prepared_statement *stmt, - uchar **data, uchar *data_end) + uchar **data, uchar *data_end, + bool bulk_protocol= 0) { /* skip null bits */ - uchar *read_pos= *data + (stmt->param_count+7) / 8; + uchar *read_pos= *data; + if (!bulk_protocol) + read_pos+= (stmt->param_count+7) / 8; DBUG_ENTER("setup_conversion_functions"); @@ -981,6 +1047,7 @@ static bool setup_conversion_functions(Prepared_statement *stmt, { ushort typecode; const uint signed_bit= 1 << 15; + const uint indicators_bit= 1 << 14; if (read_pos >= data_end) DBUG_RETURN(1); @@ -988,7 +1055,10 @@ static bool setup_conversion_functions(Prepared_statement *stmt, typecode= sint2korr(read_pos); read_pos+= 2; (**it).unsigned_flag= MY_TEST(typecode & signed_bit); - setup_one_conversion_function(thd, *it, (uchar) (typecode & ~signed_bit)); + if (bulk_protocol) + (**it).indicators= MY_TEST(typecode & indicators_bit); + setup_one_conversion_function(thd, *it, + (uchar) (typecode & 0xff)); } } *data= read_pos; @@ -997,6 +1067,8 @@ static bool setup_conversion_functions(Prepared_statement *stmt, #else +//TODO: support bulk parameters + /** Embedded counterparts of parameter assignment routines. @@ -1141,31 +1213,27 @@ swap_parameter_array(Item_param **param_array_dst, Assign prepared statement parameters from user variables. @param stmt Statement - @param varnames List of variables. Caller must ensure that number - of variables in the list is equal to number of statement + @param params A list of parameters. Caller must ensure that number + of parameters in the list is equal to number of statement parameters @param query Ignored */ -static bool insert_params_from_vars(Prepared_statement *stmt, - List& varnames, - String *query __attribute__((unused))) +static bool +insert_params_from_actual_params(Prepared_statement *stmt, + List ¶ms, + String *query __attribute__((unused))) { Item_param **begin= stmt->param_array; Item_param **end= begin + stmt->param_count; - user_var_entry *entry; - LEX_STRING *varname; - List_iterator var_it(varnames); - DBUG_ENTER("insert_params_from_vars"); + List_iterator param_it(params); + DBUG_ENTER("insert_params_from_actual_params"); for (Item_param **it= begin; it < end; ++it) { Item_param *param= *it; - varname= var_it++; - entry= (user_var_entry*)my_hash_search(&stmt->thd->user_vars, - (uchar*) varname->str, - varname->length); - if (param->set_from_user_var(stmt->thd, entry) || + Item *ps_param= param_it++; + if (ps_param->save_in_param(stmt->thd, param) || param->convert_str_value(stmt->thd)) DBUG_RETURN(1); } @@ -1174,45 +1242,41 @@ static bool insert_params_from_vars(Prepared_statement *stmt, /** - Do the same as insert_params_from_vars but also construct query text for - binary log. + Do the same as insert_params_from_actual_params + but also construct query text for binary log. @param stmt Prepared statement - @param varnames List of variables. Caller must ensure that number of - variables in the list is equal to number of statement + @param params A list of parameters. Caller must ensure that number of + parameters in the list is equal to number of statement parameters @param query The query with parameter markers replaced with corresponding user variables that were used to execute the query. */ -static bool insert_params_from_vars_with_log(Prepared_statement *stmt, - List& varnames, - String *query) +static bool +insert_params_from_actual_params_with_log(Prepared_statement *stmt, + List ¶ms, + String *query) { Item_param **begin= stmt->param_array; Item_param **end= begin + stmt->param_count; - user_var_entry *entry; - LEX_STRING *varname; - List_iterator var_it(varnames); + List_iterator param_it(params); THD *thd= stmt->thd; Copy_query_with_rewrite acc(thd, stmt->query(), stmt->query_length(), query); - DBUG_ENTER("insert_params_from_vars_with_log"); + DBUG_ENTER("insert_params_from_actual_params_with_log"); for (Item_param **it= begin; it < end; ++it) { Item_param *param= *it; - varname= var_it++; - - entry= (user_var_entry *) my_hash_search(&thd->user_vars, (uchar*) - varname->str, varname->length); + Item *ps_param= param_it++; /* We have to call the setup_one_conversion_function() here to set the parameter's members that might be needed further (e.g. value.cs_info.character_set_client is used in the query_val_str()). */ setup_one_conversion_function(thd, param, param->field_type()); - if (param->set_from_user_var(thd, entry)) + if (ps_param->save_in_param(thd, param)) DBUG_RETURN(1); if (acc.append(param)) @@ -2607,95 +2671,99 @@ end: } /** - Get an SQL statement text from a user variable or from plain text. + Get an SQL statement from an item in lex->prepared_stmt_code. - If the statement is plain text, just assign the - pointers, otherwise allocate memory in thd->mem_root and copy - the contents of the variable, possibly with character - set conversion. + This function can return pointers to very different memory classes: + - a static string "NULL", if the item returned NULL + - the result of prepare_stmt_code->val_str(), if no conversion was needed + - a thd->mem_root allocated string with the result of + prepare_stmt_code->val_str() converted to @@collation_connection, + if conversion was needed - @param[in] lex main lex - @param[out] query_len length of the SQL statement (is set only - in case of success) + The caller must dispose the result before the life cycle of "buffer" ends. + As soon as buffer's destructor is called, the value is not valid any more! - @retval - non-zero success - @retval - 0 in case of error (out of memory) + mysql_sql_stmt_prepare() and mysql_sql_stmt_execute_immediate() + call get_dynamic_sql_string() and then call respectively + Prepare_statement::prepare() and Prepare_statment::execute_immediate(), + who store the returned result into its permanent location using + alloc_query(). "buffer" is still not destructed at that time. + + @param[out] dst the result is stored here + @param[inout] buffer + + @retval false on success + @retval true on error (out of memory) */ -static const char *get_dynamic_sql_string(LEX *lex, uint *query_len) +bool LEX::get_dynamic_sql_string(LEX_CSTRING *dst, String *buffer) { - THD *thd= lex->thd; - char *query_str= 0; + if (prepared_stmt_code->fix_fields(thd, NULL) || + prepared_stmt_code->check_cols(1)) + return true; - if (lex->prepared_stmt_code_is_varref) + const String *str= prepared_stmt_code->val_str(buffer); + if (prepared_stmt_code->null_value) { - /* This is PREPARE stmt FROM or EXECUTE IMMEDIATE @var. */ - String str; - CHARSET_INFO *to_cs= thd->variables.collation_connection; - bool needs_conversion; - user_var_entry *entry; - String *var_value= &str; - uint32 unused, len; /* - Convert @var contents to string in connection character set. Although - it is known that int/real/NULL value cannot be a valid query we still - convert it for error messages to be uniform. + Prepare source was NULL, so we need to set "str" to + something reasonable to get a readable error message during parsing */ - if ((entry= - (user_var_entry*)my_hash_search(&thd->user_vars, - (uchar*)lex->prepared_stmt_code.str, - lex->prepared_stmt_code.length)) - && entry->value) - { - bool is_var_null; - var_value= entry->val_str(&is_var_null, &str, NOT_FIXED_DEC); - /* - NULL value of variable checked early as entry->value so here - we can't get NULL in normal conditions - */ - DBUG_ASSERT(!is_var_null); - if (!var_value) - goto end; - } - else - { - /* - variable absent or equal to NULL, so we need to set variable to - something reasonable to get a readable error message during parsing - */ - str.set(STRING_WITH_LEN("NULL"), &my_charset_latin1); - } - - needs_conversion= String::needs_conversion(var_value->length(), - var_value->charset(), to_cs, - &unused); - - len= (needs_conversion ? var_value->length() * to_cs->mbmaxlen : - var_value->length()); - if (!(query_str= (char*) alloc_root(thd->mem_root, len+1))) - goto end; - - if (needs_conversion) - { - uint dummy_errors; - len= copy_and_convert(query_str, len, to_cs, var_value->ptr(), - var_value->length(), var_value->charset(), - &dummy_errors); - } - else - memcpy(query_str, var_value->ptr(), var_value->length()); - query_str[len]= '\0'; // Safety (mostly for debug) - *query_len= len; + dst->str= "NULL"; + dst->length= 4; + return false; } - else + + /* + Character set conversion notes: + + 1) When PREPARE or EXECUTE IMMEDIATE are used with string literals: + PREPARE stmt FROM 'SELECT ''str'''; + EXECUTE IMMEDIATE 'SELECT ''str'''; + it's very unlikely that any conversion will happen below, because + @@character_set_client and @@collation_connection are normally + set to the same CHARSET_INFO pointer. + + In tricky environments when @@collation_connection is set to something + different from @@character_set_client, double conversion may happen: + - When the parser scans the string literal + (sql_yacc.yy rules "prepare_src" -> "expr" -> ... -> "text_literal") + it will convert 'str' from @@character_set_client to + @@collation_connection. + - Then in the code below will convert 'str' from @@collation_connection + back to @@character_set_client. + + 2) When PREPARE or EXECUTE IMMEDIATE is used with a user variable, + it should work about the same way, because user variables are usually + assigned like this: + SET @str='str'; + and thus have the same character set with string literals. + + 3) When PREPARE or EXECUTE IMMEDIATE is used with some + more complex expression, conversion will depend on this expression. + For example, a concatenation of string literals: + EXECUTE IMMEDIATE 'SELECT * FROM'||'t1'; + should work the same way with just a single literal, + so no conversion normally. + */ + CHARSET_INFO *to_cs= thd->variables.character_set_client; + + uint32 unused; + if (String::needs_conversion(str->length(), str->charset(), to_cs, &unused)) { - query_str= lex->prepared_stmt_code.str; - *query_len= lex->prepared_stmt_code.length; + if (!(dst->str= sql_strmake_with_convert(thd, str->ptr(), str->length(), + str->charset(), UINT_MAX32, + to_cs, &dst->length))) + { + dst->length= 0; + return true; + } + DBUG_ASSERT(dst->length <= UINT_MAX32); + return false; } -end: - return query_str; + dst->str= str->ptr(); + dst->length= str->length(); + return false; } @@ -2718,8 +2786,7 @@ void mysql_sql_stmt_prepare(THD *thd) LEX *lex= thd->lex; LEX_STRING *name= &lex->prepared_stmt_name; Prepared_statement *stmt; - const char *query; - uint query_len= 0; + LEX_CSTRING query; DBUG_ENTER("mysql_sql_stmt_prepare"); if ((stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name))) @@ -2737,7 +2804,12 @@ void mysql_sql_stmt_prepare(THD *thd) stmt->deallocate(); } - if (! (query= get_dynamic_sql_string(lex, &query_len)) || + /* + It's important for "buffer" not to be destructed before stmt->prepare()! + See comments in get_dynamic_sql_string(). + */ + StringBuffer<256> buffer; + if (lex->get_dynamic_sql_string(&query, &buffer) || ! (stmt= new Prepared_statement(thd))) { DBUG_VOID_RETURN; /* out of memory */ @@ -2758,7 +2830,7 @@ void mysql_sql_stmt_prepare(THD *thd) DBUG_VOID_RETURN; } - if (stmt->prepare(query, query_len)) + if (stmt->prepare(query.str, (uint) query.length)) { /* Statement map deletes the statement on erase */ thd->stmt_map.erase(stmt); @@ -2772,6 +2844,43 @@ void mysql_sql_stmt_prepare(THD *thd) DBUG_VOID_RETURN; } + +void mysql_sql_stmt_execute_immediate(THD *thd) +{ + LEX *lex= thd->lex; + Prepared_statement *stmt; + LEX_CSTRING query; + DBUG_ENTER("mysql_sql_stmt_execute_immediate"); + + if (lex->prepared_stmt_params_fix_fields(thd)) + DBUG_VOID_RETURN; + + /* + Prepared_statement is quite large, + let's allocate it on the heap rather than on the stack. + + It's important for "buffer" not to be destructed + before stmt->execute_immediate(). + See comments in get_dynamic_sql_string(). + */ + StringBuffer<256> buffer; + if (lex->get_dynamic_sql_string(&query, &buffer) || + !(stmt= new Prepared_statement(thd))) + DBUG_VOID_RETURN; // out of memory + + // See comments on thd->free_list in mysql_sql_stmt_execute() + Item *free_list_backup= thd->free_list; + thd->free_list= NULL; + (void) stmt->execute_immediate(query.str, (uint) query.length); + thd->free_items(); + thd->free_list= free_list_backup; + + stmt->lex->restore_set_statement_var(); + delete stmt; + DBUG_VOID_RETURN; +} + + /** Reinit prepared statement/stored procedure before execution. @@ -2957,6 +3066,11 @@ void mysqld_stmt_execute(THD *thd, char *packet_arg, uint packet_length) uchar *packet= (uchar*)packet_arg; // GCC 4.0.1 workaround ulong stmt_id= uint4korr(packet); ulong flags= (ulong) packet[4]; +#ifndef EMBEDDED_LIBRARY + ulong iterations= uint4korr(packet + 5); +#else + ulong iterations= 0; // no support +#endif /* Query text for binary, general or slow log, if any of them is open */ String expanded_query; uchar *packet_end= packet + packet_length; @@ -2982,12 +3096,16 @@ void mysqld_stmt_execute(THD *thd, char *packet_arg, uint packet_length) thd->profiling.set_query_source(stmt->query(), stmt->query_length()); #endif DBUG_PRINT("exec_query", ("%s", stmt->query())); - DBUG_PRINT("info",("stmt: 0x%lx", (long) stmt)); + DBUG_PRINT("info",("stmt: %p iterations: %lu", stmt, iterations)); open_cursor= MY_TEST(flags & (ulong) CURSOR_TYPE_READ_ONLY); thd->protocol= &thd->protocol_binary; - stmt->execute_loop(&expanded_query, open_cursor, packet, packet_end); + if (iterations <= 1) + stmt->execute_loop(&expanded_query, open_cursor, packet, packet_end); + else + stmt->execute_bulk_loop(&expanded_query, open_cursor, packet, packet_end, + iterations); thd->protocol= save_protocol; sp_cache_enforce_limit(thd->sp_proc_cache, stored_program_cache_size); @@ -3042,7 +3160,44 @@ void mysql_sql_stmt_execute(THD *thd) DBUG_PRINT("info",("stmt: 0x%lx", (long) stmt)); + if (lex->prepared_stmt_params_fix_fields(thd)) + DBUG_VOID_RETURN; + + /* + thd->free_list can already have some Items. + + Example queries: + - SET STATEMENT var=expr FOR EXECUTE stmt; + - EXECUTE stmt USING expr; + + E.g. for a query like this: + PREPARE stmt FROM 'INSERT INTO t1 VALUES (@@max_sort_length)'; + SET STATEMENT max_sort_length=2048 FOR EXECUTE stmt; + thd->free_list contains a pointer to Item_int corresponding to 2048. + + If Prepared_statement::execute() notices that the table metadata for "t1" + has changed since PREPARE, it returns an error asking the calling + Prepared_statement::execute_loop() to re-prepare the statement. + Before returning the error, Prepared_statement::execute() + calls Prepared_statement::cleanup_stmt(), + which calls thd->cleanup_after_query(), + which calls Query_arena::free_items(). + + We hide "external" Items, e.g. those created while parsing the + "SET STATEMENT" or "USING" parts of the query, + so they don't get freed in case of re-prepare. + See MDEV-10702 Crash in SET STATEMENT FOR EXECUTE + */ + Item *free_list_backup= thd->free_list; + thd->free_list= NULL; // Hide the external (e.g. "SET STATEMENT") Items (void) stmt->execute_loop(&expanded_query, FALSE, NULL, NULL); + thd->free_items(); // Free items created by execute_loop() + /* + Now restore the "external" (e.g. "SET STATEMENT") Item list. + It will be freed normaly in THD::cleanup_after_query(). + */ + thd->free_list= free_list_backup; + stmt->lex->restore_set_statement_var(); DBUG_VOID_RETURN; } @@ -3455,9 +3610,13 @@ Prepared_statement::Prepared_statement(THD *thd_arg) result(thd_arg), param_array(0), cursor(0), + packet(0), + packet_end(0), + iterations(0), param_count(0), last_errno(0), - flags((uint) IS_IN_USE) + flags((uint) IS_IN_USE), + start_param(0) { init_sql_alloc(&main_mem_root, thd_arg->variables.query_alloc_block_size, thd_arg->variables.query_prealloc_size, MYF(MY_THREAD_SPECIFIC)); @@ -3490,19 +3649,23 @@ void Prepared_statement::setup_set_params() if (replace_params_with_values) { - set_params_from_vars= insert_params_from_vars_with_log; + set_params_from_actual_params= insert_params_from_actual_params_with_log; #ifndef EMBEDDED_LIBRARY set_params= insert_params_with_log; + set_bulk_params= insert_bulk_params; // TODO: add binlog support #else + //TODO: add bulk support for bulk parameters set_params_data= emb_insert_params_with_log; #endif } else { - set_params_from_vars= insert_params_from_vars; + set_params_from_actual_params= insert_params_from_actual_params; #ifndef EMBEDDED_LIBRARY set_params= insert_params; + set_bulk_params= insert_bulk_params; #else + //TODO: add bulk support for bulk parameters set_params_data= emb_insert_params; #endif } @@ -3809,8 +3972,8 @@ Prepared_statement::set_parameters(String *expanded_query, if (is_sql_ps) { /* SQL prepared statement */ - res= set_params_from_vars(this, thd->lex->prepared_stmt_params, - expanded_query); + res= set_params_from_actual_params(this, thd->lex->prepared_stmt_params, + expanded_query); } else if (param_count) { @@ -3859,6 +4022,7 @@ Prepared_statement::set_parameters(String *expanded_query, @retval FALSE successfully executed the statement, perhaps after having reprepared it a few times. */ +const static int MAX_REPREPARE_ATTEMPTS= 3; bool Prepared_statement::execute_loop(String *expanded_query, @@ -3866,13 +4030,18 @@ Prepared_statement::execute_loop(String *expanded_query, uchar *packet, uchar *packet_end) { - const int MAX_REPREPARE_ATTEMPTS= 3; Reprepare_observer reprepare_observer; bool error; int reprepare_attempt= 0; -#ifndef DBUG_OFF - Item *free_list_state= thd->free_list; -#endif + iterations= 0; + + /* + - In mysql_sql_stmt_execute() we hide all "external" Items + e.g. those created in the "SET STATEMENT" part of the "EXECUTE" query. + - In case of mysqld_stmt_execute() there should not be "external" Items. + */ + DBUG_ASSERT(thd->free_list == NULL); + thd->select_number= select_number_after_prepare; /* Check if we got an error when sending long data */ if (state == Query_arena::STMT_ERROR) @@ -3894,12 +4063,8 @@ Prepared_statement::execute_loop(String *expanded_query, #endif reexecute: - /* - If the free_list is not empty, we'll wrongly free some externally - allocated items when cleaning up after validation of the prepared - statement. - */ - DBUG_ASSERT(thd->free_list == free_list_state); + // Make sure that reprepare() did not create any new Items. + DBUG_ASSERT(thd->free_list == NULL); /* Install the metadata observer. If some metadata version is @@ -3961,6 +4126,199 @@ reexecute: return error; } +my_bool bulk_parameters_set(THD *thd) +{ + DBUG_ENTER("bulk_parameters_set"); + Prepared_statement *stmt= (Prepared_statement *) thd->bulk_param; + + if (stmt && stmt->set_bulk_parameters(FALSE)) + DBUG_RETURN(TRUE); + DBUG_RETURN(FALSE); +} + +ulong bulk_parameters_iterations(THD *thd) +{ + Prepared_statement *stmt= (Prepared_statement *) thd->bulk_param; + if (!stmt) + return 1; + return stmt->bulk_iterations(); +} + + +my_bool Prepared_statement::set_bulk_parameters(bool reset) +{ + DBUG_ENTER("Prepared_statement::set_bulk_parameters"); + DBUG_PRINT("info", ("iteration: %lu", iterations)); + if (iterations) + { +#ifndef EMBEDDED_LIBRARY + if ((*set_bulk_params)(this, &packet, packet_end, reset)) +#else + // bulk parameters are not supported for embedded, so it will an error +#endif + { + my_error(ER_WRONG_ARGUMENTS, MYF(0), + "mysqld_stmt_bulk_execute"); + reset_stmt_params(this); + DBUG_RETURN(true); + } + iterations--; + } + start_param= 0; + DBUG_RETURN(false); +} + +ulong Prepared_statement::bulk_iterations() +{ + if (iterations) + return iterations; + return start_param ? 1 : 0; +} + +bool +Prepared_statement::execute_bulk_loop(String *expanded_query, + bool open_cursor, + uchar *packet_arg, + uchar *packet_end_arg, + ulong iterations_arg) +{ + Reprepare_observer reprepare_observer; + bool error= 0; + packet= packet_arg; + packet_end= packet_end_arg; + iterations= iterations_arg; + start_param= true; +#ifndef DBUG_OFF + Item *free_list_state= thd->free_list; +#endif + thd->select_number= select_number_after_prepare; + thd->set_bulk_execution((void *)this); + /* Check if we got an error when sending long data */ + if (state == Query_arena::STMT_ERROR) + { + my_message(last_errno, last_error, MYF(0)); + thd->set_bulk_execution(0); + return TRUE; + } + + if (!(sql_command_flags[lex->sql_command] & CF_SP_BULK_SAFE)) + { + my_error(ER_UNSUPPORTED_PS, MYF(0)); + thd->set_bulk_execution(0); + return TRUE; + } + +#ifndef EMBEDDED_LIBRARY + if (setup_conversion_functions(this, &packet, packet_end, TRUE)) +#else + // bulk parameters are not supported for embedded, so it will an error +#endif + { + my_error(ER_WRONG_ARGUMENTS, MYF(0), + "mysqld_stmt_bulk_execute"); + reset_stmt_params(this); + thd->set_bulk_execution(0); + return true; + } + +#ifdef NOT_YET_FROM_MYSQL_5_6 + if (unlikely(thd->security_ctx->password_expired && + !lex->is_change_password)) + { + my_error(ER_MUST_CHANGE_PASSWORD, MYF(0)); + thd->set_bulk_execution(0); + return true; + } +#endif + + // iterations changed by set_bulk_parameters + while ((iterations || start_param) && !error && !thd->is_error()) + { + int reprepare_attempt= 0; + + /* + Here we set parameters for not optimized commands, + optimized commands do it inside thier internal loop. + */ + if (!(sql_command_flags[lex->sql_command] & CF_SP_BULK_OPTIMIZED)) + { + if (set_bulk_parameters(TRUE)) + { + thd->set_bulk_execution(0); + return true; + } + } + +reexecute: + /* + If the free_list is not empty, we'll wrongly free some externally + allocated items when cleaning up after validation of the prepared + statement. + */ + DBUG_ASSERT(thd->free_list == free_list_state); + + /* + Install the metadata observer. If some metadata version is + different from prepare time and an observer is installed, + the observer method will be invoked to push an error into + the error stack. + */ + + if (sql_command_flags[lex->sql_command] & CF_REEXECUTION_FRAGILE) + { + reprepare_observer.reset_reprepare_observer(); + DBUG_ASSERT(thd->m_reprepare_observer == NULL); + thd->m_reprepare_observer= &reprepare_observer; + } + + error= execute(expanded_query, open_cursor) || thd->is_error(); + + thd->m_reprepare_observer= NULL; +#ifdef WITH_WSREP + + if (WSREP_ON) + { + mysql_mutex_lock(&thd->LOCK_wsrep_thd); + switch (thd->wsrep_conflict_state) + { + case CERT_FAILURE: + WSREP_DEBUG("PS execute fail for CERT_FAILURE: thd: %lld err: %d", + (longlong) thd->thread_id, + thd->get_stmt_da()->sql_errno() ); + thd->wsrep_conflict_state = NO_CONFLICT; + break; + + case MUST_REPLAY: + (void) wsrep_replay_transaction(thd); + break; + + default: + break; + } + mysql_mutex_unlock(&thd->LOCK_wsrep_thd); + } +#endif /* WITH_WSREP */ + + if ((sql_command_flags[lex->sql_command] & CF_REEXECUTION_FRAGILE) && + error && !thd->is_fatal_error && !thd->killed && + reprepare_observer.is_invalidated() && + reprepare_attempt++ < MAX_REPREPARE_ATTEMPTS) + { + DBUG_ASSERT(thd->get_stmt_da()->sql_errno() == ER_NEED_REPREPARE); + thd->clear_error(); + + error= reprepare(); + + if (! error) /* Success */ + goto reexecute; + } + } + reset_stmt_params(this); + thd->set_bulk_execution(0); + + return error; +} + bool Prepared_statement::execute_server_runnable(Server_runnable *server_runnable) @@ -4367,16 +4725,58 @@ error: } -/** Common part of DEALLOCATE PREPARE and mysqld_stmt_close. */ +/** + Prepare, execute and clean-up a statement. + @param query - query text + @param length - query text length + @retval true - the query was not executed (parse error, wrong parameters) + @retval false - the query was prepared and executed -void Prepared_statement::deallocate() + Note, if some error happened during execution, it still returns "false". +*/ +bool Prepared_statement::execute_immediate(const char *query, uint query_len) +{ + DBUG_ENTER("Prepared_statement::execute_immediate"); + String expanded_query; + static LEX_STRING execute_immediate_stmt_name= + {(char*) STRING_WITH_LEN("(immediate)") }; + + set_sql_prepare(); + name= execute_immediate_stmt_name; // for DBUG_PRINT etc + if (prepare(query, query_len)) + DBUG_RETURN(true); + + if (param_count != thd->lex->prepared_stmt_params.elements) + { + my_error(ER_WRONG_ARGUMENTS, MYF(0), "EXECUTE"); + deallocate_immediate(); + DBUG_RETURN(true); + } + + (void) execute_loop(&expanded_query, FALSE, NULL, NULL); + deallocate_immediate(); + DBUG_RETURN(false); +} + + +/** + Common part of DEALLOCATE PREPARE, EXECUTE IMMEDIATE, mysqld_stmt_close. +*/ +void Prepared_statement::deallocate_immediate() { /* We account deallocate in the same manner as mysqld_stmt_close */ status_var_increment(thd->status_var.com_stmt_close); /* It should now be safe to reset CHANGE MASTER parameters */ lex_end_stage2(lex); +} + +/** Common part of DEALLOCATE PREPARE and mysqld_stmt_close. */ + +void Prepared_statement::deallocate() +{ + deallocate_immediate(); /* Statement map calls delete stmt on erase */ thd->stmt_map.erase(this); } diff --git a/sql/sql_prepare.h b/sql/sql_prepare.h index aec4ac40036..820cb43e6d5 100644 --- a/sql/sql_prepare.h +++ b/sql/sql_prepare.h @@ -72,15 +72,19 @@ private: void mysqld_stmt_prepare(THD *thd, const char *packet, uint packet_length); void mysqld_stmt_execute(THD *thd, char *packet, uint packet_length); +void mysqld_stmt_bulk_execute(THD *thd, char *packet, uint packet_length); void mysqld_stmt_close(THD *thd, char *packet); void mysql_sql_stmt_prepare(THD *thd); void mysql_sql_stmt_execute(THD *thd); +void mysql_sql_stmt_execute_immediate(THD *thd); void mysql_sql_stmt_close(THD *thd); void mysqld_stmt_fetch(THD *thd, char *packet, uint packet_length); void mysqld_stmt_reset(THD *thd, char *packet); void mysql_stmt_get_longdata(THD *thd, char *pos, ulong packet_length); void reinit_stmt_before_use(THD *thd, LEX *lex); +ulong bulk_parameters_iterations(THD *thd); +my_bool bulk_parameters_set(THD *thd); /** Execute a fragment of server code in an isolated context, so that it doesn't leave any effect on THD. THD must have no open tables. diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 6ece9b793c9..2a22810b8c2 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -495,7 +495,7 @@ static enum enum_binlog_checksum_alg get_binlog_checksum_value_at_connect(THD * TODO - Inform the slave threads that they should sync the position - in the binary log file with flush_relay_log_info. + in the binary log file with Relay_log_info::flush(). Now they sync is done for next read. */ @@ -1629,7 +1629,7 @@ is_until_reached(binlog_send_info *info, ulong *ev_offset, break; case GTID_UNTIL_STOP_AFTER_TRANSACTION: if (event_type != XID_EVENT && - (event_type != QUERY_EVENT || + (event_type != QUERY_EVENT || /* QUERY_COMPRESSED_EVENT would never be commmit or rollback */ !Query_log_event::peek_is_commit_rollback (info->packet->ptr()+*ev_offset, info->packet->length()-*ev_offset, @@ -1863,7 +1863,7 @@ send_event_to_slave(binlog_send_info *info, Log_event_type event_type, return NULL; case GTID_SKIP_TRANSACTION: if (event_type == XID_EVENT || - (event_type == QUERY_EVENT && + (event_type == QUERY_EVENT && /* QUERY_COMPRESSED_EVENT would never be commmit or rollback */ Query_log_event::peek_is_commit_rollback(packet->ptr() + ev_offset, len - ev_offset, current_checksum_alg))) @@ -2205,6 +2205,7 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log, THD *thd= info->thd; String *packet= info->packet; Log_event_type event_type; + DBUG_ENTER("send_format_descriptor_event"); /** * 1) reset fdev before each log-file @@ -2219,12 +2220,12 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log, { info->errmsg= "Out of memory initializing format_description event"; info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG; - return 1; + DBUG_RETURN(1); } /* reset transmit packet for the event read from binary log file */ if (reset_transmit_packet(info, info->flags, &ev_offset, &info->errmsg)) - return 1; + DBUG_RETURN(1); /* Try to find a Format_description_log_event at the beginning of @@ -2240,7 +2241,7 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log, if (error) { set_read_error(info, error); - return 1; + DBUG_RETURN(1); } event_type= (Log_event_type)((uchar)(*packet)[LOG_EVENT_OFFSET+ev_offset]); @@ -2261,7 +2262,7 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log, sql_print_warning("Failed to find format descriptor event in " "start of binlog: %s", info->log_file_name); - return 1; + DBUG_RETURN(1); } info->current_checksum_alg= get_checksum_alg(packet->ptr() + ev_offset, @@ -2281,7 +2282,7 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log, sql_print_warning("Master is configured to log replication events " "with checksum, but will not send such events to " "slaves that cannot process them"); - return 1; + DBUG_RETURN(1); } uint ev_len= packet->length() - ev_offset; @@ -2295,7 +2296,7 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log, info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG; info->errmsg= "Corrupt Format_description event found " "or out-of-memory"; - return 1; + DBUG_RETURN(1); } delete info->fdev; info->fdev= tmp; @@ -2354,7 +2355,7 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log, { info->errmsg= "Failed on my_net_write()"; info->error= ER_UNKNOWN_ERROR; - return 1; + DBUG_RETURN(1); } /* @@ -2374,7 +2375,7 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log, if (error) { set_read_error(info, error); - return 1; + DBUG_RETURN(1); } event_type= (Log_event_type)((uchar)(*packet)[LOG_EVENT_OFFSET]); @@ -2386,14 +2387,15 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log, if (!sele) { info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG; - return 1; + DBUG_RETURN(1); } if (info->fdev->start_decryption(sele)) { info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG; info->errmsg= "Could not decrypt binlog: encryption key error"; - return 1; + delete sele; + DBUG_RETURN(1); } delete sele; } @@ -2409,7 +2411,7 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log, /** all done */ - return 0; + DBUG_RETURN(0); } static bool should_stop(binlog_send_info *info) @@ -3304,6 +3306,7 @@ int reset_slave(THD *thd, Master_info* mi) mi->clear_error(); mi->rli.clear_error(); mi->rli.clear_until_condition(); + mi->rli.clear_sql_delay(); mi->rli.slave_skip_counter= 0; // close master_info_file, relay_log_info_file, set mi->inited=rli->inited=0 @@ -3613,6 +3616,9 @@ bool change_master(THD* thd, Master_info* mi, bool *master_info_added) if (lex_mi->ssl != LEX_MASTER_INFO::LEX_MI_UNCHANGED) mi->ssl= (lex_mi->ssl == LEX_MASTER_INFO::LEX_MI_ENABLE); + if (lex_mi->sql_delay != -1) + mi->rli.set_sql_delay(lex_mi->sql_delay); + if (lex_mi->ssl_verify_server_cert != LEX_MASTER_INFO::LEX_MI_UNCHANGED) mi->ssl_verify_server_cert= (lex_mi->ssl_verify_server_cert == LEX_MASTER_INFO::LEX_MI_ENABLE); @@ -3797,7 +3803,7 @@ bool change_master(THD* thd, Master_info* mi, bool *master_info_added) in-memory value at restart (thus causing errors, as the old relay log does not exist anymore). */ - flush_relay_log_info(&mi->rli); + mi->rli.flush(); mysql_cond_broadcast(&mi->data_cond); mysql_mutex_unlock(&mi->rli.data_lock); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 899fdab8229..331a4942bda 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1121,9 +1121,6 @@ int JOIN::optimize() int JOIN::optimize_inner() { -/* - if (conds) { Item *it_clone= conds->build_clone(thd,thd->mem_root); } -*/ ulonglong select_opts_for_readinfo; uint no_jbuf_after; JOIN_TAB *tab; @@ -1137,6 +1134,12 @@ JOIN::optimize_inner() set_allowed_join_cache_types(); need_distinct= TRUE; + /* + Needed in case optimizer short-cuts, + set properly in make_tmp_tables_info() + */ + fields= &select_lex->item_list; + if (select_lex->first_cond_optimization) { //Do it only for the first execution @@ -1277,10 +1280,21 @@ JOIN::optimize_inner() List_iterator_fast li(select_lex->leaf_tables); while ((tbl= li++)) { + /* + Do not push conditions from where into materialized inner tables + of outer joins: this is not valid. + */ if (tbl->is_materialized_derived()) { - if (pushdown_cond_for_derived(thd, conds, tbl)) - DBUG_RETURN(1); + /* + Do not push conditions from where into materialized inner tables + of outer joins: this is not valid. + */ + if (!tbl->is_inner_table_of_outer_join()) + { + if (pushdown_cond_for_derived(thd, conds, tbl)) + DBUG_RETURN(1); + } if (mysql_handle_single_derived(thd->lex, tbl, DT_OPTIMIZE)) DBUG_RETURN(1); } @@ -1452,6 +1466,7 @@ JOIN::optimize_inner() /* Calculate how to do the join */ THD_STAGE_INFO(thd, stage_statistics); + result->prepare_to_read_rows(); if (make_join_statistics(this, select_lex->leaf_tables, &keyuse) || thd->is_fatal_error) { @@ -1912,7 +1927,7 @@ JOIN::optimize_inner() /* It's necessary to check const part of HAVING cond as there is a chance that some cond parts may become - const items after make_join_statisctics(for example + const items after make_join_statistics(for example when Item is a reference to cost table field from outer join). This check is performed only for those conditions @@ -7476,7 +7491,7 @@ double table_multi_eq_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s, if (!s->keyuse) return sel; - Item_equal *item_equal; + Item_equal *item_equal; List_iterator_fast it(cond_equal->current_level); TABLE *table= s->table; table_map table_bit= table->map; @@ -11842,7 +11857,7 @@ void JOIN::join_free() /** Free resources of given join. - @param fill true if we should free all resources, call with full==1 + @param full true if we should free all resources, call with full==1 should be last, before it this function can be called with full==0 @@ -11954,7 +11969,7 @@ void JOIN::cleanup(bool full) /* If we have tmp_join and 'this' JOIN is not tmp_join and tmp_table_param.copy_field's of them are equal then we have to remove - pointer to tmp_table_param.copy_field from tmp_join, because it qill + pointer to tmp_table_param.copy_field from tmp_join, because it will be removed in tmp_table_param.cleanup(). */ tmp_table_param.cleanup(); @@ -15096,20 +15111,9 @@ bool cond_is_datetime_is_null(Item *cond) if (cond->type() == Item::FUNC_ITEM && ((Item_func*) cond)->functype() == Item_func::ISNULL_FUNC) { - Item **args= ((Item_func_isnull*) cond)->arguments(); - if (args[0]->type() == Item::FIELD_ITEM) - { - Field *field=((Item_field*) args[0])->field; - - if (((field->type() == MYSQL_TYPE_DATE) || - (field->type() == MYSQL_TYPE_DATETIME)) && - (field->flags & NOT_NULL_FLAG)) - { - return TRUE; - } - } + return ((Item_func_isnull*) cond)->arg_is_datetime_notnull_field(); } - return FALSE; + return false; } @@ -16067,6 +16071,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, case Item::CACHE_ITEM: case Item::WINDOW_FUNC_ITEM: // psergey-winfunc: case Item::EXPR_CACHE_ITEM: + case Item::PARAM_ITEM: if (make_copy_field) { DBUG_ASSERT(((Item_result_field*)item)->result_field); @@ -16324,7 +16329,6 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List &fields, table->in_use= thd; table->quick_keys.init(); table->covering_keys.init(); - table->merge_keys.init(); table->intersect_keys.init(); table->keys_in_use_for_query.init(); table->no_rows_with_nulls= param->force_not_null_cols; @@ -17119,7 +17123,7 @@ bool open_tmp_table(TABLE *table) table->db_stat= 0; return 1; } - table->db_stat= HA_OPEN_KEYFILE+HA_OPEN_RNDFILE; + table->db_stat= HA_OPEN_KEYFILE; (void) table->file->extra(HA_EXTRA_QUICK); /* Faster */ if (!table->is_created()) { @@ -18429,9 +18433,6 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab, join_tab->tracker->r_rows++; - if (join_tab->table->vfield) - update_virtual_fields(join->thd, join_tab->table); - if (select_cond) { select_cond_result= MY_TEST(select_cond->val_int()); @@ -18882,8 +18883,6 @@ join_read_system(JOIN_TAB *tab) empty_record(table); // Make empty record return -1; } - if (table->vfield) - update_virtual_fields(tab->join->thd, table); store_record(table,record[1]); } else if (!table->status) // Only happens with left join @@ -18929,8 +18928,6 @@ join_read_const(JOIN_TAB *tab) return report_error(table, error); return -1; } - if (table->vfield) - update_virtual_fields(tab->join->thd, table); store_record(table,record[1]); } else if (!(table->status & ~STATUS_NULL_ROW)) // Only happens with left join @@ -22846,7 +22843,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param, err: if (copy) delete [] param->copy_field; // This is never 0 - param->copy_field=0; + param->copy_field= 0; err2: DBUG_RETURN(TRUE); } diff --git a/sql/sql_show.cc b/sql/sql_show.cc index d48316e4047..d3998450184 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1635,9 +1635,11 @@ static bool print_on_update_clause(Field *field, String *val, bool lcase) val->append(STRING_WITH_LEN("on update ")); else val->append(STRING_WITH_LEN("ON UPDATE ")); - val->append(STRING_WITH_LEN("CURRENT_TIMESTAMP")); + val->append(STRING_WITH_LEN("current_timestamp")); if (field->decimals() > 0) val->append_parenthesized(field->decimals()); + else + val->append(STRING_WITH_LEN("()")); return true; } return false; @@ -1657,56 +1659,47 @@ static bool get_field_default_value(THD *thd, Field *field, String *def_value, def_value->length(0); if (has_default) { + StringBuffer str(field->charset()); if (field->default_value) { - if (field->default_value->expr_item->need_parentheses_in_default()) + field->default_value->print(&str); + if (field->default_value->expr->need_parentheses_in_default()) { def_value->set_charset(&my_charset_utf8mb4_general_ci); def_value->append('('); - def_value->append(field->default_value->expr_str.str, - field->default_value->expr_str.length); + def_value->append(str); def_value->append(')'); } - else if (field->unireg_check) - def_value->append(field->default_value->expr_str.str, - field->default_value->expr_str.length); else - def_value->set(field->default_value->expr_str.str, - field->default_value->expr_str.length, - &my_charset_utf8mb4_general_ci); + def_value->append(str); } else if (!field->is_null()) { // Not null by default - char tmp[MAX_FIELD_WIDTH]; - String type(tmp, sizeof(tmp), field->charset()); if (field_type == MYSQL_TYPE_BIT) { - longlong dec= field->val_int(); - char *ptr= longlong2str(dec, tmp + 2, 2); - uint32 length= (uint32) (ptr - tmp); - tmp[0]= 'b'; - tmp[1]= '\''; - tmp[length]= '\''; - type.length(length + 1); + str.qs_append('b'); + str.qs_append('\''); + str.qs_append(field->val_int(), 2); + str.qs_append('\''); quoted= 0; } else { - field->val_str(&type); + field->val_str(&str); if (!field->str_needs_quotes()) quoted= 0; } - if (type.length()) + if (str.length()) { - String def_val; + StringBuffer def_val; uint dummy_errors; /* convert to system_charset_info == utf8 */ - def_val.copy(type.ptr(), type.length(), field->charset(), + def_val.copy(str.ptr(), str.length(), field->charset(), system_charset_info, &dummy_errors); if (quoted) append_unescaped(def_value, def_val.ptr(), def_val.length()); else - def_value->move(def_val); + def_value->append(def_val); } else if (quoted) def_value->set(STRING_WITH_LEN("''"), system_charset_info); @@ -1918,13 +1911,13 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet, if (field->vcol_info) { - packet->append(STRING_WITH_LEN(" AS (")); - packet->append(field->vcol_info->expr_str.str, - field->vcol_info->expr_str.length, - &my_charset_utf8mb4_general_ci); + StringBuffer str(&my_charset_utf8mb4_general_ci); + field->vcol_info->print(&str); + packet->append(STRING_WITH_LEN(" GENERATED ALWAYS AS (")); + packet->append(str); packet->append(STRING_WITH_LEN(")")); if (field->vcol_info->stored_in_db) - packet->append(STRING_WITH_LEN(" PERSISTENT")); + packet->append(STRING_WITH_LEN(" STORED")); else packet->append(STRING_WITH_LEN(" VIRTUAL")); } @@ -1961,10 +1954,10 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet, } if (field->check_constraint) { + StringBuffer str(&my_charset_utf8mb4_general_ci); + field->check_constraint->print(&str); packet->append(STRING_WITH_LEN(" CHECK (")); - packet->append(field->check_constraint->expr_str.str, - field->check_constraint->expr_str.length, - &my_charset_utf8mb4_general_ci); + packet->append(str); packet->append(STRING_WITH_LEN(")")); } @@ -2062,7 +2055,9 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet, for (uint i= share->field_check_constraints; i < share->table_check_constraints ; i++) { + StringBuffer str(&my_charset_utf8mb4_general_ci); Virtual_column_info *check= table->check_constraints[i]; + check->print(&str); packet->append(STRING_WITH_LEN(",\n ")); if (check->name.length) @@ -2071,9 +2066,7 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet, append_identifier(thd, packet, check->name.str, check->name.length); } packet->append(STRING_WITH_LEN(" CHECK (")); - packet->append(check->expr_str.str, - check->expr_str.length, - &my_charset_utf8mb4_general_ci); + packet->append(str); packet->append(STRING_WITH_LEN(")")); } } @@ -2232,7 +2225,7 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet, uint part_syntax_len; char *part_syntax; String comment_start; - table->part_info->set_show_version_string(&comment_start); + comment_start.append(STRING_WITH_LEN("\n")); if ((part_syntax= generate_partition_syntax(thd, table->part_info, &part_syntax_len, FALSE, @@ -2241,8 +2234,7 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet, comment_start.c_ptr()))) { packet->append(comment_start); - if (packet->append(part_syntax, part_syntax_len) || - packet->append(STRING_WITH_LEN(" */"))) + if (packet->append(part_syntax, part_syntax_len)) error= 1; my_free(part_syntax); } @@ -5516,9 +5508,9 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables, if (field->vcol_info) { if (field->vcol_info->stored_in_db) - table->field[17]->store(STRING_WITH_LEN("PERSISTENT"), cs); + table->field[17]->store(STRING_WITH_LEN("STORED GENERATED"), cs); else - table->field[17]->store(STRING_WITH_LEN("VIRTUAL"), cs); + table->field[17]->store(STRING_WITH_LEN("VIRTUAL GENERATED"), cs); } table->field[19]->store(field->comment.str, field->comment.length, cs); if (schema_table_store_record(thd, table)) @@ -7366,6 +7358,7 @@ get_referential_constraints_record(THD *thd, TABLE_LIST *tables, LEX_STRING *db_name, LEX_STRING *table_name) { CHARSET_INFO *cs= system_charset_info; + LEX_CSTRING *s; DBUG_ENTER("get_referential_constraints_record"); if (res) @@ -7410,10 +7403,10 @@ get_referential_constraints_record(THD *thd, TABLE_LIST *tables, else table->field[5]->set_null(); table->field[6]->store(STRING_WITH_LEN("NONE"), cs); - table->field[7]->store(f_key_info->update_method->str, - f_key_info->update_method->length, cs); - table->field[8]->store(f_key_info->delete_method->str, - f_key_info->delete_method->length, cs); + s= fk_option_name(f_key_info->update_method); + table->field[7]->store(s->str, s->length, cs); + s= fk_option_name(f_key_info->delete_method); + table->field[8]->store(s->str, s->length, cs); if (schema_table_store_record(thd, table)) DBUG_RETURN(1); } @@ -8447,7 +8440,7 @@ ST_FIELD_INFO columns_fields_info[]= OPEN_FRM_ONLY}, {"COLUMN_TYPE", 65535, MYSQL_TYPE_STRING, 0, 0, "Type", OPEN_FRM_ONLY}, {"COLUMN_KEY", 3, MYSQL_TYPE_STRING, 0, 0, "Key", OPEN_FRM_ONLY}, - {"EXTRA", 27, MYSQL_TYPE_STRING, 0, 0, "Extra", OPEN_FRM_ONLY}, + {"EXTRA", 30, MYSQL_TYPE_STRING, 0, 0, "Extra", OPEN_FRM_ONLY}, {"PRIVILEGES", 80, MYSQL_TYPE_STRING, 0, 0, "Privileges", OPEN_FRM_ONLY}, {"COLUMN_COMMENT", COLUMN_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0, "Comment", OPEN_FRM_ONLY}, diff --git a/sql/sql_signal.cc b/sql/sql_signal.cc index 5f4862f173c..1b7edbee54a 100644 --- a/sql/sql_signal.cc +++ b/sql/sql_signal.cc @@ -63,20 +63,6 @@ const LEX_STRING Diag_condition_item_names[]= { C_STRING_WITH_LEN("TRIGGER_SCHEMA") } }; -const LEX_STRING Diag_statement_item_names[]= -{ - { C_STRING_WITH_LEN("NUMBER") }, - { C_STRING_WITH_LEN("MORE") }, - { C_STRING_WITH_LEN("COMMAND_FUNCTION") }, - { C_STRING_WITH_LEN("COMMAND_FUNCTION_CODE") }, - { C_STRING_WITH_LEN("DYNAMIC_FUNCTION") }, - { C_STRING_WITH_LEN("DYNAMIC_FUNCTION_CODE") }, - { C_STRING_WITH_LEN("ROW_COUNT") }, - { C_STRING_WITH_LEN("TRANSACTIONS_COMMITTED") }, - { C_STRING_WITH_LEN("TRANSACTIONS_ROLLED_BACK") }, - { C_STRING_WITH_LEN("TRANSACTION_ACTIVE") } -}; - Set_signal_information::Set_signal_information( const Set_signal_information& set) diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index 83c7db8b510..6de8727876c 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -130,6 +130,128 @@ inline void init_table_list_for_single_stat_table(TABLE_LIST *tbl, } +static Table_check_intact_log_error stat_table_intact; + +static const +TABLE_FIELD_TYPE table_stat_fields[TABLE_STAT_N_FIELDS] = +{ + { + { C_STRING_WITH_LEN("db_name") }, + { C_STRING_WITH_LEN("varchar(64)") }, + { C_STRING_WITH_LEN("utf8") } + }, + { + { C_STRING_WITH_LEN("table_name") }, + { C_STRING_WITH_LEN("varchar(64)") }, + { C_STRING_WITH_LEN("utf8") } + }, + { + { C_STRING_WITH_LEN("cardinality") }, + { C_STRING_WITH_LEN("bigint(21)") }, + { NULL, 0 } + }, +}; +static const uint table_stat_pk_col[]= {0,1}; +static const TABLE_FIELD_DEF +table_stat_def= {TABLE_STAT_N_FIELDS, table_stat_fields, 2, table_stat_pk_col }; + +static const +TABLE_FIELD_TYPE column_stat_fields[COLUMN_STAT_N_FIELDS] = +{ + { + { C_STRING_WITH_LEN("db_name") }, + { C_STRING_WITH_LEN("varchar(64)") }, + { C_STRING_WITH_LEN("utf8") } + }, + { + { C_STRING_WITH_LEN("table_name") }, + { C_STRING_WITH_LEN("varchar(64)") }, + { C_STRING_WITH_LEN("utf8") } + }, + { + { C_STRING_WITH_LEN("column_name") }, + { C_STRING_WITH_LEN("varchar(64)") }, + { C_STRING_WITH_LEN("utf8") } + }, + { + { C_STRING_WITH_LEN("min_value") }, + { C_STRING_WITH_LEN("varbinary(255)") }, + { NULL, 0 } + }, + { + { C_STRING_WITH_LEN("max_value") }, + { C_STRING_WITH_LEN("varbinary(255)") }, + { NULL, 0 } + }, + { + { C_STRING_WITH_LEN("nulls_ratio") }, + { C_STRING_WITH_LEN("decimal(12,4)") }, + { NULL, 0 } + }, + { + { C_STRING_WITH_LEN("avg_length") }, + { C_STRING_WITH_LEN("decimal(12,4)") }, + { NULL, 0 } + }, + { + { C_STRING_WITH_LEN("avg_frequency") }, + { C_STRING_WITH_LEN("decimal(12,4)") }, + { NULL, 0 } + }, + { + { C_STRING_WITH_LEN("hist_size") }, + { C_STRING_WITH_LEN("tinyint(3)") }, + { NULL, 0 } + }, + { + { C_STRING_WITH_LEN("hist_type") }, + { C_STRING_WITH_LEN("enum('SINGLE_PREC_HB','DOUBLE_PREC_HB')") }, + { C_STRING_WITH_LEN("utf8") } + }, + { + { C_STRING_WITH_LEN("histogram") }, + { C_STRING_WITH_LEN("varbinary(255)") }, + { NULL, 0 } + } +}; +static const uint column_stat_pk_col[]= {0,1,2}; +static const TABLE_FIELD_DEF +column_stat_def= {COLUMN_STAT_N_FIELDS, column_stat_fields, 3, column_stat_pk_col}; + +static const +TABLE_FIELD_TYPE index_stat_fields[INDEX_STAT_N_FIELDS] = +{ + { + { C_STRING_WITH_LEN("db_name") }, + { C_STRING_WITH_LEN("varchar(64)") }, + { C_STRING_WITH_LEN("utf8") } + }, + { + { C_STRING_WITH_LEN("table_name") }, + { C_STRING_WITH_LEN("varchar(64)") }, + { C_STRING_WITH_LEN("utf8") } + }, + { + { C_STRING_WITH_LEN("index") }, + { C_STRING_WITH_LEN("varchar(64)") }, + { C_STRING_WITH_LEN("utf8") } + }, + { + { C_STRING_WITH_LEN("prefix_arity") }, + { C_STRING_WITH_LEN("int(11)") }, + { NULL, 0 } + }, + { + { C_STRING_WITH_LEN("avg_frequency") }, + { C_STRING_WITH_LEN("decimal(12,4)") }, + { NULL, 0 } + } +}; +static const uint index_stat_pk_col[]= {0,1,2,3}; +static const TABLE_FIELD_DEF +index_stat_def= {INDEX_STAT_N_FIELDS, index_stat_fields, 4, index_stat_pk_col}; + + /** @brief Open all statistical tables and lock them @@ -140,10 +262,30 @@ inline int open_stat_tables(THD *thd, TABLE_LIST *tables, Open_tables_backup *backup, bool for_write) { + int rc; + + Dummy_error_handler deh; // suppress errors + thd->push_internal_handler(&deh); init_table_list_for_stat_tables(tables, for_write); init_mdl_requests(tables); - return open_system_tables_for_read(thd, tables, backup); -} + rc= open_system_tables_for_read(thd, tables, backup); + thd->pop_internal_handler(); + + + /* If the number of tables changes, we should revise the check below. */ + DBUG_ASSERT(STATISTICS_TABLES == 3); + + if (!rc && + (stat_table_intact.check(tables[TABLE_STAT].table, &table_stat_def) || + stat_table_intact.check(tables[COLUMN_STAT].table, &column_stat_def) || + stat_table_intact.check(tables[INDEX_STAT].table, &index_stat_def))) + { + close_system_tables(thd, backup); + rc= 1; + } + + return rc; +} /** @@ -1004,11 +1146,13 @@ public: switch (i) { case COLUMN_STAT_MIN_VALUE: + table_field->read_stats->min_value->set_notnull(); stat_field->val_str(&val); table_field->read_stats->min_value->store(val.ptr(), val.length(), &my_charset_bin); break; case COLUMN_STAT_MAX_VALUE: + table_field->read_stats->max_value->set_notnull(); stat_field->val_str(&val); table_field->read_stats->max_value->store(val.ptr(), val.length(), &my_charset_bin); @@ -2725,10 +2869,7 @@ int update_statistics_for_table(THD *thd, TABLE *table) DEBUG_SYNC(thd, "statistics_update_start"); if (open_stat_tables(thd, tables, &open_tables_backup, TRUE)) - { - thd->clear_error(); DBUG_RETURN(rc); - } save_binlog_format= thd->set_current_stmt_binlog_format_stmt(); @@ -3156,10 +3297,7 @@ int delete_statistics_for_table(THD *thd, LEX_STRING *db, LEX_STRING *tab) DBUG_ENTER("delete_statistics_for_table"); if (open_stat_tables(thd, tables, &open_tables_backup, TRUE)) - { - thd->clear_error(); DBUG_RETURN(rc); - } save_binlog_format= thd->set_current_stmt_binlog_format_stmt(); @@ -3398,10 +3536,7 @@ int rename_table_in_stat_tables(THD *thd, LEX_STRING *db, LEX_STRING *tab, DBUG_ENTER("rename_table_in_stat_tables"); if (open_stat_tables(thd, tables, &open_tables_backup, TRUE)) - { - thd->clear_error(); - DBUG_RETURN(rc); - } + DBUG_RETURN(0); // not an error save_binlog_format= thd->set_current_stmt_binlog_format_stmt(); @@ -3591,7 +3726,7 @@ double get_column_avg_frequency(Field * field) return res; } - Column_statistics *col_stats= table->s->field[field->field_index]->read_stats; + Column_statistics *col_stats= field->read_stats; if (!col_stats) res= table->stat_records(); @@ -3629,7 +3764,7 @@ double get_column_range_cardinality(Field *field, { double res; TABLE *table= field->table; - Column_statistics *col_stats= table->field[field->field_index]->read_stats; + Column_statistics *col_stats= field->read_stats; double tab_records= table->stat_records(); if (!col_stats) @@ -3661,17 +3796,8 @@ double get_column_range_cardinality(Field *field, { double avg_frequency= col_stats->get_avg_frequency(); res= avg_frequency; - /* - psergey-todo: what does check for min_value, max_value mean? - min/max_value are set to NULL in alloc_statistics_for_table() and - alloc_statistics_for_table_share(). Both functions will immediately - call create_min_max_statistical_fields_for_table and - create_min_max_statistical_fields_for_table_share() respectively, - which will set min/max_value to be valid pointers, unless OOM - occurs. - */ if (avg_frequency > 1.0 + 0.000001 && - col_stats->min_value && col_stats->max_value) + col_stats->min_max_values_are_provided()) { Histogram *hist= &col_stats->histogram; if (hist->is_available()) @@ -3694,7 +3820,7 @@ double get_column_range_cardinality(Field *field, } else { - if (col_stats->min_value && col_stats->max_value) + if (col_stats->min_max_values_are_provided()) { double sel, min_mp_pos, max_mp_pos; @@ -3849,3 +3975,21 @@ double Histogram::point_selectivity(double pos, double avg_sel) return sel; } +/* + Check whether the table is one of the persistent statistical tables. +*/ +bool is_stat_table(const char *db, const char *table) +{ + DBUG_ASSERT(db && table); + + if (!memcmp(db, stat_tables_db_name.str, stat_tables_db_name.length)) + { + for (uint i= 0; i < STATISTICS_TABLES; i ++) + { + if (!memcmp(table, stat_table_name[i].str, stat_table_name[i].length)) + return true; + } + } + return false; +} + diff --git a/sql/sql_statistics.h b/sql/sql_statistics.h index 46e5cef22d1..f46583839d1 100644 --- a/sql/sql_statistics.h +++ b/sql/sql_statistics.h @@ -52,7 +52,8 @@ enum enum_table_stat_col { TABLE_STAT_DB_NAME, TABLE_STAT_TABLE_NAME, - TABLE_STAT_CARDINALITY + TABLE_STAT_CARDINALITY, + TABLE_STAT_N_FIELDS }; enum enum_column_stat_col @@ -67,7 +68,8 @@ enum enum_column_stat_col COLUMN_STAT_AVG_FREQUENCY, COLUMN_STAT_HIST_SIZE, COLUMN_STAT_HIST_TYPE, - COLUMN_STAT_HISTOGRAM + COLUMN_STAT_HISTOGRAM, + COLUMN_STAT_N_FIELDS }; enum enum_index_stat_col @@ -76,7 +78,8 @@ enum enum_index_stat_col INDEX_STAT_TABLE_NAME, INDEX_STAT_INDEX_NAME, INDEX_STAT_PREFIX_ARITY, - INDEX_STAT_AVG_FREQUENCY + INDEX_STAT_AVG_FREQUENCY, + INDEX_STAT_N_FIELDS }; inline @@ -107,6 +110,7 @@ double get_column_range_cardinality(Field *field, key_range *min_endp, key_range *max_endp, uint range_flag); +bool is_stat_table(const char *db, const char *table); class Histogram { @@ -388,6 +392,11 @@ public: avg_frequency= (ulong) (val * Scale_factor_avg_frequency); } + bool min_max_values_are_provided() + { + return !is_null(COLUMN_STAT_MIN_VALUE) && + !is_null(COLUMN_STAT_MIN_VALUE); + } }; diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 4bb9f835211..62473e082c3 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -733,7 +733,7 @@ void String::qs_append(int i) void String::qs_append(ulonglong i) { char *buff= Ptr + str_length; - char *end= longlong10_to_str(i, buff,10); + char *end= longlong10_to_str(i, buff, 10); str_length+= (int) (end-buff); } @@ -1018,10 +1018,10 @@ String_copier::well_formed_copy(CHARSET_INFO *to_cs, { m_cannot_convert_error_pos= NULL; return to_cs->cset->copy_fix(to_cs, to, to_length, from, from_length, - nchars, &m_native_copy_status); + nchars, this); } return my_convert_fix(to_cs, to, to_length, from_cs, from, from_length, - nchars, this); + nchars, this, this); } diff --git a/sql/sql_string.h b/sql/sql_string.h index cc7cff09d77..4b70675dca4 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -44,13 +44,48 @@ inline uint32 copy_and_convert(char *to, uint32 to_length, } -class String_copier: private MY_STRCONV_STATUS +class String_copy_status: protected MY_STRCOPY_STATUS { public: const char *source_end_pos() const - { return m_native_copy_status.m_source_end_pos; } + { return m_source_end_pos; } const char *well_formed_error_pos() const - { return m_native_copy_status.m_well_formed_error_pos; } + { return m_well_formed_error_pos; } +}; + + +class Well_formed_prefix_status: public String_copy_status +{ +public: + Well_formed_prefix_status(CHARSET_INFO *cs, + const char *str, const char *end, size_t nchars) + { cs->cset->well_formed_char_length(cs, str, end, nchars, this); } +}; + + +class Well_formed_prefix: public Well_formed_prefix_status +{ + const char *m_str; // The beginning of the string +public: + Well_formed_prefix(CHARSET_INFO *cs, const char *str, const char *end, + size_t nchars) + :Well_formed_prefix_status(cs, str, end, nchars), m_str(str) + { } + Well_formed_prefix(CHARSET_INFO *cs, const char *str, size_t length, + size_t nchars) + :Well_formed_prefix_status(cs, str, str + length, nchars), m_str(str) + { } + Well_formed_prefix(CHARSET_INFO *cs, const char *str, size_t length) + :Well_formed_prefix_status(cs, str, str + length, length), m_str(str) + { } + size_t length() const { return m_source_end_pos - m_str; } +}; + + +class String_copier: public String_copy_status, + protected MY_STRCONV_STATUS +{ +public: const char *cannot_convert_error_pos() const { return m_cannot_convert_error_pos; } const char *most_important_error_pos() const @@ -67,7 +102,7 @@ public: uint nchars) { return my_convert_fix(dstcs, dst, dst_length, - srccs, src, src_length, nchars, this); + srccs, src, src_length, nchars, this, this); } /* Copy a string. Fix bad bytes/characters to '?'. @@ -431,10 +466,8 @@ public: } bool append(const String &s); bool append(const char *s); - bool append(const LEX_STRING *ls) - { - return append(ls->str, ls->length); - } + bool append(const LEX_STRING *ls) { return append(ls->str, ls->length); } + bool append(const LEX_CSTRING *ls) { return append(ls->str, ls->length); } bool append(const char *s, uint32 arg_length); bool append(const char *s, uint32 arg_length, CHARSET_INFO *cs); bool append_ulonglong(ulonglong val); @@ -551,6 +584,12 @@ public: qs_append((ulonglong)i); } void qs_append(ulonglong i); + void qs_append(longlong i, int radix) + { + char *buff= Ptr + str_length; + char *end= ll2str(i, buff, radix, 0); + str_length+= (int) (end-buff); + } /* Inline (general) functions used by the protocol functions */ @@ -606,9 +645,7 @@ public: } uint well_formed_length() const { - int dummy_error; - return charset()->cset->well_formed_len(charset(), ptr(), ptr() + length(), - length(), &dummy_error); + return (uint) Well_formed_prefix(charset(), ptr(), length()).length(); } bool is_ascii() const { diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 38b45a7a2c9..b22f831ddab 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -671,7 +671,7 @@ static bool read_ddl_log_file_entry(uint entry_no) bool error= FALSE; File file_id= global_ddl_log.file_id; uchar *file_entry_buf= (uchar*)global_ddl_log.file_entry_buf; - uint io_size= global_ddl_log.io_size; + size_t io_size= global_ddl_log.io_size; DBUG_ENTER("read_ddl_log_file_entry"); mysql_mutex_assert_owner(&LOCK_gdl); @@ -2299,6 +2299,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists, error= 1; goto err; } + error= 0; table->table= 0; } @@ -2440,7 +2441,8 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists, if (table_type && table_type != view_pseudo_hton) ha_lock_engine(thd, table_type); - if (thd->locked_tables_mode) + if (thd->locked_tables_mode == LTM_LOCK_TABLES || + thd->locked_tables_mode == LTM_PRELOCKED_UNDER_LOCK_TABLES) { if (wait_while_table_is_used(thd, table->table, HA_EXTRA_NOT_USED)) { @@ -2510,8 +2512,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists, table->table ? (long) table->table->s : (long) -1)); DBUG_EXECUTE_IF("bug43138", - my_printf_error(ER_BAD_TABLE_ERROR, - ER_THD(thd, ER_BAD_TABLE_ERROR), MYF(0), + my_error(ER_BAD_TABLE_ERROR, MYF(0), table->table_name);); } DEBUG_SYNC(thd, "rm_table_no_locks_before_binlog"); @@ -2523,12 +2524,9 @@ err: { DBUG_ASSERT(errors); if (errors == 1 && was_view) - my_printf_error(ER_IT_IS_A_VIEW, ER_THD(thd, ER_IT_IS_A_VIEW), MYF(0), - wrong_tables.c_ptr_safe()); + my_error(ER_IT_IS_A_VIEW, MYF(0), wrong_tables.c_ptr_safe()); else if (errors > 1 || !thd->is_error()) - my_printf_error(ER_BAD_TABLE_ERROR, ER_THD(thd, ER_BAD_TABLE_ERROR), - MYF(0), - wrong_tables.c_ptr_safe()); + my_error(ER_BAD_TABLE_ERROR, MYF(0), wrong_tables.c_ptr_safe()); error= 1; } @@ -2901,15 +2899,13 @@ int prepare_create_field(Column_definition *sql_field, if (sql_field->charset->state & MY_CS_BINSORT) sql_field->pack_flag|=FIELDFLAG_BINARY; sql_field->length=8; // Unireg field length - sql_field->unireg_check=Field::BLOB_FIELD; (*blob_columns)++; break; case MYSQL_TYPE_GEOMETRY: #ifdef HAVE_SPATIAL if (!(table_flags & HA_CAN_GEOMETRY)) { - my_printf_error(ER_CHECK_NOT_IMPLEMENTED, ER(ER_CHECK_NOT_IMPLEMENTED), - MYF(0), "GEOMETRY"); + my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "GEOMETRY"); DBUG_RETURN(1); } sql_field->pack_flag=FIELDFLAG_GEOM | @@ -2918,11 +2914,10 @@ int prepare_create_field(Column_definition *sql_field, if (sql_field->charset->state & MY_CS_BINSORT) sql_field->pack_flag|=FIELDFLAG_BINARY; sql_field->length=8; // Unireg field length - sql_field->unireg_check=Field::BLOB_FIELD; (*blob_columns)++; break; #else - my_printf_error(ER_FEATURE_DISABLED,ER(ER_FEATURE_DISABLED), MYF(0), + my_error(ER_FEATURE_DISABLED, MYF(0), sym_group_geom.name, sym_group_geom.needed_define); DBUG_RETURN(1); #endif /*HAVE_SPATIAL*/ @@ -2937,8 +2932,7 @@ int prepare_create_field(Column_definition *sql_field, if ((sql_field->length / sql_field->charset->mbmaxlen) > MAX_FIELD_CHARLENGTH) { - my_printf_error(ER_TOO_BIG_FIELDLENGTH, ER(ER_TOO_BIG_FIELDLENGTH), - MYF(0), sql_field->field_name, + my_error(ER_TOO_BIG_FIELDLENGTH, MYF(0), sql_field->field_name, static_cast(MAX_FIELD_CHARLENGTH)); DBUG_RETURN(1); } @@ -2955,7 +2949,6 @@ int prepare_create_field(Column_definition *sql_field, FIELDFLAG_INTERVAL; if (sql_field->charset->state & MY_CS_BINSORT) sql_field->pack_flag|=FIELDFLAG_BINARY; - sql_field->unireg_check=Field::INTERVAL_FIELD; if (check_duplicates_in_interval("ENUM",sql_field->field_name, sql_field->interval, sql_field->charset, &dup_val_count)) @@ -2966,7 +2959,6 @@ int prepare_create_field(Column_definition *sql_field, FIELDFLAG_BITFIELD; if (sql_field->charset->state & MY_CS_BINSORT) sql_field->pack_flag|=FIELDFLAG_BINARY; - sql_field->unireg_check=Field::BIT_FIELD; if (check_duplicates_in_interval("SET",sql_field->field_name, sql_field->interval, sql_field->charset, &dup_val_count)) @@ -3112,8 +3104,7 @@ void promote_first_timestamp_column(List *column_definitions) @param key_info Key meta-data info. @param key_list List of existing keys. */ -static void check_duplicate_key(THD *thd, - Key *key, KEY *key_info, +static void check_duplicate_key(THD *thd, Key *key, KEY *key_info, List *key_list) { /* @@ -3175,14 +3166,11 @@ static void check_duplicate_key(THD *thd, // Report a warning if we have two identical keys. - DBUG_ASSERT(thd->lex->query_tables->alias); if (all_columns_are_identical) { push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, ER_DUP_INDEX, ER_THD(thd, ER_DUP_INDEX), - key_info->name, - thd->lex->query_tables->db, - thd->lex->query_tables->alias); + key_info->name); break; } } @@ -3348,53 +3336,14 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, if (prepare_blob_field(thd, sql_field)) DBUG_RETURN(TRUE); - if (sql_field->default_value) - { - Virtual_column_info *def= sql_field->default_value; - - if (!sql_field->has_default_expression()) - def->expr_str= null_lex_str; - - if (!def->expr_item->basic_const_item() && !def->flags) - { - Item *expr= def->expr_item; - int err= !expr->fixed && // may be already fixed if ALTER TABLE - expr->fix_fields(thd, &expr); - if (!err) - { - if (expr->result_type() == REAL_RESULT) - { // don't convert floats to string and back, it can be lossy - double res= expr->val_real(); - if (expr->null_value) - expr= new (thd->mem_root) Item_null(thd); - else - expr= new (thd->mem_root) Item_float(thd, res, expr->decimals); - } - else - { - StringBuffer buf; - String *res= expr->val_str(&buf); - if (expr->null_value) - expr= new (thd->mem_root) Item_null(thd); - else - { - char *str= (char*) thd->strmake(res->ptr(), res->length()); - expr= new (thd->mem_root) Item_string(thd, str, res->length(), res->charset()); - } - } - thd->change_item_tree(&def->expr_item, expr); - } - } - } - /* Convert the default value from client character set into the column character set if necessary. We can only do this for constants as we have not yet run fix_fields. */ if (sql_field->default_value && - sql_field->default_value->expr_item->basic_const_item() && - save_cs != sql_field->default_value->expr_item->collation.collation && + sql_field->default_value->expr->basic_const_item() && + save_cs != sql_field->default_value->expr->collation.collation && (sql_field->sql_type == MYSQL_TYPE_VAR_STRING || sql_field->sql_type == MYSQL_TYPE_STRING || sql_field->sql_type == MYSQL_TYPE_SET || @@ -3405,7 +3354,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, sql_field->sql_type == MYSQL_TYPE_ENUM)) { Item *item; - if (!(item= sql_field->default_value->expr_item-> + if (!(item= sql_field->default_value->expr-> safe_charset_converter(thd, save_cs))) { /* Could not convert */ @@ -3413,16 +3362,16 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, DBUG_RETURN(TRUE); } /* Fix for prepare statement */ - thd->change_item_tree(&sql_field->default_value->expr_item, item); + thd->change_item_tree(&sql_field->default_value->expr, item); } if (sql_field->default_value && - sql_field->default_value->expr_item->basic_const_item() && + sql_field->default_value->expr->basic_const_item() && (sql_field->sql_type == MYSQL_TYPE_SET || sql_field->sql_type == MYSQL_TYPE_ENUM)) { StringBuffer str; - String *def= sql_field->default_value->expr_item->val_str(&str); + String *def= sql_field->default_value->expr->val_str(&str); bool not_found; if (def == NULL) /* SQL "NULL" maps to NULL */ { @@ -3849,9 +3798,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, if (!my_strcasecmp(system_charset_info, column->field_name.str, dup_column->field_name.str)) { - my_printf_error(ER_DUP_FIELDNAME, - ER_THD(thd, ER_DUP_FIELDNAME),MYF(0), - column->field_name.str); + my_error(ER_DUP_FIELDNAME, MYF(0), column->field_name.str); DBUG_RETURN(TRUE); } } @@ -3927,16 +3874,21 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, } } #endif - if (!sql_field->stored_in_db()) + if (sql_field->vcol_info) { - /* Key fields must always be physically stored. */ - my_error(ER_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN, MYF(0)); - DBUG_RETURN(TRUE); - } - if (key->type == Key::PRIMARY && sql_field->vcol_info) - { - my_error(ER_PRIMARY_KEY_BASED_ON_VIRTUAL_COLUMN, MYF(0)); - DBUG_RETURN(TRUE); + if (key->type == Key::PRIMARY) + { + my_error(ER_PRIMARY_KEY_BASED_ON_GENERATED_COLUMN, MYF(0)); + DBUG_RETURN(TRUE); + } + if (sql_field->vcol_info->flags & VCOL_NOT_STRICTLY_DETERMINISTIC) + { + /* use check_expression() to report an error */ + check_expression(sql_field->vcol_info, sql_field->field_name, + VCOL_GENERATED_STORED); + DBUG_ASSERT(thd->is_error()); + DBUG_RETURN(TRUE); + } } if (!(sql_field->flags & NOT_NULL_FLAG)) { @@ -4222,11 +4174,10 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, if (check_string_char_length(&check->name, 0, NAME_CHAR_LEN, system_charset_info, 1)) { - my_error(ER_TOO_LONG_IDENT, MYF(0), key->name.str); + my_error(ER_TOO_LONG_IDENT, MYF(0), check->name.str); DBUG_RETURN(TRUE); } - if (check_expression(check, "CONSTRAINT CHECK", - check->name.str ? check->name.str : "", 0)) + if (check_expression(check, check->name.str, VCOL_CHECK_TABLE)) DBUG_RETURN(TRUE); } } @@ -6297,11 +6248,6 @@ static bool fill_alter_inplace_info(THD *thd, alter_info->key_list.elements))) DBUG_RETURN(true); - /* First we setup ha_alter_flags based on what was detected by parser. */ - if (alter_info->flags & Alter_info::ALTER_ADD_COLUMN) - ha_alter_info->handler_flags|= Alter_inplace_info::ADD_COLUMN; - if (alter_info->flags & Alter_info::ALTER_DROP_COLUMN) - ha_alter_info->handler_flags|= Alter_inplace_info::DROP_COLUMN; /* Comparing new and old default values of column is cumbersome. So instead of using such a comparison for detecting if default @@ -6349,7 +6295,7 @@ static bool fill_alter_inplace_info(THD *thd, upgrading VARCHAR column types. */ if (table->s->frm_version < FRM_VER_TRUE_VARCHAR && varchar) - ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_COLUMN_TYPE; + ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_STORED_COLUMN_TYPE; /* Go through fields in old version of table and detect changes to them. @@ -6363,20 +6309,23 @@ static bool fill_alter_inplace_info(THD *thd, about nature of changes than those provided from parser. */ bool maybe_alter_vcol= false; - for (f_ptr= table->field; (field= *f_ptr); f_ptr++) + uint field_stored_index= 0; + for (f_ptr= table->field; (field= *f_ptr); f_ptr++, + field_stored_index+= field->stored_in_db()) { /* Clear marker for renamed or dropped field which we are going to set later. */ field->flags&= ~(FIELD_IS_RENAMED | FIELD_IS_DROPPED); /* Use transformed info to evaluate flags for storage engine. */ - uint new_field_index= 0; + uint new_field_index= 0, new_field_stored_index= 0; new_field_it.init(alter_info->create_list); while ((new_field= new_field_it++)) { if (new_field->field == field) break; new_field_index++; + new_field_stored_index+= new_field->stored_in_db(); } if (new_field) @@ -6391,7 +6340,12 @@ static bool fill_alter_inplace_info(THD *thd, { case IS_EQUAL_NO: /* New column type is incompatible with old one. */ - ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_COLUMN_TYPE; + if (field->stored_in_db()) + ha_alter_info->handler_flags|= + Alter_inplace_info::ALTER_STORED_COLUMN_TYPE; + else + ha_alter_info->handler_flags|= + Alter_inplace_info::ALTER_VIRTUAL_COLUMN_TYPE; if (table->s->tmp_table == NO_TMP_TABLE) { delete_statistics_for_column(thd, table, field); @@ -6436,21 +6390,59 @@ static bool fill_alter_inplace_info(THD *thd, default: DBUG_ASSERT(0); /* Safety. */ - ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_COLUMN_TYPE; + ha_alter_info->handler_flags|= + Alter_inplace_info::ALTER_STORED_COLUMN_TYPE; } - /* - Check if the column is computed and either - is stored or is used in the partitioning expression. - */ - if (field->vcol_info && - (field->stored_in_db() || field->vcol_info->is_in_partitioning_expr())) + if (field->vcol_info || new_field->vcol_info) { - if (is_equal == IS_EQUAL_NO || - !field->vcol_info->is_equal(new_field->vcol_info)) - ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_COLUMN_VCOL; - else - maybe_alter_vcol= true; + /* base <-> virtual or stored <-> virtual */ + if (field->stored_in_db() != new_field->stored_in_db()) + ha_alter_info->handler_flags|= + Alter_inplace_info::ALTER_STORED_COLUMN_TYPE | + Alter_inplace_info::ALTER_VIRTUAL_COLUMN_TYPE; + if (field->vcol_info && new_field->vcol_info) + { + bool value_changes= is_equal == IS_EQUAL_NO; + Alter_inplace_info::HA_ALTER_FLAGS alter_expr; + if (field->stored_in_db()) + alter_expr= Alter_inplace_info::ALTER_STORED_GCOL_EXPR; + else + alter_expr= Alter_inplace_info::ALTER_VIRTUAL_GCOL_EXPR; + if (!field->vcol_info->is_equal(new_field->vcol_info)) + { + ha_alter_info->handler_flags|= alter_expr; + value_changes= true; + } + + if ((ha_alter_info->handler_flags & Alter_inplace_info::ALTER_COLUMN_DEFAULT) + && !(ha_alter_info->handler_flags & alter_expr)) + { /* + a DEFAULT value of a some column was changed. see if this vcol + uses DEFAULT() function. The check is kind of expensive, so don't + do it if ALTER_COLUMN_VCOL is already set. + */ + if (field->vcol_info->expr->walk( + &Item::check_func_default_processor, 0, 0)) + { + ha_alter_info->handler_flags|= alter_expr; + value_changes= true; + } + } + + if (field->vcol_info->is_in_partitioning_expr() || + field->flags & PART_KEY_FLAG) + { + if (value_changes) + ha_alter_info->handler_flags|= + Alter_inplace_info::ALTER_COLUMN_VCOL; + else + maybe_alter_vcol= true; + } + } + else /* base <-> stored */ + ha_alter_info->handler_flags|= + Alter_inplace_info::ALTER_STORED_COLUMN_TYPE; } /* Check if field was renamed */ @@ -6483,8 +6475,18 @@ static bool fill_alter_inplace_info(THD *thd, /* Detect changes in column order. */ - if (field->field_index != new_field_index) - ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_COLUMN_ORDER; + if (field->stored_in_db()) + { + if (field_stored_index != new_field_stored_index) + ha_alter_info->handler_flags|= + Alter_inplace_info::ALTER_STORED_COLUMN_ORDER; + } + else + { + if (field->field_index != new_field_index) + ha_alter_info->handler_flags|= + Alter_inplace_info::ALTER_VIRTUAL_COLUMN_ORDER; + } /* Detect changes in storage type of column */ if (new_field->field_storage_type() != field->field_storage_type()) @@ -6507,27 +6509,28 @@ static bool fill_alter_inplace_info(THD *thd, } else { - /* - Field is not present in new version of table and therefore was dropped. - Corresponding storage engine flag should be already set. - */ - DBUG_ASSERT(ha_alter_info->handler_flags & Alter_inplace_info::DROP_COLUMN); + // Field is not present in new version of table and therefore was dropped. field->flags|= FIELD_IS_DROPPED; + if (field->stored_in_db()) + ha_alter_info->handler_flags|= Alter_inplace_info::DROP_STORED_COLUMN; + else + ha_alter_info->handler_flags|= Alter_inplace_info::DROP_VIRTUAL_COLUMN; } } if (maybe_alter_vcol) { /* - No virtual column was altered, but perhaps one of the other columns was, - and that column was part of the vcol expression? - We don't detect this correctly (FIXME), so let's just say that a vcol - *might* be affected if any other column was altered. + What if one of the normal columns was altered and it was part of the some + virtual column expression? Currently we don't detect this correctly + (FIXME), so let's just say that a vcol *might* be affected if any other + column was altered. */ if (ha_alter_info->handler_flags & - ( Alter_inplace_info::ALTER_COLUMN_TYPE - | Alter_inplace_info::ALTER_COLUMN_NOT_NULLABLE - | Alter_inplace_info::ALTER_COLUMN_OPTION )) + ( Alter_inplace_info::ALTER_STORED_COLUMN_TYPE + | Alter_inplace_info::ALTER_VIRTUAL_COLUMN_TYPE + | Alter_inplace_info::ALTER_COLUMN_NOT_NULLABLE + | Alter_inplace_info::ALTER_COLUMN_OPTION )) ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_COLUMN_VCOL; } @@ -6536,17 +6539,17 @@ static bool fill_alter_inplace_info(THD *thd, { if (! new_field->field) { - /* - Field is not present in old version of table and therefore was added. - Again corresponding storage engine flag should be already set. - */ - DBUG_ASSERT(ha_alter_info->handler_flags & Alter_inplace_info::ADD_COLUMN); - - if (new_field->vcol_info && - (new_field->stored_in_db() || new_field->vcol_info->is_in_partitioning_expr())) - { - ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_COLUMN_VCOL; - } + // Field is not present in old version of table and therefore was added. + if (new_field->vcol_info) + if (new_field->stored_in_db()) + ha_alter_info->handler_flags|= + Alter_inplace_info::ADD_STORED_GENERATED_COLUMN; + else + ha_alter_info->handler_flags|= + Alter_inplace_info::ADD_VIRTUAL_COLUMN; + else + ha_alter_info->handler_flags|= + Alter_inplace_info::ADD_STORED_BASE_COLUMN; } } @@ -7621,7 +7624,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, new_create_list.push_back(def, thd->mem_root); if (field->stored_in_db() != def->stored_in_db()) { - my_error(ER_UNSUPPORTED_ACTION_ON_VIRTUAL_COLUMN, MYF(0)); + my_error(ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN, MYF(0)); goto err; } if (!def->after) @@ -9799,8 +9802,6 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, error= 1; break; } - if (from->vfield) - update_virtual_fields(thd, from); if (++thd->progress.counter >= time_to_report_progress) { time_to_report_progress+= MY_HOW_OFTEN_TO_WRITE/10; @@ -9830,7 +9831,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, if (to->default_field) to->update_default_fields(0, ignore); if (to->vfield) - update_virtual_fields(thd, to, VCOL_UPDATE_FOR_WRITE); + to->update_virtual_fields(VCOL_UPDATE_FOR_WRITE); /* This will set thd->is_error() if fatal failure */ if (to->verify_constraints(ignore) == VIEW_CHECK_SKIP) diff --git a/sql/sql_time.cc b/sql/sql_time.cc index 5ef036965b8..cad4bae03e8 100644 --- a/sql/sql_time.cc +++ b/sql/sql_time.cc @@ -929,7 +929,10 @@ bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type, my_bool neg= 0; enum enum_mysql_timestamp_type time_type= ltime->time_type; - if ((ulong) interval.day > MAX_DAY_NUMBER) + if (((ulonglong) interval.day + + (ulonglong) interval.hour / 24 + + (ulonglong) interval.minute / 24 / 60 + + (ulonglong) interval.second / 24 / 60 / 60) > MAX_DAY_NUMBER) goto invalid_date; if (time_type != MYSQL_TIMESTAMP_TIME) diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 7dbc8513418..14812d2f73b 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -257,20 +257,6 @@ static File_option trigname_file_parameters[]= }; -const LEX_STRING trg_action_time_type_names[]= -{ - { C_STRING_WITH_LEN("BEFORE") }, - { C_STRING_WITH_LEN("AFTER") } -}; - -const LEX_STRING trg_event_type_names[]= -{ - { C_STRING_WITH_LEN("INSERT") }, - { C_STRING_WITH_LEN("UPDATE") }, - { C_STRING_WITH_LEN("DELETE") } -}; - - class Handle_old_incorrect_sql_modes_hook: public Unknown_key_hook { private: @@ -1993,7 +1979,7 @@ bool Trigger::change_on_table_name(void* param_arg) if (sql_create_definition_file(NULL, &trigname_file, &trigname_file_type, (uchar*)&trigname, trigname_file_parameters)) - return this; + return true; /* Remove stale .TRN file in case of database upgrade */ if (param->old_db_name) @@ -2263,35 +2249,6 @@ add_tables_and_routines_for_triggers(THD *thd, } -/** - Check if any of the marked fields are used in the trigger. - - @param used_fields Bitmap over fields to check - @param event_type Type of event triggers for which we are going to inspect - @param action_time Type of trigger action time we are going to inspect -*/ - -bool Trigger::is_fields_updated_in_trigger(MY_BITMAP *used_fields) -{ - Item_trigger_field *trg_field; - sp_head *sp= body; - DBUG_ASSERT(used_fields->n_bits == base->trigger_table->s->fields); - - for (trg_field= sp->m_trg_table_fields.first; trg_field; - trg_field= trg_field->next_trg_field) - { - /* We cannot check fields which does not present in table. */ - if (trg_field->field_idx != (uint)-1) - { - if (bitmap_is_set(used_fields, trg_field->field_idx) && - trg_field->get_settable_routine_parameter()) - return true; - } - } - return false; -} - - /** Mark fields of subject table which we read/set in its triggers as such. diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 0d05d201f12..aad3701cca2 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -1382,7 +1382,9 @@ bool st_select_lex_unit::change_result(select_result_interceptor *new_result, Get column type information for this unit. SYNOPSIS - st_select_lex_unit::get_unit_column_types() + st_select_lex_unit::get_column_types() + @param for_cursor if true return the list the fields + retrieved by the cursor DESCRIPTION For a single-select the column types are taken @@ -1396,7 +1398,7 @@ bool st_select_lex_unit::change_result(select_result_interceptor *new_result, st_select_lex_unit::prepare() */ -List *st_select_lex_unit::get_unit_column_types() +List *st_select_lex_unit::get_column_types(bool for_cursor) { SELECT_LEX *sl= first_select(); bool is_procedure= MY_TEST(sl->join->procedure); @@ -1416,7 +1418,7 @@ List *st_select_lex_unit::get_unit_column_types() return &types; } - return &sl->item_list; + return for_cursor ? sl->join->fields : &sl->item_list; } diff --git a/sql/sql_update.cc b/sql/sql_update.cc index b452e4fe6ae..1f1af7f2660 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -254,7 +254,7 @@ int mysql_update(THD *thd, ha_rows *found_return, ha_rows *updated_return) { bool using_limit= limit != HA_POS_ERROR; - bool safe_update= MY_TEST(thd->variables.option_bits & OPTION_SAFE_UPDATES); + bool safe_update= thd->variables.option_bits & OPTION_SAFE_UPDATES; bool used_key_is_modified= FALSE, transactional_table, will_batch; bool can_compare_record; int res; @@ -273,6 +273,7 @@ int mysql_update(THD *thd, SORT_INFO *file_sort= 0; READ_RECORD info; SELECT_LEX *select_lex= &thd->lex->select_lex; + BLOB_VALUE_ORPHANAGE vblobs; ulonglong id; List all_fields; killed_state killed_status= NOT_KILLED; @@ -619,9 +620,7 @@ int mysql_update(THD *thd, { explain->buf_tracker.on_record_read(); if (table->vfield) - update_virtual_fields(thd, table, - table->triggers ? VCOL_UPDATE_ALL : - VCOL_UPDATE_FOR_READ); + table->update_virtual_fields(VCOL_UPDATE_FOR_READ_WRITE); thd->inc_examined_row_count(1); if (!select || (error= select->skip_record(thd)) > 0) { @@ -726,6 +725,8 @@ int mysql_update(THD *thd, table->reset_default_fields(); + vblobs.init(table); + /* We can use compare_record() to optimize away updates if the table handler is returning all columns OR if @@ -738,9 +739,7 @@ int mysql_update(THD *thd, { explain->tracker.on_record_read(); if (table->vfield) - update_virtual_fields(thd, table, - table->triggers ? VCOL_UPDATE_ALL : - VCOL_UPDATE_FOR_READ); + table->update_virtual_fields(VCOL_UPDATE_FOR_READ_WRITE); thd->inc_examined_row_count(1); if (!select || select->skip_record(thd) > 0) { @@ -749,6 +748,9 @@ int mysql_update(THD *thd, explain->tracker.on_record_after_where(); store_record(table,record[1]); + + vblobs.make_orphans(); + if (fill_record_n_invoke_before_triggers(thd, table, fields, values, 0, TRG_EVENT_UPDATE)) break; /* purecov: inspected */ @@ -908,7 +910,9 @@ int mysql_update(THD *thd, error= 1; break; } + vblobs.free_orphans(); } + vblobs.free_orphans(); ANALYZE_STOP_TRACKING(&explain->command_tracker); table->auto_increment_field_not_null= FALSE; dup_key_found= 0; @@ -1756,6 +1760,8 @@ int multi_update::prepare(List ¬_used_values, table_count); values_for_table= (List_item **) thd->alloc(sizeof(List_item *) * table_count); + vblobs= (BLOB_VALUE_ORPHANAGE *)thd->calloc(sizeof(*vblobs) * table_count); + if (thd->is_fatal_error) DBUG_RETURN(1); for (i=0 ; i < table_count ; i++) @@ -1788,6 +1794,7 @@ int multi_update::prepare(List ¬_used_values, TABLE *table= ((Item_field*)(fields_for_table[i]->head()))->field->table; switch_to_nullable_trigger_fields(*fields_for_table[i], table); switch_to_nullable_trigger_fields(*values_for_table[i], table); + vblobs[i].init(table); } } copy_field= new Copy_field[max_fields]; @@ -1804,6 +1811,21 @@ void multi_update::update_used_tables() } } +void multi_update::prepare_to_read_rows() +{ + /* + update column maps now. it cannot be done in ::prepare() before the + optimizer, because the optimize might reset them (in + SELECT_LEX::update_used_tables()), it cannot be done in + ::initialize_tables() after the optimizer, because the optimizer + might read rows from const tables + */ + + for (TABLE_LIST *tl= update_tables; tl; tl= tl->next_local) + tl->table->mark_columns_needed_for_update(); +} + + /* Check if table is safe to update on fly @@ -1920,12 +1942,10 @@ multi_update::initialize_tables(JOIN *join) { if (safe_update_on_fly(thd, join->join_tab, table_ref, all_tables)) { - table->mark_columns_needed_for_update(); table_to_update= table; // Update table on the fly continue; } } - table->mark_columns_needed_for_update(); table->prepare_for_position(); /* @@ -2056,6 +2076,8 @@ multi_update::~multi_update() free_tmp_table(thd, tmp_tables[cnt]); tmp_table_param[cnt].cleanup(); } + vblobs[cnt].free_orphans(); + vblobs[cnt].free(); } } if (copy_field) @@ -2101,7 +2123,9 @@ int multi_update::send_data(List ¬_used_values) can_compare_record= records_are_comparable(table); table->status|= STATUS_UPDATED; + vblobs[offset].free_orphans(); store_record(table,record[1]); + vblobs[offset].make_orphans(); if (fill_record_n_invoke_before_triggers(thd, table, *fields_for_table[offset], *values_for_table[offset], 0, @@ -2318,6 +2342,7 @@ int multi_update::do_updates() goto err; } table->file->extra(HA_EXTRA_NO_CACHE); + empty_record(table); check_opt_it.rewind(); while(TABLE *tbl= check_opt_it++) @@ -2387,8 +2412,13 @@ int multi_update::do_updates() field_num++; } while ((tbl= check_opt_it++)); + if (table->vfield && table->update_virtual_fields(VCOL_UPDATE_INDEXED)) + goto err2; + table->status|= STATUS_UPDATED; + vblobs[offset].free_orphans(); store_record(table,record[1]); + vblobs[offset].make_orphans(); /* Copy data from temporary table to current table */ for (copy_field_ptr=copy_field; @@ -2411,8 +2441,7 @@ int multi_update::do_updates() (error= table->update_default_fields(1, ignore))) goto err2; if (table->vfield && - update_virtual_fields(thd, table, - (table->triggers ? VCOL_UPDATE_ALL : VCOL_UPDATE_FOR_WRITE))) + table->update_virtual_fields(VCOL_UPDATE_FOR_WRITE)) goto err2; if ((error= cur_table->view_check_option(thd, ignore)) != VIEW_CHECK_OK) diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 4a88c1f2ddf..ff4a5e12e56 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -134,8 +134,7 @@ static void my_parse_error_intern(THD *thd, const char *err_text, /* Push an error into the error stack */ ErrConvString err(yytext, strlen(yytext), thd->variables.character_set_client); - my_printf_error(ER_PARSE_ERROR, ER_THD(thd, ER_PARSE_ERROR), MYF(0), - err_text, err.ptr(), lip->yylineno); + my_error(ER_PARSE_ERROR, MYF(0), err_text, err.ptr(), lip->yylineno); } @@ -911,28 +910,15 @@ bool LEX::set_bincmp(CHARSET_INFO *cs, bool bin) MYSQL_YYABORT; \ } while(0) -Virtual_column_info *add_virtual_expression(THD *thd, const char *txt, - size_t size, Item *expr) +Virtual_column_info *add_virtual_expression(THD *thd, Item *expr) { - CHARSET_INFO *cs= thd->charset(); Virtual_column_info *v= new (thd->mem_root) Virtual_column_info(); if (!v) { mem_alloc_error(sizeof(Virtual_column_info)); return 0; } - /* - We have to remove white space as remember_cur_pos may have pointed to end - of previous expression. - */ - while (cs->state_map[*(uchar*)txt] == MY_LEX_SKIP) - { - txt++; - size--; - } - v->expr_str.str= (char* ) thd->strmake(txt, size); - v->expr_str.length= size; - v->expr_item= expr; + v->expr= expr; v->utf8= 0; /* connection charset */ return v; } @@ -1002,7 +988,7 @@ Virtual_column_info *add_virtual_expression(THD *thd, const char *txt, enum enum_diag_condition_item_name diag_condition_item_name; enum Diagnostics_information::Which_area diag_area; enum Field::geometry_type geom_type; - enum Foreign_key::fk_option m_fk_option; + enum enum_fk_option m_fk_option; enum Item_udftype udf_type; enum Key::Keytype key_type; enum Statement_information_item::Name stmt_info_item_name; @@ -1300,6 +1286,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %token IGNORE_DOMAIN_IDS_SYM %token IGNORE_SYM %token IGNORE_SERVER_IDS_SYM +%token IMMEDIATE_SYM /* SQL-2003-R */ %token IMPORT %token INDEXES %token INDEX_SYM @@ -1323,6 +1310,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %token ISSUER_SYM %token ITERATE_SYM %token JOIN_SYM /* SQL-2003-R */ +%token JSON_SYM %token KEYS %token KEY_BLOCK_SIZE %token KEY_SYM /* SQL-2003-N */ @@ -1358,6 +1346,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %token LOOP_SYM %token LOW_PRIORITY %token MASTER_CONNECT_RETRY_SYM +%token MASTER_DELAY_SYM %token MASTER_GTID_POS_SYM %token MASTER_HOST_SYM %token MASTER_LOG_FILE_SYM @@ -1680,7 +1669,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %token UPDATE_SYM /* SQL-2003-R */ %token UPGRADE_SYM %token USAGE /* SQL-2003-N */ -%token USER /* SQL-2003-R */ +%token USER_SYM /* SQL-2003-R */ %token USE_FRM %token USE_SYM %token USING /* SQL-2003-R */ @@ -1759,7 +1748,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); table_ident_opt_wild create_like %type - remember_name remember_end opt_db remember_tok_start remember_cur_pos + remember_name remember_end opt_db remember_tok_start wild_and_where field_length opt_field_length opt_field_length_default_1 @@ -2003,7 +1992,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); definer_opt no_definer definer get_diagnostics parse_vcol_expr vcol_opt_specifier vcol_opt_attribute vcol_opt_attribute_list vcol_attribute - explainable_command opt_impossible_action + explainable_command END_OF_INPUT %type call sp_proc_stmts sp_proc_stmts1 sp_proc_stmt @@ -2222,23 +2211,20 @@ prepare: PREPARE_SYM ident FROM prepare_src { LEX *lex= thd->lex; + if (lex->table_or_sp_used()) + my_yyabort_error((ER_SUBQUERIES_NOT_SUPPORTED, MYF(0), + "PREPARE..FROM")); lex->sql_command= SQLCOM_PREPARE; lex->prepared_stmt_name= $2; } ; prepare_src: - TEXT_STRING_sys + { Lex->expr_allows_subselect= false; } + expr { - LEX *lex= thd->lex; - lex->prepared_stmt_code= $1; - lex->prepared_stmt_code_is_varref= FALSE; - } - | '@' ident_or_text - { - LEX *lex= thd->lex; - lex->prepared_stmt_code= $2; - lex->prepared_stmt_code_is_varref= TRUE; + Lex->prepared_stmt_code= $2; + Lex->expr_allows_subselect= true; } ; @@ -2251,11 +2237,27 @@ execute: } execute_using {} + | EXECUTE_SYM IMMEDIATE_SYM prepare_src + { + if (Lex->table_or_sp_used()) + my_yyabort_error((ER_SUBQUERIES_NOT_SUPPORTED, MYF(0), + "EXECUTE IMMEDIATE")); + Lex->sql_command= SQLCOM_EXECUTE_IMMEDIATE; + } + execute_using + {} ; execute_using: /* nothing */ - | USING execute_var_list + | USING { Lex->expr_allows_subselect= false; } + execute_var_list + { + if (Lex->table_or_sp_used()) + my_yyabort_error((ER_SUBQUERIES_NOT_SUPPORTED, MYF(0), + "EXECUTE..USING")); + Lex->expr_allows_subselect= true; + } ; execute_var_list: @@ -2264,12 +2266,9 @@ execute_var_list: ; execute_var_ident: - '@' ident_or_text + expr_or_default { - LEX *lex=Lex; - LEX_STRING *lexstr= (LEX_STRING*)thd->memdup(&$2, sizeof(LEX_STRING)); - if (!lexstr || lex->prepared_stmt_params.push_back(lexstr, - thd->mem_root)) + if (Lex->prepared_stmt_params.push_back($1, thd->mem_root)) MYSQL_YYABORT; } ; @@ -2327,6 +2326,16 @@ master_def: { Lex->mi.connect_retry = $3; } + | MASTER_DELAY_SYM '=' ulong_num + { + if ($3 > MASTER_DELAY_MAX) + { + my_error(ER_MASTER_DELAY_VALUE_OUT_OF_RANGE, MYF(0), + $3, MASTER_DELAY_MAX); + } + else + Lex->mi.sql_delay = $3; + } | MASTER_SSL_SYM '=' ulong_num { Lex->mi.ssl= $3 ? @@ -2609,7 +2618,7 @@ create: Lex->create_view_suid= TRUE; } view_or_trigger_or_sp_or_event { } - | create_or_replace USER opt_if_not_exists clear_privileges grant_list + | create_or_replace USER_SYM opt_if_not_exists clear_privileges grant_list opt_require_clause opt_resource_options { if (Lex->set_command_with_check(SQLCOM_CREATE_USER, $1 | $3)) @@ -2652,7 +2661,7 @@ server_options_list: ; server_option: - USER TEXT_STRING_sys + USER_SYM TEXT_STRING_sys { MYSQL_YYABORT_UNLESS(Lex->server_options.username.str == 0); Lex->server_options.username= $2; @@ -2661,6 +2670,7 @@ server_option: { MYSQL_YYABORT_UNLESS(Lex->server_options.host.str == 0); Lex->server_options.host= $2; + my_casedn_str(system_charset_info, Lex->server_options.host.str); } | DATABASE TEXT_STRING_sys { @@ -6097,10 +6107,10 @@ opt_check_constraint: ; check_constraint: - CHECK_SYM '(' remember_name expr remember_end ')' + CHECK_SYM '(' expr ')' { Virtual_column_info *v= - add_virtual_expression(thd, $3+1, (uint)($5 - $3) - 1, $4); + add_virtual_expression(thd, $3); if (!v) { MYSQL_YYABORT; @@ -6211,7 +6221,7 @@ vcol_attribute: ; parse_vcol_expr: - PARSE_VCOL_EXPR_SYM virtual_column_func + PARSE_VCOL_EXPR_SYM { /* "PARSE_VCOL_EXPR" can only be used by the SQL server @@ -6219,7 +6229,13 @@ parse_vcol_expr: Prevent the end user from invoking this command. */ MYSQL_YYABORT_UNLESS(Lex->parse_vcol_expr); - Lex->last_field->vcol_info= $2; + } + expr + { + Virtual_column_info *v= add_virtual_expression(thd, $3); + if (!v) + MYSQL_YYABORT; + Lex->last_field->vcol_info= v; } ; @@ -6241,10 +6257,10 @@ parenthesized_expr: ; virtual_column_func: - '(' remember_cur_pos parenthesized_expr remember_end ')' + '(' parenthesized_expr ')' { Virtual_column_info *v= - add_virtual_expression(thd, $2, (uint)($4 - $2), $3); + add_virtual_expression(thd, $2); if (!v) { MYSQL_YYABORT; @@ -6257,19 +6273,13 @@ expr_or_literal: column_default_non_parenthesized_expr | signed_literal ; column_default_expr: virtual_column_func - | remember_name expr_or_literal opt_impossible_action remember_end + | expr_or_literal { - if (!($$= add_virtual_expression(thd, $1, (uint) ($4- $1), $2))) + if (!($$= add_virtual_expression(thd, $1))) MYSQL_YYABORT; } ; -/* This is to force remember_end to look at next token */ -opt_impossible_action: - IMPOSSIBLE_ACTION {} - | /* empty */ {} - - field_type: int_type opt_field_length field_options { $$.set($1, $2); } | real_type opt_precision field_options { $$.set($1, $2); } @@ -6853,19 +6863,19 @@ opt_on_update_delete: /* empty */ { LEX *lex= Lex; - lex->fk_update_opt= Foreign_key::FK_OPTION_UNDEF; - lex->fk_delete_opt= Foreign_key::FK_OPTION_UNDEF; + lex->fk_update_opt= FK_OPTION_UNDEF; + lex->fk_delete_opt= FK_OPTION_UNDEF; } | ON UPDATE_SYM delete_option { LEX *lex= Lex; lex->fk_update_opt= $3; - lex->fk_delete_opt= Foreign_key::FK_OPTION_UNDEF; + lex->fk_delete_opt= FK_OPTION_UNDEF; } | ON DELETE_SYM delete_option { LEX *lex= Lex; - lex->fk_update_opt= Foreign_key::FK_OPTION_UNDEF; + lex->fk_update_opt= FK_OPTION_UNDEF; lex->fk_delete_opt= $3; } | ON UPDATE_SYM delete_option @@ -6885,11 +6895,11 @@ opt_on_update_delete: ; delete_option: - RESTRICT { $$= Foreign_key::FK_OPTION_RESTRICT; } - | CASCADE { $$= Foreign_key::FK_OPTION_CASCADE; } - | SET NULL_SYM { $$= Foreign_key::FK_OPTION_SET_NULL; } - | NO_SYM ACTION { $$= Foreign_key::FK_OPTION_NO_ACTION; } - | SET DEFAULT { $$= Foreign_key::FK_OPTION_DEFAULT; } + RESTRICT { $$= FK_OPTION_RESTRICT; } + | CASCADE { $$= FK_OPTION_CASCADE; } + | SET NULL_SYM { $$= FK_OPTION_SET_NULL; } + | NO_SYM ACTION { $$= FK_OPTION_NO_ACTION; } + | SET DEFAULT { $$= FK_OPTION_SET_DEFAULT; } ; constraint_key_type: @@ -7265,7 +7275,7 @@ alter: lex->server_options.reset($3); } OPTIONS_SYM '(' server_options_list ')' { } /* ALTER USER foo is allowed for MySQL compatibility. */ - | ALTER opt_if_exists USER clear_privileges grant_list + | ALTER opt_if_exists USER_SYM clear_privileges grant_list opt_require_clause opt_resource_options { Lex->create_info.set($2); @@ -7839,6 +7849,7 @@ slave: LEX *lex=Lex; lex->sql_command = SQLCOM_SLAVE_ALL_START; lex->type = 0; + /* If you change this code don't forget to update STOP SLAVE too */ } {} | STOP_SYM SLAVE optional_connection_name slave_thread_opts @@ -8217,7 +8228,7 @@ rename: } table_to_table_list {} - | RENAME USER clear_privileges rename_list + | RENAME USER_SYM clear_privileges rename_list { Lex->sql_command = SQLCOM_RENAME_USER; } @@ -8723,12 +8734,6 @@ remember_tok_start: } ; -remember_cur_pos: - { - $$= (char*) YYLIP->get_cpp_ptr(); - } - ; - remember_name: { $$= (char*) YYLIP->get_cpp_tok_start(); @@ -8991,8 +8996,7 @@ predicate: Item_func_in *item= new (thd->mem_root) Item_func_in(thd, *$7); if (item == NULL) MYSQL_YYABORT; - item->negate(); - $$= item; + $$= item->neg_transformer(thd); } | bit_expr BETWEEN_SYM bit_expr AND_SYM predicate { @@ -9006,8 +9010,7 @@ predicate: item= new (thd->mem_root) Item_func_between(thd, $1, $4, $6); if (item == NULL) MYSQL_YYABORT; - item->negate(); - $$= item; + $$= item->neg_transformer(thd); } | bit_expr SOUNDS_SYM LIKE bit_expr { @@ -9032,9 +9035,7 @@ predicate: Lex->escape_used); if (item == NULL) MYSQL_YYABORT; - $$= new (thd->mem_root) Item_func_not(thd, item); - if ($$ == NULL) - MYSQL_YYABORT; + $$= item->neg_transformer(thd); } | bit_expr REGEXP bit_expr { @@ -9631,7 +9632,7 @@ function_call_keyword: if ($$ == NULL) MYSQL_YYABORT; } - | USER '(' ')' + | USER_SYM '(' ')' { $$= new (thd->mem_root) Item_func_user(thd); if ($$ == NULL) @@ -9997,15 +9998,7 @@ function_call_conflict: } | WEEK_SYM '(' expr ')' { - Item *i1; - LEX_STRING name= {C_STRING_WITH_LEN("default_week_format")}; - if (!(i1= get_system_var(thd, OPT_SESSION, - name, null_lex_str))) - MYSQL_YYABORT; - i1->set_name(thd, (const char *) - STRING_WITH_LEN("@@default_week_format"), - system_charset_info); - $$= new (thd->mem_root) Item_func_week(thd, $3, i1); + $$= new (thd->mem_root) Item_func_week(thd, $3); if ($$ == NULL) MYSQL_YYABORT; } @@ -10686,6 +10679,7 @@ cast_type: } | cast_type_numeric { $$= $1; Lex->charset= NULL; } | cast_type_temporal { $$= $1; Lex->charset= NULL; } + | JSON_SYM { $$.set(ITEM_CAST_JSON); } ; cast_type_numeric: @@ -12173,7 +12167,7 @@ drop: lex->set_command(SQLCOM_DROP_PROCEDURE, $3); lex->spname= $4; } - | DROP USER opt_if_exists clear_privileges user_list + | DROP USER_SYM opt_if_exists clear_privileges user_list { Lex->set_command(SQLCOM_DROP_USER, $3); } @@ -12474,6 +12468,12 @@ expr_or_default: if ($$ == NULL) MYSQL_YYABORT; } + | IGNORE_SYM + { + $$= new (thd->mem_root) Item_ignore_value(thd, Lex->current_context()); + if ($$ == NULL) + MYSQL_YYABORT; + } ; opt_insert_update: @@ -13017,14 +13017,14 @@ show_param: lex->sql_command= SQLCOM_SHOW_CREATE_TRIGGER; lex->spname= $3; } - | CREATE USER + | CREATE USER_SYM { Lex->sql_command= SQLCOM_SHOW_CREATE_USER; if (!(Lex->grant_user= (LEX_USER*)thd->alloc(sizeof(LEX_USER)))) MYSQL_YYABORT; Lex->grant_user->user= current_user; } - | CREATE USER user + | CREATE USER_SYM user { Lex->sql_command= SQLCOM_SHOW_CREATE_USER; Lex->grant_user= $3; @@ -13470,7 +13470,7 @@ kill_expr: { Lex->value_list.push_front($$, thd->mem_root); } - | USER user + | USER_SYM user { Lex->users_list.push_back($2, thd->mem_root); Lex->kill_type= KILL_TYPE_USER; @@ -13846,13 +13846,13 @@ literal: } | FALSE_SYM { - $$= new (thd->mem_root) Item_int(thd, (char*) "FALSE",0,1); + $$= new (thd->mem_root) Item_bool(thd, (char*) "FALSE",0); if ($$ == NULL) MYSQL_YYABORT; } | TRUE_SYM { - $$= new (thd->mem_root) Item_int(thd, (char*) "TRUE",1,1); + $$= new (thd->mem_root) Item_bool(thd, (char*) "TRUE",1); if ($$ == NULL) MYSQL_YYABORT; } @@ -14360,10 +14360,7 @@ IDENT_sys: if (thd->charset_is_system_charset) { CHARSET_INFO *cs= system_charset_info; - int dummy_error; - uint wlen= cs->cset->well_formed_len(cs, $1.str, - $1.str+$1.length, - $1.length, &dummy_error); + uint wlen= Well_formed_prefix(cs, $1.str, $1.length).length(); if (wlen < $1.length) { ErrConvString err($1.str, $1.length, &my_charset_bin); @@ -14701,6 +14698,7 @@ keyword_sp: | ID_SYM {} | IDENTIFIED_SYM {} | IGNORE_SERVER_IDS_SYM {} + | IMMEDIATE_SYM {} /* SQL-2003-R */ | INVOKER_SYM {} | IMPORT {} | INDEXES {} @@ -14709,6 +14707,7 @@ keyword_sp: | IPC_SYM {} | ISOLATION {} | ISSUER_SYM {} + | JSON_SYM {} | INSERT_METHOD {} | KEY_BLOCK_SIZE {} | LAST_VALUE {} @@ -14735,6 +14734,7 @@ keyword_sp: | MASTER_PASSWORD_SYM {} | MASTER_SERVER_ID_SYM {} | MASTER_CONNECT_RETRY_SYM {} + | MASTER_DELAY_SYM {} | MASTER_SSL_SYM {} | MASTER_SSL_CA_SYM {} | MASTER_SSL_CAPATH_SYM {} @@ -14890,7 +14890,7 @@ keyword_sp: | UNDOFILE_SYM {} | UNKNOWN_SYM {} | UNTIL_SYM {} - | USER {} + | USER_SYM {} | USE_FRM {} | VARIABLES {} | VIEW_SYM {} @@ -15720,6 +15720,7 @@ grant_role: CHARSET_INFO *cs= system_charset_info; /* trim end spaces (as they'll be lost in mysql.user anyway) */ $1.length= cs->cset->lengthsp(cs, $1.str, $1.length); + $1.str[$1.length] = '\0'; if ($1.length == 0) my_yyabort_error((ER_INVALID_ROLE, MYF(0), "")); if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) @@ -15795,7 +15796,7 @@ object_privilege: | SHOW VIEW_SYM { Lex->grant |= SHOW_VIEW_ACL; } | CREATE ROUTINE_SYM { Lex->grant |= CREATE_PROC_ACL; } | ALTER ROUTINE_SYM { Lex->grant |= ALTER_PROC_ACL; } - | CREATE USER { Lex->grant |= CREATE_USER_ACL; } + | CREATE USER_SYM { Lex->grant |= CREATE_USER_ACL; } | EVENT_SYM { Lex->grant |= EVENT_ACL;} | TRIGGER_SYM { Lex->grant |= TRIGGER_ACL; } | CREATE TABLESPACE { Lex->grant |= CREATE_TABLESPACE_ACL; } diff --git a/sql/structs.h b/sql/structs.h index e51f3e0fe3a..144e12ca06c 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -64,9 +64,11 @@ typedef struct st_keyfile_info { /* used with ha_info() */ typedef struct st_key_part_info { /* Info about a key part */ - Field *field; - uint offset; /* offset in record (from 0) */ - uint null_offset; /* Offset to null_bit in record */ + Field *field; /* the Field object for the indexed + prefix of the original table Field. + NOT necessarily the original Field */ + uint offset; /* Offset in record (from 0) */ + uint null_offset; /* Offset to null_bit in record */ /* Length of key part in bytes, excluding NULL flag and length bytes */ uint16 length; /* @@ -77,9 +79,8 @@ typedef struct st_key_part_info { /* Info about a key part */ */ uint16 store_length; uint16 key_type; - /* Fieldnr begins counting from 1 */ - uint16 fieldnr; /* Fieldnum in UNIREG */ - uint16 key_part_flag; /* 0 or HA_REVERSE_SORT */ + uint16 fieldnr; /* Fieldnr begins counting from 1 */ + uint16 key_part_flag; /* 0 or HA_REVERSE_SORT */ uint8 type; uint8 null_bit; /* Position to null_bit */ } KEY_PART_INFO ; diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 3e6a06c3ab0..bdfedc30d46 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -1157,6 +1157,18 @@ static Sys_var_mybool Sys_log_bin( "log_bin", "Whether the binary log is enabled", READ_ONLY GLOBAL_VAR(opt_bin_log), NO_CMD_LINE, DEFAULT(FALSE)); +static Sys_var_mybool Sys_log_bin_compress( + "log_bin_compress", "Whether the binary log can be compressed", + GLOBAL_VAR(opt_bin_log_compress), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); + +/* the min length is 10, means that Begin/Commit/Rollback would never be compressed! */ +static Sys_var_uint Sys_log_bin_compress_min_len( + "log_bin_compress_min_len", + "Minimum length of sql statement(in statement mode) or record(in row mode)" + "that can be compressed.", + GLOBAL_VAR(opt_bin_log_compress_min_len), + CMD_LINE(OPT_ARG), VALID_RANGE(10, 1024), DEFAULT(256), BLOCK_SIZE(1)); + static Sys_var_mybool Sys_trust_function_creators( "log_bin_trust_function_creators", "If set to FALSE (the default), then when --log-bin is used, creation " @@ -3224,7 +3236,7 @@ static bool fix_table_open_cache(sys_var *, THD *, enum_var_type) static Sys_var_ulong Sys_table_cache_size( "table_open_cache", "The number of cached open tables", GLOBAL_VAR(tc_size), CMD_LINE(REQUIRED_ARG), - VALID_RANGE(1, 512*1024), DEFAULT(TABLE_OPEN_CACHE_DEFAULT), + VALID_RANGE(1, 1024*1024), DEFAULT(TABLE_OPEN_CACHE_DEFAULT), BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_table_open_cache)); @@ -4630,6 +4642,12 @@ static Sys_var_charptr Sys_slave_skip_errors( READ_ONLY GLOBAL_VAR(opt_slave_skip_errors), CMD_LINE(REQUIRED_ARG), IN_SYSTEM_CHARSET, DEFAULT(0)); +static Sys_var_ulonglong Sys_read_binlog_speed_limit( + "read_binlog_speed_limit", "Maximum speed(KB/s) to read binlog from" + " master (0 = no limit)", + GLOBAL_VAR(opt_read_binlog_speed_limit), CMD_LINE(REQUIRED_ARG), + VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1)); + static Sys_var_ulonglong Sys_relay_log_space_limit( "relay_log_space_limit", "Maximum space to use for all relay logs", READ_ONLY GLOBAL_VAR(relay_log_space_limit), CMD_LINE(REQUIRED_ARG), @@ -5024,8 +5042,9 @@ static Sys_var_mybool Sys_wsrep_restart_slave( GLOBAL_VAR(wsrep_restart_slave), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); static Sys_var_mybool Sys_wsrep_dirty_reads( - "wsrep_dirty_reads", "Do not reject SELECT queries even when the node " - "is not ready.", SESSION_ONLY(wsrep_dirty_reads), NO_CMD_LINE, + "wsrep_dirty_reads", + "Allow reads even when the node is not in the primary component.", + SESSION_VAR(wsrep_dirty_reads), CMD_LINE(OPT_ARG), DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG); static Sys_var_uint Sys_wsrep_gtid_domain_id( diff --git a/sql/table.cc b/sql/table.cc index 8fe1a930167..6b74ec7cfd6 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -47,6 +47,9 @@ #define MYSQL57_GENERATED_FIELD 128 #define MYSQL57_GCOL_HEADER_SIZE 4 +static Virtual_column_info * unpack_vcol_info_from_frm(THD *, MEM_ROOT *, + TABLE *, String *, Virtual_column_info **, bool *); +static bool check_vcol_forward_refs(Field *, Virtual_column_info *); /* INFORMATION_SCHEMA name */ LEX_STRING INFORMATION_SCHEMA_NAME= {C_STRING_WITH_LEN("information_schema")}; @@ -932,7 +935,7 @@ static void mysql57_calculate_null_position(TABLE_SHARE *share, if ((strpos[10] & MYSQL57_GENERATED_FIELD)) { /* Skip virtual (not stored) generated field */ - bool stored_in_db= (bool) (uint) (vcol_screen_pos[3]); + bool stored_in_db= vcol_screen_pos[3]; vcol_screen_pos+= (uint2korr(vcol_screen_pos + 1) + MYSQL57_GCOL_HEADER_SIZE); if (! stored_in_db) @@ -957,6 +960,187 @@ static void mysql57_calculate_null_position(TABLE_SHARE *share, } } + +/** Parse TABLE_SHARE::vcol_defs + + unpack_vcol_info_from_frm + 5.7 + byte 1 = 1 + byte 2,3 = expr length + byte 4 = stored_in_db + expression + 10.1- + byte 1 = 1 | 2 + byte 2 = sql_type ; but TABLE::init_from_binary_frm_image() + byte 3 = stored_in_db ; has put expr_length here + [byte 4] = optional interval_id for sql_type (if byte 1 == 2) + expression + 10.2+ + byte 1 = type + byte 2,3 = field_number + byte 4,5 = length of expression + byte 6 = length of name + name + expression +*/ +bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table, + bool *error_reported) +{ + CHARSET_INFO *save_character_set_client= thd->variables.character_set_client; + CHARSET_INFO *save_collation= thd->variables.collation_connection; + Query_arena *backup_stmt_arena_ptr= thd->stmt_arena; + const uchar *pos= table->s->vcol_defs.str; + const uchar *end= pos + table->s->vcol_defs.length; + Field **field_ptr= table->field - 1; + Field **vfield_ptr= table->vfield; + Field **dfield_ptr= table->default_field; + Virtual_column_info **check_constraint_ptr= table->check_constraints; + sql_mode_t saved_mode= thd->variables.sql_mode; + Query_arena backup_arena; + Virtual_column_info *vcol; + StringBuffer expr_str; + bool res= 1; + DBUG_ENTER("parse_vcol_defs"); + + if (check_constraint_ptr) + memcpy(table->check_constraints + table->s->field_check_constraints, + table->s->check_constraints, + table->s->table_check_constraints * sizeof(Virtual_column_info*)); + + DBUG_ASSERT(table->expr_arena == NULL); + /* + We need to use CONVENTIONAL_EXECUTION here to ensure that + any new items created by fix_fields() are not reverted. + */ + table->expr_arena= new (alloc_root(mem_root, sizeof(Query_arena))) + Query_arena(mem_root, Query_arena::STMT_CONVENTIONAL_EXECUTION); + if (!table->expr_arena) + DBUG_RETURN(1); + + thd->set_n_backup_active_arena(table->expr_arena, &backup_arena); + thd->stmt_arena= table->expr_arena; + thd->update_charset(&my_charset_utf8mb4_general_ci, table->s->table_charset); + expr_str.append(&parse_vcol_keyword); + thd->variables.sql_mode &= ~MODE_NO_BACKSLASH_ESCAPES; + + while (pos < end) + { + uint type, expr_length; + if (table->s->mysql_version >= 100202) + { + uint field_nr, name_length; + /* see pack_expression() for how data is stored */ + type= pos[0]; + field_nr= uint2korr(pos+1); + expr_length= uint2korr(pos+3); + name_length= pos[5]; + pos+= FRM_VCOL_NEW_HEADER_SIZE + name_length; + field_ptr= table->field + field_nr; + } + else + { + /* + see below in ::init_from_binary_frm_image for how data is stored + in versions below 10.2 (that includes 5.7 too) + */ + while (*++field_ptr && !(*field_ptr)->vcol_info) /* no-op */; + if (!*field_ptr) + { + open_table_error(table->s, OPEN_FRM_CORRUPTED, 1); + goto end; + } + type= (*field_ptr)->vcol_info->stored_in_db + ? VCOL_GENERATED_STORED : VCOL_GENERATED_VIRTUAL; + expr_length= uint2korr(pos+1); + if (table->s->mysql_version > 50700 && table->s->mysql_version < 100000) + pos+= 4; // MySQL from 5.7 + else + pos+= pos[0] == 2 ? 4 : 3; // MariaDB from 5.2 to 10.1 + } + + expr_str.length(parse_vcol_keyword.length); + expr_str.append((char*)pos, expr_length); + + switch (type) { + case VCOL_GENERATED_VIRTUAL: + case VCOL_GENERATED_STORED: + vcol= unpack_vcol_info_from_frm(thd, mem_root, table, &expr_str, + &((*field_ptr)->vcol_info), error_reported); + *(vfield_ptr++)= *field_ptr; + break; + case VCOL_DEFAULT: + vcol= unpack_vcol_info_from_frm(thd, mem_root, table, &expr_str, + &((*field_ptr)->default_value), + error_reported); + *(dfield_ptr++)= *field_ptr; + break; + case VCOL_CHECK_FIELD: + vcol= unpack_vcol_info_from_frm(thd, mem_root, table, &expr_str, + &((*field_ptr)->check_constraint), + error_reported); + *check_constraint_ptr++= (*field_ptr)->check_constraint; + break; + case VCOL_CHECK_TABLE: + vcol= unpack_vcol_info_from_frm(thd, mem_root, table, &expr_str, + check_constraint_ptr, error_reported); + check_constraint_ptr++; + break; + } + if (!vcol) + goto end; + pos+= expr_length; + } + + /* Now, initialize CURRENT_TIMESTAMP fields */ + for (field_ptr= table->field; *field_ptr; field_ptr++) + { + Field *field= *field_ptr; + if (field->has_default_now_unireg_check()) + { + expr_str.length(parse_vcol_keyword.length); + expr_str.append(STRING_WITH_LEN("current_timestamp(")); + expr_str.append_ulonglong(field->decimals()); + expr_str.append(')'); + vcol= unpack_vcol_info_from_frm(thd, mem_root, table, &expr_str, + &((*field_ptr)->default_value), + error_reported); + *(dfield_ptr++)= *field_ptr; + if (!field->default_value->expr) + goto end; + } + else if (field->has_update_default_function() && !field->default_value) + *(dfield_ptr++)= *field_ptr; + } + + if (vfield_ptr) + *vfield_ptr= 0; + + if (dfield_ptr) + *dfield_ptr= 0; + + if (check_constraint_ptr) + *check_constraint_ptr= 0; + + /* Check that expressions aren't refering to not yet initialized fields */ + for (field_ptr= table->field; *field_ptr; field_ptr++) + { + Field *field= *field_ptr; + if (check_vcol_forward_refs(field, field->vcol_info) || + check_vcol_forward_refs(field, field->check_constraint) || + check_vcol_forward_refs(field, field->default_value)) + goto end; + } + + res=0; +end: + thd->restore_active_arena(table->expr_arena, &backup_arena); + thd->stmt_arena= backup_stmt_arena_ptr; + if (save_character_set_client) + thd->update_charset(save_character_set_client, save_collation); + thd->variables.sql_mode= saved_mode; + DBUG_RETURN(res); +} + /** Read data from a binary .frm file image into a TABLE_SHARE @@ -982,7 +1166,6 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, uint interval_count, interval_parts, read_length, int_length; uint db_create_options, keys, key_parts, n_length; uint com_length, null_bit_pos, mysql57_vcol_null_bit_pos, bitmap_count; - uint extra_rec_buf_length; uint i; bool use_hash, mysql57_null_bits= 0; char *keynames, *names, *comment_pos; @@ -1400,8 +1583,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, if (share->db_plugin && !plugin_equals(share->db_plugin, se_plugin)) goto err; // wrong engine (someone changed the frm under our feet?) - extra_rec_buf_length= uint2korr(frm_image+59); - rec_buff_length= ALIGN_SIZE(share->reclength + 1 + extra_rec_buf_length); + rec_buff_length= ALIGN_SIZE(share->reclength + 1); share->rec_buff_length= rec_buff_length; if (!(record= (uchar *) alloc_root(&share->mem_root, rec_buff_length))) @@ -1454,6 +1636,9 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, if (!interval_count) share->intervals= 0; // For better debugging + share->vcol_defs.str= vcol_screen_pos; + share->vcol_defs.length= vcol_screen_length; + memcpy(names, strpos+(share->fields*field_pack_length), n_length+int_length); memcpy(comment_pos, disk_buff+read_length-com_length-vcol_screen_length, com_length); @@ -1537,8 +1722,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, mysql57_vcol_null_bit_pos= null_bit_pos; mysql57_calculate_null_position(share, &mysql57_vcol_null_pos, &mysql57_vcol_null_bit_pos, - strpos, - vcol_screen_pos); + strpos, vcol_screen_pos); } for (i=0 ; i < share->fields; i++, strpos+=field_pack_length, field_ptr++) @@ -1633,18 +1817,20 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, { unireg_type&= MYSQL57_GENERATED_FIELD; + /* + MySQL 5.7 generated fields + + byte 1 = 1 + byte 2,3 = expr length + byte 4 = stored_in_db + byte 5.. = expr + */ if ((uint)(vcol_screen_pos)[0] != 1) goto err; vcol_info= new (&share->mem_root) Virtual_column_info(); vcol_info_length= uint2korr(vcol_screen_pos + 1); DBUG_ASSERT(vcol_info_length); - vcol_info->stored_in_db= (bool) (uint) vcol_screen_pos[3]; - if (!(vcol_info->expr_str.str= - (char *)memdup_root(&share->mem_root, - vcol_screen_pos + MYSQL57_GCOL_HEADER_SIZE, - vcol_info_length))) - goto err; - vcol_info->expr_str.length= vcol_info_length; + vcol_info->stored_in_db= vcol_screen_pos[3]; vcol_info->utf8= 0; vcol_screen_pos+= vcol_info_length + MYSQL57_GCOL_HEADER_SIZE;; share->virtual_fields++; @@ -1659,8 +1845,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, Get virtual column data stored in the .frm file as follows: byte 1 = 1 | 2 byte 2 = sql_type - byte 3 = flags (as of now, 0 - no flags, - 1 - field is physically stored) + byte 3 = flags. 1 for stored_in_db [byte 4] = optional interval_id for sql_type (if byte 1 == 2) next byte ... = virtual column expression (text data) */ @@ -1672,20 +1857,11 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, interval_nr= (uint)vcol_screen_pos[3]; else if ((uint)vcol_screen_pos[0] != 1) goto err; - - vcol_info->stored_in_db= (bool) (uint) vcol_screen_pos[2]; + vcol_info->stored_in_db= vcol_screen_pos[2] & 1; vcol_expr_length= vcol_info_length - (uint)(FRM_VCOL_OLD_HEADER_SIZE(opt_interval_id)); - if (!(vcol_info->expr_str.str= - (char *)memdup_root(&share->mem_root, - vcol_screen_pos + - (uint) FRM_VCOL_OLD_HEADER_SIZE(opt_interval_id), - vcol_expr_length))) - goto err; - if (opt_interval_id) - interval_nr= (uint) vcol_screen_pos[3]; - vcol_info->expr_str.length= vcol_expr_length; vcol_info->utf8= 0; // before 10.2.1 the charset was unknown + int2store(vcol_screen_pos+1, vcol_expr_length); // for parse_vcol_defs() vcol_screen_pos+= vcol_info_length; share->virtual_fields++; } @@ -1726,7 +1902,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, /* Remove >32 decimals from old files */ if (share->mysql_version < 100200) - pack_flag&= ~(FIELDFLAG_LEFT_FULLSCREEN); + pack_flag&= ~FIELDFLAG_LONG_DECIMAL; if (interval_nr && charset->mbminlen > 1) { @@ -1770,11 +1946,6 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, /* Convert pre-10.2.2 timestamps to use Field::default_value */ unireg_check= (Field::utype) MTYP_TYPENR(unireg_type); - if (unireg_check == Field::TIMESTAMP_DNUN_FIELD) - unireg_check= Field::TIMESTAMP_UN_FIELD; - if (unireg_check == Field::TIMESTAMP_DN_FIELD) - unireg_check= Field::NONE; - *field_ptr= reg_field= make_field(share, &share->mem_root, record+recpos, (uint32) field_length, null_pos, null_bit_pos, pack_flag, field_type, charset, @@ -1784,17 +1955,11 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, if (!reg_field) // Not supported field type goto err; - if (unireg_check != (Field::utype) MTYP_TYPENR(unireg_type)) + if (unireg_check == Field::TIMESTAMP_DNUN_FIELD || + unireg_check == Field::TIMESTAMP_DN_FIELD) { - char buf[32]; - if (reg_field->decimals()) - my_snprintf(buf, sizeof(buf), "CURRENT_TIMESTAMP(%d)", reg_field->decimals()); - else - strmov(buf, "CURRENT_TIMESTAMP"); - reg_field->default_value= new (&share->mem_root) Virtual_column_info(); reg_field->default_value->stored_in_db= 1; - thd->make_lex_string(®_field->default_value->expr_str, buf, strlen(buf)); share->default_expressions++; } @@ -1816,11 +1981,15 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, null_pos++; } - if (mysql57_null_bits && vcol_info && !vcol_info->stored_in_db) + if (vcol_info) { - /* MySQL 5.7 has null bits last */ - swap_variables(uchar*, null_pos, mysql57_vcol_null_pos); - swap_variables(uint, null_bit_pos, mysql57_vcol_null_bit_pos); + vcol_info->name.str= const_cast(reg_field->field_name); + if (mysql57_null_bits && !vcol_info->stored_in_db) + { + /* MySQL 5.7 has null bits last */ + swap_variables(uchar*, null_pos, mysql57_vcol_null_pos); + swap_variables(uint, null_bit_pos, mysql57_vcol_null_bit_pos); + } } if (f_no_default(pack_flag)) @@ -2191,6 +2360,8 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, /* Skip header */ vcol_screen_pos+= FRM_VCOL_NEW_BASE_SIZE; + share->vcol_defs.str+= FRM_VCOL_NEW_BASE_SIZE; + share->vcol_defs.length-= FRM_VCOL_NEW_BASE_SIZE; /* Read virtual columns, default values and check constraints @@ -2203,40 +2374,28 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, uint field_nr= uint2korr(vcol_screen_pos+1); uint expr_length= uint2korr(vcol_screen_pos+3); uint name_length= (uint) vcol_screen_pos[5]; - LEX_STRING name; - char *expr; - vcol_screen_pos+= FRM_VCOL_NEW_HEADER_SIZE; - - name.str= 0; - if ((name.length= name_length)) - { - if (!(name.str= strmake_root(&share->mem_root, - (char*) vcol_screen_pos, - name_length))) - goto err; - } - vcol_screen_pos+= name_length; - if (!(vcol_info= new (&share->mem_root) Virtual_column_info()) || - !(expr= (char *) strmake_root(&share->mem_root, - (char*) vcol_screen_pos, - expr_length))) + if (!(vcol_info= new (&share->mem_root) Virtual_column_info())) goto err; - vcol_info->name= name; - /* The following can only be true for check_constraints */ + if (field_nr != UINT_MAX16) { DBUG_ASSERT(field_nr < share->fields); reg_field= share->field[field_nr]; } - vcol_info->expr_str.str= expr; - vcol_info->expr_str.length= expr_length; - vcol_screen_pos+= expr_length; + vcol_screen_pos+= FRM_VCOL_NEW_HEADER_SIZE; + vcol_info->name.length= name_length; + if (name_length) + vcol_info->name.str= strmake_root(&share->mem_root, + (char*)vcol_screen_pos, name_length); + else + vcol_info->name.str= const_cast(reg_field->field_name); + vcol_screen_pos+= name_length + expr_length; switch (type) { - case 0: // Generated virtual field + case VCOL_GENERATED_VIRTUAL: { uint recpos; reg_field->vcol_info= vcol_info; @@ -2248,25 +2407,24 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, share->stored_rec_length= recpos-1; break; } - case 1: // Generated stored field + case VCOL_GENERATED_STORED: vcol_info->stored_in_db= 1; DBUG_ASSERT(!reg_field->vcol_info); reg_field->vcol_info= vcol_info; share->virtual_fields++; - share->virtual_stored_fields++; // For insert/load data break; - case 2: // Default expression + case VCOL_DEFAULT: vcol_info->stored_in_db= 1; DBUG_ASSERT(!reg_field->default_value); reg_field->default_value= vcol_info; share->default_expressions++; break; - case 3: // Field check constraint + case VCOL_CHECK_FIELD: DBUG_ASSERT(!reg_field->check_constraint); reg_field->check_constraint= vcol_info; share->field_check_constraints++; break; - case 4: // Table check constraint + case VCOL_CHECK_TABLE: *(table_check_constraints++)= vcol_info; break; } @@ -2553,14 +2711,16 @@ static bool fix_vcol_expr(THD *thd, Virtual_column_info *vcol) const char *save_where= thd->where; thd->where= "virtual column function"; - int error= vcol->expr_item->fix_fields(thd, &vcol->expr_item); + int error= vcol->expr->fix_fields(thd, &vcol->expr); thd->mark_used_columns= save_mark_used_columns; thd->where= save_where; if (unlikely(error)) { - my_error(ER_ERROR_EVALUATING_EXPRESSION, MYF(0), vcol->expr_str); + StringBuffer str; + vcol->print(&str); + my_error(ER_ERROR_EVALUATING_EXPRESSION, MYF(0), str.c_ptr()); DBUG_RETURN(1); } @@ -2578,8 +2738,8 @@ bool fix_session_vcol_expr(THD *thd, Virtual_column_info *vcol) if (!(vcol->flags & (VCOL_TIME_FUNC|VCOL_SESSION_FUNC))) DBUG_RETURN(0); - vcol->expr_item->cleanup(); - DBUG_ASSERT(!vcol->expr_item->fixed); + vcol->expr->cleanup(); + DBUG_ASSERT(!vcol->expr->fixed); DBUG_RETURN(fix_vcol_expr(thd, vcol)); } @@ -2632,10 +2792,10 @@ bool fix_session_vcol_expr_for_read(THD *thd, Field *field, FALSE Otherwise */ -static bool fix_and_check_vcol_expr(THD *thd, TABLE *table, Field *field, +static bool fix_and_check_vcol_expr(THD *thd, TABLE *table, Virtual_column_info *vcol) { - Item* func_expr= vcol->expr_item; + Item* func_expr= vcol->expr; DBUG_ENTER("fix_and_check_vcol_expr"); DBUG_PRINT("info", ("vcol: %p", vcol)); DBUG_ASSERT(func_expr); @@ -2650,7 +2810,7 @@ static bool fix_and_check_vcol_expr(THD *thd, TABLE *table, Field *field, DBUG_RETURN(0); // already checked, no need to do it again /* fix_fields could've changed the expression */ - func_expr= vcol->expr_item; + func_expr= vcol->expr; /* this was checked in check_expression(), but the frm could be mangled... */ if (unlikely(func_expr->result_type() == ROW_RESULT)) @@ -2670,7 +2830,7 @@ static bool fix_and_check_vcol_expr(THD *thd, TABLE *table, Field *field, if (error || (res.errors & VCOL_IMPOSSIBLE)) { // this can only happen if the frm was corrupted my_error(ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED, MYF(0), res.name, - "???", field ? field->field_name : "?????"); + "???", "?????"); DBUG_RETURN(1); } vcol->flags= res.errors; @@ -2694,10 +2854,10 @@ static bool fix_and_check_vcol_expr(THD *thd, TABLE *table, Field *field, Unpack the definition of a virtual column from its linear representation @param thd The thread object - @param mem_root Where to allocate memory + @param mem_root Where to allocate memory @param table The table containing the virtual column + @param field Field if this is a DEFAULT or AS, otherwise NULL @param vcol The Virtual_column object - @param field Field if this is a DEFAULT or AS, otherwise NULL @param[out] error_reported Flag to inform the caller that no other error messages are to be generated @@ -2716,118 +2876,51 @@ static bool fix_and_check_vcol_expr(THD *thd, TABLE *table, Field *field, Before passing 'vcol_expr' to the parser the function wraps it in parentheses and prepends a special keyword. - @retval - Virtual_column_info* If a success - @retval - NULL Error + @retval Virtual_column_info* Success + @retval NULL Error */ -Virtual_column_info *unpack_vcol_info_from_frm(THD *thd, - MEM_ROOT *mem_root, - TABLE *table, - Field *field, - Virtual_column_info *vcol, - bool *error_reported) +static Virtual_column_info * +unpack_vcol_info_from_frm(THD *thd, MEM_ROOT *mem_root, TABLE *table, + String *expr_str, Virtual_column_info **vcol_ptr, + bool *error_reported) { - char *vcol_expr_str; - int str_len; - CHARSET_INFO *save_character_set_client, *save_collation; - Query_arena *backup_stmt_arena_ptr; - Query_arena backup_arena; - Query_arena *vcol_arena= 0; Create_field vcol_storage; // placeholder for vcol_info Parser_state parser_state; - Virtual_column_info *vcol_info= 0; - LEX_STRING *vcol_expr= &vcol->expr_str; + Virtual_column_info *vcol= *vcol_ptr, *vcol_info= 0; LEX *old_lex= thd->lex; LEX lex; bool error; DBUG_ENTER("unpack_vcol_info_from_frm"); - DBUG_ASSERT(vcol_expr); - save_character_set_client= thd->variables.character_set_client; - save_collation= thd->variables.collation_connection; - backup_stmt_arena_ptr= thd->stmt_arena; - - /* - Step 1: Construct the input string for the parser. - The string to be parsed has to be of the following format: - "PARSE_VCOL_EXPR ()". - */ + DBUG_ASSERT(vcol->expr == NULL); - if (!(vcol_expr_str= (char*) alloc_root(mem_root, - vcol_expr->length + - parse_vcol_keyword.length + 3))) - DBUG_RETURN(0); - memcpy(vcol_expr_str, parse_vcol_keyword.str, parse_vcol_keyword.length); - str_len= parse_vcol_keyword.length; - vcol_expr_str[str_len++]= '('; - memcpy(vcol_expr_str + str_len, vcol_expr->str, vcol_expr->length); - str_len+= vcol_expr->length; - vcol_expr_str[str_len++]= ')'; - vcol_expr_str[str_len++]= 0; - - if (parser_state.init(thd, vcol_expr_str, str_len)) - goto err; - - /* - Step 2: Setup thd for parsing. - */ - vcol_arena= table->expr_arena; - if (!vcol_arena) - { - /* - We need to use CONVENTIONAL_EXECUTION here to ensure that - any new items created by fix_fields() are not reverted. - */ - Query_arena expr_arena(mem_root, - Query_arena::STMT_CONVENTIONAL_EXECUTION); - if (!(vcol_arena= (Query_arena *) alloc_root(mem_root, - sizeof(Query_arena)))) - goto err; - *vcol_arena= expr_arena; - table->expr_arena= vcol_arena; - } - thd->set_n_backup_active_arena(vcol_arena, &backup_arena); - thd->stmt_arena= vcol_arena; + if (parser_state.init(thd, expr_str->c_ptr_safe(), expr_str->length())) + goto end; if (init_lex_with_single_table(thd, table, &lex)) - goto err; + goto end; - lex.parse_vcol_expr= TRUE; + lex.parse_vcol_expr= true; lex.last_field= &vcol_storage; - /* - Step 3: Use the parser to build an Item object from vcol_expr_str. - */ - if (vcol->utf8) - { - thd->update_charset(&my_charset_utf8mb4_general_ci, - table->s->table_charset); - } error= parse_sql(thd, &parser_state, NULL); if (error) - goto err; + goto end; vcol_storage.vcol_info->stored_in_db= vcol->stored_in_db; vcol_storage.vcol_info->name= vcol->name; vcol_storage.vcol_info->utf8= vcol->utf8; - if (!fix_and_check_vcol_expr(thd, table, field, vcol_storage.vcol_info)) + if (!fix_and_check_vcol_expr(thd, table, vcol_storage.vcol_info)) { - vcol_info= vcol_storage.vcol_info; // Expression ok + *vcol_ptr= vcol_info= vcol_storage.vcol_info; // Expression ok + DBUG_ASSERT(vcol_info->expr); goto end; } *error_reported= TRUE; -err: - thd->free_items(); end: - thd->stmt_arena= backup_stmt_arena_ptr; - if (vcol_arena) - thd->restore_active_arena(vcol_arena, &backup_arena); end_lex_with_single_table(thd, table, old_lex); - if (vcol->utf8) - thd->update_charset(save_character_set_client, save_collation); DBUG_RETURN(vcol_info); } @@ -2835,15 +2928,11 @@ end: static bool check_vcol_forward_refs(Field *field, Virtual_column_info *vcol) { bool res= vcol && - vcol->expr_item->walk(&Item::check_field_expression_processor, 0, + vcol->expr->walk(&Item::check_field_expression_processor, 0, field); return res; } -/* - Read data from a binary .frm file from MySQL 3.23 - 5.0 into TABLE_SHARE -*/ - /* Open a table based on a TABLE_SHARE @@ -2906,7 +2995,6 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share, goto err; outparam->quick_keys.init(); outparam->covering_keys.init(); - outparam->merge_keys.init(); outparam->intersect_keys.init(); outparam->keys_in_use_for_query.init(); @@ -3053,104 +3141,14 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share, if (share->table_check_constraints || share->field_check_constraints) outparam->check_constraints= check_constraint_ptr; - /* Reuse the same loop both for virtual, default and check fields */ - for (field_ptr= outparam->field; *field_ptr; field_ptr++) + if (parse_vcol_defs(thd, &outparam->mem_root, outparam, &error_reported)) { - Field *field= *field_ptr; - if (field->vcol_info) - { - Virtual_column_info *vcol; - field->vcol_info->name.str= (char*) field->field_name; - if (!(vcol= unpack_vcol_info_from_frm(thd, &outparam->mem_root, - outparam, *field_ptr, - field->vcol_info, - &error_reported))) - { - error= OPEN_FRM_CORRUPTED; - goto err; - } - field->vcol_info= vcol; - *(vfield_ptr++)= *field_ptr; - } - - if (field->check_constraint) - { - Virtual_column_info *vcol; - field->check_constraint->name.str= - (char*) field->field_name; - if (!(vcol= unpack_vcol_info_from_frm(thd, &outparam->mem_root, - outparam, 0, - field->check_constraint, - &error_reported))) - { - error= OPEN_FRM_CORRUPTED; - goto err; - } - field->check_constraint= vcol; - *(check_constraint_ptr++)= vcol; - } - - if (field->default_value) - { - Virtual_column_info *vcol; - field->default_value->name.str= - (char*) field->field_name; - if (!(vcol= unpack_vcol_info_from_frm(thd, &outparam->mem_root, - outparam, *field_ptr, - field->default_value, - &error_reported))) - { - error= OPEN_FRM_CORRUPTED; - goto err; - } - field->default_value= vcol; - *(dfield_ptr++)= *field_ptr; - } - else - if (field->has_update_default_function()) - *(dfield_ptr++)= *field_ptr; - - } - *vfield_ptr= 0; // End marker - *dfield_ptr= 0; // End marker - - /* Check that expressions aren't refering to not yet initialized fields */ - for (field_ptr= outparam->field; *field_ptr; field_ptr++) - { - Field *field= *field_ptr; - if (check_vcol_forward_refs(field, field->vcol_info) || - check_vcol_forward_refs(field, field->check_constraint) || - check_vcol_forward_refs(field, field->default_value)) - { - error= OPEN_FRM_CORRUPTED; - goto err; - } + error= OPEN_FRM_CORRUPTED; + goto err; } /* Update to use trigger fields */ switch_defaults_to_nullable_trigger_fields(outparam); - - /* Copy table level constraints to check_constraint_ptr */ - for (i= 0 ; - i < share->table_check_constraints - share->field_check_constraints; - i++) - { - if (!(*check_constraint_ptr= - unpack_vcol_info_from_frm(thd, - &outparam->mem_root, - outparam, - 0, - share->check_constraints[i], - &error_reported))) - { - error= OPEN_FRM_CORRUPTED; - goto err; - } - (*check_constraint_ptr)->name= share->check_constraints[i]->name; - check_constraint_ptr++; - } - - *check_constraint_ptr= 0; // End marker } #ifdef WITH_PARTITION_STORAGE_ENGINE @@ -3289,13 +3287,8 @@ partititon_err: /* The table struct is now initialized; Open the table */ if (db_stat) { - if (db_stat & HA_OPEN_TEMPORARY) - ha_open_flags|= HA_OPEN_TMP_TABLE; - else if ((db_stat & HA_WAIT_IF_LOCKED) || - (specialflag & SPECIAL_WAIT_IF_LOCKED)) + if (specialflag & SPECIAL_WAIT_IF_LOCKED) ha_open_flags|= HA_OPEN_WAIT_IF_LOCKED; - else if (db_stat & (HA_ABORT_IF_LOCKED | HA_GET_INFO)) - ha_open_flags|= HA_OPEN_ABORT_IF_LOCKED; else ha_open_flags|= HA_OPEN_IGNORE_IF_LOCKED; @@ -3369,6 +3362,8 @@ partititon_err: outparam->file= 0; // For easier error checking outparam->db_stat=0; thd->lex->context_analysis_only= save_context_analysis_only; + if (outparam->expr_arena) + outparam->expr_arena->free_items(); free_root(&outparam->mem_root, MYF(0)); // Safe to call on bzero'd root outparam->alias.free(); DBUG_RETURN (error); @@ -3757,7 +3752,7 @@ void prepare_frm_header(THD *thd, uint reclength, uchar *fileinfo, int4store(fileinfo+51, tmp); int4store(fileinfo+55, create_info->extra_size); /* - 59-60 is reserved for extra_rec_buf_length, + 59-60 is unused since 10.2.4 61 for default_part_db_type */ int2store(fileinfo+62, create_info->key_block_size); @@ -3811,8 +3806,8 @@ rename_file_ext(const char * from,const char * to,const char * ext) bool get_field(MEM_ROOT *mem, Field *field, String *res) { - char buff[MAX_FIELD_WIDTH], *to; - String str(buff,sizeof(buff),&my_charset_bin); + char *to; + StringBuffer str; bool rc; THD *thd= field->get_thd(); sql_mode_t sql_mode_backup= thd->variables.sql_mode; @@ -4095,13 +4090,11 @@ Table_check_intact::check(TABLE *table, const TABLE_FIELD_DEF *table_def) is backward compatible. */ } - char buffer[1024]; + StringBuffer<1024> sql_type(system_charset_info); + sql_type.extra_allocation(256); // Allocate min 256 characters at once for (i=0 ; i < table_def->count; i++, field_def++) { - String sql_type(buffer, sizeof(buffer), system_charset_info); sql_type.length(0); - /* Allocate min 256 characters at once */ - sql_type.extra_allocation(256); if (i < table->s->fields) { Field *field= table->field[i]; @@ -4230,6 +4223,15 @@ Table_check_intact::check(TABLE *table, const TABLE_FIELD_DEF *table_def) } +void Table_check_intact_log_error::report_error(uint, const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + error_log_print(ERROR_LEVEL, fmt, args); + va_end(args); +} + + /** Traverse portion of wait-for graph which is reachable through edge represented by this flush ticket in search for deadlocks. @@ -4474,7 +4476,7 @@ void TABLE::init(THD *thd, TABLE_LIST *tl) DBUG_ASSERT(key_read == 0); /* mark the record[0] uninitialized */ - TRASH(record[0], s->reclength); + TRASH_ALLOC(record[0], s->reclength); /* Initialize the null marker bits, to ensure that if we are doing a read @@ -5046,8 +5048,6 @@ void TABLE_LIST::cleanup_items() VIEW_CHECK_SKIP FAILED, but continue */ -const LEX_STRING view_check_name= { C_STRING_WITH_LEN("WITH CHECK OPTION") }; - int TABLE_LIST::view_check_option(THD *thd, bool ignore_failure) { @@ -5075,7 +5075,7 @@ int TABLE::verify_constraints(bool ignore_failure) { for (Virtual_column_info **chk= check_constraints ; *chk ; chk++) { - if ((*chk)->expr_item->val_int() == 0) + if ((*chk)->expr->val_int() == 0) { my_error(ER_CONSTRAINT_FAILED, MYF(ignore_failure ? ME_JUST_WARNING : 0), (*chk)->name.str, @@ -6185,9 +6185,9 @@ void TABLE::mark_columns_used_by_index_no_reset(uint index, { bitmap_set_bit(bitmap, key_part->fieldnr-1); if (key_part->field->vcol_info && - key_part->field->vcol_info->expr_item) + key_part->field->vcol_info->expr) key_part->field->vcol_info-> - expr_item->walk(&Item::register_field_in_bitmap, 1, bitmap); + expr->walk(&Item::register_field_in_bitmap, 1, bitmap); } } @@ -6235,6 +6235,7 @@ void TABLE::mark_auto_increment_column() void TABLE::mark_columns_needed_for_delete() { + bool need_signal= false; mark_columns_per_binlog_row_image(); if (triggers) @@ -6245,9 +6246,13 @@ void TABLE::mark_columns_needed_for_delete() for (reg_field= field ; *reg_field ; reg_field++) { if ((*reg_field)->flags & PART_KEY_FLAG) + { bitmap_set_bit(read_set, (*reg_field)->field_index); + if ((*reg_field)->vcol_info) + mark_virtual_col(*reg_field); + } } - file->column_bitmaps_signal(); + need_signal= true; } if (file->ha_table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_DELETE) { @@ -6261,11 +6266,17 @@ void TABLE::mark_columns_needed_for_delete() else { mark_columns_used_by_index_no_reset(s->primary_key, read_set); - file->column_bitmaps_signal(); + need_signal= true; } } if (check_constraints) + { mark_check_constraint_columns_for_read(); + need_signal= true; + } + + if (need_signal) + file->column_bitmaps_signal(); } @@ -6290,22 +6301,42 @@ void TABLE::mark_columns_needed_for_delete() void TABLE::mark_columns_needed_for_update() { DBUG_ENTER("mark_columns_needed_for_update"); + bool need_signal= false; mark_columns_per_binlog_row_image(); if (triggers) triggers->mark_fields_used(TRG_EVENT_UPDATE); + if (default_field) + mark_default_fields_for_write(FALSE); + if (vfield) + need_signal|= mark_virtual_columns_for_write(FALSE); if (file->ha_table_flags() & HA_REQUIRES_KEY_COLUMNS_FOR_DELETE) { - /* Mark all used key columns for read */ - Field **reg_field; - for (reg_field= field ; *reg_field ; reg_field++) + KEY *end= key_info + s->keys; + for (KEY *k= key_info; k < end; k++) { - /* Merge keys is all keys that had a column refered to in the query */ - if (merge_keys.is_overlapping((*reg_field)->part_of_key)) - bitmap_set_bit(read_set, (*reg_field)->field_index); + KEY_PART_INFO *kpend= k->key_part + k->ext_key_parts; + bool any_written= false, all_read= true; + for (KEY_PART_INFO *kp= k->key_part; kp < kpend; kp++) + { + int idx= kp->fieldnr - 1; + any_written|= bitmap_is_set(write_set, idx); + all_read&= bitmap_is_set(read_set, idx); + } + if (any_written && !all_read) + { + for (KEY_PART_INFO *kp= k->key_part; kp < kpend; kp++) + { + int idx= kp->fieldnr - 1; + if (bitmap_fast_test_and_set(read_set, idx)) + continue; + if (field[idx]->vcol_info) + mark_virtual_col(field[idx]); + } + } } - file->column_bitmaps_signal(); + need_signal= true; } if (file->ha_table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_DELETE) { @@ -6319,16 +6350,14 @@ void TABLE::mark_columns_needed_for_update() else { mark_columns_used_by_index_no_reset(s->primary_key, read_set); - file->column_bitmaps_signal(); + need_signal= true; } } - if (default_field) - mark_default_fields_for_write(FALSE); - /* Mark all virtual columns needed for update */ - if (vfield) - mark_virtual_columns_for_write(FALSE); if (check_constraints) + { mark_check_constraint_columns_for_read(); + need_signal= true; + } /* If a timestamp field settable on UPDATE is present then to avoid wrong @@ -6337,7 +6366,12 @@ void TABLE::mark_columns_needed_for_update() */ if ((file->ha_table_flags() & HA_PARTIAL_COLUMN_READ) && default_field && s->has_update_default_function) + { bitmap_union(read_set, write_set); + need_signal= true; + } + if (need_signal) + file->column_bitmaps_signal(); DBUG_VOID_RETURN; } @@ -6517,7 +6551,7 @@ bool TABLE::mark_virtual_col(Field *field) DBUG_ASSERT(field->vcol_info); if (!(res= bitmap_fast_test_and_set(vcol_set, field->field_index))) { - Item *vcol_item= field->vcol_info->expr_item; + Item *vcol_item= field->vcol_info->expr; DBUG_ASSERT(vcol_item); vcol_item->walk(&Item::register_field_in_read_map, 1, 0); } @@ -6540,7 +6574,7 @@ bool TABLE::mark_virtual_col(Field *field) through columns from write_set it is also marked in vcol_set, and, besides, it is added to write_set. - @return void + @return whether a bitmap was updated @note Let table t1 have columns a,b,c and let column c be a stored virtual @@ -6553,42 +6587,49 @@ bool TABLE::mark_virtual_col(Field *field) be added to read_set either. */ -void TABLE::mark_virtual_columns_for_write(bool insert_fl) +bool TABLE::mark_virtual_columns_for_write(bool insert_fl) { Field **vfield_ptr, *tmp_vfield; - bool bitmap_updated= FALSE; + bool bitmap_updated= false; for (vfield_ptr= vfield; *vfield_ptr; vfield_ptr++) { tmp_vfield= *vfield_ptr; if (bitmap_is_set(write_set, tmp_vfield->field_index)) bitmap_updated= mark_virtual_col(tmp_vfield); - else if (tmp_vfield->vcol_info->stored_in_db) + else if (tmp_vfield->vcol_info->stored_in_db || + (tmp_vfield->flags & PART_KEY_FLAG)) { - bool mark_fl= insert_fl; - if (!mark_fl) - { - MY_BITMAP *save_read_set; - Item *vcol_item= tmp_vfield->vcol_info->expr_item; - DBUG_ASSERT(vcol_item); - bitmap_clear_all(&tmp_set); - save_read_set= read_set; - read_set= &tmp_set; - vcol_item->walk(&Item::register_field_in_read_map, 1, 0); - read_set= save_read_set; - bitmap_intersect(&tmp_set, write_set); - mark_fl= !bitmap_is_clear_all(&tmp_set); - } - if (mark_fl) + if (insert_fl) { bitmap_set_bit(write_set, tmp_vfield->field_index); mark_virtual_col(tmp_vfield); - bitmap_updated= TRUE; + bitmap_updated= true; + } + else + { + MY_BITMAP *save_read_set= read_set, *save_vcol_set= vcol_set; + Item *vcol_item= tmp_vfield->vcol_info->expr; + DBUG_ASSERT(vcol_item); + bitmap_clear_all(&tmp_set); + read_set= vcol_set= &tmp_set; + vcol_item->walk(&Item::register_field_in_read_map, 1, 0); + read_set= save_read_set; + vcol_set= save_vcol_set; + if (bitmap_is_overlapping(&tmp_set, write_set)) + { + bitmap_set_bit(write_set, tmp_vfield->field_index); + bitmap_set_bit(vcol_set, tmp_vfield->field_index); + bitmap_union(read_set, &tmp_set); + bitmap_union(vcol_set, &tmp_set); + bitmap_updated= true; + } } } } if (bitmap_updated) file->column_bitmaps_signal(); + return bitmap_updated; } /* @@ -6609,7 +6650,7 @@ void TABLE::mark_columns_used_by_check_constraints(void) read_set= s->check_set; for (Virtual_column_info **chk= check_constraints ; *chk ; chk++) - (*chk)->expr_item->walk(&Item::register_field_in_read_map, 1, 0); + (*chk)->expr->walk(&Item::register_field_in_read_map, 1, 0); read_set= save_read_set; s->check_set_initialized= 1; @@ -6637,7 +6678,7 @@ void TABLE::mark_default_fields_for_write(bool is_insert) if (is_insert && field->default_value) { bitmap_set_bit(write_set, field->field_index); - field->default_value->expr_item-> + field->default_value->expr-> walk(&Item::register_field_in_read_map, 1, 0); } else if (!is_insert && field->has_update_default_function()) @@ -6646,6 +6687,18 @@ void TABLE::mark_default_fields_for_write(bool is_insert) DBUG_VOID_RETURN; } +void TABLE::move_fields(Field **ptr, const uchar *to, const uchar *from) +{ + my_ptrdiff_t diff= to - from; + if (diff) + { + do + { + (*ptr)->move_field_offset(diff); + } while (*(++ptr)); + } +} + /** @brief @@ -7275,19 +7328,11 @@ bool is_simple_order(ORDER *order) /* @brief Compute values for virtual columns used in query - @param thd Thread handle - @param table The TABLE object - @param vcol_update_mode Specifies what virtual column are computed + @param update_mode Specifies what virtual column are computed @details The function computes the values of the virtual columns of the table and stores them in the table record buffer. - If vcol_update_mode is set to VCOL_UPDATE_ALL then all virtual column are - computed. - If vcol_update_mode is set to VCOL_UPDATE_FOR_WRITE then all - fields that are set in vcol_set are updated. - If vcol_update_mode is set to VCOL_UPDATE_FOR_READ then all - fields that are set in vcol_set and are not stored are updated. @retval 0 Success @@ -7295,37 +7340,67 @@ bool is_simple_order(ORDER *order) >0 Error occurred when storing a virtual field value */ -int update_virtual_fields(THD *thd, TABLE *table, - enum enum_vcol_update_mode vcol_update_mode) +int TABLE::update_virtual_fields(enum_vcol_update_mode update_mode) { - DBUG_ENTER("update_virtual_fields"); - Field **vfield_ptr, *vfield; - int error __attribute__ ((unused))= 0; - DBUG_ASSERT(table && table->vfield); + DBUG_ENTER("TABLE::update_virtual_fields"); + Field **vfield_ptr, *vf; + DBUG_ASSERT(vfield); - thd->reset_arena_for_cached_items(table->expr_arena); + in_use->reset_arena_for_cached_items(expr_arena); /* Iterate over virtual fields in the table */ - for (vfield_ptr= table->vfield; *vfield_ptr; vfield_ptr++) + for (vfield_ptr= vfield; *vfield_ptr; vfield_ptr++) { - vfield= (*vfield_ptr); - Virtual_column_info *vcol_info= vfield->vcol_info; + vf= (*vfield_ptr); + Virtual_column_info *vcol_info= vf->vcol_info; DBUG_ASSERT(vcol_info); - DBUG_ASSERT(vcol_info->expr_item); - if ((bitmap_is_set(table->vcol_set, vfield->field_index) && - (vcol_update_mode == VCOL_UPDATE_FOR_WRITE || - !vcol_info->stored_in_db)) || - vcol_update_mode == VCOL_UPDATE_ALL) + DBUG_ASSERT(vcol_info->expr); + + bool update; + switch (update_mode) { + case VCOL_UPDATE_FOR_READ_WRITE: + if (triggers) + { + update= true; + break; + } + case VCOL_UPDATE_FOR_READ: + update= !vcol_info->stored_in_db + && !(key_read && vf->part_of_key.is_set(file->active_index)) + && bitmap_is_set(vcol_set, vf->field_index); + break; + case VCOL_UPDATE_FOR_WRITE: + update= triggers || bitmap_is_set(vcol_set, vf->field_index); + break; + case VCOL_UPDATE_INDEXED: + update= !vcol_info->stored_in_db && (vf->flags & PART_KEY_FLAG) + && bitmap_is_set(vcol_set, vf->field_index); + break; + } + + if (update) { /* Compute the actual value of the virtual fields */ - error= vcol_info->expr_item->save_in_field(vfield, 0); - DBUG_PRINT("info", ("field '%s' - updated", vfield->field_name)); + vcol_info->expr->save_in_field(vf, 0); + DBUG_PRINT("info", ("field '%s' - updated", vf->field_name)); } else { - DBUG_PRINT("info", ("field '%s' - skipped", vfield->field_name)); + DBUG_PRINT("info", ("field '%s' - skipped", vf->field_name)); } } - thd->reset_arena_for_cached_items(0); + in_use->reset_arena_for_cached_items(0); + DBUG_RETURN(0); +} + +int TABLE::update_virtual_field(Field *vf) +{ + DBUG_ENTER("TABLE::update_virtual_field"); + + in_use->reset_arena_for_cached_items(expr_arena); + bitmap_clear_all(&tmp_set); + vf->vcol_info->expr->walk(&Item::update_vcol_processor, 0, &tmp_set); + vf->vcol_info->expr->save_in_field(vf, 0); + in_use->reset_arena_for_cached_items(0); DBUG_RETURN(0); } @@ -7352,7 +7427,7 @@ int update_virtual_fields(THD *thd, TABLE *table, int TABLE::update_default_fields(bool update_command, bool ignore_errors) { - DBUG_ENTER("update_default_fields"); + DBUG_ENTER("TABLE::update_default_fields"); Field **field_ptr; int res= 0; DBUG_ASSERT(default_field); @@ -7373,9 +7448,7 @@ int TABLE::update_default_fields(bool update_command, bool ignore_errors) { if (field->default_value && (field->default_value->flags || field->flags & BLOB_FLAG)) - res|= (field->default_value->expr_item->save_in_field(field, 0) < 0); - else - res|= field->evaluate_insert_default_function(); + res|= (field->default_value->expr->save_in_field(field, 0) < 0); } else res|= field->evaluate_update_default_function(); @@ -8108,3 +8181,17 @@ Item* TABLE_LIST::build_pushable_cond_for_table(THD *thd, Item *cond) return cond->build_clone(thd, thd->mem_root); return 0; } + +LEX_CSTRING *fk_option_name(enum_fk_option opt) +{ + static LEX_CSTRING names[]= + { + { STRING_WITH_LEN("???") }, + { STRING_WITH_LEN("RESTRICT") }, + { STRING_WITH_LEN("CASCADE") }, + { STRING_WITH_LEN("SET NULL") }, + { STRING_WITH_LEN("NO ACTION") }, + { STRING_WITH_LEN("SET DEFAULT") } + }; + return names + opt; +} diff --git a/sql/table.h b/sql/table.h index bc30b00ac45..6552a8e13da 100644 --- a/sql/table.h +++ b/sql/table.h @@ -326,8 +326,9 @@ enum release_type { RELEASE_NORMAL, RELEASE_WAIT_FOR_DROP }; enum enum_vcol_update_mode { VCOL_UPDATE_FOR_READ= 0, + VCOL_UPDATE_FOR_READ_WRITE, VCOL_UPDATE_FOR_WRITE, - VCOL_UPDATE_ALL + VCOL_UPDATE_INDEXED }; @@ -479,6 +480,16 @@ public: }; +/* + If the table isn't valid, report the error to the server log only. +*/ +class Table_check_intact_log_error : public Table_check_intact +{ +protected: + void report_error(uint, const char *fmt, ...); +}; + + /** Class representing the fact that some thread waits for table share to be flushed. Is used to represent information about @@ -581,6 +592,7 @@ struct TABLE_SHARE KEY *key_info; /* data of keys in database */ Virtual_column_info **check_constraints; uint *blob_field; /* Index to blobs in Field arrray*/ + LEX_CUSTRING vcol_defs; /* definitions of generated columns */ TABLE_STATISTICS_CB stats_cb; @@ -644,17 +656,22 @@ struct TABLE_SHARE the record then this value is 0. */ uint null_bytes_for_compare; - uint fields; /* Number of fields */ - /* Number of stored fields, generated-only virtual fields are not included */ - uint stored_fields; + uint fields; /* number of fields */ + uint stored_fields; /* number of stored fields, purely virtual not included */ + uint virtual_fields; /* number of purely virtual fields */ + uint null_fields; /* number of null fields */ + uint blob_fields; /* number of blob fields */ + uint varchar_fields; /* number of varchar fields */ + uint default_fields; /* number of default fields */ + + uint default_expressions; + uint table_check_constraints, field_check_constraints; + uint rec_buff_length; /* Size of table->record[] buffer */ uint keys, key_parts; uint ext_key_parts; /* Total number of key parts in extended keys */ uint max_key_length, max_unique_length, total_key_length; uint uniques; /* Number of UNIQUE index */ - uint null_fields; /* number of null fields */ - uint blob_fields; /* number of blob fields */ - uint varchar_fields; /* number of varchar fields */ uint db_create_options; /* Create options from database */ uint db_options_in_use; /* Options in use */ uint db_record_offset; /* if HA_REC_IN_SEQ */ @@ -668,10 +685,7 @@ struct TABLE_SHARE uint open_errno; /* error from open_table_def() */ uint column_bitmap_size; uchar frm_version; - uint virtual_fields; - uint default_expressions; - uint table_check_constraints, field_check_constraints; - uint default_fields; /* Number of default fields */ + bool use_ext_keys; /* Extended keys can be used */ bool null_field_first; bool system; /* Set if system table (one record) */ @@ -682,7 +696,6 @@ struct TABLE_SHARE bool table_creation_was_logged; bool non_determinstic_insert; bool vcols_need_refixing; - bool virtual_stored_fields; bool check_set_initialized; bool has_update_default_function; ulong table_map_id; /* for row-based replication */ @@ -1029,7 +1042,6 @@ public: uint32 instance; /** Table cache instance this TABLE is belonging to */ THD *in_use; /* Which thread uses this */ - Field **field; /* Pointer to fields */ uchar *record[2]; /* Pointer to records */ uchar *write_row_record; /* Used as optimisation in @@ -1040,7 +1052,7 @@ public: needed by the query without reading the row. */ key_map covering_keys; - key_map quick_keys, merge_keys,intersect_keys; + key_map quick_keys, intersect_keys; /* A set of keys that can be used in the query that references this table. @@ -1059,11 +1071,11 @@ public: key_map keys_in_use_for_order_by; KEY *key_info; /* data of keys in database */ + Field **field; /* Pointer to fields */ + Field **vfield; /* Pointer to virtual fields*/ + Field **default_field; /* Fields with non-constant DEFAULT */ Field *next_number_field; /* Set if next_number is activated */ Field *found_next_number_field; /* Set on open */ - Field **vfield; /* Pointer to virtual fields*/ - /* Fields that are updated automatically on INSERT or UPDATE. */ - Field **default_field; Virtual_column_info **check_constraints; /* Table's triggers, 0 if there are no of them */ @@ -1306,7 +1318,7 @@ public: void mark_columns_needed_for_insert(void); void mark_columns_per_binlog_row_image(void); bool mark_virtual_col(Field *field); - void mark_virtual_columns_for_write(bool insert_fl); + bool mark_virtual_columns_for_write(bool insert_fl); void mark_default_fields_for_write(bool insert_fl); void mark_columns_used_by_check_constraints(void); void mark_check_constraint_columns_for_read(void); @@ -1418,8 +1430,12 @@ public: my_ptrdiff_t default_values_offset() const { return (my_ptrdiff_t) (s->default_values - record[0]); } + void move_fields(Field **ptr, const uchar *to, const uchar *from); + uint actual_n_key_parts(KEY *keyinfo); ulong actual_key_flags(KEY *keyinfo); + int update_virtual_field(Field *vf); + int update_virtual_fields(enum_vcol_update_mode update_mode); int update_default_fields(bool update, bool ignore_errors); void reset_default_fields(); inline ha_rows stat_records() { return used_stat_records; } @@ -1473,6 +1489,9 @@ enum enum_schema_table_state PROCESSED_BY_JOIN_EXEC }; +enum enum_fk_option { FK_OPTION_UNDEF, FK_OPTION_RESTRICT, FK_OPTION_CASCADE, + FK_OPTION_SET_NULL, FK_OPTION_NO_ACTION, FK_OPTION_SET_DEFAULT}; + typedef struct st_foreign_key_info { LEX_STRING *foreign_id; @@ -1480,13 +1499,15 @@ typedef struct st_foreign_key_info LEX_STRING *foreign_table; LEX_STRING *referenced_db; LEX_STRING *referenced_table; - LEX_STRING *update_method; - LEX_STRING *delete_method; + enum_fk_option update_method; + enum_fk_option delete_method; LEX_STRING *referenced_key_name; List foreign_fields; List referenced_fields; } FOREIGN_KEY_INFO; +LEX_CSTRING *fk_option_name(enum_fk_option opt); + #define MY_I_S_MAYBE_NULL 1 #define MY_I_S_UNSIGNED 2 @@ -1747,6 +1768,30 @@ struct TABLE_LIST MDL_TRANSACTION); } + inline void init_one_table_for_prelocking(const char *db_name_arg, + size_t db_length_arg, + const char *table_name_arg, + size_t table_name_length_arg, + const char *alias_arg, + enum thr_lock_type lock_type_arg, + bool routine, + TABLE_LIST *belong_to_view_arg, + uint8 trg_event_map_arg, + TABLE_LIST ***last_ptr) + { + init_one_table(db_name_arg, db_length_arg, table_name_arg, + table_name_length_arg, alias_arg, lock_type_arg); + cacheable_table= 1; + prelocking_placeholder= routine ? ROUTINE : FK; + open_type= routine ? OT_TEMPORARY_OR_BASE : OT_BASE_ONLY; + belong_to_view= belong_to_view_arg; + trg_event_map= trg_event_map_arg; + + **last_ptr= this; + prev_global= *last_ptr; + *last_ptr= &next_global; + } + /* List of tables local to a subquery (used by SQL_I_List). Considers views as leaves (unlike 'next_leaf' below). Created at parse time @@ -2027,7 +2072,7 @@ struct TABLE_LIST This TABLE_LIST object is just placeholder for prelocking, it will be used for implicit LOCK TABLES only and won't be used in real statement. */ - bool prelocking_placeholder; + enum { USER, ROUTINE, FK } prelocking_placeholder; /** Indicates that if TABLE_LIST object corresponds to the table/view which requires special handling. @@ -2634,11 +2679,8 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share, bool fix_session_vcol_expr(THD *thd, Virtual_column_info *vcol); bool fix_session_vcol_expr_for_read(THD *thd, Field *field, Virtual_column_info *vcol); -Virtual_column_info *unpack_vcol_info_from_frm(THD *thd, MEM_ROOT *mem_root, - TABLE *table, - Field *field, - Virtual_column_info *vcol, - bool *error_reported); +bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table, + bool *error_reported); TABLE_SHARE *alloc_table_share(const char *db, const char *table_name, const char *key, uint key_length); void init_tmp_table_share(THD *thd, TABLE_SHARE *share, const char *key, diff --git a/sql/table_cache.cc b/sql/table_cache.cc index 6a6b8ab827e..2feace30672 100644 --- a/sql/table_cache.cc +++ b/sql/table_cache.cc @@ -964,6 +964,8 @@ void tdc_release_share(TABLE_SHARE *share) mysql_mutex_lock(&share->tdc->LOCK_table_share); if (--share->tdc->ref_count) { + if (!share->is_view) + mysql_cond_broadcast(&share->tdc->COND_release); mysql_mutex_unlock(&share->tdc->LOCK_table_share); mysql_mutex_unlock(&LOCK_unused_shares); DBUG_VOID_RETURN; diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc index 9a85c09b08e..c05fc632a94 100644 --- a/sql/temporary_tables.cc +++ b/sql/temporary_tables.cc @@ -1116,13 +1116,8 @@ TABLE *THD::open_temporary_table(TMP_TABLE_SHARE *share, } if (open_table_from_share(this, share, alias, - (open_in_engine) ? - (uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE | - HA_GET_INDEX) : 0, - (uint) (READ_KEYINFO | COMPUTE_TYPES | - EXTRA_RECORD), - ha_open_options, - table, + open_in_engine ? (uint)HA_OPEN_KEYFILE : 0, + EXTRA_RECORD, ha_open_options, table, open_in_engine ? false : true)) { my_free(table); diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc index 2308f4277d6..643ff80de2a 100644 --- a/sql/threadpool_common.cc +++ b/sql/threadpool_common.cc @@ -84,17 +84,16 @@ struct Worker_thread_context void save() { -#ifdef HAVE_PSI_INTERFACE - psi_thread= PSI_server?PSI_server->get_thread():0; +#ifdef HAVE_PSI_THREAD_INTERFACE + psi_thread = PSI_THREAD_CALL(get_thread)(); #endif mysys_var= (st_my_thread_var *)pthread_getspecific(THR_KEY_mysys); } void restore() { -#ifdef HAVE_PSI_INTERFACE - if (PSI_server) - PSI_server->set_thread(psi_thread); +#ifdef HAVE_PSI_THREAD_INTERFACE + PSI_THREAD_CALL(set_thread)(psi_thread); #endif pthread_setspecific(THR_KEY_mysys,mysys_var); pthread_setspecific(THR_THD, 0); @@ -102,6 +101,41 @@ struct Worker_thread_context }; +#ifdef HAVE_PSI_INTERFACE + +/* + The following fixes PSI "idle" psi instrumentation. + The server assumes that connection becomes idle + just before net_read_packet() and switches to active after it. + In out setup, server becomes idle when async socket io is made. +*/ + +extern void net_before_header_psi(struct st_net *net, void *user_data, size_t); + +static void dummy_before_header(struct st_net *, void *, size_t) +{ +} + +static void re_init_net_server_extension(THD *thd) +{ + thd->m_net_server_extension.m_before_header = dummy_before_header; +} + +#else + +#define re_init_net_server_extension(thd) + +#endif /* HAVE_PSI_INTERFACE */ + + +static inline void set_thd_idle(THD *thd) +{ + thd->net.reading_or_writing= 1; +#ifdef HAVE_PSI_INTERFACE + net_before_header_psi(&thd->net, thd, 0); +#endif +} + /* Attach/associate the connection with the OS thread, */ @@ -110,10 +144,10 @@ static void thread_attach(THD* thd) pthread_setspecific(THR_KEY_mysys,thd->mysys_var); thd->thread_stack=(char*)&thd; thd->store_globals(); -#ifdef HAVE_PSI_INTERFACE - if (PSI_server) - PSI_server->set_thread(thd->event_scheduler.m_psi); +#ifdef HAVE_PSI_THREAD_INTERFACE + PSI_THREAD_CALL(set_thread)(thd->event_scheduler.m_psi); #endif + mysql_socket_set_thread_owner(thd->net.vio->mysql_socket); } /* @@ -188,8 +222,6 @@ error: static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data) { THD *thd= NULL; - int error=1; - /* Create a new connection context: mysys_thread_var and PSI thread @@ -222,45 +254,40 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data) thd->event_scheduler.data= scheduler_data; /* Create new PSI thread for use with the THD. */ -#ifdef HAVE_PSI_INTERFACE - if (PSI_server) - { - thd->event_scheduler.m_psi = - PSI_server->new_thread(key_thread_one_connection, thd, thd->thread_id); - } +#ifdef HAVE_PSI_THREAD_INTERFACE + thd->event_scheduler.m_psi= + PSI_THREAD_CALL(new_thread)(key_thread_one_connection, thd, thd->thread_id); #endif /* Login. */ thread_attach(thd); + re_init_net_server_extension(thd); ulonglong now= microsecond_interval_timer(); thd->prior_thr_create_utime= now; thd->start_utime= now; thd->thr_create_utime= now; - if (!setup_connection_thread_globals(thd)) - { - if (!thd_prepare_connection(thd)) - { - - /* - Check if THD is ok, as prepare_new_connection_state() - can fail, for example if init command failed. - */ - if (thd_is_connection_alive(thd)) - { - error= 0; - thd->net.reading_or_writing= 1; - thd->skip_wait_timeout= true; - } - } - } - if (error) - { - threadpool_remove_connection(thd); - thd= NULL; - } + if (setup_connection_thread_globals(thd)) + goto end; + + if (thd_prepare_connection(thd)) + goto end; + + /* + Check if THD is ok, as prepare_new_connection_state() + can fail, for example if init command failed. + */ + if (!thd_is_connection_alive(thd)) + goto end; + + thd->skip_wait_timeout= true; + set_thd_idle(thd); return thd; + +end: + threadpool_remove_connection(thd); + return NULL; } @@ -325,12 +352,13 @@ static int threadpool_process_request(THD *thd) goto end; } + set_thd_idle(thd); + vio= thd->net.vio; if (!vio->has_data(vio)) { /* More info on this debug sync is in sql_parse.cc*/ DEBUG_SYNC(thd, "before_do_command_net_read"); - thd->net.reading_or_writing= 1; goto end; } } diff --git a/sql/unireg.cc b/sql/unireg.cc index d3a9b832aaf..959f8341a90 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -42,13 +42,11 @@ static uint pack_keys(uchar *,uint, KEY *, ulong); static bool pack_header(THD *, uchar *, List &, HA_CREATE_INFO *, ulong, handler *); +static bool pack_vcols(String *, List &, List *); static uint get_interval_id(uint *,List &, Create_field *); static bool pack_fields(uchar **, List &, HA_CREATE_INFO*, ulong); -static void pack_constraints(uchar **buff, List *constr); static size_t packed_fields_length(List &); -static size_t packed_constraints_length(THD *, HA_CREATE_INFO*, - List *); static bool make_empty_rec(THD *, uchar *, uint, List &, uint, ulong); @@ -120,6 +118,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, int error; uchar *frm_ptr, *pos; LEX_CUSTRING frm= {0,0}; + StringBuffer vcols; DBUG_ENTER("build_frm_image"); /* If fixed row records, we need one bit to check for deleted rows */ @@ -127,9 +126,19 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, create_info->null_bits++; data_offset= (create_info->null_bits + 7) / 8; + sql_mode_t save_sql_mode= thd->variables.sql_mode; + thd->variables.sql_mode &= ~MODE_ANSI_QUOTES; + error= pack_vcols(&vcols, create_fields, create_info->check_constraint_list); + thd->variables.sql_mode= save_sql_mode; + + if (error) + DBUG_RETURN(frm); + + if (vcols.length()) + create_info->expression_length= vcols.length() + FRM_VCOL_NEW_BASE_SIZE; + error= pack_header(thd, forminfo, create_fields, create_info, data_offset, db_file); - if (error) DBUG_RETURN(frm); @@ -284,8 +293,6 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, DBUG_PRINT("info", ("part_db_type = %d", fileinfo[61])); } - int2store(fileinfo+59,db_file->extra_rec_buf_length()); - memcpy(frm_ptr, fileinfo, FRM_HEADER_SIZE); pos+= key_buff_length; @@ -338,6 +345,15 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, if (pack_fields(&pos, create_fields, create_info, data_offset)) goto err; + if (vcols.length()) + { + /* Store header for packed fields (extra space for future) */ + bzero(pos, FRM_VCOL_NEW_BASE_SIZE); + pos+= FRM_VCOL_NEW_BASE_SIZE; + memcpy(pos, vcols.ptr(), vcols.length()); + pos+= vcols.length(); + } + { /* Restore all UCS2 intervals. @@ -498,92 +514,73 @@ static uint pack_keys(uchar *keybuff, uint key_count, KEY *keyinfo, /** - Calculate and check length of stored expression (virtual, def, check) + Pack the expression (for GENERATED ALWAYS AS, DEFAULT, CHECK) - Convert string to utf8, if it isn't already - - @param thd Thread handler. Used for memory allocation - @param v_col Virtual expression. Can be 0 - @param CREATE INFO For characterset - @param length Sum total lengths here - - Note to make calls easier, one can call this with v_col == 0 + The data is stored as: + 1 byte type (enum_vcol_info_type) + 2 bytes field_number + 2 bytes length of expression + 1 byte length of name + name + next bytes column expression (text data) @return 0 ok @return 1 error (out of memory or wrong characters in expression) */ -static bool add_expr_length(THD *thd, Virtual_column_info **v_col_ptr, - size_t *length) +static bool pack_expression(String *buf, Virtual_column_info *vcol, + uint field_nr, enum_vcol_info_type type) { - Virtual_column_info *v_col= *v_col_ptr; - if (!v_col) - return 0; + if (buf->reserve(FRM_VCOL_NEW_HEADER_SIZE + vcol->name.length)) + return 1; - /* - Convert string to utf8 for storage. - */ - if (!v_col->utf8) + buf->q_append((char) type); + buf->q_append2b(field_nr); + size_t len_off= buf->length(); + buf->q_append2b(0); // to be added later + buf->q_append((char)vcol->name.length); + buf->q_append(vcol->name.str, vcol->name.length); + size_t expr_start= buf->length(); + vcol->print(buf); + size_t expr_len= buf->length() - expr_start; + if (expr_len >= 65536) { - /* - This v_col comes from the parser (e.g. CREATE TABLE) or - from old (before 10.2.1) frm. - - We have to create a new Virtual_column_info as for alter table, - the current one may be shared with the original table. - */ - Virtual_column_info *new_vcol= new (thd->mem_root) Virtual_column_info(); - LEX_STRING to; - if (thd->copy_with_error(&my_charset_utf8mb4_general_ci, - &to, - thd->variables.character_set_client, - v_col->expr_str.str, v_col->expr_str.length)) - return 1; - *new_vcol= *v_col; - new_vcol->expr_str= to; - new_vcol->utf8= 1; - *v_col_ptr= new_vcol; - v_col= new_vcol; + my_error(ER_EXPRESSION_IS_TOO_BIG, MYF(0), vcol_type_name(type)); + return 1; } - - /* - Sum up the length of the expression string, it's optional name - and the header. - */ - (*length)+= (FRM_VCOL_NEW_HEADER_SIZE + v_col->name.length + - v_col->expr_str.length); + int2store(buf->ptr() + len_off, expr_len); return 0; } -/* - pack_expression - - The data is stored as: - 1 byte type (0 virtual, 1 virtual stored, 2 def, 3 check) - 2 bytes field_number - 2 bytes length of expression - 1 byte length of name - name - next bytes column expression (text data) -*/ - -static void pack_expression(uchar **buff, Virtual_column_info *vcol, - uint offset, uint type) +static bool pack_vcols(String *buf, List &create_fields, + List *check_constraint_list) { - (*buff)[0]= (uchar) type; - int2store((*buff)+1, offset); - /* - expr_str.length < 64K as we have checked that the total size of the - frm file is < 64K - */ - int2store((*buff)+3, vcol->expr_str.length); - (*buff)[5]= vcol->name.length; - (*buff)+= FRM_VCOL_NEW_HEADER_SIZE; - memcpy((*buff), vcol->name.str, vcol->name.length); - (*buff)+= vcol->name.length; - memcpy((*buff), vcol->expr_str.str, vcol->expr_str.length); - (*buff)+= vcol->expr_str.length; + List_iterator it(create_fields); + Create_field *field; + + for (uint field_nr=0; (field= it++); field_nr++) + { + if (field->vcol_info) + if (pack_expression(buf, field->vcol_info, field_nr, + field->vcol_info->stored_in_db + ? VCOL_GENERATED_STORED : VCOL_GENERATED_VIRTUAL)) + return 1; + if (field->has_default_expression() && !field->has_default_now_unireg_check()) + if (pack_expression(buf, field->default_value, field_nr, VCOL_DEFAULT)) + return 1; + if (field->check_constraint) + if (pack_expression(buf, field->check_constraint, field_nr, + VCOL_CHECK_FIELD)) + return 1; + } + + List_iterator cit(*check_constraint_list); + Virtual_column_info *check; + while ((check= cit++)) + if (pack_expression(buf, check, UINT_MAX32, VCOL_CHECK_TABLE)) + return 1; + return 0; } @@ -594,10 +591,10 @@ static bool pack_header(THD *thd, uchar *forminfo, HA_CREATE_INFO *create_info, ulong data_offset, handler *file) { - uint length,int_count,int_length,no_empty, int_parts; + uint int_count,int_length, int_parts; uint time_stamp_pos,null_fields; uint table_options= create_info->table_options; - size_t reclength, totlength, n_length, com_length, expression_length; + size_t length, reclength, totlength, n_length, com_length; DBUG_ENTER("pack_header"); if (create_fields.elements > MAX_FIELDS) @@ -608,21 +605,11 @@ static bool pack_header(THD *thd, uchar *forminfo, totlength= 0L; reclength= data_offset; - no_empty=int_count=int_parts=int_length=time_stamp_pos=null_fields=0; + int_count=int_parts=int_length=time_stamp_pos=null_fields=0; com_length= 0; n_length=2L; create_info->field_check_constraints= 0; - if (create_info->check_constraint_list->elements) - { - expression_length= packed_constraints_length(thd, create_info, - create_info->check_constraint_list); - if (!expression_length) - DBUG_RETURN(1); // Wrong characterset - } - else - expression_length= 0; - /* Check fields */ List_iterator it(create_fields); Create_field *field; @@ -632,23 +619,8 @@ static bool pack_header(THD *thd, uchar *forminfo, ER_TOO_LONG_FIELD_COMMENT, field->field_name)) DBUG_RETURN(1); - if (add_expr_length(thd, &field->vcol_info, &expression_length)) - DBUG_RETURN(1); - if (field->default_value && field->default_value->expr_str.length) - if (add_expr_length(thd, &field->default_value, &expression_length)) - DBUG_RETURN(1); - if (add_expr_length(thd, &field->check_constraint, &expression_length)) - DBUG_RETURN(1); - totlength+= field->length; com_length+= field->comment.length; - if (MTYP_TYPENR(field->unireg_check) == Field::NOEMPTY || - field->unireg_check & MTYP_NOEMPTY_BIT) - { - field->unireg_check= (Field::utype) ((uint) field->unireg_check | - MTYP_NOEMPTY_BIT); - no_empty++; - } /* We mark first TIMESTAMP field with NOW() in DEFAULT or ON UPDATE as auto-update field. @@ -723,31 +695,22 @@ static bool pack_header(THD *thd, uchar *forminfo, DBUG_RETURN(1); } - if (expression_length) - { - expression_length+= FRM_VCOL_NEW_BASE_SIZE; - create_info->expression_length= expression_length; - } - /* Hack to avoid bugs with small static rows in MySQL */ - reclength=MY_MAX(file->min_record_length(table_options),reclength); - if ((ulong) create_fields.elements*FCOMP+FRM_FORMINFO_SIZE+ - n_length+int_length+com_length+expression_length > 65535L || - int_count > 255) + reclength= MY_MAX(file->min_record_length(table_options), reclength); + length= n_length + create_fields.elements*FCOMP + FRM_FORMINFO_SIZE + + int_length + com_length + create_info->expression_length; + if (length > 65535L || int_count > 255) { my_message(ER_TOO_MANY_FIELDS, "Table definition is too large", MYF(0)); DBUG_RETURN(1); } bzero((char*)forminfo,FRM_FORMINFO_SIZE); - length=(create_fields.elements*FCOMP+FRM_FORMINFO_SIZE+n_length+int_length+ - com_length+expression_length); int2store(forminfo,length); - forminfo[256] = 0; int2store(forminfo+258,create_fields.elements); - int2store(forminfo+260,0); // Screen length, not used anymore + // bytes 260-261 are unused int2store(forminfo+262,totlength); - int2store(forminfo+264,no_empty); + // bytes 264-265 are unused int2store(forminfo+266,reclength); int2store(forminfo+268,n_length); int2store(forminfo+270,int_count); @@ -758,7 +721,7 @@ static bool pack_header(THD *thd, uchar *forminfo, int2store(forminfo+280,22); /* Rows needed */ int2store(forminfo+282,null_fields); int2store(forminfo+284,com_length); - int2store(forminfo+286,expression_length); + int2store(forminfo+286,create_info->expression_length); DBUG_RETURN(0); } /* pack_header */ @@ -820,29 +783,6 @@ static size_t packed_fields_length(List &create_fields) DBUG_RETURN(length); } - -static size_t packed_constraints_length(THD *thd, HA_CREATE_INFO *info, - List *constr) -{ - List_iterator it(*constr); - size_t length= 0; - Virtual_column_info *check; - - while ((check= it++)) - if (add_expr_length(thd, it.ref(), &length)) - return 0; - return length; -} - -static void pack_constraints(uchar **buff, List *constr) -{ - List_iterator it(*constr); - Virtual_column_info *check; - while ((check= it++)) - pack_expression(buff, check, UINT_MAX32, 4); -} - - /* Save fields, fieldnames and intervals */ static bool pack_fields(uchar **buff_arg, List &create_fields, @@ -865,7 +805,6 @@ static bool pack_fields(uchar **buff_arg, List &create_fields, recpos= field->offset+1 + (uint) data_offset; int3store(buff+5,recpos); int2store(buff+8,field->pack_flag); - DBUG_ASSERT(field->unireg_check < 256); buff[10]= (uchar) field->unireg_check; buff[12]= (uchar) field->interval_id; buff[13]= (uchar) field->sql_type; @@ -969,27 +908,6 @@ static bool pack_fields(uchar **buff_arg, List &create_fields, buff+= field->comment.length; } } - - if (create_info->expression_length) - { - /* Store header for packed fields (extra space for future) */ - bzero(buff, FRM_VCOL_NEW_BASE_SIZE); - buff+= FRM_VCOL_NEW_BASE_SIZE; - - /* Store expressions */ - it.rewind(); - for (uint field_nr=0 ; (field= it++) ; field_nr++) - { - if (field->vcol_info) - pack_expression(&buff, field->vcol_info, field_nr, - field->vcol_info->stored_in_db ? 1 : 0); - if (field->default_value && field->default_value->expr_str.length) - pack_expression(&buff, field->default_value, field_nr, 2); - if (field->check_constraint) - pack_expression(&buff, field->check_constraint, field_nr, 3); - } - pack_constraints(&buff, create_info->check_constraint_list); - } *buff_arg= buff; DBUG_RETURN(0); } @@ -1001,7 +919,6 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options, uint reclength, ulong data_offset) { int error= 0; - Field::utype type; uint null_count; uchar *null_pos; TABLE table; @@ -1039,12 +956,9 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options, field->sql_type, field->charset, field->geom_type, field->srid, - field->unireg_check == Field::TIMESTAMP_DNUN_FIELD - ? Field::TIMESTAMP_UN_FIELD - : field->unireg_check == Field::TIMESTAMP_DN_FIELD - ? Field::NONE : field->unireg_check, - field->save_interval ? field->save_interval : - field->interval, + field->unireg_check, + field->save_interval ? field->save_interval + : field->interval, field->field_name); if (!regfield) { @@ -1064,11 +978,14 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options, if (field->sql_type == MYSQL_TYPE_BIT && !f_bit_as_char(field->pack_flag)) null_count+= field->length & 7; - type= (Field::utype) MTYP_TYPENR(field->unireg_check); - - if (field->default_value && !field->has_default_expression()) + if (field->default_value && !field->default_value->flags && + !(field->flags & BLOB_FLAG)) { - int res= field->default_value->expr_item->save_in_field(regfield, 1); + Item *expr= field->default_value->expr; + int res= !expr->fixed && // may be already fixed if ALTER TABLE + expr->fix_fields(thd, &expr); + if (!res) + res= expr->save_in_field(regfield, 1); /* If not ok or warning of level 'note' */ if (res != 0 && res != 3) { @@ -1084,12 +1001,6 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options, regfield->set_notnull(); regfield->store((longlong) 1, TRUE); } - else if (type == Field::YES) // Old unireg type - regfield->store(ER_THD(thd, ER_YES),(uint) strlen(ER_THD(thd, ER_YES)), - system_charset_info); - else if (type == Field::NO) // Old unireg type - regfield->store(ER_THD(thd, ER_NO), (uint) strlen(ER_THD(thd, ER_NO)), - system_charset_info); else regfield->reset(); } diff --git a/sql/unireg.h b/sql/unireg.h index 8e74519862e..b1cab841092 100644 --- a/sql/unireg.h +++ b/sql/unireg.h @@ -83,68 +83,53 @@ /* Defines for use with openfrm, openprt and openfrd */ -#define READ_ALL 1 /* openfrm: Read all parameters */ -#define CHANGE_FRM 2 /* openfrm: open .frm as O_RDWR */ -#define READ_KEYINFO 4 /* L{s nyckeldata fr}n filen */ -#define EXTRA_RECORD 8 /* Reserve space for an extra record */ -#define DONT_OPEN_TABLES 8 /* Don't open database-files (frd) */ -#define DONT_OPEN_MASTER_REG 16 /* Don't open first reg-file (prt) */ -#define EXTRA_LONG_RECORD 16 /* Plats f|r dubbel s|k-record */ -#define COMPUTE_TYPES 32 /* Kontrollera type f|r f{ltena */ -#define SEARCH_PRG 64 /* S|k efter registret i 'prg_dev' */ -#define READ_USED_NAMES 128 /* L{s anv{nda formul{rnamn */ -#define DONT_GIVE_ERROR 256 /* Don't do frm_error on openfrm */ -#define READ_SCREENS 1024 /* Read screens, info and helpfile */ -#define DELAYED_OPEN 4096 /* Open table later */ -#define OPEN_VIEW 8192 /* Allow open on view */ -#define OPEN_VIEW_NO_PARSE 16384 /* Open frm only if it's a view, - but do not parse view itself */ +#define READ_ALL (1 << 0) /* openfrm: Read all parameters */ +#define EXTRA_RECORD (1 << 3) /* Reserve space for an extra record */ +#define DELAYED_OPEN (1 << 12) /* Open table later */ +#define OPEN_VIEW_NO_PARSE (1 << 14) /* Open frm only if it's a view, + but do not parse view itself */ /** This flag is used in function get_all_tables() which fills I_S tables with data which are retrieved from frm files and storage engine The flag means that we need to open FRM file only to get necessary data. */ -#define OPEN_FRM_FILE_ONLY 32768 +#define OPEN_FRM_FILE_ONLY (1 << 15) /** This flag is used in function get_all_tables() which fills I_S tables with data which are retrieved from frm files and storage engine The flag means that we need to process tables only to get necessary data. Views are not processed. */ -#define OPEN_TABLE_ONLY (OPEN_FRM_FILE_ONLY*2) +#define OPEN_TABLE_ONLY (1 << 16) /** This flag is used in function get_all_tables() which fills I_S tables with data which are retrieved from frm files and storage engine The flag means that we need to process views only to get necessary data. Tables are not processed. */ -#define OPEN_VIEW_ONLY (OPEN_TABLE_ONLY*2) +#define OPEN_VIEW_ONLY (1 << 17) /** This flag is used in function get_all_tables() which fills I_S tables with data which are retrieved from frm files and storage engine. The flag means that we need to open a view using open_normal_and_derived_tables() function. */ -#define OPEN_VIEW_FULL (OPEN_VIEW_ONLY*2) +#define OPEN_VIEW_FULL (1 << 18) /** This flag is used in function get_all_tables() which fills I_S tables with data which are retrieved from frm files and storage engine. The flag means that I_S table uses optimization algorithm. */ -#define OPTIMIZE_I_S_TABLE (OPEN_VIEW_FULL*2) +#define OPTIMIZE_I_S_TABLE (1 << 19) /** This flag is used to instruct tdc_open_view() to check metadata version. */ -#define CHECK_METADATA_VERSION (OPEN_TRIGGER_ONLY*2) +#define CHECK_METADATA_VERSION (1 << 20) /* The flag means that we need to process trigger files only. */ -#define OPEN_TRIGGER_ONLY (OPTIMIZE_I_S_TABLE*2) - -#define SC_INFO_LENGTH 4 /* Form format constant */ -#define TE_INFO_LENGTH 3 -#define MTYP_NOEMPTY_BIT 128 +#define OPEN_TRIGGER_ONLY (1 << 21) /* Minimum length pattern before Turbo Boyer-Moore is used diff --git a/sql/wsrep_applier.cc b/sql/wsrep_applier.cc index 059aabe7b46..cef59513485 100644 --- a/sql/wsrep_applier.cc +++ b/sql/wsrep_applier.cc @@ -72,6 +72,9 @@ Format_description_log_event* wsrep_get_apply_format(THD* thd) { return (Format_description_log_event*) thd->wsrep_apply_format; } + + DBUG_ASSERT(thd->wsrep_rgi); + return thd->wsrep_rgi->rli->relay_log.description_event_for_exec; } @@ -361,8 +364,10 @@ wsrep_cb_status_t wsrep_commit_cb(void* const ctx, else rcode = wsrep_rollback(thd); + /* Cleanup */ wsrep_set_apply_format(thd, NULL); thd->mdl_context.release_transactional_locks(); + thd->reset_query(); /* Mutex protected */ free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC)); thd->tx_isolation= (enum_tx_isolation) thd->variables.tx_isolation; diff --git a/sql/wsrep_binlog.cc b/sql/wsrep_binlog.cc index 7884df586a1..08b7e3f1e3d 100644 --- a/sql/wsrep_binlog.cc +++ b/sql/wsrep_binlog.cc @@ -442,11 +442,13 @@ void thd_binlog_flush_pending_rows_event(THD *thd, bool stmt_end) void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf, size_t buf_len) { + DBUG_ENTER("wsrep_dump_rbr_buf_with_header"); + char filename[PATH_MAX]= {0}; File file; IO_CACHE cache; Log_event_writer writer(&cache); - Format_description_log_event *ev= wsrep_get_apply_format(thd); + Format_description_log_event *ev; int len= my_snprintf(filename, PATH_MAX, "%s/GRA_%lld_%lld_v2.log", wsrep_data_home_dir, (longlong) thd->thread_id, @@ -455,7 +457,7 @@ void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf, if (len >= PATH_MAX) { WSREP_ERROR("RBR dump path too long: %d, skipping dump.", len); - return; + DBUG_VOID_RETURN; } if ((file= mysql_file_open(key_file_wsrep_gra_log, filename, @@ -477,6 +479,13 @@ void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf, goto cleanup2; } + /* + Instantiate an FDLE object for non-wsrep threads (to be written + to the dump file). + */ + ev= (thd->wsrep_applier) ? wsrep_get_apply_format(thd) : + (new Format_description_log_event(4)); + if (writer.write(ev) || my_b_write(&cache, (uchar*)rbr_buf, buf_len) || flush_io_cache(&cache)) { @@ -489,5 +498,9 @@ cleanup2: cleanup1: mysql_file_close(file, MYF(MY_WME)); + + if (!thd->wsrep_applier) delete ev; + + DBUG_VOID_RETURN; } diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index b8fae8dbd86..b0275fc2fd5 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -36,6 +36,7 @@ #include #include "log_event.h" #include +#include "sql_plugin.h" /* wsrep_plugins_pre_init() */ wsrep_t *wsrep = NULL; /* @@ -792,7 +793,6 @@ void wsrep_thr_init() DBUG_VOID_RETURN; } - void wsrep_init_startup (bool first) { if (wsrep_init()) unireg_abort(1); @@ -803,6 +803,17 @@ void wsrep_init_startup (bool first) wsrep_debug, wsrep_convert_LOCK_to_trx, (wsrep_on_fun)wsrep_on); + /* + Pre-initialize global_system_variables.table_plugin with a dummy engine + (placeholder) required during the initialization of wsrep threads (THDs). + (see: plugin_thdvar_init()) + Note: This only needs to be done for rsync & xtrabackup based SST methods. + In case of mysqldump SST method, the wsrep threads are created after the + server plugins & global system variables are initialized. + */ + if (wsrep_before_SE()) + wsrep_plugins_pre_init(); + /* Skip replication start if dummy wsrep provider is loaded */ if (!strcmp(wsrep_provider, WSREP_NONE)) return; @@ -972,6 +983,8 @@ bool wsrep_must_sync_wait (THD* thd, uint mask) { return (thd->variables.wsrep_sync_wait & mask) && thd->variables.wsrep_on && + !(thd->variables.wsrep_dirty_reads && + !is_update_query(thd->lex->sql_command)) && !thd->in_active_multi_stmt_transaction() && thd->wsrep_conflict_state != REPLAYING && thd->wsrep_sync_wait_gtid.seqno == WSREP_SEQNO_UNDEFINED; @@ -1237,9 +1250,11 @@ int wsrep_to_buf_helper( 65536, MYF(MY_WME))) return 1; int ret(0); + enum enum_binlog_checksum_alg current_binlog_check_alg= + (enum_binlog_checksum_alg) binlog_checksum_options; Format_description_log_event *tmp_fd= new Format_description_log_event(4); - tmp_fd->checksum_alg= (enum_binlog_checksum_alg)binlog_checksum_options; + tmp_fd->checksum_alg= current_binlog_check_alg; writer.write(tmp_fd); delete tmp_fd; @@ -1258,11 +1273,13 @@ int wsrep_to_buf_helper( Query_log_event ev(thd, thd->wsrep_TOI_pre_query, thd->wsrep_TOI_pre_query_len, FALSE, FALSE, FALSE, 0); + ev.checksum_alg= current_binlog_check_alg; if (writer.write(&ev)) ret= 1; } /* continue to append the actual query */ Query_log_event ev(thd, query, query_len, FALSE, FALSE, FALSE, 0); + ev.checksum_alg= current_binlog_check_alg; if (!ret && writer.write(&ev)) ret= 1; if (!ret && wsrep_write_cache_buf(&tmp_io_cache, buf, buf_len)) ret= 1; close_cached_file(&tmp_io_cache); @@ -1764,11 +1781,11 @@ bool wsrep_grant_mdl_exception(MDL_context *requestor_ctx, /* Print some debug information. */ if (wsrep_debug) { - if ((request_thd->lex->sql_command == SQLCOM_DROP_TABLE)) + if (request_thd->lex->sql_command == SQLCOM_DROP_TABLE) { WSREP_DEBUG("DROP caused BF abort"); } - else if ((granted_thd->wsrep_query_state == QUERY_COMMITTING)) + else if (granted_thd->wsrep_query_state == QUERY_COMMITTING) { WSREP_DEBUG("MDL granted, but committing thd abort scheduled"); } diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index 50f54fddc95..03cd8674242 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -184,8 +184,6 @@ bool wsrep_sst_donor_update (sys_var *self, THD* thd, enum_var_type type) return 0; } -static wsrep_uuid_t cluster_uuid = WSREP_UUID_UNDEFINED; - bool wsrep_before_SE() { return (wsrep_provider != NULL @@ -527,13 +525,11 @@ static void* sst_joiner_thread (void* a) } else { // Scan state ID first followed by wsrep_gtid_domain_id. - char uuid[512]; unsigned long int domain_id; - size_t len= pos - out + 1; - if (len > sizeof(uuid)) goto err; // safety check - memcpy(uuid, out, len); // including '\0' - err= sst_scan_uuid_seqno (uuid, &ret_uuid, &ret_seqno); + // Null-terminate the state-id. + out[pos - out]= 0; + err= sst_scan_uuid_seqno (out, &ret_uuid, &ret_seqno); if (err) { diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc index a810a5a44ae..03e53dd3e97 100644 --- a/sql/wsrep_thd.cc +++ b/sql/wsrep_thd.cc @@ -97,7 +97,6 @@ static rpl_group_info* wsrep_relay_group_init(const char* log_fname) { Relay_log_info* rli= new Relay_log_info(false); - rli->no_storage= true; if (!rli->relay_log.description_event_for_exec) { rli->relay_log.description_event_for_exec= @@ -266,7 +265,8 @@ void wsrep_replay_transaction(THD *thd) } else if (thd->get_stmt_da()->is_set()) { - if (thd->get_stmt_da()->status() != Diagnostics_area::DA_OK) + if (thd->get_stmt_da()->status() != Diagnostics_area::DA_OK && + thd->get_stmt_da()->status() != Diagnostics_area::DA_OK_BULK) { WSREP_WARN("replay ok, thd has error status %d", thd->get_stmt_da()->status()); diff --git a/sql/wsrep_utils.cc b/sql/wsrep_utils.cc index e7d60652355..9a9c2f84ac6 100644 --- a/sql/wsrep_utils.cc +++ b/sql/wsrep_utils.cc @@ -264,7 +264,6 @@ process::process (const char* cmd, const char* type, char** env) err_ = posix_spawnattr_setflags (&attr, POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK | - /* start a new process group */ POSIX_SPAWN_SETPGROUP | POSIX_SPAWN_USEVFORK); if (err_) { diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index bb5ee7baa57..e6d4bbbc303 100644 --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@ -670,7 +670,7 @@ int wsrep_show_status (THD *thd, SHOW_VAR *var, char *buff, v->name = thd->strdup(sv->name); switch (sv->type) { case WSREP_VAR_INT64: - v->value = (char*)thd->memdup(&sv->value._int64, sizeof(longlong)); + v->value = (char*)thd->memdup(&sv->value._integer64, sizeof(longlong)); v->type = SHOW_LONGLONG; break; case WSREP_VAR_STRING: diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index c322c8eee54..9d6d100c1b8 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -383,8 +383,7 @@ unsigned int ha_archive::pack_row_v1(uchar *record) uint32 length= ((Field_blob *) table->field[*blob])->get_length(); if (length) { - uchar *data_ptr; - ((Field_blob *) table->field[*blob])->get_ptr(&data_ptr); + uchar *data_ptr= ((Field_blob *) table->field[*blob])->get_ptr(); memcpy(pos, data_ptr, length); pos+= length; } diff --git a/storage/cassandra/CMakeLists.txt b/storage/cassandra/CMakeLists.txt index df097c90a47..a5d58234d97 100644 --- a/storage/cassandra/CMakeLists.txt +++ b/storage/cassandra/CMakeLists.txt @@ -50,7 +50,6 @@ SET(cassandra_sources LINK_DIRECTORIES(${LINK_DIR}) IF(CASSANDRASE_OK) - SET(CASSANDRA_DEB_FILES "usr/lib/mysql/plugin/ha_cassandra.so" PARENT_SCOPE) MYSQL_ADD_PLUGIN(cassandra ${cassandra_sources} STORAGE_ENGINE MODULE_ONLY LINK_LIBRARIES thrift COMPONENT cassandra-engine) ENDIF(CASSANDRASE_OK) diff --git a/storage/connect/JdbcInterface.java b/storage/connect/JdbcInterface.java index f765052915d..34af8c4e013 100644 --- a/storage/connect/JdbcInterface.java +++ b/storage/connect/JdbcInterface.java @@ -340,6 +340,18 @@ public class JdbcInterface { return m; } // end of GetMaxValue + public String GetQuoteString() { + String qs = null; + + try { + qs = dbmd.getIdentifierQuoteString(); + } catch(SQLException se) { + SetErrmsg(se); + } // end try/catch + + return qs; + } // end of GetQuoteString + public int GetColumns(String[] parms) { int ncol = -1; @@ -680,11 +692,11 @@ public class JdbcInterface { return 0; } // end of TimestampField - public String ObjectField(int n, String name) { + public Object ObjectField(int n, String name) { if (rs == null) { System.out.println("No result set"); } else try { - return (n > 0) ? rs.getObject(n).toString() : rs.getObject(name).toString(); + return (n > 0) ? rs.getObject(n) : rs.getObject(name); } catch (SQLException se) { SetErrmsg(se); } //end try/catch diff --git a/storage/connect/filamdbf.cpp b/storage/connect/filamdbf.cpp index 327bcf376df..5e3dfd8fe60 100644 --- a/storage/connect/filamdbf.cpp +++ b/storage/connect/filamdbf.cpp @@ -383,7 +383,7 @@ DBFBASE::DBFBASE(DBFBASE *txfp) /* and header length. Set Records, check that Reclen is equal to lrecl and */ /* return the header length or 0 in case of error. */ /****************************************************************************/ -int DBFBASE::ScanHeader(PGLOBAL g, PSZ fname, int lrecl, char *defpath) +int DBFBASE::ScanHeader(PGLOBAL g, PSZ fn, int lrecl, int *rln, char *defpath) { int rc; char filename[_MAX_PATH]; @@ -393,7 +393,7 @@ int DBFBASE::ScanHeader(PGLOBAL g, PSZ fname, int lrecl, char *defpath) /************************************************************************/ /* Open the input file. */ /************************************************************************/ - PlugSetPath(filename, fname, defpath); + PlugSetPath(filename, fn, defpath); if (!(infile= global_fopen(g, MSGID_CANNOT_OPEN, filename, "rb"))) return 0; // Assume file does not exist @@ -410,11 +410,7 @@ int DBFBASE::ScanHeader(PGLOBAL g, PSZ fname, int lrecl, char *defpath) } else if (rc == RC_FX) return -1; - if ((int)header.Reclen() != lrecl) { - sprintf(g->Message, MSG(BAD_LRECL), lrecl, header.Reclen()); - return -1; - } // endif Lrecl - + *rln = (int)header.Reclen(); Records = (int)header.Records(); return (int)header.Headlen(); } // end of ScanHeader @@ -431,9 +427,27 @@ int DBFFAM::Cardinality(PGLOBAL g) if (!g) return 1; - if (!Headlen) - if ((Headlen = ScanHeader(g, To_File, Lrecl, Tdbp->GetPath())) < 0) - return -1; // Error in ScanHeader + if (!Headlen) { + int rln = 0; // Record length in the file header + + Headlen = ScanHeader(g, To_File, Lrecl, &rln, Tdbp->GetPath()); + + if (Headlen < 0) + return -1; // Error in ScanHeader + + if (rln && Lrecl != rln) { + // This happens always on some Linux platforms + sprintf(g->Message, MSG(BAD_LRECL), Lrecl, rln); + + if (Accept) { + Lrecl = rln; + PushWarning(g, Tdbp); + } else + return -1; + + } // endif rln + + } // endif Headlen // Set number of blocks for later use Block = (Records > 0) ? (Records + Nrec - 1) / Nrec : 0; @@ -565,7 +579,13 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g) if (Lrecl != reclen) { sprintf(g->Message, MSG(BAD_LRECL), Lrecl, reclen); - return true; + + if (Accept) { + Lrecl = reclen; + PushWarning(g, Tdbp); + } else + return true; + } // endif Lrecl hlen = HEADLEN * (n + 1) + 2; @@ -641,8 +661,14 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g) if ((rc = dbfhead(g, Stream, Tdbp->GetFile(g), &header)) == RC_OK) { if (Lrecl != (int)header.Reclen()) { sprintf(g->Message, MSG(BAD_LRECL), Lrecl, header.Reclen()); - return true; - } // endif Lrecl + + if (Accept) { + Lrecl = header.Reclen(); + PushWarning(g, Tdbp); + } else + return true; + + } // endif Lrecl Records = (int)header.Records(); Headlen = (int)header.Headlen(); @@ -916,9 +942,27 @@ int DBMFAM::Cardinality(PGLOBAL g) if (!g) return 1; - if (!Headlen) - if ((Headlen = ScanHeader(g, To_File, Lrecl, Tdbp->GetPath())) < 0) - return -1; // Error in ScanHeader + if (!Headlen) { + int rln = 0; // Record length in the file header + + Headlen = ScanHeader(g, To_File, Lrecl, &rln, Tdbp->GetPath()); + + if (Headlen < 0) + return -1; // Error in ScanHeader + + if (rln && Lrecl != rln) { + // This happens always on some Linux platforms + sprintf(g->Message, MSG(BAD_LRECL), Lrecl, rln); + + if (Accept) { + Lrecl = rln; + PushWarning(g, Tdbp); + } else + return -1; + + } // endif rln + + } // endif Headlen // Set number of blocks for later use Block = (Records > 0) ? (Records + Nrec - 1) / Nrec : 0; @@ -961,8 +1005,14 @@ bool DBMFAM::AllocateBuffer(PGLOBAL g) if (Lrecl != (int)hp->Reclen()) { sprintf(g->Message, MSG(BAD_LRECL), Lrecl, hp->Reclen()); - return true; - } // endif Lrecl + + if (Accept) { + Lrecl = hp->Reclen(); + PushWarning(g, Tdbp); + } else + return true; + + } // endif Lrecl Records = (int)hp->Records(); Headlen = (int)hp->Headlen(); diff --git a/storage/connect/filamdbf.h b/storage/connect/filamdbf.h index da84d7685a8..66458a10eaa 100644 --- a/storage/connect/filamdbf.h +++ b/storage/connect/filamdbf.h @@ -31,7 +31,7 @@ class DllExport DBFBASE { DBFBASE(PDBF txfp); // Implementation - int ScanHeader(PGLOBAL g, PSZ fname, int lrecl, char *defpath); + int ScanHeader(PGLOBAL g, PSZ fname, int lrecl, int *rlen, char *defpath); protected: // Default constructor, not to be used diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 5fe75fd0f59..419a33ed74e 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -224,6 +224,7 @@ uint GetWorkSize(void); void SetWorkSize(uint); extern "C" const char *msglang(void); +static void PopUser(PCONNECT xp); static PCONNECT GetUser(THD *thd, PCONNECT xp); static PGLOBAL GetPlug(THD *thd, PCONNECT& lxp); @@ -831,42 +832,51 @@ ha_connect::~ha_connect(void) table ? table->s->table_name.str : "", xp, xp ? xp->count : 0); - if (xp) { - PCONNECT p; - - xp->count--; - - for (p= user_connect::to_users; p; p= p->next) - if (p == xp) - break; - - if (p && !p->count) { - if (p->next) - p->next->previous= p->previous; - - if (p->previous) - p->previous->next= p->next; - else - user_connect::to_users= p->next; - - } // endif p - - if (!xp->count) { - PlugCleanup(xp->g, true); - delete xp; - } // endif count - - } // endif xp - + PopUser(xp); } // end of ha_connect destructor +/****************************************************************************/ +/* Check whether this user can be removed. */ +/****************************************************************************/ +static void PopUser(PCONNECT xp) +{ + if (xp) { + xp->count--; + + if (!xp->count) { + PCONNECT p; + + for (p= user_connect::to_users; p; p= p->next) + if (p == xp) + break; + + if (p) { + if (p->next) + p->next->previous= p->previous; + + if (p->previous) + p->previous->next= p->next; + else + user_connect::to_users= p->next; + + } // endif p + + PlugCleanup(xp->g, true); + delete xp; + } // endif count + + } // endif xp + +} // end of PopUser + + /****************************************************************************/ /* Get a pointer to the user of this handler. */ /****************************************************************************/ static PCONNECT GetUser(THD *thd, PCONNECT xp) { - if (!thd) + if (!thd) return NULL; if (xp && thd == xp->thdp) @@ -890,7 +900,6 @@ static PCONNECT GetUser(THD *thd, PCONNECT xp) return xp; } // end of GetUser - /****************************************************************************/ /* Get the global pointer of the user of this handler. */ /****************************************************************************/ @@ -1190,7 +1199,7 @@ char *ha_connect::GetRealString(const char *s) { char *sv; - if (IsPartitioned() && s && partname && *partname) { + if (IsPartitioned() && s && *partname) { sv= (char*)PlugSubAlloc(xp->g, NULL, 0); sprintf(sv, s, partname); PlugSubAlloc(xp->g, NULL, strlen(sv) + 1); @@ -2868,7 +2877,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond) strncat(body, res->ptr(), res->length()); if (res->length() < 19) - strcat(body, "1970-01-01 00:00:00" + res->length()); + strcat(body, &"1970-01-01 00:00:00"[res->length()]); strcat(body, "'}"); break; @@ -2897,7 +2906,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond) strncat(body, res->ptr(), res->length()); if (res->length() < 19) - strcat(body, "1970-01-01 00:00:00" + res->length()); + strcat(body, &"1970-01-01 00:00:00"[res->length()]); strcat(body, "'}"); break; @@ -5260,7 +5269,18 @@ static int connect_assisted_discovery(handlerton *, THD* thd, if (!(shm= (char*)db)) db= table_s->db.str; // Default value - // Check table type + // Save stack and allocation environment and prepare error return + if (g->jump_level == MAX_JUMP) { + strcpy(g->Message, MSG(TOO_MANY_JUMPS)); + goto jer; + } // endif jump_level + + if ((rc= setjmp(g->jumper[++g->jump_level])) != 0) { + my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); + goto err; + } // endif rc + + // Check table type if (ttp == TAB_UNDEF) { topt->type= (src) ? "MYSQL" : (tab) ? "PROXY" : "DOS"; ttp= GetTypeID(topt->type); @@ -5269,20 +5289,9 @@ static int connect_assisted_discovery(handlerton *, THD* thd, } else if (ttp == TAB_NIY) { sprintf(g->Message, "Unsupported table type %s", topt->type); my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); - return HA_ERR_INTERNAL_ERROR; + goto err; } // endif ttp - // Save stack and allocation environment and prepare error return - if (g->jump_level == MAX_JUMP) { - strcpy(g->Message, MSG(TOO_MANY_JUMPS)); - return HA_ERR_INTERNAL_ERROR; - } // endif jump_level - - if ((rc= setjmp(g->jumper[++g->jump_level])) != 0) { - my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); - goto err; - } // endif rc - if (!tab) { if (ttp == TAB_TBL) { // Make tab the first table of the list @@ -5842,6 +5851,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, rc= init_table_share(thd, table_s, create_info, &sql); g->jump_level--; + PopUser(xp); return rc; } // endif ok @@ -5849,7 +5859,9 @@ static int connect_assisted_discovery(handlerton *, THD* thd, err: g->jump_level--; - return HA_ERR_INTERNAL_ERROR; + jer: + PopUser(xp); + return HA_ERR_INTERNAL_ERROR; } // end of connect_assisted_discovery /** diff --git a/storage/connect/inihandl.c b/storage/connect/inihandl.c index 46102557b20..896431b855f 100644 --- a/storage/connect/inihandl.c +++ b/storage/connect/inihandl.c @@ -193,7 +193,7 @@ static void PROFILE_Save( FILE *file, PROFILESECTION *section ) } for (key = section->key; key; key = key->next) - if (key->name && key->name[0]) { + if (key->name[0]) { fprintf(file, "%s", SVP(key->name)); if (key->value) diff --git a/storage/connect/jdbconn.cpp b/storage/connect/jdbconn.cpp index 3b8de3e975b..dca9bd0eac4 100644 --- a/storage/connect/jdbconn.cpp +++ b/storage/connect/jdbconn.cpp @@ -498,145 +498,6 @@ PQRYRES JDBCDrivers(PGLOBAL g, int maxres, bool info) return qrp; } // end of JDBCDrivers -#if 0 -/*************************************************************************/ -/* JDBCDataSources: constructs the result blocks containing all JDBC */ -/* data sources available on the local host. */ -/* Called with info=true to have result column names. */ -/*************************************************************************/ -PQRYRES JDBCDataSources(PGLOBAL g, int maxres, bool info) -{ - int buftyp[] ={ TYPE_STRING, TYPE_STRING }; - XFLD fldtyp[] ={ FLD_NAME, FLD_REM }; - unsigned int length[] ={ 0, 256 }; - bool b[] ={ false, true }; - int i, n = 0, ncol = 2; - PCOLRES crp; - PQRYRES qrp; - JDBConn *jcp = NULL; - - /************************************************************************/ - /* Do an evaluation of the result size. */ - /************************************************************************/ - if (!info) { - jcp = new(g)JDBConn(g, NULL); - n = jcp->GetMaxValue(SQL_MAX_DSN_LENGTH); - length[0] = (n) ? (n + 1) : 256; - - if (!maxres) - maxres = 512; // Estimated max number of data sources - - } else { - length[0] = 256; - maxres = 0; - } // endif info - - if (trace) - htrc("JDBCDataSources: max=%d len=%d\n", maxres, length[0]); - - /************************************************************************/ - /* Allocate the structures used to refer to the result set. */ - /************************************************************************/ - qrp = PlgAllocResult(g, ncol, maxres, IDS_DSRC, - buftyp, fldtyp, length, false, true); - - for (i = 0, crp = qrp->Colresp; crp; i++, crp = crp->Next) - if (b[i]) - crp->Kdata->SetNullable(true); - - /************************************************************************/ - /* Now get the results into blocks. */ - /************************************************************************/ - if (!info && qrp && jcp->GetDataSources(qrp)) - qrp = NULL; - - /************************************************************************/ - /* Return the result pointer for use by GetData routines. */ - /************************************************************************/ - return qrp; -} // end of JDBCDataSources - -/**************************************************************************/ -/* PrimaryKeys: constructs the result blocks containing all the */ -/* JDBC catalog information concerning primary keys. */ -/**************************************************************************/ -PQRYRES JDBCPrimaryKeys(PGLOBAL g, JDBConn *op, char *dsn, char *table) -{ - static int buftyp[] ={ TYPE_STRING, TYPE_STRING, TYPE_STRING, - TYPE_STRING, TYPE_SHORT, TYPE_STRING }; - static unsigned int length[] ={ 0, 0, 0, 0, 6, 128 }; - int n, ncol = 5; - int maxres; - PQRYRES qrp; - JCATPARM *cap; - JDBConn *jcp = op; - - if (!op) { - /**********************************************************************/ - /* Open the connection with the JDBC data source. */ - /**********************************************************************/ - jcp = new(g)JDBConn(g, NULL); - - if (jcp->Open(dsn, 2) < 1) // 2 is openReadOnly - return NULL; - - } // endif op - - /************************************************************************/ - /* Do an evaluation of the result size. */ - /************************************************************************/ - n = jcp->GetMaxValue(SQL_MAX_COLUMNS_IN_TABLE); - maxres = (n) ? (int)n : 250; - n = jcp->GetMaxValue(SQL_MAX_CATALOG_NAME_LEN); - length[0] = (n) ? (n + 1) : 128; - n = jcp->GetMaxValue(SQL_MAX_SCHEMA_NAME_LEN); - length[1] = (n) ? (n + 1) : 128; - n = jcp->GetMaxValue(SQL_MAX_TABLE_NAME_LEN); - length[2] = (n) ? (n + 1) : 128; - n = jcp->GetMaxValue(SQL_MAX_COLUMN_NAME_LEN); - length[3] = (n) ? (n + 1) : 128; - - if (trace) - htrc("JDBCPrimaryKeys: max=%d len=%d,%d,%d\n", - maxres, length[0], length[1], length[2]); - - /************************************************************************/ - /* Allocate the structure used to refer to the result set. */ - /************************************************************************/ - qrp = PlgAllocResult(g, ncol, maxres, IDS_PKEY, - buftyp, NULL, length, false, true); - - if (trace) - htrc("Getting pkey results ncol=%d\n", qrp->Nbcol); - - cap = AllocCatInfo(g, CAT_KEY, NULL, table, qrp); - - /************************************************************************/ - /* Now get the results into blocks. */ - /************************************************************************/ - if ((n = jcp->GetCatInfo(cap)) >= 0) { - qrp->Nblin = n; - // ResetNullValues(cap); - - if (trace) - htrc("PrimaryKeys: NBCOL=%d NBLIN=%d\n", qrp->Nbcol, qrp->Nblin); - - } else - qrp = NULL; - - /************************************************************************/ - /* Close any local connection. */ - /************************************************************************/ - if (!op) - jcp->Close(); - - /************************************************************************/ - /* Return the result pointer for use by GetData routines. */ - /************************************************************************/ - return qrp; -} // end of JDBCPrimaryKeys -#endif // 0 - /***********************************************************************/ /* JDBConn construction/destruction. */ /***********************************************************************/ @@ -651,7 +512,7 @@ JDBConn::JDBConn(PGLOBAL g, TDBJDBC *tdbp) xqid = xuid = xid = grs = readid = fetchid = typid = errid = nullptr; prepid = xpid = pcid = nullptr; chrfldid = intfldid = dblfldid = fltfldid = bigfldid = nullptr; - datfldid = timfldid = tspfldid = nullptr; + objfldid = datfldid = timfldid = tspfldid = nullptr; //m_LoginTimeout = DEFAULT_LOGIN_TIMEOUT; //m_QueryTimeout = DEFAULT_QUERY_TIMEOUT; //m_UpdateOptions = 0; @@ -739,60 +600,6 @@ bool JDBConn::gmID(PGLOBAL g, jmethodID& mid, const char *name, const char *sig } // end of gmID -#if 0 -/***********************************************************************/ -/* Utility routine. */ -/***********************************************************************/ -PSZ JDBConn::GetStringInfo(ushort infotype) -{ - //ASSERT(m_hdbc != SQL_NULL_HDBC); - char *p, buffer[MAX_STRING_INFO]; - SWORD result; - RETCODE rc; - - rc = SQLGetInfo(m_hdbc, infotype, buffer, sizeof(buffer), &result); - - if (!Check(rc)) { - ThrowDJX(rc, "SQLGetInfo"); // Temporary - // *buffer = '\0'; - } // endif rc - - p = PlugDup(m_G, buffer); - return p; -} // end of GetStringInfo - -/***********************************************************************/ -/* Utility routines. */ -/***********************************************************************/ -void JDBConn::OnSetOptions(HSTMT hstmt) -{ - RETCODE rc; - ASSERT(m_hdbc != SQL_NULL_HDBC); - - if ((signed)m_QueryTimeout != -1) { - // Attempt to set query timeout. Ignore failure - rc = SQLSetStmtOption(hstmt, SQL_QUERY_TIMEOUT, m_QueryTimeout); - - if (!Check(rc)) - // don't attempt it again - m_QueryTimeout = (DWORD)-1; - - } // endif m_QueryTimeout - - if (m_RowsetSize > 0) { - // Attempt to set rowset size. - // In case of failure reset it to 0 to use Fetch. - rc = SQLSetStmtOption(hstmt, SQL_ROWSET_SIZE, m_RowsetSize); - - if (!Check(rc)) - // don't attempt it again - m_RowsetSize = 0; - - } // endif m_RowsetSize - -} // end of OnSetOptions -#endif // 0 - /***********************************************************************/ /* Utility routine. */ /***********************************************************************/ @@ -1007,7 +814,7 @@ int JDBConn::Open(PJPARM sop) #define N 1 #endif - // Java source will be compiled as ajar file installed in the plugin dir + // Java source will be compiled as a jar file installed in the plugin dir jpop->Append(sep); jpop->Append(GetPluginDir()); jpop->Append("JdbcInterface.jar"); @@ -1204,6 +1011,21 @@ int JDBConn::Open(PJPARM sop) return RC_FX; } // endif Msg + jmethodID qcid = nullptr; + + if (!gmID(g, qcid, "GetQuoteString", "()Ljava/lang/String;")) { + jstring s = (jstring)env->CallObjectMethod(job, qcid); + + if (s != nullptr) { + char *qch = (char*)env->GetStringUTFChars(s, (jboolean)false); + m_IDQuoteChar[0] = *qch; + } else { + s = (jstring)env->CallObjectMethod(job, errid); + Msg = (char*)env->GetStringUTFChars(s, (jboolean)false); + } // endif s + + } // endif qcid + if (gmID(g, typid, "ColumnType", "(ILjava/lang/String;)I")) return RC_FX; else @@ -1345,9 +1167,10 @@ void JDBConn::Close() /***********************************************************************/ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val) { - PGLOBAL& g = m_G; - jint ctyp; - jstring cn, jn = nullptr; + PGLOBAL& g = m_G; + jint ctyp; + jstring cn, jn = nullptr; + jobject jb = nullptr; if (rank == 0) if (!name || (jn = env->NewStringUTF(name)) == nullptr) { @@ -1363,21 +1186,32 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val) longjmp(g->jumper[g->jump_level], TYPE_AM_JDBC); } // endif Check + if (val->GetNullable()) + if (!gmID(g, objfldid, "ObjectField", "(ILjava/lang/String;)Ljava/lang/Object;")) { + jb = env->CallObjectMethod(job, objfldid, (jint)rank, jn); + + if (jb == nullptr) { + val->Reset(); + val->SetNull(true); + goto chk; + } // endif job + + } // endif objfldid + switch (ctyp) { case 12: // VARCHAR case -1: // LONGVARCHAR case 1: // CHAR - if (!gmID(g, chrfldid, "StringField", "(ILjava/lang/String;)Ljava/lang/String;")) { + if (jb) + cn = (jstring)jb; + else if (!gmID(g, chrfldid, "StringField", "(ILjava/lang/String;)Ljava/lang/String;")) cn = (jstring)env->CallObjectMethod(job, chrfldid, (jint)rank, jn); + else + cn = nullptr; - if (cn) { - const char *field = env->GetStringUTFChars(cn, (jboolean)false); - val->SetValue_psz((PSZ)field); - } else { - val->Reset(); - val->SetNull(true); - } // endif cn - + if (cn) { + const char *field = env->GetStringUTFChars(cn, (jboolean)false); + val->SetValue_psz((PSZ)field); } else val->Reset(); @@ -1449,6 +1283,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val) val->Reset(); } // endswitch Type + chk: if (Check()) { if (rank == 0) env->DeleteLocalRef(jn); diff --git a/storage/connect/jdbconn.h b/storage/connect/jdbconn.h index 095b1565bd2..0a1c52d4576 100644 --- a/storage/connect/jdbconn.h +++ b/storage/connect/jdbconn.h @@ -165,6 +165,7 @@ protected: jmethodID xpid; // The ExecutePrep method ID jmethodID pcid; // The ClosePrepStmt method ID jmethodID errid; // The GetErrmsg method ID + jmethodID objfldid; // The ObjectField method ID jmethodID chrfldid; // The StringField method ID jmethodID intfldid; // The IntField method ID jmethodID dblfldid; // The DoubleField method ID diff --git a/storage/connect/mysql-test/connect/disabled.def b/storage/connect/mysql-test/connect/disabled.def index 4e07b5c0576..64d7ece3fe1 100644 --- a/storage/connect/mysql-test/connect/disabled.def +++ b/storage/connect/mysql-test/connect/disabled.def @@ -13,3 +13,6 @@ jdbc : Variable settings depend on machine configuration jdbc_new : Variable settings depend on machine configuration jdbc_oracle : Variable settings depend on machine configuration jdbc_postgresql : Variable settings depend on machine configuration +json : TABLE_TYPE = JSON conflicts with the SQL syntax +json_udf : conflicts with the server JSON functions +json_udf_bin : conflicts with the server JSON functions diff --git a/storage/connect/mysql-test/connect/r/mysql_new.result b/storage/connect/mysql-test/connect/r/mysql_new.result index 05071ef7be6..9236ee691e5 100644 --- a/storage/connect/mysql-test/connect/r/mysql_new.result +++ b/storage/connect/mysql-test/connect/r/mysql_new.result @@ -200,7 +200,7 @@ t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` datetime DEFAULT NULL, `c` time DEFAULT NULL, - `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `e` year(4) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES('2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23'); @@ -220,7 +220,7 @@ t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` datetime DEFAULT NULL, `c` time DEFAULT NULL, - `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `e` year(4) DEFAULT NULL ) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT' `TABLE_TYPE`='MYSQL' SELECT * FROM t1; diff --git a/storage/connect/mysql-test/connect/r/vcol.result b/storage/connect/mysql-test/connect/r/vcol.result new file mode 100644 index 00000000000..1e3ecf8450a --- /dev/null +++ b/storage/connect/mysql-test/connect/r/vcol.result @@ -0,0 +1,29 @@ +create table t1 ( +#linenum int(6) not null default 0 special=rowid, +name char(12) not null, +city char(11) not null, +birth date not null date_format='DD/MM/YYYY', +hired date not null date_format='DD/MM/YYYY' flag=36, +agehired int(3) as (floor(datediff(hired,birth)/365.25)) +) +engine=CONNECT table_type=FIX file_name='boys.txt' mapped=YES lrecl=47; +select * from t1; +name city birth hired agehired +John Boston 1986-01-25 2010-06-02 24 +Henry Boston 1987-06-07 2008-04-01 20 +George San Jose 1981-08-10 2010-06-02 28 +Sam Chicago 1979-11-22 2007-10-10 27 +James Dallas 1992-05-13 2009-12-14 17 +Bill Boston 1986-09-11 2008-02-10 21 +drop table t1; +create table t1 ( +#linenum int(6) not null default 0 special=rowid, +name char(12) not null, +city char(11) not null, +birth date not null date_format='DD/MM/YYYY', +hired date not null date_format='DD/MM/YYYY' flag=36, +agehired int(3) as (floor(datediff(hired,birth)/365.25)), +index (agehired) +) +engine=CONNECT table_type=FIX file_name='boys.txt' mapped=YES lrecl=47; +ERROR 42000: Table handler doesn't support NULL in given index. Please change column 'agehired' to be NOT NULL or use another handler diff --git a/storage/connect/mysql-test/connect/t/vcol.test b/storage/connect/mysql-test/connect/t/vcol.test new file mode 100644 index 00000000000..0ed13c0e340 --- /dev/null +++ b/storage/connect/mysql-test/connect/t/vcol.test @@ -0,0 +1,26 @@ +let datadir= `select @@datadir`; +--copy_file $MTR_SUITE_DIR/std_data/boys.txt $datadir/test/boys.txt + +create table t1 ( + #linenum int(6) not null default 0 special=rowid, + name char(12) not null, + city char(11) not null, + birth date not null date_format='DD/MM/YYYY', + hired date not null date_format='DD/MM/YYYY' flag=36, + agehired int(3) as (floor(datediff(hired,birth)/365.25)) + ) +engine=CONNECT table_type=FIX file_name='boys.txt' mapped=YES lrecl=47; +select * from t1; +drop table t1; + +--error ER_NULL_COLUMN_IN_INDEX +create table t1 ( + #linenum int(6) not null default 0 special=rowid, + name char(12) not null, + city char(11) not null, + birth date not null date_format='DD/MM/YYYY', + hired date not null date_format='DD/MM/YYYY' flag=36, + agehired int(3) as (floor(datediff(hired,birth)/365.25)), + index (agehired) + ) +engine=CONNECT table_type=FIX file_name='boys.txt' mapped=YES lrecl=47; diff --git a/storage/connect/reldef.cpp b/storage/connect/reldef.cpp index 2c8ada52e6f..56a7ea8c512 100644 --- a/storage/connect/reldef.cpp +++ b/storage/connect/reldef.cpp @@ -294,7 +294,7 @@ int TABDEF::GetColCatInfo(PGLOBAL g) nlg+= nof; case TAB_DIR: case TAB_XML: - poff= loff + 1; + poff= loff + (pcf->Flags & U_VIRTUAL ? 0 : 1); break; case TAB_INI: case TAB_MAC: @@ -440,7 +440,11 @@ int TABDEF::GetColCatInfo(PGLOBAL g) } // endswitch tc // lrecl must be at least recln to avoid buffer overflow - recln= MY_MAX(recln, Hc->GetIntegerOption("Lrecl")); + if (trace) + htrc("Lrecl: Calculated=%d defined=%d\n", + recln, Hc->GetIntegerOption("Lrecl")); + + recln = MY_MAX(recln, Hc->GetIntegerOption("Lrecl")); Hc->SetIntegerOption("Lrecl", recln); ((PDOSDEF)this)->SetLrecl(recln); } // endif Lrecl @@ -534,7 +538,7 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g) #endif // 0 // Is the library already loaded? - if (!Hdll && !(Hdll = dlopen(soname, RTLD_NOLOAD))) + if (!Hdll) // Load the desired shared library if (!(Hdll = dlopen(soname, RTLD_LAZY))) { error = dlerror(); diff --git a/storage/connect/tabjdbc.cpp b/storage/connect/tabjdbc.cpp index 2726d2207dc..93ba3ca264d 100644 --- a/storage/connect/tabjdbc.cpp +++ b/storage/connect/tabjdbc.cpp @@ -686,6 +686,9 @@ bool TDBJDBC::MakeInsert(PGLOBAL g) else Prepared = true; + if (trace) + htrc("Insert=%s\n", Query->GetStr()); + return false; } // end of MakeInsert @@ -733,17 +736,18 @@ bool TDBJDBC::MakeCommand(PGLOBAL g) // If so, it must be quoted in the original query strlwr(strcat(strcat(strcpy(name, " "), Name), " ")); - if (!strstr(" update delete low_priority ignore quick from ", name)) - strlwr(strcpy(name, Name)); // Not a keyword - else + if (strstr(" update delete low_priority ignore quick from ", name)) { strlwr(strcat(strcat(strcpy(name, qc), Name), qc)); + k += 2; + } else + strlwr(strcpy(name, Name)); // Not a keyword if ((p = strstr(qrystr, name))) { for (i = 0; i < p - qrystr; i++) stmt[i] = (Qrystr[i] == '`') ? *qc : Qrystr[i]; stmt[i] = 0; - k = i + (int)strlen(Name); + k += i + (int)strlen(Name); if (qtd && *(p-1) == ' ') strcat(strcat(strcat(stmt, qc), TableName), qc); @@ -765,6 +769,9 @@ bool TDBJDBC::MakeCommand(PGLOBAL g) return 1; } // endif p + if (trace) + htrc("Command=%s\n", stmt); + Query = new(g)STRING(g, 0, stmt); return (!Query->GetSize()); } // end of MakeCommand @@ -1214,6 +1221,10 @@ int TDBJDBC::WriteDB(PGLOBAL g) } // endif oom Query->RepLast(')'); + + if (trace > 1) + htrc("Inserting: %s\n", Query->GetStr()); + rc = Jcp->ExecuteUpdate(Query->GetStr()); Query->Truncate(len); // Restore query diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 2334848a50b..038415cc188 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -407,7 +407,6 @@ static const int bulk_padding= 64; // bytes "overhead" in packet /* Variables used when chopping off trailing characters */ static const uint sizeof_trailing_comma= sizeof(", ") - 1; -static const uint sizeof_trailing_closeparen= sizeof(") ") - 1; static const uint sizeof_trailing_and= sizeof(" AND ") - 1; static const uint sizeof_trailing_where= sizeof(" WHERE ") - 1; diff --git a/storage/federatedx/federatedx_io.cc b/storage/federatedx/federatedx_io.cc index 1e0348e3bf8..5baec617cda 100644 --- a/storage/federatedx/federatedx_io.cc +++ b/storage/federatedx/federatedx_io.cc @@ -54,8 +54,6 @@ static const io_schemes_st federated_io_schemes[] = { "null", instantiate_io_null } /* must be last element */ }; -const uint federated_io_schemes_count= array_elements(federated_io_schemes); - federatedx_io::federatedx_io(FEDERATEDX_SERVER *aserver) : server(aserver), owner_ptr(0), txn_next(0), idle_next(0), active(FALSE), busy(FALSE), readonly(TRUE) diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc index cc12673f86f..a4da84ddaf3 100644 --- a/storage/federatedx/ha_federatedx.cc +++ b/storage/federatedx/ha_federatedx.cc @@ -337,7 +337,6 @@ static const int bulk_padding= 64; // bytes "overhead" in packet /* Variables used when chopping off trailing characters */ static const uint sizeof_trailing_comma= sizeof(", ") - 1; -static const uint sizeof_trailing_closeparen= sizeof(") ") - 1; static const uint sizeof_trailing_and= sizeof(" AND ") - 1; static const uint sizeof_trailing_where= sizeof(" WHERE ") - 1; diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index 446e971aacf..799200ae43f 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -24,12 +24,14 @@ INCLUDE(lzo) INCLUDE(lzma) INCLUDE(bzip2) INCLUDE(snappy) +INCLUDE(numa) MYSQL_CHECK_LZ4() MYSQL_CHECK_LZO() MYSQL_CHECK_LZMA() MYSQL_CHECK_BZIP2() MYSQL_CHECK_SNAPPY() +MYSQL_CHECK_NUMA() INCLUDE(innodb.cmake) @@ -177,7 +179,11 @@ MYSQL_ADD_PLUGIN(innobase ${INNOBASE_SOURCES} STORAGE_ENGINE # MODULE_ONLY # MODULE_OUTPUT_NAME ha_innodb DEFAULT RECOMPILE_FOR_EMBEDDED - LINK_LIBRARIES ${ZLIB_LIBRARY} ${CRC32_VPMSUM_LIBRARY} ${LINKER_SCRIPT}) + LINK_LIBRARIES + ${ZLIB_LIBRARY} + ${CRC32_VPMSUM_LIBRARY} + ${NUMA_LIBRARY} + ${LINKER_SCRIPT}) IF(WITH_INNOBASE_STORAGE_ENGINE) ADD_DEPENDENCIES(innobase GenError) diff --git a/storage/innobase/api/api0api.cc b/storage/innobase/api/api0api.cc index 1b99dcf1564..c6947b6f054 100644 --- a/storage/innobase/api/api0api.cc +++ b/storage/innobase/api/api0api.cc @@ -2172,7 +2172,7 @@ ib_col_set_value( if (len > 0 && cs->mbmaxlen > 1) { true_len = (ulint) - cs->cset->well_formed_len( + my_well_formed_length( cs, (const char*)src, (const char*)src + len, @@ -3425,9 +3425,9 @@ ib_cursor_set_memcached_sync( } if (flag) { - os_atomic_increment_lint(&table->memcached_sync_count, 1); + my_atomic_addlint(&table->memcached_sync_count, 1); } else { - os_atomic_decrement_lint(&table->memcached_sync_count, 1); + my_atomic_addlint(&table->memcached_sync_count, -1); ut_a(table->memcached_sync_count >= 0); } } else { diff --git a/storage/innobase/api/api0misc.cc b/storage/innobase/api/api0misc.cc index 3864e4b9a7f..b510f292a35 100644 --- a/storage/innobase/api/api0misc.cc +++ b/storage/innobase/api/api0misc.cc @@ -113,10 +113,6 @@ handle_new_error: trx_rollback_for_mysql(trx); break; - case DB_MUST_GET_MORE_FILE_SPACE: - - ut_error; - case DB_CORRUPTION: case DB_FOREIGN_EXCEED_MAX_CASCADE: break; diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index 255788229e4..8acb96f1910 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -37,7 +37,6 @@ Created 6/2/1994 Heikki Tuuri #include "page0zip.h" #include "gis0rtree.h" -#ifndef UNIV_HOTBACKUP #include "btr0cur.h" #include "btr0sea.h" #include "btr0pcur.h" @@ -50,6 +49,7 @@ Created 6/2/1994 Heikki Tuuri #include "gis0geo.h" #include "ut0new.h" #include "dict0boot.h" +#include "row0sel.h" /* row_search_max_autoinc() */ /**************************************************************//** Checks if the page in the cursor can be merged with given page. @@ -63,8 +63,6 @@ btr_can_merge_with_page( buf_block_t** merge_block, /*!< out: the merge block */ mtr_t* mtr); /*!< in: mini-transaction */ -#endif /* UNIV_HOTBACKUP */ - /**************************************************************//** Report that an index page is corrupted. */ void @@ -79,7 +77,6 @@ btr_corruption_report( << " of table " << index->table->name; } -#ifndef UNIV_HOTBACKUP /* Latching strategy of the InnoDB B-tree -------------------------------------- @@ -173,16 +170,17 @@ btr_root_block_get( buf_block_t* block = btr_block_get(page_id, page_size, mode, index, mtr); - if (!block) { - index->table->is_encrypted = TRUE; - index->table->corrupted = FALSE; + if (index && index->table) { + index->table->is_encrypted = TRUE; + index->table->corrupted = FALSE; - ib_push_warning(index->table->thd, DB_DECRYPTION_FAILED, - "Table %s in tablespace %lu is encrypted but encryption service or" - " used key_id is not available. " - " Can't continue reading table.", - index->table->name, space); + ib_push_warning(index->table->thd, DB_DECRYPTION_FAILED, + "Table %s in tablespace %lu is encrypted but encryption service or" + " used key_id is not available. " + " Can't continue reading table.", + index->table->name, space); + } return NULL; } @@ -242,8 +240,7 @@ btr_height_get( || mtr_memo_contains_flagged(mtr, dict_index_get_lock(index), MTR_MEMO_S_LOCK | MTR_MEMO_X_LOCK - | MTR_MEMO_SX_LOCK) - || dict_table_is_intrinsic(index->table)); + | MTR_MEMO_SX_LOCK)); /* S latches the page */ root_block = btr_root_block_get(index, RW_S_LATCH, mtr); @@ -560,8 +557,7 @@ btr_get_size( ut_ad(srv_read_only_mode || mtr_memo_contains(mtr, dict_index_get_lock(index), - MTR_MEMO_S_LOCK) - || dict_table_is_intrinsic(index->table)); + MTR_MEMO_S_LOCK)); if (index->page == FIL_NULL || dict_index_is_online_ddl(index) @@ -917,8 +913,7 @@ btr_page_get_father_node_ptr_func( ut_ad(srv_read_only_mode || mtr_memo_contains_flagged(mtr, dict_index_get_lock(index), MTR_MEMO_X_LOCK - | MTR_MEMO_SX_LOCK) - || dict_table_is_intrinsic(index->table)); + | MTR_MEMO_SX_LOCK)); ut_ad(dict_index_get_page(index) != page_no); @@ -929,17 +924,11 @@ btr_page_get_father_node_ptr_func( tuple = dict_index_build_node_ptr(index, user_rec, 0, heap, level); dberr_t err = DB_SUCCESS; - - if (dict_table_is_intrinsic(index->table)) { - err = btr_cur_search_to_nth_level_with_no_latch( - index, level + 1, tuple, PAGE_CUR_LE, cursor, - file, line, mtr); - } else { - err = btr_cur_search_to_nth_level( - index, level + 1, tuple, - PAGE_CUR_LE, latch_mode, cursor, 0, - file, line, mtr); - } + + err = btr_cur_search_to_nth_level( + index, level + 1, tuple, + PAGE_CUR_LE, latch_mode, cursor, 0, + file, line, mtr); if (err != DB_SUCCESS) { ib::warn() << " Error code: " << err @@ -1106,7 +1095,7 @@ btr_free_root_check( index_id_t index_id, mtr_t* mtr) { - ut_ad(page_id.space() != srv_tmp_space.space_id()); + ut_ad(page_id.space() != SRV_TMP_SPACE_ID); ut_ad(index_id != BTR_FREED_INDEX_ID); buf_block_t* block = buf_page_get( @@ -1328,6 +1317,11 @@ leaf_loop: page_t* root = block->frame; + if (!root) { + mtr_commit(&mtr); + return; + } + #ifdef UNIV_BTR_DEBUG ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF + root, block->page.id.space())); @@ -1408,13 +1402,125 @@ btr_free( buf_block_t* block = buf_page_get( page_id, page_size, RW_X_LATCH, &mtr); - ut_ad(page_is_root(block->frame)); + if (block) { + ut_ad(page_is_root(block->frame)); - btr_free_but_not_root(block, MTR_LOG_NO_REDO); - btr_free_root(block, &mtr); + btr_free_but_not_root(block, MTR_LOG_NO_REDO); + btr_free_root(block, &mtr); + } mtr.commit(); } -#endif /* !UNIV_HOTBACKUP */ + +/** Read the last used AUTO_INCREMENT value from PAGE_ROOT_AUTO_INC. +@param[in,out] index clustered index +@return the last used AUTO_INCREMENT value +@retval 0 on error or if no AUTO_INCREMENT value was used yet */ +ib_uint64_t +btr_read_autoinc(dict_index_t* index) +{ + ut_ad(dict_index_is_clust(index)); + ut_ad(index->table->persistent_autoinc); + ut_ad(!dict_table_is_temporary(index->table)); + + if (fil_space_t* space = fil_space_acquire(index->space)) { + mtr_t mtr; + mtr.start(); + ib_uint64_t autoinc; + if (buf_block_t* block = buf_page_get( + page_id_t(index->space, index->page), + page_size_t(space->flags), + RW_S_LATCH, &mtr)) { + autoinc = page_get_autoinc(block->frame); + } else { + autoinc = 0; + } + mtr.commit(); + fil_space_release(space); + return(autoinc); + } + + return(0); +} + +/** Read the last used AUTO_INCREMENT value from PAGE_ROOT_AUTO_INC, +or fall back to MAX(auto_increment_column). +@param[in] table table containing an AUTO_INCREMENT column +@param[in] col_no index of the AUTO_INCREMENT column +@return the AUTO_INCREMENT value +@retval 0 on error or if no AUTO_INCREMENT value was used yet */ +ib_uint64_t +btr_read_autoinc_with_fallback(const dict_table_t* table, unsigned col_no) +{ + ut_ad(table->persistent_autoinc); + ut_ad(!dict_table_is_temporary(table)); + + dict_index_t* index = dict_table_get_first_index(table); + + if (index == NULL) { + } else if (fil_space_t* space = fil_space_acquire(index->space)) { + mtr_t mtr; + mtr.start(); + buf_block_t* block = buf_page_get( + page_id_t(index->space, index->page), + page_size_t(space->flags), + RW_S_LATCH, &mtr); + + ib_uint64_t autoinc = block + ? page_get_autoinc(block->frame) : 0; + const bool retry = block && autoinc == 0 + && !page_is_empty(block->frame); + mtr.commit(); + fil_space_release(space); + + if (retry) { + /* This should be an old data file where + PAGE_ROOT_AUTO_INC was initialized to 0. + Fall back to reading MAX(autoinc_col). + There should be an index on it. */ + const dict_col_t* autoinc_col + = dict_table_get_nth_col(table, col_no); + while (index != NULL + && index->fields[0].col != autoinc_col) { + index = dict_table_get_next_index(index); + } + + if (index != NULL && index->space == space->id) { + autoinc = row_search_max_autoinc(index); + } + } + + return(autoinc); + } + + return(0); +} + +/** Write the next available AUTO_INCREMENT value to PAGE_ROOT_AUTO_INC. +@param[in,out] index clustered index +@param[in] autoinc the AUTO_INCREMENT value +@param[in] reset whether to reset the AUTO_INCREMENT + to a possibly smaller value than currently + exists in the page */ +void +btr_write_autoinc(dict_index_t* index, ib_uint64_t autoinc, bool reset) +{ + ut_ad(dict_index_is_clust(index)); + ut_ad(index->table->persistent_autoinc); + ut_ad(!dict_table_is_temporary(index->table)); + + if (fil_space_t* space = fil_space_acquire(index->space)) { + mtr_t mtr; + mtr.start(); + mtr.set_named_space(space); + page_set_autoinc(buf_page_get( + page_id_t(index->space, index->page), + page_size_t(space->flags), + RW_SX_LATCH, &mtr), + index, autoinc, &mtr, reset); + mtr.commit(); + fil_space_release(space); + } +} /*************************************************************//** Reorganizes an index page. @@ -1442,9 +1548,7 @@ btr_page_reorganize_low( mtr_t* mtr) /*!< in/out: mini-transaction */ { buf_block_t* block = page_cur_get_block(cursor); -#ifndef UNIV_HOTBACKUP buf_pool_t* buf_pool = buf_pool_from_bpage(&block->page); -#endif /* !UNIV_HOTBACKUP */ page_t* page = buf_block_get_frame(block); page_zip_des_t* page_zip = buf_block_get_page_zip(block); buf_block_t* temp_block; @@ -1469,12 +1573,7 @@ btr_page_reorganize_low( /* Turn logging off */ mtr_log_t log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE); -#ifndef UNIV_HOTBACKUP temp_block = buf_block_alloc(buf_pool); -#else /* !UNIV_HOTBACKUP */ - ut_ad(block == back_block1); - temp_block = back_block2; -#endif /* !UNIV_HOTBACKUP */ temp_page = temp_block->frame; MONITOR_INC(MONITOR_INDEX_REORG_ATTEMPTS); @@ -1487,11 +1586,9 @@ btr_page_reorganize_low( /* Copy the old page to temporary space */ buf_frame_copy(temp_page, page); -#ifndef UNIV_HOTBACKUP if (!recovery) { btr_search_drop_page_hash_index(block); } -#endif /* !UNIV_HOTBACKUP */ /* Save the cursor position. */ pos = page_rec_get_n_recs_before(page_cur_get_rec(cursor)); @@ -1508,21 +1605,28 @@ btr_page_reorganize_low( page_get_infimum_rec(temp_page), index, mtr); - /* Multiple transactions cannot simultaneously operate on the - same temp-table in parallel. - max_trx_id is ignored for temp tables because it not required - for MVCC. */ - if (dict_index_is_sec_or_ibuf(index) - && page_is_leaf(page) - && !dict_table_is_temporary(index->table)) { - /* Copy max trx id to recreated page */ - trx_id_t max_trx_id = page_get_max_trx_id(temp_page); - page_set_max_trx_id(block, NULL, max_trx_id, mtr); - /* In crash recovery, dict_index_is_sec_or_ibuf() always - holds, even for clustered indexes. max_trx_id is - unused in clustered index pages. */ - ut_ad(max_trx_id != 0 || recovery); - } + /* Copy the PAGE_MAX_TRX_ID or PAGE_ROOT_AUTO_INC. */ + memcpy(page + (PAGE_HEADER + PAGE_MAX_TRX_ID), + temp_page + (PAGE_HEADER + PAGE_MAX_TRX_ID), 8); + /* PAGE_MAX_TRX_ID is unused in clustered index pages, + non-leaf pages, and in temporary tables. It was always + zero-initialized in page_create() in all InnoDB versions. + PAGE_MAX_TRX_ID must be nonzero on dict_index_is_sec_or_ibuf() + leaf pages. + + During redo log apply, dict_index_is_sec_or_ibuf() always + holds, even for clustered indexes. */ + ut_ad(recovery || dict_table_is_temporary(index->table) + || !page_is_leaf(temp_page) + || !dict_index_is_sec_or_ibuf(index) + || page_get_max_trx_id(page) != 0); + /* PAGE_MAX_TRX_ID must be zero on non-leaf pages other than + clustered index root pages. */ + ut_ad(recovery + || page_get_max_trx_id(page) == 0 + || (dict_index_is_sec_or_ibuf(index) + ? page_is_leaf(temp_page) + : page_is_root(temp_page))); /* If innodb_log_compressed_pages is ON, page reorganize should log the compressed page image.*/ @@ -1559,13 +1663,10 @@ btr_page_reorganize_low( goto func_exit; } -#ifndef UNIV_HOTBACKUP - /* No locks are acquried for intrinsic tables. */ if (!recovery && !dict_table_is_locking_disabled(index->table)) { /* Update the record lock bitmaps */ lock_move_reorganize_page(block, temp_block); } -#endif /* !UNIV_HOTBACKUP */ data_size2 = page_get_data_size(page); max_ins_size2 = page_get_max_insert_size_after_reorganize(page, 1); @@ -1594,14 +1695,11 @@ func_exit: #ifdef UNIV_ZIP_DEBUG ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ -#ifndef UNIV_HOTBACKUP buf_block_free(temp_block); -#endif /* !UNIV_HOTBACKUP */ /* Restore logging mode */ mtr_set_log_mode(mtr, log_mode); -#ifndef UNIV_HOTBACKUP if (success) { mlog_id_t type; byte* log_ptr; @@ -1630,7 +1728,6 @@ func_exit: MONITOR_INC(MONITOR_INDEX_REORG_SUCCESSFUL); } -#endif /* !UNIV_HOTBACKUP */ return(success); } @@ -1666,7 +1763,6 @@ btr_page_reorganize_block( return(btr_page_reorganize_low(recovery, z_level, &cur, index, mtr)); } -#ifndef UNIV_HOTBACKUP /*************************************************************//** Reorganizes an index page. @@ -1688,7 +1784,6 @@ btr_page_reorganize( return(btr_page_reorganize_low(false, page_zip_level, cursor, index, mtr)); } -#endif /* !UNIV_HOTBACKUP */ /***********************************************************//** Parses a redo log record of reorganizing a page. @@ -1732,7 +1827,6 @@ btr_parse_page_reorganize( return(ptr); } -#ifndef UNIV_HOTBACKUP /*************************************************************//** Empties an index page. @see btr_page_create(). */ static @@ -1758,12 +1852,23 @@ btr_page_empty( /* Recreate the page: note that global data on page (possible segment headers, next page-field, etc.) is preserved intact */ + /* Preserve PAGE_ROOT_AUTO_INC when creating a clustered index + root page. */ + const ib_uint64_t autoinc + = dict_index_is_clust(index) && page_is_root(page) + ? page_get_autoinc(page) + : 0; + if (page_zip) { - page_create_zip(block, index, level, 0, NULL, mtr); + page_create_zip(block, index, level, autoinc, NULL, mtr); } else { page_create(block, mtr, dict_table_is_comp(index->table), dict_index_is_spatial(index)); btr_page_set_level(page, NULL, level, mtr); + if (autoinc) { + mlog_write_ull(PAGE_HEADER + PAGE_MAX_TRX_ID + page, + autoinc, mtr); + } } } @@ -1824,8 +1929,7 @@ btr_root_raise_and_insert( #endif /* UNIV_BTR_DEBUG */ ut_ad(mtr_memo_contains_flagged(mtr, dict_index_get_lock(index), MTR_MEMO_X_LOCK - | MTR_MEMO_SX_LOCK) - || dict_table_is_intrinsic(index->table)); + | MTR_MEMO_SX_LOCK)); ut_ad(mtr_is_block_fix( mtr, root_block, MTR_MEMO_PAGE_X_FIX, index->table)); @@ -2311,17 +2415,10 @@ btr_insert_on_non_leaf_level_func( ut_ad(level > 0); if (!dict_index_is_spatial(index)) { - dberr_t err = DB_SUCCESS; - if (dict_table_is_intrinsic(index->table)) { - err = btr_cur_search_to_nth_level_with_no_latch( - index, level, tuple, PAGE_CUR_LE, &cursor, - __FILE__, __LINE__, mtr); - } else { - err = btr_cur_search_to_nth_level( - index, level, tuple, PAGE_CUR_LE, - BTR_CONT_MODIFY_TREE, - &cursor, 0, file, line, mtr); - } + dberr_t err = btr_cur_search_to_nth_level( + index, level, tuple, PAGE_CUR_LE, + BTR_CONT_MODIFY_TREE, + &cursor, 0, file, line, mtr); if (err != DB_SUCCESS) { ib::warn() << " Error code: " << err @@ -2593,10 +2690,9 @@ btr_insert_into_right_sibling( page_t* page = buf_block_get_frame(block); ulint next_page_no = btr_page_get_next(page, mtr); - ut_ad(dict_table_is_intrinsic(cursor->index->table) - || mtr_memo_contains_flagged( - mtr, dict_index_get_lock(cursor->index), - MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)); + ut_ad(mtr_memo_contains_flagged( + mtr, dict_index_get_lock(cursor->index), + MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)); ut_ad(mtr_is_block_fix( mtr, block, MTR_MEMO_PAGE_X_FIX, cursor->index->table)); ut_ad(heap); @@ -2769,14 +2865,12 @@ func_start: ut_ad(mtr_memo_contains_flagged(mtr, dict_index_get_lock(cursor->index), - MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK) - || dict_table_is_intrinsic(cursor->index->table)); + MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)); ut_ad(!dict_index_is_online_ddl(cursor->index) || (flags & BTR_CREATE_FLAG) || dict_index_is_clust(cursor->index)); ut_ad(rw_lock_own_flagged(dict_index_get_lock(cursor->index), - RW_LOCK_FLAG_X | RW_LOCK_FLAG_SX) - || dict_table_is_intrinsic(cursor->index->table)); + RW_LOCK_FLAG_X | RW_LOCK_FLAG_SX)); block = btr_cur_get_block(cursor); page = buf_block_get_frame(block); @@ -2930,7 +3024,6 @@ insert_empty: } if (!srv_read_only_mode - && !dict_table_is_intrinsic(cursor->index->table) && insert_will_fit && page_is_leaf(page) && !dict_index_is_online_ddl(cursor->index)) { @@ -3228,9 +3321,6 @@ btr_set_min_rec_mark_log( /* Write rec offset as a 2-byte ulint */ mlog_catenate_ulint(mtr, page_offset(rec), MLOG_2BYTES); } -#else /* !UNIV_HOTBACKUP */ -# define btr_set_min_rec_mark_log(rec,comp,mtr) ((void) 0) -#endif /* !UNIV_HOTBACKUP */ /****************************************************************//** Parses the redo log record for setting an index record as the predefined @@ -3288,7 +3378,6 @@ btr_set_min_rec_mark( } } -#ifndef UNIV_HOTBACKUP /*************************************************************//** Deletes on the upper level the node pointer to a page. */ void @@ -3559,8 +3648,7 @@ btr_compress( } else { ut_ad(mtr_memo_contains_flagged(mtr, dict_index_get_lock(index), MTR_MEMO_X_LOCK - | MTR_MEMO_SX_LOCK) - || dict_table_is_intrinsic(index->table)); + | MTR_MEMO_SX_LOCK)); } #endif /* UNIV_DEBUG */ @@ -4152,8 +4240,7 @@ btr_discard_page( ut_ad(dict_index_get_page(index) != block->page.id.page_no()); ut_ad(mtr_memo_contains_flagged(mtr, dict_index_get_lock(index), - MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK) - || dict_table_is_intrinsic(index->table)); + MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)); ut_ad(mtr_is_block_fix(mtr, block, MTR_MEMO_PAGE_X_FIX, index->table)); @@ -5382,7 +5469,6 @@ btr_can_merge_with_page( goto error; } - max_ins_size = page_get_max_insert_size(mpage, n_recs); if (data_size > max_ins_size) { @@ -5416,5 +5502,3 @@ error: *merge_block = NULL; DBUG_RETURN(false); } - -#endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 7daec068f78..87d88cea820 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -50,7 +50,6 @@ Created 10/16/1994 Heikki Tuuri #endif #include "row0upd.h" -#ifndef UNIV_HOTBACKUP #include "mtr0log.h" #include "page0page.h" #include "page0zip.h" @@ -151,9 +150,7 @@ can be released by page reorganize, then it is reorganized */ + (sample) - 1 + (ext_size) + (not_empty)) / ((sample) + (ext_size))) /* @} */ -#endif /* !UNIV_HOTBACKUP */ -#ifndef UNIV_HOTBACKUP /*******************************************************************//** Marks all extern fields in a record as owned by the record. This function should be called if the delete mark of a record is removed: a not delete @@ -212,9 +209,7 @@ btr_rec_free_externally_stored_fields( mtr_t* mtr); /*!< in: mini-transaction handle which contains an X-latch to record page and to the index tree */ -#endif /* !UNIV_HOTBACKUP */ -#ifndef UNIV_HOTBACKUP /*==================== B-TREE SEARCH =========================*/ #if MTR_MEMO_PAGE_S_FIX != RW_S_LATCH @@ -280,10 +275,10 @@ btr_cur_latch_leaves( case BTR_MODIFY_TREE: /* It is exclusive for other operations which calls btr_page_set_prev() */ - ut_ad(mtr_memo_contains_flagged(mtr, - dict_index_get_lock(cursor->index), - MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK) - || dict_table_is_intrinsic(cursor->index->table)); + ut_ad(mtr_memo_contains_flagged( + mtr, + dict_index_get_lock(cursor->index), + MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)); /* x-latch also siblings from left to right */ left_page_no = btr_page_get_prev(page, mtr); mode = latch_mode; @@ -583,9 +578,7 @@ btr_cur_will_modify_tree( { ut_ad(!page_is_leaf(page)); ut_ad(mtr_memo_contains_flagged(mtr, dict_index_get_lock(index), - MTR_MEMO_X_LOCK - | MTR_MEMO_SX_LOCK) - || dict_table_is_intrinsic(index->table)); + MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)); /* Pessimistic delete of the first record causes delete & insert of node_ptr at upper level. And a subsequent page shrink is @@ -753,7 +746,9 @@ btr_cur_search_to_nth_level( RW_S_LATCH, or 0 */ const char* file, /*!< in: file name */ ulint line, /*!< in: line where called */ - mtr_t* mtr) /*!< in: mtr */ + mtr_t* mtr, /*!< in: mtr */ + ib_uint64_t autoinc)/*!< in: PAGE_ROOT_AUTO_INC to be written + (0 if none) */ { page_t* page = NULL; /* remove warning */ buf_block_t* block; @@ -890,6 +885,12 @@ btr_cur_search_to_nth_level( || latch_mode == BTR_SEARCH_TREE || latch_mode == BTR_MODIFY_LEAF); + ut_ad(autoinc == 0 || dict_index_is_clust(index)); + ut_ad(autoinc == 0 + || latch_mode == BTR_MODIFY_TREE + || latch_mode == BTR_MODIFY_LEAF); + ut_ad(autoinc == 0 || level == 0); + cursor->flag = BTR_CUR_BINARY; cursor->index = index; @@ -909,13 +910,12 @@ btr_cur_search_to_nth_level( # ifdef UNIV_SEARCH_PERF_STAT info->n_searches++; # endif - /* Use of AHI is disabled for intrinsic table as these tables re-use - the index-id and AHI validation is based on index-id. */ - if (rw_lock_get_writer(btr_get_search_latch(index)) - == RW_LOCK_NOT_LOCKED + if (autoinc == 0 && latch_mode <= BTR_MODIFY_LEAF && info->last_hash_succ +# ifdef MYSQL_INDEX_DISABLE_AHI && !index->disable_ahi +# endif && !estimate # ifdef PAGE_CUR_LE_OR_EXTENDS && mode != PAGE_CUR_LE_OR_EXTENDS @@ -924,8 +924,10 @@ btr_cur_search_to_nth_level( /* If !has_search_latch, we do a dirty read of btr_search_enabled below, and btr_search_guess_on_hash() will have to check it again. */ - && UNIV_LIKELY(btr_search_enabled) + && btr_search_enabled && !modify_external + && rw_lock_get_writer(btr_get_search_latch(index)) + == RW_LOCK_NOT_LOCKED && btr_search_guess_on_hash(index, info, tuple, mode, latch_mode, cursor, has_search_latch, mtr)) { @@ -1073,16 +1075,16 @@ search_loop: if (height != 0) { /* We are about to fetch the root or a non-leaf page. */ - if ((latch_mode != BTR_MODIFY_TREE - || height == level) + if ((latch_mode != BTR_MODIFY_TREE || height == level) && !retrying_for_search_prev) { /* If doesn't have SX or X latch of index, each pages should be latched before reading. */ - if (modify_external - && height == ULINT_UNDEFINED - && upper_rw_latch == RW_S_LATCH) { + if (height == ULINT_UNDEFINED + && upper_rw_latch == RW_S_LATCH + && (modify_external || autoinc)) { /* needs sx-latch of root page - for fseg operation */ + for fseg operation or for writing + PAGE_ROOT_AUTO_INC */ rw_latch = RW_SX_LATCH; } else { rw_latch = upper_rw_latch; @@ -1273,11 +1275,13 @@ retry_page_get: && page_is_leaf(page) && rw_latch != RW_NO_LATCH && rw_latch != root_leaf_rw_latch) { - /* We should retry to get the page, because the root page - is latched with different level as a leaf page. */ + /* The root page is also a leaf page (root_leaf). + We should reacquire the page, because the root page + is latched differently from leaf pages. */ ut_ad(root_leaf_rw_latch != RW_NO_LATCH); ut_ad(rw_latch == RW_S_LATCH || rw_latch == RW_SX_LATCH); - ut_ad(rw_latch == RW_S_LATCH || modify_external); + ut_ad(rw_latch == RW_S_LATCH || modify_external || autoinc); + ut_ad(!autoinc || root_leaf_rw_latch == RW_X_LATCH); ut_ad(n_blocks == 0); mtr_release_block_at_savepoint( @@ -1367,6 +1371,7 @@ retry_page_get: /* release upper blocks */ if (retrying_for_search_prev) { + ut_ad(!autoinc); for (; prev_n_releases < prev_n_blocks; prev_n_releases++) { @@ -1380,8 +1385,9 @@ retry_page_get: } for (; n_releases < n_blocks; n_releases++) { - if (n_releases == 0 && modify_external) { - /* keep latch of root page */ + if (n_releases == 0 + && (modify_external || autoinc)) { + /* keep the root page latch */ ut_ad(mtr_memo_contains_flagged( mtr, tree_blocks[n_releases], MTR_MEMO_PAGE_SX_FIX @@ -1905,6 +1911,8 @@ need_opposite_intention: } if (level != 0) { + ut_ad(!autoinc); + if (upper_rw_latch == RW_NO_LATCH) { /* latch the page */ buf_block_t* child_block; @@ -1953,12 +1961,21 @@ need_opposite_intention: cursor->up_match = up_match; cursor->up_bytes = up_bytes; + if (autoinc) { + page_set_autoinc(tree_blocks[0], + index, autoinc, mtr, false); + } + #ifdef BTR_CUR_ADAPT /* We do a dirty read of btr_search_enabled here. We will properly check btr_search_enabled again in btr_search_build_page_hash_index() before building a page hash index, while holding search latch. */ - if (btr_search_enabled && !index->disable_ahi) { + if (btr_search_enabled +# ifdef MYSQL_INDEX_DISABLE_AHI + && !index->disable_ahi +# endif + ) { btr_search_info_update(index, cursor); } #endif @@ -2009,179 +2026,6 @@ func_exit: DBUG_RETURN(err); } -/** Searches an index tree and positions a tree cursor on a given level. -This function will avoid latching the traversal path and so should be -used only for cases where-in latching is not needed. - -@param[in,out] index index -@param[in] level the tree level of search -@param[in] tuple data tuple; Note: n_fields_cmp in compared - to the node ptr page node field -@param[in] mode PAGE_CUR_L, .... - Insert should always be made using PAGE_CUR_LE - to search the position. -@param[in,out] cursor tree cursor; points to record of interest. -@param[in] file file name -@param[in[ line line where called from -@param[in,out] mtr mtr -@param[in] mark_dirty - if true then mark the block as dirty */ -dberr_t -btr_cur_search_to_nth_level_with_no_latch( - dict_index_t* index, - ulint level, - const dtuple_t* tuple, - page_cur_mode_t mode, - btr_cur_t* cursor, - const char* file, - ulint line, - mtr_t* mtr, - bool mark_dirty) -{ - page_t* page = NULL; /* remove warning */ - buf_block_t* block; - ulint height; - ulint up_match; - ulint low_match; - ulint rw_latch; - page_cur_mode_t page_mode; - ulint buf_mode; - page_cur_t* page_cursor; - ulint root_height = 0; /* remove warning */ - ulint n_blocks = 0; - dberr_t err = DB_SUCCESS; - mem_heap_t* heap = NULL; - ulint offsets_[REC_OFFS_NORMAL_SIZE]; - ulint* offsets = offsets_; - rec_offs_init(offsets_); - - DBUG_ENTER("btr_cur_search_to_nth_level_with_no_latch"); - - ut_ad(dict_table_is_intrinsic(index->table)); - ut_ad(level == 0 || mode == PAGE_CUR_LE); - ut_ad(dict_index_check_search_tuple(index, tuple)); - ut_ad(dtuple_check_typed(tuple)); - ut_ad(index->page != FIL_NULL); - - UNIV_MEM_INVALID(&cursor->up_match, sizeof cursor->up_match); - UNIV_MEM_INVALID(&cursor->low_match, sizeof cursor->low_match); -#ifdef UNIV_DEBUG - cursor->up_match = ULINT_UNDEFINED; - cursor->low_match = ULINT_UNDEFINED; -#endif /* UNIV_DEBUG */ - - cursor->flag = BTR_CUR_BINARY; - cursor->index = index; - - page_cursor = btr_cur_get_page_cur(cursor); - - const ulint space = dict_index_get_space(index); - const page_size_t page_size(dict_table_page_size(index->table)); - /* Start with the root page. */ - page_id_t page_id(space, dict_index_get_page(index)); - - up_match = 0; - low_match = 0; - - height = ULINT_UNDEFINED; - - /* We use these modified search modes on non-leaf levels of the - B-tree. These let us end up in the right B-tree leaf. In that leaf - we use the original search mode. */ - - switch (mode) { - case PAGE_CUR_GE: - page_mode = PAGE_CUR_L; - break; - case PAGE_CUR_G: - page_mode = PAGE_CUR_LE; - break; - default: - page_mode = mode; - break; - } - - /* Loop and search until we arrive at the desired level */ - bool at_desired_level = false; - while (!at_desired_level) { - buf_mode = BUF_GET; - rw_latch = RW_NO_LATCH; - - ut_ad(n_blocks < BTR_MAX_LEVELS); - - block = buf_page_get_gen(page_id, page_size, rw_latch, NULL, - buf_mode, file, line, mtr, &err, mark_dirty); - - if (err != DB_SUCCESS) { - if (err == DB_DECRYPTION_FAILED) { - ib_push_warning((void *)NULL, - DB_DECRYPTION_FAILED, - "Table %s is encrypted but encryption service or" - " used key_id is not available. " - " Can't continue reading table.", - index->table->name); - index->table->is_encrypted = true; - } - - DBUG_RETURN(err); - } - - page = buf_block_get_frame(block); - - if (height == ULINT_UNDEFINED) { - /* We are in the root node */ - - height = btr_page_get_level(page, mtr); - root_height = height; - cursor->tree_height = root_height + 1; - } - - if (height == 0) { - /* On leaf level. Switch back to original search mode.*/ - page_mode = mode; - } - - page_cur_search_with_match( - block, index, tuple, page_mode, &up_match, - &low_match, page_cursor, NULL); - - ut_ad(height == btr_page_get_level( - page_cur_get_page(page_cursor), mtr)); - - if (level != height) { - - const rec_t* node_ptr; - ut_ad(height > 0); - - height--; - - node_ptr = page_cur_get_rec(page_cursor); - - offsets = rec_get_offsets( - node_ptr, index, offsets, - ULINT_UNDEFINED, &heap); - - /* Go to the child node */ - page_id.reset(space, btr_node_ptr_get_child_page_no( - node_ptr, offsets)); - - n_blocks++; - } else { - /* If this is the desired level, leave the loop */ - at_desired_level = true; - } - } - - cursor->low_match = low_match; - cursor->up_match = up_match; - - if (heap != NULL) { - mem_heap_free(heap); - } - - DBUG_RETURN(err); -} - /*****************************************************************//** Opens a cursor at either end of an index. */ dberr_t @@ -2556,125 +2400,6 @@ btr_cur_open_at_index_side_func( return err; } -/** Opens a cursor at either end of an index. -Avoid taking latches on buffer, just pin (by incrementing fix_count) -to keep them in buffer pool. This mode is used by intrinsic table -as they are not shared and so there is no need of latching. -@param[in] from_left true if open to low end, false if open - to high end. -@param[in] index index -@param[in,out] cursor cursor -@param[in] file file name -@param[in] line line where called -@param[in,out] mtr mini transaction -*/ -dberr_t -btr_cur_open_at_index_side_with_no_latch_func( - bool from_left, - dict_index_t* index, - btr_cur_t* cursor, - ulint level, - const char* file, - ulint line, - mtr_t* mtr) -{ - page_cur_t* page_cursor; - ulint height; - rec_t* node_ptr; - ulint n_blocks = 0; - mem_heap_t* heap = NULL; - ulint offsets_[REC_OFFS_NORMAL_SIZE]; - ulint* offsets = offsets_; - dberr_t err = DB_SUCCESS; - rec_offs_init(offsets_); - - ut_ad(level != ULINT_UNDEFINED); - - page_cursor = btr_cur_get_page_cur(cursor); - cursor->index = index; - page_id_t page_id(dict_index_get_space(index), - dict_index_get_page(index)); - const page_size_t& page_size = dict_table_page_size(index->table); - - height = ULINT_UNDEFINED; - - for (;;) { - buf_block_t* block; - page_t* page; - ulint rw_latch = RW_NO_LATCH; - - ut_ad(n_blocks < BTR_MAX_LEVELS); - - block = buf_page_get_gen(page_id, page_size, rw_latch, NULL, - BUF_GET, file, line, mtr, &err); - - if (err != DB_SUCCESS) { - if (err == DB_DECRYPTION_FAILED) { - ib_push_warning((void *)NULL, - DB_DECRYPTION_FAILED, - "Table %s is encrypted but encryption service or" - " used key_id is not available. " - " Can't continue reading table.", - index->table->name); - index->table->is_encrypted = true; - } - - return (err); - } - - page = buf_block_get_frame(block); - - ut_ad(fil_page_index_page_check(page)); - ut_ad(index->id == btr_page_get_index_id(page)); - - if (height == ULINT_UNDEFINED) { - /* We are in the root node */ - - height = btr_page_get_level(page, mtr); - ut_a(height >= level); - } else { - /* TODO: flag the index corrupted if this fails */ - ut_ad(height == btr_page_get_level(page, mtr)); - } - - if (from_left) { - page_cur_set_before_first(block, page_cursor); - } else { - page_cur_set_after_last(block, page_cursor); - } - - if (height == level) { - break; - } - - ut_ad(height > 0); - - if (from_left) { - page_cur_move_to_next(page_cursor); - } else { - page_cur_move_to_prev(page_cursor); - } - - height--; - - node_ptr = page_cur_get_rec(page_cursor); - offsets = rec_get_offsets(node_ptr, cursor->index, offsets, - ULINT_UNDEFINED, &heap); - - /* Go to the child node */ - page_id.set_page_no( - btr_node_ptr_get_child_page_no(node_ptr, offsets)); - - n_blocks++; - } - - if (heap != NULL) { - mem_heap_free(heap); - } - - return(err); -} - /**********************************************************************//** Positions a cursor at a randomly chosen position within a B-tree. @return true if the index is available and we have put the cursor, false @@ -3097,11 +2822,8 @@ btr_cur_ins_lock_and_undo( return(err); } - /* Now we can fill in the roll ptr field in entry - (except if table is intrinsic) */ - - if (!(flags & BTR_KEEP_SYS_FLAG) - && !dict_table_is_intrinsic(index->table)) { + /* Now we can fill in the roll ptr field in entry */ + if (!(flags & BTR_KEEP_SYS_FLAG)) { row_upd_index_entry_sys_field(entry, index, DATA_ROLL_PTR, roll_ptr); @@ -3191,8 +2913,6 @@ btr_cur_optimistic_insert( page = buf_block_get_frame(block); index = cursor->index; - /* Block are not latched for insert if table is intrinsic - and index is auto-generated clustered index. */ ut_ad(mtr_is_block_fix(mtr, block, MTR_MEMO_PAGE_X_FIX, index->table)); ut_ad(!dict_index_is_online_ddl(index) || dict_index_is_clust(index) @@ -3311,26 +3031,18 @@ fail_err: { const rec_t* page_cursor_rec = page_cur_get_rec(page_cursor); - if (dict_table_is_intrinsic(index->table)) { - - index->rec_cache.rec_size = rec_size; - - *rec = page_cur_tuple_direct_insert( - page_cursor, entry, index, n_ext, mtr); - } else { - /* Check locks and write to the undo log, - if specified */ - err = btr_cur_ins_lock_and_undo(flags, cursor, entry, - thr, mtr, &inherit); - if (err != DB_SUCCESS) { - goto fail_err; - } - - *rec = page_cur_tuple_insert( - page_cursor, entry, index, offsets, heap, - n_ext, mtr); + /* Check locks and write to the undo log, + if specified */ + err = btr_cur_ins_lock_and_undo(flags, cursor, entry, + thr, mtr, &inherit); + if (err != DB_SUCCESS) { + goto fail_err; } + *rec = page_cur_tuple_insert( + page_cursor, entry, index, offsets, heap, + n_ext, mtr); + reorg = page_cursor_rec != page_cur_get_rec(page_cursor); } @@ -3347,13 +3059,6 @@ fail_err: goto fail; } else { - - /* For intrinsic table we take a consistent path - to re-organize using pessimistic path. */ - if (dict_table_is_intrinsic(index->table)) { - goto fail; - } - ut_ad(!reorg); /* If the record did not fit, reorganize */ @@ -3378,12 +3083,13 @@ fail_err: } #ifdef BTR_CUR_HASH_ADAPT - if (!index->disable_ahi) { - if (!reorg && leaf && (cursor->flag == BTR_CUR_HASH)) { - btr_search_update_hash_node_on_insert(cursor); - } else { - btr_search_update_hash_on_insert(cursor); - } +# ifdef MYSQL_INDEX_DISABLE_AHI + if (index->disable_ahi); else +# endif + if (!reorg && leaf && (cursor->flag == BTR_CUR_HASH)) { + btr_search_update_hash_node_on_insert(cursor); + } else { + btr_search_update_hash_on_insert(cursor); } #endif /* BTR_CUR_HASH_ADAPT */ @@ -3467,9 +3173,8 @@ btr_cur_pessimistic_insert( *big_rec = NULL; ut_ad(mtr_memo_contains_flagged( - mtr, dict_index_get_lock(btr_cur_get_index(cursor)), - MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK) - || dict_table_is_intrinsic(cursor->index->table)); + mtr, dict_index_get_lock(btr_cur_get_index(cursor)), + MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)); ut_ad(mtr_is_block_fix( mtr, btr_cur_get_block(cursor), MTR_MEMO_PAGE_X_FIX, cursor->index->table)); @@ -3489,8 +3194,7 @@ btr_cur_pessimistic_insert( return(err); } - if (!(flags & BTR_NO_UNDO_LOG_FLAG) - || dict_table_is_intrinsic(index->table)) { + if (!(flags & BTR_NO_UNDO_LOG_FLAG)) { /* First reserve enough free space for the file segments of the index tree, so that the insert will not fail because of lack of space */ @@ -3548,7 +3252,6 @@ btr_cur_pessimistic_insert( ut_ad(page_rec_get_next(btr_cur_get_rec(cursor)) == *rec || dict_index_is_spatial(index)); - if (!(flags & BTR_NO_LOCKING_FLAG)) { ut_ad(!dict_table_is_temporary(index->table)); if (dict_index_is_spatial(index)) { @@ -3577,9 +3280,10 @@ btr_cur_pessimistic_insert( } #ifdef BTR_CUR_ADAPT - if (!index->disable_ahi) { - btr_search_update_hash_on_insert(cursor); - } +# ifdef MYSQL_INDEX_DISABLE_AHI + if (index->disable_ahi); else +# endif + btr_search_update_hash_on_insert(cursor); #endif if (inherit && !(flags & BTR_NO_LOCKING_FLAG)) { @@ -3715,7 +3419,6 @@ btr_cur_update_in_place_log( row_upd_index_write_log(update, log_ptr, mtr); } -#endif /* UNIV_HOTBACKUP */ /***********************************************************//** Parses a redo log record of updating a record in-place. @@ -3794,7 +3497,6 @@ func_exit: return(ptr); } -#ifndef UNIV_HOTBACKUP /*************************************************************//** See if there is enough place in the page modification log to log an update-in-place. @@ -3921,9 +3623,7 @@ btr_cur_update_in_place( index = cursor->index; ut_ad(rec_offs_validate(rec, index, offsets)); ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table)); - ut_ad(trx_id > 0 - || (flags & BTR_KEEP_SYS_FLAG) - || dict_table_is_intrinsic(index->table)); + ut_ad(trx_id > 0 || (flags & BTR_KEEP_SYS_FLAG)); /* The insert buffer tree should never be updated in place. */ ut_ad(!dict_index_is_ibuf(index)); ut_ad(dict_index_is_online_ddl(index) == !!(flags & BTR_CREATE_FLAG) @@ -3970,8 +3670,7 @@ btr_cur_update_in_place( goto func_exit; } - if (!(flags & BTR_KEEP_SYS_FLAG) - && !dict_table_is_intrinsic(index->table)) { + if (!(flags & BTR_KEEP_SYS_FLAG)) { row_upd_rec_sys_fields(rec, NULL, index, offsets, thr_get_trx(thr), roll_ptr); } @@ -4087,9 +3786,7 @@ btr_cur_optimistic_update( page = buf_block_get_frame(block); rec = btr_cur_get_rec(cursor); index = cursor->index; - ut_ad(trx_id > 0 - || (flags & BTR_KEEP_SYS_FLAG) - || dict_table_is_intrinsic(index->table)); + ut_ad(trx_id > 0 || (flags & BTR_KEEP_SYS_FLAG)); ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table)); ut_ad(mtr_is_block_fix(mtr, block, MTR_MEMO_PAGE_X_FIX, index->table)); /* This is intended only for leaf page updates */ @@ -4275,8 +3972,7 @@ any_extern: page_cur_move_to_prev(page_cursor); - if (!(flags & BTR_KEEP_SYS_FLAG) - && !dict_table_is_intrinsic(index->table)) { + if (!(flags & BTR_KEEP_SYS_FLAG)) { row_upd_index_entry_sys_field(new_entry, index, DATA_ROLL_PTR, roll_ptr); row_upd_index_entry_sys_field(new_entry, index, DATA_TRX_ID, @@ -4422,8 +4118,7 @@ btr_cur_pessimistic_update( ut_ad(mtr_memo_contains_flagged(mtr, dict_index_get_lock(index), MTR_MEMO_X_LOCK | - MTR_MEMO_SX_LOCK) - || dict_table_is_intrinsic(index->table)); + MTR_MEMO_SX_LOCK)); ut_ad(mtr_is_block_fix(mtr, block, MTR_MEMO_PAGE_X_FIX, index->table)); #ifdef UNIV_ZIP_DEBUG ut_a(!page_zip || page_zip_validate(page_zip, page, index)); @@ -4431,8 +4126,7 @@ btr_cur_pessimistic_update( /* The insert buffer tree should never be updated in place. */ ut_ad(!dict_index_is_ibuf(index)); ut_ad(trx_id > 0 - || (flags & BTR_KEEP_SYS_FLAG) - || dict_table_is_intrinsic(index->table)); + || (flags & BTR_KEEP_SYS_FLAG)); ut_ad(dict_index_is_online_ddl(index) == !!(flags & BTR_CREATE_FLAG) || dict_index_is_clust(index)); ut_ad(thr_get_trx(thr)->id == trx_id @@ -4495,11 +4189,8 @@ btr_cur_pessimistic_update( ut_ad(rec_offs_validate(rec, index, *offsets)); n_ext += btr_push_update_extern_fields(new_entry, update, entry_heap); - /* UNDO logging is also turned-off during normal operation on intrinsic - table so condition needs to ensure that table is not intrinsic. */ if ((flags & BTR_NO_UNDO_LOG_FLAG) - && rec_offs_any_extern(*offsets) - && !dict_table_is_intrinsic(index->table)) { + && rec_offs_any_extern(*offsets)) { /* We are in a transaction rollback undoing a row update: we must free possible externally stored fields which got new values in the update, if they are not @@ -4575,8 +4266,7 @@ btr_cur_pessimistic_update( } } - if (!(flags & BTR_KEEP_SYS_FLAG) - && !dict_table_is_intrinsic(index->table)) { + if (!(flags & BTR_KEEP_SYS_FLAG)) { row_upd_index_entry_sys_field(new_entry, index, DATA_ROLL_PTR, roll_ptr); row_upd_index_entry_sys_field(new_entry, index, DATA_TRX_ID, @@ -4682,7 +4372,7 @@ btr_cur_pessimistic_update( } } - if (big_rec_vec != NULL && !dict_table_is_intrinsic(index->table)) { + if (big_rec_vec != NULL) { ut_ad(page_is_leaf(page)); ut_ad(dict_index_is_clust(index)); ut_ad(flags & BTR_KEEP_POS_FLAG); @@ -4827,7 +4517,6 @@ btr_cur_del_mark_set_clust_rec_log( mlog_close(mtr, log_ptr); } -#endif /* !UNIV_HOTBACKUP */ /****************************************************************//** Parses the redo log record for delete marking or unmarking of a clustered @@ -4909,7 +4598,6 @@ btr_cur_parse_del_mark_set_clust_rec( return(ptr); } -#ifndef UNIV_HOTBACKUP /***********************************************************//** Marks a clustered index record deleted. Writes an undo log record to undo log on this delete marking. Writes in the trx id field the id @@ -4971,12 +4659,6 @@ btr_cur_del_mark_set_clust_rec( btr_rec_set_deleted_flag(rec, page_zip, TRUE); - /* For intrinsic table, roll-ptr is not maintained as there is no UNDO - logging. Skip updating it. */ - if (dict_table_is_intrinsic(index->table)) { - return(err); - } - trx = thr_get_trx(thr); /* This function must not be invoked during rollback (of a TRX_STATE_PREPARE transaction or otherwise). */ @@ -5037,7 +4719,6 @@ btr_cur_del_mark_set_sec_rec_log( mlog_close(mtr, log_ptr); } -#endif /* !UNIV_HOTBACKUP */ /****************************************************************//** Parses the redo log record for delete marking or unmarking of a secondary @@ -5082,7 +4763,6 @@ btr_cur_parse_del_mark_set_sec_rec( return(ptr); } -#ifndef UNIV_HOTBACKUP /***********************************************************//** Sets a secondary index record delete mark to TRUE or FALSE. @return DB_SUCCESS, DB_LOCK_WAIT, or error number */ @@ -5175,16 +4855,9 @@ btr_cur_compress_if_useful( cursor position even if compression occurs */ mtr_t* mtr) /*!< in/out: mini-transaction */ { - /* Avoid applying compression as we don't accept lot of page garbage - given the workload of intrinsic table. */ - if (dict_table_is_intrinsic(cursor->index->table)) { - return(FALSE); - } - ut_ad(mtr_memo_contains_flagged( mtr, dict_index_get_lock(btr_cur_get_index(cursor)), - MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK) - || dict_table_is_intrinsic(cursor->index->table)); + MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)); ut_ad(mtr_is_block_fix( mtr, btr_cur_get_block(cursor), MTR_MEMO_PAGE_X_FIX, cursor->index->table)); @@ -5368,8 +5041,7 @@ btr_cur_pessimistic_delete( || (flags & BTR_CREATE_FLAG)); ut_ad(mtr_memo_contains_flagged(mtr, dict_index_get_lock(index), MTR_MEMO_X_LOCK - | MTR_MEMO_SX_LOCK) - || dict_table_is_intrinsic(index->table)); + | MTR_MEMO_SX_LOCK)); ut_ad(mtr_is_block_fix(mtr, block, MTR_MEMO_PAGE_X_FIX, index->table)); ut_ad(mtr->is_named_space(index->space)); @@ -5683,7 +5355,6 @@ btr_estimate_n_rows_in_range_on_level( goto inexact; } - page = buf_block_get_frame(block); /* It is possible that the tree has been reorganized in the @@ -5919,7 +5590,6 @@ btr_estimate_n_rows_in_range_low( << " index: " << index->name; } - ut_ad(page_rec_is_supremum(btr_cur_get_rec(&cursor))); /* The range specified is wihout a right border, just @@ -6406,7 +6076,6 @@ btr_estimate_number_of_different_key_vals( } } - if (n_cols == dict_index_get_n_unique_in_tree(index)) { /* If there is more than one leaf page in the tree, @@ -6914,17 +6583,14 @@ struct btr_blob_log_check_t { ut_ad(m_mtr->memo_contains_page_flagged( *m_rec, - MTR_MEMO_PAGE_X_FIX | MTR_MEMO_PAGE_SX_FIX) - || dict_table_is_intrinsic(index->table)); + MTR_MEMO_PAGE_X_FIX | MTR_MEMO_PAGE_SX_FIX)); ut_ad(mtr_memo_contains_flagged(m_mtr, dict_index_get_lock(index), - MTR_MEMO_SX_LOCK | MTR_MEMO_X_LOCK) - || dict_table_is_intrinsic(index->table)); + MTR_MEMO_SX_LOCK | MTR_MEMO_X_LOCK)); } }; - /*******************************************************************//** Stores the fields in big_rec_vec to the tablespace and puts pointers to them in rec. The extern flags in rec will have to be set beforehand. @@ -6978,9 +6644,7 @@ btr_store_big_rec_extern_fields( ut_ad(rec_offs_any_extern(offsets)); ut_ad(btr_mtr); ut_ad(mtr_memo_contains_flagged(btr_mtr, dict_index_get_lock(index), - MTR_MEMO_X_LOCK - | MTR_MEMO_SX_LOCK) - || dict_table_is_intrinsic(index->table)); + MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)); ut_ad(mtr_is_block_fix( btr_mtr, rec_block, MTR_MEMO_PAGE_X_FIX, index->table)); ut_ad(buf_block_get_frame(rec_block) == page_align(rec)); @@ -7479,9 +7143,7 @@ btr_free_externally_stored_field( ut_ad(dict_index_is_clust(index)); ut_ad(mtr_memo_contains_flagged(local_mtr, dict_index_get_lock(index), - MTR_MEMO_X_LOCK - | MTR_MEMO_SX_LOCK) - || dict_table_is_intrinsic(index->table)); + MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)); ut_ad(mtr_is_page_fix( local_mtr, field_ref, MTR_MEMO_PAGE_X_FIX, index->table)); ut_ad(!rec || rec_offs_validate(rec, index, offsets)); @@ -8112,4 +7774,3 @@ btr_rec_copy_externally_stored_field( return(btr_copy_externally_stored_field(len, data, page_size, local_len, heap)); } -#endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc index a62351f2954..7f06aed9ff0 100644 --- a/storage/innobase/btr/btr0defragment.cc +++ b/storage/innobase/btr/btr0defragment.cc @@ -26,7 +26,6 @@ Modified 30/07/2014 Jan Lindström jan.lindstrom@mariadb.com *******************************************************/ #include "btr0defragment.h" -#ifndef UNIV_HOTBACKUP #include "btr0btr.h" #include "btr0cur.h" #include "btr0sea.h" @@ -499,7 +498,7 @@ btr_defragment_merge_pages( // n_recs_to_move number of records to to_page. We try to reduce // the targeted data size on the to_page by // BTR_DEFRAGMENT_PAGE_REDUCTION_STEP_SIZE and try again. - os_atomic_increment_ulint( + my_atomic_addlint( &btr_defragment_compression_failures, 1); max_ins_size_to_use = move_size > BTR_DEFRAGMENT_PAGE_REDUCTION_STEP_SIZE @@ -722,10 +721,10 @@ btr_defragment_n_pages( } mem_heap_free(heap); n_defragmented ++; - os_atomic_increment_ulint( + my_atomic_addlint( &btr_defragment_count, 1); if (n_pages == n_defragmented) { - os_atomic_increment_ulint( + my_atomic_addlint( &btr_defragment_failures, 1); } else { index->stat_defrag_n_pages_freed += (n_pages - n_defragmented); @@ -847,5 +846,3 @@ DECLARE_THREAD(btr_defragment_thread)( os_thread_exit(); OS_THREAD_DUMMY_RETURN; } - -#endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc index a5da1b9fb0c..377a332bd9f 100644 --- a/storage/innobase/btr/btr0pcur.cc +++ b/storage/innobase/btr/btr0pcur.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2016, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -127,13 +128,14 @@ btr_pcur_store_position( ut_ad((mtr_memo_contains_flagged( mtr, dict_index_get_lock(index), MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK) - || mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_S_FIX) - || mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)) + || mtr_memo_contains_flagged(mtr, block, + MTR_MEMO_PAGE_S_FIX + | MTR_MEMO_PAGE_X_FIX)) && (block->page.buf_fix_count > 0)); } else { - ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_S_FIX) - || mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX) - || dict_table_is_intrinsic(index->table)); + ut_ad(mtr_memo_contains_flagged(mtr, block, + MTR_MEMO_PAGE_S_FIX + | MTR_MEMO_PAGE_X_FIX)); } #endif /* UNIV_DEBUG */ @@ -283,13 +285,11 @@ btr_pcur_restore_position_func( ut_a(cursor->old_rec); ut_a(cursor->old_n_fields); - /* Optimistic latching involves S/X latch not required for - intrinsic table instead we would prefer to search fresh. */ - if ((latch_mode == BTR_SEARCH_LEAF - || latch_mode == BTR_MODIFY_LEAF - || latch_mode == BTR_SEARCH_PREV - || latch_mode == BTR_MODIFY_PREV) - && !dict_table_is_intrinsic(cursor->btr_cur.index->table)) { + switch (latch_mode) { + case BTR_SEARCH_LEAF: + case BTR_MODIFY_LEAF: + case BTR_SEARCH_PREV: + case BTR_MODIFY_PREV: /* Try optimistic restoration. */ if (!buf_pool_is_obsolete(cursor->withdraw_clock) @@ -422,7 +422,6 @@ btr_pcur_move_to_next_page( buf_block_t* next_block; page_t* next_page; ulint mode; - dict_table_t* table = btr_pcur_get_btr_cur(cursor)->index->table; ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_ad(cursor->latch_mode != BTR_NO_LATCHES); @@ -444,12 +443,6 @@ btr_pcur_move_to_next_page( mode = BTR_MODIFY_LEAF; } - /* For intrinsic tables we avoid taking any latches as table is - accessed by only one thread at any given time. */ - if (dict_table_is_intrinsic(table)) { - mode = BTR_NO_LATCHES; - } - buf_block_t* block = btr_pcur_get_block(cursor); next_block = btr_block_get( @@ -523,32 +516,26 @@ btr_pcur_move_backward_from_page( prev_page_no = btr_page_get_prev(page, mtr); - /* For intrinsic table we don't do optimistic restore and so there is - no left block that is pinned that needs to be released. */ - if (!dict_table_is_intrinsic( - btr_cur_get_index(btr_pcur_get_btr_cur(cursor))->table)) { + if (prev_page_no == FIL_NULL) { + } else if (btr_pcur_is_before_first_on_page(cursor)) { - if (prev_page_no == FIL_NULL) { - } else if (btr_pcur_is_before_first_on_page(cursor)) { + prev_block = btr_pcur_get_btr_cur(cursor)->left_block; - prev_block = btr_pcur_get_btr_cur(cursor)->left_block; + btr_leaf_page_release(btr_pcur_get_block(cursor), + latch_mode, mtr); - btr_leaf_page_release(btr_pcur_get_block(cursor), - latch_mode, mtr); - - page_cur_set_after_last(prev_block, + page_cur_set_after_last(prev_block, btr_pcur_get_page_cur(cursor)); - } else { + } else { - /* The repositioned cursor did not end on an infimum - record on a page. Cursor repositioning acquired a latch - also on the previous page, but we do not need the latch: - release it. */ + /* The repositioned cursor did not end on an infimum + record on a page. Cursor repositioning acquired a latch + also on the previous page, but we do not need the latch: + release it. */ - prev_block = btr_pcur_get_btr_cur(cursor)->left_block; + prev_block = btr_pcur_get_btr_cur(cursor)->left_block; - btr_leaf_page_release(prev_block, latch_mode, mtr); - } + btr_leaf_page_release(prev_block, latch_mode, mtr); } cursor->latch_mode = latch_mode; @@ -610,7 +597,7 @@ btr_pcur_open_on_user_rec_func( mtr_t* mtr) /*!< in: mtr */ { btr_pcur_open_low(index, 0, tuple, mode, latch_mode, cursor, - file, line, mtr); + file, line, 0, mtr); if ((mode == PAGE_CUR_GE) || (mode == PAGE_CUR_G)) { diff --git a/storage/innobase/btr/btr0scrub.cc b/storage/innobase/btr/btr0scrub.cc index 8ed0117b36e..f361a9d8b1e 100644 --- a/storage/innobase/btr/btr0scrub.cc +++ b/storage/innobase/btr/btr0scrub.cc @@ -366,12 +366,17 @@ btr_optimistic_scrub( /* We play safe and reset the free bits */ if (!dict_index_is_clust(index) && - page_is_leaf(buf_block_get_frame(block))) { + block != NULL) { + buf_frame_t* frame = buf_block_get_frame(block); + if (frame && + page_is_leaf(frame)) { ibuf_reset_free_bits(block); + } } scrub_data->scrub_stat.page_reorganizations++; + return DB_SUCCESS; } @@ -486,9 +491,13 @@ btr_pessimistic_scrub( /* We play safe and reset the free bits * NOTE: need to call this prior to btr_page_split_and_insert */ if (!dict_index_is_clust(index) && - page_is_leaf(buf_block_get_frame(block))) { + block != NULL) { + buf_frame_t* frame = buf_block_get_frame(block); + if (frame && + page_is_leaf(frame)) { - ibuf_reset_free_bits(block); + ibuf_reset_free_bits(block); + } } rec = btr_page_split_and_insert( @@ -787,11 +796,8 @@ btr_scrub_page( return BTR_SCRUB_SKIP_PAGE_AND_CLOSE_TABLE; } - buf_frame_t* frame = NULL; + buf_frame_t* frame = buf_block_get_frame(block); - if (block) { - frame = buf_block_get_frame(block); - } if (!frame || btr_page_get_index_id(frame) != scrub_data->current_index->id) { /* page has been reallocated to new index */ diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc index 4489775d46c..0af2a8b637c 100644 --- a/storage/innobase/btr/btr0sea.cc +++ b/storage/innobase/btr/btr0sea.cc @@ -1214,7 +1214,9 @@ retry: (buf_fix_count == 0 when DROP TABLE or similar is executing buf_LRU_drop_page_hash_for_tablespace()). */ ut_a(index == block->index); +#ifdef MYSQL_INDEX_DISABLE_AHI ut_ad(!index->disable_ahi); +#endif ut_ad(block->page.id.space() == index->space); ut_a(index_id == index->id); @@ -1437,7 +1439,10 @@ btr_search_build_page_hash_index( ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint* offsets = offsets_; - if (index->disable_ahi || !btr_search_enabled) { +#ifdef MYSQL_INDEX_DISABLE_AHI + if (index->disable_ahi) return; +#endif + if (!btr_search_enabled) { return; } @@ -1614,15 +1619,13 @@ btr_search_move_or_delete_hash_entries( buf_block_t* block, dict_index_t* index) { - /* AHI is disabled for intrinsic table as it depends on index-id - which is dynamically assigned for intrinsic table indexes and not - through a centralized index generator. */ - if (index->disable_ahi || !btr_search_enabled) { +#ifdef MYSQL_INDEX_DISABLE_AHI + if (index->disable_ahi) return; +#endif + if (!btr_search_enabled) { return; } - ut_ad(!dict_table_is_intrinsic(index->table)); - ut_ad(rw_lock_own(&(block->lock), RW_LOCK_X)); ut_ad(rw_lock_own(&(new_block->lock), RW_LOCK_X)); @@ -1681,7 +1684,10 @@ btr_search_update_hash_on_delete(btr_cur_t* cursor) mem_heap_t* heap = NULL; rec_offs_init(offsets_); - if (cursor->index->disable_ahi || !btr_search_enabled) { +#ifdef MYSQL_INDEX_DISABLE_AHI + if (cursor->index->disable_ahi) return; +#endif + if (!btr_search_enabled) { return; } @@ -1740,7 +1746,10 @@ btr_search_update_hash_node_on_insert(btr_cur_t* cursor) dict_index_t* index; rec_t* rec; - if (cursor->index->disable_ahi || !btr_search_enabled) { +#ifdef MYSQL_INDEX_DISABLE_AHI + if (cursor->index->disable_ahi) return; +#endif + if (!btr_search_enabled) { return; } @@ -1817,7 +1826,10 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor) ulint* offsets = offsets_; rec_offs_init(offsets_); - if (cursor->index->disable_ahi || !btr_search_enabled) { +#ifdef MYSQL_INDEX_DISABLE_AHI + if (cursor->index->disable_ahi) return; +#endif + if (!btr_search_enabled) { return; } @@ -1839,7 +1851,9 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor) rec = btr_cur_get_rec(cursor); +#ifdef MYSQL_INDEX_DISABLE_AHI ut_a(!index->disable_ahi); +#endif ut_a(index == cursor->index); ut_a(!dict_index_is_ibuf(index)); diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index dbe774e7e6b..935b7fadafa 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -49,7 +49,6 @@ Created 11/5/1995 Heikki Tuuri #include "fil0fil.h" #include "fil0crypt.h" #include "fsp0sysspace.h" -#ifndef UNIV_HOTBACKUP #include "buf0buddy.h" #include "lock0lock.h" #include "sync0rw.h" @@ -59,7 +58,6 @@ Created 11/5/1995 Heikki Tuuri #include "trx0purge.h" #include "log0log.h" #include "dict0stats_bg.h" -#endif /* !UNIV_HOTBACKUP */ #include "srv0srv.h" #include "srv0start.h" #include "dict0dict.h" @@ -96,11 +94,12 @@ struct set_numa_interleave_t { if (srv_numa_interleave) { + struct bitmask *numa_mems_allowed = numa_get_mems_allowed(); ib::info() << "Setting NUMA memory policy to" " MPOL_INTERLEAVE"; if (set_mempolicy(MPOL_INTERLEAVE, - numa_all_nodes_ptr->maskp, - numa_all_nodes_ptr->size) != 0) { + numa_mems_allowed->maskp, + numa_mems_allowed->size) != 0) { ib::warn() << "Failed to set NUMA memory" " policy to MPOL_INTERLEAVE: " @@ -129,6 +128,11 @@ struct set_numa_interleave_t #define NUMA_MEMPOLICY_INTERLEAVE_IN_SCOPE #endif /* HAVE_LIBNUMA && WITH_NUMA */ +/* Enable this for checksum error messages. */ +//#ifdef UNIV_DEBUG +//#define UNIV_DEBUG_LEVEL2 1 +//#endif + /* IMPLEMENTATION OF THE BUFFER POOL ================================= @@ -317,7 +321,7 @@ that the whole area may be needed in the near future, and issue the read requests for the whole area. */ -#if (!(defined(UNIV_HOTBACKUP) || defined(UNIV_INNOCHECKSUM))) +#ifndef UNIV_INNOCHECKSUM /** Value in microseconds */ static const int WAIT_FOR_READ = 100; static const int WAIT_FOR_WRITE = 100; @@ -406,6 +410,9 @@ buf_pool_register_chunk( chunk->blocks->frame, chunk)); } +/* prototypes for new functions added to ha_innodb.cc */ +trx_t* innobase_get_trx(); + /********************************************************************//** Check if page is maybe compressed, encrypted or both when we encounter corrupted page. Note that we can't be 100% sure if page is corrupted @@ -582,7 +589,7 @@ buf_block_alloc( return(block); } -#endif /* !UNIV_HOTBACKUP && !UNIV_INNOCHECKSUM */ +#endif /* !UNIV_INNOCHECKSUM */ /** Checks if a page contains only zeroes. @param[in] read_buf database page @@ -640,19 +647,26 @@ buf_page_is_checksum_valid_crc32( #endif /* UNIV_INNOCHECKSUM */ if (checksum_field1 != checksum_field2) { - return(false); + goto invalid; } if (checksum_field1 == crc32) { return(true); + } else { + const uint32_t crc32_legacy = buf_calc_page_crc32(read_buf, true); + + if (checksum_field1 == crc32_legacy) { + return(true); + } } - const uint32_t crc32_legacy = buf_calc_page_crc32(read_buf, true); - - if (checksum_field1 == crc32_legacy) { - return(true); - } - +invalid: +#ifdef UNIV_DEBUG_LEVEL2 + ib::info() << "Page checksum crc32 not valid" + << " field1 " << checksum_field1 + << " field2 " << checksum_field2 + << " crc32 " << crc32; +#endif return(false); } @@ -724,6 +738,13 @@ buf_page_is_checksum_valid_innodb( if (checksum_field2 != mach_read_from_4(read_buf + FIL_PAGE_LSN) && checksum_field2 != old_checksum) { +#ifdef UNIV_DEBUG_LEVEL2 + ib::info() << "Page checksum crc32 not valid" + << " field1 " << checksum_field1 + << " field2 " << checksum_field2 + << " crc32 " << buf_calc_page_old_checksum(read_buf) + << " lsn " << mach_read_from_4(read_buf + FIL_PAGE_LSN); +#endif return(false); } @@ -733,6 +754,13 @@ buf_page_is_checksum_valid_innodb( (always equal to 0), to FIL_PAGE_SPACE_OR_CHKSUM */ if (checksum_field1 != 0 && checksum_field1 != new_checksum) { +#ifdef UNIV_DEBUG_LEVEL2 + ib::info() << "Page checksum crc32 not valid" + << " field1 " << checksum_field1 + << " field2 " << checksum_field2 + << " crc32 " << buf_calc_page_new_checksum(read_buf) + << " lsn " << mach_read_from_4(read_buf + FIL_PAGE_LSN); +#endif return(false); } @@ -762,6 +790,15 @@ buf_page_is_checksum_valid_none( #endif /* UNIV_INNOCHECKSUM */ ) { +#ifdef UNIV_DEBUG_LEVEL2 + if (!(checksum_field1 == checksum_field2 || checksum_field1 == BUF_NO_CHECKSUM_MAGIC)) { + ib::info() << "Page checksum crc32 not valid" + << " field1 " << checksum_field1 + << " field2 " << checksum_field2 + << " crc32 " << BUF_NO_CHECKSUM_MAGIC + << " lsn " << mach_read_from_4(read_buf + FIL_PAGE_LSN); + } +#endif #ifdef UNIV_INNOCHECKSUM if (is_log_enabled @@ -805,9 +842,24 @@ buf_page_is_corrupted( #endif /* UNIV_INNOCHECKSUM */ ) { - ulint page_encrypted = (mach_read_from_4(read_buf+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) != 0); ulint checksum_field1; ulint checksum_field2; + bool page_encrypted = false; + +#ifndef UNIV_INNOCHECKSUM // FIXME see also encryption.innochecksum test + ulint space_id = mach_read_from_4( + read_buf + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); + fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space_id); + + /* Page is encrypted if encryption information is found from + tablespace and page contains used key_version. This is true + also for pages first compressed and then encrypted. */ + if (crypt_data && + crypt_data->type != CRYPT_SCHEME_UNENCRYPTED && + fil_page_is_encrypted(read_buf)) { + page_encrypted = true; + } +#endif DBUG_EXECUTE_IF("buf_page_is_corrupt_failure", return(TRUE); ); @@ -819,10 +871,17 @@ buf_page_is_corrupted( /* Stored log sequence numbers at the start and the end of page do not match */ +#ifndef UNIV_INNOCHECKSUM + ib::info() << "Log sequence number at the start " + << mach_read_from_4(read_buf + FIL_PAGE_LSN + 4) + << " and the end " + << mach_read_from_4(read_buf + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM + 4) + << " do not match"; +#endif return(TRUE); } -#if !defined(UNIV_HOTBACKUP) && !defined(UNIV_INNOCHECKSUM) +#ifndef UNIV_INNOCHECKSUM if (check_lsn && recv_lsn_checks_on) { lsn_t current_lsn; const lsn_t page_lsn @@ -852,7 +911,7 @@ buf_page_is_corrupted( } } -#endif /* !UNIV_HOTBACKUP && !UNIV_INNOCHECKSUM */ +#endif /* !UNIV_INNOCHECKSUM */ /* Check whether the checksum fields have correct values */ @@ -906,6 +965,10 @@ buf_page_is_corrupted( || i >= FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID) && read_buf[i] != 0) { +#ifndef UNIV_INNOCHECKSUM + ib::info() << "Checksum fields zero but page is not empty."; +#endif + break; } } @@ -1199,9 +1262,7 @@ buf_page_print( const page_size_t& page_size, ulint flags) { -#ifndef UNIV_HOTBACKUP dict_index_t* index; -#endif /* !UNIV_HOTBACKUP */ if (!(flags & BUF_PAGE_PRINT_NO_FULL)) { @@ -1307,7 +1368,6 @@ buf_page_print( read_buf + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); } -#ifndef UNIV_HOTBACKUP if (mach_read_from_2(read_buf + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_TYPE) == TRX_UNDO_INSERT) { fprintf(stderr, @@ -1318,7 +1378,6 @@ buf_page_print( fprintf(stderr, "InnoDB: Page may be an update undo log page\n"); } -#endif /* !UNIV_HOTBACKUP */ switch (fil_page_get_type(read_buf)) { index_id_t index_id; @@ -1329,7 +1388,6 @@ buf_page_print( "InnoDB: Page may be an index page where" " index id is " << index_id; -#ifndef UNIV_HOTBACKUP index = dict_index_find_on_id_low(index_id); if (index) { ib::info() @@ -1337,7 +1395,6 @@ buf_page_print( << " is " << index->name << " in table " << index->table->name; } -#endif /* !UNIV_HOTBACKUP */ break; case FIL_PAGE_INODE: fputs("InnoDB: Page may be an 'inode' page\n", stderr); @@ -1384,8 +1441,6 @@ buf_page_print( ut_ad(flags & BUF_PAGE_PRINT_NO_CRASH); } -#ifndef UNIV_HOTBACKUP - # ifdef PFS_GROUP_BUFFER_SYNC extern mysql_pfs_key_t buffer_block_mutex_key; @@ -1456,6 +1511,7 @@ buf_block_init( block->frame = frame; block->page.buf_pool_index = buf_pool_index(buf_pool); + block->page.flush_type = BUF_FLUSH_LRU; block->page.state = BUF_BLOCK_NOT_USED; block->page.buf_fix_count = 0; block->page.io_fix = BUF_IO_NONE; @@ -1474,7 +1530,6 @@ buf_block_init( ut_d(block->page.file_page_was_freed = FALSE); block->index = NULL; - block->made_dirty_with_no_latch = false; block->skip_flush_check = false; ut_d(block->page.in_page_hash = FALSE); @@ -1555,10 +1610,11 @@ buf_chunk_init( #if defined(HAVE_LIBNUMA) && defined(WITH_NUMA) if (srv_numa_interleave) { + struct bitmask *numa_mems_allowed = numa_get_mems_allowed(); int st = mbind(chunk->mem, chunk->mem_size(), MPOL_INTERLEAVE, - numa_all_nodes_ptr->maskp, - numa_all_nodes_ptr->size, + numa_mems_allowed->maskp, + numa_mems_allowed->size, MPOL_MF_MOVE); if (st != 0) { ib::warn() << "Failed to set NUMA memory policy of" @@ -1711,12 +1767,25 @@ buf_chunk_not_freed( file pages. */ break; case BUF_BLOCK_FILE_PAGE: + if (srv_read_only_mode) { + /* The page cleaner is disabled in + read-only mode. No pages can be + dirtied, so all of them must be clean. */ + ut_ad(block->page.oldest_modification + == block->page.newest_modification); + ut_ad(block->page.oldest_modification == 0 + || block->page.oldest_modification + == recv_sys->recovered_lsn); + ut_ad(block->page.buf_fix_count == 0); + ut_ad(block->page.io_fix == BUF_IO_NONE); + break; + } + buf_page_mutex_enter(block); ready = buf_flush_ready_for_replace(&block->page); buf_page_mutex_exit(block); if (!ready) { - return(block); } @@ -2504,7 +2573,6 @@ buf_pool_withdraw_blocks( /* retry is not needed */ ++buf_withdraw_clock; - os_wmb; return(false); } @@ -3397,6 +3465,11 @@ page_found: buf_pool->watch[]. However, it is not in the critical code path as this function will be called only by the purge thread. */ +/* Enable this for checksum error messages. Currently on by +default on UNIV_DEBUG for encryption bugs. */ +#ifdef UNIV_DEBUG +#define UNIV_DEBUG_LEVEL2 1 +#endif /* To obey latching order first release the hash_lock. */ rw_lock_x_unlock(*hash_lock); @@ -3846,7 +3919,6 @@ buf_block_init_low( buf_block_t* block) /*!< in: block to init */ { block->index = NULL; - block->made_dirty_with_no_latch = false; block->skip_flush_check = false; block->n_hash_helps = 0; @@ -3854,7 +3926,6 @@ buf_block_init_low( block->n_bytes = 0; block->left_side = TRUE; } -#endif /* !UNIV_HOTBACKUP */ /********************************************************************//** Decompress a block. @@ -3925,7 +3996,6 @@ buf_zip_decompress( return(FALSE); } -#ifndef UNIV_HOTBACKUP /** Get a buffer block from an adaptive hash index pointer. This function does not return if the block is not identified. @param[in] ptr pointer to within a page frame @@ -3939,14 +4009,17 @@ buf_block_from_ahi(const byte* ptr) ut_ad(buf_chunk_map_ref == buf_chunk_map_reg); ut_ad(!buf_pool_resizing); - const byte* bound = reinterpret_cast(ptr) - > srv_buf_pool_chunk_unit - ? ptr - srv_buf_pool_chunk_unit : 0; - it = chunk_map->upper_bound(bound); + buf_chunk_t* chunk; + it = chunk_map->upper_bound(ptr); - ut_a(it != chunk_map->end()); + ut_a(it != chunk_map->begin()); + + if (it == chunk_map->end()) { + chunk = chunk_map->rbegin()->second; + } else { + chunk = (--it)->second; + } - buf_chunk_t* chunk = it->second; ulint offs = ptr - chunk->blocks->frame; offs >>= UNIV_PAGE_SIZE_SHIFT; @@ -4112,9 +4185,6 @@ BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH @param[in] file file name @param[in] line line where called @param[in] mtr mini-transaction -@param[in] dirty_with_no_latch - mark page as dirty even if page - is being pinned without any latch @return pointer to the block or NULL */ buf_block_t* buf_page_get_gen( @@ -4126,8 +4196,7 @@ buf_page_get_gen( const char* file, ulint line, mtr_t* mtr, - dberr_t* err, - bool dirty_with_no_latch) + dberr_t* err) { buf_block_t* block; unsigned access_time; @@ -4292,7 +4361,7 @@ loop: mutex_enter(pmutex); ut_ad(buf_pool->n_pend_reads > 0); - os_atomic_decrement_ulint(&buf_pool->n_pend_reads, 1); + my_atomic_addlint(&buf_pool->n_pend_reads, -1); buf_page_set_io_fix(bpage, BUF_IO_NONE); mutex_exit(pmutex); buf_LRU_free_page(bpage, true); @@ -4339,7 +4408,7 @@ loop: mutex_enter(pmutex); ut_ad(buf_pool->n_pend_reads > 0); - os_atomic_decrement_ulint(&buf_pool->n_pend_reads, 1); + my_atomic_addlint(&buf_pool->n_pend_reads, -1); buf_page_set_io_fix(bpage, BUF_IO_NONE); mutex_exit(pmutex); buf_LRU_free_page(bpage, true); @@ -4410,11 +4479,9 @@ got_block: bpage = &block->page; if (fsp_is_system_temporary(page_id.space()) && buf_page_get_io_fix(bpage) != BUF_IO_NONE) { - /* This suggest that page is being flushed. + /* This suggests that the page is being flushed. Avoid returning reference to this page. - Instead wait for flush action to complete. - For normal page this sync is done using SX - lock but for intrinsic there is no latching. */ + Instead wait for the flush action to complete. */ buf_block_unfix(fix_block); os_thread_sleep(WAIT_FOR_WRITE); goto loop; @@ -4739,17 +4806,6 @@ got_block: and block->lock. */ buf_wait_for_read(fix_block); - /* Mark block as dirty if requested by caller. If not requested (false) - then we avoid updating the dirty state of the block and retain the - original one. This is reason why ? - Same block can be shared/pinned by 2 different mtrs. If first mtr - set the dirty state to true and second mtr mark it as false the last - updated dirty state is retained. Which means we can loose flushing of - a modified block. */ - if (dirty_with_no_latch) { - fix_block->made_dirty_with_no_latch = dirty_with_no_latch; - } - mtr_memo_type_t fix_type; switch (rw_latch) { @@ -5126,6 +5182,7 @@ buf_page_init_low( bpage->flush_type = BUF_FLUSH_LRU; bpage->io_fix = BUF_IO_NONE; bpage->buf_fix_count = 0; + bpage->old = 0; bpage->freed_page_clock = 0; bpage->access_time = 0; bpage->newest_modification = 0; @@ -5199,8 +5256,7 @@ buf_page_init( ut_a(buf_fix_count > 0); - os_atomic_increment_uint32(&block->page.buf_fix_count, - buf_fix_count); + my_atomic_add32((int32*) &block->page.buf_fix_count, buf_fix_count); buf_pool_watch_remove(buf_pool, hash_page); } else { @@ -5439,8 +5495,7 @@ buf_page_init_for_read( ut_a(buf_fix_count > 0); - os_atomic_increment_uint32( - &bpage->buf_fix_count, buf_fix_count); + my_atomic_add32((int32*) &bpage->buf_fix_count, buf_fix_count); ut_ad(buf_pool_watch_is_sentinel(buf_pool, watch_page)); buf_pool_watch_remove(buf_pool, watch_page); @@ -5796,16 +5851,16 @@ buf_page_check_corrupt( { byte* dst_frame = (bpage->zip.data) ? bpage->zip.data : ((buf_block_t*) bpage)->frame; - unsigned key_version = bpage->key_version; bool page_compressed = bpage->page_encrypted; ulint stored_checksum = bpage->stored_checksum; - ulint calculated_checksum = bpage->stored_checksum; + ulint calculated_checksum = bpage->calculated_checksum; bool page_compressed_encrypted = bpage->page_compressed; ulint space_id = mach_read_from_4( dst_frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space_id); fil_space_t* space = fil_space_found_by_id(space_id); bool corrupted = true; + ulint key_version = bpage->key_version; if (key_version != 0 || page_compressed_encrypted) { bpage->encrypted = true; @@ -5895,7 +5950,7 @@ buf_page_io_complete( if (io_type == BUF_IO_READ) { ulint read_page_no; ulint read_space_id; - byte* frame; + byte* frame = NULL; bool compressed_page=false; ut_ad(bpage->zip.data != NULL || ((buf_block_t*)bpage)->frame != NULL); @@ -5907,7 +5962,15 @@ buf_page_io_complete( } else { frame = ((buf_block_t*) bpage)->frame; } - goto corrupt; + + ib::info() << "Page " + << bpage->id + << " in tablespace " + << bpage->space + << " encryption error key_version " + << bpage->key_version; + + goto database_corrupted; } if (bpage->size.is_compressed()) { @@ -5920,7 +5983,14 @@ buf_page_io_complete( buf_pool->n_pend_unzip--; compressed_page = false; - goto corrupt; + + ib::info() << "Page " + << bpage->id + << " in tablespace " + << bpage->space + << " zip_decompress failure."; + + goto database_corrupted; } buf_pool->n_pend_unzip--; } else { @@ -6009,7 +6079,7 @@ buf_page_io_complete( } goto page_not_corrupt; ;); -corrupt: +database_corrupted: bool corrupted = buf_page_check_corrupt(bpage); /* Compressed and encrypted pages are basically gibberish avoid @@ -6049,6 +6119,7 @@ corrupt: return(false); } else { corrupted = buf_page_check_corrupt(bpage); + ulint key_version = bpage->key_version; if (corrupted) { ib::fatal() @@ -6065,7 +6136,7 @@ corrupt: "However key management plugin or used key_id %u is not found or" " used encryption algorithm or method does not match." " Can't continue opening the table.", - (ulint)bpage->space, bpage->key_version); + (ulint)bpage->space, key_version); buf_page_print(frame, bpage->size, BUF_PAGE_PRINT_NO_CRASH); @@ -6094,7 +6165,7 @@ corrupt: #endif /* MYSQL_COMPRESSION */ && !recv_no_ibuf_operations && !Tablespace::is_undo_tablespace(bpage->id.space()) - && bpage->id.space() != srv_tmp_space.space_id() + && bpage->id.space() != SRV_TMP_SPACE_ID && !srv_is_tablespace_truncated(bpage->id.space()) && fil_page_get_type(frame) == FIL_PAGE_INDEX && page_is_leaf(frame)) { @@ -7256,57 +7327,6 @@ buf_pool_check_no_pending_io(void) return(pending_io); } -#if 0 -Code currently not used -/*********************************************************************//** -Gets the current length of the free list of buffer blocks. -@return length of the free list */ -ulint -buf_get_free_list_len(void) -/*=======================*/ -{ - ulint len; - - buf_pool_mutex_enter(buf_pool); - - len = UT_LIST_GET_LEN(buf_pool->free); - - buf_pool_mutex_exit(buf_pool); - - return(len); -} -#endif - -#else /* !UNIV_HOTBACKUP */ - -/** Inits a page to the buffer buf_pool, for use in mysqlbackup --restore. -@param[in] page_id page id -@param[in] page_size page size -@param[in,out] block block to init */ -void -buf_page_init_for_backup_restore( - const page_id_t& page_id, - const page_size_t& page_size, - buf_block_t* block) -{ - block->page.state = BUF_BLOCK_FILE_PAGE; - block->page.id = page_id; - block->page.size.copy_from(page_size); - - page_zip_des_init(&block->page.zip); - - /* We assume that block->page.data has been allocated - with page_size == univ_page_size. */ - if (page_size.is_compressed()) { - page_zip_set_size(&block->page.zip, page_size.physical()); - block->page.zip.data = block->frame + page_size.logical(); - } else { - page_zip_set_size(&block->page.zip, 0); - } -} - -#endif /* !UNIV_HOTBACKUP */ - /** Print the given page_id_t object. @param[in,out] out the output stream @param[in] page_id the page_id_t object to be printed @@ -7436,12 +7456,12 @@ buf_page_encrypt_before_write( return src_frame; } - if (crypt_data != NULL && crypt_data->encryption == FIL_SPACE_ENCRYPTION_OFF) { + if (crypt_data != NULL && crypt_data->not_encrypted()) { /* Encryption is disabled */ encrypted = false; } - if (!srv_encrypt_tables && (crypt_data == NULL || crypt_data->encryption == FIL_SPACE_ENCRYPTION_DEFAULT)) { + if (!srv_encrypt_tables && (crypt_data == NULL || crypt_data->is_default_encryption())) { /* Encryption is disabled */ encrypted = false; } @@ -7546,6 +7566,35 @@ buf_page_decrypt_after_read( bool page_compressed_encrypted = fil_page_is_compressed_encrypted(dst_frame); buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); bool success = true; + ulint space_id = mach_read_from_4( + dst_frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); + fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space_id); + + /* Page is encrypted if encryption information is found from + tablespace and page contains used key_version. This is true + also for pages first compressed and then encrypted. */ + if (!crypt_data || + (crypt_data && + crypt_data->type == CRYPT_SCHEME_UNENCRYPTED && + key_version != 0)) { + byte* frame = NULL; + + if (bpage->size.is_compressed()) { + frame = bpage->zip.data; + } else { + frame = ((buf_block_t*) bpage)->frame; + } + + /* If page is not corrupted at this point, page can't be + encrypted, thus set key_version to 0. If page is corrupted, + we assume at this point that it is encrypted as page + contained key_version != 0. Note that page could still be + really corrupted. This we will find out after decrypt by + checking page checksums. */ + if (!buf_page_is_corrupted(false, frame, bpage->size, false)) { + key_version = 0; + } + } /* If page is encrypted read post-encryption checksum */ if (!page_compressed_encrypted && key_version != 0) { @@ -7650,4 +7699,3 @@ buf_page_decrypt_after_read( return (success); } #endif /* !UNIV_INNOCHECKSUM */ - diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index ff1d2057e6a..5f46576ad7e 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -40,8 +40,6 @@ Created 2011/12/19 #include "fil0crypt.h" #include "fil0pagecompress.h" -#ifndef UNIV_HOTBACKUP - /** The doublewrite buffer */ buf_dblwr_t* buf_dblwr = NULL; @@ -1195,7 +1193,6 @@ try_again: } else { ut_a(buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE); - UNIV_MEM_ASSERT_RW(frame, bpage->size.logical()); @@ -1360,4 +1357,3 @@ retry: blocks. Next do the write to the intended position. */ buf_dblwr_write_block_to_datafile(bpage, sync); } -#endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 26e0da4e371..b82c4db18ad 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -41,7 +41,6 @@ Created 11/11/1995 Heikki Tuuri #include "srv0start.h" #include "srv0srv.h" #include "page0zip.h" -#ifndef UNIV_HOTBACKUP #include "ut0byte.h" #include "page0page.h" #include "fil0fil.h" @@ -806,7 +805,6 @@ buf_flush_write_complete( buf_dblwr_update(bpage, flush_type); } -#endif /* !UNIV_HOTBACKUP */ /** Calculate the checksum of a page from compressed table and update the page. @@ -995,7 +993,6 @@ buf_flush_init_for_writing( checksum); } -#ifndef UNIV_HOTBACKUP /********************************************************************//** Does an asynchronous write of a buffer page. NOTE: in simulated aio and also when the doublewrite buffer is used, we must call @@ -2264,8 +2261,6 @@ buf_flush_single_page_from_LRU( scanned); } - - ut_ad(!buf_pool_mutex_own(buf_pool)); return(freed); } @@ -2521,7 +2516,6 @@ page_cleaner_flush_pages_recommendation( lsn_avg_rate = (lsn_avg_rate + lsn_rate) / 2; - /* aggregate stats of all slots */ mutex_enter(&page_cleaner->mutex); @@ -3237,7 +3231,8 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)( if (ret_sleep == OS_SYNC_TIME_EXCEEDED) { ulint curr_time = ut_time_ms(); - if (curr_time > next_loop_time + 3000) { + if (curr_time > next_loop_time + 3000 + && !(test_flags & TEST_SIGINT)) { if (warn_count == 0) { ib::info() << "page_cleaner: 1000ms" " intended loop took " @@ -3678,7 +3673,6 @@ buf_flush_validate( } #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ -#endif /* !UNIV_HOTBACKUP */ /******************************************************************//** Check if there are any dirty pages that belong to a space id in the flush diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index 5d2077763a6..6a57e6746ff 100644 --- a/storage/innobase/buf/buf0lru.cc +++ b/storage/innobase/buf/buf0lru.cc @@ -28,7 +28,6 @@ Created 11/5/1995 Heikki Tuuri #include "buf0lru.ic" #endif /* UNIV_NOINL */ -#ifndef UNIV_HOTBACKUP #include "ut0byte.h" #include "ut0rnd.h" #include "sync0rw.h" @@ -2791,4 +2790,3 @@ buf_LRU_print(void) } } #endif /* UNIV_DEBUG_PRINT || UNIV_DEBUG || UNIV_BUF_DEBUG */ -#endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/data/data0data.cc b/storage/innobase/data/data0data.cc index 4b788c8952c..0ccf5868d14 100644 --- a/storage/innobase/data/data0data.cc +++ b/storage/innobase/data/data0data.cc @@ -31,7 +31,6 @@ Created 5/30/1994 Heikki Tuuri #include "data0data.ic" #endif -#ifndef UNIV_HOTBACKUP #include "rem0rec.h" #include "rem0cmp.h" #include "page0page.h" @@ -40,8 +39,6 @@ Created 5/30/1994 Heikki Tuuri #include "btr0cur.h" #include "row0upd.h" -#endif /* !UNIV_HOTBACKUP */ - #ifdef UNIV_DEBUG /** Dummy variable to catch access to uninitialized fields. In the debug version, dtuple_create() will make all fields of dtuple_t point @@ -54,7 +51,6 @@ ulint data_dummy; # endif /* !UNIV_DEBUG_VALGRIND */ #endif /* UNIV_DEBUG */ -#ifndef UNIV_HOTBACKUP /** Compare two data tuples. @param[in] tuple1 first data tuple @param[in] tuple2 second data tuple @@ -159,7 +155,6 @@ dump: return(TRUE); } -#endif /* !UNIV_HOTBACKUP */ #ifdef UNIV_DEBUG /**********************************************************//** @@ -255,7 +250,6 @@ dtuple_validate( } #endif /* UNIV_DEBUG */ -#ifndef UNIV_HOTBACKUP /*************************************************************//** Pretty prints a dfield value according to its data type. */ void @@ -848,4 +842,3 @@ dfield_t::clone( return(obj); } -#endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/data/data0type.cc b/storage/innobase/data/data0type.cc index 8fb3761531c..cad165d1489 100644 --- a/storage/innobase/data/data0type.cc +++ b/storage/innobase/data/data0type.cc @@ -31,7 +31,6 @@ Created 1/16/1996 Heikki Tuuri #include "data0type.ic" #endif -#ifndef UNIV_HOTBACKUP /* At the database startup we store the default-charset collation number of this MySQL installation to this global variable. If we have < 4.1.2 format column definitions, or records in the insert buffer, we use this @@ -78,7 +77,6 @@ dtype_get_at_most_n_mbchars( return(data_len); } -#endif /* UNIV_HOTBACKUP */ /*********************************************************************//** Checks if a data main type is a string type. Also a BLOB is considered a @@ -174,14 +172,11 @@ dtype_validate( ut_a((type->prtype & DATA_MYSQL_TYPE_MASK) < DATA_N_SYS_COLS); } -#ifndef UNIV_HOTBACKUP ut_a(dtype_get_mbminlen(type) <= dtype_get_mbmaxlen(type)); -#endif /* !UNIV_HOTBACKUP */ return(TRUE); } -#ifndef UNIV_HOTBACKUP /*********************************************************************//** Prints a data type structure. */ void @@ -299,4 +294,3 @@ dtype_print( fprintf(stderr, " len %lu", (ulong) len); } -#endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc index 31952424119..cfea64d51c2 100644 --- a/storage/innobase/dict/dict0crea.cc +++ b/storage/innobase/dict/dict0crea.cc @@ -461,7 +461,7 @@ dict_build_tablespace_for_table( bool needs_file_per_table; char* filepath; - ut_ad(mutex_own(&dict_sys->mutex) || dict_table_is_intrinsic(table)); + ut_ad(mutex_own(&dict_sys->mutex)); needs_file_per_table = DICT_TF2_FLAG_IS_SET(table, DICT_TF2_USE_FILE_PER_TABLE); @@ -571,8 +571,7 @@ dict_build_tablespace_for_table( supports Redundant and Compact */ ut_ad(dict_tf_get_rec_format(table->flags) != REC_FORMAT_COMPRESSED); - table->space = static_cast( - srv_tmp_space.space_id()); + table->space = SRV_TMP_SPACE_ID; } else { /* Create in the system tablespace. */ ut_ad(table->space == srv_sys_space.space_id()); @@ -920,7 +919,7 @@ dict_build_index_def( dict_index_t* index, /*!< in/out: index */ trx_t* trx) /*!< in/out: InnoDB transaction handle */ { - ut_ad(mutex_own(&dict_sys->mutex) || dict_table_is_intrinsic(table)); + ut_ad(mutex_own(&dict_sys->mutex)); if (trx->table_id == 0) { /* Record only the first table id. */ @@ -930,18 +929,7 @@ dict_build_index_def( ut_ad((UT_LIST_GET_LEN(table->indexes) > 0) || dict_index_is_clust(index)); - if (!dict_table_is_intrinsic(table)) { - dict_hdr_get_new_id(NULL, &index->id, NULL, table, false); - } else { - /* Index are re-loaded in process of creation using id. - If same-id is used for all indexes only first index will always - be retrieved when expected is iterative return of all indexes*/ - if (UT_LIST_GET_LEN(table->indexes) > 0) { - index->id = UT_LIST_GET_LAST(table->indexes)->id + 1; - } else { - index->id = 1; - } - } + dict_hdr_get_new_id(NULL, &index->id, NULL, table, false); /* Inherit the space id from the table; we store all indexes of a table in the same tablespace */ @@ -1061,8 +1049,7 @@ dict_create_index_tree_in_mem( mtr_t mtr; ulint page_no = FIL_NULL; - ut_ad(mutex_own(&dict_sys->mutex) - || dict_table_is_intrinsic(index->table)); + ut_ad(mutex_own(&dict_sys->mutex)); if (index->type == DICT_FTS) { /* FTS index does not need an index tree */ @@ -1175,8 +1162,7 @@ dict_drop_index_tree_in_mem( const dict_index_t* index, /*!< in: index */ ulint page_no) /*!< in: index page-no */ { - ut_ad(mutex_own(&dict_sys->mutex) - || dict_table_is_intrinsic(index->table)); + ut_ad(mutex_own(&dict_sys->mutex)); ut_ad(dict_table_is_temporary(index->table)); ulint root_page_no = page_no; @@ -1295,8 +1281,7 @@ dict_truncate_index_tree_in_mem( bool truncate; ulint space = index->space; - ut_ad(mutex_own(&dict_sys->mutex) - || dict_table_is_intrinsic(index->table)); + ut_ad(mutex_own(&dict_sys->mutex)); ut_ad(dict_table_is_temporary(index->table)); ulint type = index->type; @@ -2203,7 +2188,6 @@ Add a foreign key definition to the data dictionary tables. dberr_t dict_create_add_foreign_to_dictionary( /*==================================*/ - dict_table_t* table, /*!< in: table */ const char* name, /*!< in: table name */ const dict_foreign_t* foreign,/*!< in: foreign key */ trx_t* trx) /*!< in/out: dictionary transaction */ @@ -2245,8 +2229,7 @@ dict_create_add_foreign_to_dictionary( char* fk_def; innobase_convert_name(tablename, MAX_TABLE_NAME_LEN, - table->name.m_name, strlen(table->name.m_name), - trx->mysql_thd); + name, strlen(name), trx->mysql_thd); innobase_convert_name(buf, MAX_TABLE_NAME_LEN, foreign->id, strlen(foreign->id), trx->mysql_thd); @@ -2277,8 +2260,7 @@ dict_create_add_foreign_to_dictionary( char* fk_def; innobase_convert_name(tablename, MAX_TABLE_NAME_LEN, - table->name.m_name, strlen(table->name.m_name), - trx->mysql_thd); + name, strlen(name), trx->mysql_thd); innobase_convert_name(buf, MAX_TABLE_NAME_LEN, foreign->id, strlen(foreign->id), trx->mysql_thd); fk_def = dict_foreign_def_get((dict_foreign_t*)foreign, trx); @@ -2509,12 +2491,7 @@ dict_create_add_foreigns_to_dictionary( dict_foreign_t* foreign; dberr_t error; - ut_ad(mutex_own(&dict_sys->mutex) - || dict_table_is_intrinsic(table)); - - if (dict_table_is_intrinsic(table)) { - goto exit_loop; - } + ut_ad(mutex_own(&dict_sys->mutex)); if (NULL == dict_table_get_low("SYS_FOREIGN")) { @@ -2532,7 +2509,7 @@ dict_create_add_foreigns_to_dictionary( ut_ad(foreign->id != NULL); error = dict_create_add_foreign_to_dictionary( - (dict_table_t*)table, table->name.m_name, foreign, trx); + table->name.m_name, foreign, trx); if (error != DB_SUCCESS) { @@ -2540,7 +2517,6 @@ dict_create_add_foreigns_to_dictionary( } } -exit_loop: trx->op_info = "committing foreign key definitions"; if (trx_is_started(trx)) { @@ -2796,14 +2772,6 @@ dict_table_assign_new_id( dict_table_t* table, trx_t* trx) { - if (dict_table_is_intrinsic(table)) { - /* There is no significance of this table->id (if table is - intrinsic) so assign it default instead of something meaningful - to avoid confusion.*/ - table->id = ULINT_UNDEFINED; - } else { - dict_hdr_get_new_id(&table->id, NULL, NULL, table, false); - } - + dict_hdr_get_new_id(&table->id, NULL, NULL, table, false); trx->table_id = table->id; } diff --git a/storage/innobase/dict/dict0defrag_bg.cc b/storage/innobase/dict/dict0defrag_bg.cc index 82aa3abcde6..3f3eefc6acf 100644 --- a/storage/innobase/dict/dict0defrag_bg.cc +++ b/storage/innobase/dict/dict0defrag_bg.cc @@ -43,10 +43,6 @@ static ib_mutex_t defrag_pool_mutex; static mysql_pfs_key_t defrag_pool_mutex_key; #endif -/** The number of tables that can be added to "defrag_pool" before -it is enlarged */ -static const ulint DEFRAG_POOL_INITIAL_SLOTS = 128; - /** Indices whose defrag stats need to be saved to persistent storage.*/ struct defrag_pool_item_t { table_id_t table_id; diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index 6a33de63b69..37c6341a293 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -55,7 +55,6 @@ Issue a warning that the row is too big. */ void ib_warn_row_too_big(const dict_table_t* table); -#ifndef UNIV_HOTBACKUP #include "btr0btr.h" #include "btr0cur.h" #include "btr0sea.h" @@ -502,21 +501,15 @@ dict_table_close( indexes after an aborted online index creation */ { - if (!dict_locked && !dict_table_is_intrinsic(table)) { + if (!dict_locked) { mutex_enter(&dict_sys->mutex); } - ut_ad(mutex_own(&dict_sys->mutex) || dict_table_is_intrinsic(table)); + ut_ad(mutex_own(&dict_sys->mutex)); ut_a(table->get_ref_count() > 0); table->release(); - /* Intrinsic table is not added to dictionary cache so skip other - cache specific actions. */ - if (dict_table_is_intrinsic(table)) { - return; - } - /* Force persistent stats re-read upon next open of the table so that FLUSH TABLE can be used to forcibly fetch stats from disk if they have been manually modified. We reset table->stat_initialized @@ -557,7 +550,6 @@ dict_table_close( } } } -#endif /* !UNIV_HOTBACKUP */ /********************************************************************//** Closes the only open handle to a table and drops a table while assuring @@ -660,41 +652,6 @@ dict_table_get_col_name( return(s); } -/**********************************************************************//** -Returns a column's name. -@return column name. NOTE: not guaranteed to stay valid if table is -modified in any way (columns added, etc.). */ -UNIV_INTERN -const char* -dict_table_get_col_name_for_mysql( -/*==============================*/ - const dict_table_t* table, /*!< in: table */ - const char* col_name)/*! in: MySQL table column name */ -{ - ulint i; - const char* s; - - ut_ad(table); - ut_ad(col_name); - ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); - - s = table->col_names; - if (s) { - /* If we have many virtual columns MySQL key_part->fieldnr - could be larger than number of columns in InnoDB table - when creating new indexes. */ - for (i = 0; i < table->n_def; i++) { - - if (!innobase_strcasecmp(s, col_name)) { - break; /* Found */ - } - s += strlen(s) + 1; - } - } - - return(s); -} - /** Returns a virtual column's name. @param[in] table target table @param[in] col_nr virtual column number (nth virtual column) @@ -794,7 +751,6 @@ dict_table_get_nth_v_col_mysql( return(dict_table_get_nth_v_col(table, i)); } -#ifndef UNIV_HOTBACKUP /** Allocate and init the autoinc latch of a given table. This function must not be called concurrently on the same table object. @param[in,out] table_void table whose autoinc latch to create */ @@ -823,7 +779,6 @@ dict_index_zip_pad_alloc( mutex_create(LATCH_ID_ZIP_PAD_MUTEX, index->zip_pad.mutex); } - /********************************************************************//** Acquire the autoinc lock. */ void @@ -851,20 +806,6 @@ dict_index_zip_pad_lock( mutex_enter(index->zip_pad.mutex); } - -/********************************************************************//** -Unconditionally set the autoinc counter. */ -void -dict_table_autoinc_initialize( -/*==========================*/ - dict_table_t* table, /*!< in/out: table */ - ib_uint64_t value) /*!< in: next value to assign to a row */ -{ - ut_ad(dict_table_autoinc_own(table)); - - table->autoinc = value; -} - /** Get all the FTS indexes on a table. @param[in] table table @param[out] indexes all FTS indexes on this table @@ -890,75 +831,6 @@ dict_table_get_all_fts_indexes( return(ib_vector_size(indexes)); } -/** Store autoinc value when the table is evicted. -@param[in] table table evicted */ -void -dict_table_autoinc_store( - const dict_table_t* table) -{ - ut_ad(mutex_own(&dict_sys->mutex)); - - if (table->autoinc != 0) { - ut_ad(dict_sys->autoinc_map->find(table->id) - == dict_sys->autoinc_map->end()); - - dict_sys->autoinc_map->insert( - std::pair( - table->id, table->autoinc)); - } -} - -/** Restore autoinc value when the table is loaded. -@param[in] table table loaded */ -void -dict_table_autoinc_restore( - dict_table_t* table) -{ - ut_ad(mutex_own(&dict_sys->mutex)); - - autoinc_map_t::iterator it; - it = dict_sys->autoinc_map->find(table->id); - - if (it != dict_sys->autoinc_map->end()) { - table->autoinc = it->second; - ut_ad(table->autoinc != 0); - - dict_sys->autoinc_map->erase(it); - } -} - -/********************************************************************//** -Reads the next autoinc value (== autoinc counter value), 0 if not yet -initialized. -@return value for a new row, or 0 */ -ib_uint64_t -dict_table_autoinc_read( -/*====================*/ - const dict_table_t* table) /*!< in: table */ -{ - ut_ad(dict_table_autoinc_own(table)); - - return(table->autoinc); -} - -/********************************************************************//** -Updates the autoinc counter if the value supplied is greater than the -current value. */ -void -dict_table_autoinc_update_if_greater( -/*=================================*/ - - dict_table_t* table, /*!< in/out: table */ - ib_uint64_t value) /*!< in: value which was assigned to a row */ -{ - ut_ad(dict_table_autoinc_own(table)); - - if (value > table->autoinc) { - - table->autoinc = value; - } -} - /********************************************************************//** Release the autoinc lock. */ void @@ -968,7 +840,6 @@ dict_table_autoinc_unlock( { mutex_exit(table->autoinc_mutex); } -#endif /* !UNIV_HOTBACKUP */ /** Looks for column n in an index. @param[in] index index @@ -1027,7 +898,6 @@ dict_index_get_nth_col_or_prefix_pos( return(ULINT_UNDEFINED); } -#ifndef UNIV_HOTBACKUP /** Returns TRUE if the index contains a column or a prefix of that column. @param[in] index index @param[in] n column number @@ -1253,8 +1123,6 @@ dict_init(void) } mutex_create(LATCH_ID_DICT_FOREIGN_ERR, &dict_foreign_err_mutex); - - dict_sys->autoinc_map = new autoinc_map_t(); } /**********************************************************************//** @@ -1368,7 +1236,6 @@ dict_table_open_on_name( DBUG_RETURN(table); } -#endif /* !UNIV_HOTBACKUP */ /**********************************************************************//** Adds system columns to a table object. */ @@ -1388,18 +1255,12 @@ dict_table_add_system_columns( (so that they can be indexed by the numerical value of DATA_ROW_ID, etc.) and as the last columns of the table memory object. The clustered index will not always physically contain all system - columns. - Intrinsic table don't need DB_ROLL_PTR as UNDO logging is turned off - for these tables. */ + columns. */ dict_mem_table_add_col(table, heap, "DB_ROW_ID", DATA_SYS, DATA_ROW_ID | DATA_NOT_NULL, DATA_ROW_ID_LEN); -#if (DATA_ITT_N_SYS_COLS != 2) -#error "DATA_ITT_N_SYS_COLS != 2" -#endif - #if DATA_ROW_ID != 0 #error "DATA_ROW_ID != 0" #endif @@ -1410,23 +1271,20 @@ dict_table_add_system_columns( #error "DATA_TRX_ID != 1" #endif - if (!dict_table_is_intrinsic(table)) { - dict_mem_table_add_col(table, heap, "DB_ROLL_PTR", DATA_SYS, - DATA_ROLL_PTR | DATA_NOT_NULL, - DATA_ROLL_PTR_LEN); + dict_mem_table_add_col(table, heap, "DB_ROLL_PTR", DATA_SYS, + DATA_ROLL_PTR | DATA_NOT_NULL, + DATA_ROLL_PTR_LEN); #if DATA_ROLL_PTR != 2 #error "DATA_ROLL_PTR != 2" #endif - /* This check reminds that if a new system column is added to - the program, it should be dealt with here */ + /* This check reminds that if a new system column is added to + the program, it should be dealt with here */ #if DATA_N_SYS_COLS != 3 #error "DATA_N_SYS_COLS != 3" #endif - } } -#ifndef UNIV_HOTBACKUP /** Mark if table has big rows. @param[in,out] table table handler */ void @@ -1526,8 +1384,6 @@ dict_table_add_to_cache( UT_LIST_ADD_FIRST(dict_sys->table_non_LRU, table); } - dict_table_autoinc_restore(table); - ut_ad(dict_lru_validate()); dict_sys->size += mem_heap_get_size(table->heap) @@ -1750,6 +1606,7 @@ struct dict_foreign_remove_partial if (table != NULL) { table->referenced_set.erase(foreign); } + dict_foreign_free(foreign); } }; @@ -2262,10 +2119,6 @@ dict_table_remove_from_cache_low( ut_ad(dict_lru_validate()); - if (lru_evict) { - dict_table_autoinc_store(table); - } - if (lru_evict && table->drop_aborted) { /* Do as dict_table_try_drop_aborted() does. */ @@ -2654,7 +2507,7 @@ dict_index_add_to_cache_w_vcol( ulint i; ut_ad(index); - ut_ad(mutex_own(&dict_sys->mutex) || dict_table_is_intrinsic(table)); + ut_ad(mutex_own(&dict_sys->mutex)); ut_ad(index->n_def == index->n_fields); ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); ut_ad(!dict_index_is_online_ddl(index)); @@ -2687,9 +2540,10 @@ dict_index_add_to_cache_w_vcol( new_index->n_fields = new_index->n_def; new_index->trx_id = index->trx_id; new_index->set_committed(index->is_committed()); - new_index->allow_duplicates = index->allow_duplicates; new_index->nulls_equal = index->nulls_equal; +#ifdef MYSQL_INDEX_DISABLE_AHI new_index->disable_ahi = index->disable_ahi; +#endif if (dict_index_too_big_for_tree(table, new_index, strict)) { @@ -2771,39 +2625,7 @@ dict_index_add_to_cache_w_vcol( rw_lock_create(index_tree_rw_lock_key, &new_index->lock, SYNC_INDEX_TREE); - /* Intrinsic table are not added to dictionary cache instead are - cached to session specific thread cache. */ - if (!dict_table_is_intrinsic(table)) { - dict_sys->size += mem_heap_get_size(new_index->heap); - } - - /* Check if key part of the index is unique. */ - if (dict_table_is_intrinsic(table)) { - - new_index->rec_cache.fixed_len_key = true; - for (i = 0; i < new_index->n_uniq; i++) { - - const dict_field_t* field; - field = dict_index_get_nth_field(new_index, i); - - if (!field->fixed_len) { - new_index->rec_cache.fixed_len_key = false; - break; - } - } - - new_index->rec_cache.key_has_null_cols = false; - for (i = 0; i < new_index->n_uniq; i++) { - - const dict_field_t* field; - field = dict_index_get_nth_field(new_index, i); - - if (!(field->col->prtype & DATA_NOT_NULL)) { - new_index->rec_cache.key_has_null_cols = true; - break; - } - } - } + dict_sys->size += mem_heap_get_size(new_index->heap); dict_mem_index_free(index); @@ -2926,7 +2748,6 @@ dict_index_remove_from_cache_low( size = mem_heap_get_size(index->heap); - ut_ad(!dict_table_is_intrinsic(table)); ut_ad(dict_sys->size >= size); dict_sys->size -= size; @@ -2963,7 +2784,7 @@ dict_index_find_cols( ut_ad(table != NULL && index != NULL); ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); - ut_ad(mutex_own(&dict_sys->mutex) || dict_table_is_intrinsic(table)); + ut_ad(mutex_own(&dict_sys->mutex)); for (ulint i = 0; i < index->n_fields; i++) { ulint j; @@ -3045,7 +2866,6 @@ found: return(TRUE); } -#endif /* !UNIV_HOTBACKUP */ /*******************************************************************//** Adds a column to index. */ @@ -3128,7 +2948,6 @@ dict_index_add_col( } } -#ifndef UNIV_HOTBACKUP /*******************************************************************//** Copies fields contained in index2 to index1. */ static @@ -3285,7 +3104,7 @@ dict_index_build_internal_clust( ut_ad(dict_index_is_clust(index)); ut_ad(!dict_index_is_ibuf(index)); - ut_ad(mutex_own(&dict_sys->mutex) || dict_table_is_intrinsic(table)); + ut_ad(mutex_own(&dict_sys->mutex)); ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); /* Create a new index object with certainly enough fields */ @@ -3342,7 +3161,6 @@ dict_index_build_internal_clust( new_index, table, dict_table_get_sys_col(table, DATA_TRX_ID), 0); - for (i = 0; i < trx_id_pos; i++) { ulint fixed_size = dict_col_get_fixed_size( @@ -3379,16 +3197,9 @@ dict_index_build_internal_clust( } } - /* UNDO logging is turned-off for intrinsic table and so - DATA_ROLL_PTR system columns are not added as default system - columns to such tables. */ - if (!dict_table_is_intrinsic(table)) { - - dict_index_add_col( - new_index, table, - dict_table_get_sys_col(table, DATA_ROLL_PTR), - 0); - } + dict_index_add_col( + new_index, table, + dict_table_get_sys_col(table, DATA_ROLL_PTR), 0); /* Remember the table columns already contained in new_index */ indexed = static_cast( @@ -3451,7 +3262,7 @@ dict_index_build_internal_non_clust( ut_ad(table && index); ut_ad(!dict_index_is_clust(index)); ut_ad(!dict_index_is_ibuf(index)); - ut_ad(mutex_own(&dict_sys->mutex) || dict_table_is_intrinsic(table)); + ut_ad(mutex_own(&dict_sys->mutex)); ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); /* The clustered index should be the first in the list of indexes */ @@ -3667,7 +3478,6 @@ dict_foreign_find( return(NULL); } - /*********************************************************************//** Tries to find an index whose first fields are the columns in the array, in the same order and is not marked for deletion and is not the same @@ -3847,14 +3657,12 @@ dict_foreign_add_to_cache( } if (for_in_cache) { - /* Free the foreign object */ dict_foreign_free(foreign); } else { for_in_cache = foreign; } - if (ref_table && !for_in_cache->referenced_table) { ulint index_error; ulint err_col; @@ -3877,10 +3685,9 @@ dict_foreign_add_to_cache( "referenced table do not match" " the ones in table."); - if (for_in_cache == foreign) { - mem_heap_free(foreign->heap); - } - + if (for_in_cache == foreign) { + dict_foreign_free(foreign); + } DBUG_RETURN(DB_CANNOT_ADD_CONSTRAINT); } @@ -3934,7 +3741,8 @@ dict_foreign_add_to_cache( elements removed must be one */ } - mem_heap_free(foreign->heap); + + dict_foreign_free(foreign); } DBUG_RETURN(DB_CANNOT_ADD_CONSTRAINT); @@ -4231,7 +4039,6 @@ dict_scan_col( return(ptr); } - /*********************************************************************//** Open a table from its database and table name, this is currently used by foreign constraint parser to get the referenced table. @@ -6527,7 +6334,6 @@ dict_set_merge_threshold_all_debug( } #endif /* UNIV_DEBUG */ -#endif /* !UNIV_HOTBACKUP */ /**********************************************************************//** Inits dict_ind_redundant. */ @@ -6551,7 +6357,6 @@ dict_ind_init(void) dict_ind_redundant->cached = TRUE; } -#ifndef UNIV_HOTBACKUP /**********************************************************************//** Frees dict_ind_redundant. */ static @@ -7095,8 +6900,6 @@ dict_close(void) mutex_free(&dict_foreign_err_mutex); - delete dict_sys->autoinc_map; - ut_ad(dict_sys->size == 0); ut_free(dict_sys); @@ -7334,7 +7137,7 @@ dict_index_zip_pad_update( /* Use atomics even though we have the mutex. This is to ensure that we are able to read info->pad atomically. */ - os_atomic_increment_ulint(&info->pad, ZIP_PAD_INCR); + my_atomic_addlint(&info->pad, ZIP_PAD_INCR); MONITOR_INC(MONITOR_PAD_INCREMENTS); } @@ -7356,7 +7159,7 @@ dict_index_zip_pad_update( /* Use atomics even though we have the mutex. This is to ensure that we are able to read info->pad atomically. */ - os_atomic_decrement_ulint(&info->pad, ZIP_PAD_INCR); + my_atomic_addlint(&info->pad, -ZIP_PAD_INCR); info->n_rounds = 0; @@ -7409,7 +7212,6 @@ dict_index_zip_failure( dict_index_zip_pad_unlock(index); } - /*********************************************************************//** Return the optimal page size, for which page will likely compress. @return page size beyond which page might not compress */ @@ -7430,10 +7232,7 @@ dict_index_zip_pad_optimal_page_size( return(UNIV_PAGE_SIZE); } - /* We use atomics to read index->zip_pad.pad. Here we use zero - as increment as are not changing the value of the 'pad'. */ - - pad = os_atomic_increment_ulint(&index->zip_pad.pad, 0); + pad = my_atomic_loadlint(&index->zip_pad.pad); ut_ad(pad < UNIV_PAGE_SIZE); sz = UNIV_PAGE_SIZE - pad; @@ -7628,7 +7427,6 @@ dict_space_get_id( return(id); } -#endif /* !UNIV_HOTBACKUP */ /** Determine the extent size (in pages) for the given table @param[in] table the table whose extent size is being diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc index f38ad85e903..b40d659e362 100644 --- a/storage/innobase/dict/dict0load.cc +++ b/storage/innobase/dict/dict0load.cc @@ -493,7 +493,7 @@ err_len: } /* This receives a dict_foreign_t* that points to a stack variable. - So mem_heap_free(foreign->heap) is not used as elsewhere. + So dict_foreign_free(foreign) is not used as elsewhere. Since the heap used here is freed elsewhere, foreign->heap is not assigned. */ foreign->id = mem_heap_strdupl(heap, (const char*) field, len); @@ -3179,7 +3179,7 @@ err_exit: ib::error() << "Table " << table->name << " in InnoDB" " data dictionary contains invalid flags." " SYS_TABLES.MIX_LEN=" << table->flags2; - table->flags2 &= ~(DICT_TF2_TEMPORARY|DICT_TF2_INTRINSIC); + table->flags2 &= ~DICT_TF2_TEMPORARY; dict_table_remove_from_cache(table); table = NULL; err = DB_FAIL; diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc index b0d679d4619..f4726ecd329 100644 --- a/storage/innobase/dict/dict0mem.cc +++ b/storage/innobase/dict/dict0mem.cc @@ -24,10 +24,8 @@ Data dictionary memory object creation Created 1/8/1996 Heikki Tuuri ***********************************************************************/ -#ifndef UNIV_HOTBACKUP #include "ha_prototypes.h" #include -#endif /* !UNIV_HOTBACKUP */ #include "dict0mem.h" @@ -41,11 +39,7 @@ Created 1/8/1996 Heikki Tuuri #include "dict0dict.h" #include "fts0priv.h" #include "ut0crc32.h" - -#ifndef UNIV_HOTBACKUP -# include "lock0lock.h" -#endif /* !UNIV_HOTBACKUP */ - +#include "lock0lock.h" #include "sync0sync.h" #include @@ -152,21 +146,12 @@ dict_mem_table_create( dict_table_stats_lock() will not be noop. */ dict_table_stats_latch_create(table, true); -#ifndef UNIV_HOTBACKUP table->autoinc_lock = static_cast( mem_heap_alloc(heap, lock_get_size())); /* lazy creation of table autoinc latch */ dict_table_autoinc_create_lazy(table); - table->autoinc = 0; - table->sess_row_id = 0; - table->sess_trx_id = 0; - - /* The number of transactions that are either waiting on the - AUTOINC lock or have been granted the lock. */ - table->n_waiting_or_granted_auto_inc_locks = 0; - /* If the table has an FTS index or we are in the process of building one, create the table->fts */ if (dict_table_has_fts_index(table) @@ -177,7 +162,6 @@ dict_mem_table_create( } else { table->fts = NULL; } -#endif /* !UNIV_HOTBACKUP */ if (DICT_TF_HAS_SHARED_SPACE(table->flags)) { dict_get_and_save_space_name(table, true); @@ -209,10 +193,8 @@ dict_mem_table_free( fts_free(table); } } -#ifndef UNIV_HOTBACKUP - dict_table_autoinc_destroy(table); -#endif /* UNIV_HOTBACKUP */ + dict_table_autoinc_destroy(table); dict_mem_table_free_foreign_vcol_set(table); dict_table_stats_latch_destroy(table); @@ -440,7 +422,6 @@ dict_mem_table_add_s_col( table->s_cols->push_back(s_col); } - /**********************************************************************//** Renames a column of a table in the data dictionary cache. */ static MY_ATTRIBUTE((nonnull)) @@ -640,10 +621,8 @@ dict_mem_fill_column_struct( ulint prtype, /*!< in: precise type */ ulint col_len) /*!< in: column length */ { -#ifndef UNIV_HOTBACKUP ulint mbminlen; ulint mbmaxlen; -#endif /* !UNIV_HOTBACKUP */ column->ind = (unsigned int) col_pos; column->ord_part = 0; @@ -651,10 +630,9 @@ dict_mem_fill_column_struct( column->mtype = (unsigned int) mtype; column->prtype = (unsigned int) prtype; column->len = (unsigned int) col_len; -#ifndef UNIV_HOTBACKUP - dtype_get_mblen(mtype, prtype, &mbminlen, &mbmaxlen); + + dtype_get_mblen(mtype, prtype, &mbminlen, &mbmaxlen); dict_col_set_mbminmaxlen(column, mbminlen, mbmaxlen); -#endif /* !UNIV_HOTBACKUP */ } /**********************************************************************//** @@ -701,7 +679,6 @@ dict_mem_index_create( return(index); } -#ifndef UNIV_HOTBACKUP /**********************************************************************//** Creates and initializes a foreign constraint memory object. @return own: foreign constraint struct */ @@ -961,8 +938,6 @@ dict_mem_table_free_foreign_vcol_set( } } -#endif /* !UNIV_HOTBACKUP */ - /**********************************************************************//** Adds a field definition to an index. NOTE: does not take a copy of the column name if the field is a column. The memory occupied @@ -1045,7 +1020,7 @@ dict_mem_create_temporary_tablename( size_t dblen = dbend - dbtab + 1; /* Increment a randomly initialized number for each temp file. */ - os_atomic_increment_uint32(&dict_temp_file_num, 1); + my_atomic_add32((int32*) &dict_temp_file_num, 1); size = dblen + (sizeof(TEMP_FILE_PREFIX) + 3 + 20 + 1 + 10); name = static_cast(mem_heap_alloc(heap, size)); @@ -1158,4 +1133,3 @@ dict_mem_table_is_system( return true; } } - diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc index ff5162a68c4..87502ef130c 100644 --- a/storage/innobase/dict/dict0stats.cc +++ b/storage/innobase/dict/dict0stats.cc @@ -23,8 +23,6 @@ Code used for calculating and manipulating table statistics. Created Jan 06, 2010 Vasil Dimov *******************************************************/ -#ifndef UNIV_HOTBACKUP - #include "univ.i" #include "ut0ut.h" @@ -700,7 +698,10 @@ void dict_stats_copy( /*============*/ dict_table_t* dst, /*!< in/out: destination table */ - const dict_table_t* src) /*!< in: source table */ + const dict_table_t* src, /*!< in: source table */ + bool reset_ignored_indexes) /*!< in: if true, set ignored indexes + to have the same statistics as if + the table was empty */ { dst->stats_last_recalc = src->stats_last_recalc; dst->stat_n_rows = src->stat_n_rows; @@ -719,7 +720,16 @@ dict_stats_copy( && (src_idx = dict_table_get_next_index(src_idx)))) { if (dict_stats_should_ignore_index(dst_idx)) { - continue; + if (reset_ignored_indexes) { + /* Reset index statistics for all ignored indexes, + unless they are FT indexes (these have no statistics)*/ + if (dst_idx->type & DICT_FTS) { + continue; + } + dict_stats_empty_index(dst_idx, true); + } else { + continue; + } } ut_ad(!dict_index_is_ibuf(dst_idx)); @@ -818,7 +828,7 @@ dict_stats_snapshot_create( t = dict_stats_table_clone_create(table); - dict_stats_copy(t, table); + dict_stats_copy(t, table, false); t->stat_persistent = table->stat_persistent; t->stats_auto_recalc = table->stats_auto_recalc; @@ -3283,13 +3293,10 @@ dict_stats_update( dict_table_stats_lock(table, RW_X_LATCH); - /* Initialize all stats to dummy values before - copying because dict_stats_table_clone_create() does - skip corrupted indexes so our dummy object 't' may - have less indexes than the real object 'table'. */ - dict_stats_empty_table(table, true); - - dict_stats_copy(table, t); + /* Pass reset_ignored_indexes=true as parameter + to dict_stats_copy. This will cause statictics + for corrupted indexes to be set to empty values */ + dict_stats_copy(table, t, true); dict_stats_assert_initialized(table); @@ -4281,5 +4288,3 @@ test_dict_stats_all() #endif /* UNIV_ENABLE_UNIT_TEST_DICT_STATS */ /* @} */ - -#endif /* UNIV_HOTBACKUP */ diff --git a/storage/innobase/dict/dict0stats_bg.cc b/storage/innobase/dict/dict0stats_bg.cc index dbc8e90bed6..9d04cee4165 100644 --- a/storage/innobase/dict/dict0stats_bg.cc +++ b/storage/innobase/dict/dict0stats_bg.cc @@ -63,10 +63,6 @@ static os_event_t dict_stats_disabled_event; /** This mutex protects the "recalc_pool" variable. */ static ib_mutex_t recalc_pool_mutex; -/** The number of tables that can be added to "recalc_pool" before -it is enlarged */ -static const ulint RECALC_POOL_INITIAL_SLOTS = 128; - /** Allocator type, used by std::vector */ typedef ut_allocator recalc_pool_allocator_t; diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 9062bf1586b..fd1cc24c92a 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -41,14 +41,10 @@ Modified Jan Lindström jan.lindstrom@mariadb.com #include /** Mutex for keys */ -UNIV_INTERN ib_mutex_t fil_crypt_key_mutex; +static ib_mutex_t fil_crypt_key_mutex; static bool fil_crypt_threads_inited = false; -#ifdef UNIV_PFS_MUTEX -UNIV_INTERN mysql_pfs_key_t fil_crypt_key_mutex_key; -#endif - /** Is encryption enabled/disabled */ UNIV_INTERN ulong srv_encrypt_tables = 0; @@ -62,20 +58,16 @@ static uint srv_n_fil_crypt_threads_started = 0; UNIV_INTERN uint srv_fil_crypt_rotate_key_age = 1; /** Event to signal FROM the key rotation threads. */ -UNIV_INTERN os_event_t fil_crypt_event; +static os_event_t fil_crypt_event; /** Event to signal TO the key rotation threads. */ -UNIV_INTERN os_event_t fil_crypt_threads_event; +static os_event_t fil_crypt_threads_event; /** Event for waking up threads throttle */ -UNIV_INTERN os_event_t fil_crypt_throttle_sleep_event; +static os_event_t fil_crypt_throttle_sleep_event; /** Mutex for key rotation threads */ -UNIV_INTERN ib_mutex_t fil_crypt_threads_mutex; - -#ifdef UNIV_PFS_MUTEX -UNIV_INTERN mysql_pfs_key_t fil_crypt_threads_mutex_key; -#endif +static ib_mutex_t fil_crypt_threads_mutex; /** Variable ensuring only 1 thread at time does initial conversion */ static bool fil_crypt_start_converting = false; @@ -95,17 +87,6 @@ extern uint srv_background_scrub_data_check_interval; static fil_crypt_stat_t crypt_stat; static ib_mutex_t crypt_stat_mutex; -#ifdef UNIV_PFS_MUTEX -UNIV_INTERN mysql_pfs_key_t fil_crypt_stat_mutex_key; -#endif - -/** - * key for crypt data mutex -*/ -#ifdef UNIV_PFS_MUTEX -UNIV_INTERN mysql_pfs_key_t fil_crypt_data_mutex_key; -#endif - static bool fil_crypt_needs_rotation( /*=====================*/ @@ -138,6 +119,25 @@ fil_space_crypt_cleanup() /*=====================*/ { os_event_destroy(fil_crypt_throttle_sleep_event); + mutex_free(&fil_crypt_key_mutex); + mutex_free(&crypt_stat_mutex); +} + +/** +Get latest key version from encryption plugin. +@return key version or ENCRYPTION_KEY_VERSION_INVALID */ +uint +fil_space_crypt_struct::key_get_latest_version(void) +{ + uint key_version = key_found; + + if (is_key_found()) { + key_version = encryption_key_get_latest_version(key_id); + srv_stats.n_key_requests.inc(); + key_found = key_version; + } + + return key_version; } /****************************************************************** @@ -148,20 +148,25 @@ fil_crypt_get_latest_key_version( /*=============================*/ fil_space_crypt_t* crypt_data) /*!< in: crypt data */ { - uint rc = encryption_key_get_latest_version(crypt_data->key_id); + ut_ad(crypt_data != NULL); - if (fil_crypt_needs_rotation(crypt_data->encryption, - crypt_data->min_key_version, - rc, srv_fil_crypt_rotate_key_age)) { - os_event_set(fil_crypt_threads_event); + uint key_version = crypt_data->key_get_latest_version(); + + if (crypt_data->is_key_found()) { + + if (fil_crypt_needs_rotation(crypt_data->encryption, + crypt_data->min_key_version, + key_version, + srv_fil_crypt_rotate_key_age)) { + os_event_set(fil_crypt_threads_event); + } } - return rc; + return key_version; } /****************************************************************** Mutex helper for crypt_data->scheme */ -static void crypt_data_scheme_locker( /*=====================*/ @@ -178,6 +183,36 @@ crypt_data_scheme_locker( } } +/****************************************************************** +Create a fil_space_crypt_t object +@return crypt object */ +static +fil_space_crypt_t* +fil_space_create_crypt_data( +/*========================*/ + uint type, + fil_encryption_t encrypt_mode, + uint min_key_version, + uint key_id, + ulint offset) +{ + const uint sz = sizeof(fil_space_crypt_t); + void* buf = ut_zalloc_nokey(sz); + fil_space_crypt_t* crypt_data = NULL; + + if (buf) { + crypt_data = new(buf) + fil_space_crypt_struct( + type, + min_key_version, + key_id, + offset, + encrypt_mode); + } + + return crypt_data; +} + /****************************************************************** Create a fil_space_crypt_t object @return crypt object */ @@ -188,27 +223,7 @@ fil_space_create_crypt_data( fil_encryption_t encrypt_mode, /*!< in: encryption mode */ uint key_id) /*!< in: encryption key id */ { - const uint sz = sizeof(fil_space_crypt_t); - fil_space_crypt_t* crypt_data = - static_cast(malloc(sz)); - - memset(crypt_data, 0, sz); - - if (encrypt_mode == FIL_SPACE_ENCRYPTION_OFF || - (!srv_encrypt_tables && encrypt_mode == FIL_SPACE_ENCRYPTION_DEFAULT)) { - crypt_data->type = CRYPT_SCHEME_UNENCRYPTED; - } else { - crypt_data->type = CRYPT_SCHEME_1; - crypt_data->min_key_version = encryption_key_get_latest_version(key_id); - } - - mutex_create(LATCH_ID_FIL_CRYPT_DATA_MUTEX, &crypt_data->mutex); - crypt_data->locker = crypt_data_scheme_locker; - my_random_bytes(crypt_data->iv, sizeof(crypt_data->iv)); - crypt_data->encryption = encrypt_mode; - crypt_data->inited = true; - crypt_data->key_id = key_id; - return crypt_data; + return (fil_space_create_crypt_data(0, encrypt_mode, 0, key_id, 0)); } /****************************************************************** @@ -233,7 +248,7 @@ fil_space_merge_crypt_data( dst->type = src->type; dst->min_key_version = src->min_key_version; dst->keyserver_requests += src->keyserver_requests; - dst->inited = src->inited; + dst->closing = src->closing; mutex_exit(&dst->mutex); } @@ -249,11 +264,6 @@ fil_space_read_crypt_data( const byte* page, /*!< in: page 0 */ ulint offset) /*!< in: offset */ { - if (memcmp(page + offset, EMPTY_PATTERN, MAGIC_SZ) == 0) { - /* Crypt data is not stored. */ - return NULL; - } - if (memcmp(page + offset, CRYPT_MAGIC, MAGIC_SZ) != 0) { /* Crypt data is not stored. */ return NULL; @@ -305,18 +315,12 @@ fil_space_read_crypt_data( fil_encryption_t encryption = (fil_encryption_t)mach_read_from_1( page + offset + MAGIC_SZ + 2 + iv_length + 8); - const uint sz = sizeof(fil_space_crypt_t) + iv_length; - crypt_data = static_cast(malloc(sz)); - memset(crypt_data, 0, sz); - + crypt_data = fil_space_create_crypt_data(encryption, key_id); + /* We need to overwrite these as above function will initialize + members */ crypt_data->type = type; crypt_data->min_key_version = min_key_version; - crypt_data->key_id = key_id; crypt_data->page0_offset = offset; - crypt_data->encryption = encryption; - mutex_create(LATCH_ID_FIL_CRYPT_DATA_MUTEX, &crypt_data->mutex); - crypt_data->locker = crypt_data_scheme_locker; - crypt_data->inited = true; memcpy(crypt_data->iv, page + offset + MAGIC_SZ + 2, iv_length); return crypt_data; @@ -331,19 +335,11 @@ fil_space_destroy_crypt_data( fil_space_crypt_t **crypt_data) /*!< out: crypt data */ { if (crypt_data != NULL && (*crypt_data) != NULL) { - /* Make sure that this thread owns the crypt_data - and make it unawailable, this does not fully - avoid the race between drop table and crypt thread */ mutex_enter(&fil_crypt_threads_mutex); - mutex_enter(&(*crypt_data)->mutex); - (*crypt_data)->inited = false; - mutex_exit(&(*crypt_data)->mutex); - /* JAN: TODO: - mutex_free(& (*crypt_data)->mutex); - memset(*crypt_data, 0, sizeof(fil_space_crypt_t)); - free(*crypt_data); - (*crypt_data) = NULL; - */ + fil_space_crypt_t* c = *crypt_data; + c->~fil_space_crypt_struct(); + ut_free(c); + *crypt_data = NULL; mutex_exit(&fil_crypt_threads_mutex); } } @@ -491,6 +487,7 @@ fil_parse_write_crypt_data( } fil_space_crypt_t* crypt_data = fil_space_create_crypt_data(encryption, key_id); + /* Need to overwrite these as above will initialize fields. */ crypt_data->page0_offset = offset; crypt_data->min_key_version = min_key_version; crypt_data->encryption = encryption; @@ -644,7 +641,7 @@ fil_space_encrypt( return src_frame; } - ut_a(crypt_data != NULL && crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF); + ut_a(crypt_data != NULL && crypt_data->is_encrypted()); byte* tmp = fil_encrypt_buf(crypt_data, space, offset, lsn, src_frame, page_size, dst_frame); @@ -723,7 +720,7 @@ fil_space_check_encryption_read( return false; } - if (crypt_data->encryption == FIL_SPACE_ENCRYPTION_OFF) { + if (crypt_data->not_encrypted()) { return false; } @@ -776,7 +773,7 @@ fil_space_decrypt( return false; } - ut_a(crypt_data != NULL && crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF); + ut_a(crypt_data != NULL && crypt_data->is_encrypted()); /* read space & lsn */ ulint header_len = FIL_PAGE_DATA; @@ -1008,20 +1005,13 @@ Copy global key state */ static void fil_crypt_get_key_state( /*====================*/ - key_state_t *new_state) /*!< out: key state */ + key_state_t* new_state, /*!< out: key state */ + fil_space_crypt_t* crypt_data) /*!< in, out: crypt_data */ { if (srv_encrypt_tables) { - new_state->key_version = - encryption_key_get_latest_version(new_state->key_id); + new_state->key_version = crypt_data->key_get_latest_version(); new_state->rotate_key_age = srv_fil_crypt_rotate_key_age; - if (new_state->key_version == ENCRYPTION_KEY_VERSION_INVALID) { - ib::error() << "Used key_id " - << new_state->key_id - << " can't be found from key file."; - } - - ut_a(new_state->key_version != ENCRYPTION_KEY_VERSION_INVALID); ut_a(new_state->key_version != ENCRYPTION_KEY_NOT_ENCRYPTED); } else { new_state->key_version = 0; @@ -1081,9 +1071,7 @@ fil_crypt_is_closing( fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space); if (crypt_data) { - mutex_enter(&crypt_data->mutex); - closing = crypt_data->closing; - mutex_exit(&crypt_data->mutex); + closing = crypt_data->is_closing(false); } return closing; @@ -1183,10 +1171,11 @@ fil_crypt_start_encrypting_space( /* 3 - compute location to store crypt data */ byte* frame = buf_block_get_frame(block); - ulint maxsize = 0; ut_ad(crypt_data); - crypt_data->page0_offset = - fsp_header_get_crypt_offset(page_size, &maxsize); + crypt_data->page0_offset = FSP_HEADER_OFFSET + + fsp_header_get_encryption_offset(page_size); + const ulint maxsize = page_size.logical() + - crypt_data->page0_offset - FIL_PAGE_DATA_END; /* 4 - write crypt data to page 0 */ fil_space_write_crypt_data_low(crypt_data, @@ -1342,6 +1331,18 @@ fil_crypt_space_needs_rotation( } return false; } + + crypt_data->key_get_latest_version(); + + if (!crypt_data->is_key_found()) { + return false; + } + } + + /* If used key_id is not found from encryption plugin we can't + continue to rotate the tablespace */ + if (!crypt_data->is_key_found()) { + return false; } mutex_enter(&crypt_data->mutex); @@ -1355,7 +1356,7 @@ fil_crypt_space_needs_rotation( } /* prevent threads from starting to rotate space */ - if (crypt_data->closing) { + if (crypt_data->is_closing(true)) { break; } @@ -1364,13 +1365,13 @@ fil_crypt_space_needs_rotation( } /* No need to rotate space if encryption is disabled */ - if (crypt_data->encryption == FIL_SPACE_ENCRYPTION_OFF) { + if (crypt_data->not_encrypted()) { break; } if (crypt_data->key_id != key_state->key_id) { key_state->key_id= crypt_data->key_id; - fil_crypt_get_key_state(key_state); + fil_crypt_get_key_state(key_state, crypt_data); } bool need_key_rotation = fil_crypt_needs_rotation( @@ -1383,12 +1384,14 @@ fil_crypt_space_needs_rotation( time_t diff = time(0) - crypt_data->rotate_state.scrubbing. last_scrub_completed; + bool need_scrubbing = crypt_data->rotate_state.scrubbing.is_active && diff >= (time_t) srv_background_scrub_data_interval; - if (need_key_rotation == false && need_scrubbing == false) + if (need_key_rotation == false && need_scrubbing == false) { break; + } mutex_exit(&crypt_data->mutex); /* NOTE! fil_decr_pending_ops is performed outside */ @@ -1604,8 +1607,9 @@ fil_crypt_find_space_to_rotate( os_event_wait_time(fil_crypt_threads_event, 1000000); } - if (state->should_shutdown()) + if (state->should_shutdown()) { return false; + } if (state->first) { state->first = false; @@ -1667,7 +1671,7 @@ fil_crypt_start_rotate_space( crypt_data->rotate_state.start_time = time(0); if (crypt_data->type == CRYPT_SCHEME_UNENCRYPTED && - crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF && + crypt_data->is_encrypted() && key_state->key_version != 0) { /* this is rotation unencrypted => encrypted */ crypt_data->type = CRYPT_SCHEME_1; @@ -1704,7 +1708,7 @@ fil_crypt_find_page_to_rotate( mutex_enter(&crypt_data->mutex); ut_ad(key_state->key_id == crypt_data->key_id); - if (crypt_data->closing == false && + if (!crypt_data->is_closing(true) && crypt_data->rotate_state.next_offset < crypt_data->rotate_state.max_offset) { @@ -1968,7 +1972,7 @@ fil_crypt_rotate_page( /* statistics */ state->crypt_stat.pages_modified++; } else { - if (crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF) { + if (crypt_data->is_encrypted()) { ut_a(kv >= crypt_data->min_key_version || (kv == 0 && key_state->key_version == 0)); @@ -2154,10 +2158,9 @@ fil_crypt_flush_space( if (block && err == DB_SUCCESS) { byte* frame = buf_block_get_frame(block); - ulint maxsize=0; - crypt_data->page0_offset = - fsp_header_get_crypt_offset(page_size, &maxsize); + crypt_data->page0_offset = FSP_HEADER_OFFSET + + fsp_header_get_encryption_offset(page_size); fil_space_write_crypt_data(space, frame, crypt_data->page0_offset, @@ -2181,7 +2184,7 @@ fil_crypt_complete_rotate_space( fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space); /* Space might already be dropped */ - if (crypt_data != NULL && crypt_data->inited) { + if (crypt_data != NULL && !crypt_data->is_closing(false)) { mutex_enter(&crypt_data->mutex); /** @@ -2468,6 +2471,7 @@ fil_crypt_threads_cleanup() { os_event_destroy(fil_crypt_event); os_event_destroy(fil_crypt_threads_event); + mutex_free(&fil_crypt_threads_mutex); fil_crypt_threads_inited = false; } @@ -2477,7 +2481,8 @@ UNIV_INTERN void fil_space_crypt_mark_space_closing( /*===============================*/ - ulint space) /*!< in: Space id */ + ulint space, /*!< in: tablespace id */ + fil_space_crypt_t* crypt_data) /*!< in: crypt_data or NULL */ { if (!fil_crypt_threads_inited) { return; @@ -2485,7 +2490,9 @@ fil_space_crypt_mark_space_closing( mutex_enter(&fil_crypt_threads_mutex); - fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space); + if (!crypt_data) { + crypt_data = fil_space_get_crypt_data(space); + } if (crypt_data == NULL) { mutex_exit(&fil_crypt_threads_mutex); @@ -2514,7 +2521,7 @@ fil_space_crypt_close_tablespace( fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space); - if (crypt_data == NULL || !crypt_data->inited) { + if (crypt_data == NULL || crypt_data->is_closing(false)) { mutex_exit(&fil_crypt_threads_mutex); return; } @@ -2568,6 +2575,8 @@ fil_space_crypt_get_status( { fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(id); + memset(status, 0, sizeof(*status)); + if (crypt_data != NULL) { status->space = id; status->scheme = crypt_data->type; @@ -2588,6 +2597,7 @@ fil_space_crypt_get_status( } else { status->rotating = false; } + mutex_exit(&crypt_data->mutex); if (srv_encrypt_tables || crypt_data->min_key_version) { @@ -2597,7 +2607,6 @@ fil_space_crypt_get_status( status->current_key_version = 0; } } else { - memset(status, 0, sizeof(*status)); if (srv_encrypt_tables) { os_event_set(fil_crypt_threads_event); } @@ -2630,6 +2639,7 @@ fil_space_get_scrub_status( struct fil_space_scrub_status_t* status) /*!< out: status */ { fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(id); + memset(status, 0, sizeof(*status)); if (crypt_data != NULL) { @@ -2654,9 +2664,8 @@ fil_space_get_scrub_status( } else { status->scrubbing = false; } + mutex_exit(&crypt_data->mutex); - } else { - memset(status, 0, sizeof(*status)); } return crypt_data == NULL ? 1 : 0; diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 55c51f1be05..60ed4e01422 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -29,7 +29,6 @@ Created 10/25/1995 Heikki Tuuri #include "fsp0pagecompress.h" #include "fil0crypt.h" -#ifndef UNIV_HOTBACKUP #include "btr0btr.h" #include "buf0buf.h" #include "dict0boot.h" @@ -51,11 +50,10 @@ Created 10/25/1995 Heikki Tuuri #include "srv0start.h" #include "trx0purge.h" #include "ut0new.h" -# include "buf0lru.h" -# include "ibuf0ibuf.h" -# include "os0event.h" -# include "sync0sync.h" -#endif /* !UNIV_HOTBACKUP */ +#include "buf0lru.h" +#include "ibuf0ibuf.h" +#include "os0event.h" +#include "sync0sync.h" #include "buf0flu.h" #include "srv0start.h" #include "trx0purge.h" @@ -161,11 +159,6 @@ fil_addr_t fil_addr_null = {FIL_NULL, 0}; initialized. */ fil_system_t* fil_system = NULL; -#ifdef UNIV_HOTBACKUP -static ulint srv_data_read; -static ulint srv_data_written; -#endif /* UNIV_HOTBACKUP */ - /** Determine if user has explicitly disabled fsync(). */ #ifndef _WIN32 # define fil_buffering_disabled(s) \ @@ -185,7 +178,7 @@ fil_is_user_tablespace_id( ulint space_id) { return(space_id > srv_undo_tablespaces_open - && space_id != srv_tmp_space.space_id()); + && space_id != SRV_TMP_SPACE_ID); } #ifdef UNIV_DEBUG @@ -384,7 +377,6 @@ fil_space_get( return(space); } -#ifndef UNIV_HOTBACKUP /** Returns the latch of a file space. @param[in] id space id @param[out] flags tablespace flags @@ -456,7 +448,6 @@ fil_space_set_imported( mutex_exit(&fil_system->mutex); } -#endif /* !UNIV_HOTBACKUP */ /**********************************************************************//** Checks if all the file nodes in a space are flushed. The caller must hold @@ -484,7 +475,7 @@ fil_space_is_flushed( return(true); } -#if !defined(NO_FALLOCATE) && defined(UNIV_LINUX) +#ifdef UNIV_LINUX #include /** FusionIO atomic write control info */ @@ -511,7 +502,7 @@ fil_fusionio_enable_atomic_write(os_file_t file) return(false); } -#endif /* !NO_FALLOCATE && UNIV_LINUX */ +#endif /* UNIV_LINUX */ /** Append a file to the chain of files of a space. @param[in] name file name of a file that is not open @@ -698,13 +689,6 @@ retry: size_bytes = os_file_get_size(node->handle); ut_a(size_bytes != (os_offset_t) -1); -#ifdef UNIV_HOTBACKUP - if (space->id == 0) { - node->size = (ulint) (size_bytes / UNIV_PAGE_SIZE); - os_file_close(node->handle); - goto add_size; - } -#endif /* UNIV_HOTBACKUP */ ut_a(space->purpose != FIL_TYPE_LOG); /* Read the first page of the tablespace */ @@ -721,6 +705,7 @@ retry: success = os_file_read( request, node->handle, page, 0, UNIV_PAGE_SIZE); + srv_stats.page0_read.add(1); space_id = fsp_header_get_space_id(page); flags = fsp_header_get_flags(page); @@ -812,19 +797,16 @@ retry: /* After apply-incremental, tablespaces are not extended to a whole megabyte. Do not cut off valid data. */ -#ifndef UNIV_HOTBACKUP + /* Truncate the size to a multiple of extent size. */ if (size_bytes >= extent_size) { size_bytes = ut_2pow_round(size_bytes, extent_size); } -#endif /* !UNIV_HOTBACKUP */ + node->size = (ulint) (size_bytes / page_size.physical()); -#ifdef UNIV_HOTBACKUP -add_size: -#endif /* UNIV_HOTBACKUP */ space->size += node->size; } } @@ -879,11 +861,9 @@ fil_node_close_file( ut_a(node->n_pending == 0); ut_a(node->n_pending_flushes == 0); ut_a(!node->being_extended); -#ifndef UNIV_HOTBACKUP ut_a(node->modification_counter == node->flush_counter || node->space->purpose == FIL_TYPE_TEMPORARY || srv_fast_shutdown == 2); -#endif /* !UNIV_HOTBACKUP */ ret = os_file_close(node->handle); ut_a(ret); @@ -968,6 +948,341 @@ fil_try_to_close_file_in_LRU( return(false); } +/** Flush any writes cached by the file system. +@param[in,out] space tablespace */ +static +void +fil_flush_low(fil_space_t* space) +{ + ut_ad(mutex_own(&fil_system->mutex)); + ut_ad(space); + ut_ad(!space->stop_new_ops); + + if (fil_buffering_disabled(space)) { + + /* No need to flush. User has explicitly disabled + buffering. */ + ut_ad(!space->is_in_unflushed_spaces); + ut_ad(fil_space_is_flushed(space)); + ut_ad(space->n_pending_flushes == 0); + +#ifdef UNIV_DEBUG + for (fil_node_t* node = UT_LIST_GET_FIRST(space->chain); + node != NULL; + node = UT_LIST_GET_NEXT(chain, node)) { + ut_ad(node->modification_counter + == node->flush_counter); + ut_ad(node->n_pending_flushes == 0); + } +#endif /* UNIV_DEBUG */ + + return; + } + + /* Prevent dropping of the space while we are flushing */ + space->n_pending_flushes++; + + for (fil_node_t* node = UT_LIST_GET_FIRST(space->chain); + node != NULL; + node = UT_LIST_GET_NEXT(chain, node)) { + + int64_t old_mod_counter = node->modification_counter; + + if (old_mod_counter <= node->flush_counter) { + continue; + } + + ut_a(node->is_open); + + switch (space->purpose) { + case FIL_TYPE_TEMPORARY: + ut_ad(0); // we already checked for this + case FIL_TYPE_TABLESPACE: + case FIL_TYPE_IMPORT: + fil_n_pending_tablespace_flushes++; + break; + case FIL_TYPE_LOG: + fil_n_pending_log_flushes++; + fil_n_log_flushes++; + break; + } +#ifdef _WIN32 + if (node->is_raw_disk) { + + goto skip_flush; + } +#endif /* _WIN32 */ +retry: + if (node->n_pending_flushes > 0) { + /* We want to avoid calling os_file_flush() on + the file twice at the same time, because we do + not know what bugs OS's may contain in file + i/o */ + + int64_t sig_count = os_event_reset(node->sync_event); + + mutex_exit(&fil_system->mutex); + + os_event_wait_low(node->sync_event, sig_count); + + mutex_enter(&fil_system->mutex); + + if (node->flush_counter >= old_mod_counter) { + + goto skip_flush; + } + + goto retry; + } + + ut_a(node->is_open); + node->n_pending_flushes++; + + mutex_exit(&fil_system->mutex); + + os_file_flush(node->handle); + + mutex_enter(&fil_system->mutex); + + os_event_set(node->sync_event); + + node->n_pending_flushes--; +skip_flush: + if (node->flush_counter < old_mod_counter) { + node->flush_counter = old_mod_counter; + + if (space->is_in_unflushed_spaces + && fil_space_is_flushed(space)) { + + space->is_in_unflushed_spaces = false; + + UT_LIST_REMOVE( + fil_system->unflushed_spaces, + space); + } + } + + switch (space->purpose) { + case FIL_TYPE_TEMPORARY: + break; + case FIL_TYPE_TABLESPACE: + case FIL_TYPE_IMPORT: + fil_n_pending_tablespace_flushes--; + continue; + case FIL_TYPE_LOG: + fil_n_pending_log_flushes--; + continue; + } + + ut_ad(0); + } + + space->n_pending_flushes--; +} + +/** +Fill the pages with NULs +@param[in] node File node +@param[in] page_size physical page size +@param[in] start Offset from the start of the file in bytes +@param[in] len Length in bytes +@param[in] read_only_mode + if true, then read only mode checks are enforced. +@return DB_SUCCESS or error code */ +static +dberr_t +fil_write_zeros( + const fil_node_t* node, + ulint page_size, + os_offset_t start, + ulint len, + bool read_only_mode) +{ + ut_a(len > 0); + + /* Extend at most 1M at a time */ + ulint n_bytes = ut_min(static_cast(1024 * 1024), len); + byte* ptr = reinterpret_cast(ut_zalloc_nokey(n_bytes + + page_size)); + byte* buf = reinterpret_cast(ut_align(ptr, page_size)); + + os_offset_t offset = start; + dberr_t err = DB_SUCCESS; + const os_offset_t end = start + len; + IORequest request(IORequest::WRITE); + + while (offset < end) { + err = os_aio( + request, OS_AIO_SYNC, node->name, + node->handle, buf, offset, n_bytes, read_only_mode, + NULL, NULL, NULL); + + if (err != DB_SUCCESS) { + break; + } + + offset += n_bytes; + + n_bytes = ut_min(n_bytes, static_cast(end - offset)); + + DBUG_EXECUTE_IF("ib_crash_during_tablespace_extension", + DBUG_SUICIDE();); + } + + ut_free(ptr); + + return(err); +} + +/** Try to extend a tablespace. +@param[in,out] space tablespace to be extended +@param[in,out] node last file of the tablespace +@param[in] size desired size in number of pages +@param[out] success whether the operation succeeded +@return whether the operation should be retried */ +static UNIV_COLD __attribute__((warn_unused_result, nonnull)) +bool +fil_space_extend_must_retry( + fil_space_t* space, + fil_node_t* node, + ulint size, + bool* success) +{ + ut_ad(mutex_own(&fil_system->mutex)); + ut_ad(UT_LIST_GET_LAST(space->chain) == node); + ut_ad(size >= FIL_IBD_FILE_INITIAL_SIZE); + + *success = space->size >= size; + + if (*success) { + /* Space already big enough */ + return(false); + } + + if (node->being_extended) { + /* Another thread is currently extending the file. Wait + for it to finish. + It'd have been better to use event driven mechanism but + the entire module is peppered with polling stuff. */ + mutex_exit(&fil_system->mutex); + os_thread_sleep(100000); + return(true); + } + + node->being_extended = true; + + if (!fil_node_prepare_for_io(node, fil_system, space)) { + /* The tablespace data file, such as .ibd file, is missing */ + node->being_extended = false; + return(false); + } + + /* At this point it is safe to release fil_system mutex. No + other thread can rename, delete, close or extend the file because + we have set the node->being_extended flag. */ + mutex_exit(&fil_system->mutex); + + ut_ad(size > space->size); + + ulint pages_added = size - space->size; + const page_size_t pageSize(space->flags); + const ulint page_size = pageSize.physical(); + + os_offset_t start = os_file_get_size(node->handle); + ut_a(start != (os_offset_t) -1); + start &= ~(page_size - 1); + const os_offset_t end + = (node->size + pages_added) * page_size; + + *success = end <= start; + + if (!*success) { + DBUG_EXECUTE_IF("ib_crash_during_tablespace_extension", + DBUG_SUICIDE();); + +#ifdef HAVE_POSIX_FALLOCATE + /* On Linux, FusionIO atomic writes cannot extend + files, so we must use posix_fallocate(). */ + int ret = posix_fallocate(node->handle, start, + end - start); + + /* EINVAL means that fallocate() is not supported. + One known case is Linux ext3 file system with O_DIRECT. */ + if (ret == 0) { + } else if (ret != EINVAL) { + ib::error() + << "posix_fallocate(): Failed to preallocate" + " data for file " + << node->name << ", desired size " + << end << " bytes." + " Operating system error number " + << ret << ". Check" + " that the disk is not full or a disk quota" + " exceeded. Make sure the file system supports" + " this function. Some operating system error" + " numbers are described at " REFMAN + " operating-system-error-codes.html"; + } else +#endif + if (DB_SUCCESS != fil_write_zeros( + node, page_size, start, + static_cast(end - start), + space->purpose == FIL_TYPE_TEMPORARY + && srv_read_only_mode)) { + ib::warn() + << "Error while writing " << end - start + << " zeroes to " << node->name + << " starting at offset " << start; + } + + /* Check how many pages actually added */ + os_offset_t actual_end = os_file_get_size(node->handle); + ut_a(actual_end != static_cast(-1)); + ut_a(actual_end >= start); + + *success = end >= actual_end; + pages_added = static_cast( + (std::min(actual_end, end) - start) / page_size); + } + + os_has_said_disk_full = !*success; + + mutex_enter(&fil_system->mutex); + + space->size += pages_added; + + ut_a(node->being_extended); + node->being_extended = false; + node->size += pages_added; + const ulint pages_in_MiB = node->size + & ~((1 << (20 - UNIV_PAGE_SIZE_SHIFT)) - 1); + + fil_node_complete_io(node, fil_system, IORequestWrite); + + /* Keep the last data file size info up to date, rounded to + full megabytes */ + + switch (space->id) { + case TRX_SYS_SPACE: + srv_sys_space.set_last_file_size(pages_in_MiB); + fil_flush_low(space); + return(false); + default: + // TODO: reject CREATE TEMPORARY TABLE...ROW_FORMAT=COMPRESSED + ut_ad(space->purpose == FIL_TYPE_TABLESPACE + || space->purpose == FIL_TYPE_TEMPORARY); + if (space->purpose == FIL_TYPE_TABLESPACE) { + fil_flush_low(space); + } + return(false); + case SRV_TMP_SPACE_ID: + ut_ad(space->purpose == FIL_TYPE_TEMPORARY); + srv_tmp_space.set_last_file_size(pages_in_MiB); + return(false); + } + +} + /*******************************************************************//** Reserves the fil_system mutex and tries to make sure we can open at least one file while holding it. This should be called before calling @@ -978,28 +1293,22 @@ fil_mutex_enter_and_prepare_for_io( /*===============================*/ ulint space_id) /*!< in: space id */ { - fil_space_t* space; - bool success; - bool print_info = false; - ulint count = 0; - ulint count2 = 0; - - for (;;) { + for (ulint count = 0, count2 = 0;;) { mutex_enter(&fil_system->mutex); - if (space_id == 0 || space_id >= SRV_LOG_SPACE_FIRST_ID) { - /* We keep log files and system tablespace files always - open; this is important in preventing deadlocks in this - module, as a page read completion often performs - another read from the insert buffer. The insert buffer - is in tablespace 0, and we cannot end up waiting in - this function. */ - return; + if (space_id >= SRV_LOG_SPACE_FIRST_ID) { + /* We keep log files always open. */ + break; } - space = fil_space_get_by_id(space_id); + fil_space_t* space = fil_space_get_by_id(space_id); - if (space != NULL && space->stop_ios) { + if (space == NULL) { + break; + } + + if (space->stop_ios) { + ut_ad(space->id != 0); /* We are going to do a rename file and want to stop new i/o's for a while. */ @@ -1011,8 +1320,6 @@ fil_mutex_enter_and_prepare_for_io( mutex_exit(&fil_system->mutex); -#ifndef UNIV_HOTBACKUP - /* Wake the i/o-handler threads to make sure pending i/o's are performed */ os_aio_simulated_wake_handler_threads(); @@ -1024,8 +1331,6 @@ fil_mutex_enter_and_prepare_for_io( fil_rename_tablespace() as well. */ os_thread_sleep(20000); -#endif /* UNIV_HOTBACKUP */ - /* Flush tablespaces so that we can close modified files in the LRU list */ fil_flush_file_spaces(FIL_TYPE_TABLESPACE); @@ -1037,65 +1342,109 @@ fil_mutex_enter_and_prepare_for_io( continue; } - if (fil_system->n_open < fil_system->max_n_open) { + fil_node_t* node = UT_LIST_GET_LAST(space->chain); + ut_ad(space->id == 0 + || node == UT_LIST_GET_FIRST(space->chain)); - return; + if (space->id == 0) { + /* We keep the system tablespace files always + open; this is important in preventing + deadlocks in this module, as a page read + completion often performs another read from + the insert buffer. The insert buffer is in + tablespace 0, and we cannot end up waiting in + this function. */ + } else if (!node || node->is_open) { + /* If the file is already open, no need to do + anything; if the space does not exist, we handle the + situation in the function which called this + function */ + } else { + while (fil_system->n_open >= fil_system->max_n_open) { + /* Too many files are open */ + if (fil_try_to_close_file_in_LRU(count > 1)) { + /* No problem */ + } else if (count >= 2) { + ib::warn() << "innodb_open_files=" + << fil_system->max_n_open + << " is exceeded (" + << fil_system->n_open + << ") files stay open)"; + break; + } else { + mutex_exit(&fil_system->mutex); + os_aio_simulated_wake_handler_threads(); + os_thread_sleep(20000); + /* Flush tablespaces so that we can + close modified files in the LRU list */ + fil_flush_file_spaces(FIL_TYPE_TABLESPACE); + + count++; + continue; + } + } } - /* If the file is already open, no need to do anything; if the - space does not exist, we handle the situation in the function - which called this function. */ + if (ulint size = UNIV_UNLIKELY(space->recv_size)) { + ut_ad(node); + bool success; + if (fil_space_extend_must_retry(space, node, size, + &success)) { + continue; + } - if (space == NULL || UT_LIST_GET_FIRST(space->chain)->is_open) { + ut_ad(mutex_own(&fil_system->mutex)); + /* Crash recovery requires the file extension + to succeed. */ + ut_a(success); + /* InnoDB data files cannot shrink. */ + ut_a(space->size >= size); - return; + /* There could be multiple concurrent I/O requests for + this tablespace (multiple threads trying to extend + this tablespace). + + Also, fil_space_set_recv_size() may have been invoked + again during the file extension while fil_system->mutex + was not being held by us. + + Only if space->recv_size matches what we read + originally, reset the field. In this way, a + subsequent I/O request will handle any pending + fil_space_set_recv_size(). */ + + if (size == space->recv_size) { + space->recv_size = 0; + } } - if (count > 1) { - print_info = true; - } - - /* Too many files are open, try to close some */ - do { - success = fil_try_to_close_file_in_LRU(print_info); - - } while (success - && fil_system->n_open >= fil_system->max_n_open); - - if (fil_system->n_open < fil_system->max_n_open) { - /* Ok */ - return; - } - - if (count >= 2) { - ib::warn() << "Too many (" << fil_system->n_open - << ") files stay open while the maximum" - " allowed value would be " - << fil_system->max_n_open << ". You may need" - " to raise the value of innodb_open_files in" - " my.cnf."; - - return; - } - - mutex_exit(&fil_system->mutex); - -#ifndef UNIV_HOTBACKUP - /* Wake the i/o-handler threads to make sure pending i/o's are - performed */ - os_aio_simulated_wake_handler_threads(); - - os_thread_sleep(20000); -#endif /* !UNIV_HOTBACKUP */ - /* Flush tablespaces so that we can close modified files in - the LRU list. */ - - fil_flush_file_spaces(FIL_TYPE_TABLESPACE); - - count++; + break; } } +/** Try to extend a tablespace if it is smaller than the specified size. +@param[in,out] space tablespace +@param[in] size desired size in pages +@return whether the tablespace is at least as big as requested */ +bool +fil_space_extend( + fil_space_t* space, + ulint size) +{ + ut_ad(!srv_read_only_mode || space->purpose == FIL_TYPE_TEMPORARY); + + bool success; + + do { + fil_mutex_enter_and_prepare_for_io(space->id); + } while (fil_space_extend_must_retry( + space, UT_LIST_GET_LAST(space->chain), size, + &success)); + + mutex_exit(&fil_system->mutex); + return(success); +} + /** Prepare to free a file node object from a tablespace memory cache. @param[in,out] node file node @param[in] space tablespace */ @@ -1199,6 +1548,7 @@ fil_space_free_low( ut_ad(space->size == 0); rw_lock_free(&space->latch); + fil_space_destroy_crypt_data(&space->crypt_data); ut_free(space->name); ut_free(space); @@ -1269,7 +1619,8 @@ fil_space_create( ulint id, ulint flags, fil_type_t purpose, - fil_space_crypt_t* crypt_data) /*!< in: crypt data */ + fil_space_crypt_t* crypt_data, /*!< in: crypt data */ + bool create_table) /*!< in: true if create table */ { fil_space_t* space; @@ -1311,9 +1662,7 @@ fil_space_create( UT_LIST_INIT(space->chain, &fil_node_t::chain); - /* This warning is not applicable while MEB scanning the redo logs */ -#ifndef UNIV_HOTBACKUP - if (fil_type_is_data(purpose) + if ((purpose == FIL_TYPE_TABLESPACE || purpose == FIL_TYPE_IMPORT) && !recv_recovery_on && id > fil_system->max_assigned_id) { @@ -1327,20 +1676,34 @@ fil_space_create( fil_system->max_assigned_id = id; } -#endif /* !UNIV_HOTBACKUP */ + space->purpose = purpose; space->flags = flags; space->magic_n = FIL_SPACE_MAGIC_N; + space->crypt_data = crypt_data; + + /* In create table we write page 0 so we have already + "read" it and for system tablespaces we have read + crypt data at startup. */ + if (create_table || crypt_data != NULL) { + space->page_0_crypt_read = true; + } + +#ifdef UNIV_DEBUG + ib::info() << "Created tablespace for space " << space->id + << " name " << space->name + << " key_id " << (space->crypt_data ? space->crypt_data->key_id : 0) + << " encryption " << (space->crypt_data ? space->crypt_data->encryption : 0); +#endif + space->encryption_type = Encryption::NONE; rw_lock_create(fil_space_latch_key, &space->latch, SYNC_FSP); if (space->purpose == FIL_TYPE_TEMPORARY) { -#ifndef UNIV_HOTBACKUP ut_d(space->latch.set_temp_fsp()); -#endif /* !UNIV_HOTBACKUP */ } HASH_INSERT(fil_space_t, hash, fil_system->spaces, id, space); @@ -1355,8 +1718,6 @@ fil_space_create( fil_system->max_assigned_id = id; } - space->crypt_data = crypt_data; - if (crypt_data) { space->read_page0 = true; /* If table could be encrypted print info */ @@ -1524,6 +1885,24 @@ fil_space_get_first_path( return(path); } +/** Set the recovered size of a tablespace in pages. +@param id tablespace ID +@param size recovered size in pages */ +UNIV_INTERN +void +fil_space_set_recv_size(ulint id, ulint size) +{ + mutex_enter(&fil_system->mutex); + ut_ad(size); + ut_ad(id < SRV_LOG_SPACE_FIRST_ID); + + if (fil_space_t* space = fil_space_get_space(id)) { + space->recv_size = size; + } + + mutex_exit(&fil_system->mutex); +} + /*******************************************************************//** Returns the size of the space in pages. The tablespace must be cached in the memory cache. @@ -1909,7 +2288,6 @@ fil_write_flushed_lsn( return(err); } -#ifndef UNIV_HOTBACKUP /** Acquire a tablespace when it could be dropped concurrently. Used by background threads that do not necessarily hold proper locks for concurrency control. @@ -1980,7 +2358,6 @@ fil_space_release( space->n_pending_ops--; mutex_exit(&fil_system->mutex); } -#endif /* !UNIV_HOTBACKUP */ /********************************************************//** Creates the database directory for a table if it does not exist yet. */ @@ -2091,7 +2468,7 @@ fil_op_write_log( ut_ad(0); } } -#ifndef UNIV_HOTBACKUP + /** Write redo log for renaming a file. @param[in] space_id tablespace id @param[in] first_page_no first page number in the file @@ -2113,7 +2490,7 @@ fil_name_write_rename( MLOG_FILE_RENAME2, space_id, first_page_no, old_name, new_name, 0, mtr); } -#endif /* !UNIV_HOTBACKUP */ + /** Write MLOG_FILE_NAME for a file. @param[in] space_id tablespace id @param[in] first_page_no first page number in the file @@ -2146,7 +2523,6 @@ fil_name_write( fil_name_write(space->id, first_page_no, file->name, mtr); } -#ifndef UNIV_HOTBACKUP /********************************************************//** Recreates table indexes by applying TRUNCATE log record during recovery. @@ -2387,7 +2763,7 @@ fil_recreate_tablespace( return(err); } -#endif /* UNIV_HOTBACKUP */ + /** Replay a file rename operation if possible. @param[in] space_id tablespace identifier @param[in] first_page_no first page number in the file @@ -2403,9 +2779,6 @@ fil_op_replay_rename( const char* name, const char* new_name) { -#ifdef UNIV_HOTBACKUP - ut_ad(recv_replay_file_ops); -#endif /* UNIV_HOTBACKUP */ ut_ad(first_page_no == 0); /* In order to replay the rename, the following must hold: @@ -2736,7 +3109,6 @@ fil_delete_tablespace( ut_a(space); ut_a(path != 0); -#ifndef UNIV_HOTBACKUP /* IMPORTANT: Because we have set space::stop_new_ops there can't be any new ibuf merges, reads or flushes. We are here because node::n_pending was zero above. However, it is still @@ -2760,15 +3132,9 @@ fil_delete_tablespace( buf_LRU_flush_or_remove_pages(id, buf_remove, 0); -#endif /* !UNIV_HOTBACKUP */ - /* If it is a delete then also delete any generated files, otherwise when we drop the database the remove directory will fail. */ { -#ifdef UNIV_HOTBACKUP - /* When replaying the operation in MySQL Enterprise - Backup, we do not try to write any log record. */ -#else /* UNIV_HOTBACKUP */ /* Before deleting the file, write a log record about it, so that InnoDB crash recovery will expect the file to be gone. */ @@ -2781,7 +3147,6 @@ fil_delete_tablespace( tablespace file, the record must have already been written to the redo log. */ log_write_up_to(mtr.commit_lsn(), true); -#endif /* UNIV_HOTBACKUP */ char* cfg_name = fil_make_filepath(path, NULL, CFG, false); if (cfg_name != NULL) { @@ -2844,7 +3209,6 @@ fil_delete_tablespace( return(err); } -#ifndef UNIV_HOTBACKUP /** Truncate the tablespace to needed size. @param[in] space_id id of tablespace to truncate @param[in] size_in_pages truncate size. @@ -3078,7 +3442,6 @@ fil_discard_tablespace( return(err); } -#endif /* !UNIV_HOTBACKUP */ /*******************************************************************//** Allocates and builds a file name from a path, a table or tablespace name @@ -3345,7 +3708,7 @@ func_exit: ut_ad(strchr(old_file_name, OS_PATH_SEPARATOR) != NULL); ut_ad(strchr(new_file_name, OS_PATH_SEPARATOR) != NULL); -#ifndef UNIV_HOTBACKUP + if (!recv_recovery_on) { mtr_t mtr; @@ -3355,7 +3718,6 @@ func_exit: mtr.commit(); log_mutex_enter(); } -#endif /* !UNIV_HOTBACKUP */ /* log_sys->mutex is above fil_system->mutex in the latching order */ ut_ad(log_mutex_own()); @@ -3383,11 +3745,9 @@ func_exit: node->name = new_file_name; } -#ifndef UNIV_HOTBACKUP if (!recv_recovery_on) { log_mutex_exit(); } -#endif /* !UNIV_HOTBACKUP */ ut_ad(space->name == old_space_name); if (success) { @@ -3498,11 +3858,10 @@ fil_ibd_create( return(DB_ERROR); } - bool atomic_write; - -#if !defined(NO_FALLOCATE) && defined(UNIV_LINUX) - if (fil_fusionio_enable_atomic_write(file)) { +#ifdef UNIV_LINUX + const bool atomic_write = fil_fusionio_enable_atomic_write(file); + if (atomic_write) { /* This is required by FusionIO HW/Firmware */ int ret = posix_fallocate(file, 0, size * UNIV_PAGE_SIZE); @@ -3525,21 +3884,14 @@ fil_ibd_create( } else { success = true; } - - atomic_write = true; - } else { - atomic_write = false; - + } else +#else + const bool atomic_write = false; +#endif /* UNIV_LINUX */ + { success = os_file_set_size( path, file, size * UNIV_PAGE_SIZE, srv_read_only_mode); } -#else - atomic_write = false; - - success = os_file_set_size( - path, file, size * UNIV_PAGE_SIZE, srv_read_only_mode); - -#endif /* !NO_FALLOCATE && UNIV_LINUX */ if (!success) { os_file_close(file); @@ -3580,11 +3932,11 @@ fil_ibd_create( page = static_cast(ut_align(buf2, UNIV_PAGE_SIZE)); memset(page, '\0', UNIV_PAGE_SIZE); -#ifndef UNIV_HOTBACKUP + /* Add the UNIV_PAGE_SIZE to the table flags and write them to the tablespace header. */ flags = fsp_flags_set_page_size(flags, univ_page_size); -#endif /* !UNIV_HOTBACKUP */ + fsp_header_init_fields(page, space_id, flags); mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, space_id); @@ -3649,9 +4001,6 @@ fil_ibd_create( return(DB_ERROR); } - /* MEB creates isl files during copy-back, hence they - should not be created during apply log operation. */ -#ifndef UNIV_HOTBACKUP if (has_data_dir || has_shared_space) { /* Make the ISL file if the IBD file is not in the default location. */ @@ -3663,7 +4012,6 @@ fil_ibd_create( return(err); } } -#endif /* !UNIV_HOTBACKUP */ /* Create crypt data if the tablespace is either encrypted or user has requested it to remain unencrypted. */ @@ -3674,7 +4022,7 @@ fil_ibd_create( space = fil_space_create(name, space_id, flags, is_temp ? FIL_TYPE_TEMPORARY : FIL_TYPE_TABLESPACE, - crypt_data); + crypt_data, true); if (!fil_node_create_low( path, size, space, false, punch_hole, atomic_write)) { @@ -3698,7 +4046,6 @@ fil_ibd_create( } #endif /* MYSQL_ENCRYPTION */ -#ifndef UNIV_HOTBACKUP if (!is_temp) { mtr_t mtr; const fil_node_t* file = UT_LIST_GET_FIRST(space->chain); @@ -3710,7 +4057,7 @@ fil_ibd_create( fil_name_write(space, 0, file, &mtr); mtr_commit(&mtr); } -#endif /* !UNIV_HOTBACKUP */ + err = DB_SUCCESS; /* Error code is set. Cleanup the various variables used. @@ -3729,7 +4076,6 @@ error_exit_1: return(err); } -#ifndef UNIV_HOTBACKUP /** Try to open a single-table tablespace and optionally check that the space id in it is correct. If this does not succeed, print an error message to the .err log. This function is used to open a tablespace when we start @@ -3832,6 +4178,7 @@ fil_ibd_open( link_file_found = true; if (table) { table->crypt_data = df_remote.get_crypt_info(); + table->page_0_read = true; } } else if (df_remote.filepath() != NULL) { /* An ISL file was found but contained a bad filepath in it. @@ -3854,6 +4201,7 @@ fil_ibd_open( if (table) { table->crypt_data = df_dict.get_crypt_info(); + table->page_0_read = true; } } } @@ -3868,6 +4216,7 @@ fil_ibd_open( ++tablespaces_found; if (table) { table->crypt_data = df_default.get_crypt_info(); + table->page_0_read = true; } } @@ -3888,18 +4237,12 @@ fil_ibd_open( df_dict.close(); } - bool atomic_write; - -#if !defined(NO_FALLOCATE) && defined(UNIV_LINUX) - if (!srv_use_doublewrite_buf && df_default.is_open()) { - atomic_write = fil_fusionio_enable_atomic_write( - df_default.handle()); - } else { - atomic_write = false; - } +#ifdef UNIV_LINUX + const bool atomic_write = !srv_use_doublewrite_buf && df_default.is_open() + && fil_fusionio_enable_atomic_write(df_default.handle()); #else - atomic_write = false; -#endif /* !NO_FALLOCATE && UNIV_LINUX */ + const bool atomic_write = false; +#endif /* UNIV_LINUX */ /* We have now checked all possible tablespace locations and have a count of how many unique files we found. If things are @@ -4094,7 +4437,7 @@ skip_validate: space_name, id, flags, purpose, df_remote.is_open() ? df_remote.get_crypt_info() : df_dict.is_open() ? df_dict.get_crypt_info() : - df_default.get_crypt_info()); + df_default.get_crypt_info(), false); /* We do not measure the size of the file, that is why we pass the 0 below */ @@ -4129,32 +4472,6 @@ skip_validate: return(err); } -#endif /* !UNIV_HOTBACKUP */ - -#ifdef UNIV_HOTBACKUP -/*******************************************************************//** -Allocates a file name for an old version of a single-table tablespace. -The string must be freed by caller with ut_free()! -@return own: file name */ -static -char* -fil_make_ibbackup_old_name( -/*=======================*/ - const char* name) /*!< in: original file name */ -{ - static const char suffix[] = "_ibbackup_old_vers_"; - char* path; - ulint len = strlen(name); - - path = static_cast(ut_malloc_nokey(len + 15 + sizeof(suffix))); - - memcpy(path, name, len); - memcpy(path + len, suffix, sizeof(suffix) - 1); - ut_sprintf_timestamp_without_extra_chars( - path + len + sizeof(suffix) - 1); - return(path); -} -#endif /* UNIV_HOTBACKUP */ /** Looks for a pre-existing fil_space_t with the given tablespace ID and, if found, returns the name and filepath in newly allocated buffers @@ -4240,7 +4557,7 @@ fil_path_to_space_name( } /** Discover the correct IBD file to open given a remote or missing -filepath from the REDO log. MEB and administrators can move a crashed +filepath from the REDO log. Administrators can move a crashed database to another location on the same machine and try to recover it. Remote IBD files might be moved as well to the new location. The problem with this is that the REDO log contains the old location @@ -4252,6 +4569,7 @@ both locations, we can chose on based on these priorities; @param[in] space_id tablespace ID @param[in] df Datafile object with path from redo @return true if a valid datafile was found, false if not */ +static bool fil_ibd_discover( ulint space_id, @@ -4413,11 +4731,7 @@ fil_ibd_load( fil_node_t* node = UT_LIST_GET_FIRST(space->chain); if (0 != strcmp(innobase_basename(filename), innobase_basename(node->name))) { -#ifdef UNIV_HOTBACKUP - ib::trace() -#else ib::info() -#endif /* UNIV_HOTBACKUP */ << "Ignoring data file '" << filename << "' with space ID " << space->id << ". Another data file called " << node->name @@ -4453,11 +4767,7 @@ fil_ibd_load( os_offset_t minimum_size; case DB_SUCCESS: if (file.space_id() != space_id) { -#ifdef UNIV_HOTBACKUP - ib::trace() -#else /* !UNIV_HOTBACKUP */ ib::info() -#endif /* UNIV_HOTBACKUP */ << "Ignoring data file '" << file.filepath() << "' with space ID " << file.space_id() @@ -4481,17 +4791,10 @@ fil_ibd_load( " single-table tablespace file '" << file.filepath() << "'"; } else if (size < minimum_size) { -#ifndef UNIV_HOTBACKUP ib::error() << "The size of tablespace file '" << file.filepath() << "' is only " << size << ", should be at least " << minimum_size << "!"; -#else - /* In MEB, we work around this error. */ - file.set_space_id(ULINT_UNDEFINED); - file.set_flags(0); - break; -#endif /* !UNIV_HOTBACKUP */ } else { /* Everything is fine so far. */ break; @@ -4500,12 +4803,6 @@ fil_ibd_load( /* Fall through to error handling */ case DB_TABLESPACE_EXISTS: -#ifdef UNIV_HOTBACKUP - if (file.flags() == ~(ulint)0) { - return FIL_LOAD_OK; - } -#endif /* UNIV_HOTBACKUP */ - return(FIL_LOAD_INVALID); default: @@ -4514,69 +4811,11 @@ fil_ibd_load( ut_ad(space == NULL); -#ifdef UNIV_HOTBACKUP - if (file.space_id() == ULINT_UNDEFINED || file.space_id() == 0) { - char* new_path; - - ib::info() << "Renaming tablespace file '" << file.filepath() - << "' with space ID " << file.space_id() << " to " - << file.name() << "_ibbackup_old_vers_" - " because its size " << size() << " is too small" - " (< 4 pages 16 kB each), or the space id in the" - " file header is not sensible. This can happen in" - " an mysqlbackup run, and is not dangerous."; - file.close(); - - new_path = fil_make_ibbackup_old_name(file.filepath()); - - bool success = os_file_rename( - innodb_data_file_key, file.filepath(), new_path); - - ut_a(success); - - ut_free(new_path); - - return(FIL_LOAD_ID_CHANGED); - } - - /* A backup may contain the same space several times, if the space got - renamed at a sensitive time. Since it is enough to have one version of - the space, we rename the file if a space with the same space id - already exists in the tablespace memory cache. We rather rename the - file than delete it, because if there is a bug, we do not want to - destroy valuable data. */ - - mutex_enter(&fil_system->mutex); - space = fil_space_get_by_id(space_id); - mutex_exit(&fil_system->mutex); - - if (space != NULL) { - ib::info() << "Renaming data file '" << file.filepath() - << "' with space ID " << space_id << " to " - << file.name() - << "_ibbackup_old_vers_ because space " - << space->name << " with the same id was scanned" - " earlier. This can happen if you have renamed tables" - " during an mysqlbackup run."; - file.close(); - - char* new_path = fil_make_ibbackup_old_name(file.filepath()); - - bool success = os_file_rename( - innodb_data_file_key, file.filepath(), new_path); - - ut_a(success); - - ut_free(new_path); - return(FIL_LOAD_OK); - } -#endif /* UNIV_HOTBACKUP */ - bool is_temp = FSP_FLAGS_GET_TEMPORARY(file.flags()); space = fil_space_create( file.name(), space_id, file.flags(), is_temp ? FIL_TYPE_TEMPORARY : FIL_TYPE_TABLESPACE, - file.get_crypt_info()); + file.get_crypt_info(), false); if (space == NULL) { return(FIL_LOAD_INVALID); @@ -4666,7 +4905,6 @@ fil_report_missing_tablespace( " exists in the InnoDB internal data dictionary."; } -#ifndef UNIV_HOTBACKUP /** Returns true if a matching tablespace exists in the InnoDB tablespace memory cache. Note that if we have not done a crash recovery at the database startup, there may be many tablespaces which are not yet in the memory cache. @@ -4843,7 +5081,7 @@ error_exit: return(false); } -#endif /* !UNIV_HOTBACKUP */ + /** Return the space ID based on the tablespace name. The tablespace must be found in the tablespace memory cache. This call is made from external to this module, so the mutex is not owned. @@ -4864,323 +5102,6 @@ fil_space_get_id_by_name( return(id); } -/** -Fill the pages with NULs -@param[in] node File node -@param[in] page_size physical page size -@param[in] start Offset from the start of the file in bytes -@param[in] len Length in bytes -@param[in] read_only_mode - if true, then read only mode checks are enforced. -@return DB_SUCCESS or error code */ -static -dberr_t -fil_write_zeros( - const fil_node_t* node, - ulint page_size, - os_offset_t start, - ulint len, - bool read_only_mode) -{ - ut_a(len > 0); - - /* Extend at most 1M at a time */ - ulint n_bytes = ut_min(static_cast(1024 * 1024), len); - byte* ptr = reinterpret_cast(ut_zalloc_nokey(n_bytes - + page_size)); - byte* buf = reinterpret_cast(ut_align(ptr, page_size)); - - os_offset_t offset = start; - dberr_t err = DB_SUCCESS; - const os_offset_t end = start + len; - IORequest request(IORequest::WRITE); - - while (offset < end) { - -#ifdef UNIV_HOTBACKUP - err = os_file_write( - request, node->name, node->handle, buf, offset, - n_bytes); -#else - err = os_aio( - request, OS_AIO_SYNC, node->name, - node->handle, buf, offset, n_bytes, read_only_mode, - NULL, NULL, NULL); -#endif /* UNIV_HOTBACKUP */ - - if (err != DB_SUCCESS) { - break; - } - - offset += n_bytes; - - n_bytes = ut_min(n_bytes, static_cast(end - offset)); - - DBUG_EXECUTE_IF("ib_crash_during_tablespace_extension", - DBUG_SUICIDE();); - } - - ut_free(ptr); - - return(err); -} - -/** Try to extend a tablespace if it is smaller than the specified size. -@param[in,out] space tablespace -@param[in] size desired size in pages -@return whether the tablespace is at least as big as requested */ -bool -fil_space_extend( - fil_space_t* space, - ulint size) -{ - /* In read-only mode we allow write to shared temporary tablespace - as intrinsic table created by Optimizer reside in this tablespace. */ - ut_ad(!srv_read_only_mode || fsp_is_system_temporary(space->id)); - -retry: - -#ifdef UNIV_HOTBACKUP - page_size_t page_length(space->flags); - ulint actual_size = space->size; - ib::trace() << "space id : " << space->id << ", space name : " - << space->name << ", space size : " << actual_size << " pages," - << " desired space size : " << size << " pages," - << " page size : " << page_length.physical(); -#endif /* UNIV_HOTBACKUP */ - - bool success = true; - - fil_mutex_enter_and_prepare_for_io(space->id); - - if (space->size >= size) { - /* Space already big enough */ - mutex_exit(&fil_system->mutex); - return(true); - } - - page_size_t pageSize(space->flags); - const ulint page_size = pageSize.physical(); - fil_node_t* node = UT_LIST_GET_LAST(space->chain); - - if (!node->being_extended) { - /* Mark this node as undergoing extension. This flag - is used by other threads to wait for the extension - opereation to finish. */ - node->being_extended = true; - } else { - /* Another thread is currently extending the file. Wait - for it to finish. It'd have been better to use an event - driven mechanism but the entire module is peppered with - polling code. */ - - mutex_exit(&fil_system->mutex); - os_thread_sleep(100000); - goto retry; - } - - if (!fil_node_prepare_for_io(node, fil_system, space)) { - /* The tablespace data file, such as .ibd file, is missing */ - node->being_extended = false; - mutex_exit(&fil_system->mutex); - - return(false); - } - - /* At this point it is safe to release fil_system mutex. No - other thread can rename, delete or close the file because - we have set the node->being_extended flag. */ - mutex_exit(&fil_system->mutex); - - ulint pages_added; - - /* Note: This code is going to be executed independent of FusionIO HW - if the OS supports posix_fallocate() */ - - ut_ad(size > space->size); - - os_offset_t node_start = os_file_get_size(node->handle); - ut_a(node_start != (os_offset_t) -1); - - /* Node first page number */ - ulint node_first_page = space->size - node->size; - - /* Number of physical pages in the node/file */ - ulint n_node_physical_pages - = static_cast(node_start) / page_size; - - /* Number of pages to extend in the node/file */ - lint n_node_extend; - - n_node_extend = size - (node_first_page + node->size); - - /* If we already have enough physical pages to satisfy the - extend request on the node then ignore it */ - if (node->size + n_node_extend > n_node_physical_pages) { - - DBUG_EXECUTE_IF("ib_crash_during_tablespace_extension", - DBUG_SUICIDE();); - - os_offset_t len; - dberr_t err = DB_SUCCESS; - - len = ((node->size + n_node_extend) * page_size) - node_start; - ut_ad(len > 0); - const char* name = node->name == NULL ? space->name : node->name; - -#if !defined(NO_FALLOCATE) && defined(UNIV_LINUX) - /* This is required by FusionIO HW/Firmware */ - int ret = posix_fallocate(node->handle, node_start, len); - - /* We already pass the valid offset and len in, if EINVAL - is returned, it could only mean that the file system doesn't - support fallocate(), currently one known case is - ext3 FS with O_DIRECT. We ignore EINVAL here so that the - error message won't flood. */ - if (ret != 0 && ret != EINVAL) { - ib::error() - << "posix_fallocate(): Failed to preallocate" - " data for file " - << name << ", desired size " - << len << " bytes." - " Operating system error number " - << ret << ". Check" - " that the disk is not full or a disk quota" - " exceeded. Make sure the file system supports" - " this function. Some operating system error" - " numbers are described at " REFMAN - " operating-system-error-codes.html"; - - err = DB_IO_ERROR; - } -#endif /* NO_FALLOCATE || !UNIV_LINUX */ - - if (!node->atomic_write || err == DB_IO_ERROR) { - - bool read_only_mode; - - read_only_mode = (space->purpose != FIL_TYPE_TEMPORARY - ? false : srv_read_only_mode); - - err = fil_write_zeros( - node, page_size, node_start, - static_cast(len), read_only_mode); - - if (err != DB_SUCCESS) { - - ib::warn() - << "Error while writing " << len - << " zeroes to " << name - << " starting at offset " << node_start; - } - } - - /* Check how many pages actually added */ - os_offset_t end = os_file_get_size(node->handle); - ut_a(end != static_cast(-1) && end >= node_start); - - os_has_said_disk_full = !(success = (end == node_start + len)); - - pages_added = static_cast(end - node_start) / page_size; - - } else { - success = true; - pages_added = n_node_extend; - os_has_said_disk_full = FALSE; - } - - mutex_enter(&fil_system->mutex); - - ut_a(node->being_extended); - - node->size += pages_added; - space->size += pages_added; - node->being_extended = false; - - fil_node_complete_io(node, fil_system, IORequestWrite); - -#ifndef UNIV_HOTBACKUP - /* Keep the last data file size info up to date, rounded to - full megabytes */ - ulint pages_per_mb = (1024 * 1024) / page_size; - ulint size_in_pages = ((node->size / pages_per_mb) * pages_per_mb); - - if (space->id == srv_sys_space.space_id()) { - srv_sys_space.set_last_file_size(size_in_pages); - } else if (space->id == srv_tmp_space.space_id()) { - srv_tmp_space.set_last_file_size(size_in_pages); - } -#else - ib::trace() << "extended space : " << space->name << " from " - << actual_size << " pages to " << space->size << " pages " - << ", desired space size : " << size << " pages."; -#endif /* !UNIV_HOTBACKUP */ - - mutex_exit(&fil_system->mutex); - - fil_flush(space->id); - - return(success); -} - -#ifdef UNIV_HOTBACKUP -/********************************************************************//** -Extends all tablespaces to the size stored in the space header. During the -mysqlbackup --apply-log phase we extended the spaces on-demand so that log -records could be applied, but that may have left spaces still too small -compared to the size stored in the space header. */ -void -fil_extend_tablespaces_to_stored_len(void) -/*======================================*/ -{ - byte* buf; - ulint actual_size; - ulint size_in_header; - dberr_t error; - bool success; - - buf = (byte*)ut_malloc_nokey(UNIV_PAGE_SIZE); - - mutex_enter(&fil_system->mutex); - - for (fil_space_t* space = UT_LIST_GET_FIRST(fil_system->space_list); - space != NULL; - space = UT_LIST_GET_NEXT(space_list, space)) { - - ut_a(space->purpose == FIL_TYPE_TABLESPACE); - - mutex_exit(&fil_system->mutex); /* no need to protect with a - mutex, because this is a - single-threaded operation */ - error = fil_read( - page_id_t(space->id, 0), - page_size_t(space->flags), - 0, univ_page_size.physical(), buf); - - ut_a(error == DB_SUCCESS); - - size_in_header = fsp_header_get_field(buf, FSP_SIZE); - - success = fil_space_extend(space, size_in_header); - if (!success) { - ib::error() << "Could not extend the tablespace of " - << space->name << " to the size stored in" - " header, " << size_in_header << " pages;" - " size after extension " << actual_size - << " pages. Check that you have free disk" - " space and retry!"; - ut_a(success); - } - - mutex_enter(&fil_system->mutex); - } - - mutex_exit(&fil_system->mutex); - - ut_free(buf); -} -#endif - /*========== RESERVE FREE EXTENTS (for a B-tree split, for example) ===*/ /*******************************************************************//** @@ -5472,8 +5393,6 @@ fil_io( #endif ut_ad(fil_validate_skip()); -#ifndef UNIV_HOTBACKUP - /* ibuf bitmap pages must be read in the sync AIO mode: */ ut_ad(recv_no_ibuf_operations || req_type.is_write() @@ -5504,12 +5423,7 @@ fil_io( } else { mode = OS_AIO_NORMAL; } -#else /* !UNIV_HOTBACKUP */ - ut_a(sync); - ulint mode = OS_AIO_SYNC; -#endif /* !UNIV_HOTBACKUP */ -#ifndef UNIV_HOTBACKUP if (req_type.is_read()) { srv_stats.data_read.add(len); @@ -5521,7 +5435,6 @@ fil_io( srv_stats.data_written.add(len); } -#endif /* !UNIV_HOTBACKUP */ /* Reserve the fil_system mutex and make sure that we can open at least one file while holding it, if the file is not already open */ @@ -5724,33 +5637,14 @@ fil_io( req_type.block_size(node->block_size); - dberr_t err; - -#ifdef UNIV_HOTBACKUP - /* In mysqlbackup do normal i/o, not aio */ - if (req_type.is_read()) { - - err = os_file_read(req_type, node->handle, buf, offset, len); - - } else { - - ut_ad(!srv_read_only_mode - || fsp_is_system_temporary(page_id.space())); - - err = os_file_write( - req_type, node->name, node->handle, buf, offset, len); - } -#else /* UNIV_HOTBACKUP */ /* Queue the aio request */ - err = os_aio( + dberr_t err = os_aio( req_type, mode, name, node->handle, buf, offset, len, - fsp_is_system_temporary(page_id.space()) - ? false : srv_read_only_mode, + space->purpose != FIL_TYPE_TEMPORARY + && srv_read_only_mode, node, message, write_size); -#endif /* UNIV_HOTBACKUP */ - if (err == DB_IO_NO_PUNCH_HOLE) { err = DB_SUCCESS; @@ -5786,7 +5680,6 @@ fil_io( return(err); } -#ifndef UNIV_HOTBACKUP /**********************************************************************//** Waits for an aio operation to complete. This function is used to write the handler for completed requests. The aio array of pending requests is divided @@ -5849,7 +5742,6 @@ fil_aio_wait( ut_ad(0); } -#endif /* !UNIV_HOTBACKUP */ /**********************************************************************//** Flushes to disk possible writes cached by the OS. If the space does not exist @@ -5860,146 +5752,16 @@ fil_flush( ulint space_id) /*!< in: file space id (this can be a group of log files or a tablespace of the database) */ { - fil_node_t* node; - os_file_t file; - mutex_enter(&fil_system->mutex); - fil_space_t* space = fil_space_get_by_id(space_id); - - if (space == NULL - || space->purpose == FIL_TYPE_TEMPORARY - || space->stop_new_ops - || space->is_being_truncated) { - mutex_exit(&fil_system->mutex); - - return; + if (fil_space_t* space = fil_space_get_by_id(space_id)) { + if (space->purpose != FIL_TYPE_TEMPORARY + && !space->stop_new_ops + && !space->is_being_truncated) { + fil_flush_low(space); + } } - if (fil_buffering_disabled(space)) { - - /* No need to flush. User has explicitly disabled - buffering. */ - ut_ad(!space->is_in_unflushed_spaces); - ut_ad(fil_space_is_flushed(space)); - ut_ad(space->n_pending_flushes == 0); - -#ifdef UNIV_DEBUG - for (node = UT_LIST_GET_FIRST(space->chain); - node != NULL; - node = UT_LIST_GET_NEXT(chain, node)) { - ut_ad(node->modification_counter - == node->flush_counter); - ut_ad(node->n_pending_flushes == 0); - } -#endif /* UNIV_DEBUG */ - - mutex_exit(&fil_system->mutex); - return; - } - - space->n_pending_flushes++; /*!< prevent dropping of the space while - we are flushing */ - for (node = UT_LIST_GET_FIRST(space->chain); - node != NULL; - node = UT_LIST_GET_NEXT(chain, node)) { - - int64_t old_mod_counter = node->modification_counter; - - if (old_mod_counter <= node->flush_counter) { - continue; - } - - ut_a(node->is_open); - - switch (space->purpose) { - case FIL_TYPE_TEMPORARY: - ut_ad(0); // we already checked for this - case FIL_TYPE_TABLESPACE: - case FIL_TYPE_IMPORT: - fil_n_pending_tablespace_flushes++; - break; - case FIL_TYPE_LOG: - fil_n_pending_log_flushes++; - fil_n_log_flushes++; - break; - } -#ifdef _WIN32 - if (node->is_raw_disk) { - - goto skip_flush; - } -#endif /* _WIN32 */ -retry: - if (node->n_pending_flushes > 0) { - /* We want to avoid calling os_file_flush() on - the file twice at the same time, because we do - not know what bugs OS's may contain in file - i/o */ - -#ifndef UNIV_HOTBACKUP - int64_t sig_count = os_event_reset(node->sync_event); -#endif /* !UNIV_HOTBACKUP */ - - mutex_exit(&fil_system->mutex); - - os_event_wait_low(node->sync_event, sig_count); - - mutex_enter(&fil_system->mutex); - - if (node->flush_counter >= old_mod_counter) { - - goto skip_flush; - } - - goto retry; - } - - ut_a(node->is_open); - file = node->handle; - node->n_pending_flushes++; - - mutex_exit(&fil_system->mutex); - - os_file_flush(file); - - mutex_enter(&fil_system->mutex); - - os_event_set(node->sync_event); - - node->n_pending_flushes--; -skip_flush: - if (node->flush_counter < old_mod_counter) { - node->flush_counter = old_mod_counter; - - if (space->is_in_unflushed_spaces - && fil_space_is_flushed(space)) { - - space->is_in_unflushed_spaces = false; - - UT_LIST_REMOVE( - fil_system->unflushed_spaces, - space); - } - } - - switch (space->purpose) { - case FIL_TYPE_TEMPORARY: - ut_ad(0); // we already checked for this - case FIL_TYPE_TABLESPACE: - case FIL_TYPE_IMPORT: - fil_n_pending_tablespace_flushes--; - continue; - case FIL_TYPE_LOG: - fil_n_pending_log_flushes--; - continue; - } - - ut_ad(0); - } - - space->n_pending_flushes--; - mutex_exit(&fil_system->mutex); } @@ -6182,7 +5944,6 @@ fil_page_set_type( mach_write_to_2(page + FIL_PAGE_TYPE, type); } -#ifndef UNIV_HOTBACKUP /** Reset the page type. Data files created before MySQL 5.1 may contain garbage in FIL_PAGE_TYPE. In MySQL 3.23.53, only undo log pages and index pages were tagged. @@ -6203,7 +5964,6 @@ fil_page_reset_type( << fil_page_get_type(page) << " to " << type << "."; mlog_write_ulint(page + FIL_PAGE_TYPE, type, MLOG_2BYTES, mtr); } -#endif /* !UNIV_HOTBACKUP */ /****************************************************************//** Closes the tablespace memory cache. */ @@ -6224,10 +5984,11 @@ fil_close(void) ut_free(fil_system); fil_system = NULL; + + fil_space_crypt_cleanup(); } } -#ifndef UNIV_HOTBACKUP /********************************************************************//** Initializes a buffer control block when the buf_pool is created. */ static @@ -6301,11 +6062,13 @@ fil_iterate( for (offset = iter.start; offset < iter.end; offset += n_bytes) { - byte* io_buffer = iter.io_buffer; + byte* io_buffer = iter.io_buffer; + const bool row_compressed + = callback.get_page_size().is_compressed(); block->frame = io_buffer; - if (callback.get_page_size().is_compressed()) { + if (row_compressed) { page_zip_des_init(&block->page.zip); page_zip_set_size(&block->page.zip, iter.page_size); @@ -6353,9 +6116,7 @@ fil_iterate( bool encrypted = false; /* Use additional crypt io buffer if tablespace is encrypted */ - if ((iter.crypt_data != NULL && iter.crypt_data->encryption == FIL_SPACE_ENCRYPTION_ON) || - (srv_encrypt_tables && - iter.crypt_data && iter.crypt_data->encryption == FIL_SPACE_ENCRYPTION_DEFAULT)) { + if (iter.crypt_data != NULL && iter.crypt_data->should_encrypt()) { encrypted = true; readptr = iter.crypt_io_buffer; @@ -6379,9 +6140,11 @@ fil_iterate( bool decrypted = false; for (ulint i = 0; i < n_pages_read; ++i) { - ulint size = iter.page_size; - byte* src = (readptr + (i * size)); - byte* dst = (io_buffer + (i * size)); + ulint size = iter.page_size; + dberr_t err = DB_SUCCESS; + byte* src = readptr + (i * size); + byte* dst = io_buffer + (i * size); + bool frame_changed = false; ulint page_type = mach_read_from_2(src+FIL_PAGE_TYPE); @@ -6405,9 +6168,12 @@ fil_iterate( if (decrypted) { updated = true; + } else if (!page_compressed + && !row_compressed) { + block->frame = src; + frame_changed = true; } else { - /* TODO: remove unnecessary memcpy's */ - memcpy(dst, src, iter.page_size); + memcpy(dst, src, size); } } @@ -6433,7 +6199,45 @@ fil_iterate( buf_block_set_state(block, BUF_BLOCK_NOT_USED); buf_block_set_state(block, BUF_BLOCK_READY_FOR_USE); - src = (io_buffer + (i * size)); + /* If tablespace is encrypted we use additional + temporary scratch area where pages are read + for decrypting readptr == crypt_io_buffer != io_buffer. + + Destination for decryption is a buffer pool block + block->frame == dst == io_buffer that is updated. + Pages that did not require decryption even when + tablespace is marked as encrypted are not copied + instead block->frame is set to src == readptr. + + For encryption we again use temporary scratch area + writeptr != io_buffer == dst + that is then written to the tablespace + + (1) For normal tables io_buffer == dst == writeptr + (2) For only page compressed tables + io_buffer == dst == writeptr + (3) For encrypted (and page compressed) + readptr != io_buffer == dst != writeptr + */ + + ut_ad(!encrypted && !page_compressed ? + src == dst && dst == writeptr + (i * size):1); + ut_ad(page_compressed && !encrypted ? + src == dst && dst == writeptr + (i * size):1); + ut_ad(encrypted ? + src != dst && dst != writeptr + (i * size):1); + + if (encrypted) { + memcpy(writeptr + (i * size), + row_compressed ? block->page.zip.data : + block->frame, size); + } + + if (frame_changed) { + block->frame = dst; + } + + src = io_buffer + (i * size); if (page_compressed) { ulint len = 0; @@ -6454,7 +6258,7 @@ fil_iterate( write it back. Note that we should not encrypt the buffer that is in buffer pool. */ if (decrypted && encrypted) { - unsigned char *dest = (writeptr + (i * size)); + byte *dest = writeptr + (i * size); ulint space = mach_read_from_4( src + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); ulint offset = mach_read_from_4(src + FIL_PAGE_OFFSET); @@ -6634,12 +6438,11 @@ fil_tablespace_iterate( iter.n_io_buffers = n_io_buffers; iter.page_size = callback.get_page_size().physical(); - ulint crypt_data_offset = fsp_header_get_crypt_offset( - callback.get_page_size(), 0); - /* read (optional) crypt data */ iter.crypt_data = fil_space_read_crypt_data( - 0, page, crypt_data_offset); + 0, page, FSP_HEADER_OFFSET + + fsp_header_get_encryption_offset( + callback.get_page_size())); #ifdef MYSQL_ENCRYPTION /* Set encryption info. */ @@ -6680,18 +6483,24 @@ fil_tablespace_iterate( iter.io_buffer = static_cast( ut_align(io_buffer, UNIV_PAGE_SIZE)); - /** Add an exta buffer for encryption */ - void* crypt_io_buffer = NULL; - if (iter.crypt_data != NULL) { - crypt_io_buffer = ut_malloc_nokey( - iter.n_io_buffers * UNIV_PAGE_SIZE); + void* crypt_io_buffer; + if (iter.crypt_data) { + crypt_io_buffer = static_cast( + ut_malloc_nokey((2 + iter.n_io_buffers) + * UNIV_PAGE_SIZE)); iter.crypt_io_buffer = static_cast( - crypt_io_buffer); + ut_align(crypt_io_buffer, + UNIV_PAGE_SIZE)); + } else { + crypt_io_buffer = NULL; } err = fil_iterate(iter, block, callback); ut_free(io_buffer); + ut_free(crypt_io_buffer); + + fil_space_destroy_crypt_data(&iter.crypt_data); } } @@ -6718,7 +6527,6 @@ fil_tablespace_iterate( return(err); } -#endif /* !UNIV_HOTBACKUP */ /** Set the tablespace table size. @param[in] page a page belonging to the tablespace */ @@ -6797,63 +6605,6 @@ fil_get_space_names( return(err); } -#ifndef UNIV_HOTBACKUP -/** Return the next fil_node_t in the current or next fil_space_t. -Once started, the caller must keep calling this until it returns NULL. -fil_space_acquire() and fil_space_release() are invoked here which -blocks a concurrent operation from dropping the tablespace. -@param[in] prev_node Pointer to the previous fil_node_t. -If NULL, use the first fil_space_t on fil_system->space_list. -@return pointer to the next fil_node_t. -@retval NULL if this was the last file node */ -const fil_node_t* -fil_node_next( - const fil_node_t* prev_node) -{ - fil_space_t* space; - const fil_node_t* node = prev_node; - - mutex_enter(&fil_system->mutex); - - if (node == NULL) { - space = UT_LIST_GET_FIRST(fil_system->space_list); - - /* We can trust that space is not NULL because at least the - system tablespace is always present and loaded first. */ - space->n_pending_ops++; - - node = UT_LIST_GET_FIRST(space->chain); - ut_ad(node != NULL); - } else { - space = node->space; - ut_ad(space->n_pending_ops > 0); - node = UT_LIST_GET_NEXT(chain, node); - - if (node == NULL) { - /* Move on to the next fil_space_t */ - space->n_pending_ops--; - space = UT_LIST_GET_NEXT(space_list, space); - - /* Skip spaces that are being dropped or truncated. */ - while (space != NULL - && (space->stop_new_ops - || space->is_being_truncated)) { - space = UT_LIST_GET_NEXT(space_list, space); - } - - if (space != NULL) { - space->n_pending_ops++; - node = UT_LIST_GET_FIRST(space->chain); - ut_ad(node != NULL); - } - } - } - - mutex_exit(&fil_system->mutex); - - return(node); -} - /** Generate redo log for swapping two .ibd files @param[in] old_table old table @param[in] new_table new table @@ -6952,7 +6703,7 @@ fil_mtr_rename_log( return(DB_SUCCESS); } -#endif /* !UNIV_HOTBACKUP */ + #ifdef UNIV_DEBUG /** Check that a tablespace is valid for mtr_commit(). @param[in] space persistent tablespace that has been changed */ @@ -7040,7 +6791,7 @@ fil_names_dirty_and_write( bogus_name, mtr); }); } -#ifndef UNIV_HOTBACKUP + /** On a log checkpoint, reset fil_names_dirty_and_write() flags and write out MLOG_FILE_NAME and MLOG_CHECKPOINT if needed. @param[in] lsn checkpoint LSN @@ -7212,7 +6963,6 @@ truncate_t::truncate( return(err); } -#endif /* !UNIV_HOTBACKUP */ /** Note that the file system where the file resides doesn't support PUNCH HOLE. @@ -7624,12 +7374,55 @@ fil_space_get_crypt_data( space = fil_space_get_by_id(id); - if (space != NULL) { - crypt_data = space->crypt_data; - } - mutex_exit(&fil_system->mutex); + if (space != NULL) { + /* If we have not yet read the page0 + of this tablespace we will do it now. */ + if (!space->crypt_data && !space->page_0_crypt_read) { + ulint space_id = space->id; + fil_node_t* node; + + ut_a(space->crypt_data == NULL); + node = UT_LIST_GET_FIRST(space->chain); + + byte *buf = static_cast(ut_malloc(2 * UNIV_PAGE_SIZE, PSI_INSTRUMENT_ME)); + byte *page = static_cast(ut_align(buf, UNIV_PAGE_SIZE)); + fil_read(page_id_t(space_id, 0), univ_page_size, 0, univ_page_size.physical(), + page); + ulint flags = fsp_header_get_flags(page); + ulint offset = FSP_HEADER_OFFSET + + fsp_header_get_encryption_offset( + page_size_t(flags)); + space->crypt_data = fil_space_read_crypt_data(space_id, page, offset); + ut_free(buf); + +#ifdef UNIV_DEBUG + ib::info() << "Read page 0 from tablespace for" + << "space " << space_id + << " name " << space->name + << " key_id " << (space->crypt_data ? space->crypt_data->key_id : 0) + << " encryption " << (space->crypt_data ? space->crypt_data->encryption : 0) + << " handle " << node->handle; +#endif + + ut_a(space->id == space_id); + + space->page_0_crypt_read = true; + } + + crypt_data = space->crypt_data; + + if (!space->page_0_crypt_read) { + ib::warn() << "Space " << space->id << " name " + << space->name << " contains encryption " + << (space->crypt_data ? space->crypt_data->encryption : 0) + << " information for key_id " + << (space->crypt_data ? space->crypt_data->key_id : 0) + << " but page0 is not read."; + } + } + return(crypt_data); } diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc index 4479c06f1b2..98d732a9f9d 100644 --- a/storage/innobase/fil/fil0pagecompress.cc +++ b/storage/innobase/fil/fil0pagecompress.cc @@ -48,14 +48,9 @@ Updated 14/02/2015 #include "trx0sys.h" #include "row0mysql.h" #include "ha_prototypes.h" // IB_LOG_ -#ifndef UNIV_HOTBACKUP -# include "buf0lru.h" -# include "ibuf0ibuf.h" -# include "sync0sync.h" -#else /* !UNIV_HOTBACKUP */ -# include "srv0srv.h" -static ulint srv_data_read, srv_data_written; -#endif /* !UNIV_HOTBACKUP */ +#include "buf0lru.h" +#include "ibuf0ibuf.h" +#include "sync0sync.h" #include "zlib.h" #ifdef __linux__ #include diff --git a/storage/innobase/fsp/fsp0file.cc b/storage/innobase/fsp/fsp0file.cc index 501a8e58622..0e1d2f3233b 100644 --- a/storage/innobase/fsp/fsp0file.cc +++ b/storage/innobase/fsp/fsp0file.cc @@ -33,9 +33,6 @@ Created 2013-7-26 by Kevin Lewis #include "srv0start.h" #include "ut0new.h" #include "fil0crypt.h" -#ifdef UNIV_HOTBACKUP -#include "my_sys.h" -#endif /* UNIV_HOTBACKUP */ /** Initialize the name, size and order of this datafile @param[in] name tablespace name, will be copied @@ -63,22 +60,17 @@ Datafile::shutdown() ut_free(m_name); m_name = NULL; + ut_free(m_encryption_key); + m_encryption_key = NULL; + + /* The fil_space_t::crypt_data was freed in + fil_space_free_low(). Invalidate our redundant pointer. */ + m_crypt_info = NULL; + + ut_free(m_encryption_iv); + m_encryption_iv = NULL; + free_filepath(); - - if (m_encryption_key != NULL) { - ut_free(m_encryption_key); - m_encryption_key = NULL; - } - - if (m_crypt_info) { - fil_space_destroy_crypt_data(&m_crypt_info); - } - - if (m_encryption_iv != NULL) { - ut_free(m_encryption_iv); - m_encryption_iv = NULL; - } - free_first_page(); } @@ -373,9 +365,10 @@ Datafile::read_first_page(bool read_only_mode) m_space_id = fsp_header_get_space_id(m_first_page); } - const page_size_t page_sz = fsp_header_get_page_size(m_first_page); - ulint offset = fsp_header_get_crypt_offset(page_sz, NULL); - m_crypt_info = fil_space_read_crypt_data(m_space_id, m_first_page, offset); + m_crypt_info = fil_space_read_crypt_data( + m_space_id, m_first_page, + FSP_HEADER_OFFSET + fsp_header_get_encryption_offset( + fsp_header_get_page_size(m_first_page))); return(err); } @@ -463,39 +456,6 @@ Datafile::validate_for_recovery() switch (err) { case DB_SUCCESS: case DB_TABLESPACE_EXISTS: -#ifdef UNIV_HOTBACKUP - err = restore_from_doublewrite(0); - if (err != DB_SUCCESS) { - return(err); - } - /* Free the previously read first page and then re-validate. */ - free_first_page(); - err = validate_first_page(0, false); - if (err == DB_SUCCESS) { - std::string filepath = fil_space_get_first_path( - m_space_id); - if (is_intermediate_file(filepath.c_str())) { - /* Existing intermediate file with same space - id is obsolete.*/ - if (fil_space_free(m_space_id, FALSE)) { - err = DB_SUCCESS; - } - } else { - filepath.assign(m_filepath); - if (is_intermediate_file(filepath.c_str())) { - /* New intermediate file with same space id - shall be ignored.*/ - err = DB_TABLESPACE_EXISTS; - /* Set all bits of 'flags' as a special - indicator for "ignore tablespace". Hopefully - InnoDB will never use all bits or at least all - bits set will not be a meaningful setting - otherwise.*/ - m_flags = ~0; - } - } - } -#endif /* UNIV_HOTBACKUP */ break; default: diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index 9dc99f3f09d..fe272accd5a 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -31,9 +31,6 @@ Created 11/29/1995 Heikki Tuuri #include "fsp0fsp.ic" #endif -#ifdef UNIV_HOTBACKUP -# include "fut0lst.h" -#else /* UNIV_HOTBACKUP */ #include "buf0buf.h" #include "fil0fil.h" #include "fil0crypt.h" @@ -215,7 +212,6 @@ fsp_flags_to_dict_tf( return(flags); } -#endif /* !UNIV_HOTBACKUP */ /** Validate the tablespace flags. These flags are stored in the tablespace header at offset FSP_SPACE_FLAGS. @@ -338,16 +334,6 @@ err_exit: return (false); } -/** Check if tablespace is system temporary. -@param[in] space_id tablespace ID -@return true if tablespace is system temporary. */ -bool -fsp_is_system_temporary( - ulint space_id) -{ - return(space_id == srv_tmp_space.space_id()); -} - /** Check if checksum is disabled for the given space. @param[in] space_id tablespace ID @return true if checksum is disabled for given space. */ @@ -371,9 +357,7 @@ fsp_is_file_per_table( && !fsp_is_shared_tablespace(fsp_flags)); } -#ifndef UNIV_HOTBACKUP #ifdef UNIV_DEBUG - /** Skip some of the sanity checks that are time consuming even in debug mode and can affect frequent verification runs that are done to ensure stability of the product. @@ -385,7 +369,6 @@ fsp_skip_sanity_check( return(srv_skip_temp_table_checks_debug && fsp_is_system_temporary(space_id)); } - #endif /* UNIV_DEBUG */ /**********************************************************************//** @@ -751,7 +734,6 @@ xdes_get_offset( + ((page_offset(descr) - XDES_ARR_OFFSET) / XDES_SIZE) * FSP_EXTENT_SIZE); } -#endif /* !UNIV_HOTBACKUP */ /***********************************************************//** Inits a file page whose prior contents should be ignored. */ @@ -781,8 +763,7 @@ fsp_init_file_page_low( } } -#ifndef UNIV_HOTBACKUP -# ifdef UNIV_DEBUG +#ifdef UNIV_DEBUG /** Assert that the mini-transaction is compatible with updating an allocation bitmap page. @param[in] id tablespace identifier @@ -800,24 +781,18 @@ fsp_space_modify_check( when there is a higher-level redo log record written. */ break; case MTR_LOG_NO_REDO: -#ifdef UNIV_DEBUG { const fil_type_t type = fil_space_get_type(id); - ut_a(id == srv_tmp_space.space_id() - || srv_is_tablespace_truncated(id) + ut_a(srv_is_tablespace_truncated(id) || fil_space_is_being_truncated(id) || fil_space_get_flags(id) == ULINT_UNDEFINED || type == FIL_TYPE_TEMPORARY || type == FIL_TYPE_IMPORT || fil_space_is_redo_skipped(id)); } -#endif /* UNIV_DEBUG */ return; case MTR_LOG_ALL: - /* We must not write redo log for the shared temporary - tablespace. */ - ut_ad(id != srv_tmp_space.space_id()); - /* If we write redo log, the tablespace must exist. */ + /* We may only write redo log for a persistent tablespace. */ ut_ad(fil_space_get_type(id) == FIL_TYPE_TABLESPACE); ut_ad(mtr->is_named_space(id)); return; @@ -825,7 +800,7 @@ fsp_space_modify_check( ut_ad(0); } -# endif /* UNIV_DEBUG */ +#endif /* UNIV_DEBUG */ /** Initialize a file page. @param[in,out] block file page @@ -842,7 +817,6 @@ fsp_init_file_page( mlog_write_initial_log_record(buf_block_get_frame(block), MLOG_INIT_FILE_PAGE2, mtr); } -#endif /* !UNIV_HOTBACKUP */ /***********************************************************//** Parses a redo log record of a file page init. @@ -903,31 +877,6 @@ fsp_header_init_fields( flags); } -#ifndef UNIV_HOTBACKUP -/** Get the offset of encrytion information in page 0. -@param[in] page_size page size. -@return offset on success, otherwise 0. */ -static -ulint -fsp_header_get_encryption_offset( - const page_size_t& page_size) -{ - ulint offset; -#ifdef UNIV_DEBUG - ulint left_size; -#endif - - offset = XDES_ARR_OFFSET + XDES_SIZE * xdes_arr_size(page_size); -#ifdef UNIV_DEBUG - left_size = page_size.physical() - FSP_HEADER_OFFSET - offset - - FIL_PAGE_DATA_END; - - ut_ad(left_size >= ENCRYPTION_INFO_SIZE_V2); -#endif - - return offset; -} - #if 0 /* MySQL 5.7 Encryption */ /** Fill the encryption info. @param[in] space tablespace @@ -1194,13 +1143,14 @@ fsp_header_init( } } - ulint maxsize = 0; - ulint offset = fsp_header_get_crypt_offset(page_size, &maxsize); - fil_space_write_crypt_data(space_id, page, offset, maxsize, mtr); + ulint offset = FSP_HEADER_OFFSET + + fsp_header_get_encryption_offset(page_size); + fil_space_write_crypt_data(space_id, page, offset, + page_size.logical() + - offset - FIL_PAGE_DATA_END, mtr); return(true); } -#endif /* !UNIV_HOTBACKUP */ /**********************************************************************//** Reads the space id from the first page of a tablespace. @@ -1397,7 +1347,6 @@ fsp_header_get_encryption_key( } #endif /* ! */ -#ifndef UNIV_HOTBACKUP /**********************************************************************//** Increases the space size field of a space. */ void @@ -1549,15 +1498,14 @@ fsp_try_extend_data_file( const page_size_t page_size( mach_read_from_4(header + FSP_SPACE_FLAGS)); - if (space->id == srv_sys_space.space_id()) { - + switch (space->id) { + case TRX_SYS_SPACE: size_increase = srv_sys_space.get_increment(); - - } else if (space->id == srv_tmp_space.space_id()) { - + break; + case SRV_TMP_SPACE_ID: size_increase = srv_tmp_space.get_increment(); - - } else { + break; + default: ulint extent_pages = fsp_get_extent_size_in_pages(page_size); if (size < extent_pages) { @@ -1679,11 +1627,17 @@ fsp_fill_free_list( const page_size_t page_size(flags); if (size < limit + FSP_EXTENT_SIZE * FSP_FREE_ADD) { - if ((!init_space && !is_system_tablespace(space->id)) - || (space->id == srv_sys_space.space_id() - && srv_sys_space.can_auto_extend_last_file()) - || (space->id == srv_tmp_space.space_id() - && srv_tmp_space.can_auto_extend_last_file())) { + bool skip_resize = init_space; + switch (space->id) { + case TRX_SYS_SPACE: + skip_resize = !srv_sys_space.can_auto_extend_last_file(); + break; + case SRV_TMP_SPACE_ID: + skip_resize = srv_tmp_space.can_auto_extend_last_file(); + break; + } + + if (!skip_resize) { ulint n_pages = 0; fsp_try_extend_data_file(space, header, mtr, &n_pages); size = space->size_in_header; @@ -1733,7 +1687,7 @@ fsp_fill_free_list( order, and we must be able to release its latch. Note: Insert-Buffering is disabled for tables that reside in the temp-tablespace. */ - if (space->id != srv_tmp_space.space_id()) { + if (space->purpose != FIL_TYPE_TEMPORARY) { mtr_t ibuf_mtr; mtr_start(&ibuf_mtr); @@ -1741,9 +1695,7 @@ fsp_fill_free_list( /* Avoid logging while truncate table fix-up is active. */ - if (space->purpose == FIL_TYPE_TEMPORARY - || srv_is_tablespace_truncated( - space->id)) { + if (srv_is_tablespace_truncated(space->id)) { mtr_set_log_mode( &ibuf_mtr, MTR_LOG_NO_REDO); } @@ -4305,7 +4257,6 @@ fseg_print( fseg_print_low(inode, mtr); } #endif /* UNIV_BTR_PRINT */ -#endif /* !UNIV_HOTBACKUP */ #ifdef UNIV_DEBUG /** Print the file segment header to the given output stream. @@ -4353,35 +4304,3 @@ fsp_page_is_free_func( return xdes_mtr_get_bit( descr, XDES_FREE_BIT, page_no % FSP_EXTENT_SIZE, mtr); } - -/**********************************************************************//** -Compute offset after xdes where crypt data can be stored -@return offset */ -ulint -fsp_header_get_crypt_offset( -/*========================*/ - const page_size_t& page_size,/*!< in: page size */ - ulint* max_size) /*!< out: free space available for crypt data */ -{ - ulint pageno = 0; - /* compute first page_no that will have xdes stored on page != 0*/ - - for (ulint i = 0; - (pageno = xdes_calc_descriptor_page(page_size, i)) == 0; ) - i++; - - /* use pageno prior to this...i.e last page on page 0 */ - ut_ad(pageno > 0); - pageno--; - - ulint iv_offset = XDES_ARR_OFFSET + - XDES_SIZE * (1 + xdes_calc_descriptor_index(page_size, pageno)); - - if (max_size != NULL) { - /* return how much free space there is available on page */ - *max_size = (page_size.logical() ? page_size.logical() : UNIV_PAGE_SIZE) - - (FSP_HEADER_OFFSET + iv_offset + FIL_PAGE_DATA_END); - } - - return FSP_HEADER_OFFSET + iv_offset; -} diff --git a/storage/innobase/fsp/fsp0space.cc b/storage/innobase/fsp/fsp0space.cc index f66f7b8fc78..45942f58dd3 100644 --- a/storage/innobase/fsp/fsp0space.cc +++ b/storage/innobase/fsp/fsp0space.cc @@ -27,14 +27,10 @@ Created 2012-11-16 by Sunny Bains as srv/srv0space.cc #include "fsp0space.h" #include "fsp0sysspace.h" -#ifndef UNIV_HOTBACKUP #include "fsp0fsp.h" #include "os0file.h" -#endif /* !UNIV_HOTBACKUP */ - #include "my_sys.h" - /** Check if two tablespaces have common data file names. @param other_space Tablespace to check against this. @return true if they have the same data filenames and paths */ @@ -122,18 +118,12 @@ Tablespace::open_or_create(bool is_temp) break; } - bool atomic_write; - -#if !defined(NO_FALLOCATE) && defined(UNIV_LINUX) - if (!srv_use_doublewrite_buf) { - atomic_write = fil_fusionio_enable_atomic_write( - it->m_handle); - } else { - atomic_write = false; - } +#ifdef UNIV_LINUX + const bool atomic_write = fil_fusionio_enable_atomic_write( + it->m_handle); #else - atomic_write = false; -#endif /* !NO_FALLOCATE && UNIV_LINUX */ + const bool atomic_write = false; +#endif /* We can close the handle now and open the tablespace the proper way. */ @@ -150,7 +140,8 @@ Tablespace::open_or_create(bool is_temp) tablespace in the tablespace manager. */ space = fil_space_create( m_name, m_space_id, flags, is_temp - ? FIL_TYPE_TEMPORARY : FIL_TYPE_TABLESPACE, it->m_crypt_info); + ? FIL_TYPE_TEMPORARY : FIL_TYPE_TABLESPACE, it->m_crypt_info, + false); } ut_a(fil_validate()); @@ -185,7 +176,6 @@ Tablespace::find(const char* filename) return(false); } - /** Delete all the data files. */ void Tablespace::delete_files() @@ -207,17 +197,6 @@ Tablespace::delete_files() } } -/** Check if undo tablespace. -@return true if undo tablespace */ -bool -Tablespace::is_undo_tablespace( - ulint id) -{ - return(id <= srv_undo_tablespaces_open - && id != srv_sys_space.space_id() - && id != srv_tmp_space.space_id()); -} - /** Use the ADD DATAFILE path to create a Datafile object and add it to the front of m_files. Parse the datafile path into a path and a filename with extension 'ibd'. diff --git a/storage/innobase/fsp/fsp0sysspace.cc b/storage/innobase/fsp/fsp0sysspace.cc index 66b5da15e8b..fa6a46890db 100644 --- a/storage/innobase/fsp/fsp0sysspace.cc +++ b/storage/innobase/fsp/fsp0sysspace.cc @@ -29,7 +29,6 @@ Refactored 2013-7-26 by Kevin Lewis #include "fsp0sysspace.h" #include "srv0start.h" #include "trx0sys.h" -#ifndef UNIV_HOTBACKUP #include "dict0load.h" #include "mem0mem.h" #include "os0file.h" @@ -40,9 +39,6 @@ Refactored 2013-7-26 by Kevin Lewis If server passes the option for create/open DB to SE, we should remove such direct reference to server header and global variable */ #include "mysqld.h" -#else -my_bool opt_initialize = 0; -#endif /* !UNIV_HOTBACKUP */ /** The control info of the system tablespace. */ SysTablespace srv_sys_space; @@ -364,7 +360,8 @@ SysTablespace::check_size( also the data file could contain an incomplete extent. So we need to round the size downward to a megabyte.*/ - ulint rounded_size_pages = get_pages_from_size(size); + const ulint rounded_size_pages = static_cast( + size >> UNIV_PAGE_SIZE_SHIFT); /* If last file */ if (&file == &m_files.back() && m_auto_extend_last_file) { @@ -375,7 +372,7 @@ SysTablespace::check_size( ib::error() << "The Auto-extending " << name() << " data file '" << file.filepath() << "' is" " of a different size " << rounded_size_pages - << " pages (rounded down to MB) than specified" + << " pages than specified" " in the .cnf file: initial " << file.m_size << " pages, max " << m_last_file_size_max << " (relevant if non-zero) pages!"; @@ -388,7 +385,7 @@ SysTablespace::check_size( if (rounded_size_pages != file.m_size) { ib::error() << "The " << name() << " data file '" << file.filepath() << "' is of a different size " - << rounded_size_pages << " pages (rounded down to MB)" + << rounded_size_pages << " pages" " than the " << file.m_size << " pages specified in" " the .cnf file!"; return(DB_ERROR); @@ -537,7 +534,6 @@ SysTablespace::open_file( return(err); } -#ifndef UNIV_HOTBACKUP /** Check the tablespace header for this tablespace. @param[out] flushed_lsn the value of FIL_PAGE_FILE_FLUSH_LSN @return DB_SUCCESS or error code */ @@ -612,7 +608,7 @@ SysTablespace::read_lsn_and_check_flags(lsn_t* flushed_lsn) return(DB_SUCCESS); } -#endif /* !UNIV_HOTBACKUP */ + /** Check if a file can be opened in the correct mode. @param[in] file data file object @param[out] reason exact reason if file_status check failed. @@ -759,7 +755,7 @@ SysTablespace::file_found( /* Need to create the system tablespace for new raw device. */ return(file.m_type == SRV_NEW_RAW); } -#ifndef UNIV_HOTBACKUP + /** Check the data file specification. @param[out] create_new_db true if a new database is to be created @param[in] min_expected_size Minimum expected tablespace size in bytes @@ -779,7 +775,8 @@ SysTablespace::check_file_spec( return(DB_ERROR); } - if (get_sum_of_sizes() < min_expected_size / UNIV_PAGE_SIZE) { + if (!m_auto_extend_last_file + && get_sum_of_sizes() < min_expected_size / UNIV_PAGE_SIZE) { ib::error() << "Tablespace size must be at least " << min_expected_size / (1024 * 1024) << " MB"; @@ -909,28 +906,24 @@ SysTablespace::open_or_create( return(err); } -#if !defined(NO_FALLOCATE) && defined(UNIV_LINUX) +#ifdef UNIV_LINUX /* Note: This should really be per node and not per tablespace because a tablespace can contain multiple files (nodes). The implication is that all files of the tablespace should be on the same medium. */ - if (fil_fusionio_enable_atomic_write(it->m_handle)) { + it->m_atomic_write + = fil_fusionio_enable_atomic_write(it->m_handle); - if (srv_use_doublewrite_buf) { - ib::info() << "FusionIO atomic IO enabled," - " disabling the double write buffer"; + if (it->m_atomic_write && srv_use_doublewrite_buf) { + ib::info() << "FusionIO atomic IO enabled," + " disabling the double write buffer"; - srv_use_doublewrite_buf = false; - } - - it->m_atomic_write = true; - } else { - it->m_atomic_write = false; + srv_use_doublewrite_buf = false; } #else it->m_atomic_write = false; -#endif /* !NO_FALLOCATE && UNIV_LINUX*/ +#endif } if (!create_new_db && flush_lsn) { @@ -966,7 +959,8 @@ SysTablespace::open_or_create( space = fil_space_create( name(), space_id(), flags(), is_temp - ? FIL_TYPE_TEMPORARY : FIL_TYPE_TABLESPACE, m_crypt_info); + ? FIL_TYPE_TEMPORARY : FIL_TYPE_TABLESPACE, m_crypt_info, + false); } ut_a(fil_validate()); @@ -990,7 +984,7 @@ SysTablespace::open_or_create( return(err); } -#endif /* UNIV_HOTBACKUP */ + /** Normalize the file size, convert from megabytes to number of pages. */ void SysTablespace::normalize() diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index 3451607a37e..d74f8cfa5bf 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2016, MariaDB Corporation. All Rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1857,7 +1858,7 @@ fts_create_one_common_table( TRX_DICT_OP_TABLE. */ trx_dict_op_t op = trx_get_dict_operation(trx); - error = row_create_index_for_mysql(index, trx, NULL, NULL); + error = row_create_index_for_mysql(index, trx, NULL); trx->dict_operation = op; } @@ -1974,7 +1975,7 @@ fts_create_common_tables( op = trx_get_dict_operation(trx); - error = row_create_index_for_mysql(index, trx, NULL, NULL); + error = row_create_index_for_mysql(index, trx, NULL); trx->dict_operation = op; @@ -1992,18 +1993,20 @@ func_exit: return(error); } -/** Creates one FTS auxiliary index table for an FTS index. + +/** Create one FTS auxiliary index table for an FTS index. @param[in,out] trx transaction @param[in] index the index instance @param[in] fts_table fts_table structure -@param[in] heap memory heap +@param[in,out] heap memory heap +@see row_merge_create_fts_sort_index() @return DB_SUCCESS or error code */ static dict_table_t* fts_create_one_index_table( trx_t* trx, const dict_index_t* index, - fts_table_t* fts_table, + const fts_table_t* fts_table, mem_heap_t* heap) { dict_field_t* field; @@ -2027,7 +2030,8 @@ fts_create_one_index_table( charset == &my_charset_latin1 ? DATA_VARCHAR : DATA_VARMYSQL, field->col->prtype, - FTS_INDEX_WORD_LEN); + FTS_MAX_WORD_LEN_IN_CHAR + * DATA_MBMAXLEN(field->col->mbminmaxlen)); dict_mem_table_add_col(new_table, heap, "first_doc_id", DATA_INT, DATA_NOT_NULL | DATA_UNSIGNED, @@ -2063,7 +2067,7 @@ fts_create_one_index_table( trx_dict_op_t op = trx_get_dict_operation(trx); - error = row_create_index_for_mysql(index, trx, NULL, NULL); + error = row_create_index_for_mysql(index, trx, NULL); trx->dict_operation = op; } diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc index 5989aff83f4..45c71f6f1cd 100644 --- a/storage/innobase/fts/fts0opt.cc +++ b/storage/innobase/fts/fts0opt.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2016, MariaDB Corporation. All Rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -285,7 +286,7 @@ fts_zip_initialize( zip->last_big_block = 0; zip->word.f_len = 0; - memset(zip->word.f_str, 0, FTS_MAX_WORD_LEN); + *zip->word.f_str = 0; ib_vector_reset(zip->blocks); diff --git a/storage/innobase/gis/gis0geo.cc b/storage/innobase/gis/gis0geo.cc index b90b47dc08c..436249c0026 100644 --- a/storage/innobase/gis/gis0geo.cc +++ b/storage/innobase/gis/gis0geo.cc @@ -364,8 +364,9 @@ mbr_join_square( b += 2; } while (a != end); - /* Check for infinity or NaN, so we don't get NaN in calculations */ - if (my_isinf(square) || my_isnan(square)) { + /* Check if finite (not infinity or NaN), + so we don't get NaN in calculations */ + if (!isfinite(square)) { return DBL_MAX; } diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc index ee89e0a913f..559ac2a6aa5 100644 --- a/storage/innobase/gis/gis0rtree.cc +++ b/storage/innobase/gis/gis0rtree.cc @@ -28,8 +28,6 @@ Created 2013/03/27 Allen Lai and Jimmy Yang #include "page0cur.h" #include "page0zip.h" #include "gis0rtree.h" - -#ifndef UNIV_HOTBACKUP #include "btr0cur.h" #include "btr0sea.h" #include "btr0pcur.h" @@ -40,8 +38,6 @@ Created 2013/03/27 Allen Lai and Jimmy Yang #include "srv0mon.h" #include "gis0geo.h" -#endif /* UNIV_HOTBACKUP */ - /*************************************************************//** Initial split nodes info for R-tree split. @return initialized split nodes array */ @@ -1988,7 +1984,7 @@ rtr_estimate_n_rows_in_range( mtr_commit(&mtr); mem_heap_free(heap); - if (my_isinf(area) || my_isnan(area)) { + if (!isfinite(area)) { return(HA_POS_ERROR); } diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc index 2c0c5b453a3..99543ef8c9c 100644 --- a/storage/innobase/gis/gis0sea.cc +++ b/storage/innobase/gis/gis0sea.cc @@ -28,8 +28,6 @@ Created 2014/01/16 Jimmy Yang #include "page0cur.h" #include "page0zip.h" #include "gis0rtree.h" - -#ifndef UNIV_HOTBACKUP #include "btr0cur.h" #include "btr0sea.h" #include "btr0pcur.h" @@ -40,8 +38,6 @@ Created 2014/01/16 Jimmy Yang #include "srv0mon.h" #include "gis0geo.h" -#endif /* UNIV_HOTBACKUP */ - /*************************************************************//** Pop out used parent path entry, until we find the parent with matching page number */ @@ -1550,7 +1546,6 @@ rtr_copy_buf( (another) thread while it was copied. */ memcpy(&matches->block.page, &block->page, sizeof(buf_page_t)); matches->block.frame = block->frame; -#ifndef UNIV_HOTBACKUP matches->block.unzip_LRU = block->unzip_LRU; ut_d(matches->block.in_unzip_LRU_list = block->in_unzip_LRU_list); @@ -1569,12 +1564,9 @@ rtr_copy_buf( matches->block.curr_n_fields = block->curr_n_fields; matches->block.curr_left_side = block->curr_left_side; matches->block.index = block->index; - matches->block.made_dirty_with_no_latch - = block->made_dirty_with_no_latch; ut_d(matches->block.debug_latch = block->debug_latch); -#endif /* !UNIV_HOTBACKUP */ } /****************************************************************//** diff --git a/storage/innobase/ha/ha0ha.cc b/storage/innobase/ha/ha0ha.cc index f57a6d383d9..cf92f22ac15 100644 --- a/storage/innobase/ha/ha0ha.cc +++ b/storage/innobase/ha/ha0ha.cc @@ -28,11 +28,10 @@ Created 8/22/1994 Heikki Tuuri #include "ha0ha.ic" #endif -#ifndef UNIV_HOTBACKUP #ifdef UNIV_DEBUG # include "buf0buf.h" #endif /* UNIV_DEBUG */ -# include "btr0sea.h" +#include "btr0sea.h" #include "page0page.h" /*************************************************************//** @@ -537,4 +536,3 @@ builds, see http://bugs.mysql.com/36941 */ (ulong) n_bufs); } } -#endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/ha/hash0hash.cc b/storage/innobase/ha/hash0hash.cc index 234fd7ac032..7c5798ae254 100644 --- a/storage/innobase/ha/hash0hash.cc +++ b/storage/innobase/ha/hash0hash.cc @@ -32,8 +32,6 @@ Created 5/20/1997 Heikki Tuuri #include "mem0mem.h" #include "sync0sync.h" -#ifndef UNIV_HOTBACKUP - /************************************************************//** Reserves the mutex for a fold value in a hash table. */ void @@ -249,8 +247,6 @@ hash_unlock_x_all_but( } } -#endif /* !UNIV_HOTBACKUP */ - /*************************************************************//** Creates a hash table with >= n array cells. The actual number of cells is chosen to be a prime number slightly bigger than n. @@ -277,14 +273,12 @@ hash_create( table->type = HASH_TABLE_SYNC_NONE; table->array = array; table->n_cells = prime; -#ifndef UNIV_HOTBACKUP -# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG +#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG table->adaptive = FALSE; -# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ +#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ table->n_sync_obj = 0; table->sync_obj.mutexes = NULL; table->heaps = NULL; -#endif /* !UNIV_HOTBACKUP */ table->heap = NULL; ut_d(table->magic_n = HASH_TABLE_MAGIC_N); @@ -307,7 +301,6 @@ hash_table_free( ut_free(table); } -#ifndef UNIV_HOTBACKUP /*************************************************************//** Creates a sync object array to protect a hash table. ::sync_obj can be mutexes or rw_locks depening on the type of @@ -362,4 +355,3 @@ hash_create_sync_obj( table->n_sync_obj = n_sync_obj; } -#endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 1e74154f26d..6a6a049d5a6 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -126,6 +126,14 @@ this program; if not, write to the Free Software Foundation, Inc., #define thd_get_trx_isolation(X) ((enum_tx_isolation)thd_tx_isolation(X)) extern "C" void thd_mark_transaction_to_rollback(MYSQL_THD thd, bool all); +unsigned long long thd_get_query_id(const MYSQL_THD thd); +TABLE *find_fk_open_table(THD *thd, const char *db, size_t db_len, + const char *table, size_t table_len); +MYSQL_THD create_thd(); +void destroy_thd(MYSQL_THD thd); +void reset_thd(MYSQL_THD thd); +TABLE *open_purge_table(THD *thd, const char *db, size_t dblen, + const char *tb, size_t tblen); #ifdef MYSQL_DYNAMIC_PLUGIN #define tc_size 400 @@ -242,7 +250,7 @@ values */ static ulong innobase_fast_shutdown = 1; static my_bool innobase_file_format_check = TRUE; static my_bool innobase_use_atomic_writes = FALSE; -static my_bool innobase_use_fallocate = TRUE; +static my_bool innobase_use_fallocate; static my_bool innobase_use_doublewrite = TRUE; static my_bool innobase_use_checksums = TRUE; static my_bool innobase_locks_unsafe_for_binlog = FALSE; @@ -281,6 +289,77 @@ void set_my_errno(int err) errno = err; } + +/** Checks whether the file name belongs to a partition of a table. +@param[in] file_name file name +@return pointer to the end of the table name part of the file name, or NULL */ +static +char* +is_partition( +/*=========*/ + char* file_name) +{ + /* We look for pattern #P# to see if the table is partitioned + MariaDB table. */ +#ifdef _WIN32 + return strstr(file_name, "#p#"); +#else + return strstr(file_name, "#P#"); +#endif /* _WIN32 */ +} + +/** Service thread that waits for the server shutdown and stops purge threads. +Purge workers have THDs that are needed to calculate virtual columns. +This THDs must be destroyed rather early in the server shutdown sequence. +This service thread creates a THD and idly waits for it to get a signal to +die. Then it notifies all purge workers to shutdown. +*/ +st_my_thread_var *thd_destructor_myvar= NULL; +mysql_cond_t thd_destructor_cond; +pthread_t thd_destructor_thread; + +pthread_handler_t +thd_destructor_proxy(void *) +{ + mysql_mutex_t thd_destructor_mutex; + + my_thread_init(); + mysql_mutex_init(PSI_NOT_INSTRUMENTED, &thd_destructor_mutex, 0); + mysql_cond_init(PSI_NOT_INSTRUMENTED, &thd_destructor_cond, 0); + + thd_destructor_myvar = _my_thread_var(); + THD *thd= create_thd(); + thd_proc_info(thd, "InnoDB background thread"); + + mysql_mutex_lock(&thd_destructor_mutex); + thd_destructor_myvar->current_mutex = &thd_destructor_mutex; + thd_destructor_myvar->current_cond = &thd_destructor_cond; + /* wait until the server wakes the THD to abort and die */ + while (!thd_destructor_myvar->abort) + mysql_cond_wait(&thd_destructor_cond, &thd_destructor_mutex); + mysql_mutex_unlock(&thd_destructor_mutex); + thd_destructor_myvar = NULL; + + srv_fast_shutdown = (ulint) innobase_fast_shutdown; + if (srv_fast_shutdown == 0) { + while (trx_sys_any_active_transactions()) { + os_thread_sleep(1000); + } + + /* Some background threads might generate undo pages that will + need to be purged, so they have to be shut down before purge + threads if slow shutdown is requested. */ + srv_shutdown_bg_undo_sources(); + } + srv_purge_wakeup(); + + destroy_thd(thd); + mysql_cond_destroy(&thd_destructor_cond); + mysql_mutex_destroy(&thd_destructor_mutex); + my_thread_end(); + return 0; +} + /** Return the InnoDB ROW_FORMAT enum value @param[in] row_format row_format from "innodb_default_row_format" @return InnoDB ROW_FORMAT value from rec_format_t enum. */ @@ -379,6 +458,22 @@ static TYPELIB innodb_default_row_format_typelib = { NULL }; +/** Possible values of the parameter innodb_lock_schedule_algorithm */ +static const char* innodb_lock_schedule_algorithm_names[] = { + "fcfs", + "vats", + NullS +}; + +/** Used to define an enumerate type of the system variable +innodb_lock_schedule_algorithm. */ +static TYPELIB innodb_lock_schedule_algorithm_typelib = { + array_elements(innodb_lock_schedule_algorithm_names) - 1, + "innodb_lock_schedule_algorithm_typelib", + innodb_lock_schedule_algorithm_names, + NULL +}; + /* The following counter is used to convey information to InnoDB about server activity: in case of normal DML ops it is not sensible to call srv_active_wake_master_thread after each @@ -437,9 +532,11 @@ static mysql_pfs_key_t innobase_share_mutex_key; static mysql_pfs_key_t commit_cond_mutex_key; static mysql_pfs_key_t commit_cond_key; static mysql_pfs_key_t pending_checkpoint_mutex_key; +static mysql_pfs_key_t thd_destructor_thread_key; static PSI_mutex_info all_pthread_mutexes[] = { PSI_KEY(commit_cond_mutex), + PSI_KEY(pending_checkpoint_mutex), PSI_KEY(innobase_share_mutex) }; @@ -564,6 +661,7 @@ static PSI_thread_info all_innodb_threads[] = { PSI_KEY(srv_purge_thread), PSI_KEY(srv_worker_thread), PSI_KEY(trx_rollback_clean_thread), + PSI_KEY(thd_destructor_thread), }; # endif /* UNIV_PFS_THREAD */ @@ -668,6 +766,11 @@ srv_mbr_debug(const byte* data) static void innodb_remember_check_sysvar_funcs(); mysql_var_check_func check_sysvar_enum; +// should page compression be used by default for new tables +static MYSQL_THDVAR_BOOL(compression_default, PLUGIN_VAR_OPCMDARG, + "Is compression the default for new tables", + NULL, NULL, FALSE); + static MYSQL_THDVAR_UINT(default_encryption_key_id, PLUGIN_VAR_RQCMDARG, "Default encryption key id used for table encryption.", NULL, NULL, @@ -685,7 +788,7 @@ ha_create_table_option innodb_table_option_list[]= { /* With this option user can enable page compression feature for the table */ - HA_TOPTION_BOOL("PAGE_COMPRESSED", page_compressed, 0), + HA_TOPTION_SYSVAR("PAGE_COMPRESSED", page_compressed, compression_default), /* With this option user can set zip compression level for page compression for this table*/ HA_TOPTION_NUMBER("PAGE_COMPRESSION_LEVEL", page_compression_level, 0, 1, 9, 1), @@ -830,13 +933,17 @@ innobase_map_isolation_level( /** Gets field offset for a field in a table. @param[in] table MySQL table object -@param[in] field MySQL field object +@param[in] field MySQL field object (from table->field array) @return offset */ static inline uint get_field_offset( const TABLE* table, - const Field* field); + const Field* field) +{ + return field->offset(table->record[0]); +} + /*************************************************************//** Check for a valid value of innobase_compression_algorithm. @@ -1016,6 +1123,8 @@ static SHOW_VAR innodb_status_variables[]= { (char*) &export_vars.innodb_pages_created, SHOW_LONG}, {"pages_read", (char*) &export_vars.innodb_pages_read, SHOW_LONG}, + {"pages0_read", + (char*) &export_vars.innodb_page0_read, SHOW_LONG}, {"pages_written", (char*) &export_vars.innodb_pages_written, SHOW_LONG}, {"row_lock_current_waits", @@ -1164,6 +1273,8 @@ static SHOW_VAR innodb_status_variables[]= { {"scrub_background_page_split_failures_unknown", (char*) &export_vars.innodb_scrub_page_split_failures_unknown, SHOW_LONG}, + {"encryption_num_key_requests", + (char*) &export_vars.innodb_encryption_key_requests, SHOW_LONGLONG}, {NullS, NullS, SHOW_LONG} }; @@ -1523,31 +1634,6 @@ innodb_enable_monitor_at_startup( /*=============================*/ char* str); /*!< in: monitor counter enable list */ -/** Fill handlerton based INFORMATION_SCHEMA tables. -@param[in] (unused) Handle to the handlerton structure -@param[in] thd Thread/connection descriptor -@param[in,out] tables Information Schema tables to fill -@param[in] (unused) Intended for conditional pushdown -@param[in] idx Table id that indicates which I_S table to fill -@return Operation status */ -static -int -innobase_fill_i_s_table( - handlerton*, - THD* thd, - TABLE_LIST* tables, - Item*, - enum_schema_tables idx) -{ - int ret = 0; - - if (idx == SCH_FILES) { - ret = i_s_files_table_fill(thd, tables); - } - - return(ret); -} - #ifdef MYSQL_STORE_FTS_DOC_ID /** Store doc_id value into FTS_DOC_ID field @param[in,out] tbl table containing FULLTEXT index @@ -1671,7 +1757,7 @@ thd_is_replication_slave_thread( /*============================*/ THD* thd) /*!< in: thread handle */ { - return((ibool) thd_slave_thread(thd)); + return thd && ((ibool) thd_slave_thread(thd)); } /******************************************************************//** @@ -1697,6 +1783,56 @@ thd_trx_is_read_only( return(thd != 0 && thd_tx_is_read_only(thd)); } +static MYSQL_THDVAR_BOOL(background_thread, + PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_NOSYSVAR, + "Internal (not user visible) flag to mark " + "background purge threads", NULL, NULL, 0); + +/** Create a MYSQL_THD for background purge threads and mark it as such. +@returns new MYSQL_THD */ +MYSQL_THD +innobase_create_background_thd() +/*============================*/ +{ + MYSQL_THD thd= create_thd(); + thd_proc_info(thd, "InnoDB background thread"); + THDVAR(thd, background_thread) = true; + return thd; +} + + +/** Destroy a background purge thread THD. +@param[in] thd MYSQL_THD to destroy */ +void +innobase_destroy_background_thd( +/*============================*/ + MYSQL_THD thd) +{ + /* need to close the connection explicitly, the server won't do it + if innodb is in the PLUGIN_IS_DYING state */ + innobase_close_connection(innodb_hton_ptr, thd); + thd_set_ha_data(thd, innodb_hton_ptr, NULL); + destroy_thd(thd); +} + +/** Close opened tables, free memory, delete items for a MYSQL_THD. +@param[in] thd MYSQL_THD to reset */ +void +innobase_reset_background_thd(MYSQL_THD thd) +{ + if (!thd) { + thd = current_thd; + } + + ut_ad(thd); + ut_ad(THDVAR(thd, background_thread)); + + /* background purge thread */ + reset_thd(thd); + thd_proc_info(thd, ""); +} + + #if 0 /** Check if the transaction can be rolled back @@ -1794,13 +1930,6 @@ innobase_srv_conc_enter_innodb( } #endif /* WITH_WSREP */ - /* We rely on server to do external_lock(F_UNLCK) to reset the - srv_conc.n_active counter. Since there are no locks on instrinsic - tables, we should skip this for intrinsic temporary tables. */ - if (dict_table_is_intrinsic(prebuilt->table)) { - return; - } - trx_t* trx = prebuilt->trx; if (srv_thread_concurrency) { if (trx->n_tickets_to_enter_innodb > 0) { @@ -1839,13 +1968,6 @@ innobase_srv_conc_exit_innodb( } #endif /* WITH_WSREP */ - /* We rely on server to do external_lock(F_UNLCK) to reset the - srv_conc.n_active counter. Since there are no locks on instrinsic - tables, we should skip this for intrinsic temporary tab */ - if (dict_table_is_intrinsic(prebuilt->table)) { - return; - } - trx_t* trx = prebuilt->trx; #ifdef UNIV_DEBUG btrsea_sync_check check(trx->has_search_latch); @@ -1967,29 +2089,6 @@ thd_innodb_tmpdir( return(tmp_dir); } -/** Obtain the private handler of InnoDB session specific data. -@param[in,out] thd MySQL thread handler. -@return reference to private handler */ -MY_ATTRIBUTE((warn_unused_result)) -static -innodb_session_t*& -thd_to_innodb_session( - THD* thd) -{ - innodb_session_t*& innodb_session = - *(innodb_session_t**) thd_ha_data(thd, innodb_hton_ptr); - - if (innodb_session != NULL) { - return(innodb_session); - } - - innodb_session = UT_NEW_NOKEY(innodb_session_t()); - - thd_set_ha_data(thd, innodb_hton_ptr, innodb_session); - - return(innodb_session); -} - /** Obtain the InnoDB transaction of a MySQL thread. @param[in,out] thd MySQL thread handler. @return reference to transaction pointer */ @@ -1998,10 +2097,7 @@ trx_t*& thd_to_trx( THD* thd) { - innodb_session_t*& innodb_session = thd_to_innodb_session(thd); - ut_ad(innodb_session != NULL); - - return(innodb_session->m_trx); + return(*(trx_t**) thd_ha_data(thd, innodb_hton_ptr)); } #ifdef WITH_WSREP @@ -2017,47 +2113,6 @@ thd_to_trx_id( } #endif /* WITH_WSREP */ -/** Check if statement is of type INSERT .... SELECT that involves -use of intrinsic tables. -@param[in] thd thread handler -@return true if INSERT .... SELECT statement. */ -static inline -bool -thd_is_ins_sel_stmt(THD* user_thd) -{ - /* If the session involves use of intrinsic table - and it is trying to fetch the result from non-temporary tables - it indicates "insert .... select" statement. For non-temporary - table this is verifed using the locked tables count but for - intrinsic table as external_lock is not invoked this count is - not updated. - - Why is this needed ? - Use of AHI is blocked if statement is insert .... select statement. */ - innodb_session_t* innodb_priv = thd_to_innodb_session(user_thd); - return(innodb_priv->count_register_table_handler() > 0 ? true : false); -} - -/** Add the table handler to thread cache. -Obtain the InnoDB transaction of a MySQL thread. -@param[in,out] table table handler -@param[in,out] heap heap for allocating system columns. -@param[in,out] thd MySQL thread handler */ -static inline -void -add_table_to_thread_cache( - dict_table_t* table, - mem_heap_t* heap, - THD* thd) -{ - dict_table_add_system_columns(table, heap); - - dict_table_set_big_rows(table); - - innodb_session_t*& priv = thd_to_innodb_session(thd); - priv->register_table_handler(table->name.m_name, table); -} - /********************************************************************//** Call this function when mysqld passes control to the client. That is to avoid deadlocks on the adaptive hash S-latch possibly held by thd. For more @@ -2404,7 +2459,7 @@ innobase_check_identifier_length( CHARSET_INFO *cs = system_charset_info; DBUG_ENTER("innobase_check_identifier_length"); - size_t len = cs->cset->well_formed_len( + size_t len = my_well_formed_length( cs, id, id + strlen(id), NAME_CHAR_LEN, &well_formed_error); @@ -2512,7 +2567,7 @@ innobase_get_stmt_unsafe( LEX_STRING* stmt; const char* query=NULL; - stmt = thd_query_string(thd); + stmt = thd ? thd_query_string(thd) : NULL; // MySQL 5.7 //stmt = thd_query_unsafe(thd); @@ -2545,7 +2600,7 @@ innobase_get_stmt_safe( ut_ad(buflen > 1); - stmt = thd_query_string(thd); + stmt = thd ? thd_query_string(thd) : NULL; if (stmt && stmt->str) { length = stmt->length > buflen ? buflen : stmt->length; @@ -2704,11 +2759,10 @@ innobase_mysql_tmpfile( char errbuf[MYSYS_STRERROR_SIZE]; DBUG_PRINT("error",("Got error %d on dup",fd2)); set_my_errno(errno); - my_strerror(errbuf, sizeof(errbuf), my_errno); my_error(EE_OUT_OF_FILERESOURCES, MYF(0), - "ib*", my_errno, - errbuf); + "ib*", errno, + my_strerror(errbuf, sizeof(errbuf), errno)); } my_close(fd, MYF(MY_WME)); } @@ -3114,16 +3168,12 @@ check_trx_exists( if (trx == NULL) { trx = innobase_trx_allocate(thd); - innodb_session_t* innodb_session = thd_to_innodb_session(thd); - innodb_session->m_trx = trx; - /* User trx can be forced to rollback, so we unset the disable flag. */ ut_ad(trx->in_innodb & TRX_FORCE_ROLLBACK_DISABLE); trx->in_innodb &= TRX_FORCE_ROLLBACK_MASK; } else { ut_a(trx->magic_n == TRX_MAGIC_N); - innobase_trx_init(thd, trx); } @@ -3172,6 +3222,20 @@ innodb_replace_trx_in_thd( } #endif /* MYSQL_REPLACE_TRX_IN_THD */ +/************************************************************************* +Gets current trx. */ +trx_t* +innobase_get_trx() +{ + THD *thd=current_thd; + if (likely(thd != 0)) { + trx_t*& trx = thd_to_trx(thd); + return(trx); + } else { + return(NULL); + } +} + /*********************************************************************//** Note that a transaction has been registered with MySQL. @return true if transaction is registered with MySQL 2PC coordinator */ @@ -3317,6 +3381,7 @@ ha_innobase::ha_innobase( | HA_CAN_VIRTUAL_COLUMNS | HA_CAN_INDEX_BLOBS | HA_CAN_SQL_HANDLER + | HA_REQUIRES_KEY_COLUMNS_FOR_DELETE | HA_PRIMARY_KEY_REQUIRED_FOR_POSITION | HA_PRIMARY_KEY_IN_READ_INDEX | HA_BINLOG_ROW_CAPABLE @@ -3366,8 +3431,7 @@ ha_innobase::update_thd( TrxInInnoDB trx_in_innodb(trx); - ut_ad(dict_table_is_intrinsic(m_prebuilt->table) - || trx_in_innodb.is_aborted() + ut_ad(trx_in_innodb.is_aborted() || (trx->dict_operation_lock_mode == 0 && trx->dict_operation == TRX_DICT_OP_NONE)); @@ -4051,12 +4115,6 @@ innobase_init( innobase_hton->commit_by_xid = innobase_commit_by_xid; innobase_hton->rollback_by_xid = innobase_rollback_by_xid; innobase_hton->commit_checkpoint_request=innobase_checkpoint_request; - -#ifdef INNOBASE_CURSOR_VIEW - innobase_hton->create_cursor_read_view = innobase_create_cursor_view; - innobase_hton->set_cursor_read_view = innobase_set_cursor_view; - innobase_hton->close_cursor_read_view = innobase_close_cursor_view; -#endif innobase_hton->create = innobase_create_handler; #ifdef MYSQL_TABLESPACES @@ -4071,7 +4129,6 @@ innobase_init( innobase_hton->flush_logs = innobase_flush_logs; innobase_hton->show_status = innobase_show_status; - innobase_hton->fill_is_table = innobase_fill_i_s_table; innobase_hton->flags = HTON_SUPPORTS_EXTENDED_KEYS | HTON_SUPPORTS_FOREIGN_KEYS; @@ -4148,17 +4205,18 @@ innobase_init( ut_new_boot(); if (UNIV_PAGE_SIZE != UNIV_PAGE_SIZE_DEF) { - fprintf(stderr, - "InnoDB: Warning: innodb_page_size has been " - "changed from default value %d to %ldd. (###EXPERIMENTAL### " - "operation)\n", UNIV_PAGE_SIZE_DEF, UNIV_PAGE_SIZE); + ib::info() << "innodb_page_size has been " + << "changed from default value " + << UNIV_PAGE_SIZE_DEF << " to " << UNIV_PAGE_SIZE; /* There is hang on buffer pool when trying to get a new page if buffer pool size is too small for large page sizes */ - if (innobase_buffer_pool_size < (24 * 1024 * 1024)) { - fprintf(stderr, "InnoDB: Error: innobase_page_size %lu requires " - "innodb_buffer_pool_size > 24M current %lld", - UNIV_PAGE_SIZE, innobase_buffer_pool_size); + if (UNIV_PAGE_SIZE > UNIV_PAGE_SIZE_DEF + && innobase_buffer_pool_size < (24 * 1024 * 1024)) { + ib::info() << "innodb_page_size=" + << UNIV_PAGE_SIZE << " requires " + << "innodb_buffer_pool_size > 24M current " + << innobase_buffer_pool_size; goto error; } } @@ -4580,9 +4638,13 @@ innobase_change_buffering_inited_ok: data_mysql_default_charset_coll = (ulint) default_charset_info->number; innobase_commit_concurrency_init_default(); -#ifdef HAVE_POSIX_FALLOCATE - srv_use_posix_fallocate = (ibool) innobase_use_fallocate; -#endif + + if (innobase_use_fallocate) { + ib::warn() << "innodb_use_fallocate is DEPRECATED" + " and has no effect in MariaDB 10.2." + " It will be removed in MariaDB 10.3."; + } + srv_use_atomic_writes = (ibool) innobase_use_atomic_writes; if (innobase_use_atomic_writes) { fprintf(stderr, "InnoDB: using atomic writes.\n"); @@ -4601,13 +4663,6 @@ innobase_change_buffering_inited_ok: srv_file_flush_method_str = (char*)"O_DIRECT"; fprintf(stderr, "InnoDB: using O_DIRECT due to atomic writes.\n"); } -#endif -#ifdef HAVE_POSIX_FALLOCATE - /* Due to a bug in directFS, using atomics needs - * posix_fallocate to extend the file - * pwrite() past end of the file won't work - */ - srv_use_posix_fallocate = TRUE; #endif } @@ -4655,6 +4710,12 @@ innobase_change_buffering_inited_ok: } */ + if (!srv_read_only_mode) { + mysql_thread_create(thd_destructor_thread_key, + &thd_destructor_thread, + NULL, thd_destructor_proxy, NULL); + } + /* Since we in this module access directly the fields of a trx struct, and due to different headers and flags it might happen that ib_mutex_t has a different size in this module and in InnoDB @@ -4789,6 +4850,13 @@ innobase_end( #ifdef MYSQL_ENCRYPTION mutex_free(&master_key_id_mutex); #endif + + if (!abort_loop && thd_destructor_myvar) { + // may be UNINSTALL PLUGIN statement + thd_destructor_myvar->abort = 1; + mysql_cond_broadcast(thd_destructor_myvar->current_cond); + } + if (innobase_shutdown_for_mysql() != DB_SUCCESS) { err = 1; } @@ -5067,7 +5135,7 @@ innobase_commit( if (!trx_is_registered_for_2pc(trx) && trx_is_started(trx)) { - sql_print_error("Transaction not registered for MySQL 2PC," + sql_print_error("Transaction not registered for MariaDB 2PC," " but transaction is active"); } @@ -5581,7 +5649,7 @@ innobase_close_connection( if (!trx_is_registered_for_2pc(trx) && trx_is_started(trx)) { - sql_print_error("Transaction not registered for MySQL 2PC, " + sql_print_error("Transaction not registered for MariaDB 2PC, " "but transaction is active"); } @@ -5602,7 +5670,7 @@ innobase_close_connection( } } else { sql_print_warning( - "MySQL is closing a connection that has an active " + "MariaDB is closing a connection that has an active " "InnoDB transaction. " TRX_ID_FMT " row modifications " "will roll back.", " row modifications will roll back.", @@ -5625,10 +5693,6 @@ innobase_close_connection( trx_free_for_mysql(trx); } - UT_DELETE(thd_to_innodb_session(thd)); - - thd_to_innodb_session(thd) = NULL; - DBUG_RETURN(0); } @@ -5670,9 +5734,6 @@ innobase_kill_query( /* Cancel a pending lock request if there are any */ bool lock_mutex_taken = false; bool trx_mutex_taken = false; - bool already_have_lock_mutex = false; - bool already_have_trx_mutex = false; - dberr_t err = DB_SUCCESS; if (trx->lock.wait_lock) { WSREP_DEBUG("Killing victim trx %p BF %d trx BF %d trx_id " IB_ID_FMT " ABORT %d thd %p" @@ -5685,40 +5746,31 @@ innobase_kill_query( wsrep_thd_is_BF(current_thd, FALSE)); } - if (!wsrep_thd_is_BF(trx->mysql_thd, FALSE) && - trx->abort_type == TRX_SERVER_ABORT) { - ut_ad(!lock_mutex_own()); + if (!wsrep_thd_is_BF(trx->mysql_thd, FALSE)) { lock_mutex_enter(); lock_mutex_taken = true; - } else { - already_have_lock_mutex = true; } if (trx->abort_type != TRX_WSREP_ABORT) { - ut_ad(!trx_mutex_own(trx)); trx_mutex_enter(trx); trx_mutex_taken = true; - } else { - already_have_trx_mutex = true; } - err = lock_trx_handle_wait(trx, - (lock_mutex_taken || already_have_lock_mutex), - (trx_mutex_taken || already_have_trx_mutex)); +#ifdef UNIV_DEBUG + dberr_t err = +#endif + lock_trx_handle_wait(trx, true, true); + + ut_ad(err == DB_SUCCESS || err == DB_LOCK_WAIT + || err == DB_DEADLOCK); if (lock_mutex_taken) { - ut_ad(lock_mutex_own()); lock_mutex_exit(); } if (trx_mutex_taken) { - ut_ad(trx_mutex_own(trx)); trx_mutex_exit(trx); } - - if (err != DB_SUCCESS && err != DB_LOCK_WAIT) { - ib::warn() << "Killing connection failed " << ut_strerr(err) << "("<vfield || table->current_lock != F_WRLCK) { + return; + } + + dict_index_t* clust_index = dict_table_get_first_index(m_prebuilt->table); + uint num_v = 0; + for (uint j = 0; j < table->s->virtual_fields; j++) { + if (table->vfield[j]->stored_in_db()) { + continue; + } + + dict_col_t* col = &m_prebuilt->table->v_cols[num_v].m_col; + if (col->ord_part || + (dict_index_is_online_ddl(clust_index) && + row_log_col_is_indexed(clust_index, num_v))) { + table->mark_virtual_col(table->vfield[j]); + } + num_v++; + } +} + + /****************************************************************//** Determines if table caching is supported. @return HA_CACHE_TBL_ASKTRANSACT */ @@ -6214,8 +6296,6 @@ innobase_match_index_columns( if (innodb_idx_fld >= innodb_idx_fld_end) { DBUG_RETURN(FALSE); } - - mtype = innodb_idx_fld->col->mtype; } /* MariaDB-5.5 compatibility */ @@ -6259,7 +6339,6 @@ innobase_match_index_columns( DBUG_RETURN(TRUE); } -#ifdef MYSQL_VIRTUAL_COLUMNS /** Build a template for a base column for a virtual column @param[in] table MySQL TABLE @param[in] clust_index InnoDB clustered index @@ -6319,21 +6398,6 @@ innobase_vcol_build_templ( templ->is_unsigned = col->prtype & DATA_UNSIGNED; } -/** callback used by MySQL server layer to initialize -the table virtual columns' template -@param[in] table MySQL TABLE -@param[in,out] ib_table InnoDB table */ -void -innobase_build_v_templ_callback( - const TABLE* table, - void* ib_table) -{ - const dict_table_t* t_table = static_cast(ib_table); - - innobase_build_v_templ(table, t_table, t_table->vc_templ, NULL, - true, NULL); -} - /** Build template for the virtual columns and their base columns. This is done when the table first opened. @param[in] table MySQL TABLE @@ -6341,16 +6405,14 @@ is done when the table first opened. @param[in,out] s_templ InnoDB template structure @param[in] add_v new virtual columns added along with add index call -@param[in] locked true if dict_sys mutex is held -@param[in] share_tbl_name original MySQL table name */ +@param[in] locked true if dict_sys mutex is held */ void innobase_build_v_templ( const TABLE* table, const dict_table_t* ib_table, dict_vcol_templ_t* s_templ, const dict_add_v_col_t* add_v, - bool locked, - const char* share_tbl_name) + bool locked) { ulint ncol = ib_table->n_cols - DATA_N_SYS_COLS; ulint n_v_col = ib_table->n_v_cols; @@ -6382,15 +6444,8 @@ innobase_build_v_templ( * sizeof *s_templ->vtempl)); s_templ->n_col = ncol; s_templ->n_v_col = n_v_col; - s_templ->rec_len = table->s->stored_rec_length; - // JAN: MySQL 5.6 - // s_templ->default_rec = table->s->default_values; - - s_templ->default_rec = static_cast( - ut_malloc_nokey(table->s->stored_rec_length)); - memcpy(s_templ->default_rec, table->s->default_values, - table->s->stored_rec_length); - + s_templ->rec_len = table->s->reclength; + s_templ->default_rec = table->s->default_values; /* Mark those columns could be base columns */ for (ulint i = 0; i < ib_table->n_v_cols; i++) { @@ -6490,12 +6545,7 @@ innobase_build_v_templ( s_templ->db_name = table->s->db.str; s_templ->tb_name = table->s->table_name.str; - - if (share_tbl_name) { - s_templ->share_name = share_tbl_name; - } } -#endif /* MYSQL_VIRTUAL_COLUMNS */ /*******************************************************************//** This function builds a translation table in INNOBASE_SHARE @@ -6592,7 +6642,7 @@ innobase_build_index_translation( if (!innobase_match_index_columns(&table->key_info[count], index_mapping[count])) { sql_print_error("Found index %s whose column info" - " does not match that of MySQL.", + " does not match that of MariaDB.", table->key_info[count].name); ret = false; goto func_exit; @@ -6705,33 +6755,35 @@ innobase_get_int_col_max_value( return(max_value); } -/************************************************************************ -Set the autoinc column max value. This should only be called once from -ha_innobase::open(). Therefore there's no need for a covering lock. */ +/** Initialize the AUTO_INCREMENT column metadata. + +Since a partial table definition for a persistent table can already be +present in the InnoDB dict_sys cache before it is accessed from SQL, +we have to initialize the AUTO_INCREMENT counter on the first +ha_innobase::open(). + +@param[in,out] table persistent table +@param[in] field the AUTO_INCREMENT column */ +static void -ha_innobase::innobase_initialize_autoinc() -/*======================================*/ +initialize_auto_increment(dict_table_t* table, const Field* field) { - ulonglong auto_inc; - const Field* field = table->found_next_number_field; + ut_ad(!dict_table_is_temporary(table)); - if (field != NULL) { - auto_inc = innobase_get_int_col_max_value(field); - ut_ad(!innobase_is_v_fld(field)); + const unsigned col_no = innodb_col_no(field); - /* autoinc column cannot be virtual column */ - ut_ad(!innobase_is_v_fld(field)); - } else { - /* We have no idea what's been passed in to us as the - autoinc column. We set it to the 0, effectively disabling - updates to the table. */ - auto_inc = 0; + dict_table_autoinc_lock(table); - ib::info() << "Unable to determine the AUTOINC column name"; - } + table->persistent_autoinc = 1 + + dict_table_get_nth_col_pos(table, col_no, NULL); - if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) { + if (table->autoinc) { + /* Already initialized. Our caller checked + table->persistent_autoinc without + dict_table_autoinc_lock(), and there might be multiple + ha_innobase::open() executing concurrently. */ + } else if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) { /* If the recovery level is set so high that writes are disabled we force the AUTOINC counter to 0 value effectively disabling writes to the table. @@ -6742,82 +6794,16 @@ ha_innobase::innobase_initialize_autoinc() tables can be dumped with minimal hassle. If an error were returned in this case, the first attempt to read the table would fail and subsequent SELECTs would succeed. */ - auto_inc = 0; - } else if (field == NULL) { - /* This is a far more serious error, best to avoid - opening the table and return failure. */ - my_error(ER_AUTOINC_READ_FAILED, MYF(0)); - } else { - dict_index_t* index; - const char* col_name; - ib_uint64_t read_auto_inc; - ulint err; - - update_thd(ha_thd()); - - col_name = field->field_name; - - /* For intrinsic table, name of field has to be prefixed with - table name to maintain column-name uniqueness. */ - if (m_prebuilt->table != NULL - && dict_table_is_intrinsic(m_prebuilt->table)) { - - ulint col_no = dict_col_get_no(dict_table_get_nth_col( - m_prebuilt->table, field->field_index)); - - col_name = dict_table_get_col_name( - m_prebuilt->table, col_no); - } - - index = innobase_get_index(table->s->next_number_index); - - /* Execute SELECT MAX(col_name) FROM TABLE; */ - err = row_search_max_autoinc(index, col_name, &read_auto_inc); - - switch (err) { - case DB_SUCCESS: { - ulonglong col_max_value; - - col_max_value = innobase_get_int_col_max_value(field); - - /* At the this stage we do not know the increment - nor the offset, so use a default increment of 1. */ - - auto_inc = innobase_next_autoinc( - read_auto_inc, 1, 1, 0, col_max_value); - - break; - } - case DB_RECORD_NOT_FOUND: - ib::error() << "MySQL and InnoDB data dictionaries are" - " out of sync. Unable to find the AUTOINC" - " column " << col_name << " in the InnoDB" - " table " << index->table->name << ". We set" - " the next AUTOINC column value to 0, in" - " effect disabling the AUTOINC next value" - " generation."; - - ib::info() << "You can either set the next AUTOINC" - " value explicitly using ALTER TABLE or fix" - " the data dictionary by recreating the" - " table."; - - /* This will disable the AUTOINC generation. */ - auto_inc = 0; - - /* We want the open to succeed, so that the user can - take corrective action. ie. reads should succeed but - updates should fail. */ - err = DB_SUCCESS; - break; - default: - /* row_search_max_autoinc() should only return - one of DB_SUCCESS or DB_RECORD_NOT_FOUND. */ - ut_error; - } + } else if (table->persistent_autoinc) { + table->autoinc = innobase_next_autoinc( + btr_read_autoinc_with_fallback(table, col_no), + 1 /* need */, + 1 /* auto_increment_increment */, + 0 /* auto_increment_offset */, + innobase_get_int_col_max_value(field)); } - dict_table_autoinc_initialize(m_prebuilt->table, auto_inc); + dict_table_autoinc_unlock(table); } /*****************************************************************//** @@ -6835,7 +6821,6 @@ ha_innobase::open( dict_table_t* ib_table; char norm_name[FN_REFLEN]; THD* thd; - char* is_part = NULL; dict_err_ignore_t ignore_err = DICT_ERR_IGNORE_NONE; DBUG_ENTER("ha_innobase::open"); @@ -6865,13 +6850,7 @@ ha_innobase::open( m_upd_buf = NULL; m_upd_buf_size = 0; - /* We look for pattern #P# to see if the table is partitioned - MySQL table. */ -#ifdef _WIN32 - is_part = strstr(norm_name, "#p#"); -#else - is_part = strstr(norm_name, "#P#"); -#endif /* _WIN32 */ + char* is_part = is_partition(norm_name); /* Check whether FOREIGN_KEY_CHECKS is set to 0. If so, the table can be opened even if some FK indexes are missing. If not, the table @@ -6880,30 +6859,19 @@ ha_innobase::open( ignore_err = DICT_ERR_IGNORE_FK_NOKEY; } - /* Get pointer to a table object in InnoDB dictionary cache. - For intrinsic table, get it from session private data */ - ib_table = thd_to_innodb_session(thd)->lookup_table_handler(norm_name); - - if (ib_table == NULL) { - - ib_table = open_dict_table(name, norm_name, is_part, - ignore_err); - } else { - ib_table->acquire(); - ut_ad(dict_table_is_intrinsic(ib_table)); - } + ib_table = open_dict_table(name, norm_name, is_part, ignore_err); if (ib_table != NULL && ((!DICT_TF2_FLAG_IS_SET(ib_table, DICT_TF2_FTS_HAS_DOC_ID) - && table->s->stored_fields != dict_table_get_n_tot_u_cols(ib_table)) + && table->s->fields != dict_table_get_n_tot_u_cols(ib_table)) || (DICT_TF2_FLAG_IS_SET(ib_table, DICT_TF2_FTS_HAS_DOC_ID) - && (table->s->stored_fields + && (table->s->fields != dict_table_get_n_tot_u_cols(ib_table) - 1)))) { ib::warn() << "Table " << norm_name << " contains " << dict_table_get_n_user_cols(ib_table) << " user" - " defined columns in InnoDB, but " << table->s->stored_fields - << " columns in MySQL. Please check" + " defined columns in InnoDB, but " << table->s->fields + << " columns in MariaDB. Please check" " INFORMATION_SCHEMA.INNODB_SYS_COLUMNS and " REFMAN "innodb-troubleshooting.html for how to resolve the" " issue."; @@ -7014,9 +6982,7 @@ ha_innobase::open( bool warning_pushed = false; fil_space_crypt_t* crypt_data = ib_table->crypt_data; - if ((crypt_data && crypt_data->encryption == FIL_SPACE_ENCRYPTION_ON) || - (srv_encrypt_tables && - crypt_data && crypt_data->encryption == FIL_SPACE_ENCRYPTION_DEFAULT)) { + if (crypt_data && crypt_data->should_encrypt()) { if (!encryption_key_id_exists(crypt_data->key_id)) { push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, @@ -7048,7 +7014,7 @@ ha_innobase::open( DBUG_RETURN(ret_err); } - m_prebuilt = row_create_prebuilt(ib_table, table->s->stored_rec_length); + m_prebuilt = row_create_prebuilt(ib_table, table->s->reclength); m_prebuilt->default_rec = table->s->default_values; ut_ad(m_prebuilt->default_rec); @@ -7060,12 +7026,10 @@ ha_innobase::open( key_used_on_scan = m_primary_key; -#ifdef MYSQL_VIRTUAL_COLUMNS if (ib_table->n_v_cols) { mutex_enter(&dict_sys->mutex); if (ib_table->vc_templ == NULL) { ib_table->vc_templ = UT_NEW_NOKEY(dict_vcol_templ_t()); - ib_table->vc_templ->vtempl = NULL; } else if (ib_table->get_ref_count() == 1) { /* Clean and refresh the template if no one else get hold on it */ @@ -7076,12 +7040,11 @@ ha_innobase::open( if (ib_table->vc_templ->vtempl == NULL) { innobase_build_v_templ( table, ib_table, ib_table->vc_templ, NULL, - true, m_share->table_name); + true); } mutex_exit(&dict_sys->mutex); } -#endif /* MYSQL_VIRTUAL_COLUMNS */ if (!innobase_build_index_translation(table, ib_table, m_share)) { sql_print_error("Build InnoDB index translation table for" @@ -7198,22 +7161,12 @@ ha_innobase::open( dict_table_get_format(m_prebuilt->table)); } - /* Only if the table has an AUTOINC column. */ - if (m_prebuilt->table != NULL - && !m_prebuilt->table->ibd_file_missing - && table->found_next_number_field != NULL) { - dict_table_autoinc_lock(m_prebuilt->table); - - /* Since a table can already be "open" in InnoDB's internal - data dictionary, we only init the autoinc counter once, the - first time the table is loaded. We can safely reuse the - autoinc value from a previous MySQL open. */ - if (dict_table_autoinc_read(m_prebuilt->table) == 0) { - - innobase_initialize_autoinc(); - } - - dict_table_autoinc_unlock(m_prebuilt->table); + if (m_prebuilt->table == NULL + || dict_table_is_temporary(m_prebuilt->table) + || m_prebuilt->table->persistent_autoinc + || m_prebuilt->table->ibd_file_missing) { + } else if (const Field* ai = table->found_next_number_field) { + initialize_auto_increment(m_prebuilt->table, ai); } /* Set plugin parser for fulltext index */ @@ -7269,6 +7222,24 @@ ha_innobase::open( DBUG_RETURN(0); } +/** Convert MySQL column number to dict_table_t::cols[] offset. +@param[in] field non-virtual column +@return column number relative to dict_table_t::cols[] */ +unsigned +innodb_col_no(const Field* field) +{ + ut_ad(!innobase_is_s_fld(field)); + const TABLE* table = field->table; + unsigned col_no = 0; + ut_ad(field == table->field[field->field_index]); + for (unsigned i = 0; i < field->field_index; i++) { + if (table->field[i]->stored_in_db()) { + col_no++; + } + } + return(col_no); +} + /** Opens dictionary table object using table name. For partition, we need to try alternative lower/upper case names to support moving data files across platforms. @@ -7429,19 +7400,6 @@ ha_innobase::close() /* The following accessor functions should really be inside MySQL code! */ -/** Gets field offset for a field in a table. -@param[in] table MySQL table object -@param[in] field MySQL field object -@return offset */ -static inline -uint -get_field_offset( - const TABLE* table, - const Field* field) -{ - return(static_cast((field->ptr - table->record[0]))); -} - #ifdef WITH_WSREP UNIV_INTERN int @@ -7492,7 +7450,7 @@ wsrep_innobase_mysql_sort( if (charset == NULL) { sql_print_error("InnoDB needs charset %lu for doing " - "a comparison, but MySQL cannot " + "a comparison, but MariaDB cannot " "find that charset.", (ulong) charset_number); ut_a(0); @@ -7792,8 +7750,7 @@ get_innobase_type_from_mysql_type( case MYSQL_TYPE_VARCHAR: /* new >= 5.0.3 true VARCHAR */ if (field->binary()) { return(DATA_BINARY); - } else if (strcmp(field->charset()->name, - "latin1_swedish_ci") == 0) { + } else if (field->charset() == &my_charset_latin1) { return(DATA_VARCHAR); } else { return(DATA_VARMYSQL); @@ -7801,10 +7758,8 @@ get_innobase_type_from_mysql_type( case MYSQL_TYPE_BIT: case MYSQL_TYPE_STRING: if (field->binary()) { - return(DATA_FIXBINARY); - } else if (strcmp(field->charset()->name, - "latin1_swedish_ci") == 0) { + } else if (field->charset() == &my_charset_latin1) { return(DATA_CHAR); } else { return(DATA_MYSQL); @@ -7962,7 +7917,7 @@ wsrep_store_key_val_for_row( the true length of the key */ if (len > 0 && cs->mbmaxlen > 1) { - true_len = (ulint) cs->cset->well_formed_len(cs, + true_len = (ulint) my_well_formed_length(cs, (const char *) data, (const char *) data + len, (uint) (key_len / @@ -8048,7 +8003,7 @@ wsrep_store_key_val_for_row( the true length of the key */ if (blob_len > 0 && cs->mbmaxlen > 1) { - true_len = (ulint) cs->cset->well_formed_len(cs, + true_len = (ulint) my_well_formed_length(cs, (const char *) blob_data, (const char *) blob_data + blob_len, @@ -8137,7 +8092,7 @@ wsrep_store_key_val_for_row( if (key_len > 0 && cs->mbmaxlen > 1) { true_len = (ulint) - cs->cset->well_formed_len(cs, + my_well_formed_length(cs, (const char *)src_start, (const char *)src_start + key_len, @@ -8195,10 +8150,9 @@ build_template_needs_field( dict_index_t* index, /*!< in: InnoDB index to use */ const TABLE* table, /*!< in: MySQL table object */ ulint i, /*!< in: field index in InnoDB table */ - ulint sql_idx, /*!< in: field index in SQL table */ ulint num_v) /*!< in: num virtual column so far */ { - const Field* field = table->field[sql_idx]; + const Field* field = table->field[i]; if (!index_contains) { if (read_just_key) { @@ -8213,8 +8167,8 @@ build_template_needs_field( return(field); } - if (bitmap_is_set(table->read_set, static_cast(sql_idx)) - || bitmap_is_set(table->write_set, static_cast(sql_idx))) { + if (bitmap_is_set(table->read_set, static_cast(i)) + || bitmap_is_set(table->write_set, static_cast(i))) { /* This field is needed in the query */ return(field); @@ -8290,7 +8244,62 @@ build_template_field( templ->col_no = i; templ->clust_rec_field_no = dict_col_get_clust_pos( col, clust_index); - ut_a(templ->clust_rec_field_no != ULINT_UNDEFINED); + /* If clustered index record field is not found, lets print out + field names and all the rest to understand why field is not found. */ + if (templ->clust_rec_field_no == ULINT_UNDEFINED) { + const char* tb_col_name = dict_table_get_col_name(clust_index->table, i); + dict_field_t* field=NULL; + size_t size = 0; + + for(ulint j=0; j < clust_index->n_user_defined_cols; j++) { + dict_field_t* ifield = &(clust_index->fields[j]); + if (ifield && !memcmp(tb_col_name, ifield->name, + strlen(tb_col_name))) { + field = ifield; + break; + } + } + + ib::info() << "Looking for field " << i << " name " + << (tb_col_name ? tb_col_name : "NULL") + << " from table " << clust_index->table->name; + + + for(ulint j=0; j < clust_index->n_user_defined_cols; j++) { + dict_field_t* ifield = &(clust_index->fields[j]); + ib::info() << "InnoDB Table " + << clust_index->table->name + << "field " << j << " name " + << (ifield ? ifield->name() : "NULL"); + } + + for(ulint j=0; j < table->s->stored_fields; j++) { + ib::info() << "MySQL table " + << table->s->table_name.str + << " field " << j << " name " + << table->field[j]->field_name; + } + + ib::error() << "Clustered record field for column " << i + << " not found table n_user_defined " + << clust_index->n_user_defined_cols + << " index n_user_defined " + << clust_index->table->n_cols - DATA_N_SYS_COLS + << " InnoDB table " + << clust_index->table->name + << " field name " + << (field ? field->name() : "NULL") + << " MySQL table " + << table->s->table_name.str + << " field name " + << (tb_col_name ? tb_col_name : "NULL") + << " n_fields " + << table->s->stored_fields + << " query " + << innobase_get_stmt_unsafe(current_thd, &size); + + ut_a(templ->clust_rec_field_no != ULINT_UNDEFINED); + } templ->rec_field_is_prefix = FALSE; templ->rec_prefix_field_no = ULINT_UNDEFINED; @@ -8396,10 +8405,10 @@ ha_innobase::build_template( { dict_index_t* index; dict_index_t* clust_index; - ulint n_stored_fields; + ulint n_fields; ibool fetch_all_in_key = FALSE; ibool fetch_primary_key_cols = FALSE; - ulint i, sql_idx; + ulint i; if (m_prebuilt->select_lock_type == LOCK_X) { /* We always retrieve the whole clustered index record if we @@ -8452,12 +8461,11 @@ ha_innobase::build_template( /* Below we check column by column if we need to access the clustered index. */ - /* number of stored columns */ - n_stored_fields= (ulint)table->s->stored_fields; + n_fields = (ulint) table->s->fields; /* number of columns */ if (!m_prebuilt->mysql_template) { m_prebuilt->mysql_template = (mysql_row_templ_t*) - ut_malloc_nokey(n_stored_fields * sizeof(mysql_row_templ_t)); + ut_malloc_nokey(n_fields * sizeof(mysql_row_templ_t)); } m_prebuilt->template_type = whole_row @@ -8479,16 +8487,14 @@ ha_innobase::build_template( ulint num_v = 0; /* Push down an index condition or an end_range check. */ - for (i = 0, sql_idx = 0; i < n_stored_fields; i++, sql_idx++) { + for (i = 0; i < n_fields; i++) { ibool index_contains; - while (!table->field[sql_idx]->stored_in_db()) { - sql_idx++; - } - - if (innobase_is_v_fld(table->field[sql_idx])) { + if (innobase_is_v_fld(table->field[i])) { index_contains = dict_index_contains_col_or_prefix( index, num_v, true); + if (index_contains) + goto no_icp; } else { index_contains = dict_index_contains_col_or_prefix( index, i - num_v, false); @@ -8509,8 +8515,7 @@ ha_innobase::build_template( the subset field->part_of_key.is_set(active_index) which would be acceptable if end_range==NULL. */ - bool is_v = innobase_is_v_fld(table->field[sql_idx]); - + bool is_v = innobase_is_v_fld(table->field[i]); if (build_template_needs_field_in_icp( index, m_prebuilt, index_contains, is_v ? num_v : i - num_v, is_v)) { @@ -8519,17 +8524,17 @@ ha_innobase::build_template( mysql_row_templ_t* templ; if (whole_row) { - field = table->field[sql_idx]; + field = table->field[i]; } else { field = build_template_needs_field( index_contains, m_prebuilt->read_just_key, fetch_all_in_key, fetch_primary_key_cols, - index, table, i, sql_idx, num_v); + index, table, i, num_v); if (!field) { if (innobase_is_v_fld( - table->field[sql_idx])) { + table->field[i])) { num_v++; } continue; @@ -8611,7 +8616,7 @@ ha_innobase::build_template( < m_prebuilt->index->n_uniq); */ } - if (innobase_is_v_fld(table->field[sql_idx])) { + if (innobase_is_v_fld(table->field[i])) { num_v++; } } @@ -8623,15 +8628,11 @@ ha_innobase::build_template( /* Include the fields that are not needed in index condition pushdown. */ - for (i = 0, sql_idx = 0; i < n_stored_fields; i++, sql_idx++) { + for (i = 0; i < n_fields; i++) { mysql_row_templ_t* templ; ibool index_contains; - while (!table->field[sql_idx]->stored_in_db()) { - sql_idx++; - } - - if (innobase_is_v_fld(table->field[sql_idx])) { + if (innobase_is_v_fld(table->field[i])) { index_contains = dict_index_contains_col_or_prefix( index, num_v, true); } else { @@ -8639,7 +8640,7 @@ ha_innobase::build_template( index, i - num_v, false); } - bool is_v = innobase_is_v_fld(table->field[sql_idx]); + bool is_v = innobase_is_v_fld(table->field[i]); if (!build_template_needs_field_in_icp( index, m_prebuilt, index_contains, @@ -8648,16 +8649,16 @@ ha_innobase::build_template( const Field* field; if (whole_row) { - field = table->field[sql_idx]; + field = table->field[i]; } else { field = build_template_needs_field( index_contains, m_prebuilt->read_just_key, fetch_all_in_key, fetch_primary_key_cols, - index, table, i, sql_idx, num_v); + index, table, i, num_v); if (!field) { - if (innobase_is_v_fld(table->field[sql_idx])) { + if (innobase_is_v_fld(table->field[i])) { num_v++; } continue; @@ -8676,18 +8677,15 @@ ha_innobase::build_template( m_prebuilt->idx_cond = this; } else { +no_icp: mysql_row_templ_t* templ; ulint num_v = 0; /* No index condition pushdown */ m_prebuilt->idx_cond = NULL; - for (i = 0, sql_idx = 0; i < n_stored_fields; i++, sql_idx++) { + for (i = 0; i < n_fields; i++) { const Field* field; - while (!table->field[sql_idx]->stored_in_db()) { - sql_idx++; - } - if (whole_row) { /* Even this is whole_row, if the seach is on a virtual column, and read_just_key is @@ -8695,7 +8693,7 @@ ha_innobase::build_template( will not try to fill the value since they are not stored in such index nor in the cluster index. */ - if (innobase_is_v_fld(table->field[sql_idx]) + if (innobase_is_v_fld(table->field[i]) && m_prebuilt->read_just_key && !dict_index_contains_col_or_prefix( m_prebuilt->index, num_v, true)) @@ -8707,11 +8705,11 @@ ha_innobase::build_template( continue; } - field = table->field[sql_idx]; + field = table->field[i]; } else { ibool contain; - if (innobase_is_v_fld(table->field[sql_idx])) { + if (innobase_is_v_fld(table->field[i])) { contain = dict_index_contains_col_or_prefix( index, num_v, true); } else { @@ -8720,16 +8718,14 @@ ha_innobase::build_template( false); } - field = build_template_needs_field( contain, m_prebuilt->read_just_key, fetch_all_in_key, fetch_primary_key_cols, - index, table, i, sql_idx, num_v); - + index, table, i, num_v); if (!field) { - if (innobase_is_v_fld(table->field[sql_idx])) { + if (innobase_is_v_fld(table->field[i])) { num_v++; } continue; @@ -8772,18 +8768,10 @@ ha_innobase::innobase_lock_autoinc(void) { DBUG_ENTER("ha_innobase::innobase_lock_autoinc"); dberr_t error = DB_SUCCESS; - long lock_mode = innobase_autoinc_lock_mode; - ut_ad(!srv_read_only_mode - || dict_table_is_intrinsic(m_prebuilt->table)); + ut_ad(!srv_read_only_mode); - if (dict_table_is_intrinsic(m_prebuilt->table)) { - /* Intrinsic table are not shared accorss connection - so there is no need to AUTOINC lock the table. */ - lock_mode = AUTOINC_NO_LOCKING; - } - - switch (lock_mode) { + switch (innobase_autoinc_lock_mode) { case AUTOINC_NO_LOCKING: /* Acquire only the AUTOINC mutex. */ dict_table_autoinc_lock(m_prebuilt->table); @@ -8859,30 +8847,6 @@ ha_innobase::innobase_set_max_autoinc( return(error); } -/** Write Row interface optimized for intrinisc table. -@param[in] record a row in MySQL format. -@return 0 on success or error code */ -int -ha_innobase::intrinsic_table_write_row(uchar* record) -{ - dberr_t err; - - /* No auto-increment support for intrinsic table. */ - ut_ad(!(table->next_number_field && record == table->record[0])); - - if (m_prebuilt->mysql_template == NULL - || m_prebuilt->template_type != ROW_MYSQL_WHOLE_ROW) { - /* Build the template used in converting quickly between - the two database formats */ - build_template(true); - } - - err = row_insert_for_mysql((byte*) record, m_prebuilt); - - return(convert_error_code_to_mysql( - err, m_prebuilt->table->flags, m_user_thd)); -} - /********************************************************************//** Stores a row in an InnoDB database, to the table specified in this handle. @@ -8903,15 +8867,10 @@ ha_innobase::write_row( DBUG_ENTER("ha_innobase::write_row"); - if (dict_table_is_intrinsic(m_prebuilt->table)) { - DBUG_RETURN(intrinsic_table_write_row(record)); - } - trx_t* trx = thd_to_trx(m_user_thd); TrxInInnoDB trx_in_innodb(trx); - if (!dict_table_is_intrinsic(m_prebuilt->table) - && trx_in_innodb.is_aborted()) { + if (trx_in_innodb.is_aborted()) { innobase_rollback(ht, m_user_thd, false); @@ -9316,28 +9275,32 @@ innodb_fill_old_vcol_val( return(buf); } -/**********************************************************************//** -Checks which fields have changed in a row and stores information -of them to an update vector. +/** Calculate an update vector corresponding to the changes +between old_row and new_row. +@param[out] uvect update vector +@param[in] old_row current row in MySQL format +@param[in] new_row intended updated row in MySQL format +@param[in] table MySQL table handle +@param[in,out] upd_buff buffer to use for converted values +@param[in] buff_len length of upd_buff +@param[in,out] prebuilt InnoDB execution context +@param[out] auto_inc updated AUTO_INCREMENT value, or 0 if none @return DB_SUCCESS or error code */ static dberr_t calc_row_difference( -/*================*/ - upd_t* uvect, /*!< in/out: update vector */ - const uchar* old_row, /*!< in: old row in MySQL format */ - uchar* new_row, /*!< in: new row in MySQL format */ - TABLE* table, /*!< in: table in MySQL data - dictionary */ - uchar* upd_buff, /*!< in: buffer to use */ - ulint buff_len, /*!< in: buffer length */ - row_prebuilt_t* prebuilt, /*!< in: InnoDB prebuilt struct */ - THD* thd) /*!< in: user thread */ + upd_t* uvect, + const uchar* old_row, + uchar* new_row, + TABLE* table, + uchar* upd_buff, + ulint buff_len, + row_prebuilt_t* prebuilt, + ib_uint64_t& auto_inc) { uchar* original_upd_buff = upd_buff; Field* field; enum_field_types field_mysql_type; - uint n_fields; ulint o_len; ulint n_len; ulint col_pack_len; @@ -9351,34 +9314,30 @@ calc_row_difference( ulint n_changed = 0; dfield_t dfield; dict_index_t* clust_index; - uint sql_idx,i, innodb_idx= 0; + uint i; ibool changes_fts_column = FALSE; ibool changes_fts_doc_col = FALSE; - trx_t* trx = thd_to_trx(thd); + trx_t* const trx = prebuilt->trx; doc_id_t doc_id = FTS_NULL_DOC_ID; ulint num_v = 0; - ut_ad(!srv_read_only_mode || dict_table_is_intrinsic(prebuilt->table)); + ut_ad(!srv_read_only_mode); - n_fields = table->s->fields; clust_index = dict_table_get_first_index(prebuilt->table); + auto_inc = 0; /* We use upd_buff to convert changed fields */ buf = (byte*) upd_buff; - for (sql_idx = 0,i=0; i < n_fields; i++, sql_idx++) { - field = table->field[sql_idx]; + for (i = 0; i < table->s->fields; i++) { + field = table->field[i]; bool is_virtual = innobase_is_v_fld(field); dict_col_t* col; - if (!field->stored_in_db()) { - continue; - } - if (is_virtual) { col = &prebuilt->table->v_cols[num_v].m_col; } else { - col = &prebuilt->table->cols[innodb_idx - num_v]; + col = &prebuilt->table->cols[i - num_v]; } o_ptr = (const byte*) old_row + get_field_offset(table, field); @@ -9591,11 +9550,22 @@ calc_row_difference( dfield_set_null(vfield); } num_v++; + ut_ad(field != table->found_next_number_field); } else { ufield->field_no = dict_col_get_clust_pos( - &prebuilt->table->cols[innodb_idx - num_v], + &prebuilt->table->cols[i - num_v], clust_index); ufield->old_v_val = NULL; + if (field != table->found_next_number_field + || dfield_is_null(&ufield->new_val)) { + } else { + auto_inc = row_parse_int( + static_cast( + ufield->new_val.data), + ufield->new_val.len, + col->mtype, + col->prtype & DATA_UNSIGNED); + } } n_changed++; @@ -9639,10 +9609,6 @@ calc_row_difference( ut_ad(col->ord_part || online_ord_part); num_v++; } - - if (field->stored_in_db()) { - innodb_idx++; - } } /* If the update changes a column with an FTS index on it, we @@ -9650,7 +9616,7 @@ calc_row_difference( other changes. We piggy back our changes on the normal UPDATE to reduce processing and IO overhead. */ if (!prebuilt->table->fts) { - trx->fts_next_doc_id = 0; + trx->fts_next_doc_id = 0; } else if (changes_fts_column || changes_fts_doc_col) { dict_table_t* innodb_table = prebuilt->table; @@ -9807,7 +9773,7 @@ wsrep_calc_row_hash( } #endif /* WITH_WSREP */ -/* +/** Updates a row given as a parameter to a new value. Note that we are given whole rows, not just the fields which are updated: this incurs some overhead for CPU when we check which fields are actually updated. @@ -9832,7 +9798,7 @@ ha_innobase::update_row( ut_a(m_prebuilt->trx == trx); - if (high_level_read_only && !dict_table_is_intrinsic(m_prebuilt->table)) { + if (high_level_read_only) { ib_senderrf(ha_thd(), IB_LOG_LEVEL_WARN, ER_READ_ONLY_MODE); DBUG_RETURN(HA_ERR_TABLE_READONLY); } else if (!trx_is_started(trx)) { @@ -9843,19 +9809,17 @@ ha_innobase::update_row( ut_ad(m_upd_buf_size == 0); /* Create a buffer for packing the fields of a record. Why - table->stored_rec_length did not work here? Obviously, - because char fields when packed actually became 1 byte - longer, when we also stored the string length as the first - byte. */ + table->reclength did not work here? Obviously, because char + fields when packed actually became 1 byte longer, when we also + stored the string length as the first byte. */ - m_upd_buf_size = table->s->stored_rec_length + table->s->max_key_length + m_upd_buf_size = table->s->reclength + table->s->max_key_length + MAX_REF_PARTS * 3; m_upd_buf = reinterpret_cast( - my_malloc( - m_upd_buf_size, + my_malloc(//PSI_INSTRUMENT_ME, + m_upd_buf_size, MYF(MY_WME))); - /* JAN: TODO: MySQL 5.7: PSI_INSTRUMENT_ME,...*/ if (m_upd_buf == NULL) { m_upd_buf_size = 0; @@ -9863,27 +9827,21 @@ ha_innobase::update_row( } } - upd_t* uvect; - - if (m_prebuilt->upd_node) { - uvect = m_prebuilt->upd_node->update; - } else { - uvect = row_get_prebuilt_update_vector(m_prebuilt); - } + upd_t* uvect = row_get_prebuilt_update_vector(m_prebuilt); + ib_uint64_t autoinc; /* Build an update vector from the modified fields in the rows (uses m_upd_buf of the handle) */ error = calc_row_difference( uvect, old_row, new_row, table, m_upd_buf, m_upd_buf_size, - m_prebuilt, m_user_thd); + m_prebuilt, autoinc); if (error != DB_SUCCESS) { goto func_exit; } - if (!dict_table_is_intrinsic(m_prebuilt->table) - && TrxInInnoDB::is_aborted(trx)) { + if (TrxInInnoDB::is_aborted(trx)) { innobase_rollback(ht, m_user_thd, false); @@ -9898,42 +9856,29 @@ ha_innobase::update_row( error = row_update_for_mysql((byte*) old_row, m_prebuilt); - /* We need to do some special AUTOINC handling for the following case: + if (error == DB_SUCCESS && autoinc) { + /* A value for an AUTO_INCREMENT column + was specified in the UPDATE statement. */ - INSERT INTO t (c1,c2) VALUES(x,y) ON DUPLICATE KEY UPDATE ... + autoinc = innobase_next_autoinc( + autoinc, 1, + m_prebuilt->autoinc_increment, + m_prebuilt->autoinc_offset, + innobase_get_int_col_max_value( + table->found_next_number_field)); - We need to use the AUTOINC counter that was actually used by - MySQL in the UPDATE statement, which can be different from the - value used in the INSERT statement. */ + error = innobase_set_max_autoinc(autoinc); - if (error == DB_SUCCESS - && table->next_number_field - && new_row == table->record[0] - && thd_sql_command(m_user_thd) == SQLCOM_INSERT - && trx->duplicates) { - - ulonglong auto_inc; - ulonglong col_max_value; - - auto_inc = table->next_number_field->val_int(); - - /* We need the upper limit of the col type to check for - whether we update the table autoinc counter or not. */ - col_max_value = - innobase_get_int_col_max_value(table->next_number_field); - - if (auto_inc <= col_max_value && auto_inc != 0) { - - ulonglong offset; - ulonglong increment; - - offset = m_prebuilt->autoinc_offset; - increment = m_prebuilt->autoinc_increment; - - auto_inc = innobase_next_autoinc( - auto_inc, 1, increment, offset, col_max_value); - - error = innobase_set_max_autoinc(auto_inc); + if (m_prebuilt->table->persistent_autoinc) { + /* Update the PAGE_ROOT_AUTO_INC. Yes, we do + this even if dict_table_t::autoinc already was + greater than autoinc, because we cannot know + if any INSERT actually used (and wrote to + PAGE_ROOT_AUTO_INC) a value bigger than our + autoinc. */ + btr_write_autoinc(dict_table_get_first_index( + m_prebuilt->table), + autoinc); } } @@ -9997,8 +9942,7 @@ ha_innobase::delete_row( DBUG_ENTER("ha_innobase::delete_row"); - if (!dict_table_is_intrinsic(m_prebuilt->table) - && trx_in_innodb.is_aborted()) { + if (trx_in_innodb.is_aborted()) { innobase_rollback(ht, m_user_thd, false); @@ -10008,7 +9952,7 @@ ha_innobase::delete_row( ut_a(m_prebuilt->trx == trx); - if (high_level_read_only && !dict_table_is_intrinsic(m_prebuilt->table)) { + if (high_level_read_only) { ib_senderrf(ha_thd(), IB_LOG_LEVEL_WARN, ER_READ_ONLY_MODE); DBUG_RETURN(HA_ERR_TABLE_READONLY); } else if (!trx_is_started(trx)) { @@ -10058,28 +10002,7 @@ int ha_innobase::delete_all_rows() { DBUG_ENTER("ha_innobase::delete_all_rows"); - - /* Currently enabled only for intrinsic tables. */ - if (!dict_table_is_intrinsic(m_prebuilt->table)) { - DBUG_RETURN(HA_ERR_WRONG_COMMAND); - } - - TrxInInnoDB trx_in_innodb(m_prebuilt->trx); - - if (!dict_table_is_intrinsic(m_prebuilt->table) - && trx_in_innodb.is_aborted()) { - - DBUG_RETURN(innobase_rollback(ht, m_user_thd, false)); - } - - dberr_t error = row_delete_all_rows(m_prebuilt->table); - - if (error == DB_SUCCESS) { - dict_stats_update(m_prebuilt->table, DICT_STATS_EMPTY_TABLE); - } - - DBUG_RETURN(convert_error_code_to_mysql( - error, m_prebuilt->table->flags, m_user_thd)); + DBUG_RETURN(HA_ERR_WRONG_COMMAND); } /**********************************************************************//** @@ -10093,11 +10016,7 @@ ha_innobase::unlock_row(void) { DBUG_ENTER("ha_innobase::unlock_row"); - /* Consistent read does not take any locks, thus there is - nothing to unlock. There is no locking for intrinsic table. */ - - if (m_prebuilt->select_lock_type == LOCK_NONE - || dict_table_is_intrinsic(m_prebuilt->table)) { + if (m_prebuilt->select_lock_type == LOCK_NONE) { DBUG_VOID_RETURN; } @@ -10107,8 +10026,6 @@ ha_innobase::unlock_row(void) DBUG_VOID_RETURN; } - ut_ad(!dict_table_is_intrinsic(m_prebuilt->table)); - /* Ideally, this assert must be in the beginning of the function. But there are some calls to this function from the SQL layer when the transaction is in state TRX_STATE_NOT_STARTED. The check on @@ -10196,8 +10113,6 @@ ha_innobase::index_end(void) { DBUG_ENTER("index_end"); - m_prebuilt->index->last_sel_cur->release(); - active_index = MAX_KEY; in_range_check_pushed_down = FALSE; @@ -10399,29 +10314,17 @@ ha_innobase::index_read( innobase_srv_conc_enter_innodb(m_prebuilt); - if (!dict_table_is_intrinsic(m_prebuilt->table)) { + if (TrxInInnoDB::is_aborted(m_prebuilt->trx)) { - if (TrxInInnoDB::is_aborted(m_prebuilt->trx)) { + innobase_rollback(ht, m_user_thd, false); - innobase_rollback(ht, m_user_thd, false); - - DBUG_RETURN(convert_error_code_to_mysql( - DB_FORCED_ABORT, 0, m_user_thd)); - } - - m_prebuilt->ins_sel_stmt = thd_is_ins_sel_stmt( - m_user_thd); - - ret = row_search_mvcc( - buf, mode, m_prebuilt, match_mode, 0); - - } else { - m_prebuilt->session = thd_to_innodb_session(m_user_thd); - - ret = row_search_no_mvcc( - buf, mode, m_prebuilt, match_mode, 0); + DBUG_RETURN(convert_error_code_to_mysql( + DB_FORCED_ABORT, 0, m_user_thd)); } + ret = row_search_mvcc( + buf, mode, m_prebuilt, match_mode, 0); + innobase_srv_conc_exit_innodb(m_prebuilt); } else { @@ -10438,10 +10341,10 @@ ha_innobase::index_read( table->status = 0; if (m_prebuilt->table->is_system_db) { srv_stats.n_system_rows_read.add( - (size_t) m_prebuilt->trx->id, 1); + thd_get_thread_id(m_prebuilt->trx->mysql_thd), 1); } else { srv_stats.n_rows_read.add( - (size_t) m_prebuilt->trx->id, 1); + thd_get_thread_id(m_prebuilt->trx->mysql_thd), 1); } break; @@ -10601,8 +10504,7 @@ ha_innobase::change_active_index( TrxInInnoDB trx_in_innodb(m_prebuilt->trx); - if (!dict_table_is_intrinsic(m_prebuilt->table) - && trx_in_innodb.is_aborted()) { + if (trx_in_innodb.is_aborted()) { innobase_rollback(ht, m_user_thd, false); @@ -10729,9 +10631,7 @@ ha_innobase::general_fetch( ut_ad(trx == thd_to_trx(m_user_thd)); - bool intrinsic = dict_table_is_intrinsic(m_prebuilt->table); - - if (!intrinsic && TrxInInnoDB::is_aborted(trx)) { + if (TrxInInnoDB::is_aborted(trx)) { innobase_rollback(ht, m_user_thd, false); @@ -10741,17 +10641,8 @@ ha_innobase::general_fetch( innobase_srv_conc_enter_innodb(m_prebuilt); - if (!intrinsic) { - - ret = row_search_mvcc( - buf, PAGE_CUR_UNSUPP, m_prebuilt, match_mode, - direction); - - } else { - ret = row_search_no_mvcc( - buf, PAGE_CUR_UNSUPP, m_prebuilt, match_mode, - direction); - } + ret = row_search_mvcc( + buf, PAGE_CUR_UNSUPP, m_prebuilt, match_mode, direction); innobase_srv_conc_exit_innodb(m_prebuilt); @@ -10763,10 +10654,10 @@ ha_innobase::general_fetch( table->status = 0; if (m_prebuilt->table->is_system_db) { srv_stats.n_system_rows_read.add( - (size_t) m_prebuilt->trx->id, 1); + thd_get_thread_id(trx->mysql_thd), 1); } else { srv_stats.n_rows_read.add( - (size_t) m_prebuilt->trx->id, 1); + thd_get_thread_id(trx->mysql_thd), 1); } break; case DB_RECORD_NOT_FOUND: @@ -10905,8 +10796,7 @@ ha_innobase::rnd_init( { TrxInInnoDB trx_in_innodb(m_prebuilt->trx); - if (!dict_table_is_intrinsic(m_prebuilt->table) - && trx_in_innodb.is_aborted()) { + if (trx_in_innodb.is_aborted()) { return(innobase_rollback(ht, m_user_thd, false)); } @@ -11156,10 +11046,7 @@ ha_innobase::ft_init_ext( /* Allocate FTS handler, and instantiate it before return */ fts_hdl = reinterpret_cast( - my_malloc(sizeof(NEW_FT_INFO), MYF(0))); - /* JAN: TODO: MySQL 5.7 PSI - my_malloc(PSI_INSTRUMENT_ME, sizeof(NEW_FT_INFO), MYF(0))); - */ + my_malloc(/*PSI_INSTRUMENT_ME,*/ sizeof(NEW_FT_INFO), MYF(0))); fts_hdl->please = const_cast<_ft_vft*>(&ft_vft_result); fts_hdl->could_you = const_cast<_ft_vft_ext*>(&ft_vft_ext_result); @@ -11753,7 +11640,7 @@ ha_innobase::wsrep_append_keys( keyval1[0] = (char)i; if (!tab) { - WSREP_WARN("MySQL-InnoDB key mismatch %s %s", + WSREP_WARN("MariaDB-InnoDB key mismatch %s %s", table->s->table_name.str, key_info->name); } @@ -11938,7 +11825,43 @@ create_table_check_doc_id_col( return(false); } -#ifdef MYSQL_VIRTUAL_COLUMNS + +/** Finds all base columns needed to compute a given generated column. +This is returned as a bitmap, in field->table->tmp_set. +Works for both dict_v_col_t and dict_s_col_t columns. +@param[in] table InnoDB table +@param[in] field MySQL field +@param[in,out] col virtual or stored column */ +template +void +prepare_vcol_for_base_setup( +/*========================*/ + const dict_table_t* table, + const Field* field, + T* col) +{ + ut_ad(col->num_base == 0); + ut_ad(col->base_col == NULL); + + MY_BITMAP *old_read_set = field->table->read_set; + MY_BITMAP *old_vcol_set = field->table->vcol_set; + + field->table->read_set = field->table->vcol_set = &field->table->tmp_set; + + bitmap_clear_all(&field->table->tmp_set); + field->vcol_info->expr->walk( + &Item::register_field_in_read_map, 1, field->table); + col->num_base= bitmap_bits_set(&field->table->tmp_set); + if (col->num_base != 0) { + col->base_col = static_cast(mem_heap_zalloc( + table->heap, col->num_base * sizeof( + * col->base_col))); + } + field->table->read_set= old_read_set; + field->table->vcol_set= old_vcol_set; +} + + /** Set up base columns for virtual column @param[in] table InnoDB table @param[in] field MySQL field @@ -11951,10 +11874,12 @@ innodb_base_col_setup( { int n = 0; + prepare_vcol_for_base_setup(table, field, v_col); + for (uint i= 0; i < field->table->s->fields; ++i) { const Field* base_field = field->table->field[i]; - if (!base_field->is_virtual_gcol() - && bitmap_is_set(&field->gcol_info->base_columns_map, i)) { + if (base_field->stored_in_db() + && bitmap_is_set(&field->table->tmp_set, i)) { ulint z; for (z = 0; z < table->n_cols; z++) { @@ -11972,10 +11897,9 @@ innodb_base_col_setup( n++; } } + v_col->num_base= n; } -#endif /* MYSQL_VIRTUAL_COLUMNS */ -#ifdef MYSQL_VIRTUAL_COLUMNS /** Set up base columns for stored column @param[in] table InnoDB table @param[in] field MySQL field @@ -11988,12 +11912,14 @@ innodb_base_col_setup_for_stored( { ulint n = 0; + prepare_vcol_for_base_setup(table, field, s_col); + for (uint i= 0; i < field->table->s->fields; ++i) { const Field* base_field = field->table->field[i]; if (!innobase_is_s_fld(base_field) && !innobase_is_v_fld(base_field) - && bitmap_is_set(&field->gcol_info->base_columns_map, + && bitmap_is_set(&field->table->tmp_set, i)) { ulint z; for (z = 0; z < table->n_cols; z++) { @@ -12015,8 +11941,8 @@ innodb_base_col_setup_for_stored( } } } + s_col->num_base= n; } -#endif /** Create a table definition to an InnoDB database. @return ER_* level error */ @@ -12026,7 +11952,6 @@ create_table_info_t::create_table_def() { dict_table_t* table; ulint n_cols; - ulint s_cols; ulint col_type; ulint col_len; ulint nulls_allowed; @@ -12035,6 +11960,7 @@ create_table_info_t::create_table_def() ulint long_true_varchar; ulint charset_no; ulint i; + ulint j = 0; ulint doc_id_col = 0; ibool has_doc_id_col = FALSE; mem_heap_t* heap; @@ -12071,9 +11997,7 @@ create_table_info_t::create_table_def() } n_cols = m_form->s->fields; - s_cols = m_form->s->stored_fields; -#ifdef MYSQL_VIRTUAL_COLUMNS /* Find out any virtual column */ for (i = 0; i < n_cols; i++) { Field* field = m_form->field[i]; @@ -12082,7 +12006,6 @@ create_table_info_t::create_table_def() num_v++; } } -#endif /* MYSQL_VIRTUAL_COLUMNS */ ut_ad(trx_state_eq(m_trx, TRX_STATE_NOT_STARTED)); @@ -12108,8 +12031,7 @@ create_table_info_t::create_table_def() } /* Adjust the number of columns for the FTS hidden field */ - actual_n_cols = m_form->s->stored_fields; - + actual_n_cols = n_cols; if (m_flags2 & DICT_TF2_FTS && !has_doc_id_col) { actual_n_cols += 1; } @@ -12120,7 +12042,7 @@ create_table_info_t::create_table_def() /* Set the hidden doc_id column. */ if (m_flags2 & DICT_TF2_FTS) { table->fts->doc_col = has_doc_id_col - ? doc_id_col : s_cols; + ? doc_id_col : n_cols - num_v; } if (strlen(m_temp_path) != 0) { @@ -12149,32 +12071,10 @@ create_table_info_t::create_table_def() for (i = 0; i < n_cols; i++) { ulint is_virtual; - bool is_stored MY_ATTRIBUTE((unused)); + bool is_stored = false; + Field* field = m_form->field[i]; - if (!field->stored_in_db()) { - continue; - } - - /* Generate a unique column name by pre-pending table-name for - intrinsic tables. For other tables (including normal - temporary) column names are unique. If not, MySQL layer will - block such statement. - This is work-around fix till Optimizer can handle this issue - (probably 5.7.4+). */ - char field_name[MAX_FULL_NAME_LEN + 2 + 10]; - - if (dict_table_is_intrinsic(table) && field->orig_table) { - - ut_snprintf(field_name, sizeof(field_name), - "%s_%s_%lu", field->orig_table->alias.c_ptr(), - field->field_name, i); - - } else { - ut_snprintf(field_name, sizeof(field_name), - "%s", field->field_name); - } - col_type = get_innobase_type_from_mysql_type( &unsigned_type, field); @@ -12250,9 +12150,9 @@ create_table_info_t::create_table_def() /* First check whether the column to be added has a system reserved name. */ - if (dict_col_name_is_reserved(field_name)){ + if (dict_col_name_is_reserved(field->field_name)){ my_error(ER_WRONG_COLUMN_NAME, MYF(0), - field_name); + field->field_name); err_col: dict_mem_table_free(table); mem_heap_free(heap); @@ -12264,7 +12164,7 @@ err_col: if (!is_virtual) { dict_mem_table_add_col(table, heap, - field_name, col_type, + field->field_name, col_type, dtype_form_prtype( (ulint) field->type() | nulls_allowed | unsigned_type @@ -12272,35 +12172,26 @@ err_col: charset_no), col_len); } else { -#ifdef MYSQL_VIRTUAL_COLUMNS dict_mem_table_add_v_col(table, heap, - field_name, col_type, + field->field_name, col_type, dtype_form_prtype( (ulint) field->type() | nulls_allowed | unsigned_type | binary_type | long_true_varchar | is_virtual, charset_no), - col_len, i, - 0); + col_len, i, 0); + } - field->gcol_info->non_virtual_base_columns()); -#endif - } - -#ifdef MYSQL_VIRTUAL_COLUMNS if (is_stored) { ut_ad(!is_virtual); /* Added stored column in m_s_cols list. */ dict_mem_table_add_s_col( - table, - field->gcol_info->non_virtual_base_columns()); + table, 0); } -#endif } -#ifdef MYSQL_VIRTUAL_COLUMNS + if (num_v) { - ulint j = 0; for (i = 0; i < n_cols; i++) { dict_v_col_t* v_col; @@ -12341,7 +12232,6 @@ err_col: } } } -#endif /* MYSQL_VIRTUAL_COLUMNS */ /* Add the FTS doc_id hidden column. */ if (m_flags2 & DICT_TF2_FTS && !has_doc_id_col) { @@ -12374,7 +12264,6 @@ err_col: my_error(ER_TABLESPACE_CANNOT_ENCRYPT, MYF(0)); err = DB_UNSUPPORTED; dict_mem_table_free(table); - */ } else { #endif /* MYSQL_COMPRESSION */ /* Get a new table ID */ @@ -12390,18 +12279,8 @@ err_col: temp_table_heap = mem_heap_create(256); - /* For intrinsic table (given that they are - not shared beyond session scope), add - it to session specific THD structure - instead of adding it to dictionary cache. */ - if (dict_table_is_intrinsic(table)) { - add_table_to_thread_cache( - table, temp_table_heap, m_thd); - - } else { - dict_table_add_to_cache( - table, FALSE, temp_table_heap); - } + dict_table_add_to_cache( + table, FALSE, temp_table_heap); DBUG_EXECUTE_IF("ib_ddl_crash_during_create2", DBUG_SUICIDE();); @@ -12584,7 +12463,7 @@ create_index( DBUG_RETURN(convert_error_code_to_mysql( row_create_index_for_mysql( - index, trx, NULL, NULL), + index, trx, NULL), flags, NULL)); } @@ -12599,13 +12478,7 @@ create_index( ind_type |= DICT_UNIQUE; } - /* JAN: TODO: MySQL 5.7 PSI - field_lengths = (ulint*) my_malloc(PSI_INSTRUMENT_ME, - key->user_defined_key_parts * sizeof * - field_lengths, MYF(MY_FAE)); - */ - - field_lengths = (ulint*) my_malloc( + field_lengths = (ulint*) my_malloc(//PSI_INSTRUMENT_ME, key->user_defined_key_parts * sizeof * field_lengths, MYF(MY_FAE)); @@ -12615,26 +12488,6 @@ create_index( index = dict_mem_index_create(table_name, key->name, 0, ind_type, key->user_defined_key_parts); - innodb_session_t*& priv = thd_to_innodb_session(trx->mysql_thd); - dict_table_t* handler = priv->lookup_table_handler(table_name); - - if (handler != NULL) { - /* This setting will enforce SQL NULL == SQL NULL. - For now this is turned-on for intrinsic tables - only but can be turned on for other tables if needed arises. */ - index->nulls_equal = - (key->flags & HA_NULL_ARE_EQUAL) ? true : false; - - /* Disable use of AHI for intrinsic table indexes as AHI - validates the predicated entry using index-id which has to be - system-wide unique that is not the case with indexes of - intrinsic table for performance reason. - Also given the lifetime of these tables and frequent delete - and update AHI would not help on performance front as it does - with normal tables. */ - index->disable_ahi = true; - } - for (ulint i = 0; i < key->user_defined_key_parts; i++) { KEY_PART_INFO* key_part = key->key_part + i; ulint prefix_len; @@ -12658,13 +12511,6 @@ create_index( ut_error; const char* field_name = key_part->field->field_name; - if (handler != NULL && dict_table_is_intrinsic(handler)) { - - ut_ad(!innobase_is_v_fld(key_part->field)); - ulint col_no = dict_col_get_no(dict_table_get_nth_col( - handler, key_part->field->field_index)); - field_name = dict_table_get_col_name(handler, col_no); - } col_type = get_innobase_type_from_mysql_type( &is_unsigned, key_part->field); @@ -12685,7 +12531,7 @@ create_index( case DATA_DOUBLE: case DATA_DECIMAL: sql_print_error( - "MySQL is trying to create a column" + "MariaDB is trying to create a column" " prefix index field, on an" " inappropriate data type. Table" " name %s, column name %s.", @@ -12714,13 +12560,9 @@ create_index( sure we don't create too long indexes. */ error = convert_error_code_to_mysql( - row_create_index_for_mysql(index, trx, field_lengths, handler), + row_create_index_for_mysql(index, trx, field_lengths), flags, NULL); - if (error && handler != NULL) { - priv->unregister_table_handler(table_name); - } - my_free(field_lengths); DBUG_RETURN(error); @@ -12746,26 +12588,7 @@ create_clustered_index_when_no_primary( innobase_index_reserve_name, 0, DICT_CLUSTERED, 0); - innodb_session_t*& priv = thd_to_innodb_session(trx->mysql_thd); - - dict_table_t* handler = priv->lookup_table_handler(table_name); - - if (handler != NULL) { - /* Disable use of AHI for intrinsic table indexes as AHI - validates the predicated entry using index-id which has to be - system-wide unique that is not the case with indexes of - intrinsic table for performance reason. - Also given the lifetime of these tables and frequent delete - and update AHI would not help on performance front as it does - with normal tables. */ - index->disable_ahi = true; - } - - error = row_create_index_for_mysql(index, trx, NULL, handler); - - if (error != DB_SUCCESS && handler != NULL) { - priv->unregister_table_handler(table_name); - } + error = row_create_index_for_mysql(index, trx, NULL); return(convert_error_code_to_mysql(error, flags, NULL)); } @@ -12834,6 +12657,7 @@ create_table_info_t::create_option_data_directory_is_valid() } +#ifdef MYSQL_TABLESPACES #define IDENT_NAME_OK 0 static int check_tablespace_name(const char *name) { @@ -12881,8 +12705,7 @@ validate_tablespace_name( err = HA_WRONG_CREATE_OPTION; } } else { - my_printf_error( - ER_WRONG_TABLESPACE_NAME, + my_printf_error(ER_WRONG_TABLESPACE_NAME, "InnoDB: A general tablespace" " name cannot start with `%s`.", MYF(0), reserved_space_name_prefix); @@ -13026,6 +12849,7 @@ create_table_info_t::create_option_tablespace_is_valid() return(true); } +#endif #ifdef MYSQL_COMPRESSION /** Validate the COPMRESSION option. @@ -13116,6 +12940,7 @@ create_table_info_t::create_options_are_invalid() ut_ad(m_thd != NULL); ut_ad(m_create_info != NULL); +#ifdef MYSQL_TABLESPACES /* The TABLESPACE designation on a CREATE TABLE is not subject to non-strict-mode. If it is incorrect or is incompatible with other options, then we will return an error. Make sure the tablespace exists @@ -13123,6 +12948,7 @@ create_table_info_t::create_options_are_invalid() if (!create_option_tablespace_is_valid()) { return("TABLESPACE"); } +#endif /* If innodb_strict_mode is not set don't do any more validation. Also, if this table is being put into a shared general tablespace @@ -13723,8 +13549,6 @@ index_bad: } } - //rec_format_t row_format = m_form->s->row_type; - if (m_create_info->key_block_size > 0) { /* The requested compressed page size (key_block_size) is given in kilobytes. If it is a valid number, store @@ -13878,22 +13702,6 @@ index_bad: if (m_create_info->options & HA_LEX_CREATE_TMP_TABLE) { m_flags2 |= DICT_TF2_TEMPORARY; - /* Intrinsic tables reside only in the shared temporary - tablespace and we will always use ROW_FORMAT=DYNAMIC. */ - -#ifdef MYSQL_COMPRESSION - if ((m_create_info->options & HA_LEX_CREATE_INTERNAL_TMP_TABLE) - && !m_use_file_per_table) { - - /* We do not allow compressed instrinsic - temporary tables. */ - - ut_ad(zip_ssize == 0); - m_flags2 |= DICT_TF2_INTRINSIC; - innodb_row_format = REC_FORMAT_DYNAMIC; - } -#endif - } /* Set the table flags */ @@ -14167,6 +13975,30 @@ create_table_info_t::initialize() } +/** Check if a virtual column is part of a fulltext or spatial index. */ +bool +create_table_info_t::gcols_in_fulltext_or_spatial() +{ + for (ulint i = 0; i < m_form->s->keys; i++) { + const KEY* key = m_form->key_info + i; + if (key->flags & (HA_SPATIAL | HA_FULLTEXT)) { + for (ulint j = 0; j < key->user_defined_key_parts; j++) { + const KEY_PART_INFO* key_part = key->key_part + j; + + /* We do not support special (Fulltext or + Spatial) index on virtual columns */ + if (innobase_is_v_fld(key_part->field)) { + my_error(ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN, MYF(0)); + return true; + } + } + } + + } + return false; +} + + /** Prepare to create a new table to an InnoDB database. @param[in] name Table name @return error number */ @@ -14204,10 +14036,14 @@ create_table_info_t::prepare_create_table( DBUG_RETURN(HA_WRONG_CREATE_OPTION); } - if (high_level_read_only && !is_intrinsic_temp_table()) { + if (high_level_read_only) { DBUG_RETURN(HA_ERR_TABLE_READONLY); } + if (gcols_in_fulltext_or_spatial()) { + DBUG_RETURN(HA_ERR_UNSUPPORTED); + } + DBUG_RETURN(parse_table_name(name)); } @@ -14348,17 +14184,7 @@ create_table_info_t::create_table() stmt = innobase_get_stmt_unsafe(m_thd, &stmt_len); - innodb_session_t*& priv = - thd_to_innodb_session(m_trx->mysql_thd); - dict_table_t* handler = - priv->lookup_table_handler(m_table_name); - - ut_ad(handler == NULL - || (handler != NULL && dict_table_is_intrinsic(handler))); - - /* There is no concept of foreign key for intrinsic tables. */ - if (stmt && (handler == NULL)) { - + if (stmt) { dberr_t err = row_table_add_foreign_constraints( m_trx, stmt, stmt_len, m_table_name, m_create_info->options & HA_LEX_CREATE_TMP_TABLE); @@ -14384,19 +14210,15 @@ create_table_info_t::create_table() " table where referencing columns appear" " as the first columns.\n", m_table_name); break; -#ifdef MYSQL_VIRTUAL_COLUMNS - case DB_NO_FK_ON_V_BASE_COL: + case DB_NO_FK_ON_S_BASE_COL: push_warning_printf( m_thd, Sql_condition::WARN_LEVEL_WARN, HA_ERR_CANNOT_ADD_FOREIGN, "Create table '%s' with foreign key constraint" " failed. Cannot add foreign key constraint" - " placed on the base column of indexed" - " virtual column, or constraint placed" - " on columns being part of virtual index.\n", + " placed on the base column of stored" + " column. \n", m_table_name); - break; -#endif default: break; } @@ -14404,23 +14226,15 @@ create_table_info_t::create_table() error = convert_error_code_to_mysql(err, m_flags, NULL); if (error) { - if (handler != NULL) { - priv->unregister_table_handler(m_table_name); - } DBUG_RETURN(error); } } - if (!is_intrinsic_temp_table()) { - innobase_table = dict_table_open_on_name( - m_table_name, TRUE, FALSE, DICT_ERR_IGNORE_NONE); + innobase_table = dict_table_open_on_name( + m_table_name, TRUE, FALSE, DICT_ERR_IGNORE_NONE); - if (innobase_table != NULL) { - dict_table_close(innobase_table, TRUE, FALSE); - } - - } else { - innobase_table = NULL; + if (innobase_table != NULL) { + dict_table_close(innobase_table, TRUE, FALSE); } DBUG_RETURN(0); @@ -14435,17 +14249,8 @@ create_table_info_t::create_table_update_dict() DBUG_ENTER("create_table_update_dict"); - innobase_table = thd_to_innodb_session(m_thd)->lookup_table_handler( - m_table_name); - - - if (innobase_table == NULL) { - innobase_table = dict_table_open_on_name( - m_table_name, FALSE, FALSE, DICT_ERR_IGNORE_NONE); - } else { - innobase_table->acquire(); - ut_ad(dict_table_is_intrinsic(innobase_table)); - } + innobase_table = dict_table_open_on_name( + m_table_name, FALSE, FALSE, DICT_ERR_IGNORE_NONE); DBUG_ASSERT(innobase_table != 0); if (innobase_table->fts != NULL) { @@ -14488,34 +14293,40 @@ create_table_info_t::create_table_update_dict() } } - /* Note: We can't call update_thd() as m_prebuilt will not be - setup at this stage and so we use thd. */ + if (const Field* ai = m_form->found_next_number_field) { + ut_ad(!innobase_is_v_fld(ai)); - /* We need to copy the AUTOINC value from the old table if - this is an ALTER|OPTIMIZE TABLE or CREATE INDEX because CREATE INDEX - does a table copy too. If query was one of : + ib_uint64_t autoinc = m_create_info->auto_increment_value; - CREATE TABLE ...AUTO_INCREMENT = x; or - ALTER TABLE...AUTO_INCREMENT = x; or - OPTIMIZE TABLE t; or - CREATE INDEX x on t(...); - - Find out a table definition from the dictionary and get - the current value of the auto increment field. Set a new - value to the auto increment field if the value is greater - than the maximum value in the column. */ - - if (((m_create_info->used_fields & HA_CREATE_USED_AUTO) - || thd_sql_command(m_thd) == SQLCOM_ALTER_TABLE - || thd_sql_command(m_thd) == SQLCOM_OPTIMIZE - || thd_sql_command(m_thd) == SQLCOM_CREATE_INDEX) - && m_create_info->auto_increment_value > 0) { - ib_uint64_t auto_inc_value; - - auto_inc_value = m_create_info->auto_increment_value; + if (autoinc == 0) { + autoinc = 1; + } dict_table_autoinc_lock(innobase_table); - dict_table_autoinc_initialize(innobase_table, auto_inc_value); + dict_table_autoinc_initialize(innobase_table, autoinc); + + if (dict_table_is_temporary(innobase_table)) { + /* AUTO_INCREMENT is not persistent for + TEMPORARY TABLE. Temporary tables are never + evicted. Keep the counter in memory only. */ + } else { + const unsigned col_no = innodb_col_no(ai); + + innobase_table->persistent_autoinc = 1 + + dict_table_get_nth_col_pos( + innobase_table, col_no, NULL); + + /* Persist the "last used" value, which + typically is AUTO_INCREMENT - 1. + In btr_create(), the value 0 was already written. */ + if (--autoinc) { + btr_write_autoinc( + dict_table_get_first_index( + innobase_table), + autoinc); + } + } + dict_table_autoinc_unlock(innobase_table); } @@ -14579,13 +14390,8 @@ ha_innobase::create( /* Latch the InnoDB data dictionary exclusively so that no deadlocks or lock waits can happen in it during a table create operation. - Drop table etc. do this latching in row0mysql.cc. - Avoid locking dictionary if table is intrinsic. - Table Object for such table is cached in THD instead of storing it - to dictionary. */ - if (!info.is_intrinsic_temp_table()) { - row_mysql_lock_data_dictionary(trx); - } + Drop table etc. do this latching in row0mysql.cc. */ + row_mysql_lock_data_dictionary(trx); if ((error = info.create_table())) { goto cleanup; @@ -14593,14 +14399,12 @@ ha_innobase::create( innobase_commit_low(trx); - if (!info.is_intrinsic_temp_table()) { - ut_ad(!srv_read_only_mode); - row_mysql_unlock_data_dictionary(trx); - /* Flush the log to reduce probability that the .frm files and - the InnoDB data dictionary get out-of-sync if the user runs - with innodb_flush_log_at_trx_commit = 0 */ - log_buffer_flush_to_disk(); - } + ut_ad(!srv_read_only_mode); + row_mysql_unlock_data_dictionary(trx); + /* Flush the log to reduce probability that the .frm files and + the InnoDB data dictionary get out-of-sync if the user runs + with innodb_flush_log_at_trx_commit = 0 */ + log_buffer_flush_to_disk(); error = info.create_table_update_dict(); @@ -14615,38 +14419,7 @@ ha_innobase::create( cleanup: trx_rollback_for_mysql(trx); - - if (!info.is_intrinsic_temp_table()) { - row_mysql_unlock_data_dictionary(trx); - } else { - THD* thd = info.thd(); - - dict_table_t* intrinsic_table = - thd_to_innodb_session(thd)->lookup_table_handler( - info.table_name()); - - if (intrinsic_table != NULL) { - thd_to_innodb_session(thd)->unregister_table_handler( - info.table_name()); - - for (;;) { - dict_index_t* index; - index = UT_LIST_GET_FIRST( - intrinsic_table->indexes); - if (index == NULL) { - break; - } - rw_lock_free(&index->lock); - UT_LIST_REMOVE(intrinsic_table->indexes, index); - dict_mem_index_free(index); - index = NULL; - } - - dict_mem_table_free(intrinsic_table); - intrinsic_table = NULL; - } - } - + row_mysql_unlock_data_dictionary(trx); trx_free_for_mysql(trx); DBUG_RETURN(error); @@ -14801,11 +14574,6 @@ ha_innobase::truncate() { DBUG_ENTER("ha_innobase::truncate"); - /* Truncate of intrinsic table is not allowed truncate for now. */ - if (dict_table_is_intrinsic(m_prebuilt->table)) { - DBUG_RETURN(HA_ERR_WRONG_COMMAND); - } - if (high_level_read_only) { DBUG_RETURN(HA_ERR_TABLE_READONLY); } @@ -14884,17 +14652,7 @@ ha_innobase::delete_table( extension, in contrast to ::create */ normalize_table_name(norm_name, name); - innodb_session_t*& priv = thd_to_innodb_session(thd); - dict_table_t* handler = priv->lookup_table_handler(norm_name); - - if (handler != NULL) { - for (dict_index_t* index = UT_LIST_GET_FIRST(handler->indexes); - index != NULL; - index = UT_LIST_GET_NEXT(indexes, index)) { - index->last_ins_cur->release(); - index->last_sel_cur->release(); - } - } else if (srv_read_only_mode) { + if (srv_read_only_mode) { DBUG_RETURN(HA_ERR_TABLE_READONLY); } @@ -14940,16 +14698,11 @@ ha_innobase::delete_table( err = row_drop_table_for_mysql( norm_name, trx, thd_sql_command(thd) == SQLCOM_DROP_DB, - false, handler); + false); if (err == DB_TABLE_NOT_FOUND && innobase_get_lower_case_table_names() == 1) { - char* is_part = NULL; -#ifdef __WIN__ - is_part = strstr(norm_name, "#p#"); -#else - is_part = strstr(norm_name, "#P#"); -#endif /* __WIN__ */ + char* is_part = is_partition(norm_name); if (is_part) { char par_case_name[FN_REFLEN]; @@ -14999,9 +14752,9 @@ ha_innobase::delete_table( tbl_name.m_name = norm_name; ib::error() << "Table " << tbl_name << " does not exist in the InnoDB" - " internal data dictionary though MySQL is" + " internal data dictionary though MariaDB is" " trying to drop it. Have you copied the .frm" - " file of the table to the MySQL database" + " file of the table to the MariaDB database" " directory from another database? " << TROUBLESHOOTING_MSG; } @@ -15014,11 +14767,7 @@ ha_innobase::delete_table( native innodb partitioning is completed */ if (err == DB_TABLE_NOT_FOUND && innobase_get_lower_case_table_names() == 1) { -#ifdef _WIN32 - char* is_part = strstr(norm_name, "#p#"); -#else - char* is_part = strstr(norm_name, "#P#"); -#endif /* _WIN32 */ + char* is_part = is_partition(norm_name); if (is_part != NULL) { char par_case_name[FN_REFLEN]; @@ -15040,20 +14789,16 @@ ha_innobase::delete_table( err = row_drop_table_for_mysql( par_case_name, trx, thd_sql_command(thd) == SQLCOM_DROP_DB, - true, handler); + true); } } - if (handler == NULL) { - ut_ad(!srv_read_only_mode); - /* Flush the log to reduce probability that the .frm files and - the InnoDB data dictionary get out-of-sync if the user runs - with innodb_flush_log_at_trx_commit = 0 */ + ut_ad(!srv_read_only_mode); + /* Flush the log to reduce probability that the .frm files and + the InnoDB data dictionary get out-of-sync if the user runs + with innodb_flush_log_at_trx_commit = 0 */ - log_buffer_flush_to_disk(); - } else if (err == DB_SUCCESS) { - priv->unregister_table_handler(norm_name); - } + log_buffer_flush_to_disk(); innobase_commit_low(trx); @@ -15074,8 +14819,7 @@ validate_create_tablespace_info( THD* thd, st_alter_tablespace* alter_info) { - - int error = 0; + ulint space_id; /* The parser ensures that these fields are provided. */ ut_a(alter_info->tablespace_name); @@ -15512,9 +15256,7 @@ innobase_drop_database( } ptr++; - namebuf = (char*) my_malloc((uint) len + 2, MYF(0)); - // JAN: TODO: MySQL 5.7 - //namebuf = (char*) my_malloc(PSI_INSTRUMENT_ME, (uint) len + 2, MYF(0)); + namebuf = (char*) my_malloc(/*PSI_INSTRUMENT_ME,*/ (uint) len + 2, MYF(0)); memcpy(namebuf, ptr, len); namebuf[len] = '/'; @@ -15605,9 +15347,9 @@ innobase_rename_table( if (error == DB_TABLE_NOT_FOUND) { ib::error() << "Table " << ut_get_name(trx, norm_from) << " does not exist in the InnoDB internal" - " data dictionary though MySQL is trying to" + " data dictionary though MariaDB is trying to" " rename the table. Have you copied the .frm" - " file of the table to the MySQL database" + " file of the table to the MariaDB database" " directory from another database? " << TROUBLESHOOTING_MSG; } @@ -15615,12 +15357,7 @@ innobase_rename_table( if (error != DB_SUCCESS) { if (error == DB_TABLE_NOT_FOUND && innobase_get_lower_case_table_names() == 1) { - char* is_part = NULL; -#ifdef _WIN32 - is_part = strstr(norm_from, "#p#"); -#else - is_part = strstr(norm_from, "#P#"); -#endif /* _WIN32 */ + char* is_part = is_partition(norm_from); if (is_part) { char par_case_name[FN_REFLEN]; @@ -15769,8 +15506,9 @@ For other error codes, the server will fall back to counting records. */ #ifdef MYSQL_57_SELECT_COUNT_OPTIMIZATION int -ha_innobase::records(ha_rows* num_rows) -/*===================================*/ +ha_innobase::records( +/*==================*/ + ha_rows* num_rows) /*!< out: number of rows */ { DBUG_ENTER("ha_innobase::records()"); @@ -15842,16 +15580,15 @@ ha_innobase::records(ha_rows* num_rows) case DB_LOCK_WAIT_TIMEOUT: *num_rows = HA_POS_ERROR; DBUG_RETURN(convert_error_code_to_mysql(ret, 0, m_user_thd)); - break; case DB_INTERRUPTED: *num_rows = HA_POS_ERROR; DBUG_RETURN(HA_ERR_QUERY_INTERRUPTED); - break; default: /* No other error besides the three below is returned from row_scan_index_for_mysql(). Make a debug catch. */ *num_rows = HA_POS_ERROR; ut_ad(0); + DBUG_RETURN(-1); } m_prebuilt->trx->op_info = ""; @@ -15861,6 +15598,7 @@ ha_innobase::records(ha_rows* num_rows) DBUG_RETURN(HA_ERR_QUERY_INTERRUPTED); } + *num_rows= n_rows; DBUG_RETURN(0); } #endif /* MYSQL_57_SELECT_COUNT_OPTIMIZATION */ @@ -16233,7 +15971,7 @@ innobase_get_mysql_key_number_for_index( if (index->is_committed()) { sql_print_warning( "Found index %s in InnoDB index list" - " but not its MySQL index number." + " but not its MariaDB index number." " It could be an InnoDB internal" " index.", index->name()); @@ -16355,7 +16093,7 @@ ha_innobase::info_low( /* In case MySQL calls this in the middle of a SELECT query, release possible adaptive hash latch to avoid deadlocks of threads */ - m_prebuilt->trx->op_info = (char*)"returning various info to MySQL"; + m_prebuilt->trx->op_info = (char*)"returning various info to MariaDB"; trx_search_latch_release_if_reserved(m_prebuilt->trx); @@ -16392,7 +16130,7 @@ ha_innobase::info_low( } m_prebuilt->trx->op_info = - "returning various info to MySQL"; + "returning various info to MariaDB"; } @@ -16493,8 +16231,7 @@ ha_innobase::info_low( char errbuf[MYSYS_STRERROR_SIZE]; thd = ha_thd(); - my_strerror(errbuf, sizeof(errbuf), - errno); + push_warning_printf( thd, Sql_condition::WARN_LEVEL_WARN, @@ -16506,8 +16243,8 @@ ha_innobase::info_low( " the free space to zero." " (errno: %d - %s)", ib_table->name.m_name, errno, - errbuf); - + my_strerror(errbuf, sizeof(errbuf), + errno)); stats.delete_length = 0; } else { @@ -16612,7 +16349,7 @@ ha_innobase::info_low( sql_print_error( "Index %s of %s has %lu columns" " unique inside InnoDB, but" - " MySQL is asking statistics for" + " MariaDB is asking statistics for" " %lu columns. Have you mixed" " up .frm files from different" " installations? %s", @@ -16672,9 +16409,8 @@ ha_innobase::info_low( nor the CHECK TABLE time, nor the UPDATE or INSERT time. */ if (os_file_get_status( - path, &stat_info, false, - (dict_table_is_intrinsic(ib_table) - ? false : srv_read_only_mode)) == DB_SUCCESS) { + path, &stat_info, false, + srv_read_only_mode) == DB_SUCCESS) { stats.create_time = (ulong) stat_info.ctime; } } @@ -16704,18 +16440,7 @@ ha_innobase::info_low( } if ((flag & HA_STATUS_AUTO) && table->found_next_number_field) { - - ulonglong auto_inc_val = innobase_peek_autoinc(); - /* Initialize autoinc value if not set. */ - if (auto_inc_val == 0) { - - dict_table_autoinc_lock(m_prebuilt->table); - innobase_initialize_autoinc(); - dict_table_autoinc_unlock(m_prebuilt->table); - - auto_inc_val = innobase_peek_autoinc(); - } - stats.auto_increment_value = auto_inc_val; + stats.auto_increment_value = innobase_peek_autoinc(); } func_exit: @@ -16737,72 +16462,6 @@ ha_innobase::info( return(info_low(flag, false /* not ANALYZE */)); } -/** Enable indexes. -@param[in] mode enable index mode. -@return HA_ERR_* error code or 0 */ -int -ha_innobase::enable_indexes( - uint mode) -{ - int error = HA_ERR_WRONG_COMMAND; - - /* Enable index only for intrinsic table. Behavior for all other - table continue to remain same. */ - - if (dict_table_is_intrinsic(m_prebuilt->table)) { - ut_ad(mode == HA_KEY_SWITCH_ALL); - for (dict_index_t* index - = UT_LIST_GET_FIRST(m_prebuilt->table->indexes); - index != NULL; - index = UT_LIST_GET_NEXT(indexes, index)) { - - /* InnoDB being clustered index we can't disable/enable - clustered index itself. */ - if (dict_index_is_clust(index)) { - continue; - } - - index->allow_duplicates = false; - } - error = 0; - } - - return(error); -} - -/** Disable indexes. -@param[in] mode disable index mode. -@return HA_ERR_* error code or 0 */ -int -ha_innobase::disable_indexes( - uint mode) -{ - int error = HA_ERR_WRONG_COMMAND; - - /* Disable index only for intrinsic table. Behavior for all other - table continue to remain same. */ - - if (dict_table_is_intrinsic(m_prebuilt->table)) { - ut_ad(mode == HA_KEY_SWITCH_ALL); - for (dict_index_t* index - = UT_LIST_GET_FIRST(m_prebuilt->table->indexes); - index != NULL; - index = UT_LIST_GET_NEXT(indexes, index)) { - - /* InnoDB being clustered index we can't disable/enable - clustered index itself. */ - if (dict_index_is_clust(index)) { - continue; - } - - index->allow_duplicates = true; - } - error = 0; - } - - return(error); -} - /* Updates index cardinalities of the table, based on random dives into each index tree. This does NOT calculate exact statistics on the table. @@ -17080,7 +16739,7 @@ ha_innobase::check( && !dict_index_is_corrupted(index)) { /* Enlarge the fatal lock wait timeout during CHECK TABLE. */ - os_atomic_increment_ulint( + my_atomic_addlint( &srv_fatal_semaphore_wait_threshold, SRV_SEMAPHORE_WAIT_EXTENSION); @@ -17089,9 +16748,9 @@ ha_innobase::check( /* Restore the fatal lock wait timeout after CHECK TABLE. */ - os_atomic_decrement_ulint( + my_atomic_addlint( &srv_fatal_semaphore_wait_threshold, - SRV_SEMAPHORE_WAIT_EXTENSION); + -SRV_SEMAPHORE_WAIT_EXTENSION); if (err != DB_SUCCESS) { is_ok = false; @@ -17132,7 +16791,7 @@ ha_innobase::check( if (!dict_index_is_clust(index)) { m_prebuilt->index_usable = FALSE; // row_mysql_lock_data_dictionary(m_prebuilt->trx); - dict_set_corrupted(index, m_prebuilt->trx, "dict_set_index_corrupted");; + dict_set_corrupted(index, m_prebuilt->trx, "dict_set_index_corrupted"); // row_mysql_unlock_data_dictionary(m_prebuilt->trx); }); @@ -17430,41 +17089,26 @@ get_foreign_key_info( } while (++i < foreign->n_fields); if (foreign->type & DICT_FOREIGN_ON_DELETE_CASCADE) { - len = 7; - ptr = "CASCADE"; + f_key_info.delete_method = FK_OPTION_CASCADE; } else if (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL) { - len = 8; - ptr = "SET NULL"; + f_key_info.delete_method = FK_OPTION_SET_NULL; } else if (foreign->type & DICT_FOREIGN_ON_DELETE_NO_ACTION) { - len = 9; - ptr = "NO ACTION"; + f_key_info.delete_method = FK_OPTION_NO_ACTION; } else { - len = 8; - ptr = "RESTRICT"; + f_key_info.delete_method = FK_OPTION_RESTRICT; } - f_key_info.delete_method = thd_make_lex_string( - thd, f_key_info.delete_method, ptr, - static_cast(len), 1); if (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE) { - len = 7; - ptr = "CASCADE"; + f_key_info.update_method = FK_OPTION_CASCADE; } else if (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL) { - len = 8; - ptr = "SET NULL"; + f_key_info.update_method = FK_OPTION_SET_NULL; } else if (foreign->type & DICT_FOREIGN_ON_UPDATE_NO_ACTION) { - len = 9; - ptr = "NO ACTION"; + f_key_info.update_method = FK_OPTION_NO_ACTION; } else { - len = 8; - ptr = "RESTRICT"; + f_key_info.update_method = FK_OPTION_RESTRICT; } - f_key_info.update_method = thd_make_lex_string( - thd, f_key_info.update_method, ptr, - static_cast(len), 1); - if (foreign->referenced_index && foreign->referenced_index->name != NULL) { referenced_key_name = thd_make_lex_string( @@ -17926,16 +17570,6 @@ ha_innobase::start_stmt( TrxInInnoDB trx_in_innodb(trx); - if (dict_table_is_intrinsic(m_prebuilt->table)) { - - if (thd_sql_command(thd) == SQLCOM_ALTER_TABLE) { - - DBUG_RETURN(HA_ERR_WRONG_COMMAND); - } - - DBUG_RETURN(0); - } - trx = m_prebuilt->trx; innobase_srv_conc_force_exit_innodb(trx); @@ -18065,18 +17699,6 @@ ha_innobase::external_lock( ut_ad(m_prebuilt->table); - if (dict_table_is_intrinsic(m_prebuilt->table)) { - - if (thd_sql_command(thd) == SQLCOM_ALTER_TABLE) { - - DBUG_RETURN(HA_ERR_WRONG_COMMAND); - } - - TrxInInnoDB::begin_stmt(trx); - - DBUG_RETURN(0); - } - /* Statement based binlogging does not work in isolation level READ UNCOMMITTED and READ COMMITTED since the necessary locks cannot be taken. In this case, we print an @@ -18402,12 +18024,8 @@ innodb_show_status( /* allocate buffer for the string, and read the contents of the temporary file */ - /* JAN: TODO: MySQL 5.7 PSI */ - if (!(str = (char*) my_malloc( + if (!(str = (char*) my_malloc(//PSI_INSTRUMENT_ME, usable_len + 1, MYF(0)))) { - /* if (!(str = (char*) my_malloc(PSI_INSTRUMENT_ME, - usable_len + 1, MYF(0)))) { - */ mutex_exit(&srv_monitor_file_mutex); DBUG_RETURN(1); } @@ -18842,15 +18460,9 @@ get_share( grows too big */ share = reinterpret_cast( - my_malloc( + my_malloc(//PSI_INSTRUMENT_ME, sizeof(*share) + length + 1, MYF(MY_FAE | MY_ZEROFILL))); - /* JAN: TODO: MySQL 5.7 PSI - share = reinterpret_cast( - my_malloc(PSI_INSTRUMENT_ME, - sizeof(*share) + length + 1, - MYF(MY_FAE | MY_ZEROFILL))); - */ share->table_name = reinterpret_cast( memcpy(share + 1, table_name, length + 1)); @@ -18917,7 +18529,6 @@ free_share( mysql_mutex_unlock(&innobase_share_mutex); } -#if 0 /*********************************************************************//** Returns number of THR_LOCK locks used for one instance of InnoDB table. InnoDB no longer relies on THR_LOCK locks so 0 value is returned. @@ -18933,7 +18544,6 @@ ha_innobase::lock_count(void) const { return 0; } -#endif /*****************************************************************//** Supposed to convert a MySQL table lock stored in the 'lock' field of the @@ -19001,7 +18611,6 @@ ha_innobase::store_lock( const uint sql_command = thd_sql_command(thd); if (srv_read_only_mode - && !dict_table_is_intrinsic(m_prebuilt->table) && (sql_command == SQLCOM_UPDATE || sql_command == SQLCOM_INSERT || sql_command == SQLCOM_REPLACE @@ -19181,8 +18790,6 @@ ha_innobase::store_lock( lock.type = lock_type; } - *to++= &lock; - if (!trx_is_started(trx) && (m_prebuilt->select_lock_type != LOCK_NONE || m_prebuilt->stored_select_lock_type != LOCK_NONE)) { @@ -19689,7 +19296,7 @@ innobase_xa_prepare( if (!trx_is_registered_for_2pc(trx) && trx_is_started(trx)) { - sql_print_error("Transaction not registered for MySQL 2PC," + sql_print_error("Transaction not registered for MariaDB 2PC," " but transaction is active"); } @@ -19833,64 +19440,6 @@ innobase_rollback_by_xid( } } -#ifdef INNOBASE_CURSOR_VIEW - -/*******************************************************************//** -Create a consistent view for a cursor based on current transaction -which is created if the corresponding MySQL thread still lacks one. -This consistent view is then used inside of MySQL when accessing records -using a cursor. -@return pointer to cursor view or NULL */ -static -void* -innobase_create_cursor_view( -/*========================*/ - handlerton* hton, /*!< in: innobase hton */ - THD* thd) /*!< in: user thread handle */ -{ - DBUG_ASSERT(hton == innodb_hton_ptr); - - return(read_cursor_view_create_for_mysql(check_trx_exists(thd))); -} - -/*******************************************************************//** -Close the given consistent cursor view of a transaction and restore -global read view to a transaction read view. Transaction is created if the -corresponding MySQL thread still lacks one. */ -static -void -innobase_close_cursor_view( -/*=======================*/ - handlerton* hton, /*!< in: innobase hton */ - THD* thd, /*!< in: user thread handle */ - void* curview)/*!< in: Consistent read view to be closed */ -{ - DBUG_ASSERT(hton == innodb_hton_ptr); - - read_cursor_view_close_for_mysql(check_trx_exists(thd), - (cursor_view_t*) curview); -} - -/*******************************************************************//** -Set the given consistent cursor view to a transaction which is created -if the corresponding MySQL thread still lacks one. If the given -consistent cursor view is NULL global read view of a transaction is -restored to a transaction read view. */ -static -void -innobase_set_cursor_view( -/*=====================*/ - handlerton* hton, /*!< in: innobase hton */ - THD* thd, /*!< in: user thread handle */ - void* curview)/*!< in: Consistent cursor view to be set */ -{ - DBUG_ASSERT(hton == innodb_hton_ptr); - - read_cursor_set_for_mysql(check_trx_exists(thd), - (cursor_view_t*) curview); -} -#endif /* INNOBASE_CURSOR_VIEW */ - bool ha_innobase::check_if_incompatible_data( /*====================================*/ @@ -21044,12 +20593,8 @@ innodb_monitor_validate( by InnoDB, so we can access it in another callback function innodb_monitor_update() and free it appropriately */ if (name) { - /* JAN: TODO: MySQL 5.7 PSI - monitor_name = my_strdup(PSI_INSTRUMENT_ME, + monitor_name = my_strdup(//PSI_INSTRUMENT_ME, name, MYF(0)); - */ - monitor_name = my_strdup( - name, MYF(0)); } else { return(1); } @@ -22346,7 +21891,7 @@ wsrep_fake_trx_id( trx_id_t trx_id = trx_sys_get_new_trx_id(); mutex_exit(&trx_sys->mutex); - (void *)wsrep_ws_handle_for_trx(wsrep_thd_ws_handle(thd), trx_id); + wsrep_ws_handle_for_trx(wsrep_thd_ws_handle(thd), trx_id); } #endif /* WITH_WSREP */ @@ -22373,7 +21918,7 @@ static MYSQL_SYSVAR_ENUM(checksum_algorithm, srv_checksum_algorithm, " write a constant magic number, do not allow values other than that" " magic number when reading;" " Files updated when this option is set to crc32 or strict_crc32 will" - " not be readable by MySQL versions older than 5.6.3", + " not be readable by MariaDB versions older than 10.0.4", NULL, NULL, SRV_CHECKSUM_ALGORITHM_CRC32, &innodb_checksum_algorithm_typelib); @@ -22412,7 +21957,7 @@ static MYSQL_SYSVAR_BOOL(use_atomic_writes, innobase_use_atomic_writes, static MYSQL_SYSVAR_BOOL(use_fallocate, innobase_use_fallocate, PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, - "Preallocate files fast, using operating system functionality. On POSIX systems, posix_fallocate system call is used.", + "Use posix_fallocate() to allocate files. DEPRECATED, has no effect.", NULL, NULL, FALSE); static MYSQL_SYSVAR_ULONG(io_capacity, srv_io_capacity, @@ -22784,6 +22329,18 @@ static MYSQL_SYSVAR_ULONG(doublewrite_batch_size, srv_doublewrite_batch_size, NULL, NULL, 120, 1, 127, 0); #endif /* defined UNIV_DEBUG || defined UNIV_PERF_DEBUG */ +static MYSQL_SYSVAR_ENUM(lock_schedule_algorithm, innodb_lock_schedule_algorithm, + PLUGIN_VAR_RQCMDARG, + "The algorithm Innodb uses for deciding which locks to grant next when" + " a lock is released. Possible values are" + " FCFS" + " grant the locks in First-Come-First-Served order;" + " VATS" + " use the Variance-Aware-Transaction-Scheduling algorithm, which" + " uses an Eldest-Transaction-First heuristic.", + NULL, NULL, INNODB_LOCK_SCHEDULE_ALGORITHM_VATS, + &innodb_lock_schedule_algorithm_typelib); + static MYSQL_SYSVAR_ULONG(buffer_pool_instances, srv_buf_pool_instances, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "Number of buffer pool instances, set to higher value on high-end machines to increase scalability", @@ -23333,7 +22890,7 @@ static MYSQL_SYSVAR_BOOL(status_output_locks, srv_print_innodb_lock_monitor, static MYSQL_SYSVAR_BOOL(print_all_deadlocks, srv_print_all_deadlocks, PLUGIN_VAR_OPCMDARG, - "Print all deadlocks to MySQL error log (off by default)", + "Print all deadlocks to MariaDB error log (off by default)", NULL, NULL, FALSE); static MYSQL_SYSVAR_ULONG(compression_failure_threshold_pct, @@ -23386,6 +22943,12 @@ static MYSQL_SYSVAR_BOOL(trx_purge_view_update_only_debug, " but the each purges were not done yet.", NULL, NULL, FALSE); +static MYSQL_SYSVAR_ULONG(data_file_size_debug, + srv_sys_space_size_debug, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, + "InnoDB system tablespace size to be set in recovery.", + NULL, NULL, 0, 0, UINT_MAX32, 0); + static MYSQL_SYSVAR_ULONG(fil_make_page_dirty_debug, srv_fil_make_page_dirty_debug, PLUGIN_VAR_OPCMDARG, "Make the first page of the given tablespace dirty.", @@ -23657,6 +23220,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(ft_sort_pll_degree), MYSQL_SYSVAR(large_prefix), MYSQL_SYSVAR(force_load_corrupted), + MYSQL_SYSVAR(lock_schedule_algorithm), MYSQL_SYSVAR(locks_unsafe_for_binlog), MYSQL_SYSVAR(lock_wait_timeout), MYSQL_SYSVAR(page_size), @@ -23769,6 +23333,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(trx_rseg_n_slots_debug), MYSQL_SYSVAR(limit_optimistic_insert_debug), MYSQL_SYSVAR(trx_purge_view_update_only_debug), + MYSQL_SYSVAR(data_file_size_debug), MYSQL_SYSVAR(fil_make_page_dirty_debug), MYSQL_SYSVAR(saved_page_number_debug), MYSQL_SYSVAR(compress_debug), @@ -23782,6 +23347,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(fatal_semaphore_wait_threshold), /* Table page compression feature */ MYSQL_SYSVAR(use_trim), + MYSQL_SYSVAR(compression_default), MYSQL_SYSVAR(compression_algorithm), MYSQL_SYSVAR(mtflush_threads), MYSQL_SYSVAR(use_mtflush), @@ -23805,6 +23371,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { #endif MYSQL_SYSVAR(instrument_semaphores), MYSQL_SYSVAR(buf_dump_status_frequency), + MYSQL_SYSVAR(background_thread), NULL }; @@ -23979,29 +23546,29 @@ innobase_index_cond( return handler_index_cond_check(file); } -#ifdef MYSQL_VIRTUAL_COLUMNS -/** Get the computed value by supplying the base column values. -@param[in,out] table the table whose virtual column template to be built */ -void -innobase_init_vc_templ( + +/** Find or open a mysql table for the virtual column template +@param[in] thd mysql thread handle +@param[in,out] table InnoDB table whose virtual column template is to be updated +@return TABLE if successful or NULL */ +static TABLE * +innobase_find_mysql_table_for_vc( +/*=============================*/ + THD* thd, dict_table_t* table) { - char dbname[MAX_DATABASE_NAME_LEN + 1]; - char tbname[MAX_TABLE_NAME_LEN + 1]; - char* name = table->name.m_name; - ulint dbnamelen = dict_get_db_name_len(name); - ulint tbnamelen = strlen(name) - dbnamelen - 1; - char t_dbname[MAX_DATABASE_NAME_LEN + 1]; - char t_tbname[MAX_TABLE_NAME_LEN + 1]; - - mutex_enter(&dict_sys->mutex); - - if (table->vc_templ != NULL) { - mutex_exit(&dict_sys->mutex); - - return; + if (table->vc_templ->mysql_table_query_id == thd_get_query_id(thd)) { + return table->vc_templ->mysql_table; } + char dbname[MAX_DATABASE_NAME_LEN + 1]; + char tbname[MAX_TABLE_NAME_LEN + 1]; + char* name = table->name.m_name; + uint dbnamelen = dict_get_db_name_len(name); + uint tbnamelen = strlen(name) - dbnamelen - 1; + char t_dbname[MAX_DATABASE_NAME_LEN + 1]; + char t_tbname[MAX_TABLE_NAME_LEN + 1]; + strncpy(dbname, name, dbnamelen); dbname[dbnamelen] = 0; strncpy(tbname, name + dbnamelen + 1, tbnamelen); @@ -24009,36 +23576,53 @@ innobase_init_vc_templ( /* For partition table, remove the partition name and use the "main" table name to build the template */ -#ifdef _WIN32 - char* is_part = strstr(tbname, "#p#"); -#else - char* is_part = strstr(tbname, "#P#"); -#endif /* _WIN32 */ + char* is_part = is_partition(tbname); if (is_part != NULL) { *is_part = '\0'; tbnamelen = is_part - tbname; } - table->vc_templ = UT_NEW_NOKEY(dict_vcol_templ_t()); - table->vc_templ->vtempl = NULL; - dbnamelen = filename_to_tablename(dbname, t_dbname, MAX_DATABASE_NAME_LEN + 1); tbnamelen = filename_to_tablename(tbname, t_tbname, MAX_TABLE_NAME_LEN + 1); -#ifdef UNIV_DEBUG - // bool ret = -#endif /* UNIV_DEBUG */ + TABLE *mysql_table = find_fk_open_table(thd, t_dbname, dbnamelen, + t_tbname, tbnamelen); - /* JAN: TODO: MySQL: 5.7 virtual columsn - handler::my_prepare_gcolumn_template( - thd, t_dbname, t_tbname, - &innobase_build_v_templ_callback, - static_cast(table)); - ut_ad(!ret); - */ + if (!mysql_table && THDVAR(thd, background_thread)) { + /* only open the table in background purge threads */ + mysql_table = open_purge_table(thd, t_dbname, dbnamelen, + t_tbname, tbnamelen); + } + + table->vc_templ->mysql_table = mysql_table; + table->vc_templ->mysql_table_query_id = thd_get_query_id(thd); + return mysql_table; +} + +/** Get the computed value by supplying the base column values. +@param[in,out] table table whose virtual column template to be built */ +void +innobase_init_vc_templ( + dict_table_t* table) +{ + if (table->vc_templ != NULL) { + return; + } + + table->vc_templ = UT_NEW_NOKEY(dict_vcol_templ_t()); + + TABLE *mysql_table= innobase_find_mysql_table_for_vc(current_thd, table); + + ut_ad(mysql_table); + if (!mysql_table) { + return; + } + + mutex_enter(&dict_sys->mutex); + innobase_build_v_templ(mysql_table, table, table->vc_templ, NULL, true); mutex_exit(&dict_sys->mutex); } @@ -24064,11 +23648,7 @@ innobase_rename_vc_templ( /* For partition table, remove the partition name and use the "main" table name to build the template */ -#ifdef _WIN32 - char* is_part = strstr(tbname, "#p#"); -#else - char* is_part = strstr(tbname, "#P#"); -#endif /* _WIN32 */ + char* is_part = is_partition(tbname); if (is_part != NULL) { *is_part = '\0'; @@ -24152,7 +23732,6 @@ innobase_get_computed_value( upd_t* parent_update, dict_foreign_t* foreign) { - byte rec_buf1[REC_VERSION_56_MAX_INDEX_COL_LEN]; byte rec_buf2[REC_VERSION_56_MAX_INDEX_COL_LEN]; byte* mysql_rec; byte* buf; @@ -24178,15 +23757,20 @@ innobase_get_computed_value( *local_heap = mem_heap_create(UNIV_PAGE_SIZE); } - mysql_rec = static_cast(mem_heap_alloc( - *local_heap, index->table->vc_templ->rec_len)); buf = static_cast(mem_heap_alloc( *local_heap, index->table->vc_templ->rec_len)); } else { - mysql_rec = rec_buf1; buf = rec_buf2; } + if (!mysql_table) { + mysql_table = innobase_find_mysql_table_for_vc(thd, index->table); + } + + ut_ad(mysql_table); + + mysql_rec = mysql_table->record[0]; + for (ulint i = 0; i < col->num_base; i++) { dict_col_t* base_col = col->base_col[i]; const dfield_t* row_field = NULL; @@ -24245,46 +23829,11 @@ innobase_get_computed_value( field = dtuple_get_nth_v_field(row, col->v_pos); - /* Bitmap for specifying which virtual columns the server - should evaluate */ - MY_BITMAP column_map; - my_bitmap_map col_map_storage[bitmap_buffer_size(REC_MAX_N_FIELDS)]; - - bitmap_init(&column_map, col_map_storage, REC_MAX_N_FIELDS, false); - - /* Specify the column the server should evaluate */ - bitmap_set_bit(&column_map, col->m_col.ind); - - if (mysql_table == NULL) { - if (vctempl->type == DATA_BLOB) { - ulint max_len; - - if (vctempl->mysql_col_len - 8 == 1) { - /* This is for TINYBLOB only, which needs - only 1 byte, other BLOBs won't be affected */ - max_len = 255; - } else { - max_len = DICT_MAX_FIELD_LEN_BY_FORMAT( - index->table) + 1; - } - - byte* blob_mem = static_cast( - mem_heap_alloc(heap, max_len)); - - row_mysql_store_blob_ref( - mysql_rec + vctempl->mysql_col_offset, - vctempl->mysql_col_len, blob_mem, max_len); - } - - ret = handler::my_eval_gcolumn_expr_with_open( - thd, index->table->vc_templ->db_name.c_str(), - index->table->vc_templ->tb_name.c_str(), &column_map, - (uchar *)mysql_rec); - } else { - ret = handler::my_eval_gcolumn_expr( - thd, mysql_table, &column_map, - (uchar *)mysql_rec); - } + my_bitmap_map* old_write_set = dbug_tmp_use_all_columns(mysql_table, mysql_table->write_set); + my_bitmap_map* old_read_set = dbug_tmp_use_all_columns(mysql_table, mysql_table->read_set); + ret = mysql_table->update_virtual_field(mysql_table->field[col->m_col.ind]); + dbug_tmp_restore_column_map(mysql_table->read_set, old_read_set); + dbug_tmp_restore_column_map(mysql_table->write_set, old_write_set); if (ret != 0) { #ifdef INNODB_VIRTUAL_DEBUG @@ -24296,11 +23845,6 @@ innobase_get_computed_value( return(NULL); } - /* we just want to store the data in passed in MySQL record */ - if (ret != 0) { - return(NULL); - } - if (vctempl->mysql_null_bit_mask && (mysql_rec[vctempl->mysql_null_byte_offset] & vctempl->mysql_null_bit_mask)) { @@ -24340,7 +23884,7 @@ innobase_get_computed_value( return(field); } -#endif /* MYSQL_VIRTUAL_COLUMNS */ + /** Attempt to push down an index condition. @param[in] keyno MySQL key number @@ -24805,20 +24349,22 @@ ib_push_warning( const char *format,/*!< in: warning message */ ...) { - va_list args; - THD *thd = (THD *)trx->mysql_thd; - char *buf; + if (trx && trx->mysql_thd) { + THD *thd = (THD *)trx->mysql_thd; + va_list args; + char *buf; #define MAX_BUF_SIZE 4*1024 - va_start(args, format); - buf = (char *)my_malloc(MAX_BUF_SIZE, MYF(MY_WME)); - vsprintf(buf,format, args); + va_start(args, format); + buf = (char *)my_malloc(MAX_BUF_SIZE, MYF(MY_WME)); + vsprintf(buf,format, args); - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - convert_error_code_to_mysql((dberr_t)error, 0, thd), - buf); - my_free(buf); - va_end(args); + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + convert_error_code_to_mysql((dberr_t)error, 0, thd), + buf); + my_free(buf); + va_end(args); + } } /********************************************************************//** @@ -24870,7 +24416,7 @@ ib_push_frm_error( case DICT_FRM_NO_PK: sql_print_error("Table %s has a primary key in " "InnoDB data dictionary, but not " - "in MySQL!" + "in MariaDB!" " Have you mixed up " ".frm files from different " "installations? See " @@ -24884,17 +24430,17 @@ ib_push_frm_error( "InnoDB: Table %s has a " "primary key in InnoDB data " "dictionary, but not in " - "MySQL!", ib_table->name); + "MariaDB!", ib_table->name); } break; case DICT_NO_PK_FRM_HAS: sql_print_error( "Table %s has no primary key in InnoDB data " - "dictionary, but has one in MySQL! If you " - "created the table with a MySQL version < " + "dictionary, but has one in MariaDB! If you " + "created the table with a MariaDB version < " "3.23.54 and did not define a primary key, " "but defined a unique key with all non-NULL " - "columns, then MySQL internally treats that " + "columns, then MariaDB internally treats that " "key as the primary key. You can fix this " "error by dump + DROP + CREATE + reimport " "of the table.", ib_table->name); @@ -24905,7 +24451,7 @@ ib_push_frm_error( "InnoDB: Table %s has no " "primary key in InnoDB data " "dictionary, but has one in " - "MySQL!", + "MariaDB!", ib_table->name); } break; @@ -24914,7 +24460,7 @@ ib_push_frm_error( sql_print_error("InnoDB: Table %s contains %lu " "indexes inside InnoDB, which " "is different from the number of " - "indexes %u defined in the MySQL " + "indexes %u defined in the MariaDB " " Have you mixed up " ".frm files from different " "installations? See " @@ -24929,7 +24475,7 @@ ib_push_frm_error( "InnoDB: Table %s contains %lu " "indexes inside InnoDB, which " "is different from the number of " - "indexes %u defined in the MySQL ", + "indexes %u defined in the MariaDB ", ib_table->name, n_keys, table->s->keys); } @@ -24938,7 +24484,7 @@ ib_push_frm_error( case DICT_FRM_CONSISTENT: default: sql_print_error("InnoDB: Table %s is consistent " - "on InnoDB data dictionary and MySQL " + "on InnoDB data dictionary and MariaDB " " FRM file.", ib_table->name); ut_error; diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index b436453e610..cef39e594b9 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -119,6 +119,8 @@ public: const key_map* keys_to_use_for_scanning(); + void column_bitmaps_signal(); + /** Opens dictionary table object using table name. For partition, we need to try alternative lower/upper case names to support moving data files across platforms. @@ -203,9 +205,6 @@ public: int ft_read(uchar* buf); - int enable_indexes(uint mode); - int disable_indexes(uint mode); - void position(const uchar *record); int info(uint); @@ -274,7 +273,7 @@ public: void free_foreign_key_create_info(char* str); - //uint lock_count(void) const; + uint lock_count(void) const; THR_LOCK_DATA** store_lock( THD* thd, @@ -458,7 +457,6 @@ protected: int end_stmt(); dberr_t innobase_get_autoinc(ulonglong* value); - void innobase_initialize_autoinc(); dberr_t innobase_lock_autoinc(); ulonglong innobase_peek_autoinc(); dberr_t innobase_set_max_autoinc(ulonglong auto_inc); @@ -468,9 +466,6 @@ protected: @see build_template() */ void reset_template(); - /** Write Row Interface optimized for Intrinsic table. */ - int intrinsic_table_write_row(uchar* record); - protected: inline void update_thd(THD* thd); void update_thd(); @@ -787,6 +782,8 @@ public: @return NULL if valid, string name of bad option if not. */ const char* create_options_are_invalid(); + bool gcols_in_fulltext_or_spatial(); + /** Validates engine specific table options not handled by SQL-parser. @return NULL if valid, string name of bad option if not. */ @@ -833,14 +830,6 @@ public: THD* thd() const { return(m_thd); } - inline bool is_intrinsic_temp_table() const - { - /* DICT_TF2_INTRINSIC implies DICT_TF2_TEMPORARY */ - ut_ad(!(m_flags2 & DICT_TF2_INTRINSIC) - || (m_flags2 & DICT_TF2_TEMPORARY)); - return((m_flags2 & DICT_TF2_INTRINSIC) != 0); - } - /** Normalizes a table name string. A normalized name consists of the database name catenated to '/' and table name. An example: test/mytable. On Windows normalization puts @@ -1051,13 +1040,9 @@ innodb_base_col_setup_for_stored( dict_s_col_t* s_col); /** whether this is a stored column */ -// JAN: TODO: MySQL 5.7 virtual fields -//#define innobase_is_s_fld(field) ((field)->gcol_info && (field)->stored_in_db) -#define innobase_is_s_fld(field) (field == NULL) -// JAN: TODO: MySQL 5.7 virtual fields +#define innobase_is_s_fld(field) ((field)->vcol_info && (field)->stored_in_db()) /** whether this is a computed virtual column */ -//#define innobase_is_v_fld(field) ((field)->gcol_info && !(field)->stored_in_db) -#define innobase_is_v_fld(field) (field == NULL) +#define innobase_is_v_fld(field) ((field)->vcol_info && !(field)->stored_in_db()) /** Release temporary latches. Call this function when mysqld passes control to the client. That is to @@ -1134,16 +1119,14 @@ innodb_rec_per_key( @param[in,out] s_templ InnoDB template structure @param[in] add_v new virtual columns added along with add index call -@param[in] locked true if innobase_share_mutex is held -@param[in] share_tbl_name original MySQL table name */ +@param[in] locked true if innobase_share_mutex is held */ void innobase_build_v_templ( const TABLE* table, const dict_table_t* ib_table, dict_vcol_templ_t* s_templ, const dict_add_v_col_t* add_v, - bool locked, - const char* share_tbl_name); + bool locked); /** callback used by MySQL server layer to initialized the table virtual columns' template @@ -1158,6 +1141,13 @@ innobase_build_v_templ_callback( the table virtual columns' template */ typedef void (*my_gcolumn_templatecallback_t)(const TABLE*, void*); +/** Convert MySQL column number to dict_table_t::cols[] offset. +@param[in] field non-virtual column +@return column number relative to dict_table_t::cols[] */ +unsigned +innodb_col_no(const Field* field) + MY_ATTRIBUTE((nonnull, warn_unused_result)); + /********************************************************************//** Helper function to push frm mismatch error to error log and if needed to sql-layer. */ @@ -1171,19 +1161,3 @@ ib_push_frm_error( ulint n_keys, /*!< in: InnoDB #keys */ bool push_warning); /*!< in: print warning ? */ -/*****************************************************************//** -Validates the create options. We may build on this function -in future. For now, it checks two specifiers: -KEY_BLOCK_SIZE and ROW_FORMAT -If innodb_strict_mode is not set then this function is a no-op -@return NULL if valid, string if not. */ -UNIV_INTERN -const char* -create_options_are_invalid( -/*=======================*/ - THD* thd, /*!< in: connection thread. */ - TABLE* form, /*!< in: information on table - columns and indexes */ - HA_CREATE_INFO* create_info, /*!< in: create info. */ - bool use_tablespace) /*!< in: srv_file_per_table */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); diff --git a/storage/innobase/handler/ha_innopart.cc b/storage/innobase/handler/ha_innopart.cc index 5fd02dfa016..09a60be1577 100644 --- a/storage/innobase/handler/ha_innopart.cc +++ b/storage/innobase/handler/ha_innopart.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2016, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -827,17 +828,6 @@ ha_innopart::alter_table_flags( return(HA_PARTITION_FUNCTION_SUPPORTED | HA_FAST_CHANGE_PARTITION); } -/** Internally called for initializing auto increment value. -Only called from ha_innobase::discard_or_import_table_space() -and should not do anything, since it is ha_innopart will initialize -it on first usage. */ -int -ha_innopart::innobase_initialize_autoinc() -{ - ut_ad(0); - return(0); -} - /** Set the autoinc column max value. This should only be called once from ha_innobase::open(). Therefore there's no need for a covering lock. @@ -892,78 +882,33 @@ ha_innopart::initialize_auto_increment( my_error(ER_AUTOINC_READ_FAILED, MYF(0)); error = HA_ERR_AUTOINC_READ_FAILED; } else { - dict_index_t* index; - const char* col_name; - ib_uint64_t read_auto_inc; - ib_uint64_t max_auto_inc = 0; - ulint err; - dict_table_t* ib_table; - ulonglong col_max_value; - - col_max_value = field->get_max_int_value(); + ib_uint64_t col_max_value = field->get_max_int_value(); update_thd(ha_thd()); - col_name = field->field_name; for (uint part = 0; part < m_tot_parts; part++) { - ib_table = m_part_share->get_table_part(part); + dict_table_t* ib_table + = m_part_share->get_table_part(part); dict_table_autoinc_lock(ib_table); - read_auto_inc = dict_table_autoinc_read(ib_table); - if (read_auto_inc != 0) { - set_if_bigger(max_auto_inc, read_auto_inc); - dict_table_autoinc_unlock(ib_table); - continue; - } - /* Execute SELECT MAX(col_name) FROM TABLE; */ - index = m_part_share->get_index( - part, table->s->next_number_index); - err = row_search_max_autoinc( - index, col_name, &read_auto_inc); + ut_ad(ib_table->persistent_autoinc); + ib_uint64_t read_auto_inc + = dict_table_autoinc_read(ib_table); + if (read_auto_inc == 0) { + read_auto_inc = btr_read_autoinc( + dict_table_get_first_index(ib_table)); - switch (err) { - case DB_SUCCESS: { /* At the this stage we do not know the increment nor the offset, so use a default increment of 1. */ - auto_inc = innobase_next_autoinc( + read_auto_inc = innobase_next_autoinc( read_auto_inc, 1, 1, 0, col_max_value); - set_if_bigger(max_auto_inc, auto_inc); dict_table_autoinc_initialize(ib_table, - auto_inc); - break; - } - case DB_RECORD_NOT_FOUND: - ib::error() << "MySQL and InnoDB data" - " dictionaries are out of sync. Unable" - " to find the AUTOINC column " - << col_name << " in the InnoDB table " - << index->table->name << ". We set the" - " next AUTOINC column value to 0, in" - " effect disabling the AUTOINC next" - " value generation."; - - ib::info() << "You can either set the next" - " AUTOINC value explicitly using ALTER" - " TABLE or fix the data dictionary by" - " recreating the table."; - - /* We want the open to succeed, so that the - user can take corrective action. ie. reads - should succeed but updates should fail. */ - - /* This will disable the AUTOINC generation. */ - auto_inc = 0; - goto done; - default: - /* row_search_max_autoinc() should only return - one of DB_SUCCESS or DB_RECORD_NOT_FOUND. */ - - ut_error; + read_auto_inc); } + set_if_bigger(auto_inc, read_auto_inc); dict_table_autoinc_unlock(ib_table); } - auto_inc = max_auto_inc; } done: @@ -1578,22 +1523,6 @@ ha_innopart::update_partition( DBUG_VOID_RETURN; } -/** Save currently highest auto increment value. -@param[in] nr Auto increment value to save. */ -void -ha_innopart::save_auto_increment( - ulonglong nr) -{ - - /* Store it in the shared dictionary of the partition. - TODO: When the new DD is done, store it in the table and make it - persistent! */ - - dict_table_autoinc_lock(m_prebuilt->table); - dict_table_autoinc_update_if_greater(m_prebuilt->table, nr + 1); - dict_table_autoinc_unlock(m_prebuilt->table); -} - /** Was the last returned row semi consistent read. In an UPDATE or DELETE, if the row under the cursor was locked by another transaction, and the engine used an optimistic read of the last diff --git a/storage/innobase/handler/ha_innopart.h b/storage/innobase/handler/ha_innopart.h index 8caa9cdd8d2..5f3f8eaa318 100644 --- a/storage/innobase/handler/ha_innopart.h +++ b/storage/innobase/handler/ha_innopart.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2016, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -723,12 +724,6 @@ private: int next_partition_index(); - /** Internally called for initializing auto increment value. - Should never be called, but defined to catch such errors. - @return 0 on success else error code. */ - int - innobase_initialize_autoinc(); - /** Get the index for the current partition @param[in] keynr MySQL index number. @return InnoDB index or NULL. */ @@ -772,12 +767,6 @@ private: initialize_auto_increment( bool /* no_lock */); - /** Save currently highest auto increment value. - @param[in] nr Auto increment value to save. */ - void - save_auto_increment( - ulonglong nr); - /** Setup the ordered record buffer and the priority queue. @param[in] used_parts Number of used partitions in query. @return false for success, else true. */ diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index bd076aabc19..e09ed99937a 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -59,6 +59,10 @@ Smart ALTER TABLE #include // PROCESS_ACL #endif +static const char *MSG_UNSUPPORTED_ALTER_ONLINE_ON_VIRTUAL_COLUMN= + "INPLACE ADD or DROP of virtual columns cannot be " + "combined with other ALTER TABLE actions"; + /* For supporting Native InnoDB Partitioning. */ /* JAN: TODO: MySQL 5.7 #include "partition_info.h" @@ -67,7 +71,8 @@ Smart ALTER TABLE /** Operations for creating secondary indexes (no rebuild needed) */ static const Alter_inplace_info::HA_ALTER_FLAGS INNOBASE_ONLINE_CREATE = Alter_inplace_info::ADD_INDEX - | Alter_inplace_info::ADD_UNIQUE_INDEX; + | Alter_inplace_info::ADD_UNIQUE_INDEX + | Alter_inplace_info::ADD_SPATIAL_INDEX; /** Operations for rebuilding a table in place */ static const Alter_inplace_info::HA_ALTER_FLAGS INNOBASE_ALTER_REBUILD @@ -77,17 +82,12 @@ static const Alter_inplace_info::HA_ALTER_FLAGS INNOBASE_ALTER_REBUILD /* CHANGE_CREATE_OPTION needs to check innobase_need_rebuild() */ | Alter_inplace_info::ALTER_COLUMN_NULLABLE | Alter_inplace_info::ALTER_COLUMN_NOT_NULLABLE - | Alter_inplace_info::ALTER_COLUMN_ORDER - | Alter_inplace_info::DROP_COLUMN - | Alter_inplace_info::ADD_COLUMN -#ifdef MYSQL_VIRTUAL_COLUMNS | Alter_inplace_info::ALTER_STORED_COLUMN_ORDER | Alter_inplace_info::DROP_STORED_COLUMN | Alter_inplace_info::ADD_STORED_BASE_COLUMN - | Alter_inplace_info::ALTER_STORED_COLUMN_TYPE -#endif | Alter_inplace_info::RECREATE_TABLE /* + | Alter_inplace_info::ALTER_STORED_COLUMN_TYPE */ ; @@ -101,9 +101,7 @@ static const Alter_inplace_info::HA_ALTER_FLAGS INNOBASE_INPLACE_IGNORE | Alter_inplace_info::ALTER_PARTITIONED | Alter_inplace_info::ALTER_COLUMN_COLUMN_FORMAT | Alter_inplace_info::ALTER_COLUMN_STORAGE_TYPE -#ifdef MYSQL_VIRTUAL_COLUMNS | Alter_inplace_info::ALTER_VIRTUAL_GCOL_EXPR -#endif | Alter_inplace_info::ALTER_RENAME; /** Operations on foreign key definitions (changing the schema only) */ @@ -121,15 +119,12 @@ static const Alter_inplace_info::HA_ALTER_FLAGS INNOBASE_ALTER_NOREBUILD | Alter_inplace_info::RENAME_INDEX #endif | Alter_inplace_info::ALTER_COLUMN_NAME - | Alter_inplace_info::ALTER_COLUMN_EQUAL_PACK_LENGTH; -#ifdef MYSQL_VIRTUAL_COLUMNS - | Alter_inplace_info::ALTER_INDEX_COMMENT + | Alter_inplace_info::ALTER_COLUMN_EQUAL_PACK_LENGTH + //| Alter_inplace_info::ALTER_INDEX_COMMENT | Alter_inplace_info::ADD_VIRTUAL_COLUMN | Alter_inplace_info::DROP_VIRTUAL_COLUMN - | Alter_inplace_info::ALTER_VIRTUAL_COLUMN_ORDER - | Alter_inplace_info::ALTER_VIRTUAL_COLUMN_TYPE -#endif - ; + | Alter_inplace_info::ALTER_VIRTUAL_COLUMN_ORDER; + struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx { /** Dummy query graph */ @@ -178,8 +173,6 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx const dtuple_t* add_cols; /** autoinc sequence to use */ ib_sequence_t sequence; - /** maximum auto-increment value */ - ulonglong max_autoinc; /** temporary table name to use for old table when renaming tables */ const char* tmp_name; /** whether the order of the clustered index is unchanged */ @@ -229,7 +222,6 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx add_cols (0), sequence(prebuilt->trx->mysql_thd, autoinc_col_min_value_arg, autoinc_col_max_value_arg), - max_autoinc (0), tmp_name (0), skip_pk_sort(false), num_to_add_vcol(0), @@ -453,7 +445,6 @@ innobase_need_rebuild( return(!!(ha_alter_info->handler_flags & INNOBASE_ALTER_REBUILD)); } -#ifdef MYSQL_VIRTUAL_COLUMNS /** Check if virtual column in old and new table are in order, excluding those dropped column. This is needed because when we drop a virtual column, ALTER_VIRTUAL_COLUMN_ORDER is also turned on, so we can't decide if this @@ -484,7 +475,7 @@ check_v_col_in_order( cf_it.rewind(); while (const Create_field* new_field = cf_it++) { - if (!new_field->is_virtual_gcol()) { + if (!innobase_is_v_fld(new_field)) { continue; } @@ -510,29 +501,15 @@ check_v_col_in_order( } for (ulint i = 0; i < table->s->fields; i++) { - Field* field = table->s->field[i]; - bool dropped = false; - Alter_drop* drop; + Field* field = table->field[i]; - if (field->stored_in_db) { + if (field->stored_in_db()) { continue; } ut_ad(innobase_is_v_fld(field)); - /* Check if this column is in drop list */ - List_iterator_fast cf_it( - ha_alter_info->alter_info->drop_list); - - while ((drop = (cf_it++)) != NULL) { - if (my_strcasecmp(system_charset_info, - field->field_name, drop->name) == 0) { - dropped = true; - break; - } - } - - if (dropped) { + if (field->flags & FIELD_IS_DROPPED) { continue; } @@ -541,7 +518,7 @@ check_v_col_in_order( while (j < altered_table->s->fields) { Field* new_field = altered_table->s->field[j]; - if (new_field->stored_in_db) { + if (new_field->stored_in_db()) { j++; continue; } @@ -567,7 +544,6 @@ check_v_col_in_order( return(true); } -#endif /* MYSQL_VIRTUAL_COLUMNS */ /** Check if InnoDB supports a particular alter table in-place @param altered_table TABLE object for new version of table. @@ -602,7 +578,7 @@ ha_innobase::check_if_supported_inplace_alter( DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); } - if (altered_table->s->stored_fields > REC_MAX_N_USER_FIELDS) { + if (altered_table->s->fields > REC_MAX_N_USER_FIELDS) { /* Deny the inplace ALTER TABLE. MySQL will try to re-create the table and ha_innobase::create() will return an error too. This is how we effectively @@ -658,14 +634,11 @@ ha_innobase::check_if_supported_inplace_alter( | INNOBASE_ALTER_NOREBUILD | INNOBASE_ALTER_REBUILD)) { -#ifdef MYSQL_VIRTUAL_COLUMNS if (ha_alter_info->handler_flags & Alter_inplace_info::ALTER_STORED_COLUMN_TYPE) { ha_alter_info->unsupported_reason = innobase_get_err_msg( ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COLUMN_TYPE); } -#endif - DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); } @@ -806,8 +779,8 @@ ha_innobase::check_if_supported_inplace_alter( DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); } -#ifdef MYSQL_VIRTUAL_COLUMNS - // JAN: TODO: MySQL 5.7 Virtual columns + bool add_drop_v_cols = false; + /* If there is add or drop virtual columns, we will support operations with these 2 options alone with inplace interface for now */ @@ -824,8 +797,8 @@ ha_innobase::check_if_supported_inplace_alter( | Alter_inplace_info::DROP_VIRTUAL_COLUMN | Alter_inplace_info::ALTER_VIRTUAL_COLUMN_ORDER | Alter_inplace_info::ALTER_VIRTUAL_GCOL_EXPR + | Alter_inplace_info::ALTER_COLUMN_VCOL /* - | Alter_inplace_info::ALTER_STORED_COLUMN_ORDER | Alter_inplace_info::ADD_STORED_BASE_COLUMN | Alter_inplace_info::DROP_STORED_COLUMN | Alter_inplace_info::ALTER_STORED_COLUMN_ORDER @@ -840,14 +813,12 @@ ha_innobase::check_if_supported_inplace_alter( || (!check_v_col_in_order( this->table, altered_table, ha_alter_info))) { ha_alter_info->unsupported_reason = - innobase_get_err_msg( - ER_UNSUPPORTED_ALTER_INPLACE_ON_VIRTUAL_COLUMN); + MSG_UNSUPPORTED_ALTER_ONLINE_ON_VIRTUAL_COLUMN; DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); } add_drop_v_cols = true; } -#endif /* MYSQL_VIRTUAL_COLUMNS */ /* We should be able to do the operation in-place. See if we can do it online (LOCK=NONE). */ @@ -862,25 +833,23 @@ ha_innobase::check_if_supported_inplace_alter( + ha_alter_info->key_count; new_key++) { -#ifdef MYSQL_VIRTUAL_COLUMNS - /* Do not support adding/droping a vritual column, while + /* Do not support adding/droping a virtual column, while there is a table rebuild caused by adding a new FTS_DOC_ID */ if ((new_key->flags & HA_FULLTEXT) && add_drop_v_cols && !DICT_TF2_FLAG_IS_SET(m_prebuilt->table, DICT_TF2_FTS_HAS_DOC_ID)) { ha_alter_info->unsupported_reason = - innobase_get_err_msg( - ER_UNSUPPORTED_ALTER_INPLACE_ON_VIRTUAL_COLUMN); + MSG_UNSUPPORTED_ALTER_ONLINE_ON_VIRTUAL_COLUMN; DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); } -#endif /* MYSQL_VIRTUAL_COLUMNS */ for (KEY_PART_INFO* key_part = new_key->key_part; key_part < new_key->key_part + new_key->user_defined_key_parts; key_part++) { const Create_field* new_field; - DBUG_ASSERT(key_part->fieldnr < altered_table->s->fields); + DBUG_ASSERT(key_part->fieldnr + < altered_table->s->fields); cf_it.rewind(); for (uint fieldnr = 0; (new_field = cf_it++); @@ -939,31 +908,27 @@ ha_innobase::check_if_supported_inplace_alter( online = false; } -#ifdef MYSQL_VIRTUAL_COLUMNS - if (key_part->field->is_virtual_gcol()) { + if (innobase_is_v_fld(key_part->field)) { /* Do not support adding index on newly added virtual column, while there is also a drop virtual column in the same clause */ if (ha_alter_info->handler_flags & Alter_inplace_info::DROP_VIRTUAL_COLUMN) { ha_alter_info->unsupported_reason = - innobase_get_err_msg( - ER_UNSUPPORTED_ALTER_INPLACE_ON_VIRTUAL_COLUMN); + MSG_UNSUPPORTED_ALTER_ONLINE_ON_VIRTUAL_COLUMN; DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); } ha_alter_info->unsupported_reason = - innobase_get_err_msg( - ER_UNSUPPORTED_ALTER_ONLINE_ON_VIRTUAL_COLUMN); + MSG_UNSUPPORTED_ALTER_ONLINE_ON_VIRTUAL_COLUMN; online = false; } -#endif /* MYSQL_VIRTUAL_COLUMNS */ } } DBUG_ASSERT(!m_prebuilt->table->fts || m_prebuilt->table->fts->doc_col - <= table->s->stored_fields); + <= table->s->fields); DBUG_ASSERT(!m_prebuilt->table->fts || m_prebuilt->table->fts->doc_col < dict_table_get_n_user_cols(m_prebuilt->table)); @@ -975,7 +940,7 @@ ha_innobase::check_if_supported_inplace_alter( ha_alter_info->index_add_buffer[i]]; if (key->flags & HA_SPATIAL) { ha_alter_info->unsupported_reason = innobase_get_err_msg( - ER_INNODB_FT_LIMIT); + ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS); DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); } @@ -1049,13 +1014,10 @@ ha_innobase::check_if_supported_inplace_alter( } if (innobase_spatial_exist(altered_table)) { -#ifdef MYSQL_SPATIAL_INDEX ha_alter_info->unsupported_reason = innobase_get_err_msg( ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS); -#endif - ha_alter_info->unsupported_reason = innobase_get_err_msg( - ER_INNODB_FT_LIMIT); + DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); } else { ha_alter_info->unsupported_reason = @@ -1228,29 +1190,29 @@ innobase_set_foreign_key_option( switch (fk_key->delete_opt) { // JAN: TODO: ? MySQL 5.7 used enum fk_option directly from sql_lex.h - case Foreign_key::FK_OPTION_NO_ACTION: - case Foreign_key::FK_OPTION_RESTRICT: - case Foreign_key::FK_OPTION_DEFAULT: + case FK_OPTION_NO_ACTION: + case FK_OPTION_RESTRICT: + case FK_OPTION_SET_DEFAULT: foreign->type = DICT_FOREIGN_ON_DELETE_NO_ACTION; break; - case Foreign_key::FK_OPTION_CASCADE: + case FK_OPTION_CASCADE: foreign->type = DICT_FOREIGN_ON_DELETE_CASCADE; break; - case Foreign_key::FK_OPTION_SET_NULL: + case FK_OPTION_SET_NULL: foreign->type = DICT_FOREIGN_ON_DELETE_SET_NULL; break; } switch (fk_key->update_opt) { - case Foreign_key::FK_OPTION_NO_ACTION: - case Foreign_key::FK_OPTION_RESTRICT: - case Foreign_key::FK_OPTION_DEFAULT: + case FK_OPTION_NO_ACTION: + case FK_OPTION_RESTRICT: + case FK_OPTION_SET_DEFAULT: foreign->type |= DICT_FOREIGN_ON_UPDATE_NO_ACTION; break; - case Foreign_key::FK_OPTION_CASCADE: + case FK_OPTION_CASCADE: foreign->type |= DICT_FOREIGN_ON_UPDATE_CASCADE; break; - case Foreign_key::FK_OPTION_SET_NULL: + case FK_OPTION_SET_NULL: foreign->type |= DICT_FOREIGN_ON_UPDATE_SET_NULL; break; } @@ -1370,8 +1332,6 @@ next_rec: return(NULL); } -#ifdef MYSQL_VIRTUAL_COLUMNS - /** Check whether given column is a base of stored column. @param[in] col_name column name @param[in] table table @@ -1433,7 +1393,6 @@ innobase_check_fk_stored( return(false); } -#endif /* MYSQL_VIRTUAL_COLUMNS */ /** Create InnoDB foreign key structure from MySQL alter_info @param[in] ha_alter_info alter table info @@ -1681,13 +1640,14 @@ innobase_get_foreign_key_info( goto err_exit; } -#ifdef MYSQL_VIRTUAL_COLUMNS if (innobase_check_fk_stored( add_fk[num_fk], table, s_cols)) { - my_error(ER_CANNOT_ADD_FOREIGN_BASE_COL_STORED, MYF(0)); + my_printf_error( + HA_ERR_UNSUPPORTED, + "Cannot add foreign key on the base column " + "of stored column", MYF(0)); goto err_exit; } -#endif num_fk++; } @@ -1808,24 +1768,19 @@ innobase_rec_to_mysql( const ulint* offsets)/*!< in: rec_get_offsets( rec, index, ...) */ { - uint n_fields = table->s->stored_fields; - uint sql_idx = 0; + uint n_fields = table->s->fields; ut_ad(n_fields == dict_table_get_n_user_cols(index->table) - !!(DICT_TF2_FLAG_IS_SET(index->table, DICT_TF2_FTS_HAS_DOC_ID))); - for (uint i = 0; i < n_fields; i++, sql_idx++) { - Field* field; + for (uint i = 0; i < n_fields; i++) { + Field* field = table->field[i]; ulint ipos; ulint ilen; const uchar* ifield; ulint prefix_col; - while (!((field= table->field[sql_idx])->stored_in_db())) { - sql_idx++; - } - field->reset(); ipos = dict_index_get_nth_col_or_prefix_pos( @@ -1856,7 +1811,9 @@ null_field: } /*************************************************************//** -Copies an InnoDB index entry to table->record[0]. */ +Copies an InnoDB index entry to table->record[0]. +This is used in preparation for print_keydup_error() from +inline add index */ void innobase_fields_to_mysql( /*=====================*/ @@ -1864,8 +1821,7 @@ innobase_fields_to_mysql( const dict_index_t* index, /*!< in: InnoDB index */ const dfield_t* fields) /*!< in: InnoDB index fields */ { - uint n_fields = table->s->stored_fields; - uint sql_idx = 0; + uint n_fields = table->s->fields; ulint num_v = 0; ut_ad(n_fields == dict_table_get_n_user_cols(index->table) @@ -1873,16 +1829,12 @@ innobase_fields_to_mysql( - !!(DICT_TF2_FLAG_IS_SET(index->table, DICT_TF2_FTS_HAS_DOC_ID))); - for (uint i = 0; i < n_fields; i++, sql_idx++) { - Field* field; + for (uint i = 0; i < n_fields; i++) { + Field* field = table->field[i]; ulint ipos; ulint col_n; ulint prefix_col; - while (!((field= table->field[sql_idx])->stored_in_db())) { - sql_idx++; - } - field->reset(); if (innobase_is_v_fld(field)) { @@ -1916,7 +1868,9 @@ innobase_fields_to_mysql( } /*************************************************************//** -Copies an InnoDB row to table->record[0]. */ +Copies an InnoDB row to table->record[0]. +This is used in preparation for print_keydup_error() from +row_log_table_apply() */ void innobase_row_to_mysql( /*==================*/ @@ -1924,9 +1878,8 @@ innobase_row_to_mysql( const dict_table_t* itab, /*!< in: InnoDB table */ const dtuple_t* row) /*!< in: InnoDB row */ { - uint n_fields = table->s->stored_fields; - uint sql_idx = 0; - uint num_v = 0; + uint n_fields = table->s->fields; + ulint num_v = 0; /* The InnoDB row may contain an extra FTS_DOC_ID column at the end. */ ut_ad(row->n_fields == dict_table_get_n_cols(itab)); @@ -1934,12 +1887,8 @@ innobase_row_to_mysql( + dict_table_get_n_v_cols(itab) - !!(DICT_TF2_FLAG_IS_SET(itab, DICT_TF2_FTS_HAS_DOC_ID))); - for (uint i = 0; i < n_fields; i++, sql_idx++) { - Field* field; - - while (!((field= table->field[sql_idx])->stored_in_db())) { - sql_idx++; - } + for (uint i = 0; i < n_fields; i++) { + Field* field = table->field[i]; field->reset(); @@ -1963,6 +1912,11 @@ innobase_row_to_mysql( dfield_get_len(df), field); } } + if (table->vfield) { + my_bitmap_map* old_vcol_set = tmp_use_all_columns(table, table->vcol_set); + table->update_virtual_fields(VCOL_UPDATE_FOR_READ_WRITE); + tmp_restore_column_map(table->vcol_set, old_vcol_set); + } } /*************************************************************//** @@ -2139,22 +2093,19 @@ name_ok: is not being created @param[in] key_part MySQL key definition @param[in,out] index_field index field -@param[in] new_clustered new cluster -@param[in] fields MySQL table fields*/ +@param[in] new_clustered new cluster */ static void innobase_create_index_field_def( const TABLE* altered_table, const KEY_PART_INFO* key_part, index_field_t* index_field, - bool new_clustered, - const Field** fields) + bool new_clustered) { const Field* field; ibool is_unsigned; ulint col_type; ulint num_v = 0; - ulint num_m_v = 0; DBUG_ENTER("innobase_create_index_field_def"); @@ -2167,34 +2118,21 @@ innobase_create_index_field_def( ut_a(field); for (ulint i = 0; i < key_part->fieldnr; i++) { - const Field* ifield = altered_table->field[i]; - if (innobase_is_v_fld(ifield)) { + if (innobase_is_v_fld(altered_table->field[i])) { num_v++; } - - if (!ifield->stored_in_db()) { - num_m_v++; - } } col_type = get_innobase_type_from_mysql_type( &is_unsigned, field); -#ifdef MYSQL_VIRTUAL_COLUMNS - if (!field->stored_in_db && field->gcol_info) { - if (!field->stored_in_db && false) { - index_field->is_v_col = true; - index_field->col_no = num_v; - } else { - index_field->is_v_col = false; - index_field->col_no = key_part->fieldnr - num_v; - } + if (innobase_is_v_fld(field)) { + index_field->is_v_col = true; + index_field->col_no = num_v; + } else { + index_field->is_v_col = false; + index_field->col_no = key_part->fieldnr - num_v; } -#else - index_field->is_v_col = false; - index_field->col_no = key_part->fieldnr - num_m_v; - index_field->col_name = altered_table ? field->field_name : fields[key_part->fieldnr]->field_name; -#endif /* MYSQL_VIRTUAL_COLUMNS */ if (DATA_LARGE_MTYPE(col_type) || (key_part->length < field->pack_length() @@ -2229,8 +2167,7 @@ innobase_create_index_def( bool new_clustered, bool key_clustered, index_def_t* index, - mem_heap_t* heap, - const Field** fields) + mem_heap_t* heap) { const KEY* key = &keys[key_number]; ulint i; @@ -2309,21 +2246,16 @@ innobase_create_index_def( index->fields[0].prefix_len = 0; index->fields[0].is_v_col = false; - #ifdef MYSQL_VIRTUAL_COLUMNS - if (!key->key_part[0].field->stored_in_db - && key->key_part[0].field->gcol_info) { + if (innobase_is_v_fld(key->key_part[0].field)) { /* Currently, the spatial index cannot be created on virtual columns. It is blocked in server layer */ - ut_ad(0); index->fields[0].is_v_col = true; } else { - index->fields[0].is_v_col = false; } -#endif /* MYSQL_VIRTUAL_COLUMNS */ } else { index->ind_type = (key->flags & HA_NOSAME) ? DICT_UNIQUE : 0; } @@ -2332,7 +2264,7 @@ innobase_create_index_def( for (i = 0; i < n_fields; i++) { innobase_create_index_field_def( altered_table, &key->key_part[i], - &index->fields[i], new_clustered, fields); + &index->fields[i], new_clustered); if (index->fields[i].is_v_col) { index->ind_type |= DICT_VIRTUAL; @@ -2363,18 +2295,13 @@ innobase_fts_check_doc_id_col( { *fts_doc_col_no = ULINT_UNDEFINED; - const uint n_cols = altered_table->s->stored_fields; - uint sql_idx = 0; + const uint n_cols = altered_table->s->fields; ulint i; *num_v = 0; - for (i = 0; i < n_cols; i++, sql_idx++) { - const Field* field; - - while (!((field= altered_table->field[sql_idx])->stored_in_db())) { - sql_idx++; - } + for (i = 0; i < n_cols; i++) { + const Field* field = altered_table->field[i]; if (innobase_is_v_fld(field)) { (*num_v)++; @@ -2687,7 +2614,7 @@ innobase_create_key_defs( /* Create the PRIMARY key index definition */ innobase_create_index_def( altered_table, key_info, primary_key_number, - TRUE, TRUE, indexdef++, heap, (const Field **)altered_table->field); + true, true, indexdef++, heap); created_clustered: n_add = 1; @@ -2699,7 +2626,7 @@ created_clustered: /* Copy the index definitions. */ innobase_create_index_def( altered_table, key_info, i, true, - false, indexdef, heap, (const Field **)altered_table->field); + false, indexdef, heap); if (indexdef->ind_type & DICT_FTS) { n_fts_add++; @@ -2716,8 +2643,7 @@ created_clustered: && !innobase_fts_check_doc_id_col( NULL, altered_table, &fts_doc_id_col, &num_v)) { - fts_doc_id_col = - altered_table->s->stored_fields; + fts_doc_id_col = altered_table->s->fields - num_v; add_fts_doc_id = true; } @@ -2746,7 +2672,7 @@ created_clustered: for (ulint i = 0; i < n_add; i++) { innobase_create_index_def( altered_table, key_info, add[i], - false, false, indexdef, heap, (const Field **)altered_table->field); + false, false, indexdef, heap); if (indexdef->ind_type & DICT_FTS) { n_fts_add++; @@ -3147,16 +3073,15 @@ innobase_build_col_map( dtuple_t* add_cols, mem_heap_t* heap) { - uint old_i, old_innobase_i; DBUG_ENTER("innobase_build_col_map"); DBUG_ASSERT(altered_table != table); DBUG_ASSERT(new_table != old_table); DBUG_ASSERT(dict_table_get_n_cols(new_table) + dict_table_get_n_v_cols(new_table) - >= altered_table->s->stored_fields + DATA_N_SYS_COLS); + >= altered_table->s->fields + DATA_N_SYS_COLS); DBUG_ASSERT(dict_table_get_n_cols(old_table) + dict_table_get_n_v_cols(old_table) - >= table->s->stored_fields + DATA_N_SYS_COLS); + >= table->s->fields + DATA_N_SYS_COLS); DBUG_ASSERT(!!add_cols == !!(ha_alter_info->handler_flags & Alter_inplace_info::ADD_COLUMN)); DBUG_ASSERT(!add_cols || dtuple_get_n_fields(add_cols) @@ -3169,14 +3094,13 @@ innobase_build_col_map( List_iterator_fast cf_it( ha_alter_info->alter_info->create_list); - uint i = 0, sql_idx = 0; + uint i = 0; uint num_v = 0; /* Any dropped columns will map to ULINT_UNDEFINED. */ - for (old_innobase_i = 0; - old_innobase_i + DATA_N_SYS_COLS < old_table->n_cols; - old_innobase_i++) { - col_map[old_innobase_i] = ULINT_UNDEFINED; + for (uint old_i = 0; old_i + DATA_N_SYS_COLS < old_table->n_cols; + old_i++) { + col_map[old_i] = ULINT_UNDEFINED; } for (uint old_i = 0; old_i < old_table->n_v_cols; old_i++) { @@ -3192,21 +3116,8 @@ innobase_build_col_map( ulint num_old_v = 0; - if (!new_field->stored_in_db()) - { - sql_idx++; - continue; - } - - for (old_i = 0, old_innobase_i= 0; - table->field[old_i]; - old_i++) { + for (uint old_i = 0; table->field[old_i]; old_i++) { const Field* field = table->field[old_i]; - - if (!table->field[old_i]->stored_in_db()) { - continue; - } - if (innobase_is_v_fld(field)) { if (is_v && new_field->field == field) { col_map[old_table->n_cols + num_v] @@ -3219,30 +3130,27 @@ innobase_build_col_map( } if (new_field->field == field) { - col_map[old_innobase_i] = i; + col_map[old_i - num_old_v] = i; goto found_col; } - old_innobase_i++; } ut_ad(!is_v); innobase_build_col_map_add( heap, dtuple_get_nth_field(add_cols, i), - altered_table->field[sql_idx], + altered_table->field[i + num_v], dict_table_is_comp(new_table)); found_col: if (is_v) { num_v++; } else { i++; - sql_idx++; } } - DBUG_ASSERT(i == altered_table->s->stored_fields - num_v); + DBUG_ASSERT(i == altered_table->s->fields - num_v); - i = table->s->stored_fields; - //i = table->s->fields - old_table->n_v_cols; + i = table->s->fields - old_table->n_v_cols; /* Add the InnoDB hidden FTS_DOC_ID column, if any. */ if (i + DATA_N_SYS_COLS < old_table->n_cols) { @@ -3252,21 +3160,21 @@ found_col: DICT_TF2_FTS_HAS_DOC_ID)); DBUG_ASSERT(i + DATA_N_SYS_COLS + 1 == old_table->n_cols); DBUG_ASSERT(!strcmp(dict_table_get_col_name( - old_table, table->s->stored_fields), + old_table, i), FTS_DOC_ID_COL_NAME)); - if (altered_table->s->stored_fields + DATA_N_SYS_COLS + if (altered_table->s->fields + DATA_N_SYS_COLS - new_table->n_v_cols < new_table->n_cols) { DBUG_ASSERT(DICT_TF2_FLAG_IS_SET( new_table, DICT_TF2_FTS_HAS_DOC_ID)); - DBUG_ASSERT(altered_table->s->stored_fields + DBUG_ASSERT(altered_table->s->fields + DATA_N_SYS_COLS + 1 - == new_table->n_cols); - col_map[i] = altered_table->s->stored_fields; - /* col_map[i] = altered_table->s->fields + == static_cast( + new_table->n_cols + + new_table->n_v_cols)); + col_map[i] = altered_table->s->fields - new_table->n_v_cols; - */ } else { DBUG_ASSERT(!DICT_TF2_FLAG_IS_SET( new_table, @@ -3682,8 +3590,6 @@ innobase_check_gis_columns( DBUG_RETURN(DB_SUCCESS); } -#ifdef MYSQL_VIRTUAL_COLUMNS - /** Collect virtual column info for its addition @param[in] ha_alter_info Data used during in-place alter @param[in] altered_table MySQL table that is being altered to @@ -3749,10 +3655,8 @@ prepare_inplace_add_virtual( &is_unsigned, field); - if (!field->gcol_info || field->stored_in_db) { - my_error(ER_WRONG_KEY_COLUMN, MYF(0), - field->field_name); - return(true); + if (!innobase_is_v_fld(field)) { + continue; } col_len = field->pack_length(); @@ -3778,7 +3682,7 @@ prepare_inplace_add_virtual( charset_no += MAX_CHAR_COLL_NUM;); if (charset_no > MAX_CHAR_COLL_NUM) { - my_error(ER_WRONG_KEY_COLUMN, MYF(0), + my_error(ER_WRONG_KEY_COLUMN, MYF(0), "InnoDB", field->field_name); return(true); } @@ -3809,13 +3713,9 @@ prepare_inplace_add_virtual( ctx->add_vcol[j].m_col.len = col_len; ctx->add_vcol[j].m_col.ind = i - 1; - /* ctx->add_vcol[j].num_base = - field->gcol_info->non_virtual_base_columns(); - */ + ctx->add_vcol[j].num_base = 0; ctx->add_vcol_name[j] = field->field_name; - ctx->add_vcol[j].base_col = static_cast( - mem_heap_alloc(ctx->heap, ctx->add_vcol[j].num_base - * sizeof *(ctx->add_vcol[j].base_col))); + ctx->add_vcol[j].base_col = NULL; ctx->add_vcol[j].v_pos = ctx->old_table->n_v_cols - ctx->num_to_drop_vcol + j; @@ -3844,12 +3744,17 @@ prepare_inplace_drop_virtual( ha_innobase_inplace_ctx* ctx; ulint i = 0; ulint j = 0; - Alter_drop *drop; ctx = static_cast (ha_alter_info->handler_ctx); - ctx->num_to_drop_vcol = ha_alter_info->alter_info->drop_list.elements; + ctx->num_to_drop_vcol = 0; + for (i = 0; table->field[i]; i++) { + const Field* field = table->field[i]; + if (field->flags & FIELD_IS_DROPPED && !field->stored_in_db()) { + ctx->num_to_drop_vcol++; + } + } ctx->drop_vcol = static_cast( mem_heap_alloc(ctx->heap, ctx->num_to_drop_vcol @@ -3858,26 +3763,9 @@ prepare_inplace_drop_virtual( mem_heap_alloc(ctx->heap, ctx->num_to_drop_vcol * sizeof *ctx->drop_vcol_name)); - List_iterator_fast cf_it( - ha_alter_info->alter_info->drop_list); - - while ((drop = (cf_it++)) != NULL) { - const Field* field; - ulint old_i; - - ut_ad(drop->type == Alter_drop::COLUMN); - - for (old_i = 0; table->field[old_i]; old_i++) { - const Field* n_field = table->field[old_i]; - if (!my_strcasecmp(system_charset_info, - n_field->field_name, drop->name)) { - break; - } - } - - i++; - - if (!table->field[old_i]) { + for (i = 0; table->field[i]; i++) { + Field *field = table->field[i]; + if (!(field->flags & FIELD_IS_DROPPED) || field->stored_in_db()) { continue; } @@ -3886,19 +3774,10 @@ prepare_inplace_drop_virtual( ulint field_type; ulint charset_no; - field = table->field[old_i]; - ulint col_type = get_innobase_type_from_mysql_type( &is_unsigned, field); - - if (!field->gcol_info || field->stored_in_db) { - my_error(ER_WRONG_KEY_COLUMN, MYF(0), - field->field_name); - return(true); - } - col_len = field->pack_length(); field_type = (ulint) field->type(); @@ -3922,7 +3801,7 @@ prepare_inplace_drop_virtual( charset_no += MAX_CHAR_COLL_NUM;); if (charset_no > MAX_CHAR_COLL_NUM) { - my_error(ER_WRONG_KEY_COLUMN, MYF(0), + my_error(ER_WRONG_KEY_COLUMN, MYF(0), "InnoDB", field->field_name); return(true); } @@ -3952,12 +3831,12 @@ prepare_inplace_drop_virtual( ctx->drop_vcol[j].m_col.len = col_len; - ctx->drop_vcol[j].m_col.ind = old_i; + ctx->drop_vcol[j].m_col.ind = i; ctx->drop_vcol_name[j] = field->field_name; dict_v_col_t* v_col = dict_table_get_nth_v_col_mysql( - ctx->old_table, old_i); + ctx->old_table, i); ctx->drop_vcol[j].v_pos = v_col->v_pos; j++; } @@ -4415,7 +4294,7 @@ innodb_v_adjust_idx_col( /* Found the field in the new table */ while (const Create_field* new_field = cf_it++) { - if (!new_field->is_virtual_gcol()) { + if (!innobase_is_v_fld(new_field)) { continue; } @@ -4435,7 +4314,7 @@ innodb_v_adjust_idx_col( ut_a(0); } - ut_ad(field->is_virtual_gcol()); + ut_ad(innobase_is_v_fld(field)); num_v = 0; @@ -4449,7 +4328,7 @@ innodb_v_adjust_idx_col( break; } - if (old_table->field[old_i]->is_virtual_gcol()) { + if (innobase_is_v_fld(old_table->field[old_i])) { num_v++; } } @@ -4457,7 +4336,6 @@ innodb_v_adjust_idx_col( ut_ad(col_found); } } -#endif /* MYSQL_VIRTUAL_COLUMNS */ /** Update internal structures with concurrent writes blocked, while preparing ALTER TABLE. @@ -4522,7 +4400,6 @@ prepare_inplace_alter_table_dict( trx_start_if_not_started_xa(ctx->prebuilt->trx, true); -#ifdef MYSQL_VIRTUAL_COLUMNS if (ha_alter_info->handler_flags & Alter_inplace_info::DROP_VIRTUAL_COLUMN) { if (prepare_inplace_drop_virtual( @@ -4551,12 +4428,9 @@ prepare_inplace_alter_table_dict( } } - /* - There should be no order change for virtual columns coming in - here - */ + /* There should be no order change for virtual columns coming in + here */ ut_ad(check_v_col_in_order(old_table, altered_table, ha_alter_info)); -#endif /* MYSQL_VIRTUAL_COLUMNS */ /* Create a background transaction for the operations on the data dictionary tables. */ @@ -4671,9 +4545,9 @@ prepare_inplace_alter_table_dict( ctx->new_table->id); ulint n_cols = 0; ulint n_v_cols = 0; - ulint n_mv_cols = 0; dtuple_t* add_cols; ulint space_id = 0; + ulint z = 0; ulint key_id = FIL_DEFAULT_ENCRYPTION_KEY; fil_encryption_t mode = FIL_SPACE_ENCRYPTION_DEFAULT; const char* compression=NULL; @@ -4697,15 +4571,11 @@ prepare_inplace_alter_table_dict( if (innobase_is_v_fld(field)) { n_v_cols++; } else { - if (field->stored_in_db()) { n_cols++; - } else { - n_mv_cols++; - } } } - ut_ad(n_cols + n_v_cols + n_mv_cols == altered_table->s->fields); + ut_ad(n_cols + n_v_cols == altered_table->s->fields); if (add_fts_doc_id) { n_cols++; @@ -4757,21 +4627,17 @@ prepare_inplace_alter_table_dict( user_table->data_dir_path); } - for (uint i = 0, sql_idx=0; i < altered_table->s->stored_fields; i++, sql_idx++) { - Field* field; + for (uint i = 0; i < altered_table->s->fields; i++) { + const Field* field = altered_table->field[i]; ulint is_unsigned; - ulint charset_no; - ulint col_len; - - while (!((field= altered_table->field[sql_idx])->stored_in_db())) { - sql_idx++; - } - - ulint field_type = (ulint) field->type(); - bool is_virtual = innobase_is_v_fld(field); + ulint field_type + = (ulint) field->type(); ulint col_type = get_innobase_type_from_mysql_type( &is_unsigned, field); + ulint charset_no; + ulint col_len; + bool is_virtual = innobase_is_v_fld(field); /* we assume in dtype_form_prtype() that this fits in two bytes */ @@ -4795,7 +4661,7 @@ prepare_inplace_alter_table_dict( if (charset_no > MAX_CHAR_COLL_NUM) { dict_mem_table_free( ctx->new_table); - my_error(ER_WRONG_KEY_COLUMN, MYF(0), + my_error(ER_WRONG_KEY_COLUMN, MYF(0), "InnoDB", field->field_name); goto new_clustered_failed; } @@ -4838,7 +4704,6 @@ prepare_inplace_alter_table_dict( } if (is_virtual) { -#ifdef MYSQL_VIRTUAL_COLUMNS dict_mem_table_add_v_col( ctx->new_table, ctx->heap, field->field_name, @@ -4846,9 +4711,7 @@ prepare_inplace_alter_table_dict( dtype_form_prtype( field_type, charset_no) | DATA_VIRTUAL, - col_len, i, - field->gcol_info->non_virtual_base_columns()); -#endif /* MYSQL_VIRTUAL_COLUMNS */ + col_len, i, 0); } else { dict_mem_table_add_col( ctx->new_table, ctx->heap, @@ -4860,9 +4723,6 @@ prepare_inplace_alter_table_dict( } } -#ifdef MYSQL_VIRTUAL_COLUMNS - ulint z = 0; - if (n_v_cols) { for (uint i = 0; i < altered_table->s->fields; i++) { dict_v_col_t* v_col; @@ -4878,15 +4738,12 @@ prepare_inplace_alter_table_dict( ctx->new_table, field, v_col); } } -#endif /* MYSQL_VIRTUAL_COLUMNS */ if (add_fts_doc_id) { fts_add_doc_id_column(ctx->new_table, ctx->heap); ctx->new_table->fts->doc_col = fts_doc_id_col; ut_ad(fts_doc_id_col - == altered_table->s->stored_fields - n_v_cols); - ut_ad(fts_doc_id_col == altered_table->s->stored_fields); - + == altered_table->s->fields - n_v_cols); } else if (ctx->new_table->fts) { ctx->new_table->fts->doc_col = fts_doc_id_col; } @@ -5036,14 +4893,12 @@ new_clustered_failed: for (ulint a = 0; a < ctx->num_to_add_index; a++) { -#ifdef MYSQL_VIRTUAL_COLUMNS if (index_defs[a].ind_type & DICT_VIRTUAL && ctx->num_to_drop_vcol > 0 && !new_clustered) { innodb_v_adjust_idx_col(ha_alter_info, old_table, ctx->num_to_drop_vcol, &index_defs[a]); } -#endif /* MYSQL_VIRTUAL_COLUMNS */ ctx->add_index[a] = row_merge_create_index( ctx->trx, ctx->new_table, @@ -5117,6 +4972,23 @@ new_clustered_failed: DBUG_EXECUTE_IF("innodb_alter_table_pk_assert_no_sort", DBUG_ASSERT(ctx->skip_pk_sort);); + DBUG_ASSERT(!ctx->new_table->persistent_autoinc); + if (const Field* ai = altered_table->found_next_number_field) { + const unsigned col_no = innodb_col_no(ai); + + ctx->new_table->persistent_autoinc = 1 + + dict_table_get_nth_col_pos( + ctx->new_table, col_no, NULL); + + /* Initialize the AUTO_INCREMENT sequence + to the rebuilt table from the old one. */ + if (!old_table->found_next_number_field) { + } else if (ib_uint64_t autoinc + = btr_read_autoinc(clust_index)) { + btr_write_autoinc(new_clust_index, autoinc); + } + } + if (ctx->online) { /* Allocate a log for online table rebuild. */ rw_lock_x_lock(&clust_index->lock); @@ -5581,7 +5453,6 @@ rename_index_in_cache( DBUG_VOID_RETURN; } -# /** Rename all indexes in data dictionary cache of a given table that are specified in ha_alter_info. @@ -5615,7 +5486,6 @@ rename_indexes_in_cache( } #endif /* MYSQL_RENAME_INDEX */ -#ifdef MYSQL_VIRTUAL_COLUMNS /** Fill the stored column information in s_cols list. @param[in] altered_table mysql table object @param[in] table innodb table object @@ -5640,7 +5510,7 @@ alter_fill_stored_column( continue; } - ulint num_base = field->gcol_info->non_virtual_base_columns(); + ulint num_base = 0; dict_col_t* col = dict_table_get_nth_col(table, i); s_col.m_col = col; @@ -5663,7 +5533,7 @@ alter_fill_stored_column( (*s_cols)->push_back(s_col); } } -#endif /* MYSQL_VIRTUAL_COLUMNS */ + /** Allows InnoDB to update internal structures with concurrent writes blocked (provided that check_if_supported_inplace_alter() @@ -5804,6 +5674,12 @@ ha_innobase::prepare_inplace_alter_table( info.set_tablespace_type(is_file_per_table); + if (ha_alter_info->handler_flags & Alter_inplace_info::ADD_INDEX) { + if (info.gcols_in_fulltext_or_spatial()) { + goto err_exit_no_heap; + } + } + if (ha_alter_info->handler_flags & Alter_inplace_info::CHANGE_CREATE_OPTION) { const char* invalid_opt = info.create_options_are_invalid(); @@ -6242,10 +6118,9 @@ check_if_can_drop_indexes: & Alter_inplace_info::ADD_FOREIGN_KEY) { ut_ad(!m_prebuilt->trx->check_foreigns); -#ifdef MYSQL_VIRTUAL_COLUMNS alter_fill_stored_column(altered_table, m_prebuilt->table, &s_cols, &s_heap); -#endif + add_fk = static_cast( mem_heap_zalloc( heap, @@ -6316,7 +6191,6 @@ err_exit: } -#ifdef MYSQL_VIRTUAL_COLUMNS if ((ha_alter_info->handler_flags & Alter_inplace_info::DROP_VIRTUAL_COLUMN) && prepare_inplace_drop_virtual( @@ -6330,7 +6204,6 @@ err_exit: ha_alter_info, altered_table, table)) { DBUG_RETURN(true); } -#endif /* MYSQL_VIRTUAL_COLUMNS */ DBUG_RETURN(false); } @@ -6346,7 +6219,7 @@ err_exit: m_prebuilt->table, altered_table, &fts_doc_col_no, &num_v)) { - fts_doc_col_no = altered_table->s->stored_fields; + fts_doc_col_no = altered_table->s->fields - num_v; add_fts_doc_id = true; add_fts_doc_id_idx = true; @@ -6374,36 +6247,24 @@ err_exit: DBUG_ASSERT( doc_col_no == fts_doc_col_no || doc_col_no == ULINT_UNDEFINED - || (ha_alter_info->handler_flags)); - /* JAN: TODO: MySQL 5.7 Virtual columns + || (ha_alter_info->handler_flags & (Alter_inplace_info::ALTER_STORED_COLUMN_ORDER | Alter_inplace_info::DROP_STORED_COLUMN - | - Alter_inplace_info::ADD_STORED_COLUMN))); - */ + | Alter_inplace_info::ADD_STORED_BASE_COLUMN))); } } /* See if an AUTO_INCREMENT column was added. */ - uint i = 0, innodb_idx= 0; + uint i = 0; ulint num_v = 0; List_iterator_fast cf_it( ha_alter_info->alter_info->create_list); while (const Create_field* new_field = cf_it++) { const Field* field; - if (!new_field->stored_in_db()) { - i++; - continue; - } DBUG_ASSERT(i < altered_table->s->fields); - DBUG_ASSERT(innodb_idx < altered_table->s->stored_fields); for (uint old_i = 0; table->field[old_i]; old_i++) { - if (!table->field[old_i]->stored_in_db()) { - continue; - } - if (new_field->field == table->field[old_i]) { goto found_col; } @@ -6427,12 +6288,10 @@ err_exit: my_error(ER_WRONG_AUTO_KEY, MYF(0)); goto err_exit; } - add_autoinc_col_no = innodb_idx; - /* JAN: TODO: MySQL 5.7 - autoinc_col_max_value = - field->get_max_int_value(); - */ + /* Get the col no of the old table non-virtual column array */ + add_autoinc_col_no = i - num_v; + autoinc_col_max_value = innobase_get_int_col_max_value(field); } found_col: @@ -6441,7 +6300,6 @@ found_col: } i++; - innodb_idx++; } DBUG_ASSERT(heap); @@ -6615,7 +6473,6 @@ ok_exit: && alter_templ_needs_rebuild( altered_table, ha_alter_info, ctx->new_table)); -#ifdef MYSQL_VIRTUAL_COLUMNS if ((ctx->new_table->n_v_cols > 0) && rebuild_templ) { /* Save the templ if isn't NULL so as to restore the original state in case of alter operation failures. */ @@ -6623,11 +6480,9 @@ ok_exit: old_templ = ctx->new_table->vc_templ; } s_templ = UT_NEW_NOKEY(dict_vcol_templ_t()); - s_templ->vtempl = NULL; innobase_build_v_templ( - altered_table, ctx->new_table, s_templ, - NULL, false, NULL); + altered_table, ctx->new_table, s_templ, NULL, false); ctx->new_table->vc_templ = s_templ; } else if (ctx->num_to_add_vcol > 0 && ctx->num_to_drop_vcol == 0) { @@ -6644,11 +6499,8 @@ ok_exit: add_v->v_col = ctx->add_vcol; add_v->v_col_name = ctx->add_vcol_name; - s_templ->vtempl = NULL; - innobase_build_v_templ( - altered_table, ctx->new_table, s_templ, - add_v, false, NULL); + altered_table, ctx->new_table, s_templ, add_v, false); old_templ = ctx->new_table->vc_templ; ctx->new_table->vc_templ = s_templ; } @@ -6659,7 +6511,6 @@ ok_exit: if (!ctx->need_rebuild() && ctx->num_to_drop_vcol > 0) { eval_table = table; } -#endif /* MYSQL_VIRTUAL_COLUMNS */ /* Read the clustered index of the table and build indexes based on this information using temporary @@ -7466,14 +7317,13 @@ innobase_enlarge_columns_try( List_iterator_fast cf_it( ha_alter_info->alter_info->create_list); ulint i = 0; - bool is_v=false; + ulint num_v = 0; + bool is_v; for (Field** fp = table->field; *fp; fp++, i++) { ulint idx; -#ifdef MYSQL_VIRTUAL_COLUMNS - ulint num_v = 0; - if ((*fp)->is_virtual_gcol()) { + if (innobase_is_v_fld(*fp)) { is_v = true; idx = num_v; num_v++; @@ -7481,10 +7331,6 @@ innobase_enlarge_columns_try( idx = i - num_v; is_v = false; } -#else - idx = i; - is_v = false; -#endif cf_it.rewind(); while (Create_field* cf = cf_it++) { @@ -7568,85 +7414,120 @@ innobase_rename_or_enlarge_columns_cache( } } -/** Get the auto-increment value of the table on commit. +/** Set the auto-increment value of the table on commit. @param ha_alter_info Data used during in-place alter @param ctx In-place ALTER TABLE context @param altered_table MySQL table that is being altered -@param old_table MySQL table as it is before the ALTER operation -@return the next auto-increment value (0 if not present) */ -static MY_ATTRIBUTE((nonnull, warn_unused_result)) -ulonglong -commit_get_autoinc( -/*===============*/ +@param old_table MySQL table as it is before the ALTER operation */ +static MY_ATTRIBUTE((nonnull)) +void +commit_set_autoinc( Alter_inplace_info* ha_alter_info, ha_innobase_inplace_ctx*ctx, const TABLE* altered_table, const TABLE* old_table) { - ulonglong max_autoinc; - DBUG_ENTER("commit_get_autoinc"); if (!altered_table->found_next_number_field) { /* There is no AUTO_INCREMENT column in the table after the ALTER operation. */ - max_autoinc = 0; } else if (ctx->add_autoinc != ULINT_UNDEFINED) { + ut_ad(ctx->need_rebuild()); /* An AUTO_INCREMENT column was added. Get the last value from the sequence, which may be based on a supplied AUTO_INCREMENT value. */ - max_autoinc = ctx->sequence.last(); + ib_uint64_t autoinc = ctx->sequence.last(); + ctx->new_table->autoinc = autoinc; + /* Bulk index creation does not update + PAGE_ROOT_AUTO_INC, so we must persist the "last used" + value here. */ + btr_write_autoinc(dict_table_get_first_index(ctx->new_table), + autoinc - 1, true); } else if ((ha_alter_info->handler_flags & Alter_inplace_info::CHANGE_CREATE_OPTION) && (ha_alter_info->create_info->used_fields & HA_CREATE_USED_AUTO)) { - /* An AUTO_INCREMENT value was supplied, but the table was not - rebuilt. Get the user-supplied value or the last value from the - sequence. */ - ib_uint64_t max_value_table; - dberr_t err; + /* An AUTO_INCREMENT value was supplied by the user. + It must be persisted to the data file. */ + const Field* ai = old_table->found_next_number_field; + ut_ad(!strcmp(dict_table_get_col_name(ctx->old_table, + innodb_col_no(ai)), + ai->field_name)); - Field* autoinc_field = - old_table->found_next_number_field; - - dict_index_t* index = dict_table_get_index_on_first_col( - ctx->old_table, autoinc_field->field_index, - autoinc_field->field_name); - - max_autoinc = ha_alter_info->create_info->auto_increment_value; - - dict_table_autoinc_lock(ctx->old_table); - - err = row_search_max_autoinc( - index, autoinc_field->field_name, &max_value_table); - - if (err != DB_SUCCESS) { - ut_ad(0); - max_autoinc = 0; - } else if (max_autoinc <= max_value_table) { - ulonglong col_max_value; - ulonglong offset; - - col_max_value = innobase_get_int_col_max_value(autoinc_field); - // JAN: TODO: MySQL 5.7 - //col_max_value = autoinc_field->get_max_int_value(); - - offset = ctx->prebuilt->autoinc_offset; - max_autoinc = innobase_next_autoinc( - max_value_table, 1, 1, offset, - col_max_value); + ib_uint64_t autoinc + = ha_alter_info->create_info->auto_increment_value; + if (autoinc == 0) { + autoinc = 1; } - dict_table_autoinc_unlock(ctx->old_table); - } else { - /* An AUTO_INCREMENT value was not specified. - Read the old counter value from the table. */ - ut_ad(old_table->found_next_number_field); - dict_table_autoinc_lock(ctx->old_table); - max_autoinc = ctx->old_table->autoinc; - dict_table_autoinc_unlock(ctx->old_table); + + if (autoinc >= ctx->old_table->autoinc) { + /* Persist the predecessor of the + AUTO_INCREMENT value as the last used one. */ + ctx->new_table->autoinc = autoinc--; + } else { + /* Mimic ALGORITHM=COPY in the following scenario: + + CREATE TABLE t (a SERIAL); + INSERT INTO t SET a=100; + ALTER TABLE t AUTO_INCREMENT = 1; + INSERT INTO t SET a=NULL; + SELECT * FROM t; + + By default, ALGORITHM=INPLACE would reset the + sequence to 1, while after ALGORITHM=COPY, the + last INSERT would use a value larger than 100. + + We could only search the tree to know current + max counter in the table and compare. */ + const dict_col_t* autoinc_col + = dict_table_get_nth_col(ctx->old_table, + innodb_col_no(ai)); + dict_index_t* index + = dict_table_get_first_index(ctx->old_table); + while (index != NULL + && index->fields[0].col != autoinc_col) { + index = dict_table_get_next_index(index); + } + + ut_ad(index); + + ib_uint64_t max_in_table = index + ? row_search_max_autoinc(index) + : 0; + + if (autoinc <= max_in_table) { + ctx->new_table->autoinc = innobase_next_autoinc( + max_in_table, 1, + ctx->prebuilt->autoinc_increment, + ctx->prebuilt->autoinc_offset, + innobase_get_int_col_max_value(ai)); + /* Persist the maximum value as the + last used one. */ + autoinc = max_in_table; + } else { + /* Persist the predecessor of the + AUTO_INCREMENT value as the last used one. */ + ctx->new_table->autoinc = autoinc--; + } + } + + btr_write_autoinc(dict_table_get_first_index(ctx->new_table), + autoinc, true); + } else if (ctx->need_rebuild()) { + /* No AUTO_INCREMENT value was specified. + Copy it from the old table. */ + ctx->new_table->autoinc = ctx->old_table->autoinc; + /* The persistent value was already copied in + prepare_inplace_alter_table_dict() when ctx->new_table + was created. If this was a LOCK=NONE operation, the + AUTO_INCREMENT values would be updated during + row_log_table_apply(). If this was LOCK!=NONE, + the table contents could not possibly have changed + between prepare_inplace and commit_inplace. */ } - DBUG_RETURN(max_autoinc); + DBUG_VOID_RETURN; } /** Add or drop foreign key constraints to the data dictionary tables, @@ -7711,7 +7592,7 @@ innobase_update_foreign_try( names, while the columns in ctx->old_table have not been renamed yet. */ error = dict_create_add_foreign_to_dictionary( - (dict_table_t*)ctx->old_table,ctx->old_table->name.m_name, fk, trx); + ctx->old_table->name.m_name, fk, trx); DBUG_EXECUTE_IF( "innodb_test_cannot_add_fk_system", @@ -8227,7 +8108,6 @@ commit_try_norebuild( } #endif /* MYSQL_RENAME_INDEX */ -#ifdef MYSQL_VIRTUAL_COLUMNS if ((ha_alter_info->handler_flags & Alter_inplace_info::DROP_VIRTUAL_COLUMN) && innobase_drop_virtual_try( @@ -8243,7 +8123,6 @@ commit_try_norebuild( ctx->old_table, trx)) { DBUG_RETURN(true); } -#endif /* MYSQL_VIRTUAL_COLUMNS */ DBUG_RETURN(false); } @@ -8729,8 +8608,7 @@ ha_innobase::commit_inplace_alter_table( DBUG_ASSERT(new_clustered == ctx->need_rebuild()); - ctx->max_autoinc = commit_get_autoinc( - ha_alter_info, ctx, altered_table, table); + commit_set_autoinc(ha_alter_info, ctx, altered_table, table); if (ctx->need_rebuild()) { ctx->tmp_name = dict_mem_create_temporary_tablename( @@ -9068,14 +8946,6 @@ foreign_fail: (*pctx); DBUG_ASSERT(ctx->need_rebuild() == new_clustered); - if (altered_table->found_next_number_field) { - dict_table_t* t = ctx->new_table; - - dict_table_autoinc_lock(t); - dict_table_autoinc_initialize(t, ctx->max_autoinc); - dict_table_autoinc_unlock(t); - } - bool add_fts = false; /* Publish the created fulltext index, if any. diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 011c46525b9..4a13faa480f 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -9406,11 +9406,8 @@ i_s_innodb_mutexes_fill_table( TABLE_LIST* tables, /*!< in/out: tables to fill */ Item* ) /*!< in: condition (not used) */ { - ib_mutex_t* mutex; rw_lock_t* lock; - ulint block_mutex_oswait_count = 0; ulint block_lock_oswait_count = 0; - ib_mutex_t* block_mutex = NULL; rw_lock_t* block_lock = NULL; Field** fields = tables->table->field; @@ -9425,6 +9422,9 @@ i_s_innodb_mutexes_fill_table( // mutex_enter(&mutex_list_mutex); #ifdef JAN_TODO_FIXME + ib_mutex_t* mutex; + ulint block_mutex_oswait_count = 0; + ib_mutex_t* block_mutex = NULL; for (mutex = UT_LIST_GET_FIRST(os_mutex_list); mutex != NULL; mutex = UT_LIST_GET_NEXT(list, mutex)) { if (mutex->count_os_wait == 0) { @@ -9845,147 +9845,3 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_semaphore_waits = STRUCT_FLD(version_info, INNODB_VERSION_STR), STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; - -/** Fill handlerton based INFORMATION_SCHEMA.FILES table. -@param[in,out] thd thread/connection descriptor -@param[in,out] tables information schema tables to fill -@retval 0 for success -@retval HA_ERR_OUT_OF_MEM when running out of memory -@return nonzero for failure */ -int -i_s_files_table_fill( - THD* thd, - TABLE_LIST* tables) -{ - TABLE* table_to_fill = tables->table; - Field** fields = table_to_fill->field; - /* Use this class so that if the OK() macro returns, - fil_space_release() is called. */ - FilSpace space; - - DBUG_ENTER("i_s_files_table_fill"); - - /* Gather information reportable to information_schema.files - for the first or next file in fil_system. */ - for (const fil_node_t* node = fil_node_next(NULL); - node != NULL; - node = fil_node_next(node)) { - const char* type = "TABLESPACE"; - const char* space_name; - /** Buffer to build file-per-table tablespace names. - Even though a space_id is often stored in a ulint, it cannot - be larger than 1<<32-1, which is 10 numeric characters. */ - char file_per_table_name[ - sizeof("innodb_file_per_table_1234567890")]; - uintmax_t avail_space; - ulint extent_pages; - ulint extend_pages; - - space = node->space; - fil_type_t purpose = space()->purpose; - - switch (purpose) { - case FIL_TYPE_LOG: - /* Do not report REDO LOGs to I_S.FILES */ - space = NULL; - continue; - case FIL_TYPE_TABLESPACE: - if (!is_system_tablespace(space()->id) - && space()->id <= srv_undo_tablespaces_open) { - type = "UNDO LOG"; - break; - } /* else fall through for TABLESPACE */ - case FIL_TYPE_IMPORT: - /* 'IMPORTING'is a status. The type is TABLESPACE. */ - break; - case FIL_TYPE_TEMPORARY: - type = "TEMPORARY"; - break; - }; - - page_size_t page_size(space()->flags); - - /* Single-table tablespaces are assigned to a schema. */ - if (!is_predefined_tablespace(space()->id) - && !FSP_FLAGS_GET_SHARED(space()->flags)) { - /* Their names will be like "test/t1" */ - ut_ad(NULL != strchr(space()->name, '/')); - - /* File-per-table tablespace names are generated - internally and certain non-file-system-allowed - characters are expanded which can make the space - name too long. In order to avoid that problem, - use a modified tablespace name. - Since we are not returning dbname and tablename, - the user must match the space_id to i_s_table.space - in order find the single table that is in it or the - schema it belongs to. */ - ut_snprintf( - file_per_table_name, - sizeof(file_per_table_name), - "innodb_file_per_table_" ULINTPF, - space()->id); - space_name = file_per_table_name; - } else { - /* Only file-per-table space names contain '/'. - This is not file-per-table . */ - ut_ad(NULL == strchr(space()->name, '/')); - - space_name = space()->name; - } - - init_fill_schema_files_row(table_to_fill); - - OK(field_store_ulint(fields[IS_FILES_FILE_ID], - space()->id)); - OK(field_store_string(fields[IS_FILES_FILE_NAME], - node->name)); - OK(field_store_string(fields[IS_FILES_FILE_TYPE], - type)); - OK(field_store_string(fields[IS_FILES_TABLESPACE_NAME], - space_name)); - OK(field_store_string(fields[IS_FILES_ENGINE], - "InnoDB")); - OK(field_store_ulint(fields[IS_FILES_FREE_EXTENTS], - space()->free_len)); - - extent_pages = fsp_get_extent_size_in_pages(page_size); - - OK(field_store_ulint(fields[IS_FILES_TOTAL_EXTENTS], - space()->size_in_header / extent_pages)); - OK(field_store_ulint(fields[IS_FILES_EXTENT_SIZE], - extent_pages * page_size.physical())); - OK(field_store_ulint(fields[IS_FILES_INITIAL_SIZE], - node->init_size * page_size.physical())); - - if (node->max_size >= ULINT_MAX) { - fields[IS_FILES_MAXIMUM_SIZE]->set_null(); - } else { - OK(field_store_ulint(fields[IS_FILES_MAXIMUM_SIZE], - node->max_size * page_size.physical())); - } - if (space()->id == srv_sys_space.space_id()) { - extend_pages = srv_sys_space.get_increment(); - } else if (space()->id == srv_tmp_space.space_id()) { - extend_pages = srv_tmp_space.get_increment(); - } else { - extend_pages = fsp_get_pages_to_extend_ibd( - page_size, node->size); - } - - OK(field_store_ulint(fields[IS_FILES_AUTOEXTEND_SIZE], - extend_pages * page_size.physical())); - - avail_space = fsp_get_available_space_in_free_extents(space()); - OK(field_store_ulint(fields[IS_FILES_DATA_FREE], - static_cast(avail_space * 1024))); - OK(field_store_string(fields[IS_FILES_STATUS], - (purpose == FIL_TYPE_IMPORT) - ? "IMPORTING" : "NORMAL")); - - schema_table_store_record(thd, table_to_fill); - space = NULL; - } - - DBUG_RETURN(0); -} diff --git a/storage/innobase/handler/i_s.h b/storage/innobase/handler/i_s.h index eb076ec802e..d272490dd27 100644 --- a/storage/innobase/handler/i_s.h +++ b/storage/innobase/handler/i_s.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyrigth (c) 2014, 2015, MariaDB Corporation +Copyrigth (c) 2014, 2016, MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -66,17 +66,6 @@ extern struct st_maria_plugin i_s_innodb_tablespaces_encryption; extern struct st_maria_plugin i_s_innodb_tablespaces_scrubbing; extern struct st_maria_plugin i_s_innodb_sys_semaphore_waits; -/** Fill handlerton based INFORMATION_SCHEMA.FILES table. -@param[in,out] thd thread/connection descriptor -@param[in,out] tables information schema tables to fill -@retval 0 for success -@retval HA_ERR_OUT_OF_MEM when running out of memory -@return nonzero for failure */ -int -i_s_files_table_fill( - THD *thd, - TABLE_LIST *tables); - /** maximum number of buffer page info we would cache. */ #define MAX_BUF_INFO_CACHED 10000 diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index 71aa7be3ef7..612a2f9a690 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -46,8 +46,6 @@ my_bool srv_ibuf_disable_background_merge; #include "ibuf0ibuf.ic" #endif -#ifndef UNIV_HOTBACKUP - #include "buf0buf.h" #include "buf0rea.h" #include "fsp0fsp.h" @@ -595,7 +593,6 @@ ibuf_max_size_update( } -#endif /* !UNIV_HOTBACKUP */ /*********************************************************************//** Initializes an ibuf bitmap page. */ void @@ -618,10 +615,7 @@ ibuf_bitmap_page_init( memset(page + IBUF_BITMAP, 0, byte_offset); /* The remaining area (up to the page trailer) is uninitialized. */ - -#ifndef UNIV_HOTBACKUP mlog_write_initial_log_record(page, MLOG_IBUF_BITMAP_INIT, mtr); -#endif /* !UNIV_HOTBACKUP */ } /*********************************************************************//** @@ -644,7 +638,7 @@ ibuf_parse_bitmap_init( return(ptr); } -#ifndef UNIV_HOTBACKUP + # ifdef UNIV_DEBUG /** Gets the desired bits for a given page from a bitmap page. @param[in] page bitmap page @@ -862,11 +856,17 @@ ibuf_set_free_bits_low( mtr_t* mtr) /*!< in/out: mtr */ { page_t* bitmap_page; + buf_frame_t* frame; ut_ad(mtr->is_named_space(block->page.id.space())); - if (!page_is_leaf(buf_block_get_frame(block))) { + if (!block) { + return; + } + frame = buf_block_get_frame(block); + + if (!frame || !page_is_leaf(frame)) { return; } @@ -1040,7 +1040,10 @@ ibuf_update_free_bits_zip( page_t* bitmap_page; ulint after; - ut_a(page_is_leaf(buf_block_get_frame(block))); + ut_a(block); + buf_frame_t* frame = buf_block_get_frame(block); + ut_a(frame); + ut_a(page_is_leaf(frame)); ut_a(block->page.size.is_compressed()); bitmap_page = ibuf_bitmap_get_map_page(block->page.id, @@ -1447,7 +1450,7 @@ ibuf_add_ops( ulint i; for (i = 0; i < IBUF_OP_COUNT; i++) { - os_atomic_increment_ulint(&arr[i], ops[i]); + my_atomic_addlint(&arr[i], ops[i]); } } @@ -2745,8 +2748,6 @@ ibuf_merge_in_background( } #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ - - while (sum_pages < n_pages) { ulint n_bytes; @@ -3727,9 +3728,10 @@ ibuf_insert( op, page_id.space(), page_id.page_no())); ut_ad(dtuple_check_typed(entry)); - ut_ad(page_id.space() != srv_tmp_space.space_id()); + ut_ad(page_id.space() != SRV_TMP_SPACE_ID); ut_a(!dict_index_is_clust(index)); + ut_ad(!dict_table_is_temporary(index->table)); no_counter = use <= IBUF_USE_INSERT; @@ -4788,7 +4790,7 @@ reset_bit: btr_pcur_close(&pcur); mem_heap_free(heap); - os_atomic_increment_ulint(&ibuf->n_merges, 1); + my_atomic_addlint(&ibuf->n_merges, 1); ibuf_add_ops(ibuf->n_merged_ops, mops); ibuf_add_ops(ibuf->n_discarded_ops, dops); if (space != NULL) { @@ -5122,5 +5124,3 @@ ibuf_set_bitmap_for_bulk_load( mtr_commit(&mtr); } - -#endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h index c177f23824f..419c5db657d 100644 --- a/storage/innobase/include/btr0btr.h +++ b/storage/innobase/include/btr0btr.h @@ -2,7 +2,7 @@ Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2014, 2015, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2014, 2016, MariaDB Corporation. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -37,7 +37,6 @@ Created 6/2/1994 Heikki Tuuri #include "btr0types.h" #include "gis0type.h" -#ifndef UNIV_HOTBACKUP /** Maximum record size which can be stored on a page, without using the special big record storage structure */ #define BTR_PAGE_MAX_REC_SIZE (UNIV_PAGE_SIZE / 2 - 200) @@ -140,7 +139,6 @@ record is in spatial index */ ((latch_mode) & ~(BTR_LATCH_FOR_INSERT \ | BTR_LATCH_FOR_DELETE \ | BTR_MODIFY_EXTERNAL)) -#endif /* UNIV_HOTBACKUP */ /**************************************************************//** Report that an index page is corrupted. */ @@ -161,7 +159,6 @@ btr_corruption_report( ut_error; \ } -#ifndef UNIV_HOTBACKUP /**************************************************************//** Gets the root node of a tree and sx-latches it for segment access. @return root page, sx-latched */ @@ -242,10 +239,16 @@ btr_block_get_func( @param index index tree, may be NULL if not the insert buffer tree @param mtr mini-transaction handle @return the uncompressed page frame */ -# define btr_page_get(page_id, page_size, mode, index, mtr) \ - buf_block_get_frame(btr_block_get(page_id, page_size, \ - mode, index, mtr)) -#endif /* !UNIV_HOTBACKUP */ +UNIV_INLINE +page_t* +btr_page_get( +/*=========*/ + const page_id_t& page_id, + const page_size_t& page_size, + ulint mode, + dict_index_t* index, + mtr_t* mtr) + MY_ATTRIBUTE((warn_unused_result)); /**************************************************************//** Gets the index id field of a page. @return index id */ @@ -255,7 +258,6 @@ btr_page_get_index_id( /*==================*/ const page_t* page) /*!< in: index page */ MY_ATTRIBUTE((warn_unused_result)); -#ifndef UNIV_HOTBACKUP /********************************************************//** Gets the node level field in an index page. @return level, leaf level == 0 */ @@ -353,6 +355,34 @@ btr_free( const page_id_t& page_id, const page_size_t& page_size); +/** Read the last used AUTO_INCREMENT value from PAGE_ROOT_AUTO_INC. +@param[in,out] index clustered index +@return the last used AUTO_INCREMENT value +@retval 0 on error or if no AUTO_INCREMENT value was used yet */ +ib_uint64_t +btr_read_autoinc(dict_index_t* index) + MY_ATTRIBUTE((nonnull, warn_unused_result)); + +/** Read the last used AUTO_INCREMENT value from PAGE_ROOT_AUTO_INC, +or fall back to MAX(auto_increment_column). +@param[in] table table containing an AUTO_INCREMENT column +@param[in] col_no index of the AUTO_INCREMENT column +@return the AUTO_INCREMENT value +@retval 0 on error or if no AUTO_INCREMENT value was used yet */ +ib_uint64_t +btr_read_autoinc_with_fallback(const dict_table_t* table, unsigned col_no) + MY_ATTRIBUTE((nonnull, warn_unused_result)); + +/** Write the next available AUTO_INCREMENT value to PAGE_ROOT_AUTO_INC. +@param[in,out] index clustered index +@param[in] autoinc the AUTO_INCREMENT value +@param[in] reset whether to reset the AUTO_INCREMENT + to a possibly smaller value than currently + exists in the page */ +void +btr_write_autoinc(dict_index_t* index, ib_uint64_t autoinc, bool reset = false) + MY_ATTRIBUTE((nonnull)); + /*************************************************************//** Makes tree one level higher by splitting the root, and inserts the tuple. It is assumed that mtr contains an x-latch on the tree. @@ -479,9 +509,8 @@ btr_insert_on_non_leaf_level_func( const char* file, /*!< in: file name */ ulint line, /*!< in: line where called */ mtr_t* mtr); /*!< in: mtr */ -# define btr_insert_on_non_leaf_level(f,i,l,t,m) \ +#define btr_insert_on_non_leaf_level(f,i,l,t,m) \ btr_insert_on_non_leaf_level_func(f,i,l,t,__FILE__,__LINE__,m) -#endif /* !UNIV_HOTBACKUP */ /****************************************************************//** Sets a record as the predefined minimum record. */ void @@ -490,7 +519,6 @@ btr_set_min_rec_mark( rec_t* rec, /*!< in/out: record */ mtr_t* mtr) /*!< in: mtr */ MY_ATTRIBUTE((nonnull)); -#ifndef UNIV_HOTBACKUP /*************************************************************//** Deletes on the upper level the node pointer to a page. */ void @@ -543,7 +571,6 @@ btr_discard_page( btr_cur_t* cursor, /*!< in: cursor on the page to discard: not on the root page */ mtr_t* mtr); /*!< in: mtr */ -#endif /* !UNIV_HOTBACKUP */ /****************************************************************//** Parses the redo log record for setting an index record as the predefined minimum record. @@ -570,7 +597,6 @@ btr_parse_page_reorganize( buf_block_t* block, /*!< in: page to be reorganized, or NULL */ mtr_t* mtr) /*!< in: mtr or NULL */ MY_ATTRIBUTE((warn_unused_result)); -#ifndef UNIV_HOTBACKUP /**************************************************************//** Gets the number of pages in a B-tree. @return number of pages, or ULINT_UNDEFINED if the index is unavailable */ @@ -771,7 +797,6 @@ btr_lift_page_up( #define BTR_N_LEAF_PAGES 1 #define BTR_TOTAL_SIZE 2 -#endif /* !UNIV_HOTBACKUP */ #ifndef UNIV_NONINL #include "btr0btr.ic" diff --git a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0btr.ic index 58a0c6755b1..810ac8f8b67 100644 --- a/storage/innobase/include/btr0btr.ic +++ b/storage/innobase/include/btr0btr.ic @@ -25,7 +25,6 @@ Created 6/2/1994 Heikki Tuuri *******************************************************/ #include "mach0data.h" -#ifndef UNIV_HOTBACKUP #include "mtr0mtr.h" #include "mtr0log.h" #include "page0zip.h" @@ -63,7 +62,9 @@ btr_block_get_func( page_id, page_size, mode, NULL, BUF_GET, file, line, mtr, &err); if (err == DB_DECRYPTION_FAILED) { - index->table->is_encrypted = true; + if (index && index->table) { + index->table->is_encrypted = true; + } } if (block) { @@ -99,7 +100,36 @@ btr_page_set_index_id( mlog_write_ull(page + (PAGE_HEADER + PAGE_INDEX_ID), id, mtr); } } -#endif /* !UNIV_HOTBACKUP */ + +/** Gets a buffer page and declares its latching order level. +@param space tablespace identifier +@param zip_size compressed page size in bytes or 0 for uncompressed pages +@param page_no page number +@param mode latch mode +@param idx index tree, may be NULL if not the insert buffer tree +@param mtr mini-transaction handle +@return the uncompressed page frame */ +UNIV_INLINE +page_t* +btr_page_get( +/*=========*/ + const page_id_t& page_id, + const page_size_t& page_size, + ulint mode, + dict_index_t* index, + mtr_t* mtr) +{ + buf_block_t* block=NULL; + buf_frame_t* frame=NULL; + + block = btr_block_get(page_id, page_size, mode, index, mtr); + + if (block) { + frame = buf_block_get_frame(block); + } + + return ((page_t*)frame); +} /**************************************************************//** Gets the index id field of a page. @@ -113,7 +143,6 @@ btr_page_get_index_id( return(mach_read_from_8(page + PAGE_HEADER + PAGE_INDEX_ID)); } -#ifndef UNIV_HOTBACKUP /********************************************************//** Gets the node level field in an index page. @return level, leaf level == 0 */ @@ -306,4 +335,3 @@ btr_leaf_page_release( mtr->memo_release(block, mode); } -#endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index f582f04733c..a1e37ec46d0 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -60,7 +60,6 @@ struct btr_latch_leaves_t { ulint savepoints[3]; }; -#ifndef UNIV_HOTBACKUP #include "que0types.h" #include "row0types.h" #include "ha0ha.h" @@ -190,38 +189,10 @@ btr_cur_search_to_nth_level( RW_S_LATCH, or 0 */ const char* file, /*!< in: file name */ ulint line, /*!< in: line where called */ - mtr_t* mtr); /*!< in: mtr */ - -/** Searches an index tree and positions a tree cursor on a given level. -This function will avoid placing latches the travesal path and so -should be used only for cases where-in latching is not needed. - -@param[in] index index -@param[in] level the tree level of search -@param[in] tuple data tuple; Note: n_fields_cmp in compared - to the node ptr page node field -@param[in] mode PAGE_CUR_L, .... - Insert should always be made using PAGE_CUR_LE - to search the position. -@param[in,out] cursor tree cursor; points to record of interest. -@param[in] file file name -@param[in[ line line where called from -@param[in,out] mtr mtr -@param[in] mark_dirty - if true then mark the block as dirty -@return DB_SUCCESS or error code */ -dberr_t -btr_cur_search_to_nth_level_with_no_latch( - dict_index_t* index, - ulint level, - const dtuple_t* tuple, - page_cur_mode_t mode, - btr_cur_t* cursor, - const char* file, - ulint line, - mtr_t* mtr, - bool mark_dirty = true) - __attribute__((warn_unused_result)); + mtr_t* mtr, /*!< in/out: mini-transaction */ + ib_uint64_t autoinc = 0); + /*!< in: PAGE_ROOT_AUTO_INC to be written + (0 if none) */ /*****************************************************************//** Opens a cursor at either end of an index. @@ -244,35 +215,6 @@ btr_cur_open_at_index_side_func( #define btr_cur_open_at_index_side(f,i,l,c,lv,m) \ btr_cur_open_at_index_side_func(f,i,l,c,lv,__FILE__,__LINE__,m) -/** Opens a cursor at either end of an index. -Avoid taking latches on buffer, just pin (by incrementing fix_count) -to keep them in buffer pool. This mode is used by intrinsic table -as they are not shared and so there is no need of latching. -@param[in] from_left true if open to low end, false if open - to high end. -@param[in] index index -@param[in] latch_mode latch mode -@param[in,out] cursor cursor -@param[in] file file name -@param[in] line line where called -@param[in,out] mtr mini transaction -@return DB_SUCCESS or error code -*/ -dberr_t -btr_cur_open_at_index_side_with_no_latch_func( - bool from_left, - dict_index_t* index, - btr_cur_t* cursor, - ulint level, - const char* file, - ulint line, - mtr_t* mtr) - __attribute__((warn_unused_result)); - -#define btr_cur_open_at_index_side_with_no_latch(f,i,c,lv,m) \ - btr_cur_open_at_index_side_with_no_latch_func( \ - f,i,c,lv,__FILE__,__LINE__,m) - /**********************************************************************//** Positions a cursor at a randomly chosen position within a B-tree. @return true if the index is available and we have put the cursor, false @@ -587,7 +529,6 @@ btr_cur_pessimistic_delete( bool rollback,/*!< in: performing rollback? */ mtr_t* mtr) /*!< in: mtr */ MY_ATTRIBUTE((nonnull)); -#endif /* !UNIV_HOTBACKUP */ /***********************************************************//** Parses a redo log record of updating a record in-place. @return end of log record or NULL */ @@ -622,7 +563,6 @@ btr_cur_parse_del_mark_set_sec_rec( byte* end_ptr,/*!< in: buffer end */ page_t* page, /*!< in/out: page or NULL */ page_zip_des_t* page_zip);/*!< in/out: compressed page, or NULL */ -#ifndef UNIV_HOTBACKUP /** Estimates the number of rows in a given index range. @param[in] index index @@ -998,7 +938,6 @@ btr_rec_set_deleted_flag( page_zip_des_t* page_zip,/*!< in/out: compressed page (or NULL) */ ulint flag); /*!< in: nonzero if delete marked */ - /** If pessimistic delete fails because of lack of file space, there is still a good change of success a little later. Try this many times. */ @@ -1052,7 +991,6 @@ extern ulint btr_cur_n_non_sea_old; srv_refresh_innodb_monitor_stats(). Referenced by srv_printf_innodb_monitor(). */ extern ulint btr_cur_n_sea_old; -#endif /* !UNIV_HOTBACKUP */ #ifdef UNIV_DEBUG /* Flag to limit optimistic insert records */ diff --git a/storage/innobase/include/btr0cur.ic b/storage/innobase/include/btr0cur.ic index 45c0d59a8aa..b1e59651a1d 100644 --- a/storage/innobase/include/btr0cur.ic +++ b/storage/innobase/include/btr0cur.ic @@ -23,7 +23,6 @@ The index tree cursor Created 10/16/1994 Heikki Tuuri *******************************************************/ -#ifndef UNIV_HOTBACKUP #include "btr0btr.h" #ifdef UNIV_DEBUG @@ -231,5 +230,3 @@ btr_rec_set_deleted_flag( rec_set_deleted_flag_old(rec, flag); } } - -#endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/include/btr0defragment.h b/storage/innobase/include/btr0defragment.h index 6257c4bc996..21ba6d9f426 100644 --- a/storage/innobase/include/btr0defragment.h +++ b/storage/innobase/include/btr0defragment.h @@ -20,10 +20,6 @@ this program; if not, write to the Free Software Foundation, Inc., #ifndef btr0defragment_h #define btr0defragment_h -#include "univ.i" - -#ifndef UNIV_HOTBACKUP - #include "btr0pcur.h" /* Max number of pages to consider at once during defragmentation. */ @@ -98,7 +94,4 @@ DECLARE_THREAD(btr_defragment_thread)( /*==========================================*/ void* arg); /*!< in: a dummy parameter required by os_thread_create */ - - -#endif /* !UNIV_HOTBACKUP */ #endif diff --git a/storage/innobase/include/btr0pcur.h b/storage/innobase/include/btr0pcur.h index 02f4faf24a5..947316f0e4d 100644 --- a/storage/innobase/include/btr0pcur.h +++ b/storage/innobase/include/btr0pcur.h @@ -114,9 +114,11 @@ btr_pcur_open_low( btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */ const char* file, /*!< in: file name */ ulint line, /*!< in: line where called */ + ib_uint64_t autoinc,/*!< in: PAGE_ROOT_AUTO_INC to be written + (0 if none) */ mtr_t* mtr); /*!< in: mtr */ #define btr_pcur_open(i,t,md,l,c,m) \ - btr_pcur_open_low(i,0,t,md,l,c,__FILE__,__LINE__,m) + btr_pcur_open_low(i,0,t,md,l,c,__FILE__,__LINE__,0,m) /**************************************************************//** Opens an persistent cursor to an index tree without initializing the cursor. */ diff --git a/storage/innobase/include/btr0pcur.ic b/storage/innobase/include/btr0pcur.ic index 6cd968b4682..60790bc1316 100644 --- a/storage/innobase/include/btr0pcur.ic +++ b/storage/innobase/include/btr0pcur.ic @@ -434,6 +434,8 @@ btr_pcur_open_low( btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */ const char* file, /*!< in: file name */ ulint line, /*!< in: line where called */ + ib_uint64_t autoinc,/*!< in: PAGE_ROOT_AUTO_INC to be written + (0 if none) */ mtr_t* mtr) /*!< in: mtr */ { btr_cur_t* btr_cursor; @@ -452,20 +454,9 @@ btr_pcur_open_low( ut_ad(!dict_index_is_spatial(index)); - if (dict_table_is_intrinsic(index->table)) { - ut_ad((latch_mode & BTR_MODIFY_LEAF) - || (latch_mode & BTR_SEARCH_LEAF) - || (latch_mode & BTR_MODIFY_TREE)); - err = btr_cur_search_to_nth_level_with_no_latch( - index, level, tuple, mode, btr_cursor, - file, line, mtr, - (((latch_mode & BTR_MODIFY_LEAF) - || (latch_mode & BTR_MODIFY_TREE)) ? true : false)); - } else { - err = btr_cur_search_to_nth_level( - index, level, tuple, mode, latch_mode, - btr_cursor, 0, file, line, mtr); - } + err = btr_cur_search_to_nth_level( + index, level, tuple, mode, latch_mode, + btr_cursor, 0, file, line, mtr, autoinc); if (err != DB_SUCCESS) { ib::warn() << " Error code: " << err @@ -521,18 +512,9 @@ btr_pcur_open_with_no_init_func( btr_cursor = btr_pcur_get_btr_cur(cursor); - if (dict_table_is_intrinsic(index->table)) { - ut_ad((latch_mode & BTR_MODIFY_LEAF) - || (latch_mode & BTR_SEARCH_LEAF)); - err = btr_cur_search_to_nth_level_with_no_latch( - index, 0, tuple, mode, btr_cursor, - file, line, mtr, - ((latch_mode & BTR_MODIFY_LEAF) ? true : false)); - } else { - err = btr_cur_search_to_nth_level( - index, 0, tuple, mode, latch_mode, btr_cursor, - has_search_latch, file, line, mtr); - } + err = btr_cur_search_to_nth_level( + index, 0, tuple, mode, latch_mode, btr_cursor, + has_search_latch, file, line, mtr); cursor->pos_state = BTR_PCUR_IS_POSITIONED; @@ -568,15 +550,9 @@ btr_pcur_open_at_index_side( btr_pcur_init(pcur); } - if (dict_table_is_intrinsic(index->table)) { - err = btr_cur_open_at_index_side_with_no_latch( - from_left, index, - btr_pcur_get_btr_cur(pcur), level, mtr); - } else { - err = btr_cur_open_at_index_side( - from_left, index, latch_mode, - btr_pcur_get_btr_cur(pcur), level, mtr); - } + err = btr_cur_open_at_index_side( + from_left, index, latch_mode, + btr_pcur_get_btr_cur(pcur), level, mtr); pcur->pos_state = BTR_PCUR_IS_POSITIONED; pcur->old_stored = false; diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index c4bc107044d..e1c92c130c4 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -27,6 +27,9 @@ Created 11/5/1995 Heikki Tuuri #ifndef buf0buf_h #define buf0buf_h +/** Magic value to use instead of checksums when they are disabled */ +#define BUF_NO_CHECKSUM_MAGIC 0xDEADBEEFUL + #include "univ.i" #include "fil0fil.h" #include "mtr0types.h" @@ -35,7 +38,6 @@ Created 11/5/1995 Heikki Tuuri #include "hash0hash.h" #include "ut0byte.h" #include "page0types.h" -#ifndef UNIV_HOTBACKUP #include "ut0rbt.h" #include "os0proc.h" #include "log0log.h" @@ -99,20 +101,11 @@ extern volatile ulint buf_withdraw_clock; /*!< the clock is incremented every time a pointer to a page may become obsolete */ -#ifdef UNIV_DEBUG +# ifdef UNIV_DEBUG extern my_bool buf_disable_resize_buffer_pool_debug; /*!< if TRUE, resizing buffer pool is not allowed. */ -#endif /* UNIV_DEBUG */ -#else /* !UNIV_HOTBACKUP */ -extern buf_block_t* back_block1; /*!< first block, for --apply-log */ -extern buf_block_t* back_block2; /*!< second block, for page reorganize */ -#endif /* !UNIV_HOTBACKUP */ -#endif /* !UNIV_INNOCHECKSUM */ +# endif /* UNIV_DEBUG */ -/** Magic value to use instead of checksums when they are disabled */ -#define BUF_NO_CHECKSUM_MAGIC 0xDEADBEEFUL - -#ifndef UNIV_INNOCHECKSUM /** @brief States of a control block @see buf_page_t @@ -341,7 +334,6 @@ operator<<( std::ostream& out, const page_id_t& page_id); -#ifndef UNIV_HOTBACKUP /********************************************************************//** Acquire mutex on all buffer pool instances */ UNIV_INLINE @@ -468,7 +460,7 @@ void buf_block_free( /*===========*/ buf_block_t* block); /*!< in, own: block to be freed */ -#endif /* !UNIV_HOTBACKUP */ + /*********************************************************************//** Copies contents of a buffer frame to a given buffer. @return buf */ @@ -478,7 +470,7 @@ buf_frame_copy( /*===========*/ byte* buf, /*!< in: buffer to copy to */ const buf_frame_t* frame); /*!< in: buffer frame */ -#ifndef UNIV_HOTBACKUP + /**************************************************************//** NOTE! The following macros should be used instead of buf_page_get_gen, to improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed @@ -570,9 +562,6 @@ BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH @param[in] line line where called @param[in] mtr mini-transaction @param[out] err DB_SUCCESS or error code -@param[in] dirty_with_no_latch - mark page as dirty even if page - is being pinned without any latch @return pointer to the block or NULL */ buf_block_t* buf_page_get_gen( @@ -584,8 +573,7 @@ buf_page_get_gen( const char* file, ulint line, mtr_t* mtr, - dberr_t* err, - bool dirty_with_no_latch = false); + dberr_t* err); /** Initializes a page to the buffer buf_pool. The page is usually not read from a file even if it cannot be found in the buffer buf_pool. This is one @@ -601,21 +589,6 @@ buf_page_create( const page_size_t& page_size, mtr_t* mtr); -#else /* !UNIV_HOTBACKUP */ - -/** Inits a page to the buffer buf_pool, for use in mysqlbackup --restore. -@param[in] page_id page id -@param[in] page_size page size -@param[in,out] block block to init */ -void -buf_page_init_for_backup_restore( - const page_id_t& page_id, - const page_size_t& page_size, - buf_block_t* block); - -#endif /* !UNIV_HOTBACKUP */ - -#ifndef UNIV_HOTBACKUP /********************************************************************//** Releases a compressed-only page acquired with buf_page_get_zip(). */ UNIV_INLINE @@ -792,17 +765,14 @@ buf_block_unfix( @param[in,out] b block to bufferfix @param[in] f file name where requested @param[in] l line number where requested */ -# define buf_block_buf_fix_inc(b,f,l) buf_block_buf_fix_inc_func(f,l,b) +# define buf_block_buf_fix_inc(b,f,l) buf_block_buf_fix_inc_func(f,l,b) # else /* UNIV_DEBUG */ /** Increments the bufferfix count. @param[in,out] b block to bufferfix @param[in] f file name where requested @param[in] l line number where requested */ -# define buf_block_buf_fix_inc(b,f,l) buf_block_buf_fix_inc_func(b) +# define buf_block_buf_fix_inc(b,f,l) buf_block_buf_fix_inc_func(b) # endif /* UNIV_DEBUG */ -#else /* !UNIV_HOTBACKUP */ -# define buf_block_modify_clock_inc(block) ((void) 0) -#endif /* !UNIV_HOTBACKUP */ #endif /* !UNIV_INNOCHECKSUM */ /** Checks if a page contains only zeroes. @@ -839,7 +809,6 @@ buf_page_is_corrupted( #endif /* UNIV_INNOCHECKSUM */ ) MY_ATTRIBUTE((warn_unused_result)); #ifndef UNIV_INNOCHECKSUM -#ifndef UNIV_HOTBACKUP /**********************************************************************//** Gets the space id, page offset, and byte offset within page of a pointer pointing to a buffer frame containing a file page. */ @@ -897,7 +866,7 @@ void buf_print(void); /*============*/ #endif /* UNIV_DEBUG_PRINT || UNIV_DEBUG || UNIV_BUF_DEBUG */ -#endif /* !UNIV_HOTBACKUP */ + enum buf_page_print_flags { /** Do not crash at the end of buf_page_print(). */ BUF_PAGE_PRINT_NO_CRASH = 1, @@ -924,7 +893,7 @@ buf_zip_decompress( /*===============*/ buf_block_t* block, /*!< in/out: block */ ibool check); /*!< in: TRUE=verify the page checksum */ -#ifndef UNIV_HOTBACKUP + #ifdef UNIV_DEBUG /*********************************************************************//** Returns the number of latched pages in the buffer pool. @@ -994,7 +963,6 @@ this function is called: not latched and not modified. */ void buf_pool_invalidate(void); /*=====================*/ -#endif /* !UNIV_HOTBACKUP */ /*======================================================================== --------------------------- LOWER LEVEL ROUTINES ------------------------- @@ -1067,7 +1035,7 @@ buf_page_in_file( /*=============*/ const buf_page_t* bpage) /*!< in: pointer to control block */ MY_ATTRIBUTE((warn_unused_result)); -#ifndef UNIV_HOTBACKUP + /*********************************************************************//** Determines if a block should be on unzip_LRU list. @return TRUE if block belongs to unzip_LRU */ @@ -1225,7 +1193,7 @@ buf_page_get_block( /*===============*/ buf_page_t* bpage) /*!< in: control block, or NULL */ MY_ATTRIBUTE((warn_unused_result)); -#endif /* !UNIV_HOTBACKUP */ + #ifdef UNIV_DEBUG /*********************************************************************//** Gets a pointer to the memory frame of a block. @@ -1245,7 +1213,6 @@ Gets the compressed page descriptor corresponding to an uncompressed page if applicable. */ #define buf_block_get_page_zip(block) \ ((block)->page.zip.data ? &(block)->page.zip : NULL) -#ifndef UNIV_HOTBACKUP /** Get a buffer block from an adaptive hash index pointer. This function does not return if the block is not identified. @@ -1429,13 +1396,6 @@ buf_page_hash_get_low() function. #define buf_block_hash_get(b, page_id) \ buf_block_hash_get_locked(b, page_id, NULL, 0) -/*********************************************************************//** -Gets the current length of the free list of buffer blocks. -@return length of the free list */ -ulint -buf_get_free_list_len(void); -/*=======================*/ - /********************************************************************//** Determine if a block is a sentinel for a buffer pool watch. @return TRUE if a sentinel for a buffer pool watch, FALSE if not */ @@ -1535,8 +1495,6 @@ buf_flush_update_zip_checksum( ulint size, lsn_t lsn); -#endif /* !UNIV_HOTBACKUP */ - /********************************************************************//** The hook that is called just before a page is written to disk. The function encrypts the content of the page and returns a pointer @@ -1639,7 +1597,6 @@ public: /** Block state. @see buf_page_in_file */ buf_page_state state; -#ifndef UNIV_HOTBACKUP unsigned flush_type:2; /*!< if this block is currently being flushed to disk, this tells the flush_type. @@ -1650,7 +1607,6 @@ public: # error "MAX_BUFFER_POOLS > 64; redefine buf_pool_index:6" # endif /* @} */ -#endif /* !UNIV_HOTBACKUP */ page_zip_des_t zip; /*!< compressed page; zip.data (but not the data it points to) is also protected by buf_pool->mutex; @@ -1682,7 +1638,6 @@ public: buf_tmp_buffer_t* slot; /*!< Slot for temporary memory used for encryption/compression or NULL */ - #ifndef UNIV_HOTBACKUP buf_page_t* hash; /*!< node used in chaining to buf_pool->page_hash or buf_pool->zip_hash */ @@ -1796,7 +1751,6 @@ public: protected by buf_pool->zip_mutex or buf_block_t::mutex. */ # endif /* UNIV_DEBUG */ -#endif /* !UNIV_HOTBACKUP */ }; /** The buffer control block structure */ @@ -1814,7 +1768,6 @@ struct buf_block_t{ is of size UNIV_PAGE_SIZE, and aligned to an address divisible by UNIV_PAGE_SIZE */ -#ifndef UNIV_HOTBACKUP BPageLock lock; /*!< read-write lock of the buffer frame */ UT_LIST_NODE_T(buf_block_t) unzip_LRU; @@ -1901,12 +1854,6 @@ struct buf_block_t{ complete, though: there may have been hash collisions, record deletions, etc. */ - bool made_dirty_with_no_latch; - /*!< true if block has been made dirty - without acquiring X/SX latch as the - block belongs to temporary tablespace - and block is always accessed by a - single thread. */ bool skip_flush_check; /*!< Skip check in buf_dblwr_check_block during bulk load, protected by lock.*/ @@ -1926,7 +1873,6 @@ struct buf_block_t{ and accessed; we introduce this new mutex in InnoDB-5.1 to relieve contention on the buffer pool mutex */ -#endif /* !UNIV_HOTBACKUP */ }; /** Check if a buf_block_t object is in a valid state @@ -1937,7 +1883,6 @@ struct buf_block_t{ && (buf_block_get_state(block) <= BUF_BLOCK_REMOVE_HASH)) -#ifndef UNIV_HOTBACKUP /**********************************************************************//** Compute the hash fold value for blocks in buf_pool->zip_hash. */ /* @{ */ @@ -2472,7 +2417,6 @@ Use these instead of accessing buf_pool->mutex directly. */ /** Release the buffer pool mutex. */ # define buf_pool_mutex_exit(b) mutex_exit(&b->mutex) #endif -#endif /* !UNIV_HOTBACKUP */ /* @} */ /********************************************************************** diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic index bf7799774c6..f2b1b151598 100644 --- a/storage/innobase/include/buf0buf.ic +++ b/storage/innobase/include/buf0buf.ic @@ -32,7 +32,6 @@ Created 11/5/1995 Heikki Tuuri *******************************************************/ #include "mtr0mtr.h" -#ifndef UNIV_HOTBACKUP #include "buf0flu.h" #include "buf0lru.h" #include "buf0rea.h" @@ -208,7 +207,6 @@ buf_page_peek_if_too_old( return(!buf_page_peek_if_young(bpage)); } } -#endif /* !UNIV_HOTBACKUP */ /*********************************************************************//** Gets the state of a block. @@ -385,7 +383,6 @@ buf_page_in_file( return(FALSE); } -#ifndef UNIV_HOTBACKUP /*********************************************************************//** Determines if a block should be on unzip_LRU list. @return TRUE if block belongs to unzip_LRU */ @@ -717,7 +714,6 @@ buf_page_get_block( return(NULL); } -#endif /* !UNIV_HOTBACKUP */ #ifdef UNIV_DEBUG /*********************************************************************//** @@ -744,9 +740,7 @@ buf_block_get_frame( ut_error; break; case BUF_BLOCK_FILE_PAGE: -# ifndef UNIV_HOTBACKUP ut_a(block->page.buf_fix_count > 0); -# endif /* !UNIV_HOTBACKUP */ /* fall through */ case BUF_BLOCK_READY_FOR_USE: case BUF_BLOCK_MEMORY: @@ -796,7 +790,6 @@ buf_ptr_get_fsp_addr( addr->boffset = ut_align_offset(ptr, UNIV_PAGE_SIZE); } -#ifndef UNIV_HOTBACKUP /**********************************************************************//** Gets the hash value of the page the pointer is pointing to. This can be used in searches in the lock hash table. @@ -866,7 +859,6 @@ buf_block_free( buf_pool_mutex_exit(buf_pool); } -#endif /* !UNIV_HOTBACKUP */ /*********************************************************************//** Copies contents of a buffer frame to a given buffer. @@ -885,7 +877,6 @@ buf_frame_copy( return(buf); } -#ifndef UNIV_HOTBACKUP /********************************************************************//** Gets the youngest modification log sequence number for a frame. Returns zero if not file page or no modification occurred yet. @@ -926,7 +917,7 @@ buf_block_modify_clock_inc( #ifdef UNIV_DEBUG buf_pool_t* buf_pool = buf_pool_from_bpage((buf_page_t*) block); - /* No latch is acquired if block belongs to intrinsic table. */ + /* No latch is acquired for the shared temporary tablespace. */ if (!fsp_is_system_temporary(block->page.id.space())) { ut_ad((buf_pool_mutex_own(buf_pool) && (block->page.buf_fix_count == 0)) @@ -949,7 +940,7 @@ buf_block_get_modify_clock( buf_block_t* block) /*!< in: block */ { #ifdef UNIV_DEBUG - /* No latch is acquired if block belongs to intrinsic table. */ + /* No latch is acquired for the shared temporary tablespace. */ if (!fsp_is_system_temporary(block->page.id.space())) { ut_ad(rw_lock_own(&(block->lock), RW_LOCK_S) || rw_lock_own(&(block->lock), RW_LOCK_X) @@ -968,7 +959,7 @@ ulint buf_block_fix( buf_page_t* bpage) { - return(os_atomic_increment_uint32(&bpage->buf_fix_count, 1)); + return(my_atomic_add32((int32*) &bpage->buf_fix_count, 1) + 1); } /** Increments the bufferfix count. @@ -1016,7 +1007,7 @@ ulint buf_block_unfix( buf_page_t* bpage) { - ulint count = os_atomic_decrement_uint32(&bpage->buf_fix_count, 1); + ulint count = my_atomic_add32((int32*) &bpage->buf_fix_count, -1) - 1; ut_ad(count + 1 != 0); return(count); } @@ -1451,14 +1442,12 @@ ulint buf_pool_size_align( ulint size) { - const ulint m = srv_buf_pool_instances * srv_buf_pool_chunk_unit; + const ib_uint64_t m = ((ib_uint64_t)srv_buf_pool_instances) * srv_buf_pool_chunk_unit; size = ut_max(size, srv_buf_pool_min_size); if (size % m == 0) { return(size); } else { - return((size / m + 1) * m); + return (ulint)((size / m + 1) * m); } } - -#endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/include/buf0dblwr.h b/storage/innobase/include/buf0dblwr.h index eb13c3b35e5..fdb9ab15a24 100644 --- a/storage/innobase/include/buf0dblwr.h +++ b/storage/innobase/include/buf0dblwr.h @@ -32,8 +32,6 @@ Created 2011/12/19 Inaam Rana #include "buf0types.h" #include "log0recv.h" -#ifndef UNIV_HOTBACKUP - /** Doublewrite system */ extern buf_dblwr_t* buf_dblwr; /** Set to TRUE when the doublewrite buffer is being created */ @@ -156,7 +154,4 @@ struct buf_dblwr_t{ cached to write_buf */ }; - -#endif /* UNIV_HOTBACKUP */ - #endif diff --git a/storage/innobase/include/buf0flu.h b/storage/innobase/include/buf0flu.h index 40083798d48..273f9666419 100644 --- a/storage/innobase/include/buf0flu.h +++ b/storage/innobase/include/buf0flu.h @@ -30,7 +30,6 @@ Created 11/5/1995 Heikki Tuuri #include "univ.i" #include "ut0byte.h" #include "log0log.h" -#ifndef UNIV_HOTBACKUP #include "buf0types.h" /** Flag indicating if the page_cleaner is in active state. */ @@ -77,7 +76,6 @@ void buf_flush_write_complete( /*=====================*/ buf_page_t* bpage); /*!< in: pointer to the block in question */ -#endif /* !UNIV_HOTBACKUP */ /** Initialize a page for writing to the tablespace. @param[in] block buffer block; NULL if bypassing the buffer pool @param[in,out] page page frame @@ -92,7 +90,6 @@ buf_flush_init_for_writing( lsn_t newest_lsn, bool skip_checksum); -#ifndef UNIV_HOTBACKUP # if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG /********************************************************************//** Writes a flushable page asynchronously from the buffer pool to a file. @@ -128,7 +125,6 @@ buf_flush_do_batch( lsn_t lsn_limit, flush_counters_t* n); - /** This utility flushes dirty blocks from the end of the flush list of all buffer pool instances. NOTE: The calling thread is not allowed to own any latches on pages! @@ -438,8 +434,6 @@ private: bool m_interrupted; }; -#endif /* !UNIV_HOTBACKUP */ - /******************************************************************//** Start a buffer flush batch for LRU or flush list */ ibool diff --git a/storage/innobase/include/buf0flu.ic b/storage/innobase/include/buf0flu.ic index ecb98e32619..5a682ed121a 100644 --- a/storage/innobase/include/buf0flu.ic +++ b/storage/innobase/include/buf0flu.ic @@ -23,7 +23,6 @@ The database buffer pool flush algorithm Created 11/5/1995 Heikki Tuuri *******************************************************/ -#ifndef UNIV_HOTBACKUP #include "buf0buf.h" #include "mtr0mtr.h" #include "srv0srv.h" @@ -148,4 +147,3 @@ buf_flush_recv_note_modification( buf_page_mutex_exit(block); } -#endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/include/buf0lru.h b/storage/innobase/include/buf0lru.h index 0cbd77878ec..2ad1211a548 100644 --- a/storage/innobase/include/buf0lru.h +++ b/storage/innobase/include/buf0lru.h @@ -27,7 +27,6 @@ Created 11/5/1995 Heikki Tuuri #define buf0lru_h #include "univ.i" -#ifndef UNIV_HOTBACKUP #include "ut0byte.h" #include "buf0types.h" @@ -292,6 +291,4 @@ Increments the page_zip_decompress() counter in buf_LRU_stat_cur. */ #include "buf0lru.ic" #endif -#endif /* !UNIV_HOTBACKUP */ - #endif diff --git a/storage/innobase/include/data0data.h b/storage/innobase/include/data0data.h index 5537d70548a..8385fe3d0d3 100644 --- a/storage/innobase/include/data0data.h +++ b/storage/innobase/include/data0data.h @@ -196,7 +196,7 @@ dfield_dup( dfield_t* field, /*!< in/out: data field */ mem_heap_t* heap) /*!< in: memory heap where allocated */ MY_ATTRIBUTE((nonnull)); -#ifndef UNIV_HOTBACKUP + /*********************************************************************//** Tests if two data fields are equal. If len==0, tests the data length and content for equality. @@ -222,7 +222,6 @@ dfield_data_is_binary_equal( ulint len, /*!< in: data length or UNIV_SQL_NULL */ const byte* data) /*!< in: data */ MY_ATTRIBUTE((nonnull, warn_unused_result)); -#endif /* !UNIV_HOTBACKUP */ /*********************************************************************//** Gets number of fields in a data tuple. @return number of fields */ @@ -338,7 +337,6 @@ dtuple_create( ulint n_fields)/*!< in: number of fields */ MY_ATTRIBUTE((nonnull, malloc)); - /** Initialize the virtual field data in a dtuple_t @param[in,out] vrow dtuple contains the virtual fields */ UNIV_INLINE @@ -631,7 +629,6 @@ struct dtuple_t { #endif /* UNIV_DEBUG */ }; - /** A slot for a field in a big rec vector */ struct big_rec_field_t { diff --git a/storage/innobase/include/data0data.ic b/storage/innobase/include/data0data.ic index dc51735d340..71698cc12b3 100644 --- a/storage/innobase/include/data0data.ic +++ b/storage/innobase/include/data0data.ic @@ -285,7 +285,6 @@ dfield_dup( } } -#ifndef UNIV_HOTBACKUP /*********************************************************************//** Tests if two data fields are equal. If len==0, tests the data length and content for equality. @@ -330,7 +329,6 @@ dfield_data_is_binary_equal( && (len == UNIV_SQL_NULL || !memcmp(dfield_get_data(field), data, len))); } -#endif /* !UNIV_HOTBACKUP */ /*********************************************************************//** Gets info bits in a data tuple. diff --git a/storage/innobase/include/data0type.h b/storage/innobase/include/data0type.h index 00073dfca2c..d38aa7c1533 100644 --- a/storage/innobase/include/data0type.h +++ b/storage/innobase/include/data0type.h @@ -166,10 +166,6 @@ be less than 256 */ #define DATA_N_SYS_COLS 3 /* number of system columns defined above */ -#define DATA_ITT_N_SYS_COLS 2 - /* number of system columns for intrinsic - temporary table */ - #define DATA_FTS_DOC_ID 3 /* Used as FTS DOC ID column */ #define DATA_SYS_PRTYPE_MASK 0xF /* mask to extract the above from prtype */ @@ -196,6 +192,11 @@ be less than 256 */ for shorter VARCHARs MySQL uses only 1 byte */ #define DATA_VIRTUAL 8192 /* Virtual column */ +/** Get the number of system columns in a table. */ +#define dict_table_get_n_sys_cols(table) DATA_N_SYS_COLS +/** Check whether locking is disabled (never). */ +#define dict_table_is_locking_disabled(table) false + /*-------------------------------------------*/ /* This many bytes we need to store the type information affecting the @@ -259,7 +260,6 @@ the underling datatype of GEOMETRY(not DATA_POINT) data. */ /* Mask to get the Charset Collation number (0x7fff) */ #define CHAR_COLL_MASK MAX_CHAR_COLL_NUM -#ifndef UNIV_HOTBACKUP /*********************************************************************//** Gets the MySQL type code from a dtype. @return MySQL type code; this is NOT an InnoDB type code! */ @@ -285,7 +285,6 @@ dtype_get_at_most_n_mbchars( ulint data_len, /*!< in: length of str (in bytes) */ const char* str); /*!< in: the string whose prefix length is being determined */ -#endif /* !UNIV_HOTBACKUP */ /*********************************************************************//** Checks if a data main type is a string type. Also a BLOB is considered a string type. @@ -349,7 +348,7 @@ ulint dtype_get_prtype( /*=============*/ const dtype_t* type); /*!< in: data type */ -#ifndef UNIV_HOTBACKUP + /*********************************************************************//** Compute the mbminlen and mbmaxlen members of a data type structure. */ UNIV_INLINE @@ -390,7 +389,6 @@ ibool dtype_is_utf8( /*==========*/ ulint prtype);/*!< in: precise data type */ -#endif /* !UNIV_HOTBACKUP */ /*********************************************************************//** Gets the type length. @return fixed length of the type, in bytes, or 0 if variable-length */ @@ -399,7 +397,7 @@ ulint dtype_get_len( /*==========*/ const dtype_t* type); /*!< in: data type */ -#ifndef UNIV_HOTBACKUP + /*********************************************************************//** Gets the minimum length of a character, in bytes. @return minimum length of a char, in bytes, or 0 if this is not a @@ -431,7 +429,6 @@ dtype_set_mbminmaxlen( ulint mbmaxlen); /*!< in: maximum length of a char, in bytes, or 0 if this is not a character type */ -#endif /* !UNIV_HOTBACKUP */ /***********************************************************************//** Returns the size of a fixed size data type, 0 if not a fixed size type. @return fixed size, or 0 */ @@ -445,7 +442,7 @@ dtype_get_fixed_size_low( ulint mbminmaxlen, /*!< in: minimum and maximum length of a multibyte character, in bytes */ ulint comp); /*!< in: nonzero=ROW_FORMAT=COMPACT */ -#ifndef UNIV_HOTBACKUP + /***********************************************************************//** Returns the minimum size of a data type. @return minimum size */ @@ -468,7 +465,6 @@ dtype_get_max_size_low( /*===================*/ ulint mtype, /*!< in: main type */ ulint len); /*!< in: length */ -#endif /* !UNIV_HOTBACKUP */ /***********************************************************************//** Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a type. For fixed length types it is the fixed length of the type, otherwise 0. @@ -479,7 +475,7 @@ dtype_get_sql_null_size( /*====================*/ const dtype_t* type, /*!< in: type */ ulint comp); /*!< in: nonzero=ROW_FORMAT=COMPACT */ -#ifndef UNIV_HOTBACKUP + /**********************************************************************//** Reads to a type the stored information which determines its alphabetical ordering and the storage size of an SQL NULL value. */ @@ -527,8 +523,6 @@ dtype_sql_name( char* name, /*!< out: SQL name */ unsigned name_sz);/*!< in: size of the name buffer */ -#endif /* !UNIV_HOTBACKUP */ - /*********************************************************************//** Validates a data type structure. @return TRUE if ok */ @@ -571,13 +565,11 @@ struct dtype_t{ string data (in addition to the string, MySQL uses 1 or 2 bytes to store the string length) */ -#ifndef UNIV_HOTBACKUP unsigned mbminmaxlen:5; /*!< minimum and maximum length of a character, in bytes; DATA_MBMINMAXLEN(mbminlen,mbmaxlen); mbminlen=DATA_MBMINLEN(mbminmaxlen); mbmaxlen=DATA_MBMINLEN(mbminmaxlen) */ -#endif /* !UNIV_HOTBACKUP */ }; #ifndef UNIV_NONINL diff --git a/storage/innobase/include/data0type.ic b/storage/innobase/include/data0type.ic index 57770ec0e17..869d0ba8ed6 100644 --- a/storage/innobase/include/data0type.ic +++ b/storage/innobase/include/data0type.ic @@ -24,8 +24,7 @@ Created 1/16/1996 Heikki Tuuri *******************************************************/ #include "mach0data.h" -#ifndef UNIV_HOTBACKUP -# include "ha_prototypes.h" +#include "ha_prototypes.h" /*********************************************************************//** Gets the MySQL charset-collation code for MySQL string types. @@ -137,9 +136,6 @@ dtype_set_mblen( ut_ad(dtype_validate(type)); } -#else /* !UNIV_HOTBACKUP */ -# define dtype_set_mblen(type) (void) 0 -#endif /* !UNIV_HOTBACKUP */ /*********************************************************************//** Sets a data type structure. */ @@ -218,7 +214,6 @@ dtype_get_len( return(type->len); } -#ifndef UNIV_HOTBACKUP /*********************************************************************//** Gets the minimum length of a character, in bytes. @return minimum length of a char, in bytes, or 0 if this is not a @@ -471,8 +466,6 @@ dtype_sql_name( return(name); } -#endif /* !UNIV_HOTBACKUP */ - /***********************************************************************//** Returns the size of a fixed size data type, 0 if not a fixed size type. @return fixed size, or 0 */ @@ -513,7 +506,6 @@ dtype_get_fixed_size_low( case DATA_POINT: return(len); case DATA_MYSQL: -#ifndef UNIV_HOTBACKUP if (prtype & DATA_BINARY_TYPE) { return(len); } else if (!comp) { @@ -534,9 +526,6 @@ dtype_get_fixed_size_low( return(len); } } -#else /* !UNIV_HOTBACKUP */ - return(len); -#endif /* !UNIV_HOTBACKUP */ /* fall through for variable-length charsets */ case DATA_VARCHAR: case DATA_BINARY: @@ -553,7 +542,6 @@ dtype_get_fixed_size_low( return(0); } -#ifndef UNIV_HOTBACKUP /***********************************************************************//** Returns the minimum size of a data type. @return minimum size */ @@ -659,7 +647,6 @@ dtype_get_max_size_low( return(ULINT_MAX); } -#endif /* !UNIV_HOTBACKUP */ /***********************************************************************//** Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a type. @@ -672,11 +659,6 @@ dtype_get_sql_null_size( const dtype_t* type, /*!< in: type */ ulint comp) /*!< in: nonzero=ROW_FORMAT=COMPACT */ { -#ifndef UNIV_HOTBACKUP return(dtype_get_fixed_size_low(type->mtype, type->prtype, type->len, type->mbminmaxlen, comp)); -#else /* !UNIV_HOTBACKUP */ - return(dtype_get_fixed_size_low(type->mtype, type->prtype, type->len, - 0, 0)); -#endif /* !UNIV_HOTBACKUP */ } diff --git a/storage/innobase/include/dict0crea.h b/storage/innobase/include/dict0crea.h index f9ef39fa8c6..51cef91d318 100644 --- a/storage/innobase/include/dict0crea.h +++ b/storage/innobase/include/dict0crea.h @@ -276,7 +276,6 @@ Add a foreign key definition to the data dictionary tables. dberr_t dict_create_add_foreign_to_dictionary( /*==================================*/ - dict_table_t* table, /*!< in: table */ const char* name, /*!< in: table name */ const dict_foreign_t* foreign,/*!< in: foreign key */ trx_t* trx) /*!< in/out: dictionary transaction */ diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index ccef08ff73f..be6f6b1d9a5 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -2,7 +2,7 @@ Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2015, MariaDB Corporation. +Copyright (c) 2013, 2016, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -51,8 +51,7 @@ Created 1/8/1996 Heikki Tuuri extern bool innodb_table_stats_not_found; extern bool innodb_index_stats_not_found; -#ifndef UNIV_HOTBACKUP -# include "sync0rw.h" +#include "sync0rw.h" /********************************************************************//** Get the database name length in a table name. @return database name length */ @@ -228,7 +227,6 @@ dict_max_v_field_len_store_undo( dict_table_t* table, ulint col_no); -#endif /* !UNIV_HOTBACKUP */ #ifdef UNIV_DEBUG /*********************************************************************//** Assert that a column and a data type match. @@ -241,7 +239,7 @@ dict_col_type_assert_equal( const dtype_t* type) /*!< in: data type */ MY_ATTRIBUTE((nonnull, warn_unused_result)); #endif /* UNIV_DEBUG */ -#ifndef UNIV_HOTBACKUP + /***********************************************************************//** Returns the minimum size of the column. @return minimum size */ @@ -327,46 +325,52 @@ dict_table_autoinc_lock( /*====================*/ dict_table_t* table) /*!< in/out: table */ MY_ATTRIBUTE((nonnull)); -/********************************************************************//** -Unconditionally set the autoinc counter. */ +/** Unconditionally set the AUTO_INCREMENT counter. +@param[in,out] table table or partition +@param[in] value next available AUTO_INCREMENT value */ +MY_ATTRIBUTE((nonnull)) +UNIV_INLINE void -dict_table_autoinc_initialize( -/*==========================*/ - dict_table_t* table, /*!< in/out: table */ - ib_uint64_t value) /*!< in: next value to assign to a row */ - MY_ATTRIBUTE((nonnull)); +dict_table_autoinc_initialize(dict_table_t* table, ib_uint64_t value) +{ + ut_ad(dict_table_autoinc_own(table)); + table->autoinc = value; +} -/** Store autoinc value when the table is evicted. -@param[in] table table evicted */ -void -dict_table_autoinc_store( - const dict_table_t* table); - -/** Restore autoinc value when the table is loaded. -@param[in] table table loaded */ -void -dict_table_autoinc_restore( - dict_table_t* table); - -/********************************************************************//** -Reads the next autoinc value (== autoinc counter value), 0 if not yet -initialized. -@return value for a new row, or 0 */ +/** +@param[in] table table or partition +@return the next AUTO_INCREMENT counter value +@retval 0 if AUTO_INCREMENT is not yet initialized */ +MY_ATTRIBUTE((nonnull, warn_unused_result)) +UNIV_INLINE ib_uint64_t -dict_table_autoinc_read( -/*====================*/ - const dict_table_t* table) /*!< in: table */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); -/********************************************************************//** -Updates the autoinc counter if the value supplied is greater than the -current value. */ -void -dict_table_autoinc_update_if_greater( -/*=================================*/ +dict_table_autoinc_read(const dict_table_t* table) +{ + ut_ad(dict_table_autoinc_own(table)); + return(table->autoinc); +} + +/** Update the AUTO_INCREMENT sequence if the value supplied is greater +than the current value. +@param[in,out] table table or partition +@param[in] value AUTO_INCREMENT value that was assigned to a row +@return whether the AUTO_INCREMENT sequence was updated */ +MY_ATTRIBUTE((nonnull)) +UNIV_INLINE +bool +dict_table_autoinc_update_if_greater(dict_table_t* table, ib_uint64_t value) +{ + ut_ad(dict_table_autoinc_own(table)); + + if (value > table->autoinc) { + + table->autoinc = value; + return(true); + } + + return(false); +} - dict_table_t* table, /*!< in/out: table */ - ib_uint64_t value) /*!< in: value which was assigned to a row */ - MY_ATTRIBUTE((nonnull)); /********************************************************************//** Release the autoinc lock. */ void @@ -374,7 +378,6 @@ dict_table_autoinc_unlock( /*======================*/ dict_table_t* table) /*!< in/out: table */ MY_ATTRIBUTE((nonnull)); -#endif /* !UNIV_HOTBACKUP */ /**********************************************************************//** Adds system columns to a table object. */ void @@ -383,7 +386,7 @@ dict_table_add_system_columns( dict_table_t* table, /*!< in/out: table */ mem_heap_t* heap) /*!< in: temporary heap */ MY_ATTRIBUTE((nonnull)); -#ifndef UNIV_HOTBACKUP + /** Mark if table has big rows. @param[in,out] table table handler */ void @@ -412,8 +415,9 @@ void dict_table_remove_from_cache_low( /*=============================*/ dict_table_t* table, /*!< in, own: table */ - ibool lru_evict); /*!< in: TRUE if table being evicted + ibool lru_evict) /*!< in: TRUE if table being evicted to make room in the table LRU list */ + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Renames a table object. @return TRUE if success */ @@ -613,18 +617,6 @@ dict_table_get_col_name( ulint col_nr) /*!< in: column number */ MY_ATTRIBUTE((nonnull, warn_unused_result)); -/**********************************************************************//** -Returns a column's name. -@return column name. NOTE: not guaranteed to stay valid if table is -modified in any way (columns added, etc.). */ -UNIV_INTERN -const char* -dict_table_get_col_name_for_mysql( -/*==============================*/ - const dict_table_t* table, /*!< in: table */ - const char* col_name)/*!< in: MySQL table column name */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); - /** Returns a virtual column's name. @param[in] table table object @param[in] col_nr virtual column number(nth virtual column) @@ -736,7 +728,6 @@ dict_table_get_next_index( # define dict_table_get_last_index(table) UT_LIST_GET_LAST((table)->indexes) # define dict_table_get_next_index(index) UT_LIST_GET_NEXT(indexes, index) #endif /* UNIV_DEBUG */ -#endif /* !UNIV_HOTBACKUP */ /* Skip corrupted index */ #define dict_table_skip_corrupt_index(index) \ @@ -843,17 +834,6 @@ ulint dict_table_get_n_tot_u_cols( const dict_table_t* table); /********************************************************************//** -Gets the number of system columns in a table. -For intrinsic table on ROW_ID column is added for all other -tables TRX_ID and ROLL_PTR are all also appeneded. -@return number of system (e.g., ROW_ID) columns of a table */ -UNIV_INLINE -ulint -dict_table_get_n_sys_cols( -/*======================*/ - const dict_table_t* table) /*!< in: table */ - MY_ATTRIBUTE((warn_unused_result)); -/********************************************************************//** Gets the number of all non-virtual columns (also system) in a table in the dictionary cache. @return number of columns of a table */ @@ -910,7 +890,6 @@ dict_table_n_rows_dec( dict_table_t* table) /*!< in/out: table */ MY_ATTRIBUTE((nonnull)); - /** Get nth virtual column @param[in] table target table @param[in] col_nr column number in MySQL Table definition @@ -969,7 +948,7 @@ dict_table_get_sys_col_no( const dict_table_t* table, /*!< in: table */ ulint sys) /*!< in: DATA_ROW_ID, ... */ MY_ATTRIBUTE((nonnull, warn_unused_result)); -#ifndef UNIV_HOTBACKUP + /********************************************************************//** Returns the minimum data size of an index record. @return minimum data size in bytes */ @@ -979,7 +958,6 @@ dict_index_get_min_size( /*====================*/ const dict_index_t* index) /*!< in: index */ MY_ATTRIBUTE((nonnull, warn_unused_result)); -#endif /* !UNIV_HOTBACKUP */ /********************************************************************//** Check whether the table uses the compact page format. @return TRUE if table uses the compact page format */ @@ -1092,7 +1070,6 @@ dict_table_page_size( const dict_table_t* table) MY_ATTRIBUTE((warn_unused_result)); -#ifndef UNIV_HOTBACKUP /*********************************************************************//** Obtain exclusive locks on all index trees of the table. This is to prevent accessing index trees while InnoDB is updating internal metadata for @@ -1222,7 +1199,6 @@ dict_index_add_to_cache_w_vcol( ulint page_no, ibool strict) MY_ATTRIBUTE((warn_unused_result)); -#endif /* !UNIV_HOTBACKUP */ /********************************************************************//** Gets the number of fields in the internal representation of an index, including fields added by the dictionary system. @@ -1413,7 +1389,7 @@ dict_index_add_col( dict_col_t* col, /*!< in: column */ ulint prefix_len) /*!< in: column prefix length */ MY_ATTRIBUTE((nonnull)); -#ifndef UNIV_HOTBACKUP + /*******************************************************************//** Copies types of fields contained in index to tuple. */ void @@ -1424,7 +1400,6 @@ dict_index_copy_types( ulint n_fields) /*!< in: number of field types to copy */ MY_ATTRIBUTE((nonnull)); -#endif /* !UNIV_HOTBACKUP */ /*********************************************************************//** Gets the field column. @return field->col, pointer to the table column */ @@ -1434,7 +1409,7 @@ dict_field_get_col( /*===============*/ const dict_field_t* field) /*!< in: index field */ MY_ATTRIBUTE((nonnull, warn_unused_result)); -#ifndef UNIV_HOTBACKUP + /**********************************************************************//** Returns an index object if it is found in the dictionary cache. Assumes that dict_sys->mutex is already being held. @@ -1769,8 +1744,6 @@ extern dict_sys_t* dict_sys; /** the data dictionary rw-latch protecting dict_sys */ extern rw_lock_t* dict_operation_lock; -typedef std::map autoinc_map_t; - /* Dictionary system struct */ struct dict_sys_t{ DictSysMutex mutex; /*!< mutex protecting the data @@ -1806,10 +1779,7 @@ struct dict_sys_t{ UT_LIST_BASE_NODE_T(dict_table_t) table_non_LRU; /*!< List of tables that can't be evicted from the cache */ - autoinc_map_t* autoinc_map; /*!< Map to store table id and autoinc - when table is evicted */ }; -#endif /* !UNIV_HOTBACKUP */ /** dummy index for ROW_FORMAT=REDUNDANT supremum and infimum records */ extern dict_index_t* dict_ind_redundant; @@ -1901,7 +1871,7 @@ Closes the data dictionary module. */ void dict_close(void); /*============*/ -#ifndef UNIV_HOTBACKUP + /**********************************************************************//** Check whether the table is corrupted. @return nonzero for corrupted table, zero for valid tables */ @@ -1922,7 +1892,6 @@ dict_index_is_corrupted( const dict_index_t* index) /*!< in: index */ MY_ATTRIBUTE((nonnull, warn_unused_result)); -#endif /* !UNIV_HOTBACKUP */ /**********************************************************************//** Flags an index and table corrupted both in the data dictionary cache and in the system table SYS_INDEXES. */ @@ -2016,24 +1985,6 @@ dict_table_is_encrypted( const dict_table_t* table) /*!< in: table to check */ MY_ATTRIBUTE((warn_unused_result)); -/** Check whether the table is intrinsic. -An intrinsic table is a special kind of temporary table that -is invisible to the end user. It is created internally by the MySQL server -layer or other module connected to InnoDB in order to gather and use data -as part of a larger task. Since access to it must be as fast as possible, -it does not need UNDO semantics, system fields DB_TRX_ID & DB_ROLL_PTR, -doublewrite, checksum, insert buffer, use of the shared data dictionary, -locking, or even a transaction. In short, these are not ACID tables at all, -just temporary - -@param[in] table table to check -@return true if intrinsic table flag is set. */ -UNIV_INLINE -bool -dict_table_is_intrinsic( - const dict_table_t* table) - MY_ATTRIBUTE((warn_unused_result)); - /** Check if the table is in a shared tablespace (System or General). @param[in] id Space ID to check @return true if id is a shared tablespace, false if not. */ @@ -2043,18 +1994,6 @@ dict_table_in_shared_tablespace( const dict_table_t* table) MY_ATTRIBUTE((warn_unused_result)); -/** Check whether locking is disabled for this table. -Currently this is done for intrinsic table as their visibility is limited -to the connection only. - -@param[in] table table to check -@return true if locking is disabled. */ -UNIV_INLINE -bool -dict_table_is_locking_disabled( - const dict_table_t* table) - MY_ATTRIBUTE((warn_unused_result)); - /********************************************************************//** Turn-off redo-logging if temporary table. */ UNIV_INLINE @@ -2064,31 +2003,6 @@ dict_disable_redo_if_temporary( const dict_table_t* table, /*!< in: table to check */ mtr_t* mtr); /*!< out: mini-transaction */ -/** Get table session row-id and increment the row-id counter for next use. -@param[in,out] table table handler -@return next table local row-id. */ -UNIV_INLINE -row_id_t -dict_table_get_next_table_sess_row_id( - dict_table_t* table); - -/** Get table session trx-id and increment the trx-id counter for next use. -@param[in,out] table table handler -@return next table local trx-id. */ -UNIV_INLINE -trx_id_t -dict_table_get_next_table_sess_trx_id( - dict_table_t* table); - -/** Get current session trx-id. -@param[in] table table handler -@return table local trx-id. */ -UNIV_INLINE -trx_id_t -dict_table_get_curr_table_sess_trx_id( - const dict_table_t* table); - -#ifndef UNIV_HOTBACKUP /*********************************************************************//** This function should be called whenever a page is successfully compressed. Updates the compression padding information. */ @@ -2129,18 +2043,6 @@ dict_index_node_ptr_max_size( /*=========================*/ const dict_index_t* index) /*!< in: index */ MY_ATTRIBUTE((warn_unused_result)); -/*****************************************************************//** -Get index by first field of the index -@return index which is having first field matches -with the field present in field_index position of table */ -UNIV_INLINE -dict_index_t* -dict_table_get_index_on_first_col( -/*==============================*/ - const dict_table_t* table, /*!< in: table */ - ulint col_index, /*!< in: position of column - in table */ - const char* field_name); /*!< in: field name */ /** Check if a column is a virtual column @param[in] col column @return true if it is a virtual column, false otherwise */ @@ -2201,9 +2103,6 @@ bool dict_table_have_virtual_index( dict_table_t* table); -#endif /* !UNIV_HOTBACKUP */ - - #ifndef UNIV_NONINL #include "dict0dict.ic" #endif diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic index 8165263c95c..b99cb421ab2 100644 --- a/storage/innobase/include/dict0dict.ic +++ b/storage/innobase/include/dict0dict.ic @@ -25,7 +25,6 @@ Created 1/8/1996 Heikki Tuuri ***********************************************************************/ #include "data0type.h" -#ifndef UNIV_HOTBACKUP #include "dict0load.h" #include "rem0types.h" #include "fsp0fsp.h" @@ -101,8 +100,6 @@ dict_col_is_virtual( return(col->prtype & DATA_VIRTUAL); } -#endif /* !UNIV_HOTBACKUP */ - #ifdef UNIV_DEBUG /*********************************************************************//** Assert that a column and a data type match. @@ -120,15 +117,12 @@ dict_col_type_assert_equal( ut_ad(col->mtype == type->mtype); ut_ad(col->prtype == type->prtype); //ut_ad(col->len == type->len); -# ifndef UNIV_HOTBACKUP ut_ad(col->mbminmaxlen == type->mbminmaxlen); -# endif /* !UNIV_HOTBACKUP */ return(TRUE); } #endif /* UNIV_DEBUG */ -#ifndef UNIV_HOTBACKUP /***********************************************************************//** Returns the minimum size of the column. @return minimum size */ @@ -152,7 +146,6 @@ dict_col_get_max_size( { return(dtype_get_max_size_low(col->mtype, col->len)); } -#endif /* !UNIV_HOTBACKUP */ /***********************************************************************//** Returns the size of a fixed size column, 0 if not a fixed size column. @return fixed size, or 0 */ @@ -245,7 +238,6 @@ dict_col_get_index_pos( return(ULINT_UNDEFINED); } -#ifndef UNIV_HOTBACKUP #ifdef UNIV_DEBUG /********************************************************************//** Gets the first index on the table (the clustered index). @@ -293,7 +285,6 @@ dict_table_get_next_index( return(UT_LIST_GET_NEXT(indexes, (dict_index_t*) index)); } #endif /* UNIV_DEBUG */ -#endif /* !UNIV_HOTBACKUP */ /********************************************************************//** Check whether the index is the clustered index. @@ -447,23 +438,6 @@ dict_table_get_n_tot_u_cols( return(dict_table_get_n_user_cols(table) + dict_table_get_n_v_cols(table)); } -/********************************************************************//** -Gets the number of system columns in a table. -For intrinsic table on ROW_ID column is added for all other -tables TRX_ID and ROLL_PTR are all also appeneded. -@return number of system (e.g., ROW_ID) columns of a table */ -UNIV_INLINE -ulint -dict_table_get_n_sys_cols( -/*======================*/ - const dict_table_t* table MY_ATTRIBUTE((unused))) /*!< in: table */ -{ - ut_ad(table); - ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); - - return(dict_table_is_intrinsic(table) - ? DATA_ITT_N_SYS_COLS : DATA_N_SYS_COLS); -} /********************************************************************//** Gets the number of all non-virtual columns (also system) in a table @@ -1208,7 +1182,6 @@ dict_table_page_size( return(dict_tf_get_page_size(table->flags)); } -#ifndef UNIV_HOTBACKUP /*********************************************************************//** Obtain exclusive locks on all index trees of the table. This is to prevent accessing index trees while InnoDB is updating internal metadata for @@ -1251,7 +1224,6 @@ dict_table_x_unlock_indexes( rw_lock_x_unlock(dict_index_get_lock(index)); } } -#endif /* !UNIV_HOTBACKUP */ /********************************************************************//** Gets the number of fields in the internal representation of an index, @@ -1457,7 +1429,6 @@ dict_index_get_nth_col_pos( prefix_col_pos)); } -#ifndef UNIV_HOTBACKUP /********************************************************************//** Returns the minimum data size of an index record. @return minimum data size in bytes */ @@ -1816,26 +1787,6 @@ dict_table_is_encrypted( return(DICT_TF2_FLAG_IS_SET(table, DICT_TF2_ENCRYPTION)); } -/** Check whether the table is intrinsic. -An intrinsic table is a special kind of temporary table that -is invisible to the end user. It can be created internally by InnoDB, the MySQL -server layer or other modules connected to InnoDB in order to gather and use -data as part of a larger task. Since access to it must be as fast as possible, -it does not need UNDO semantics, system fields DB_TRX_ID & DB_ROLL_PTR, -doublewrite, checksum, insert buffer, use of the shared data dictionary, -locking, or even a transaction. In short, these are not ACID tables at all, -just temporary data stored and manipulated during a larger process. - -@param[in] table table to check -@return true if intrinsic table flag is set. */ -UNIV_INLINE -bool -dict_table_is_intrinsic( - const dict_table_t* table) -{ - return(DICT_TF2_FLAG_IS_SET(table, DICT_TF2_INTRINSIC)); -} - /** Check if the table is in a shared tablespace (System or General). @param[in] id Space ID to check @return true if id is a shared tablespace, false if not. */ @@ -1848,20 +1799,6 @@ dict_table_in_shared_tablespace( || DICT_TF_HAS_SHARED_SPACE(table->flags)); } -/** Check whether locking is disabled for this table. -Currently this is done for intrinsic table as their visibility is limited -to the connection only. - -@param[in] table table to check -@return true if locking is disabled. */ -UNIV_INLINE -bool -dict_table_is_locking_disabled( - const dict_table_t* table) -{ - return(dict_table_is_intrinsic(table)); -} - /********************************************************************//** Turn-off redo-logging if temporary table. */ UNIV_INLINE @@ -1910,82 +1847,13 @@ dict_table_is_file_per_table( return(is_file_per_table ); } -/**********************************************************************//** -Get index by first field of the index -@return index which is having first field matches -with the field present in field_index position of table */ -UNIV_INLINE -dict_index_t* -dict_table_get_index_on_first_col( -/*==============================*/ - const dict_table_t* table, /*!< in: table */ - ulint col_index, /*!< in: position of column - in table */ - const char* field_name) /*!< in: field name */ -{ - ut_ad(col_index < table->n_cols); - - dict_col_t* column = dict_table_get_nth_col(table, col_index); - - for (dict_index_t* index = dict_table_get_first_index(table); - index != NULL; index = dict_table_get_next_index(index)) { - - if (index->fields[0].col == column) { - return(index); - } - } - - /* If not yet found use field_name */ - for (dict_index_t* index = dict_table_get_first_index(table); - index != NULL; index = dict_table_get_next_index(index)) { - if (!strcmp(index->fields[0].name, field_name)) { - return (index); - } - } - ut_error; - return(0); -} - -/** Get table session row-id and increment the row-id counter for next use. -@param[in,out] table table handler -@return next table session row-id. */ -UNIV_INLINE -row_id_t -dict_table_get_next_table_sess_row_id( - dict_table_t* table) -{ - return(++table->sess_row_id); -} - -/** Get table session trx-id and increment the trx-id counter for next use. -@param[in,out] table table handler -@return next table session trx-id. */ -UNIV_INLINE -trx_id_t -dict_table_get_next_table_sess_trx_id( - dict_table_t* table) -{ - return(++table->sess_trx_id); -} - -/** Get current session trx-id. -@param[in] table table handler -@return table session trx-id. */ -UNIV_INLINE -trx_id_t -dict_table_get_curr_table_sess_trx_id( - const dict_table_t* table) -{ - return(table->sess_trx_id); -} - /** Get reference count. @return current value of n_ref_count */ inline ulint dict_table_t::get_ref_count() const { - ut_ad(mutex_own(&dict_sys->mutex) || dict_table_is_intrinsic(this)); + ut_ad(mutex_own(&dict_sys->mutex)); return(n_ref_count); } @@ -1994,7 +1862,7 @@ inline void dict_table_t::acquire() { - ut_ad(mutex_own(&dict_sys->mutex) || dict_table_is_intrinsic(this)); + ut_ad(mutex_own(&dict_sys->mutex)); ++n_ref_count; } @@ -2003,7 +1871,7 @@ inline void dict_table_t::release() { - ut_ad(mutex_own(&dict_sys->mutex) || dict_table_is_intrinsic(this)); + ut_ad(mutex_own(&dict_sys->mutex)); ut_ad(n_ref_count > 0); --n_ref_count; } @@ -2068,7 +1936,6 @@ dict_free_vc_templ( ut_free(vc_templ->vtempl[i]); } } - ut_free(vc_templ->default_rec); ut_free(vc_templ->vtempl); vc_templ->vtempl = NULL; } @@ -2095,4 +1962,3 @@ dict_table_have_virtual_index( return(false); } -#endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 4fac0648bcb..538306f7af8 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -35,11 +35,9 @@ Created 1/8/1996 Heikki Tuuri #include "row0types.h" #include "rem0types.h" #include "btr0types.h" -#ifndef UNIV_HOTBACKUP -# include "lock0types.h" -# include "que0types.h" -# include "sync0rw.h" -#endif /* !UNIV_HOTBACKUP */ +#include "lock0types.h" +#include "que0types.h" +#include "sync0rw.h" #include "ut0mem.h" #include "ut0rnd.h" #include "ut0byte.h" @@ -50,7 +48,6 @@ Created 1/8/1996 Heikki Tuuri #include "gis0type.h" #include "os0once.h" #include "ut0new.h" - #include "fil0fil.h" #include #include "fil0crypt.h" @@ -179,7 +176,7 @@ DEFAULT=0, ON = 1, OFF = 2 + DICT_TF_WIDTH_PAGE_ENCRYPTION_KEY) /** A mask of all the known/used bits in table flags */ -#define DICT_TF_BIT_MASK (~(~0 << DICT_TF_BITS)) +#define DICT_TF_BIT_MASK (~(~0U << DICT_TF_BITS)) /** Zero relative shift position of the COMPACT field */ #define DICT_TF_POS_COMPACT 0 @@ -235,23 +232,23 @@ DEFAULT=0, ON = 1, OFF = 2 << DICT_TF_POS_SHARED_SPACE) /** Bit mask of the PAGE_COMPRESSION field */ #define DICT_TF_MASK_PAGE_COMPRESSION \ - ((~(~0 << DICT_TF_WIDTH_PAGE_COMPRESSION)) \ + ((~(~0U << DICT_TF_WIDTH_PAGE_COMPRESSION)) \ << DICT_TF_POS_PAGE_COMPRESSION) /** Bit mask of the PAGE_COMPRESSION_LEVEL field */ #define DICT_TF_MASK_PAGE_COMPRESSION_LEVEL \ - ((~(~0 << DICT_TF_WIDTH_PAGE_COMPRESSION_LEVEL)) \ + ((~(~0U << DICT_TF_WIDTH_PAGE_COMPRESSION_LEVEL)) \ << DICT_TF_POS_PAGE_COMPRESSION_LEVEL) /** Bit mask of the ATOMIC_WRITES field */ #define DICT_TF_MASK_ATOMIC_WRITES \ - ((~(~0 << DICT_TF_WIDTH_ATOMIC_WRITES)) \ + ((~(~0U << DICT_TF_WIDTH_ATOMIC_WRITES)) \ << DICT_TF_POS_ATOMIC_WRITES) /** Bit mask of the PAGE_ENCRYPTION field */ #define DICT_TF_MASK_PAGE_ENCRYPTION \ - ((~(~0 << DICT_TF_WIDTH_PAGE_ENCRYPTION)) \ + ((~(~0U << DICT_TF_WIDTH_PAGE_ENCRYPTION)) \ << DICT_TF_POS_PAGE_ENCRYPTION) /** Bit mask of the PAGE_ENCRYPTION_KEY field */ #define DICT_TF_MASK_PAGE_ENCRYPTION_KEY \ - ((~(~0 << DICT_TF_WIDTH_PAGE_ENCRYPTION_KEY)) \ + ((~(~0U << DICT_TF_WIDTH_PAGE_ENCRYPTION_KEY)) \ << DICT_TF_POS_PAGE_ENCRYPTION_KEY) /** Return the value of the COMPACT field */ @@ -337,12 +334,6 @@ use its own tablespace instead of the system tablespace. */ index tables) of a FTS table are in HEX format. */ #define DICT_TF2_FTS_AUX_HEX_NAME 64 -/** Intrinsic table bit -Intrinsic table is table created internally by MySQL modules viz. Optimizer, -FTS, etc.... Intrinsic table has all the properties of the normal table except -it is not created by user and so not visible to end-user. */ -#define DICT_TF2_INTRINSIC 128 - /** Encryption table bit. */ #define DICT_TF2_ENCRYPTION 256 @@ -859,95 +850,6 @@ struct zip_pad_info_t { a certain index.*/ #define STAT_DEFRAG_DATA_SIZE_N_SAMPLE 10 -/** If key is fixed length key then cache the record offsets on first -computation. This will help save computation cycle that generate same -redundant data. */ -class rec_cache_t -{ -public: - /** Constructor */ - rec_cache_t() - : - rec_size(), - offsets(), - sz_of_offsets(), - fixed_len_key(), - offsets_cached(), - key_has_null_cols() - { - /* Do Nothing. */ - } - -public: - /** Record size. (for fixed length key record size is constant) */ - ulint rec_size; - - /** Holds reference to cached offsets for record. */ - ulint* offsets; - - /** Size of offset array */ - uint32_t sz_of_offsets; - - /** If true, then key is fixed length key. */ - bool fixed_len_key; - - /** If true, then offset has been cached for re-use. */ - bool offsets_cached; - - /** If true, then key part can have columns that can take - NULL values. */ - bool key_has_null_cols; -}; - -/** Cache position of last inserted or selected record by caching record -and holding reference to the block where record resides. -Note: We don't commit mtr and hold it beyond a transaction lifetime as this is -a special case (intrinsic table) that are not shared accross connection. */ -class last_ops_cur_t -{ -public: - /** Constructor */ - last_ops_cur_t() - : - rec(), - block(), - mtr(), - disable_caching(), - invalid() - { - /* Do Nothing. */ - } - - /* Commit mtr and re-initialize cache record and block to NULL. */ - void release() - { - if (mtr.is_active()) { - mtr_commit(&mtr); - } - rec = NULL; - block = NULL; - invalid = false; - } - -public: - /** last inserted/selected record. */ - rec_t* rec; - - /** block where record reside. */ - buf_block_t* block; - - /** active mtr that will be re-used for next insert/select. */ - mtr_t mtr; - - /** disable caching. (disabled when table involves blob/text.) */ - bool disable_caching; - - /** If index structure is undergoing structural change viz. - split then invalidate the cached position as it would be no more - remain valid. Will be re-cached on post-split insert. */ - bool invalid; -}; - /** "GEN_CLUST_INDEX" is the name reserved for InnoDB default system clustered index when there is no primary key. */ const char innobase_index_reserve_name[] = "GEN_CLUST_INDEX"; @@ -964,7 +866,6 @@ struct dict_index_t{ id_name_t name; /*!< index name */ const char* table_name;/*!< table name */ dict_table_t* table; /*!< back pointer to table */ -#ifndef UNIV_HOTBACKUP unsigned space:32; /*!< space where the index tree is placed */ unsigned page:32;/*!< index tree root page number */ @@ -973,7 +874,6 @@ struct dict_index_t{ data size drops below this limit in percent, merging it to a neighbor is tried */ # define DICT_INDEX_MERGE_THRESHOLD_DEFAULT 50 -#endif /* !UNIV_HOTBACKUP */ unsigned type:DICT_IT_BITS; /*!< index type (DICT_CLUSTERED, DICT_UNIQUE, DICT_IBUF, DICT_CORRUPT) */ @@ -990,18 +890,15 @@ struct dict_index_t{ /*!< number of columns the user defined to be in the index: in the internal representation we add more columns */ - unsigned allow_duplicates:1; - /*!< if true, allow duplicate values - even if index is created with unique - constraint */ unsigned nulls_equal:1; /*!< if true, SQL NULL == SQL NULL */ - unsigned disable_ahi:1; - /*!< in true, then disable AHI. - Currently limited to intrinsic - temporary table as index id is not - unqiue for such table which is one of the - validation criterion for ahi. */ +#ifdef MYSQL_INDEX_DISABLE_AHI + unsigned disable_ahi:1; + /*!< whether to disable the + adaptive hash index. + Maybe this could be disabled for + temporary tables? */ +#endif unsigned n_uniq:10;/*!< number of fields from the beginning which are enough to determine an index entry uniquely */ @@ -1038,7 +935,6 @@ struct dict_index_t{ bool has_new_v_col; /*!< whether it has a newly added virtual column in ALTER */ -#ifndef UNIV_HOTBACKUP UT_LIST_NODE_T(dict_index_t) indexes;/*!< list of indexes of the table */ btr_search_t* search_info; @@ -1098,19 +994,6 @@ struct dict_index_t{ /* in which slot the next sample should be saved. */ /* @} */ - last_ops_cur_t* last_ins_cur; - /*!< cache the last insert position. - Currently limited to auto-generated - clustered index on intrinsic table only. */ - last_ops_cur_t* last_sel_cur; - /*!< cache the last selected position - Currently limited to intrinsic table only. */ - rec_cache_t rec_cache; - /*!< cache the field that needs to be - re-computed on each insert. - Limited to intrinsic table as this is common - share and can't be used without protection - if table is accessible to multiple-threads. */ rtr_ssn_t rtr_ssn;/*!< Node sequence number for RTree */ rtr_info_track_t* rtr_track;/*!< tracking all R-Tree search cursors */ @@ -1139,7 +1022,6 @@ struct dict_index_t{ ut_ad(committed || !(type & DICT_CLUSTERED)); uncommitted = !committed; } -#endif /* !UNIV_HOTBACKUP */ }; /** The status of online index creation */ @@ -1439,14 +1321,19 @@ struct dict_vcol_templ_t { /** table name */ std::string tb_name; - /** share->table_name */ - std::string share_name; - /** MySQL record length */ ulint rec_len; /** default column value if any */ byte* default_rec; + + /** cached MySQL TABLE object */ + TABLE* mysql_table; + + /** when mysql_table was cached */ + uint64_t mysql_table_query_id; + + dict_vcol_templ_t() : vtempl(0), mysql_table_query_id(-1) {} }; /* This flag is for sync SQL DDL and memcached DML. @@ -1478,6 +1365,8 @@ struct dict_table_t { inline void acquire(); void* thd; /*!< thd */ + bool page_0_read; /*!< true if page 0 has + been already read */ fil_space_crypt_t *crypt_data; /*!< crypt data if present */ /** Release the table handle. */ @@ -1572,6 +1461,11 @@ struct dict_table_t { /** Number of virtual columns. */ unsigned n_v_cols:10; + /** 1 + the position of autoinc counter field in clustered + index, or 0 if there is no persistent AUTO_INCREMENT column in + the table. */ + unsigned persistent_autoinc:10; + /** TRUE if it's not an InnoDB system table or a table that has no FK relationships. */ unsigned can_be_evicted:1; @@ -1613,7 +1507,6 @@ struct dict_table_t { /*!< !DICT_FRM_CONSISTENT==0 if data dictionary information and MySQL FRM information mismatch. */ -#ifndef UNIV_HOTBACKUP /** Hash chain node. */ hash_node_t name_hash; @@ -1874,20 +1767,6 @@ public: /** Timestamp of the last modification of this table. */ time_t update_time; - /** row-id counter for use by intrinsic table for getting row-id. - Given intrinsic table semantics, row-id can be locally maintained - instead of getting it from central generator which involves mutex - locking. */ - ib_uint64_t sess_row_id; - - /** trx_id counter for use by intrinsic table for getting trx-id. - Intrinsic table are not shared so don't need a central trx-id - but just need a increased counter to track consistent view while - proceeding SELECT as part of UPDATE. */ - ib_uint64_t sess_trx_id; - -#endif /* !UNIV_HOTBACKUP */ - bool is_encrypted; #ifdef UNIV_DEBUG diff --git a/storage/innobase/include/dict0mem.ic b/storage/innobase/include/dict0mem.ic index 3269596feb7..933f233aae6 100644 --- a/storage/innobase/include/dict0mem.ic +++ b/storage/innobase/include/dict0mem.ic @@ -60,44 +60,17 @@ dict_mem_fill_index_struct( /* Assign a ulint to a 4-bit-mapped field. Only the low-order 4 bits are assigned. */ index->type = type; -#ifndef UNIV_HOTBACKUP index->space = (unsigned int) space; index->page = FIL_NULL; index->merge_threshold = DICT_INDEX_MERGE_THRESHOLD_DEFAULT; -#endif /* !UNIV_HOTBACKUP */ index->table_name = table_name; index->n_fields = (unsigned int) n_fields; /* The '1 +' above prevents allocation of an empty mem block */ - index->allow_duplicates = false; index->nulls_equal = false; +#ifdef MYSQL_INDEX_DISABLE_AHI index->disable_ahi = false; - - new (&index->rec_cache) rec_cache_t(); - - if (heap != NULL) { - index->last_ins_cur = - static_cast(mem_heap_alloc( - heap, sizeof(last_ops_cur_t))); - - new (index->last_ins_cur) last_ops_cur_t(); - - index->last_sel_cur = - static_cast(mem_heap_alloc( - heap, sizeof(last_ops_cur_t))); - - new (index->last_sel_cur) last_ops_cur_t(); - - index->rec_cache.offsets = - static_cast(mem_heap_alloc( - heap, sizeof(ulint) * OFFS_IN_REC_NORMAL_SIZE)); - - index->rec_cache.sz_of_offsets = OFFS_IN_REC_NORMAL_SIZE; - } else { - index->last_ins_cur = NULL; - index->last_sel_cur = NULL; - index->rec_cache.offsets = NULL; - } +#endif #ifdef UNIV_DEBUG index->magic_n = DICT_INDEX_MAGIC_N; diff --git a/storage/innobase/include/dict0priv.ic b/storage/innobase/include/dict0priv.ic index fd10c566be6..fb7af2772fc 100644 --- a/storage/innobase/include/dict0priv.ic +++ b/storage/innobase/include/dict0priv.ic @@ -26,7 +26,6 @@ Created Wed 13 Oct 2010 16:10:14 EST Sunny Bains #include "dict0dict.h" #include "dict0load.h" #include "dict0priv.h" -#ifndef UNIV_HOTBACKUP /**********************************************************************//** Gets a table; loads it to the dictionary cache if necessary. A low-level @@ -125,4 +124,3 @@ dict_table_check_if_in_cache_low( !strcmp(table->name.m_name, table_name)); DBUG_RETURN(table); } -#endif /*! UNIV_HOTBACKUP */ diff --git a/storage/innobase/include/dict0stats.ic b/storage/innobase/include/dict0stats.ic index 80709091734..61c88773912 100644 --- a/storage/innobase/include/dict0stats.ic +++ b/storage/innobase/include/dict0stats.ic @@ -182,7 +182,7 @@ dict_stats_deinit( /*==============*/ dict_table_t* table) /*!< in/out: table */ { - ut_ad(mutex_own(&dict_sys->mutex) || dict_table_is_intrinsic(table)); + ut_ad(mutex_own(&dict_sys->mutex)); ut_a(table->get_ref_count() == 0); diff --git a/storage/innobase/include/fil0crypt.h b/storage/innobase/include/fil0crypt.h index acac155ef3f..e854915b2ae 100644 --- a/storage/innobase/include/fil0crypt.h +++ b/storage/innobase/include/fil0crypt.h @@ -34,9 +34,6 @@ Created 04/01/2015 Jan Lindström static const unsigned char CRYPT_MAGIC[MAGIC_SZ] = { 's', 0xE, 0xC, 'R', 'E', 't' }; -static const unsigned char EMPTY_PATTERN[MAGIC_SZ] = { - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }; - /* This key will be used if nothing else is given */ #define FIL_DEFAULT_ENCRYPTION_KEY ENCRYPTION_KEY_SYSTEM_DATA @@ -75,6 +72,17 @@ struct key_struct (that is L in CRYPT_SCHEME_1) */ }; +/** is encryption enabled */ +extern ulong srv_encrypt_tables; + +/** Mutex helper for crypt_data->scheme +@param[in, out] schme encryption scheme +@param[in] exit should we exit or enter mutex ? */ +void +crypt_data_scheme_locker( + st_encryption_scheme* scheme, + int exit); + struct fil_space_rotate_state_t { time_t start_time; /*!< time when rotation started */ @@ -96,13 +104,109 @@ struct fil_space_rotate_state_t struct fil_space_crypt_struct : st_encryption_scheme { + public: + /** Constructor. Does not initialize the members! + The object is expected to be placed in a buffer that + has been zero-initialized. */ + fil_space_crypt_struct( + ulint new_type, + uint new_min_key_version, + uint new_key_id, + ulint offset, + fil_encryption_t new_encryption) + : st_encryption_scheme(), + min_key_version(new_min_key_version), + page0_offset(offset), + encryption(new_encryption), + closing(false), + key_found(), + rotate_state() + { + key_found = new_min_key_version; + key_id = new_key_id; + my_random_bytes(iv, sizeof(iv)); + mutex_create(LATCH_ID_FIL_CRYPT_DATA_MUTEX, &mutex); + locker = crypt_data_scheme_locker; + type = new_type; + + if (new_encryption == FIL_SPACE_ENCRYPTION_OFF || + (!srv_encrypt_tables && + new_encryption == FIL_SPACE_ENCRYPTION_DEFAULT)) { + type = CRYPT_SCHEME_UNENCRYPTED; + } else { + type = CRYPT_SCHEME_1; + min_key_version = key_get_latest_version(); + } + } + + /** Destructor */ + ~fil_space_crypt_struct() + { + closing = true; + mutex_free(&mutex); + } + + /** Get latest key version from encryption plugin + @retval key_version or + @retval ENCRYPTION_KEY_VERSION_INVALID if used key_id + is not found from encryption plugin. */ + uint key_get_latest_version(void); + + /** Returns true if key was found from encryption plugin + and false if not. */ + bool is_key_found() const { + return key_found != ENCRYPTION_KEY_VERSION_INVALID; + } + + /** Returns true if tablespace should be encrypted */ + bool should_encrypt() const { + return ((encryption == FIL_SPACE_ENCRYPTION_ON) || + (srv_encrypt_tables && + encryption == FIL_SPACE_ENCRYPTION_DEFAULT)); + } + + /** Return true if tablespace is encrypted. */ + bool is_encrypted() const { + return (encryption != FIL_SPACE_ENCRYPTION_OFF); + } + + /** Return true if default tablespace encryption is used, */ + bool is_default_encryption() const { + return (encryption == FIL_SPACE_ENCRYPTION_DEFAULT); + } + + /** Return true if tablespace is not encrypted. */ + bool not_encrypted() const { + return (encryption == FIL_SPACE_ENCRYPTION_OFF); + } + + /** Is this tablespace closing. */ + bool is_closing(bool is_fixed) { + bool closed; + if (!is_fixed) { + mutex_enter(&mutex); + } + closed = closing; + if (!is_fixed) { + mutex_exit(&mutex); + } + return closed; + } + uint min_key_version; // min key version for this space ulint page0_offset; // byte offset on page 0 for crypt data fil_encryption_t encryption; // Encryption setup ib_mutex_t mutex; // mutex protecting following variables bool closing; // is tablespace being closed - bool inited; + + /** Return code from encryption_key_get_latest_version. + If ENCRYPTION_KEY_VERSION_INVALID encryption plugin + could not find the key and there is no need to call + get_latest_key_version again as keys are read only + at startup. */ + uint key_found; + fil_space_rotate_state_t rotate_state; }; @@ -321,7 +425,8 @@ UNIV_INTERN void fil_space_crypt_mark_space_closing( /*===============================*/ - ulint space); /*!< in: tablespace id */ + ulint space, /*!< in: tablespace id */ + fil_space_crypt_t* crypt_data); /*!< in: crypt_data or NULL */ /********************************************************************* Wait for crypt threads to stop accessing space */ diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 4171bed1611..1e07c4f8fb5 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -33,72 +33,17 @@ Created 10/25/1995 Heikki Tuuri #include "log0recv.h" #include "dict0types.h" #include "page0size.h" -#ifndef UNIV_HOTBACKUP #include "ibuf0types.h" -#else -#include "log0log.h" -#include "os0file.h" -#include "m_string.h" -#endif /* !UNIV_HOTBACKUP */ #include #include -#ifdef UNIV_HOTBACKUP -#include -/** determine if file is intermediate / temporary.These files are created during -reorganize partition, rename tables, add / drop columns etc. -@param[in] filepath asbosolute / relative or simply file name -@retvalue true if it is intermediate file -@retvalue false if it is normal file */ -inline -bool -is_intermediate_file(const std::string& filepath) -{ - std::string file_name = filepath; - - // extract file name from relative or absolute file name - std::size_t pos = file_name.rfind(OS_PATH_SEPARATOR); - if (pos != std::string::npos) - file_name = file_name.substr(++pos); - - transform(file_name.begin(), file_name.end(), - file_name.begin(), ::tolower); - - if (file_name[0] != '#') { - pos = file_name.rfind("#tmp#.ibd"); - if (pos != std::string::npos) - return true; - else - return false; /* normal file name */ - } - - std::vector file_name_patterns = {"#sql-", "#sql2-", - "#tmp#", "#ren#"}; - - /* search for the unsupported patterns */ - for (auto itr = file_name_patterns.begin(); - itr != file_name_patterns.end(); - itr++) { - - if (0 == std::strncmp(file_name.c_str(), - itr->c_str(), itr->length())){ - return true; - } - } - - return false; -} -#endif /* UNIV_HOTBACKUP */ - extern const char general_space_name[]; // Forward declaration struct trx_t; class page_id_t; class truncate_t; -struct fil_node_t; -struct fil_space_t; struct btr_create_t; /* structure containing encryption specification */ @@ -184,6 +129,10 @@ struct fil_space_t { /*!< length of the FSP_FREE list */ ulint free_limit; /*!< contents of FSP_FREE_LIMIT */ + ulint recv_size; + /*!< recovered tablespace size in pages; + 0 if no size change was read from the redo log, + or if the size change was implemented */ ulint flags; /*!< tablespace flags; see fsp_flags_is_valid(), page_size_t(ulint) (constructor) */ @@ -203,10 +152,8 @@ struct fil_space_t { Protected by fil_system->mutex. */ hash_node_t hash; /*!< hash chain node */ hash_node_t name_hash;/*!< hash chain the name_hash table */ -#ifndef UNIV_HOTBACKUP rw_lock_t latch; /*!< latch protecting the file space storage allocation */ -#endif /* !UNIV_HOTBACKUP */ UT_LIST_NODE_T(fil_space_t) unflushed_spaces; /*!< list of spaces with at least one unflushed file we have written to */ @@ -237,8 +184,8 @@ struct fil_space_t { /** MariaDB encryption data */ fil_space_crypt_t* crypt_data; - /** Space file block size */ - ulint file_block_size; + /** tablespace crypt data has been read */ + bool page_0_crypt_read; /** True if we have already printed compression failure */ bool printed_compression_failure; @@ -617,9 +564,7 @@ fil_space_get( data space) is stored here; below we talk about tablespaces, but also the ib_logfiles form a 'space' and it is handled here */ struct fil_system_t { -#ifndef UNIV_HOTBACKUP ib_mutex_t mutex; /*!< The mutex protecting the cache */ -#endif /* !UNIV_HOTBACKUP */ hash_table_t* spaces; /*!< The hash table of spaces in the system; they are hashed on the space id */ @@ -681,7 +626,6 @@ extern fil_system_t* fil_system; #include "fil0crypt.h" -#ifndef UNIV_HOTBACKUP /** Returns the latch of a file space. @param[in] id space id @param[out] flags tablespace flags @@ -708,15 +652,14 @@ void fil_space_set_imported( ulint id); -# ifdef UNIV_DEBUG +#ifdef UNIV_DEBUG /** Determine if a tablespace is temporary. @param[in] id tablespace identifier @return whether it is a temporary tablespace */ bool fsp_is_temporary(ulint id) MY_ATTRIBUTE((warn_unused_result, pure)); -# endif /* UNIV_DEBUG */ -#endif /* !UNIV_HOTBACKUP */ +#endif /* UNIV_DEBUG */ /** Append a file to the chain of files of a space. @param[in] name file name of a file that is not open @@ -753,7 +696,8 @@ fil_space_create( ulint id, ulint flags, fil_type_t purpose, /*!< in: FIL_TABLESPACE, or FIL_LOG if log */ - fil_space_crypt_t* crypt_data) /*!< in: crypt data */ + fil_space_crypt_t* crypt_data, /*!< in: crypt data */ + bool create_table) /*!< in: true if create table */ MY_ATTRIBUTE((warn_unused_result)); /*******************************************************************//** @@ -787,6 +731,12 @@ char* fil_space_get_first_path( ulint id); +/** Set the recovered size of a tablespace in pages. +@param id tablespace ID +@param size recovered size in pages */ +UNIV_INTERN +void +fil_space_set_recv_size(ulint id, ulint size); /*******************************************************************//** Returns the size of the space in pages. The tablespace must be cached in the memory cache. @@ -875,7 +825,6 @@ void fil_set_max_space_id_if_bigger( /*===========================*/ ulint max_id);/*!< in: maximum known id */ -#ifndef UNIV_HOTBACKUP /** Write the flushed LSN to the page header of the first page in the system tablespace. @@ -967,8 +916,6 @@ private: fil_space_t* m_space; }; -#endif /* !UNIV_HOTBACKUP */ - /********************************************************//** Creates the database directory for a table if it does not exist yet. */ void @@ -1068,7 +1015,7 @@ fil_close_tablespace( /*=================*/ trx_t* trx, /*!< in/out: Transaction covering the close */ ulint id); /*!< in: space id */ -#ifndef UNIV_HOTBACKUP + /*******************************************************************//** Discards a single-table tablespace. The tablespace must be cached in the memory cache. Discarding is like deleting a tablespace, but @@ -1088,7 +1035,6 @@ fil_discard_tablespace( /*===================*/ ulint id) /*!< in: space id */ MY_ATTRIBUTE((warn_unused_result)); -#endif /* !UNIV_HOTBACKUP */ /** Test if a tablespace file can be renamed to a new filepath by checking if that the old filepath exists and the new filepath does not exist. @@ -1234,7 +1180,6 @@ fil_file_readdir_next_file( os_file_dir_t dir, /*!< in: directory stream */ os_file_stat_t* info); /*!< in/out: buffer where the info is returned */ -#ifndef UNIV_HOTBACKUP /*******************************************************************//** Returns true if a matching tablespace exists in the InnoDB tablespace memory cache. Note that if we have not done a crash recovery at the database startup, @@ -1256,16 +1201,7 @@ fil_space_for_table_exists_in_mem( mem_heap_t* heap, /*!< in: heap memory */ table_id_t table_id, /*!< in: table id */ dict_table_t* table); /*!< in: table or NULL */ -#else /* !UNIV_HOTBACKUP */ -/********************************************************************//** -Extends all tablespaces to the size stored in the space header. During the -mysqlbackup --apply-log phase we extended the spaces on-demand so that log -records could be appllied, but that may have left spaces still too small -compared to the size stored in the space header. */ -void -fil_extend_tablespaces_to_stored_len(void); -/*======================================*/ -#endif /* !UNIV_HOTBACKUP */ + /** Try to extend a tablespace if it is smaller than the specified size. @param[in,out] space tablespace @param[in] size desired size in pages @@ -1609,18 +1545,6 @@ fil_get_space_names( /*!< in/out: Vector for collecting the names. */ MY_ATTRIBUTE((warn_unused_result)); -/** Return the next fil_node_t in the current or next fil_space_t. -Once started, the caller must keep calling this until it returns NULL. -fil_space_acquire() and fil_space_release() are invoked here which -blocks a concurrent operation from dropping the tablespace. -@param[in] prev_node Pointer to the previous fil_node_t. -If NULL, use the first fil_space_t on fil_system->space_list. -@return pointer to the next fil_node_t. -@retval NULL if this was the last file node */ -const fil_node_t* -fil_node_next( - const fil_node_t* prev_node); - /** Generate redo log for swapping two .ibd files @param[in] old_table old table @param[in] new_table new table @@ -1809,14 +1733,14 @@ fil_names_clear( lsn_t lsn, bool do_write); -#if !defined(NO_FALLOCATE) && defined(UNIV_LINUX) +#ifdef UNIV_LINUX /** Try and enable FusionIO atomic writes. @param[in] file OS file handle @return true if successful */ bool fil_fusionio_enable_atomic_write(os_file_t file); -#endif /* !NO_FALLOCATE && UNIV_LINUX */ +#endif /* UNIV_LINUX */ /** Note that the file system where the file resides doesn't support PUNCH HOLE @param[in,out] node Node to set */ diff --git a/storage/innobase/include/fil0fil.ic b/storage/innobase/include/fil0fil.ic index ae350333a16..8f8a4194c0d 100644 --- a/storage/innobase/include/fil0fil.ic +++ b/storage/innobase/include/fil0fil.ic @@ -63,6 +63,8 @@ fil_get_page_type_name( return (const char*)"PAGE_COMPRESSED"; case FIL_PAGE_INDEX: return (const char*)"INDEX"; + case FIL_PAGE_RTREE: + return (const char*)"RTREE"; case FIL_PAGE_UNDO_LOG: return (const char*)"UNDO LOG"; case FIL_PAGE_INODE: @@ -130,6 +132,7 @@ fil_page_type_validate( if (!((page_type == FIL_PAGE_PAGE_COMPRESSED || page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED || page_type == FIL_PAGE_INDEX || + page_type == FIL_PAGE_RTREE || page_type == FIL_PAGE_UNDO_LOG || page_type == FIL_PAGE_INODE || page_type == FIL_PAGE_IBUF_FREE_LIST || @@ -169,6 +172,7 @@ fil_page_type_validate( ut_ad(page_type == FIL_PAGE_PAGE_COMPRESSED || page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED || page_type == FIL_PAGE_INDEX || + page_type == FIL_PAGE_RTREE || page_type == FIL_PAGE_UNDO_LOG || page_type == FIL_PAGE_INODE || page_type == FIL_PAGE_IBUF_FREE_LIST || diff --git a/storage/innobase/include/fil0pagecompress.h b/storage/innobase/include/fil0pagecompress.h index 4d27a61be64..d4cc54c7b2a 100644 --- a/storage/innobase/include/fil0pagecompress.h +++ b/storage/innobase/include/fil0pagecompress.h @@ -34,7 +34,7 @@ Created 11/12/2013 Jan Lindström jan.lindstrom@skysql.com Returns the page compression level flag of the space, or 0 if the space is not compressed. The tablespace must be cached in the memory cache. @return page compression level if page compressed, ULINT_UNDEFINED if space not found */ -UNIV_INTERN +UNIV_INLINE ulint fil_space_get_page_compression_level( /*=================================*/ @@ -43,7 +43,7 @@ fil_space_get_page_compression_level( Returns the page compression flag of the space, or false if the space is not compressed. The tablespace must be cached in the memory cache. @return true if page compressed, false if not or space not found */ -UNIV_INTERN +UNIV_INLINE bool fil_space_is_page_compressed( /*=========================*/ @@ -61,7 +61,7 @@ fil_space_get_page_compressed( Returns the atomic writes flag of the space, or false if the space is not using atomic writes. The tablespace must be cached in the memory cache. @return atomic write table option value */ -UNIV_INTERN +UNIV_INLINE atomic_writes_t fil_space_get_atomic_writes( /*=========================*/ @@ -118,11 +118,10 @@ fil_node_get_space_id( /****************************************************************//** Get block size from fil node @return block size*/ -UNIV_INTERN +UNIV_INLINE ulint fil_node_get_block_size( /*====================*/ fil_node_t* node); /*!< in: Node where to get block size */ - #endif diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h index 3709c4a4f24..f503580a1a7 100644 --- a/storage/innobase/include/fsp0fsp.h +++ b/storage/innobase/include/fsp0fsp.h @@ -48,7 +48,7 @@ Created 12/18/1995 Heikki Tuuri + FSP_FLAGS_WIDTH_PAGE_SSIZE) /** Bit mask of the DATA_DIR field */ #define FSP_FLAGS_MASK_DATA_DIR_ORACLE \ - ((~(~0 << FSP_FLAGS_WIDTH_DATA_DIR)) \ + ((~(~0U << FSP_FLAGS_WIDTH_DATA_DIR)) \ << FSP_FLAGS_POS_DATA_DIR_ORACLE) #define FSP_FLAGS_HAS_DATA_DIR_ORACLE(flags) \ @@ -361,6 +361,16 @@ fsp_header_get_encryption_key( byte* iv, page_t* page); +/** Get the byte offset of encryption information in page 0. +@param[in] ps page size +@return byte offset relative to FSP_HEADER_OFFSET */ +inline MY_ATTRIBUTE((pure, warn_unused_result)) +ulint +fsp_header_get_encryption_offset(const page_size_t& ps) +{ + return XDES_ARR_OFFSET + XDES_SIZE * ps.physical() / FSP_EXTENT_SIZE; +} + /** Check the encryption key from the first page of a tablespace. @param[in] fsp_flags tablespace flags @param[in] page first page of a tablespace @@ -770,20 +780,6 @@ xdes_calc_descriptor_page( const page_size_t& page_size, ulint offset); -#endif /* !UNIV_INNOCHECKSUM */ - -/*********************************************************************//** -@return offset into fsp header where crypt data is stored */ -UNIV_INTERN -ulint -fsp_header_get_crypt_offset( -/*========================*/ - const page_size_t& page_size,/*!< in: page size */ - ulint* max_size); /*!< out: free space after offset */ - - -#ifndef UNIV_INNOCHECKSUM - /**********************************************************************//** Checks if a single page is free. @return true if free */ diff --git a/storage/innobase/include/fsp0fsp.ic b/storage/innobase/include/fsp0fsp.ic index 475dd238728..c675c6302a6 100644 --- a/storage/innobase/include/fsp0fsp.ic +++ b/storage/innobase/include/fsp0fsp.ic @@ -337,15 +337,4 @@ xdes_calc_descriptor_page( return(ut_2pow_round(offset, page_size.physical())); } - -/** Calculates the descriptor array size. -@param[in] page_size page size -@return size of descriptor array */ -UNIV_INLINE -ulint -xdes_arr_size( - const page_size_t& page_size) -{ - return(page_size.physical()/FSP_EXTENT_SIZE); -} #endif /* !UNIV_INNOCHECKSUM */ diff --git a/storage/innobase/include/fsp0space.h b/storage/innobase/include/fsp0space.h index 603c71b4aa6..31a1a4abc75 100644 --- a/storage/innobase/include/fsp0space.h +++ b/storage/innobase/include/fsp0space.h @@ -219,7 +219,10 @@ public: /** Check if undo tablespace. @return true if undo tablespace */ - static bool is_undo_tablespace(ulint id); + static bool is_undo_tablespace(ulint id) + { + return(id <= srv_undo_tablespaces_open); + } private: /** @param[in] filename Name to lookup in the data files. diff --git a/storage/innobase/include/fsp0sysspace.h b/storage/innobase/include/fsp0sysspace.h index 226d53ebd50..4c88b268f34 100644 --- a/storage/innobase/include/fsp0sysspace.h +++ b/storage/innobase/include/fsp0sysspace.h @@ -152,15 +152,6 @@ public: * ((1024 * 1024) / UNIV_PAGE_SIZE)); } - /** Roundoff to MegaBytes is similar as done in - SysTablespace::parse_units() function. - @return the pages when given size of file (bytes). */ - ulint get_pages_from_size(os_offset_t size) - { - return (ulint)((size / (1024 * 1024)) - * ((1024 * 1024) / UNIV_PAGE_SIZE)); - } - /** @return next increment size */ ulint get_increment() const; @@ -291,11 +282,9 @@ extern SysTablespace srv_tmp_space; @return true if id is a system tablespace, false if not. */ UNIV_INLINE bool -is_system_tablespace( - ulint id) +is_system_tablespace(ulint id) { - return(id == srv_sys_space.space_id() - || id == srv_tmp_space.space_id()); + return(id == TRX_SYS_SPACE || id == SRV_TMP_SPACE_ID); } /** Check if shared-system or undo tablespace. @@ -305,8 +294,7 @@ bool is_system_or_undo_tablespace( ulint id) { - return(id == srv_sys_space.space_id() - || id <= srv_undo_tablespaces_open); + return(id <= srv_undo_tablespaces_open); } /** Check if predefined shared tablespace. @@ -319,6 +307,6 @@ is_predefined_tablespace( ut_ad(srv_sys_space.space_id() == TRX_SYS_SPACE); ut_ad(TRX_SYS_SPACE == 0); return(id <= srv_undo_tablespaces_open - || id == srv_tmp_space.space_id()); + || id == SRV_TMP_SPACE_ID); } #endif /* fsp0sysspace_h */ diff --git a/storage/innobase/include/fsp0types.h b/storage/innobase/include/fsp0types.h index 73fd6341d94..c264fe1b595 100644 --- a/storage/innobase/include/fsp0types.h +++ b/storage/innobase/include/fsp0types.h @@ -29,6 +29,12 @@ Created May 26, 2009 Vasil Dimov #ifndef UNIV_INNOCHECKSUM +/** The fil_space_t::id of the redo log. All persistent tablespaces +have a smaller fil_space_t::id. */ +#define SRV_LOG_SPACE_FIRST_ID 0xFFFFFFF0U +/** The fil_space_t::id of the innodb_temporary tablespace. */ +#define SRV_TMP_SPACE_ID 0xFFFFFFFEU + #include "univ.i" #include "ut0byte.h" @@ -196,9 +202,12 @@ fsp_flags_is_valid( /** Check if tablespace is system temporary. @param[in] space_id verify is checksum is enabled for given space. @return true if tablespace is system temporary. */ +inline bool -fsp_is_system_temporary( - ulint space_id); +fsp_is_system_temporary(ulint space_id) +{ + return(space_id == SRV_TMP_SPACE_ID); +} /** Check if checksum is disabled for the given space. @param[in] space_id verify is checksum is enabled for given space. @@ -275,7 +284,7 @@ is a tablespace with encryption. */ + FSP_FLAGS_WIDTH_ATOMIC_WRITES ) /** A mask of all the known/used bits in tablespace flags */ -#define FSP_FLAGS_MASK (~(~0 << FSP_FLAGS_WIDTH)) +#define FSP_FLAGS_MASK (~(~0U << FSP_FLAGS_WIDTH)) /** Zero relative shift position of the POST_ANTELOPE field */ #define FSP_FLAGS_POS_POST_ANTELOPE 0 @@ -348,15 +357,15 @@ is a tablespace with encryption. */ << FSP_FLAGS_POS_ENCRYPTION) /** Bit mask of the PAGE_COMPRESSION field */ #define FSP_FLAGS_MASK_PAGE_COMPRESSION \ - ((~(~0 << FSP_FLAGS_WIDTH_PAGE_COMPRESSION)) \ + ((~(~0U << FSP_FLAGS_WIDTH_PAGE_COMPRESSION)) \ << FSP_FLAGS_POS_PAGE_COMPRESSION) /** Bit mask of the PAGE_COMPRESSION_LEVEL field */ #define FSP_FLAGS_MASK_PAGE_COMPRESSION_LEVEL \ - ((~(~0 << FSP_FLAGS_WIDTH_PAGE_COMPRESSION_LEVEL)) \ + ((~(~0U << FSP_FLAGS_WIDTH_PAGE_COMPRESSION_LEVEL)) \ << FSP_FLAGS_POS_PAGE_COMPRESSION_LEVEL) /** Bit mask of the ATOMIC_WRITES field */ #define FSP_FLAGS_MASK_ATOMIC_WRITES \ - ((~(~0 << FSP_FLAGS_WIDTH_ATOMIC_WRITES)) \ + ((~(~0U << FSP_FLAGS_WIDTH_ATOMIC_WRITES)) \ << FSP_FLAGS_POS_ATOMIC_WRITES) /** Return the value of the POST_ANTELOPE field */ diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h index 2d256472ef6..c6b39bce286 100644 --- a/storage/innobase/include/fts0fts.h +++ b/storage/innobase/include/fts0fts.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2016, MariaDB Corporation. All Rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -103,8 +104,8 @@ those defined in mysql file ft_global.h */ should not exceed FTS_DOC_ID_MAX_STEP */ #define FTS_DOC_ID_MAX_STEP 65535 -/** Maximum possible Fulltext word length */ -#define FTS_MAX_WORD_LEN HA_FT_MAXBYTELEN +/** Maximum possible Fulltext word length in bytes (assuming mbmaxlen=4) */ +#define FTS_MAX_WORD_LEN (HA_FT_MAXCHARLEN * 4) /** Maximum possible Fulltext word length (in characters) */ #define FTS_MAX_WORD_LEN_IN_CHAR HA_FT_MAXCHARLEN @@ -120,7 +121,6 @@ should not exceed FTS_DOC_ID_MAX_STEP */ #define FTS_CONFIG_TABLE_KEY_COL_LEN 50 #define FTS_CONFIG_TABLE_VALUE_COL_LEN 200 -#define FTS_INDEX_WORD_LEN FTS_MAX_WORD_LEN #define FTS_INDEX_FIRST_DOC_ID_LEN 8 #define FTS_INDEX_LAST_DOC_ID_LEN 8 #define FTS_INDEX_DOC_COUNT_LEN 4 diff --git a/storage/innobase/include/fut0lst.h b/storage/innobase/include/fut0lst.h index 9c980d1358d..e29973c1696 100644 --- a/storage/innobase/include/fut0lst.h +++ b/storage/innobase/include/fut0lst.h @@ -48,7 +48,7 @@ typedef byte flst_node_t; /* The physical size of a list node in bytes */ #define FLST_NODE_SIZE (2 * FIL_ADDR_SIZE) -#if !defined UNIV_HOTBACKUP && !defined UNIV_INNOCHECKSUM +#ifndef UNIV_INNOCHECKSUM /********************************************************************//** Initializes a list base node. */ UNIV_INLINE @@ -204,6 +204,6 @@ flst_print( #include "fut0lst.ic" #endif -#endif /* !UNIV_HOTBACKUP && !UNIV_INNOCHECKSUM*/ +#endif /* !UNIV_INNOCHECKSUM */ #endif diff --git a/storage/innobase/include/ha0ha.h b/storage/innobase/include/ha0ha.h index 15a99ddf683..6857670a01b 100644 --- a/storage/innobase/include/ha0ha.h +++ b/storage/innobase/include/ha0ha.h @@ -174,7 +174,7 @@ ha_search_and_delete_if_found( hash_table_t* table, /*!< in: hash table */ ulint fold, /*!< in: folded value of the searched data */ const rec_t* data); /*!< in: pointer to the data */ -#ifndef UNIV_HOTBACKUP + /*****************************************************************//** Removes from the chain determined by fold all nodes whose data pointer points to the page given. */ @@ -202,7 +202,6 @@ ha_print_info( /*==========*/ FILE* file, /*!< in: file where to print */ hash_table_t* table); /*!< in: hash table */ -#endif /* !UNIV_HOTBACKUP */ /** The hash table external chain node */ struct ha_node_t { diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h index f3641f93681..c10644be832 100644 --- a/storage/innobase/include/ha_prototypes.h +++ b/storage/innobase/include/ha_prototypes.h @@ -31,7 +31,7 @@ simple headers. #include "univ.i" -#if !defined UNIV_HOTBACKUP && !defined UNIV_INNOCHECKSUM +#ifndef UNIV_INNOCHECKSUM /* Forward declarations */ class THD; @@ -52,7 +52,6 @@ struct fts_string_t; #undef MYSQL_SPATIAL_INDEX #undef MYSQL_STORE_FTS_DOC_ID #undef MYSQL_TABLESPACES -#undef MYSQL_VIRTUAL_COLUMNS /*********************************************************************//** Wrapper around MySQL's copy_and_convert function. @@ -654,5 +653,20 @@ buffer pool size. void innodb_set_buf_pool_size(ulonglong buf_pool_size); -#endif /* !UNIV_HOTBACKUP && !UNIV_INNOCHECKSUM */ +/** Create a MYSQL_THD for background purge threads and mark it as such. +@returns new MYSQL_THD */ +MYSQL_THD +innobase_create_background_thd(); + +/** Destroy a background purge thread THD. +@param[in] thd MYSQL_THD to destroy */ +void +innobase_destroy_background_thd(MYSQL_THD); + +/** Close opened tables, free memory, delete items for a MYSQL_THD. +@param[in] thd MYSQL_THD to reset */ +void +innobase_reset_background_thd(MYSQL_THD); + +#endif /* !UNIV_INNOCHECKSUM */ #endif /* HA_INNODB_PROTOTYPES_H */ diff --git a/storage/innobase/include/hash0hash.h b/storage/innobase/include/hash0hash.h index a7bcee1185b..2922d424d37 100644 --- a/storage/innobase/include/hash0hash.h +++ b/storage/innobase/include/hash0hash.h @@ -28,9 +28,7 @@ Created 5/20/1997 Heikki Tuuri #include "univ.i" #include "mem0mem.h" -#ifndef UNIV_HOTBACKUP -# include "sync0rw.h" -#endif /* !UNIV_HOTBACKUP */ +#include "sync0rw.h" struct hash_table_t; struct hash_cell_t; @@ -60,7 +58,7 @@ hash_table_t* hash_create( /*========*/ ulint n); /*!< in: number of array cells */ -#ifndef UNIV_HOTBACKUP + /*************************************************************//** Creates a sync object array array to protect a hash table. ::sync_obj can be mutexes or rw_locks depening on the type of @@ -74,7 +72,6 @@ hash_create_sync_obj( latch_id_t id, /*!< in: mutex/rw_lock ID */ ulint n_sync_obj);/*!< in: number of sync objects, must be a power of 2 */ -#endif /* !UNIV_HOTBACKUP */ /*************************************************************//** Frees a hash table. */ @@ -91,15 +88,11 @@ hash_calc_hash( /*===========*/ ulint fold, /*!< in: folded value */ hash_table_t* table); /*!< in: hash table */ -#ifndef UNIV_HOTBACKUP /********************************************************************//** Assert that the mutex for the table is held */ -# define HASH_ASSERT_OWN(TABLE, FOLD) \ +#define HASH_ASSERT_OWN(TABLE, FOLD) \ ut_ad((TABLE)->type != HASH_TABLE_SYNC_MUTEX \ || (mutex_own(hash_get_mutex((TABLE), FOLD)))); -#else /* !UNIV_HOTBACKUP */ -# define HASH_ASSERT_OWN(TABLE, FOLD) -#endif /* !UNIV_HOTBACKUP */ /*******************************************************************//** Inserts a struct to a hash table. */ @@ -337,7 +330,6 @@ do {\ mem_heap_free_top(hash_get_heap(TABLE, fold111), sizeof(TYPE));\ } while (0) -#ifndef UNIV_HOTBACKUP /****************************************************************//** Move all hash table entries from OLD_TABLE to NEW_TABLE. */ @@ -537,22 +529,6 @@ hash_unlock_x_all_but( hash_table_t* table, /*!< in: hash table */ rw_lock_t* keep_lock); /*!< in: lock to keep */ -#else /* !UNIV_HOTBACKUP */ -# define hash_get_heap(table, fold) ((table)->heap) -# define hash_mutex_enter(table, fold) ((void) 0) -# define hash_mutex_exit(table, fold) ((void) 0) -# define hash_mutex_enter_all(table) ((void) 0) -# define hash_mutex_exit_all(table) ((void) 0) -# define hash_mutex_exit_all_but(t, m) ((void) 0) -# define hash_lock_s(t, f) ((void) 0) -# define hash_lock_x(t, f) ((void) 0) -# define hash_unlock_s(t, f) ((void) 0) -# define hash_unlock_x(t, f) ((void) 0) -# define hash_lock_x_all(t) ((void) 0) -# define hash_unlock_x_all(t) ((void) 0) -# define hash_unlock_x_all_but(t, l) ((void) 0) -#endif /* !UNIV_HOTBACKUP */ - struct hash_cell_t{ void* node; /*!< hash chain node, NULL if none */ }; @@ -561,15 +537,13 @@ struct hash_cell_t{ struct hash_table_t { enum hash_table_sync_t type; /*n_cells)); } -#ifndef UNIV_HOTBACKUP /************************************************************//** Gets the sync object index for a fold value in a hash table. @return index */ @@ -276,4 +275,3 @@ hash_lock_x_confirm( return(hash_lock); } -#endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/include/ib0mutex.h b/storage/innobase/include/ib0mutex.h index 3ea0687da43..9f4ad8424f3 100644 --- a/storage/innobase/include/ib0mutex.h +++ b/storage/innobase/include/ib0mutex.h @@ -31,6 +31,7 @@ Created 2013-03-26 Sunny Bains. #include "ut0ut.h" #include "ut0rnd.h" #include "os0event.h" +#include "sync0arr.h" /** OS mutex for tracking lock/unlock for debugging */ template